[Pkg-cli-apps-commits] [fsharp] 19/71: tests for F# 3.1

Christopher Halse Rogers raof-guest at moszumanska.debian.org
Fri Jan 17 05:18:10 UTC 2014


This is an automated email from the git hooks/post-receive script.

raof-guest pushed a commit to tag 3.1.0
in repository fsharp.

commit f95cef44a44a9f260e562bcbb6127b4395c4b925
Author: Don Syme <donsyme at fastmail.fm>
Date:   Thu Nov 28 14:54:02 2013 +0000

    tests for F# 3.1
---
 tests/ChompErr.bat                                 |   31 +
 tests/build-and-run.bat                            |   52 +
 tests/build.bat                                    |   37 +
 tests/config.bat                                   |  288 +
 tests/fsharp/DecidePEVerify.ps1                    |   18 +
 tests/fsharp/PickPermutations.ps1                  |   31 +
 tests/fsharp/core/access/build.bat                 |    6 +
 tests/fsharp/core/access/run.bat                   |    7 +
 tests/fsharp/core/access/test.fsx                  |  269 +
 tests/fsharp/core/apporder/build.bat               |    6 +
 tests/fsharp/core/apporder/run.bat                 |    7 +
 tests/fsharp/core/apporder/test.fsx                |  938 ++
 tests/fsharp/core/array/build.bat                  |    6 +
 tests/fsharp/core/array/run.bat                    |   15 +
 tests/fsharp/core/array/test.fsx                   | 1320 +++
 tests/fsharp/core/attributes/build.bat             |    6 +
 tests/fsharp/core/attributes/cslib.cs              |   54 +
 tests/fsharp/core/attributes/cslib.dll             |  Bin 0 -> 4096 bytes
 .../core/attributes/dont.use.empty.signature       |    1 +
 .../core/attributes/dont.use.generated.signature   |    1 +
 .../core/attributes/dont.use.wrapper.namespace     |    1 +
 tests/fsharp/core/attributes/run.bat               |    7 +
 tests/fsharp/core/attributes/test.fsx              | 1315 +++
 tests/fsharp/core/attributes/testlib.fs            |  118 +
 tests/fsharp/core/attributes/testlib.fsi           |  102 +
 tests/fsharp/core/comprehensions/build.bat         |    6 +
 tests/fsharp/core/comprehensions/run.bat           |    7 +
 tests/fsharp/core/comprehensions/test-hw.fsx       | 1049 +++
 tests/fsharp/core/comprehensions/test.fsx          | 1482 ++++
 tests/fsharp/core/control/build.bat                |    6 +
 tests/fsharp/core/control/repeat.bat               |   13 +
 tests/fsharp/core/control/run.bat                  |    8 +
 tests/fsharp/core/control/test.fsx                 | 2065 +++++
 tests/fsharp/core/controlChamenos/build.bat        |    6 +
 tests/fsharp/core/controlChamenos/run.bat          |    8 +
 tests/fsharp/core/controlChamenos/test.fsx         |  150 +
 tests/fsharp/core/controlMailbox/build.bat         |    6 +
 tests/fsharp/core/controlMailbox/repeat.bat        |   13 +
 tests/fsharp/core/controlMailbox/run.bat           |    8 +
 tests/fsharp/core/controlMailbox/test.fsx          |  644 ++
 tests/fsharp/core/controlStackOverflow/build.bat   |    6 +
 tests/fsharp/core/controlStackOverflow/run.bat     |    8 +
 tests/fsharp/core/controlStackOverflow/test.fsx    |  436 +
 tests/fsharp/core/controlWebExt/build.bat          |    6 +
 tests/fsharp/core/controlWebExt/run.bat            |    7 +
 tests/fsharp/core/controlWebExt/test.fsx           |  162 +
 tests/fsharp/core/controlWpf/build.bat             |    6 +
 tests/fsharp/core/controlWpf/dont.pipe.to.stdin    |    1 +
 tests/fsharp/core/controlWpf/run.bat               |    6 +
 tests/fsharp/core/controlWpf/test.fsx              |   39 +
 tests/fsharp/core/csext/System.Core.dll            |  Bin 0 -> 663552 bytes
 tests/fsharp/core/csext/build.bat                  |    6 +
 tests/fsharp/core/csext/run.bat                    |    7 +
 tests/fsharp/core/csext/test.fsx                   |   53 +
 tests/fsharp/core/csfromfs/Excel.dll               |  Bin 0 -> 1273856 bytes
 tests/fsharp/core/csfromfs/ProtectedMethodOpt.cs   |    8 +
 tests/fsharp/core/csfromfs/ProtectedMethodOpt.fs   |   11 +
 tests/fsharp/core/csfromfs/build.bat               |  212 +
 tests/fsharp/core/csfromfs/byrefs.cs               |   64 +
 tests/fsharp/core/csfromfs/byrefs.fs               |  113 +
 tests/fsharp/core/csfromfs/classes.cs              |  198 +
 tests/fsharp/core/csfromfs/classes.fs              |  353 +
 tests/fsharp/core/csfromfs/collections.fs          |   38 +
 tests/fsharp/core/csfromfs/events.cs               |   39 +
 tests/fsharp/core/csfromfs/events.fs               |   74 +
 tests/fsharp/core/csfromfs/fields.cs               |   50 +
 tests/fsharp/core/csfromfs/fields.fs               |  114 +
 tests/fsharp/core/csfromfs/generics.cs             |  610 ++
 tests/fsharp/core/csfromfs/indexers.cs             |   75 +
 tests/fsharp/core/csfromfs/indexers.fs             |   33 +
 tests/fsharp/core/csfromfs/lib.cs                  |  846 ++
 tests/fsharp/core/csfromfs/methods.cs              |  348 +
 tests/fsharp/core/csfromfs/methods.fs              |  150 +
 tests/fsharp/core/csfromfs/nested-types-error.bsl  |   18 +
 tests/fsharp/core/csfromfs/nested-types-error.fs   |   30 +
 tests/fsharp/core/csfromfs/nested-types.cs         |   80 +
 tests/fsharp/core/csfromfs/nested-types.fs         |   32 +
 tests/fsharp/core/csfromfs/optional.fs             |  114 +
 tests/fsharp/core/csfromfs/properties.cs           |  214 +
 tests/fsharp/core/csfromfs/properties.fs           |  124 +
 tests/fsharp/core/csfromfs/run.bat                 |   74 +
 tests/fsharp/core/csfromfs/test.fs                 |   81 +
 tests/fsharp/core/events/build.bat                 |   46 +
 tests/fsharp/core/events/run.bat                   |   38 +
 tests/fsharp/core/events/test.fs                   |  552 ++
 tests/fsharp/core/events/testcs.cs                 |   42 +
 tests/fsharp/core/forwarders/a.cs                  |   71 +
 tests/fsharp/core/forwarders/b.cs                  |   22 +
 tests/fsharp/core/forwarders/build.bat             |   75 +
 tests/fsharp/core/forwarders/c.fs                  |   22 +
 tests/fsharp/core/forwarders/test.fs               |   29 +
 tests/fsharp/core/fsfromcs/CsClient.csproj         |   53 +
 tests/fsharp/core/fsfromcs/build.bat               |   50 +
 tests/fsharp/core/fsfromcs/lib.ml                  |   74 +
 tests/fsharp/core/fsfromcs/run.bat                 |   33 +
 tests/fsharp/core/fsfromcs/test.cs                 |  290 +
 tests/fsharp/core/fsfromfsviacs/build.bat          |   46 +
 tests/fsharp/core/fsfromfsviacs/lib.ml             |   46 +
 tests/fsharp/core/fsfromfsviacs/lib2.cs            |   37 +
 tests/fsharp/core/fsfromfsviacs/run.bat            |   31 +
 tests/fsharp/core/fsfromfsviacs/test.fsx           |   54 +
 tests/fsharp/core/fsi-reload/build.bat             |   20 +
 tests/fsharp/core/fsi-reload/run.bat               |   30 +
 tests/fsharp/core/fsi-reload/test1.ml              |   77 +
 tests/fsharp/core/fsi-reload/test1a.ml             |   15 +
 tests/fsharp/core/fsi-reload/test1b.ml             |   18 +
 tests/fsharp/core/fsiAndModifiers/build.bat        |   18 +
 tests/fsharp/core/fsiAndModifiers/prepare.fsx      |   34 +
 tests/fsharp/core/fsiAndModifiers/run.bat          |   30 +
 tests/fsharp/core/fsiAndModifiers/test.fsx         |    4 +
 tests/fsharp/core/genericmeasures/build.bat        |    5 +
 tests/fsharp/core/genericmeasures/run.bat          |    5 +
 tests/fsharp/core/genericmeasures/test.fsx         |   61 +
 tests/fsharp/core/hiding/build.bat                 |   54 +
 tests/fsharp/core/hiding/client.ml                 |   23 +
 tests/fsharp/core/hiding/lib.ml                    |   14 +
 tests/fsharp/core/hiding/lib.mli                   |   11 +
 tests/fsharp/core/hiding/lib2.ml                   |   13 +
 tests/fsharp/core/hiding/lib2.mli                  |   11 +
 tests/fsharp/core/hiding/lib3.ml                   |   22 +
 tests/fsharp/core/hiding/libv.ml                   |   15 +
 tests/fsharp/core/innerpoly/build.bat              |    6 +
 tests/fsharp/core/innerpoly/run.bat                |    7 +
 tests/fsharp/core/innerpoly/test.fsx               |  392 +
 tests/fsharp/core/int32/build.bat                  |    5 +
 tests/fsharp/core/int32/run.bat                    |    5 +
 tests/fsharp/core/int32/test.fsx                   |  400 +
 tests/fsharp/core/internalsvisible/build.bat       |   61 +
 tests/fsharp/core/internalsvisible/key.snk         |  Bin 0 -> 596 bytes
 tests/fsharp/core/internalsvisible/library.fs      |   26 +
 tests/fsharp/core/internalsvisible/library.fsi     |   14 +
 tests/fsharp/core/internalsvisible/librarycs.cs    |   19 +
 tests/fsharp/core/internalsvisible/main.fs         |   30 +
 tests/fsharp/core/lazy/build.bat                   |    6 +
 tests/fsharp/core/lazy/run.bat                     |    7 +
 tests/fsharp/core/lazy/test.fsx                    |   85 +
 tests/fsharp/core/letrec/build.bat                 |    6 +
 tests/fsharp/core/letrec/run.bat                   |    6 +
 tests/fsharp/core/letrec/test.fsx                  |  656 ++
 tests/fsharp/core/libtest/build.bat                |    6 +
 tests/fsharp/core/libtest/run.bat                  |   13 +
 tests/fsharp/core/libtest/test.fsx                 | 5124 +++++++++++
 tests/fsharp/core/lift/build.bat                   |    6 +
 tests/fsharp/core/lift/run.bat                     |    6 +
 tests/fsharp/core/lift/test.fsx                    |   69 +
 tests/fsharp/core/load-script/1.fsx                |    2 +
 tests/fsharp/core/load-script/2.fsx                |    3 +
 tests/fsharp/core/load-script/3.fsx                |    3 +
 tests/fsharp/core/load-script/FlagCheck.fs         |    8 +
 tests/fsharp/core/load-script/FlagCheck.fsx        |    7 +
 tests/fsharp/core/load-script/ProjectDriver.fsx    |   11 +
 tests/fsharp/core/load-script/ProjectFile.fs       |    4 +
 tests/fsharp/core/load-script/ThisProject.fsx      |    4 +
 tests/fsharp/core/load-script/build.bat            |   53 +
 tests/fsharp/core/load-script/load-FlagCheckFs.fsx |    3 +
 tests/fsharp/core/load-script/multiple-load-1.fsx  |    2 +
 tests/fsharp/core/load-script/multiple-load-2.fsx  |    2 +
 tests/fsharp/core/load-script/out.bsl              |   77 +
 tests/fsharp/core/load-script/pipescr              |    2 +
 tests/fsharp/core/load-script/script.bat           |   45 +
 tests/fsharp/core/load-script/usesfsi.fsx          |    2 +
 tests/fsharp/core/longnames/build.bat              |    6 +
 .../core/longnames/dont.use.generated.signature    |    1 +
 tests/fsharp/core/longnames/run.bat                |    7 +
 tests/fsharp/core/longnames/test.fsx               |  422 +
 tests/fsharp/core/map/build.bat                    |    6 +
 tests/fsharp/core/map/run.bat                      |    7 +
 tests/fsharp/core/map/test.fsx                     |  172 +
 tests/fsharp/core/math/lalgebra/test.fsx           |  308 +
 tests/fsharp/core/math/lapack/LAPACK.dll           |  Bin 0 -> 2936832 bytes
 tests/fsharp/core/math/lapack/blas.dll             |  Bin 0 -> 421888 bytes
 tests/fsharp/core/math/lapack/build.bat            |    6 +
 tests/fsharp/core/math/lapack/dont.run.peverify    |    1 +
 .../core/math/lapack/dont.use.wrapper.namespace    |    1 +
 tests/fsharp/core/math/lapack/run.bat              |    7 +
 tests/fsharp/core/math/lapack/test.fsx             |   75 +
 tests/fsharp/core/math/numbers/build.bat           |    6 +
 tests/fsharp/core/math/numbers/run.bat             |   10 +
 tests/fsharp/core/math/numbers/test.fsx            |  276 +
 tests/fsharp/core/math/numbersVS2008/build.bat     |    6 +
 tests/fsharp/core/math/numbersVS2008/run.bat       |   10 +
 tests/fsharp/core/math/numbersVS2008/test.fsx      |  259 +
 tests/fsharp/core/math/tdirs                       |    3 +
 tests/fsharp/core/measures/build.bat               |    5 +
 tests/fsharp/core/measures/run.bat                 |    5 +
 tests/fsharp/core/measures/test.fsx                |  616 ++
 tests/fsharp/core/members/absil.fs                 |   49 +
 tests/fsharp/core/members/absil.fsi                | 1859 ++++
 tests/fsharp/core/members/basics/build.bat         |    6 +
 tests/fsharp/core/members/basics/run.bat           |   14 +
 tests/fsharp/core/members/basics/test-hw.fsx       | 5577 ++++++++++++
 tests/fsharp/core/members/basics/test.fs           | 3366 +++++++
 tests/fsharp/core/members/basics/test.fsi          |  131 +
 tests/fsharp/core/members/console/console2.fs      |   72 +
 tests/fsharp/core/members/console/test.fsx         |   76 +
 tests/fsharp/core/members/ctree/build.bat          |    6 +
 tests/fsharp/core/members/ctree/run.bat            |    7 +
 tests/fsharp/core/members/ctree/test.fsx           |   52 +
 tests/fsharp/core/members/factors/build.bat        |    6 +
 .../members/factors/dont.use.generated.signature   |    1 +
 tests/fsharp/core/members/factors/run.bat          |   14 +
 tests/fsharp/core/members/factors/test.fsx         |  266 +
 tests/fsharp/core/members/incremental/build.bat    |    6 +
 .../incremental/dont.use.generated.signature       |    1 +
 tests/fsharp/core/members/incremental/run.bat      |   13 +
 tests/fsharp/core/members/incremental/test-hw.fsx  |  723 ++
 tests/fsharp/core/members/incremental/test.fsx     |  728 ++
 tests/fsharp/core/members/ops/build.bat            |    6 +
 tests/fsharp/core/members/ops/run.bat              |    7 +
 tests/fsharp/core/members/ops/test.fsx             |  577 ++
 tests/fsharp/core/members/stephen.ml               |  257 +
 tests/fsharp/core/members/tdirs                    |    6 +
 tests/fsharp/core/mscorlib/2.0/mscorlib.dll        |  Bin 0 -> 4366336 bytes
 tests/fsharp/core/mscorlib/3.5/mscorlib.dll        |  Bin 0 -> 4444160 bytes
 tests/fsharp/core/mscorlib/4.0/mscorlib.dll        |  Bin 0 -> 4934656 bytes
 .../mscorlib/Silverlight2.0.30523.8/mscorlib.dll   |  Bin 0 -> 1463296 bytes
 tests/fsharp/core/mscorlib/build.bat               |   62 +
 tests/fsharp/core/mscorlib/test.fsx                |   17 +
 tests/fsharp/core/namespaces/build.bat             |    6 +
 tests/fsharp/core/namespaces/dont.pipe.to.stdin    |    4 +
 tests/fsharp/core/namespaces/dont.run.as.script    |    1 +
 .../core/namespaces/dont.use.empty.signature       |    1 +
 .../core/namespaces/dont.use.generated.signature   |    1 +
 .../core/namespaces/dont.use.wrapper.namespace     |    1 +
 tests/fsharp/core/namespaces/run.bat               |    9 +
 tests/fsharp/core/namespaces/test.fs               |   79 +
 tests/fsharp/core/namespaces/test.fsi              |   26 +
 tests/fsharp/core/nested/build.bat                 |    6 +
 tests/fsharp/core/nested/run.bat                   |    7 +
 tests/fsharp/core/nested/test.fsx                  |   70 +
 .../core/netcore/ConsoleApplication1/Program.cs    |  112 +
 .../ConsoleApplication1/Properties/AssemblyInfo.cs |   36 +
 .../ConsoleApplication1/portabletestentry.csproj   |   69 +
 tests/fsharp/core/netcore/build.bat                |    6 +
 tests/fsharp/core/netcore/netcore.sln              |   46 +
 .../netcoreautomationhelperlibrary/Extensions.fs   |  120 +
 .../netcoreautomationhelperlibrary/Hooks.fs        |   34 +
 .../System.Diagnostics.fs                          |   24 +
 .../netcoreautomationhelperlibrary/System.IO.fs    |   51 +
 .../netcoreautomationhelperlibrary/System.fs       |   28 +
 .../netcoreautomationhelperlibrary.fsproj          |   66 +
 .../standardconsole.fs                             |   65 +
 .../core/netcore/netcorelibrary1/InitialHook.fs    |   32 +
 .../netcorelibrary1/netcoretestinglibrary.fsproj   |  170 +
 tests/fsharp/core/netcore/run.bat                  |   19 +
 tests/fsharp/core/parsing/build.bat                |   43 +
 tests/fsharp/core/parsing/crlf.ml                  |    2 +
 tests/fsharp/core/parsing/toplet.ml                |   15 +
 tests/fsharp/core/patterns/build.bat               |    6 +
 tests/fsharp/core/patterns/run.bat                 |    6 +
 tests/fsharp/core/patterns/test.fsx                | 1101 +++
 tests/fsharp/core/pinvoke/build.bat                |   37 +
 tests/fsharp/core/pinvoke/test.fsx                 |  247 +
 .../core/portable/ConsoleApplication1/Program.cs   |  112 +
 .../ConsoleApplication1/Properties/AssemblyInfo.cs |   36 +
 .../ConsoleApplication1/portabletestentry.csproj   |   69 +
 .../portabletestentry.csproj.vspscc                |   10 +
 tests/fsharp/core/portable/build.bat               |    6 +
 .../portableautomationhelperlibrary/Extensions.fs  |   30 +
 .../portableautomationhelperlibrary/Hooks.fs       |   34 +
 .../PortableAutomationHelperLibrary.fsproj.vspscc  |   10 +
 .../System.Diagnostics.fs                          |   24 +
 .../portableautomationhelperlibrary/System.IO.fs   |   51 +
 .../portableautomationhelperlibrary/System.fs      |   28 +
 .../portableautomationhelperlibrary.fsproj         |   65 +
 .../standardconsole.fs                             |   65 +
 tests/fsharp/core/portable/portablelibrary1.sln    |   48 +
 .../core/portable/portablelibrary1/InitialHook.fs  |   32 +
 .../PortableTestingLibrary.fsproj.vspscc           |   10 +
 .../portablelibrary1/portabletestinglibrary.fsproj |  103 +
 .../core/portable/portablelibrary1/script.fsx      |    6 +
 .../fsharp/core/portable/portablelibrary1/test.fsx | 1307 +++
 tests/fsharp/core/portable/run.bat                 |   19 +
 tests/fsharp/core/printf/build.bat                 |    8 +
 tests/fsharp/core/printf/run.bat                   |    8 +
 tests/fsharp/core/printf/test.fsx                  | 9154 ++++++++++++++++++++
 tests/fsharp/core/printing/build.bat               |   99 +
 .../fsharp/core/printing/preludePrintSize1000.fsx  |    3 +
 tests/fsharp/core/printing/preludePrintSize200.fsx |    3 +
 .../printing/preludeShowDeclarationValuesFalse.fsx |    3 +
 tests/fsharp/core/printing/test.fsx                |  926 ++
 tests/fsharp/core/printing/testLoadFile.fsx        |   10 +
 tests/fsharp/core/printing/testLoadFile2.fsx       |   10 +
 tests/fsharp/core/printing/z.output.test.1000.bsl  | 2994 +++++++
 tests/fsharp/core/printing/z.output.test.200.bsl   | 2243 +++++
 .../fsharp/core/printing/z.output.test.default.bsl | 6521 ++++++++++++++
 tests/fsharp/core/printing/z.output.test.off.bsl   | 2017 +++++
 tests/fsharp/core/printing/z.output.test.quiet.bsl |  288 +
 tests/fsharp/core/queriesCustomQueryOps/build.bat  |   50 +
 .../core/queriesCustomQueryOps/negativetest.bsl    |   14 +
 .../core/queriesCustomQueryOps/negativetest.fsx    |   68 +
 tests/fsharp/core/queriesCustomQueryOps/run.bat    |   53 +
 tests/fsharp/core/queriesCustomQueryOps/test.fsx   |  468 +
 .../core/queriesLeafExpressionConvert/build.bat    |   47 +
 .../core/queriesLeafExpressionConvert/run.bat      |   53 +
 .../core/queriesLeafExpressionConvert/test.fsx     | 1104 +++
 .../fsharp/core/queriesNullableOperators/build.bat |   47 +
 tests/fsharp/core/queriesNullableOperators/run.bat |   53 +
 .../fsharp/core/queriesNullableOperators/test.fsx  |  316 +
 tests/fsharp/core/queriesOverIEnumerable/build.bat |   47 +
 tests/fsharp/core/queriesOverIEnumerable/run.bat   |   53 +
 tests/fsharp/core/queriesOverIEnumerable/test.fsx  | 1011 +++
 tests/fsharp/core/queriesOverIQueryable/build.bat  |   47 +
 tests/fsharp/core/queriesOverIQueryable/run.bat    |   53 +
 tests/fsharp/core/queriesOverIQueryable/test.fsx   | 2477 ++++++
 .../queriesOverIQueryableLinqToEntities/build.bat  |   75 +
 .../queriesOverIQueryableLinqToEntities/run.bat    |   65 +
 .../test-part1.fs                                  |   67 +
 .../test-part2.fs                                  |  563 ++
 .../queriesOverIQueryableLinqToEntities/test.fsx   |  664 ++
 .../core/queriesOverIQueryableLinqToSql/build.bat  |   71 +
 .../core/queriesOverIQueryableLinqToSql/run.bat    |   67 +
 .../queriesOverIQueryableLinqToSql/test-part1.fs   |   59 +
 .../queriesOverIQueryableLinqToSql/test-part2.fs   |  558 ++
 .../core/queriesOverIQueryableLinqToSql/test.fsx   |  751 ++
 tests/fsharp/core/queriesOverOData/build.bat       |   70 +
 tests/fsharp/core/queriesOverOData/run.bat         |   79 +
 tests/fsharp/core/queriesOverOData/test.fsx        |  145 +
 tests/fsharp/core/quotes/build.bat                 |   47 +
 tests/fsharp/core/quotes/cslib.cs                  |    4 +
 tests/fsharp/core/quotes/cslib.dll                 |  Bin 0 -> 3072 bytes
 tests/fsharp/core/quotes/dont.use.empty.signature  |    1 +
 tests/fsharp/core/quotes/run.bat                   |   53 +
 tests/fsharp/core/quotes/test.fsx                  | 2415 ++++++
 tests/fsharp/core/quotesDebugInfo/build.bat        |   45 +
 tests/fsharp/core/quotesDebugInfo/run.bat          |   53 +
 tests/fsharp/core/quotesDebugInfo/test.fsx         |  647 ++
 .../fsharp/core/quotesInMultipleModules/build.bat  |   60 +
 .../core/quotesInMultipleModules/module1.fsx       |   11 +
 .../core/quotesInMultipleModules/module2.fsx       |    9 +
 tests/fsharp/core/quotesInMultipleModules/run.bat  |   53 +
 tests/fsharp/core/reflect/build.bat                |    6 +
 tests/fsharp/core/reflect/dont.pipe.to.stdin       |    4 +
 tests/fsharp/core/reflect/dont.use.empty.signature |    1 +
 .../core/reflect/dont.use.generated.signature      |    2 +
 tests/fsharp/core/reflect/run.bat                  |    7 +
 tests/fsharp/core/reflect/test.fs                  |   19 +
 tests/fsharp/core/reflect/test2.fs                 |  315 +
 tests/fsharp/core/resources/Icon1.ico              |  Bin 0 -> 1078 bytes
 tests/fsharp/core/resources/Image1.bmp             |  Bin 0 -> 3382 bytes
 tests/fsharp/core/resources/Resources.resx         |  134 +
 tests/fsharp/core/resources/TextFile1.txt          |    3 +
 tests/fsharp/core/resources/build.bat              |   63 +
 tests/fsharp/core/resources/chimes.wav             |  Bin 0 -> 55776 bytes
 tests/fsharp/core/resources/run.bat                |   42 +
 tests/fsharp/core/resources/test.fs                |   32 +
 tests/fsharp/core/seq/build.bat                    |    6 +
 tests/fsharp/core/seq/run.bat                      |   13 +
 tests/fsharp/core/seq/test.fsx                     |  500 ++
 tests/fsharp/core/subtype/build.bat                |    6 +
 tests/fsharp/core/subtype/run.bat                  |    7 +
 tests/fsharp/core/subtype/test.fsx                 | 1704 ++++
 tests/fsharp/core/syntax/build.bat                 |    6 +
 .../core/syntax/dont.use.generated.signature       |    1 +
 .../fsharp/core/syntax/dont.use.wrapper.namespace  |    1 +
 tests/fsharp/core/syntax/run.bat                   |    7 +
 tests/fsharp/core/syntax/test.fsx                  | 1802 ++++
 tests/fsharp/core/tdirs                            |   64 +
 tests/fsharp/core/tlr/build.bat                    |    6 +
 tests/fsharp/core/tlr/run.bat                      |    6 +
 tests/fsharp/core/tlr/test.fsx                     |  400 +
 tests/fsharp/core/topinit/app69514.fs              |    5 +
 tests/fsharp/core/topinit/build.bat                |  195 +
 .../core/topinit/flag_deterministic_init1.fs       |    3 +
 .../core/topinit/flag_deterministic_init10.fs      |    3 +
 .../core/topinit/flag_deterministic_init11.fs      |    3 +
 .../core/topinit/flag_deterministic_init12.fs      |    3 +
 .../core/topinit/flag_deterministic_init13.fs      |    3 +
 .../core/topinit/flag_deterministic_init14.fs      |    3 +
 .../core/topinit/flag_deterministic_init15.fs      |    3 +
 .../core/topinit/flag_deterministic_init16.fs      |    3 +
 .../core/topinit/flag_deterministic_init17.fs      |    3 +
 .../core/topinit/flag_deterministic_init18.fs      |    3 +
 .../core/topinit/flag_deterministic_init19.fs      |    3 +
 .../core/topinit/flag_deterministic_init2.fs       |    3 +
 .../core/topinit/flag_deterministic_init20.fs      |    3 +
 .../core/topinit/flag_deterministic_init21.fs      |    3 +
 .../core/topinit/flag_deterministic_init22.fs      |    3 +
 .../core/topinit/flag_deterministic_init23.fs      |    3 +
 .../core/topinit/flag_deterministic_init24.fs      |    3 +
 .../core/topinit/flag_deterministic_init25.fs      |    3 +
 .../core/topinit/flag_deterministic_init26.fs      |    3 +
 .../core/topinit/flag_deterministic_init27.fs      |    3 +
 .../core/topinit/flag_deterministic_init28.fs      |    3 +
 .../core/topinit/flag_deterministic_init29.fs      |    3 +
 .../core/topinit/flag_deterministic_init3.fs       |    3 +
 .../core/topinit/flag_deterministic_init30.fs      |    3 +
 .../core/topinit/flag_deterministic_init31.fs      |    3 +
 .../core/topinit/flag_deterministic_init32.fs      |    3 +
 .../core/topinit/flag_deterministic_init33.fs      |    3 +
 .../core/topinit/flag_deterministic_init34.fs      |    3 +
 .../core/topinit/flag_deterministic_init35.fs      |    3 +
 .../core/topinit/flag_deterministic_init36.fs      |    3 +
 .../core/topinit/flag_deterministic_init37.fs      |    3 +
 .../core/topinit/flag_deterministic_init38.fs      |    3 +
 .../core/topinit/flag_deterministic_init39.fs      |    3 +
 .../core/topinit/flag_deterministic_init4.fs       |    3 +
 .../core/topinit/flag_deterministic_init40.fs      |    3 +
 .../core/topinit/flag_deterministic_init41.fs      |    3 +
 .../core/topinit/flag_deterministic_init42.fs      |    3 +
 .../core/topinit/flag_deterministic_init43.fs      |    3 +
 .../core/topinit/flag_deterministic_init44.fs      |    3 +
 .../core/topinit/flag_deterministic_init45.fs      |    3 +
 .../core/topinit/flag_deterministic_init46.fs      |    3 +
 .../core/topinit/flag_deterministic_init47.fs      |    3 +
 .../core/topinit/flag_deterministic_init48.fs      |    3 +
 .../core/topinit/flag_deterministic_init49.fs      |    3 +
 .../core/topinit/flag_deterministic_init5.fs       |    3 +
 .../core/topinit/flag_deterministic_init50.fs      |    3 +
 .../core/topinit/flag_deterministic_init51.fs      |    3 +
 .../core/topinit/flag_deterministic_init52.fs      |    3 +
 .../core/topinit/flag_deterministic_init53.fs      |    3 +
 .../core/topinit/flag_deterministic_init54.fs      |    3 +
 .../core/topinit/flag_deterministic_init55.fs      |    3 +
 .../core/topinit/flag_deterministic_init56.fs      |    3 +
 .../core/topinit/flag_deterministic_init57.fs      |    3 +
 .../core/topinit/flag_deterministic_init58.fs      |    3 +
 .../core/topinit/flag_deterministic_init59.fs      |    3 +
 .../core/topinit/flag_deterministic_init6.fs       |    3 +
 .../core/topinit/flag_deterministic_init60.fs      |    3 +
 .../core/topinit/flag_deterministic_init61.fs      |    3 +
 .../core/topinit/flag_deterministic_init62.fs      |    3 +
 .../core/topinit/flag_deterministic_init63.fs      |    3 +
 .../core/topinit/flag_deterministic_init64.fs      |    3 +
 .../core/topinit/flag_deterministic_init65.fs      |    3 +
 .../core/topinit/flag_deterministic_init66.fs      |    3 +
 .../core/topinit/flag_deterministic_init67.fs      |    3 +
 .../core/topinit/flag_deterministic_init68.fs      |    3 +
 .../core/topinit/flag_deterministic_init69.fs      |    3 +
 .../core/topinit/flag_deterministic_init7.fs       |    3 +
 .../core/topinit/flag_deterministic_init70.fs      |    3 +
 .../core/topinit/flag_deterministic_init71.fs      |    3 +
 .../core/topinit/flag_deterministic_init72.fs      |    3 +
 .../core/topinit/flag_deterministic_init73.fs      |    3 +
 .../core/topinit/flag_deterministic_init74.fs      |    3 +
 .../core/topinit/flag_deterministic_init75.fs      |    3 +
 .../core/topinit/flag_deterministic_init76.fs      |    3 +
 .../core/topinit/flag_deterministic_init77.fs      |    3 +
 .../core/topinit/flag_deterministic_init78.fs      |    3 +
 .../core/topinit/flag_deterministic_init79.fs      |    3 +
 .../core/topinit/flag_deterministic_init8.fs       |    3 +
 .../core/topinit/flag_deterministic_init80.fs      |    3 +
 .../core/topinit/flag_deterministic_init81.fs      |    3 +
 .../core/topinit/flag_deterministic_init82.fs      |    3 +
 .../core/topinit/flag_deterministic_init83.fs      |    3 +
 .../core/topinit/flag_deterministic_init84.fs      |    3 +
 .../core/topinit/flag_deterministic_init85.fs      |    3 +
 .../core/topinit/flag_deterministic_init9.fs       |    3 +
 tests/fsharp/core/topinit/generate.fsx             |  142 +
 tests/fsharp/core/topinit/lib.ml                   |   13 +
 tests/fsharp/core/topinit/lib69514.fs              |   14 +
 tests/fsharp/core/topinit/lib69514.fsi             |   16 +
 .../fsharp/core/topinit/lib_deterministic_init1.fs |   12 +
 .../core/topinit/lib_deterministic_init10.fs       |   12 +
 .../core/topinit/lib_deterministic_init11.fs       |   12 +
 .../core/topinit/lib_deterministic_init12.fs       |   12 +
 .../core/topinit/lib_deterministic_init13.fs       |   12 +
 .../core/topinit/lib_deterministic_init14.fs       |   12 +
 .../core/topinit/lib_deterministic_init15.fs       |   12 +
 .../core/topinit/lib_deterministic_init16.fs       |   12 +
 .../core/topinit/lib_deterministic_init17.fs       |   12 +
 .../core/topinit/lib_deterministic_init18.fs       |   12 +
 .../core/topinit/lib_deterministic_init19.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init2.fs |   12 +
 .../core/topinit/lib_deterministic_init20.fs       |   12 +
 .../core/topinit/lib_deterministic_init21.fs       |   12 +
 .../core/topinit/lib_deterministic_init22.fs       |   12 +
 .../core/topinit/lib_deterministic_init23.fs       |   12 +
 .../core/topinit/lib_deterministic_init24.fs       |   12 +
 .../core/topinit/lib_deterministic_init25.fs       |   12 +
 .../core/topinit/lib_deterministic_init26.fs       |   12 +
 .../core/topinit/lib_deterministic_init27.fs       |   12 +
 .../core/topinit/lib_deterministic_init28.fs       |   12 +
 .../core/topinit/lib_deterministic_init29.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init3.fs |   12 +
 .../core/topinit/lib_deterministic_init30.fs       |   12 +
 .../core/topinit/lib_deterministic_init31.fs       |   12 +
 .../core/topinit/lib_deterministic_init32.fs       |   12 +
 .../core/topinit/lib_deterministic_init33.fs       |   12 +
 .../core/topinit/lib_deterministic_init34.fs       |   12 +
 .../core/topinit/lib_deterministic_init35.fs       |   12 +
 .../core/topinit/lib_deterministic_init36.fs       |   12 +
 .../core/topinit/lib_deterministic_init37.fs       |   12 +
 .../core/topinit/lib_deterministic_init38.fs       |   12 +
 .../core/topinit/lib_deterministic_init39.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init4.fs |   12 +
 .../core/topinit/lib_deterministic_init40.fs       |   12 +
 .../core/topinit/lib_deterministic_init41.fs       |   12 +
 .../core/topinit/lib_deterministic_init42.fs       |   12 +
 .../core/topinit/lib_deterministic_init43.fs       |   12 +
 .../core/topinit/lib_deterministic_init44.fs       |   12 +
 .../core/topinit/lib_deterministic_init45.fs       |   12 +
 .../core/topinit/lib_deterministic_init46.fs       |   12 +
 .../core/topinit/lib_deterministic_init47.fs       |   12 +
 .../core/topinit/lib_deterministic_init48.fs       |   12 +
 .../core/topinit/lib_deterministic_init49.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init5.fs |   12 +
 .../core/topinit/lib_deterministic_init50.fs       |   12 +
 .../core/topinit/lib_deterministic_init51.fs       |   12 +
 .../core/topinit/lib_deterministic_init52.fs       |   12 +
 .../core/topinit/lib_deterministic_init53.fs       |   12 +
 .../core/topinit/lib_deterministic_init54.fs       |   12 +
 .../core/topinit/lib_deterministic_init55.fs       |   12 +
 .../core/topinit/lib_deterministic_init56.fs       |   12 +
 .../core/topinit/lib_deterministic_init57.fs       |   12 +
 .../core/topinit/lib_deterministic_init58.fs       |   12 +
 .../core/topinit/lib_deterministic_init59.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init6.fs |   12 +
 .../core/topinit/lib_deterministic_init60.fs       |   12 +
 .../core/topinit/lib_deterministic_init61.fs       |   12 +
 .../core/topinit/lib_deterministic_init62.fs       |   12 +
 .../core/topinit/lib_deterministic_init63.fs       |   12 +
 .../core/topinit/lib_deterministic_init64.fs       |   12 +
 .../core/topinit/lib_deterministic_init65.fs       |   12 +
 .../core/topinit/lib_deterministic_init66.fs       |   12 +
 .../core/topinit/lib_deterministic_init67.fs       |   12 +
 .../core/topinit/lib_deterministic_init68.fs       |   12 +
 .../core/topinit/lib_deterministic_init69.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init7.fs |   12 +
 .../core/topinit/lib_deterministic_init70.fs       |   12 +
 .../core/topinit/lib_deterministic_init71.fs       |   12 +
 .../core/topinit/lib_deterministic_init72.fs       |   12 +
 .../core/topinit/lib_deterministic_init73.fs       |   12 +
 .../core/topinit/lib_deterministic_init74.fs       |   12 +
 .../core/topinit/lib_deterministic_init75.fs       |   12 +
 .../core/topinit/lib_deterministic_init76.fs       |   12 +
 .../core/topinit/lib_deterministic_init77.fs       |   12 +
 .../core/topinit/lib_deterministic_init78.fs       |   12 +
 .../core/topinit/lib_deterministic_init79.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init8.fs |   12 +
 .../core/topinit/lib_deterministic_init80.fs       |   12 +
 .../core/topinit/lib_deterministic_init81.fs       |   12 +
 .../core/topinit/lib_deterministic_init82.fs       |   12 +
 .../core/topinit/lib_deterministic_init83.fs       |   12 +
 .../core/topinit/lib_deterministic_init84.fs       |   12 +
 .../core/topinit/lib_deterministic_init85.fs       |   12 +
 .../fsharp/core/topinit/lib_deterministic_init9.fs |   12 +
 tests/fsharp/core/topinit/run.bat                  |   60 +
 tests/fsharp/core/topinit/static-main.fs           |   16 +
 tests/fsharp/core/topinit/test.cs                  |   34 +
 tests/fsharp/core/topinit/test0.fs                 |   96 +
 tests/fsharp/core/topinit/test1.fs                 |   24 +
 tests/fsharp/core/topinit/test2.fs                 |   30 +
 tests/fsharp/core/topinit/test3.fs                 |   32 +
 tests/fsharp/core/topinit/test4.fs                 |   54 +
 tests/fsharp/core/topinit/test5.fs                 |   36 +
 tests/fsharp/core/topinit/test6.fs                 |   56 +
 .../fsharp/core/topinit/test_deterministic_init.fs |  601 ++
 tests/fsharp/core/unicode/build.bat                |   52 +
 tests/fsharp/core/unicode/dont.pipe.to.stdin       |    1 +
 tests/fsharp/core/unicode/kanji-unicode-utf16.fs   |  Bin 0 -> 128 bytes
 .../unicode/kanji-unicode-utf7-codepage-65000.fs   |    5 +
 .../kanji-unicode-utf8-nosig-codepage-65001.fs     |    5 +
 .../kanji-unicode-utf8-withsig-codepage-65001.fs   |    5 +
 tests/fsharp/core/unicode/out.bsl                  |    1 +
 tests/fsharp/core/unicode/run.bat                  |   55 +
 tests/fsharp/core/unicode/test.fsx                 |  144 +
 tests/fsharp/core/unicode/utf8source.ml            |    8 +
 tests/fsharp/core/verify/build.bat                 |   78 +
 tests/fsharp/core/verify/run.bat                   |   30 +
 tests/fsharp/core/verify/xmlverify.fs              |   12 +
 tests/fsharp/optimize/analyses/build.bat           |   72 +
 .../analyses/effects.HasEffect.output.test.bsl     |   50 +
 tests/fsharp/optimize/analyses/effects.fs          |  118 +
 .../analyses/sizes.FunctionSizes.output.test.bsl   |   18 +
 .../analyses/sizes.TotalSizes.output.test.bsl      |   18 +
 tests/fsharp/optimize/analyses/sizes.fs            |   26 +
 .../tailcalls.NoNeedToTailcall.output.test.bsl     |   53 +
 tests/fsharp/optimize/analyses/tailcalls.fs        |  126 +
 tests/fsharp/optimize/basics/build.bat             |   35 +
 tests/fsharp/optimize/basics/run.bat               |   50 +
 tests/fsharp/optimize/basics/test.ml               |  107 +
 tests/fsharp/optimize/stats/run.bat                |   49 +
 tests/fsharp/optimize/stats/stats10.txt            |   77 +
 tests/fsharp/optimize/tdirs                        |    3 +
 tests/fsharp/perf/graph/build.bat                  |    6 +
 tests/fsharp/perf/graph/run.bat                    |    7 +
 tests/fsharp/perf/graph/test.ml                    |  550 ++
 tests/fsharp/perf/nbody/build.bat                  |    6 +
 tests/fsharp/perf/nbody/run.bat                    |    7 +
 tests/fsharp/perf/nbody/test.ml                    |  159 +
 tests/fsharp/perf/tdirs                            |    2 +
 tests/fsharp/regression/26/build.bat               |    5 +
 tests/fsharp/regression/26/run.bat                 |    7 +
 tests/fsharp/regression/26/test.ml                 |   32 +
 tests/fsharp/regression/321/build.bat              |    6 +
 tests/fsharp/regression/321/run.bat                |    7 +
 tests/fsharp/regression/321/test.ml                |   29 +
 tests/fsharp/regression/321/test.mli               |    3 +
 tests/fsharp/regression/655/build.bat              |   40 +
 tests/fsharp/regression/655/main.fs                |   13 +
 tests/fsharp/regression/655/run.bat                |   38 +
 tests/fsharp/regression/655/xlibC.ml               |   15 +
 tests/fsharp/regression/656/build.bat              |   33 +
 tests/fsharp/regression/656/filehelper.fs          |   36 +
 tests/fsharp/regression/656/form.fs                |  932 ++
 tests/fsharp/regression/656/formshelper.fs         |  169 +
 tests/fsharp/regression/656/mathhelper.fs          |  136 +
 tests/fsharp/regression/656/misc.fs                |   30 +
 tests/fsharp/regression/656/playerrecord.fs        |   89 +
 tests/fsharp/regression/656/plot.fs                |  174 +
 tests/fsharp/regression/656/run.bat                |   34 +
 tests/fsharp/regression/656/trackedplayers.fs      |  375 +
 tests/fsharp/regression/656/traj.fs                |  255 +
 tests/fsharp/regression/83/build.bat               |   32 +
 tests/fsharp/regression/83/run.bat                 |   16 +
 tests/fsharp/regression/83/test.ml                 |   46 +
 tests/fsharp/regression/84/build.bat               |    6 +
 tests/fsharp/regression/84/run.bat                 |    7 +
 tests/fsharp/regression/84/test.ml                 |   11 +
 tests/fsharp/regression/85/Category.ml             |    8 +
 tests/fsharp/regression/85/build.bat               |   40 +
 tests/fsharp/regression/85/category.dll            |  Bin 0 -> 20480 bytes
 tests/fsharp/regression/85/run.bat                 |   26 +
 tests/fsharp/regression/86/build.bat               |    6 +
 tests/fsharp/regression/86/run.bat                 |    7 +
 tests/fsharp/regression/86/test.ml                 |   11 +
 .../lucian-standalone-bug/AsmL.Tools.Algos.SA.dll  |  Bin 0 -> 20480 bytes
 .../lucian-standalone-bug/AsmL.Tools.Algos.SA.pdb  |  Bin 0 -> 19968 bytes
 .../AsmL.Tools.Algos.SimplexMethod.dll             |  Bin 0 -> 24576 bytes
 .../AsmL.Tools.Algos.SimplexMethod.pdb             |  Bin 0 -> 28160 bytes
 .../AsmL.Tools.Algos.SimplexMethod.xml             |   66 +
 .../AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll   |  Bin 0 -> 37376 bytes
 .../AsmL.Tools.Algos.SimplexMethodOpt.Tableu.pdb   |  Bin 0 -> 281600 bytes
 .../lucian-standalone-bug/HashMultiMap.fs          |  166 +
 .../regression/lucian-standalone-bug/HashSet.fs    |   54 +
 .../Microsoft.GLEE.Drawing.dll                     |  Bin 0 -> 49152 bytes
 .../Microsoft.GLEE.Drawing.pdb                     |  Bin 0 -> 118272 bytes
 .../Microsoft.GLEE.GraphHelper.dll                 |  Bin 0 -> 20480 bytes
 .../Microsoft.GLEE.GraphHelper.pdb                 |  Bin 0 -> 13824 bytes
 .../Microsoft.GLEE.GraphViewerGDI.XML              |  446 +
 .../Microsoft.GLEE.GraphViewerGDI.dll              |  Bin 0 -> 81920 bytes
 .../Microsoft.GLEE.GraphViewerGDI.pdb              |  Bin 0 -> 157184 bytes
 .../Microsoft.GLEE.IGraphViewer.dll                |  Bin 0 -> 36864 bytes
 .../Microsoft.GLEE.IGraphViewer.pdb                |  Bin 0 -> 65024 bytes
 .../Microsoft.GLEE.Splines.dll                     |  Bin 0 -> 61440 bytes
 .../Microsoft.GLEE.Splines.pdb                     |  Bin 0 -> 163328 bytes
 .../lucian-standalone-bug/Microsoft.GLEE.dll       |  Bin 0 -> 139264 bytes
 .../lucian-standalone-bug/Microsoft.GLEE.pdb       |  Bin 0 -> 398848 bytes
 .../regression/lucian-standalone-bug/TaggedHash.fs |   59 +
 .../regression/lucian-standalone-bug/analysis.fs   | 1097 +++
 .../fsharp/regression/lucian-standalone-bug/ast.fs |  234 +
 .../regression/lucian-standalone-bug/build.bat     |   28 +
 .../regression/lucian-standalone-bug/checkmri.doc  |  Bin 0 -> 19968 bytes
 .../regression/lucian-standalone-bug/checkmri.fs   |  279 +
 .../lucian-standalone-bug/checkmri.fsharpp         |  122 +
 .../regression/lucian-standalone-bug/checkmri.ppt  |  Bin 0 -> 74240 bytes
 .../regression/lucian-standalone-bug/checkmri.sln  |   20 +
 .../regression/lucian-standalone-bug/edit.bat      |   15 +
 .../regression/lucian-standalone-bug/eg1.viper     |  121 +
 .../regression/lucian-standalone-bug/eg2.viper     |   30 +
 .../regression/lucian-standalone-bug/eg3.viper     |   36 +
 .../regression/lucian-standalone-bug/eg4.viper     |   23 +
 .../regression/lucian-standalone-bug/eg5.viper     |   23 +
 .../regression/lucian-standalone-bug/eg6.viper     |   34 +
 .../regression/lucian-standalone-bug/eg7.viper     |   29 +
 .../regression/lucian-standalone-bug/hashtbl.fs    |   79 +
 .../fsharp/regression/lucian-standalone-bug/lex.fs |  678 ++
 .../regression/lucian-standalone-bug/lex.fsl       |   86 +
 .../regression/lucian-standalone-bug/lexing.fs     |   67 +
 .../regression/lucian-standalone-bug/make.bat      |   14 +
 .../regression/lucian-standalone-bug/pars.fs       | 1804 ++++
 .../regression/lucian-standalone-bug/pars.fsy      |  181 +
 .../regression/lucian-standalone-bug/parsing.fs    |   41 +
 .../lucian-standalone-bug/prim-lexing.fs           |  418 +
 .../lucian-standalone-bug/prim-parsing.fs          |  513 ++
 .../regression/lucian-standalone-bug/states.fs     | 1013 +++
 .../regression/lucian-standalone-bug/test.fs       |   25 +
 .../regression/lucian-standalone-bug/utils.fs      |   70 +
 tests/fsharp/regression/tdirs                      |   11 +
 tests/fsharp/regression/tuple-bug-1/build.bat      |    7 +
 tests/fsharp/regression/tuple-bug-1/run.bat        |    4 +
 tests/fsharp/regression/tuple-bug-1/test.ml        |   30 +
 tests/fsharp/regression/wecker-1/JSTM.dll          |  Bin 0 -> 20480 bytes
 tests/fsharp/regression/wecker-1/build.bat         |   55 +
 tests/fsharp/regression/wecker-1/chan.fs           |  241 +
 tests/fsharp/regression/wecker-1/chan.fsi          |   87 +
 tests/fsharp/regression/wecker-1/main.fs           |   88 +
 tests/fsharp/regression/wecker-1/ml2.exe           |  Bin 0 -> 9216 bytes
 tests/fsharp/regression/wecker-1/run.bat           |   39 +
 tests/fsharp/single-neg-test.bat                   |  108 +
 tests/fsharp/single-test-build.bat                 |  313 +
 tests/fsharp/single-test-run.bat                   |  324 +
 tests/fsharp/tdirs                                 |    7 +
 tests/fsharp/tools/FSharp.PowerPack/README.txt     |   10 +
 .../fixed/Test.Compiler.CodeDom.dll                |  Bin 0 -> 369664 bytes
 .../FSharp.PowerPack/fixed/Test.PowerPack.Linq.dll |  Bin 0 -> 378880 bytes
 .../FSharp.PowerPack/fixed/Test.PowerPack.dll      |  Bin 0 -> 1109504 bytes
 .../fsppack/src/CodePlex.Settings.targets          |   27 +
 .../FSharp.PowerPack/fsppack/src/CodePlex.targets  |   25 +
 .../Test.Compiler.CodeDom.fsproj                   |   51 +
 .../assemblyinfo.FSharp.Compiler.CodeDom.dll.fs    |    8 +
 .../src/FSharp.Compiler.CodeDom/codedomvisitor.fs  |  101 +
 .../src/FSharp.Compiler.CodeDom/codeprovider.fs    |  302 +
 .../src/FSharp.Compiler.CodeDom/codeprovider.fsi   |   15 +
 .../src/FSharp.Compiler.CodeDom/compiler.fs        |  176 +
 .../src/FSharp.Compiler.CodeDom/generator.fs       | 1810 ++++
 .../fsppack/src/FSharp.PowerPack.Linq/Assembly.fs  |    8 +
 .../FSharp.PowerPack.Linq/FuncConvertExtensions.fs |   28 +
 .../FuncConvertExtensions.fsi                      |   40 +
 .../fsppack/src/FSharp.PowerPack.Linq/Linq.fs      |  809 ++
 .../fsppack/src/FSharp.PowerPack.Linq/Linq.fsi     |  124 +
 .../src/FSharp.PowerPack.Linq/LinqQueries.fs       |  785 ++
 .../src/FSharp.PowerPack.Linq/LinqQueries.fsi      |   61 +
 .../Test.PowerPack.Linq.fsproj                     |   56 +
 .../assemblyinfo.FSharp.PowerPack.Linq.dll.fs      |    8 +
 .../src/FSharp.PowerPack/AsyncOperations.fs        |  167 +
 .../src/FSharp.PowerPack/AsyncOperations.fsi       |   81 +
 .../fsppack/src/FSharp.PowerPack/AsyncWorker.fs    |   65 +
 .../fsppack/src/FSharp.PowerPack/AsyncWorker.fsi   |   20 +
 .../fsppack/src/FSharp.PowerPack/Compat.Array.fs   |  109 +
 .../fsppack/src/FSharp.PowerPack/Compat.Array.fsi  |   80 +
 .../fsppack/src/FSharp.PowerPack/Compat.Array2D.fs |   32 +
 .../src/FSharp.PowerPack/Compat.Array2D.fsi        |   26 +
 .../fsppack/src/FSharp.PowerPack/Compat.List.fs    |  141 +
 .../fsppack/src/FSharp.PowerPack/Compat.List.fsi   |  125 +
 .../fsppack/src/FSharp.PowerPack/Compat.Seq.fs     |   23 +
 .../fsppack/src/FSharp.PowerPack/Compat.Seq.fsi    |   15 +
 .../fsppack/src/FSharp.PowerPack/Compat.String.fs  |  110 +
 .../fsppack/src/FSharp.PowerPack/Compat.String.fsi |   98 +
 .../src/FSharp.PowerPack/CompilerLocationUtils.fs  |  213 +
 .../fsppack/src/FSharp.PowerPack/HashMultiMap.fs   |  166 +
 .../fsppack/src/FSharp.PowerPack/HashMultiMap.fsi  |   84 +
 .../fsppack/src/FSharp.PowerPack/HashSet.fs        |   54 +
 .../fsppack/src/FSharp.PowerPack/HashSet.fsi       |   59 +
 .../fsppack/src/FSharp.PowerPack/Measure.fs        |   15 +
 .../fsppack/src/FSharp.PowerPack/Measure.fsi       |   25 +
 .../fsppack/src/FSharp.PowerPack/NativeArray.fs    |  105 +
 .../fsppack/src/FSharp.PowerPack/NativeArray.fsi   |  158 +
 .../src/FSharp.PowerPack/PhysicalConstants.fs      |   91 +
 .../fsppack/src/FSharp.PowerPack/PowerPack.fs      |   33 +
 .../fsppack/src/FSharp.PowerPack/SI.fs             |  112 +
 .../src/FSharp.PowerPack/TaggedCollections.fs      | 1179 +++
 .../src/FSharp.PowerPack/TaggedCollections.fsi     |  225 +
 .../fsppack/src/FSharp.PowerPack/TaggedHash.fs     |   59 +
 .../fsppack/src/FSharp.PowerPack/TaggedHash.fsi    |   89 +
 .../src/FSharp.PowerPack/Test.PowerPack.fsproj     |  252 +
 .../src/FSharp.PowerPack/UnitTestHelpers.fs        |   12 +
 .../fsppack/src/FSharp.PowerPack/arg.fs            |  111 +
 .../fsppack/src/FSharp.PowerPack/arg.fsi           |   47 +
 .../assemblyinfo.FSharp.PowerPack.dll.fs           |    8 +
 .../fsppack/src/FSharp.PowerPack/buffer.fs         |   32 +
 .../fsppack/src/FSharp.PowerPack/buffer.fsi        |   56 +
 .../fsppack/src/FSharp.PowerPack/byte.fs           |   44 +
 .../fsppack/src/FSharp.PowerPack/byte.fsi          |   76 +
 .../fsppack/src/FSharp.PowerPack/char.fs           |   21 +
 .../fsppack/src/FSharp.PowerPack/char.fsi          |   23 +
 .../fsppack/src/FSharp.PowerPack/filename.fs       |   51 +
 .../fsppack/src/FSharp.PowerPack/filename.fsi      |   62 +
 .../fsppack/src/FSharp.PowerPack/float.fs          |   56 +
 .../fsppack/src/FSharp.PowerPack/float.fsi         |   55 +
 .../fsppack/src/FSharp.PowerPack/hashtbl.fs        |   79 +
 .../fsppack/src/FSharp.PowerPack/hashtbl.fsi       |  138 +
 .../fsppack/src/FSharp.PowerPack/int16.fs          |   39 +
 .../fsppack/src/FSharp.PowerPack/int32.fs          |   60 +
 .../fsppack/src/FSharp.PowerPack/int32.fsi         |  105 +
 .../fsppack/src/FSharp.PowerPack/int64.fs          |   55 +
 .../fsppack/src/FSharp.PowerPack/int64.fsi         |  100 +
 .../fsppack/src/FSharp.PowerPack/lazy.fs           |   12 +
 .../fsppack/src/FSharp.PowerPack/lazy.fsi          |   31 +
 .../fsppack/src/FSharp.PowerPack/lazylist.fs       |  261 +
 .../fsppack/src/FSharp.PowerPack/lazylist.fsi      |  189 +
 .../fsppack/src/FSharp.PowerPack/lexing.fs         |   68 +
 .../fsppack/src/FSharp.PowerPack/lexing.fsi        |   97 +
 .../fsppack/src/FSharp.PowerPack/map.fs            |   45 +
 .../fsppack/src/FSharp.PowerPack/map.fsi           |   57 +
 .../fsppack/src/FSharp.PowerPack/math/INumeric.fs  |  241 +
 .../fsppack/src/FSharp.PowerPack/math/INumeric.fsi |   82 +
 .../FSharp.PowerPack/math/NativeArrayExtensions.fs |   52 +
 .../math/NativeArrayExtensions.fsi                 |   27 +
 .../src/FSharp.PowerPack/math/associations.fs      |   61 +
 .../src/FSharp.PowerPack/math/associations.fsi     |   28 +
 .../fsppack/src/FSharp.PowerPack/math/complex.fs   |  130 +
 .../fsppack/src/FSharp.PowerPack/math/complex.fsi  |  136 +
 .../lapack/FSharp.PowerPack.Math.Providers.fsproj  |   45 +
 .../src/FSharp.PowerPack/math/lapack/build.bat     |    6 +
 .../FSharp.PowerPack/math/lapack/code_generator.fs |  611 ++
 .../src/FSharp.PowerPack/math/lapack/la.fsharpp    |   92 +
 .../src/FSharp.PowerPack/math/lapack/la.sln        |   20 +
 .../FSharp.PowerPack/math/lapack/lapack_base.fs    |  131 +
 .../FSharp.PowerPack/math/lapack/lapack_service.fs |    5 +
 .../math/lapack/lapack_service_mkl.fs              | 1354 +++
 .../math/lapack/lapack_service_mkl.fsi             |    5 +
 .../math/lapack/lapack_service_netlib.fs           | 1345 +++
 .../math/lapack/lapack_service_netlib.fsi          |    5 +
 .../math/lapack/lapack_service_template.fs         |   66 +
 .../FSharp.PowerPack/math/lapack/linear_algebra.fs |  201 +
 .../math/lapack/linear_algebra.fsi                 |   82 +
 .../math/lapack/linear_algebra_managed.fs          |  238 +
 .../math/lapack/linear_algebra_service.fs          |  175 +
 .../src/FSharp.PowerPack/math/lapack/regen.bat     |    3 +
 .../src/FSharp.PowerPack/math/lapack/service.fs    |  165 +
 .../src/FSharp.PowerPack/math/lapack/service.fsi   |   19 +
 .../fsppack/src/FSharp.PowerPack/math/matrix.fs    | 2567 ++++++
 .../fsppack/src/FSharp.PowerPack/math/matrix.fsi   | 1106 +++
 .../fsppack/src/FSharp.PowerPack/math/q.fs         |  324 +
 .../fsppack/src/FSharp.PowerPack/math/q.fsi        |   93 +
 .../fsppack/src/FSharp.PowerPack/mllib.fsharpp     |  318 +
 .../fsppack/src/FSharp.PowerPack/obj.fs            |   15 +
 .../fsppack/src/FSharp.PowerPack/obj.fsi           |   37 +
 .../fsppack/src/FSharp.PowerPack/parsing.fs        |   42 +
 .../fsppack/src/FSharp.PowerPack/parsing.fsi       |   56 +
 .../fsppack/src/FSharp.PowerPack/permutation.fs    |   52 +
 .../fsppack/src/FSharp.PowerPack/permutation.fsi   |   38 +
 .../fsppack/src/FSharp.PowerPack/pervasives.fs     |  708 ++
 .../fsppack/src/FSharp.PowerPack/pervasives.fsi    |  855 ++
 .../fsppack/src/FSharp.PowerPack/prim-lexing.fs    |  423 +
 .../fsppack/src/FSharp.PowerPack/prim-lexing.fsi   |  151 +
 .../fsppack/src/FSharp.PowerPack/prim-parsing.fs   |  513 ++
 .../fsppack/src/FSharp.PowerPack/prim-parsing.fsi  |  130 +
 .../fsppack/src/FSharp.PowerPack/printexc.fs       |   17 +
 .../fsppack/src/FSharp.PowerPack/printexc.fsi      |   15 +
 .../fsppack/src/FSharp.PowerPack/resizearray.fs    |  319 +
 .../fsppack/src/FSharp.PowerPack/resizearray.fsi   |  239 +
 .../fsppack/src/FSharp.PowerPack/sbyte.fs          |   47 +
 .../fsppack/src/FSharp.PowerPack/set.fs            |   95 +
 .../fsppack/src/FSharp.PowerPack/set.fsi           |   85 +
 .../fsppack/src/FSharp.PowerPack/sformat.fs        | 1018 +++
 .../fsppack/src/FSharp.PowerPack/sformat.fsi       |  186 +
 .../fsppack/src/FSharp.PowerPack/sys.fs            |   65 +
 .../fsppack/src/FSharp.PowerPack/sys.fsi           |   84 +
 .../fsppack/src/FSharp.PowerPack/uint16.fs         |   47 +
 .../fsppack/src/FSharp.PowerPack/uint32.fs         |   59 +
 .../fsppack/src/FSharp.PowerPack/uint32.fsi        |   61 +
 .../fsppack/src/FSharp.PowerPack/uint64.fs         |   44 +
 .../fsppack/src/FSharp.PowerPack/uint64.fsi        |   55 +
 .../fsppack/src/assemblyinfo.Common.fs             |    8 +
 .../tools/FSharp.PowerPack/fsppack/src/fs.pubkey   |  Bin 0 -> 160 bytes
 .../tools/FSharp.PowerPack/fsppack/src/fs.snk      |  Bin 0 -> 596 bytes
 .../fsppack/src/fsppack.vs2008.sln                 |   44 +
 tests/fsharp/tools/bundle/build.bat                |   56 +
 .../fsharp/tools/bundle/test-one-fsharp-module.fs  |    9 +
 .../bundle/test_two_fsharp_modules_module_1.fs     |   12 +
 .../bundle/test_two_fsharp_modules_module_2.fs     |    8 +
 tests/fsharp/tools/eval/build.bat                  |    6 +
 tests/fsharp/tools/eval/run.bat                    |    7 +
 tests/fsharp/tools/eval/test.fsx                   | 2511 ++++++
 tests/fsharp/tools/tdirs                           |    2 +
 .../typeProviders/build-typeprovider-test.bat      |   48 +
 .../DbmlFile/DbmlFiles/AdventureWorksDev10.dbml    |  247 +
 .../DbmlFile/DbmlFiles/SqlNorthwindDev11.dbml      |  169 +
 .../typeProviders/builtin/DbmlFile/build.bat       |    8 +
 .../fsharp/typeProviders/builtin/DbmlFile/run.bat  |    7 +
 .../fsharp/typeProviders/builtin/DbmlFile/test.fsx |  212 +
 .../builtin/EdmxFile/EdmxFiles/SampleModel01.edmx  |   87 +
 .../typeProviders/builtin/EdmxFile/build.bat       |    8 +
 .../fsharp/typeProviders/builtin/EdmxFile/run.bat  |    7 +
 .../fsharp/typeProviders/builtin/EdmxFile/test.fsx |  143 +
 .../typeProviders/builtin/ODataService/build.bat   |    8 +
 .../typeProviders/builtin/ODataService/run.bat     |    7 +
 .../typeProviders/builtin/ODataService/test.fsx    |  144 +
 .../builtin/SqlDataConnection/DB/NORTHWND.MDF      |  Bin 0 -> 4784128 bytes
 .../builtin/SqlDataConnection/build.bat            |    8 +
 .../builtin/SqlDataConnection/run.bat              |   12 +
 .../builtin/SqlDataConnection/test.fsx             |  249 +
 .../builtin/SqlEntityConnection/DB/NORTHWND.MDF    |  Bin 0 -> 4784128 bytes
 .../builtin/SqlEntityConnection/build.bat          |    8 +
 .../builtin/SqlEntityConnection/run.bat            |    7 +
 .../builtin/SqlEntityConnection/test.fsx           |  238 +
 .../typeProviders/builtin/WsdlService/build.bat    |    8 +
 .../typeProviders/builtin/WsdlService/run.bat      |    7 +
 .../typeProviders/builtin/WsdlService/test.fsx     |  210 +
 .../builtin/copyFSharpDataTypeProviderDLL.cmd      |   28 +
 tests/fsharp/typeProviders/builtin/tdirs           |    6 +
 tests/fsharp/typeProviders/builtin/test.exe.config |   12 +
 .../fsharp/typeProviders/diamondAssembly/build.bat |   38 +
 tests/fsharp/typeProviders/diamondAssembly/run.bat |   41 +
 .../fsharp/typeProviders/diamondAssembly/test1.fsx |   27 +
 .../typeProviders/diamondAssembly/test2a.fsx       |   25 +
 .../typeProviders/diamondAssembly/test2b.fsx       |   25 +
 .../fsharp/typeProviders/diamondAssembly/test3.fsx |  176 +
 .../fsharp/typeProviders/globalNamespace/build.bat |   23 +
 .../globalNamespace/globalNamespaceTP.cs           |   70 +
 .../fsharp/typeProviders/globalNamespace/test.fsx  |   41 +
 tests/fsharp/typeProviders/helloWorld/TypeMagic.fs |  494 ++
 tests/fsharp/typeProviders/helloWorld/build.bat    |   97 +
 tests/fsharp/typeProviders/helloWorld/build.fs     |    0
 tests/fsharp/typeProviders/helloWorld/provided.fs  |  197 +
 tests/fsharp/typeProviders/helloWorld/providedJ.fs |   11 +
 tests/fsharp/typeProviders/helloWorld/providedK.fs |    7 +
 .../helloWorld/providedNullAssemblyName.fsx        |    3 +
 tests/fsharp/typeProviders/helloWorld/provider.fsx | 1062 +++
 tests/fsharp/typeProviders/helloWorld/run.bat      |   10 +
 tests/fsharp/typeProviders/helloWorld/test.fsx     | 1147 +++
 .../typeProviders/helloWorld/testlib_client.fsx    |   19 +
 .../typeProviders/helloWorldCSharp/build.bat       |   40 +
 .../fsharp/typeProviders/helloWorldCSharp/magic.fs |  480 +
 .../typeProviders/helloWorldCSharp/magic.snk       |  Bin 0 -> 596 bytes
 .../typeProviders/helloWorldCSharp/provider.cs     |   62 +
 .../fsharp/typeProviders/helloWorldCSharp/run.bat  |   21 +
 .../fsharp/typeProviders/helloWorldCSharp/test.fsx |   43 +
 .../negTests/EVIL_PROVIDER_ConstructorThrows.bslpp |    4 +
 .../negTests/EVIL_PROVIDER_ConstructorThrows.fsx   |    4 +
 .../EVIL_PROVIDER_DoesNotHaveConstructor.bslpp     |    4 +
 .../EVIL_PROVIDER_DoesNotHaveConstructor.fsx       |    5 +
 .../EVIL_PROVIDER_DoesNotHaveConstructor.vsbslpp   |    6 +
 ...VIL_PROVIDER_GetInvokerExpression_Exception.bsl |    2 +
 ...VIL_PROVIDER_GetInvokerExpression_Exception.fsx |    7 +
 .../EVIL_PROVIDER_GetInvokerExpression_Null.bsl    |    2 +
 .../EVIL_PROVIDER_GetInvokerExpression_Null.fsx    |    7 +
 .../EVIL_PROVIDER_GetNamespaces_Exception.bsl      |    4 +
 .../EVIL_PROVIDER_GetNamespaces_Exception.fsx      |    4 +
 .../negTests/EVIL_PROVIDER_GetNamespaces_Null.bsl  |    4 +
 .../negTests/EVIL_PROVIDER_GetNamespaces_Null.fsx  |    4 +
 ...EVIL_PROVIDER_GetNestedNamespaces_Exception.bsl |    4 +
 ...EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx |    5 +
 .../EVIL_PROVIDER_GetNestedNamespaces_Null.fsx     |    5 +
 ...EVIL_PROVIDER_GetStaticParameters_Exception.bsl |    4 +
 ...EVIL_PROVIDER_GetStaticParameters_Exception.fsx |    7 +
 .../EVIL_PROVIDER_GetStaticParameters_Null.bsl     |    4 +
 .../EVIL_PROVIDER_GetStaticParameters_Null.fsx     |    7 +
 .../negTests/EVIL_PROVIDER_GetTypes_Exception.bsl  |    4 +
 .../negTests/EVIL_PROVIDER_GetTypes_Exception.fsx  |    4 +
 .../negTests/EVIL_PROVIDER_GetTypes_Null.bsl       |    4 +
 .../negTests/EVIL_PROVIDER_GetTypes_Null.fsx       |    4 +
 .../negTests/EVIL_PROVIDER_NamespaceName_Empty.bsl |    4 +
 .../negTests/EVIL_PROVIDER_NamespaceName_Empty.fsx |    4 +
 .../EVIL_PROVIDER_NamespaceName_Exception.bsl      |    4 +
 .../EVIL_PROVIDER_NamespaceName_Exception.fsx      |    4 +
 .../negTests/EVIL_PROVIDER_NamespaceName_Null.fsx  |    4 +
 .../EVIL_PROVIDER_ResolveTypeName_Exception.bsl    |   20 +
 .../EVIL_PROVIDER_ResolveTypeName_Exception.fsx    |    7 +
 .../EVIL_PROVIDER_ResolveTypeName_Null.bsl         |    4 +
 .../EVIL_PROVIDER_ResolveTypeName_Null.fsx         |    7 +
 ...peWithIncorrectNameFromApplyStaticArguments.bsl |    8 +
 ...peWithIncorrectNameFromApplyStaticArguments.fsx |    9 +
 .../negTests/InvalidInvokerExpression.bsl          |    2 +
 .../negTests/InvalidInvokerExpression.fsx          |    4 +
 .../typeProviders/negTests/MostBasicProvider.fsx   |  138 +
 .../negTests/ProviderAttributeErrorConsume.bslpp   |    4 +
 .../negTests/ProviderAttribute_EmptyConsume.bslpp  |    4 +
 tests/fsharp/typeProviders/negTests/TypeEvil.fs    |  538 ++
 tests/fsharp/typeProviders/negTests/build.bat      |  126 +
 tests/fsharp/typeProviders/negTests/neg1.bsl       | 1449 ++++
 tests/fsharp/typeProviders/negTests/neg1.fsx       |  451 +
 tests/fsharp/typeProviders/negTests/neg1_a.bsl     |    6 +
 tests/fsharp/typeProviders/negTests/neg1_a.fsx     |    7 +
 tests/fsharp/typeProviders/negTests/neg2.bsl       |    6 +
 tests/fsharp/typeProviders/negTests/neg2.fsx       |    3 +
 tests/fsharp/typeProviders/negTests/neg2c.bsl      |    2 +
 tests/fsharp/typeProviders/negTests/neg2c.fsx      |    6 +
 tests/fsharp/typeProviders/negTests/neg2e.bsl      |    6 +
 tests/fsharp/typeProviders/negTests/neg2e.fsx      |   12 +
 tests/fsharp/typeProviders/negTests/neg2g.bsl      |    4 +
 tests/fsharp/typeProviders/negTests/neg2g.fsx      |    8 +
 tests/fsharp/typeProviders/negTests/neg2h.bsl      |    2 +
 tests/fsharp/typeProviders/negTests/neg2h.fs       |    5 +
 tests/fsharp/typeProviders/negTests/neg2h.fsi      |    6 +
 tests/fsharp/typeProviders/negTests/neg3.bsl       |    4 +
 tests/fsharp/typeProviders/negTests/neg3.fsx       |    6 +
 tests/fsharp/typeProviders/negTests/neg4.bsl       |   28 +
 tests/fsharp/typeProviders/negTests/neg4.fsx       |   53 +
 tests/fsharp/typeProviders/negTests/neg5.bsl       |    6 +
 tests/fsharp/typeProviders/negTests/neg6.bsl       |   12 +
 tests/fsharp/typeProviders/negTests/neg6.fsx       |   16 +
 tests/fsharp/typeProviders/negTests/neg7.bsl       |    0
 tests/fsharp/typeProviders/negTests/neg7.fsx       |    6 +
 tests/fsharp/typeProviders/negTests/provider.fsx   |  594 ++
 .../negTests/providerAttributeError.fsx            |    3 +
 .../negTests/providerAttributeErrorConsume.fsx     |    1 +
 .../negTests/providerAttribute_Empty.fsx           |    3 +
 .../negTests/providerAttribute_EmptyConsume.fsx    |    1 +
 tests/fsharp/typeProviders/negTests/sed.fsx        |    8 +
 tests/fsharp/typeProviders/splitAssembly/build.bat |   27 +
 .../fsharp/typeProviders/splitAssembly/provider.fs |   17 +
 .../splitAssembly/providerDesigner.fsx             |   51 +
 tests/fsharp/typeProviders/splitAssembly/run.bat   |   10 +
 tests/fsharp/typeProviders/splitAssembly/test.fsx  |   43 +
 tests/fsharp/typeProviders/tdirs                   |    8 +
 tests/fsharp/typeProviders/wedgeAssembly/build.bat |   71 +
 tests/fsharp/typeProviders/wedgeAssembly/run.bat   |   29 +
 .../wedgeAssembly/test2a-restricted.fsi            |   48 +
 tests/fsharp/typeProviders/wedgeAssembly/test2a.fs |   54 +
 .../fsharp/typeProviders/wedgeAssembly/test2a.fsi  |   44 +
 .../wedgeAssembly/test2b-restricted.fsi            |   50 +
 tests/fsharp/typeProviders/wedgeAssembly/test2b.fs |   54 +
 .../fsharp/typeProviders/wedgeAssembly/test2b.fsi  |   44 +
 tests/fsharp/typeProviders/wedgeAssembly/test3.fsx |  125 +
 tests/fsharp/typecheck/misc/build.bat              |    5 +
 tests/fsharp/typecheck/misc/run.bat                |    5 +
 tests/fsharp/typecheck/misc/test.ml                |   37 +
 tests/fsharp/typecheck/sigs/build.bat              |  471 +
 tests/fsharp/typecheck/sigs/neg01.bsl              |    6 +
 tests/fsharp/typecheck/sigs/neg01a.fs              |   23 +
 tests/fsharp/typecheck/sigs/neg01a.fsi             |   26 +
 tests/fsharp/typecheck/sigs/neg01b.fs              |    2 +
 tests/fsharp/typecheck/sigs/neg02.bsl              |    8 +
 tests/fsharp/typecheck/sigs/neg02.fs               |   22 +
 tests/fsharp/typecheck/sigs/neg03.bsl              |  116 +
 tests/fsharp/typecheck/sigs/neg03.fs               |  154 +
 tests/fsharp/typecheck/sigs/neg04.bsl              |  126 +
 tests/fsharp/typecheck/sigs/neg04.fs               |  179 +
 tests/fsharp/typecheck/sigs/neg05.bsl              |   26 +
 tests/fsharp/typecheck/sigs/neg05.fs               |   64 +
 tests/fsharp/typecheck/sigs/neg06.bsl              |  144 +
 tests/fsharp/typecheck/sigs/neg06.fs               |  408 +
 tests/fsharp/typecheck/sigs/neg06_a.bsl            |    4 +
 tests/fsharp/typecheck/sigs/neg06_a.fs             |   41 +
 tests/fsharp/typecheck/sigs/neg06_b.bsl            |    4 +
 tests/fsharp/typecheck/sigs/neg06_b.fs             |   21 +
 tests/fsharp/typecheck/sigs/neg07.bsl              |   38 +
 tests/fsharp/typecheck/sigs/neg07.fs               |   98 +
 tests/fsharp/typecheck/sigs/neg08.bsl              |   24 +
 tests/fsharp/typecheck/sigs/neg08.fs               |   80 +
 tests/fsharp/typecheck/sigs/neg08.fsi              |    3 +
 tests/fsharp/typecheck/sigs/neg09.bsl              |   16 +
 tests/fsharp/typecheck/sigs/neg09.fs               |   50 +
 tests/fsharp/typecheck/sigs/neg09.fsi              |    7 +
 tests/fsharp/typecheck/sigs/neg10.bsl              |  250 +
 tests/fsharp/typecheck/sigs/neg10.fs               |  462 +
 tests/fsharp/typecheck/sigs/neg10.fsi              |   14 +
 tests/fsharp/typecheck/sigs/neg10_a.bsl            |    2 +
 tests/fsharp/typecheck/sigs/neg10_a.fs             |    9 +
 tests/fsharp/typecheck/sigs/neg11.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg11.fs               |    9 +
 tests/fsharp/typecheck/sigs/neg12.bsl              |   20 +
 tests/fsharp/typecheck/sigs/neg12.fs               |   51 +
 tests/fsharp/typecheck/sigs/neg13.bsl              |   32 +
 tests/fsharp/typecheck/sigs/neg13.fs               |   65 +
 tests/fsharp/typecheck/sigs/neg14.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg14a.fs              |   18 +
 tests/fsharp/typecheck/sigs/neg14a.fsi             |   19 +
 tests/fsharp/typecheck/sigs/neg14b.fs              |    2 +
 tests/fsharp/typecheck/sigs/neg15.bsl              |   60 +
 tests/fsharp/typecheck/sigs/neg15.fs               |  204 +
 tests/fsharp/typecheck/sigs/neg16.bsl              |   82 +
 tests/fsharp/typecheck/sigs/neg16.fs               |  113 +
 tests/fsharp/typecheck/sigs/neg17.bsl              |   36 +
 tests/fsharp/typecheck/sigs/neg17.fs               |  143 +
 tests/fsharp/typecheck/sigs/neg17.fsi              |   47 +
 tests/fsharp/typecheck/sigs/neg17b.fs              |   58 +
 tests/fsharp/typecheck/sigs/neg18.bsl              |   44 +
 tests/fsharp/typecheck/sigs/neg18.fs               |  192 +
 tests/fsharp/typecheck/sigs/neg19.bsl              |   20 +
 tests/fsharp/typecheck/sigs/neg19.fs               |   23 +
 tests/fsharp/typecheck/sigs/neg20.bsl              |  364 +
 tests/fsharp/typecheck/sigs/neg20.fs               |  342 +
 tests/fsharp/typecheck/sigs/neg21.bsl              |   44 +
 tests/fsharp/typecheck/sigs/neg21.fs               |   27 +
 tests/fsharp/typecheck/sigs/neg22.bsl              |   28 +
 tests/fsharp/typecheck/sigs/neg22.fs               |   41 +
 tests/fsharp/typecheck/sigs/neg23.bsl              |   40 +
 tests/fsharp/typecheck/sigs/neg23.fs               |  157 +
 tests/fsharp/typecheck/sigs/neg24.bsl              |   30 +
 tests/fsharp/typecheck/sigs/neg24.fs               |   71 +
 tests/fsharp/typecheck/sigs/neg25.bsl              |   22 +
 tests/fsharp/typecheck/sigs/neg25.fs               |  215 +
 tests/fsharp/typecheck/sigs/neg26.bsl              |   10 +
 tests/fsharp/typecheck/sigs/neg26.fs               |   53 +
 tests/fsharp/typecheck/sigs/neg27.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg27.fs               |   10 +
 tests/fsharp/typecheck/sigs/neg27.fsi              |   10 +
 tests/fsharp/typecheck/sigs/neg27.vsbsl            |    6 +
 tests/fsharp/typecheck/sigs/neg28.bsl              |  130 +
 tests/fsharp/typecheck/sigs/neg28.fsx              |  289 +
 tests/fsharp/typecheck/sigs/neg29.bsl              |   20 +
 tests/fsharp/typecheck/sigs/neg29.fs               |   24 +
 tests/fsharp/typecheck/sigs/neg30.bsl              |   34 +
 tests/fsharp/typecheck/sigs/neg30.fs               |   79 +
 tests/fsharp/typecheck/sigs/neg31.bsl              |   12 +
 tests/fsharp/typecheck/sigs/neg31.fs               |  116 +
 tests/fsharp/typecheck/sigs/neg31.fsi              |   97 +
 tests/fsharp/typecheck/sigs/neg32.bsl              |   44 +
 tests/fsharp/typecheck/sigs/neg32.fs               |   60 +
 tests/fsharp/typecheck/sigs/neg33.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg33.fs               |   14 +
 tests/fsharp/typecheck/sigs/neg33.fsi              |   16 +
 tests/fsharp/typecheck/sigs/neg34.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg34.fs               |    3 +
 tests/fsharp/typecheck/sigs/neg34.fsi              |    3 +
 tests/fsharp/typecheck/sigs/neg35.bsl              |   16 +
 tests/fsharp/typecheck/sigs/neg35.fs               |   12 +
 tests/fsharp/typecheck/sigs/neg36.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg36.fs               |   33 +
 tests/fsharp/typecheck/sigs/neg37.bsl              |   22 +
 tests/fsharp/typecheck/sigs/neg37.fs               |   43 +
 tests/fsharp/typecheck/sigs/neg37_a.bsl            |    2 +
 tests/fsharp/typecheck/sigs/neg37_a.fs             |    8 +
 tests/fsharp/typecheck/sigs/neg38.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg38.fs               |    5 +
 tests/fsharp/typecheck/sigs/neg39.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg39.fs               |    5 +
 tests/fsharp/typecheck/sigs/neg40.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg40.fs               |    6 +
 tests/fsharp/typecheck/sigs/neg41.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg41.fs               |    3 +
 tests/fsharp/typecheck/sigs/neg42.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg42.fs               |    3 +
 tests/fsharp/typecheck/sigs/neg42.fsi              |    3 +
 tests/fsharp/typecheck/sigs/neg43.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg43.fs               |   15 +
 tests/fsharp/typecheck/sigs/neg43.fsi              |   18 +
 tests/fsharp/typecheck/sigs/neg44.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg44.fs               |   43 +
 tests/fsharp/typecheck/sigs/neg45.bsl              |   84 +
 tests/fsharp/typecheck/sigs/neg45.fs               |  148 +
 tests/fsharp/typecheck/sigs/neg46.bsl              |   38 +
 tests/fsharp/typecheck/sigs/neg46.fs               |   75 +
 tests/fsharp/typecheck/sigs/neg47.bsl              |    8 +
 tests/fsharp/typecheck/sigs/neg47.fs               |   33 +
 tests/fsharp/typecheck/sigs/neg48.bsl              |   58 +
 tests/fsharp/typecheck/sigs/neg48.fs               |  108 +
 tests/fsharp/typecheck/sigs/neg49.bsl              |   24 +
 tests/fsharp/typecheck/sigs/neg49.fs               |   29 +
 tests/fsharp/typecheck/sigs/neg50.bsl              |   12 +
 tests/fsharp/typecheck/sigs/neg50.fs               |   78 +
 tests/fsharp/typecheck/sigs/neg51.bsl              |   24 +
 tests/fsharp/typecheck/sigs/neg51.fs               |   55 +
 tests/fsharp/typecheck/sigs/neg52.bsl              |   12 +
 tests/fsharp/typecheck/sigs/neg52.fs               |   24 +
 tests/fsharp/typecheck/sigs/neg53.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg53.fs               |   13 +
 tests/fsharp/typecheck/sigs/neg54.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg54.fs               |   13 +
 tests/fsharp/typecheck/sigs/neg55.bsl              |    6 +
 tests/fsharp/typecheck/sigs/neg55.fs               |   25 +
 tests/fsharp/typecheck/sigs/neg56.bsl              |   10 +
 tests/fsharp/typecheck/sigs/neg56.fs               |   28 +
 tests/fsharp/typecheck/sigs/neg56_a.bsl            |    2 +
 tests/fsharp/typecheck/sigs/neg56_a.fs             |   20 +
 tests/fsharp/typecheck/sigs/neg56_b.bsl            |    8 +
 tests/fsharp/typecheck/sigs/neg56_b.fs             |   37 +
 tests/fsharp/typecheck/sigs/neg57.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg57.fs               |    6 +
 tests/fsharp/typecheck/sigs/neg57.fsi              |    7 +
 tests/fsharp/typecheck/sigs/neg58.bsl              |    8 +
 tests/fsharp/typecheck/sigs/neg58.fs               |   11 +
 tests/fsharp/typecheck/sigs/neg58.fsi              |   11 +
 tests/fsharp/typecheck/sigs/neg59.bsl              |   46 +
 tests/fsharp/typecheck/sigs/neg59.fs               |  132 +
 tests/fsharp/typecheck/sigs/neg60.bsl              |   85 +
 tests/fsharp/typecheck/sigs/neg60.fs               |   87 +
 tests/fsharp/typecheck/sigs/neg61.bsl              |  106 +
 tests/fsharp/typecheck/sigs/neg61.fs               |  203 +
 tests/fsharp/typecheck/sigs/neg62.bsl              |   34 +
 tests/fsharp/typecheck/sigs/neg62.fs               |   88 +
 tests/fsharp/typecheck/sigs/neg63.bsl              |   12 +
 tests/fsharp/typecheck/sigs/neg63.fs               |   15 +
 tests/fsharp/typecheck/sigs/neg64.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg64.fsx              |   94 +
 tests/fsharp/typecheck/sigs/neg64.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg65.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg65.fs               |   25 +
 tests/fsharp/typecheck/sigs/neg66.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg66.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg66.vsbsl            |    6 +
 tests/fsharp/typecheck/sigs/neg67.bsl              |    8 +
 tests/fsharp/typecheck/sigs/neg67.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg67.vsbsl            |   23 +
 tests/fsharp/typecheck/sigs/neg68.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg68.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg68.vsbsl            |    8 +
 tests/fsharp/typecheck/sigs/neg69.bsl              |   68 +
 tests/fsharp/typecheck/sigs/neg69.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg69.vsbsl            |  136 +
 tests/fsharp/typecheck/sigs/neg70.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg70.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg70.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg71.bsl              |    6 +
 tests/fsharp/typecheck/sigs/neg71.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg71.vsbsl            |   16 +
 tests/fsharp/typecheck/sigs/neg72.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg72.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg72.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg73.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg73.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg73.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg74.bsl              |   56 +
 tests/fsharp/typecheck/sigs/neg74.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg74.vsbsl            |  114 +
 tests/fsharp/typecheck/sigs/neg75.bsl              |   10 +
 tests/fsharp/typecheck/sigs/neg75.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg75.vsbsl            |   20 +
 tests/fsharp/typecheck/sigs/neg76.bsl              |   10 +
 tests/fsharp/typecheck/sigs/neg76.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg76.vsbsl            |   20 +
 tests/fsharp/typecheck/sigs/neg77.bsl              |    6 +
 tests/fsharp/typecheck/sigs/neg77.fsx              |  253 +
 tests/fsharp/typecheck/sigs/neg77.vsbsl            |   14 +
 tests/fsharp/typecheck/sigs/neg78.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg78.fsx              |    4 +
 tests/fsharp/typecheck/sigs/neg78.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg79.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg79.fsx              |   93 +
 tests/fsharp/typecheck/sigs/neg79.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg80.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg80.fsx              |  145 +
 tests/fsharp/typecheck/sigs/neg80.vsbsl            |   11 +
 tests/fsharp/typecheck/sigs/neg81.bsl              |   14 +
 tests/fsharp/typecheck/sigs/neg81.fsx              |    9 +
 tests/fsharp/typecheck/sigs/neg81.vsbsl            |   28 +
 tests/fsharp/typecheck/sigs/neg82.bsl              |   22 +
 tests/fsharp/typecheck/sigs/neg82.fsx              |  144 +
 tests/fsharp/typecheck/sigs/neg82.vsbsl            |   46 +
 tests/fsharp/typecheck/sigs/neg83.bsl              |    6 +
 tests/fsharp/typecheck/sigs/neg83.fsx              |   15 +
 tests/fsharp/typecheck/sigs/neg83.vsbsl            |   12 +
 tests/fsharp/typecheck/sigs/neg84.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg84.fsx              |   10 +
 tests/fsharp/typecheck/sigs/neg84.vsbsl            |    4 +
 tests/fsharp/typecheck/sigs/neg85.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg85.fsx              |   35 +
 tests/fsharp/typecheck/sigs/neg86.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg86.fsx              |   36 +
 tests/fsharp/typecheck/sigs/neg86.vsbsl            |   22 +
 tests/fsharp/typecheck/sigs/neg87.bsl              |   40 +
 tests/fsharp/typecheck/sigs/neg87.fsx              |   15 +
 tests/fsharp/typecheck/sigs/neg88.bsl              |   18 +
 tests/fsharp/typecheck/sigs/neg88.fs               |   21 +
 tests/fsharp/typecheck/sigs/neg89.bsl              |   44 +
 tests/fsharp/typecheck/sigs/neg89.fsx              |    8 +
 tests/fsharp/typecheck/sigs/neg90.bsl              |    2 +
 tests/fsharp/typecheck/sigs/neg90.fs               |    4 +
 tests/fsharp/typecheck/sigs/neg91.bsl              |    4 +
 tests/fsharp/typecheck/sigs/neg91.fs               |   14 +
 tests/fsharp/typecheck/sigs/neg_byref_0.fs         |    7 +
 tests/fsharp/typecheck/sigs/neg_byref_1.bsl        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_1.fs         |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_10.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_10.fs        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_11.bsl       |    8 +
 tests/fsharp/typecheck/sigs/neg_byref_11.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_12.bsl       |    8 +
 tests/fsharp/typecheck/sigs/neg_byref_12.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_13.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_13.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_14.bsl       |    8 +
 tests/fsharp/typecheck/sigs/neg_byref_14.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_15.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_15.fs        |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_16.bsl       |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_16.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_17.bsl       |   18 +
 tests/fsharp/typecheck/sigs/neg_byref_17.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_18.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_18.fs        |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_19.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_19.fs        |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_2.bsl        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_2.fs         |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_20.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_20.fs        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_21.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_21.fs        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_22.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_22.fs        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_23.bsl       |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_23.fs        |    6 +
 tests/fsharp/typecheck/sigs/neg_byref_3.bsl        |    8 +
 tests/fsharp/typecheck/sigs/neg_byref_3.fs         |    3 +
 tests/fsharp/typecheck/sigs/neg_byref_4.bsl        |    8 +
 tests/fsharp/typecheck/sigs/neg_byref_4.fs         |    5 +
 tests/fsharp/typecheck/sigs/neg_byref_5.bsl        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_5.fs         |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_6.bsl        |    4 +
 tests/fsharp/typecheck/sigs/neg_byref_6.fs         |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_7.bsl        |   20 +
 tests/fsharp/typecheck/sigs/neg_byref_7.fs         |    2 +
 tests/fsharp/typecheck/sigs/neg_byref_8.bsl        |   20 +
 tests/fsharp/typecheck/sigs/neg_byref_8.fs         |    2 +
 tests/fsharp/typecheck/sigs/pos01a.fs              |   46 +
 tests/fsharp/typecheck/sigs/pos01a.fsi             |   29 +
 tests/fsharp/typecheck/sigs/pos02.fs               |   55 +
 tests/fsharp/typecheck/sigs/pos03.fs               |   24 +
 tests/fsharp/typecheck/sigs/pos03a.fs              |   24 +
 tests/fsharp/typecheck/sigs/pos03a.fsi             |   27 +
 tests/fsharp/typecheck/sigs/pos05.fs               |   64 +
 tests/fsharp/typecheck/sigs/pos06.fs               |    8 +
 tests/fsharp/typecheck/sigs/pos07.fs               |   47 +
 tests/fsharp/typecheck/sigs/pos08.fs               |  248 +
 tests/fsharp/typecheck/sigs/pos09.fs               |   21 +
 tests/fsharp/typecheck/sigs/pos10.fs               |    6 +
 tests/fsharp/typecheck/sigs/pos11.fs               |  130 +
 tests/fsharp/typecheck/sigs/pos12.fs               |   30 +
 tests/fsharp/typecheck/sigs/pos13.fs               |   10 +
 tests/fsharp/typecheck/tdirs                       |    2 +
 tests/run.bat                                      |   32 +
 tests/run40.bat                                    |   14 +
 tests/run40d.bat                                   |   14 +
 tests/tdirs                                        |    1 +
 1280 files changed, 156517 insertions(+)

diff --git a/tests/ChompErr.bat b/tests/ChompErr.bat
new file mode 100644
index 0000000..b7eadaa
--- /dev/null
+++ b/tests/ChompErr.bat
@@ -0,0 +1,31 @@
+ at if "%_echo%"=="" echo off
+if /I %1 EQU 0 	( goto Skip )
+
+if not defined _UNATTENDEDLOG ( goto Exit ) 
+
+echo ERRORLEVEL=%1: in %2 >> %_UNATTENDEDLOG%
+echo current directory is %CD%  >> %_UNATTENDEDLOG%
+:LOG_ERRORS
+if "%~3"=="" (
+echo. >> %_UNATTENDEDLOG%
+exit /b 0
+) 
+echo "%~3" >> %_UNATTENDEDLOG%
+shift /3
+goto LOG_ERRORS 
+
+
+:Skip
+exit /b 0
+
+:Exit
+echo ERRORLEVEL= %1 : in %2
+echo current directory is %CD%
+:ECHO_ERRORS
+if "%~3"=="" (
+echo 
+exit /b 1
+)
+echo %~3
+shift /3
+goto ECHO_ERRORS 
diff --git a/tests/build-and-run.bat b/tests/build-and-run.bat
new file mode 100644
index 0000000..5fbf4e9
--- /dev/null
+++ b/tests/build-and-run.bat
@@ -0,0 +1,52 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+set _ScriptHome=%~dp0%
+
+if "%_UNATTENDEDLOG%"== "" set _UNATTENDEDLOG=%~dp0%\build-and-run.log
+echo Start: >_UNATTENDEDLOG
+
+if exist tdirs (
+    for /f %%i in (tdirs) do ( 
+        if exist "%%i" (
+            pushd %%i
+            echo **************************************************
+            cd
+            cd >> %_UNATTENDEDLOG%
+            echo **************************************************
+            call %_ScriptHome%\build-and-run.bat
+            if ERRORLEVEL 1 goto Exit
+            popd
+        )
+    )
+)
+
+if NOT exist tdirs (
+    if exist build.bat (
+        call .\build.bat
+        if ERRORLEVEL 1 exit /b 1
+    )
+    
+    if exist run.bat (
+        call .\run.bat
+        if ERRORLEVEL 1 exit /b 1
+    ) 
+
+    if NOT exist build.bat (
+        if NOT exist run.bat ( 
+            echo FAILURE: build.bat and run.bat not found.  Check %CD%\..\tdirs
+            call .\build.bat > NUL 2>&1
+            if ERRORLEVEL 1 goto Error
+        )
+    )
+)
+
+:Exit
+endlocal
+
+exit /b %ERRORLEVEL%
+
+:Error
+call %_ScriptHome%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
\ No newline at end of file
diff --git a/tests/build.bat b/tests/build.bat
new file mode 100644
index 0000000..69bef2d
--- /dev/null
+++ b/tests/build.bat
@@ -0,0 +1,37 @@
+ at if "%_echo%"=="" echo off
+ 
+setlocal
+set _ScriptHome=%~dp0%
+
+if exist tdirs (
+ for /f %%i in (tdirs) do ( 
+  if exist %%i (
+	pushd %%i
+        echo **************************************************
+        cd
+        echo **************************************************
+        call %_ScriptHome%\build.bat
+	if ERRORLEVEL 1 goto Error
+	popd
+  )
+ )
+)
+
+if NOT exist tdirs (
+   if exist build.bat (
+        call .\build.bat
+	if ERRORLEVEL 1 goto Error
+   ) 
+)
+
+echo Built fsharp ok.
+:Ok
+endlocal
+exit /b 0
+
+:Error
+endlocal
+exit /b %ERRORLEVEL%
+
+
+
diff --git a/tests/config.bat b/tests/config.bat
new file mode 100644
index 0000000..276be18
--- /dev/null
+++ b/tests/config.bat
@@ -0,0 +1,288 @@
+ at if "%_echo%"=="" echo off
+
+set _SCRIPT_DRIVE=%~d0
+set _SCRIPT_PATH=%~p0
+set SCRIPT_ROOT=%_SCRIPT_DRIVE%%_SCRIPT_PATH%
+
+if not defined FSHARP_HOME set FSHARP_HOME=%SCRIPT_ROOT%..\..
+
+for /f %%i in ("%FSHARP_HOME%") do set FSHARP_HOME=%%~fi
+
+REM Do we know where fsc.exe is?
+IF DEFINED FSCBinPath goto :FSCBinPathFound
+FOR /F "delims=" %%i IN ('where fsc.exe') DO IF NOT DEFINED FSCBinPath SET FSCBinPath=%%~dpi
+:FSCBinPathFound
+
+SET CLIFLAVOUR=cli\4.5
+
+if not defined FSCBinPath set FSCBinPath=%FSHARP_HOME%\Retail\%CLIFLAVOUR%\bin
+
+if not exist "%FSCBinPath%\fsc.exe" echo %FSCBinPath%\fsc.exe not found. Assume that this is a lab QA run machine, with product installed.
+if not exist "%FSCBinPath%\fsc.exe" call :SetFSCBinPath45
+ 
+if not exist "%FSCBinPath%\fsc.exe" echo %FSCBinPath%\fsc.exe still not found. Assume that user has added it to path somewhere
+
+REM strip extra file separators and make short-name in case the the location is "Program Files" (how i hate spaces in file names!)
+if defined FSCBinPath for /f "delims=" %%l in ("%FSCBinPath%") do set FSCBinPath=%%~fsl
+
+REM add %FSCBinPath% to path only if not already there. Otherwise, the path keeps growing.
+echo %path%; | find /i "%FSCBinPath%;" > NUL
+if ERRORLEVEL 1    set PATH=%PATH%;%FSCBinPath%
+
+if "%FSDIFF%"=="" set FSDIFF=%FSHARP_HOME%\src\tests\fsharpqa\testenv\bin\%processor_architecture%\diff.exe -dew
+
+rem check if we're already configured, if not use the configuration from the last line of the config file
+if "%fsc%"=="" ( 
+    set csc_flags=/nologo
+    set fsiroot=fsi
+)
+
+if not defined ALINK  set ALINK=al.exe
+if not defined CSC    set CSC=csc.exe %csc_flags%
+
+REM SDK Dependencires.
+if not defined ILDASM   set ILDASM=ildasm.exe
+if not defined GACUTIL   set GACUTIL=gacutil.exe
+if not defined PEVERIFY set PEVERIFY=peverify.exe
+if not defined RESGEN   set RESGEN=resgen.exe
+
+if "%fsiroot%" == "" ( set fsiroot=fsi)
+
+REM == Test strategy: if we are on a 32bit OS => use fsi.exe
+REM ==                if we are on a 64bit OS => use fsiAnyCPU.exe
+REM == This way we get coverage of both binaries without having to
+REM == double the test matrix. Note that our nightly automation
+REM == always cover x86 and x64... so we won't miss much. There
+REM == is an implicit assumption that the CLR will do it's job
+REM == to make an FSIAnyCPU.exe behave as FSI.exe on a 32bit OS.
+REM == On 64 bit machines ensure that we run the 64 bit versions of tests too.
+SET OSARCH=%PROCESSOR_ARCHITECTURE%
+IF NOT "%PROCESSOR_ARCHITEW6432%"=="" SET OSARCH=%PROCESSOR_ARCHITEW6432%
+IF "%fsiroot%"=="fsi" IF NOT "%OSARCH%"=="x86" (
+    SET fsiroot=fsiAnyCPU
+    set FSC_BASIC_64=FSC_BASIC_64
+)
+
+REM ---------------------------------------------------------------
+REM If we set a "--cli-version" flag anywhere in the flags then assume its v1.x
+REM and generate a config file, so we end up running the test on the right version
+REM of the CLR.  Also modify the CORSDK used.
+REM
+REM Use CLR 1.1 at a minimum since 1.0 is not installed on most of my machines
+
+REM otherwise assume v2.0
+REM TODO: we need to update this to be v2.0 or v3.5 and nothing else.
+
+set fsc_flags=%fsc_flags% 
+
+set CLR_SUPPORTS_GENERICS=true
+set ILDASM=%ILDASM%
+set GACUTIL=%GACUTIL%
+set CLR_SUPPORTS_WINFORMS=true
+set CLR_SUPPORTS_SYSTEM_WEB=true
+
+REM ==
+REM == F# v1.0 targets NetFx3.5 (i.e. NDP2.0)
+REM == It is ok to hardcode the location, since this is not going to
+REM == change ever. Well, if/when we target a different runtime we'll have
+REM == to come and update this, but for now we MUST make sure we use the 2.0 stuff.
+REM ==
+REM == If we run on a 64bit machine (from a 64bit command prompt!), we use the 64bit
+REM == CLR, but tweaking 'Framework' to 'Framework64'.
+REM ==
+set CORDIR=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\
+
+set CORDIR40=
+FOR /D %%i IN (%windir%\Microsoft.NET\Framework\v4.0.?????) do set CORDIR40=%%i
+IF NOT "%CORDIR40%"=="" set CORDIR=%CORDIR40%
+
+REM == Use the same runtime as our architecture
+REM == ASSUMPTION: This could be a good or bad thing.
+IF /I NOT "%PROCESSOR_ARCHITECTURE%"=="x86" set CORDIR=%CORDIR:Framework=Framework64%
+
+REM ==
+REM == Find out path to NDP SDK (on a standard F# v1.0 run, this should be one of:
+REM == - NDP2.0 SDK (NetFx2.0 SDK)
+REM == - WinSDK 6.0A (VS2008)
+REM == - WinSDK 6.1 (Vista WinSDK)
+REM == - WinSDK 7.0A (Dev10)
+REM == - WinSDK 8.0A (Dev11)
+REM == - WinSDK 8.1A (Dev12)
+REM == ==> we need to peverify against NET 2.0 (F# VS2008) or 4.0/4.5/4.5.1 (F# Dev12)
+REM ==
+REM == Try Windows SDK 6.x or 7.x
+ at reg>NUL 2>&1 QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /v CurrentInstallFolder
+IF ERRORLEVEL 1 goto :TryNDPSDK20
+
+IF /I "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
+    FOR /F "tokens=2*" %%A IN ('reg QUERY "HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET CORSDK=%%B
+) ELSE (
+    FOR /F "tokens=2*" %%A IN ('reg QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v8.1A\WinSDK-NetFx40Tools" /v InstallationFolder') DO SET CORSDK=%%B
+)
+
+IF "%CORSDK%"=="" FOR /F "tokens=2*" %%A IN ('reg QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows" /v CurrentInstallFolder') DO SET CORSDK=%%BBin
+IF NOT "%CORDIR40%"=="" IF EXIST "%CORSDK%\NETFX 4.0 Tools" set CORSDK=%CORSDK%\NETFX 4.0 Tools
+
+REM == Fix up CORSDK for 64bit platforms...
+IF /I "%PROCESSOR_ARCHITECTURE%"=="AMD64" SET CORSDK=%CORSDK%\x64
+IF /I "%PROCESSOR_ARCHITECTURE%"=="IA64"  SET CORSDK=%CORSDK%\IA64
+goto :DoneCORSDK
+
+REM == Try NDP2.0 SDK
+:TryNDPSDK20
+ at reg>NUL 2>&1 QUERY "HKLM\Software\Microsoft\.NETFramework" /v sdkInstallRootv2.0
+IF NOT ERRORLEVEL 0 @echo NDPSDK Not Found!&&goto :TryNDPSDK20
+FOR /F "tokens=2*" %%A IN ('reg QUERY "HKLM\Software\Microsoft\.NETFramework" /v sdkInstallRootv2.0') DO SET CORSDK=%%BBin
+goto :DoneCORSDK
+
+:DoneCORSDK
+
+REM add powerpack to flags only if not already there. Otherwise, the variable can keep growing.
+echo %fsc_flags% | find /i "powerpack"
+if ERRORLEVEL 1 set fsc_flags=%fsc_flags% -r:System.Core.dll --nowarn:20
+
+if not defined fsi_flags set fsi_flags=%fsc_flags:--define:COMPILED=% --define:INTERACTIVE --maxerrors:1 --abortonerror
+
+echo %fsc_flags%; | find "--define:COMPILED" > NUL || (
+    set fsc_flags=%fsc_flags% --define:COMPILED
+)
+
+if NOT "%fsc_flags:generate-config-file=X%"=="%fsc_flags%" ( 
+    if NOT "%fsc_flags:clr-root=X%"=="%fsc_flags%" ( 
+        set fsc_flags=%fsc_flags% --clr-root:%CORDIR%
+    )
+)
+
+if "%CORDIR%"=="unknown" set CORDIR=
+
+REM use short names in the path so you don't have to deal with the space in things like "Program Files"
+for /f "delims=" %%I in ("%CORSDK%") do set CORSDK=%%~dfsI%
+for /f "delims=" %%I in ("%CORDIR%") do set CORDIR=%%~dfsI%
+
+set NGEN=
+
+REM ==
+REM == Set path to C# compiler. If we are NOT on NetFx4.0, try we prefer C# 3.5 to C# 2.0 
+REM == This is because we have tests that reference System.Core.dll from C# code!
+REM == (e.g. fsharp\core\fsfromcs)
+REM ==
+                        IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\csc.exe"                                          SET CSC="%CORDIR%\csc.exe" %csc_flags%
+IF     "%CORDIR40%"=="" IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\..\V3.5\csc.exe"                                  SET CSC="%CORDIR%\..\v3.5\csc.exe" %csc_flags%
+
+IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\ngen.exe"            SET NGEN=%CORDIR%\ngen.exe
+IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\al.exe"              SET ALINK=%CORDIR%\al.exe
+
+REM ==
+REM == The logic here is: pick the latest msbuild
+REM == If we are testing against NDP4.0, then don't try msbuild 3.5
+REM ==
+IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\ildasm.exe"          SET ILDASM=%CORSDK%\ildasm.exe
+IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\gacutil.exe"         SET GACUTIL=%CORSDK%\gacutil.exe
+IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\peverify.exe"        SET PEVERIFY=%CORSDK%\peverify.exe
+IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\resgen.exe"          SET RESGEN=%CORSDK%\resgen.exe
+IF NOT "%CORSDK%"=="" IF EXIST "%CORSDK%\al.exe"              SET ALINK=%CORSDK%\al.exe
+
+IF NOT DEFINED FSC                                            SET FSC=fsc.exe
+IF NOT DEFINED FSI                                            SET FSI=%fsiroot%.exe
+
+IF DEFINED FSCBinPath IF EXIST "%FSCBinPath%\fsc.exe"   SET FSC=%FSCBinPath%\fsc.exe
+IF DEFINED FSCBinPath IF EXIST "%FSCBinPath%\%fsiroot%.exe"   SET FSI=%FSCBinPath%\%fsiroot%.exe
+
+REM == In Dev11 (layout setup), FSharp.Core.dll is not sitting next to fsc.exe
+REM == so we provide an alternative location to look for it. Automation will check
+REM == this value (which may or may not be defined) and decide to use it.
+set FSCOREDLLPATH=
+set FSCOREDLL20PATH=
+call :GetFSCOREDLLPaths
+
+IF EXIST "%FSCBinPath%\FSharp.Core.dll" set FSCOREDLLPATH=%FSCBinPath%
+set FSCOREDLLPATH=%FSCOREDLLPATH%\FSharp.Core.dll
+
+set FSCOREDLL20PATH=%FSCOREDLL20PATH%\FSharp.Core.dll
+IF EXIST "%FSCBinPath%..\..\net20\bin\FSharp.Core.dll" set FSCOREDLL20PATH=%FSCBinPath%..\..\net20\bin\FSharp.Core.dll
+IF EXIST "%FSCBinPath%Runtime\2.0\FSharp.Core.dll" set FSCOREDLL20PATH=%FSCBinPath%Runtime\2.0\FSharp.Core.dll
+
+REM == Set standard flags for invoking powershell scripts
+IF NOT DEFINED PSH_FLAGS SET PSH_FLAGS=-nologo -noprofile -executionpolicy Unrestricted
+
+if DEFINED _UNATTENDEDLOG exit /b 0
+
+rem first see if we have got msbuild installed
+if exist "%X86_PROGRAMFILES%\MSBuild\12.0\Bin\MSBuild.exe" SET MSBuildToolsPath=%X86_PROGRAMFILES%\MSBuild\12.0\Bin\
+if not "%MSBuildToolsPath%" == "" goto done_MsBuildToolsPath
+
+                        IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\msbuild.exe"         SET MSBuildToolsPath=%CORDIR%
+IF     "%CORDIR40%"=="" IF NOT "%CORDIR%"=="" IF EXIST "%CORDIR%\..\V3.5\msbuild.exe" SET MSBuildToolsPath="%CORDIR%\..\V3.5\"
+
+IF NOT "%CORDIR%"=="" FOR /f %%j IN ("%MSBuildToolsPath%") do SET MSBuildToolsPath=%%~fj
+:done_MsBuildToolsPath
+
+echo ---------------------------------------------------------------
+echo Executables
+echo.
+echo ALINK               =%ALINK%
+echo CORDIR              =%CORDIR%
+echo CORSDK              =%CORSDK%
+echo CSC                 =%CSC%
+echo csc_flags           =%csc_flags%
+echo FSC                 =%FSC%
+echo fsc_flags           =%fsc_flags%
+echo FSCBinPath          =%FSCBinPath%
+echo FSCOREDLL20PATH     =%FSCOREDLL20PATH%
+echo FSCOREDLLPATH       =%FSCOREDLLPATH%
+echo FSDIFF              =%FSDIFF%
+echo FSI                 =%FSI%
+echo fsi_flags           =%fsi_flags%
+echo GACUTIL             =%GACUTIL%
+echo ILDASM              =%ILDASM%
+echo MSBUILDTOOLSPATH    =%MSBuildToolsPath%
+echo NGEN                =%ngen%
+echo PEVERIFY            =%PEVERIFY%
+echo RESGEN              =%RESGEN%
+echo ---------------------------------------------------------------
+
+exit /b 0
+
+REM ===
+REM === Find path to FSC/FSI looking up the registry
+REM === Will set the FSCBinPath env variable.
+REM === This if for Dev11+/NDP4.5
+REM === Works on both XP and Vista and hopefully everything else
+REM === Works on 32bit and 64 bit, no matter what cmd prompt it is invoked from
+REM === 
+:SetFSCBinPath45
+
+reg>NUL 2>&1 query "HKLM\SOFTWARE\Microsoft\FSharp\3.1\Runtime\v4.0" /ve
+IF ERRORLEVEL 1 goto :Try64bit
+FOR /F "tokens=1-2*" %%a IN ('reg query "HKLM\SOFTWARE\Microsoft\FSharp\3.1\Runtime\v4.0" /ve') DO set FSCBinPath=%%c
+IF EXIST "%FSCBinPath%" goto :EOF
+FOR /F "tokens=1-3*" %%a IN ('reg query "HKLM\SOFTWARE\Microsoft\FSharp\3.1\Runtime\v4.0" /ve') DO set FSCBinPath=%%d
+goto :EOF
+
+:Try64bit
+FOR /F "tokens=1-2*" %%a IN ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\FSharp\3.1\Runtime\v4.0" /ve') DO set FSCBinPath=%%c
+IF EXIST "%FSCBinPath%" goto :EOF
+FOR /F "tokens=1-3*" %%a IN ('reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\FSharp\3.1\Runtime\v4.0" /ve') DO set FSCBinPath=%%d
+
+goto :EOF
+
+REM ===
+REM === Find path to FSharp.Core.dll (in Dev11, this is under Reference Assemblies\Microsoft\FSharp\3.0\Runtime\v4.0 and v2.0)
+REM ===                               in Dev12, this is under Reference Assemblies\Microsoft\FSharp\{.NETFramework|.NETCore|.NETPortable}\...
+REM ===
+:GetFSCOREDLLPaths
+
+REM == Find out OS architecture, no matter what cmd prompt
+SET OSARCH=%PROCESSOR_ARCHITECTURE%
+IF NOT "%PROCESSOR_ARCHITEW6432%"=="" SET OSARCH=%PROCESSOR_ARCHITEW6432%
+
+REM == Find out path to native 'Program Files 32bit', no matter what
+REM == architecture we are running on and no matter what command
+REM == prompt we came from.
+IF /I "%OSARCH%"=="x86"   set X86_PROGRAMFILES=%ProgramFiles%
+IF /I "%OSARCH%"=="IA64"  set X86_PROGRAMFILES=%ProgramFiles(x86)%
+IF /I "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)%
+
+REM == Set path to v2.0 and v4.0 FSharp.Core.dll (4.0 is the default)
+set FSCOREDLLPATH=%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0
+set FSCOREDLL20PATH=%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v2.0\2.3.0.0
\ No newline at end of file
diff --git a/tests/fsharp/DecidePEVerify.ps1 b/tests/fsharp/DecidePEVerify.ps1
new file mode 100644
index 0000000..88676f0
--- /dev/null
+++ b/tests/fsharp/DecidePEVerify.ps1
@@ -0,0 +1,18 @@
+param(
+   [string] $testPath,
+   [string] $fscPath
+)
+
+$errorActionPreference = 'Stop'
+
+if(-not (Test-Path "$testPath\dont.run.peverify"))
+{
+    # seed for random selection is based on build # and test area
+    # this ensures re-runs are predictable, but different test areas get different random choices
+    $seed = (dir $fscPath).VersionInfo.FileBuildPart -bxor $testPath.GetHashCode()
+
+    # 50% chance that we will skip PEVerify step
+    $skipPEVerify = (Get-Random -SetSeed $seed) % 2
+
+    if($skipPEVerify){ 'Randomly decided not to do peverify' | out-file "$testPath\dont.run.peverify" }
+}
\ No newline at end of file
diff --git a/tests/fsharp/PickPermutations.ps1 b/tests/fsharp/PickPermutations.ps1
new file mode 100644
index 0000000..b31532a
--- /dev/null
+++ b/tests/fsharp/PickPermutations.ps1
@@ -0,0 +1,31 @@
+param(
+   [string] $testPath,  # path to test directory
+   [string] $fscPath,   # path to FSC.exe
+   [string] $allPermutations   # space-delimited list of all permutation labels
+)
+
+$errorActionPreference = 'Stop'
+
+# some permutations do not apply to all test areas
+# we don't want to randomly pick a permutation which does not apply to the current test area
+$specialCaseCriteria = @{
+   'FSC_HW'                = (Test-Path "$testPath\test-hw.*")
+   'FSC_BASIC_64'          = ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64')
+   'GENERATED_SIGNATURE'   = ((Test-Path "$testPath\test.ml") -and (-not (Test-Path "$testPath\dont.use.generated.signature")))
+   'EMPTY_SIGNATURE'       = ((Test-Path "$testPath\test.ml") -and (-not (Test-Path "$testPath\dont.use.empty.signature")))
+   'EMPTY_SIGNATURE_OPT'   = ((Test-Path "$testPath\test.ml") -and (-not (Test-Path "$testPath\dont.use.empty.signature")))
+   'AS_DLL'                = (-not (Test-Path "$testPath\dont.compile.test.as.dll"))
+   'WRAPPER_NAMESPACE'     = ((Test-Path "$testPath\test.ml") -and (-not (Test-Path "$testPath\dont.use.wrapper.namespace")))
+   'WRAPPER_NAMESPACE_OPT' = ((Test-Path "$testPath\test.ml") -and (-not (Test-Path "$testPath\dont.use.wrapper.namespace")))
+   'FSI_FILE'              = (-not (Test-Path "$testPath\dont.run.as.script"))
+   'FSI_STDIN'             = (-not (Test-Path "$testPath\dont.pipe.to.stdin"))
+   'FSI_STDIN_OPT'         = (-not (Test-Path "$testPath\dont.pipe.to.stdin"))
+   'FSI_STDIN_GUI'         = (-not (Test-Path "$testPath\dont.pipe.to.stdin"))   
+}
+
+# seed for random selection is based on build # and test area
+# this ensures re-runs are predictable, but different test areas get different random choices
+$seed = (dir $fscPath).VersionInfo.FileBuildPart -bxor $testPath.GetHashCode()
+$permutations = ($allPermutations -split '\s+') |?{ $specialCaseCriteria[$_] -ne $false } | Get-Random -SetSeed $seed
+
+$permutations -join ' '
\ No newline at end of file
diff --git a/tests/fsharp/core/access/build.bat b/tests/fsharp/core/access/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/access/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/access/run.bat b/tests/fsharp/core/access/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/access/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/access/test.fsx b/tests/fsharp/core/access/test.fsx
new file mode 100644
index 0000000..5c76953
--- /dev/null
+++ b/tests/fsharp/core/access/test.fsx
@@ -0,0 +1,269 @@
+// #Regression #Conformance #Accessibility #SignatureFiles #Regression #Records #Unions 
+#if Portable
+module Core_access
+#endif
+
+#light
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+(*--------------------*)
+
+// Test cases for bug://1562
+// Checking that generated signature can be compiled against the file.
+  
+type internal typInternal = | AAA1
+type private  typPrivate  = | AAA2
+type public   typPublic   = | AAA3
+type          typDefault  = | AAA4
+type internal rrr = | AAA
+
+let  internal  ValInternal = 1212
+let  private   ValPrivate  = 1212
+let  public    ValPublic   = 1212
+let            ValDefault  = 1212
+
+type MyClassFields = 
+    val internal fieldInternal : int
+    val private  fieldPrivate  : int
+    val public   fieldPublic   : int    
+    
+type MyClassMutableFields = 
+    val mutable internal mfieldInternal : int
+    val mutable private  mfieldPrivate  : int
+    val mutable public   mfieldPublic   : int
+    
+type MyClassStaticMembers = 
+    static member internal SInternal = 12
+    static member private  SPrivate  = 12
+    static member public   SPublic   = 12
+    static member          SDefault  = 12
+    static member internal SMInternal() = 12
+    static member private  SMPrivate()  = 12
+    static member public   SMPublic()   = 12
+    static member          SMDefault()  = 12
+    
+type MyClassPropertiyGetters =     
+    member internal x.InstInternal = 12
+    member private  x.InstPrivate  = 12
+    member public   x.InstPublic   = 12
+    member          x.InstDefault  = 12
+    
+type MyClassExplicitCtors =  
+    val v : int   
+    internal new(x)     = { v = x }
+    private  new(x,y)   = { v = x + y}
+    public   new(x,y,z) = { v = x + y + z}
+
+type MyClassExplicitCtors2 =  
+    new() = {}
+    internal new(x)     = let v : int = x in {}
+    private  new(x,y)   = let v : int = x + y in {}
+    public   new(x,y,z) = let v : int = x + y + z in {}
+    
+type MyClassPropertyGetSetterMatrix =      
+    //--
+    member obj.PropGetSetInternalInternal
+        with internal get() = 1 
+        and  internal set(x:int) = ()
+    member obj.PropGetSetInternalPrivate
+        with internal get() = 1 
+        and  private  set(x:int) = ()
+    member obj.PropGetSetInternalPublic
+        with internal get() = 1 
+        and  public   set(x:int) = ()
+    //--
+    member obj.PropGetSetPrivateInternal
+        with private  get() = 1 
+        and  internal set(x:int) = ()
+    member obj.PropGetSetPrivatePrivate
+        with private  get() = 1 
+        and  private  set(x:int) = ()
+    member obj.PropGetSetPrivatePublic
+        with private  get() = 1 
+        and  public   set(x:int) = ()
+    //--
+    member obj.PropGetSetPublicInternal    
+        with public   get() = 1 
+        and  internal set(x:int) = ()
+    member obj.PropGetSetPublicPrivate
+        with public   get() = 1 
+        and  private  set(x:int) = ()
+    member obj.PropGetSetPublicPublic
+        with public   get() = 1 
+        and  public   set(x:int) = ()    
+
+type MyClassImplicitCtorInternal internal() =
+    member obj.Res = 12    
+    
+type MyClassImplicitCtorPrivate private() =
+    member obj.Res = 12    
+    
+module internal ModInternal = begin end
+module private  ModPrivate  = begin end
+module public   ModPublic   = begin end
+
+type recordRepInternal = internal { rfA1 : int }
+type recordRepPrivate  = private  { rfA2 : int }
+type recordRepPublic   = public   { rfA3 : int }
+
+type dtypeRepInternal = internal | AA1 | BB1
+type dtypeRepPrivate  = private  | AA2 | BB2
+type dtypeRepPublic   = public   | AA3 | BB3
+
+type internal dtypeRepPublic2   =  private  | AA3 | BB3
+type private  dtypeRepPublic3   =  internal | AA3 | BB3
+
+type internal dtypeRepPublic4 =
+      private 
+              | AA3
+              | BB3
+
+module internal M = 
+  module private PP = 
+    type dtypeRepPublic5 =
+            | AA3
+            | BB3
+
+module private M2 = 
+    module internal P =
+        let vv = 12
+        
+
+module RestrictedRecordsAndUnionsUsingPrivateAndInternalTypes = 
+
+    module public Test1 =
+        
+        type internal Data = 
+                {
+                    Datum: int
+                }
+
+        type public Datum = 
+            internal
+                {
+                    Thing: Data
+                }
+
+        type public Datum2 = 
+            internal | A of Data * Data | B of Data
+                
+    module public Test2 =
+        
+        type internal Data = 
+                {
+                    Datum: int
+                }
+
+        type internal Datum = 
+                {
+                    Thing: Data
+                }
+
+        type internal Datum2 = 
+             | A of Data * Data | B of Data
+                
+    module public Test3 =
+        
+        type public Data = 
+              internal
+                {
+                    Datum: int
+                }
+
+        type internal Datum = 
+                {
+                    Thing: Data
+                }
+
+        type internal Datum2 = 
+            internal | A of Data * Data | B of Data
+                
+
+    module public Test4 =
+        
+        type internal Data = 
+                {
+                    Datum: int
+                }
+
+        type public Datum = 
+             internal
+                {
+                    Thing: Data
+                }
+
+        type public Datum2 = 
+            internal | A of Data * Data | B of Data
+                
+
+    module public Test5 =
+        
+        type private Data = 
+                {
+                    Datum: int
+                }
+
+        type public Datum = 
+            private
+                {
+                    Thing: Data
+                }
+
+        type public Datum2 = 
+            private | A of Data * Data | B of Data
+
+
+    module Test6 = 
+        module internal HelperModule = 
+            
+            type public Data = 
+                private
+                    {
+                        Datum: int
+                    }
+                    
+            let internal handle (data:Data): int = data.Datum
+            
+        module public Module =
+            
+            type public Data = 
+                private
+                    {
+                        Thing: HelperModule.Data
+                    }
+                    
+            let public getInt (data:Data): int = HelperModule.handle data.Thing               
+
+    module Test7 = 
+        module internal HelperModule = 
+            
+            type Data = 
+                    {
+                        Datum: int
+                    }
+                    
+            let handle (data:Data): int = data.Datum
+            
+        module Module =
+            
+            type Data = 
+                internal
+                    {
+                        Thing: HelperModule.Data
+                    }
+                    
+            let getInt (data:Data): int = HelperModule.handle data.Thing               
+
+
+    (*--------------------*)  
+
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
diff --git a/tests/fsharp/core/apporder/build.bat b/tests/fsharp/core/apporder/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/apporder/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/apporder/run.bat b/tests/fsharp/core/apporder/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/apporder/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/apporder/test.fsx b/tests/fsharp/core/apporder/test.fsx
new file mode 100644
index 0000000..90c641e
--- /dev/null
+++ b/tests/fsharp/core/apporder/test.fsx
@@ -0,0 +1,938 @@
+// #Conformance #Constants #Recursion #LetBindings #MemberDefinitions #Mutable 
+#if Portable
+module Core_apporder
+#endif
+
+#light
+let failures = ref false
+let report_failure (s) = 
+  stderr.WriteLine ("NO: " + s); failures := true; failwith ""
+let test s b = if b then () else report_failure(s) 
+
+(* TEST SUITE FOR Int32 *)
+
+let out r (s:string) = r := !r @ [s]
+
+let check s v1 v2 = 
+    if v1 = v2 then printfn "%s: OK" s
+    else printfn "%s: FAILED, expected %A, got %A" s v2 v1
+
+module CheckMutationOfArgumentValuesInOtherArguments = 
+    let test1232() = 
+        let mutable cell1 = 1
+        let f1 x = printfn "hello"; (fun y -> printfn "x = %A, y = %A" x y; (x,y))
+        let f2 x y = printfn "x = %A, y = %A" x y; (x,y)
+        cell1 <- 1 // reset
+        let res = f1 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test1" res (11,11)
+        cell1 <- 1 // reset
+        let res = f1 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test2" res (1,21)
+        cell1 <- 1 // reset
+        let res = (f1 (cell1 <- 11;  cell1)) cell1
+        check "test1232 - test3" res (11,11)
+        cell1 <- 1 // reset
+        let res = (f1 cell1) (cell1 <- 21;  cell1) 
+        check "test1232 - test4" res (1,21)
+        cell1 <- 1 // reset
+        let res = f2 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test5" res (11,11)
+        cell1 <- 1 // reset
+        let res = f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test6" res (1,21)
+        cell1 <- 1 // reset
+        let res = (f2 cell1) (cell1 <- 21;  cell1) 
+        check "test1232 - test7" res (1,21)
+        cell1 <- 1 // reset
+        let res = f2 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test8" res (11,11)
+        cell1 <- 1 // reset
+        let res = f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test9" res (1,21)
+
+    test1232()    
+
+    let test1233() = 
+        let cell1 = ref 1
+        let f1 x = cell1 := 4; (fun y -> printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; (x,y,!cell1))
+        let f2 x y = printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; (x,y,!cell1)
+        cell1 := 1
+        let res = f1 (cell1 := 11;  !cell1) !cell1
+        check "test1233 - test1" res (11,11,4)
+        cell1 := 1
+        let res = (f1 (cell1 := 11;  !cell1)) !cell1
+        check "test1233 - test2" res (11,4,4)
+        cell1 := 1
+        let res = f1 !cell1 (cell1 := 21;  !cell1) 
+        check "test1233 - test3" res (1,21,4)
+        cell1 := 1
+        let res = (f1 !cell1) (cell1 := 21;  !cell1) 
+        check "test1233 - test4" res (1,21,21)
+        cell1 := 1
+        let res = f2 (cell1 := 11;  !cell1) !cell1
+        check "test1233 - test5" res (11,11,11)
+        cell1 := 1
+        let res = (f2 (cell1 := 11;  !cell1)) !cell1
+        check "test1233 - test6" res (11,11,11)
+        cell1 := 1
+        let res = f2 !cell1 (cell1 := 21;  !cell1) 
+        check "test1233 - test7" res (1,21,21)
+        cell1 := 1
+        let res = (f2 !cell1) (cell1 := 21;  !cell1) 
+        check "test1233 - test8" res (1,21,21)
+
+
+    test1233()    
+
+    let test1234() = 
+        let mutable cell1 = 1
+        let f1 x = (); (fun y -> (x,y))
+        let f2 x y =  (x,y)
+        cell1 <- 1 // reset
+        let res = f1 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test1" res (11,11)
+        cell1 <- 1 // reset
+        let res = f1 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test2" res (1,21)
+        cell1 <- 1 // reset
+        let res = (f1 (cell1 <- 11;  cell1)) cell1
+        check "test1234 - test3" res (11,11)
+        cell1 <- 1 // reset
+        let res = (f1 cell1) (cell1 <- 21;  cell1) 
+        check "test1234 - test4" res (1,21)
+        cell1 <- 1 // reset
+        let res = f2 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test5" res (11,11)
+        cell1 <- 1 // reset
+        let res = f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test6" res (1,21)
+        cell1 <- 1 // reset
+        let res = (f2 cell1) (cell1 <- 21;  cell1) 
+        check "test1234 - test7" res (1,21)
+        cell1 <- 1 // reset
+        let res = f2 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test8" res (11,11)
+        cell1 <- 1 // reset
+        let res = f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test9" res (1,21)
+
+    test1234()    
+
+    let test1235() = 
+        let cell1 = ref 1
+        let f1 x = cell1 := 4; (fun y -> (* printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; *) (x,y,!cell1))
+        let f2 x y = (* printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; *) (x,y,!cell1)
+        cell1 := 1
+        let res = f1 (cell1 := 11;  !cell1) !cell1
+        check "test1235 - test1" res (11,11,4)
+        cell1 := 1
+        let res = (f1 (cell1 := 11;  !cell1)) !cell1
+        check "test1235 - test2" res (11,4,4)
+        cell1 := 1
+        let res = f1 !cell1 (cell1 := 21;  !cell1) 
+        check "test1235 - test3" res (1,21,4)
+        cell1 := 1
+        let res = (f1 !cell1) (cell1 := 21;  !cell1) 
+        check "test1235 - test4" res (1,21,21)
+        cell1 := 1
+        let res = f2 (cell1 := 11;  !cell1) !cell1
+        check "test1235 - test5" res (11,11,11)
+        cell1 := 1
+        let res = (f2 (cell1 := 11;  !cell1)) !cell1
+        check "test1235 - test6" res (11,11,11)
+        cell1 := 1
+        let res = f2 !cell1 (cell1 := 21;  !cell1) 
+        check "test1235 - test7" res (1,21,21)
+        cell1 := 1
+        let res = (f2 !cell1) (cell1 := 21;  !cell1) 
+        check "test1235 - test8" res (1,21,21)
+
+
+    test1235()    
+
+
+module CheckMutationOfArgumentValuesInOtherArgumentsWithIdFunction = 
+    let test1232() = 
+        let mutable cell1 = 1
+        let f1 x = printfn "hello"; (fun y -> printfn "x = %A, y = %A" x y; (x,y))
+        let f2 x y = printfn "x = %A, y = %A" x y; (x,y)
+        cell1 <- 1 // reset
+        let res = id f1 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test1" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f1 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test2" res (1,21)
+        cell1 <- 1 // reset
+        let res = id (f1 (cell1 <- 11;  cell1)) cell1
+        check "test1232 - test3" res (11,11)
+        cell1 <- 1 // reset
+        let res = id (f1 cell1) (cell1 <- 21;  cell1) 
+        check "test1232 - test4" res (1,21)
+        cell1 <- 1 // reset
+        let res = id f2 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test5" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test6" res (1,21)
+        cell1 <- 1 // reset
+        let res = id (f2 cell1) (cell1 <- 21;  cell1) 
+        check "test1232 - test7" res (1,21)
+        cell1 <- 1 // reset
+        let res = id f2 (cell1 <- 11;  cell1) cell1
+        check "test1232 - test8" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1232 - test9" res (1,21)
+
+    test1232()    
+
+    let test1233() = 
+        let cell1 = ref 1
+        let f1 x = cell1 := 4; (fun y -> printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; (x,y,!cell1))
+        let f2 x y = printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; (x,y,!cell1)
+        cell1 := 1
+        let res = id f1 (cell1 := 11;  !cell1) !cell1
+        check "test1233 - test1" res (11,11,4)
+        cell1 := 1
+        let res = id (f1 (cell1 := 11;  !cell1)) !cell1
+        check "test1233 - test2" res (11,4,4)
+        cell1 := 1
+        let res = id f1 !cell1 (cell1 := 21;  !cell1) 
+        check "test1233 - test3" res (1,21,4)
+        cell1 := 1
+        let res = id (f1 !cell1) (cell1 := 21;  !cell1) 
+        check "test1233 - test4" res (1,21,21)
+        cell1 := 1
+        let res = id f2 (cell1 := 11;  !cell1) !cell1
+        check "test1233 - test5" res (11,11,11)
+        cell1 := 1
+        let res = id (f2 (cell1 := 11;  !cell1)) !cell1
+        check "test1233 - test6" res (11,11,11)
+        cell1 := 1
+        let res = id f2 !cell1 (cell1 := 21;  !cell1) 
+        check "test1233 - test7" res (1,21,21)
+        cell1 := 1
+        let res = id (f2 !cell1) (cell1 := 21;  !cell1) 
+        check "test1233 - test8" res (1,21,21)
+
+
+    test1233()    
+
+    let test1234() = 
+        let mutable cell1 = 1
+        let f1 x = (); (fun y -> (x,y))
+        let f2 x y =  (x,y)
+        cell1 <- 1 // reset
+        let res = id f1 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test1" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f1 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test2" res (1,21)
+        cell1 <- 1 // reset
+        let res = id (f1 (cell1 <- 11;  cell1)) cell1
+        check "test1234 - test3" res (11,11)
+        cell1 <- 1 // reset
+        let res = id (f1 cell1) (cell1 <- 21;  cell1) 
+        check "test1234 - test4" res (1,21)
+        cell1 <- 1 // reset
+        let res = id f2 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test5" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test6" res (1,21)
+        cell1 <- 1 // reset
+        let res = id (f2 cell1) (cell1 <- 21;  cell1) 
+        check "test1234 - test7" res (1,21)
+        cell1 <- 1 // reset
+        let res = id f2 (cell1 <- 11;  cell1) cell1
+        check "test1234 - test8" res (11,11)
+        cell1 <- 1 // reset
+        let res = id f2 cell1 (cell1 <- 21;  cell1) 
+        check "test1234 - test9" res (1,21)
+
+    test1234()    
+
+    let test1235() = 
+        let cell1 = ref 1
+        let f1 x = cell1 := 4; (fun y -> (* printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; *) (x,y,!cell1))
+        let f2 x y = (* printfn "x = %A, y = %A, !cell1 = %A" x y !cell1; *) (x,y,!cell1)
+        cell1 := 1
+        let res = id f1 (cell1 := 11;  !cell1) !cell1
+        check "test1235 - test1" res (11,11,4)
+        cell1 := 1
+        let res = id (f1 (cell1 := 11;  !cell1)) !cell1
+        check "test1235 - test2" res (11,4,4)
+        cell1 := 1
+        let res = id f1 !cell1 (cell1 := 21;  !cell1) 
+        check "test1235 - test3" res (1,21,4)
+        cell1 := 1
+        let res = id (f1 !cell1) (cell1 := 21;  !cell1) 
+        check "test1235 - test4" res (1,21,21)
+        cell1 := 1
+        let res = id f2 (cell1 := 11;  !cell1) !cell1
+        check "test1235 - test5" res (11,11,11)
+        cell1 := 1
+        let res = id (f2 (cell1 := 11;  !cell1)) !cell1
+        check "test1235 - test6" res (11,11,11)
+        cell1 := 1
+        let res = id f2 !cell1 (cell1 := 21;  !cell1) 
+        check "test1235 - test7" res (1,21,21)
+        cell1 := 1
+        let res = id (f2 !cell1) (cell1 := 21;  !cell1) 
+        check "test1235 - test8" res (1,21,21)
+
+
+    test1235()    
+
+module AppTwo = 
+    let test1() = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        f (out r "1") (out r "2")
+        check "(two args at a time) test1" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        f (out r "1") (out r "2")
+        check "(two args at a time) test2" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3() = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        f (out r "1") (out r "2")
+        check "(two args at a time) test3" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        f (out r "1") (out r "2")
+        obj <- f
+        check "(two args at a time) test1captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        f (out r "1") (out r "2")
+        obj <- f
+        check "(two args at a time) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3captured() = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        f (out r "1") (out r "2")
+        obj <- f
+        check "(two args at a time) test3captured" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let test1top = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        f (out r "1") (out r "2")
+        fun () -> check "(two args at a time) test1top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        f (out r "1") (out r "2")
+        fun () -> check "(two args at a time) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3top = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        f (out r "1") (out r "2")
+        fun () -> check "(two args at a time) test3top" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let r1 = ref []
+    let f1 x = out r1 "app1"; (fun y -> out r1 "app2")
+    let test1mod() = 
+        f1 (out r1 "1") (out r1 "2")
+        check "(two args at a time) test1mod" !r1 ["1"; "2"; "app1"; "app2"]
+
+    let r2 = ref []
+    let f2 x y = out r2 "app1"; out r2 "app2"
+    let test2mod() = 
+        f2 (out r2 "1") (out r2 "2")
+        check "(two args at a time) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    let r3 = ref []
+    let f3 = out r3 "f0"; (fun x -> out r3 "app1"; (fun y -> out r3 "app2"))
+    let test3mod() = 
+        f3 (out r3 "1") (out r3 "2")
+        check "(two args at a time) test3mod" !r3 ["f0"; "1"; "2"; "app1"; "app2"]
+
+    test1()
+    test2()
+    test3()
+        
+    test1captured()
+    test2captured()
+    test3captured()
+
+    test1top()
+    test2top()
+    test3top()
+        
+    test1mod()
+    test2mod()
+    test3mod()
+    
+module AppOne = 
+    let test1() = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        (f (out r "1")) (out r "2")
+        check "(one arg at a time) test1" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        (f (out r "1")) (out r "2")
+        check "(one arg at a time) test2" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3() = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        (f (out r "1")) (out r "2")
+        check "(one arg at a time) test3" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        (f (out r "1")) (out r "2")
+        obj <- f
+        check "(one arg at a time) test1captured" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        (f (out r "1")) (out r "2")
+        obj <- f
+        check "(one arg at a time) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3captured() = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        (f (out r "1")) (out r "2")
+        obj <- f
+        check "(one arg at a time) test3captured" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let test1top = 
+        let r = ref []
+        let f x = out r "app1"; (fun y -> out r "app2")
+        (f (out r "1")) (out r "2")
+        fun () -> check "(one arg at a time) test1top" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let f x y = out r "app1"; out r "app2"
+        (f (out r "1")) (out r "2")
+        fun () -> check "(one arg at a time) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3top = 
+        let r = ref []
+        let f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        (f (out r "1")) (out r "2")
+        fun () -> check "(one arg at a time) test3top" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let r1 = ref []
+    let f1 x = out r1 "app1"; (fun y -> out r1 "app2")
+    let test1mod() = 
+        (f1 (out r1 "1")) (out r1 "2")
+        check "(one arg at a time) test1mod" !r1 ["1"; "app1"; "2"; "app2"]
+
+    let r2 = ref []
+    let f2 x y = out r2 "app1"; out r2 "app2"
+    let test2mod() = 
+        (f2 (out r2 "1")) (out r2 "2")
+        check "(one arg at a time) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    let r3 = ref []
+    let f3 = out r3 "f0"; (fun x -> out r3 "app1"; (fun y -> out r3 "app2"))
+    let test3mod() = 
+        (f3 (out r3 "1")) (out r3 "2")
+        check "(one arg at a time) test3mod" !r3 ["f0"; "1"; "app1"; "2"; "app2"]
+
+    test1()
+    test2()
+    test3()
+        
+    test1captured()
+    test2captured()
+    test3captured()
+
+    test1top()
+    test2top()
+    test3top()
+        
+    test1mod()
+    test2mod()
+    test3mod()
+    
+module AppTwoRec = 
+    let test1() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = f (out r "1") (out r "2")
+        g ()
+        check "(two args at a time, rec) test1" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = f (out r "1") (out r "2")
+        g ()
+        check "(two args at a time, rec) test2" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3() = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = f (out r "1") (out r "2")
+        g ()
+        check "(two args at a time, rec) test3" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = f (out r "1") (out r "2")
+        g ()
+        obj <- f
+        check "(two args at a time, rec) test1captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = f (out r "1") (out r "2")
+        g ()
+        obj <- f
+        check "(two args at a time, rec) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3captured() = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = f (out r "1") (out r "2")
+        g ()
+        obj <- f
+        check "(two args at a time, rec) test3captured" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let test1top = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = f (out r "1") (out r "2")
+        g ()
+        fun () -> check "(two args at a time, rec) test1top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = f (out r "1") (out r "2")
+        g ()
+        fun () -> check "(two args at a time, rec) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3top = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = f (out r "1") (out r "2")
+        g ()
+        fun () -> check "(two args at a time, rec) test3top" !r ["f0"; "1"; "2"; "app1"; "app2"]
+
+    let r1 = ref []
+    let rec f1 x = out r1 "app1"; (fun y -> out r1 "app2")
+    and g1() = f1 (out r1 "1") (out r1 "2")
+    let test1mod() = 
+        g1()
+        check "(two args at a time, rec) test1mod" !r1 ["1"; "2"; "app1"; "app2"]
+
+    let r2 = ref []
+    let rec f2 x y = out r2 "app1"; out r2 "app2"
+    and g2() = f2 (out r2 "1") (out r2 "2")
+    let test2mod() = 
+        g2()
+        check "(two args at a time, rec) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    let r3 = ref []
+    let rec f3 = out r3 "f0"; (fun x -> out r3 "app1"; (fun y -> out r3 "app2"))
+    and g3() = f3 (out r3 "1") (out r3 "2")
+    let test3mod() = 
+        g3()
+        check "(two args at a time, rec) test3mod" !r3 ["f0"; "1"; "2"; "app1"; "app2"]
+
+    test1()
+    test2()
+    test3()
+        
+    test1captured()
+    test2captured()
+    test3captured()
+
+    test1top()
+    test2top()
+    test3top()
+        
+    test1mod()
+    test2mod()
+    test3mod()
+    
+module AppOneRec = 
+    let test1() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        check "(one arg at a time, rec) test1" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        check "(one arg at a time, rec) test2" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3() = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        check "(one arg at a time, rec) test3" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        obj <- f
+        check "(one arg at a time, rec) test1captured" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        obj <- f
+        check "(one arg at a time, rec) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3captured() = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        obj <- f
+        check "(one arg at a time, rec) test3captured" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let test1top = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2")
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        fun () -> check "(one arg at a time, rec) test1top" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        fun () -> check "(one arg at a time, rec) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test3top = 
+        let r = ref []
+        let rec f = out r "f0"; (fun x -> out r "app1"; (fun y -> out r "app2"))
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        fun () -> check "(one arg at a time, rec) test3top" !r ["f0"; "1"; "app1"; "2"; "app2"]
+
+    let r1 = ref []
+    let rec f1 x = out r1 "app1"; (fun y -> out r1 "app2")
+    and g1() = (f1 (out r1 "1")) (out r1 "2")
+    let test1mod() = 
+        g1()
+        check "(one arg at a time, rec) test1mod" !r1 ["1"; "app1"; "2"; "app2"]
+
+    let r2 = ref []
+    let rec f2 x y = out r2 "app1"; out r2 "app2"
+    and g2() = (f2 (out r2 "1")) (out r2 "2")
+    let test2mod() = 
+        g2()
+        check "(one arg at a time, rec) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    let r3 = ref []
+    let rec f3 = out r3 "f0"; (fun x -> out r3 "app1"; (fun y -> out r3 "app2"))
+    and g3() = (f3 (out r3 "1")) (out r3 "2")
+    let test3mod() = 
+        g3()
+        check "(one arg at a time, rec) test3mod" !r3 ["f0"; "1"; "app1"; "2"; "app2"]
+
+    test1()
+    test2()
+    test3()
+        
+    test1captured()
+    test2captured()
+    test3captured()
+
+    test1top()
+    test2top()
+    test3top()
+        
+    test1mod()
+    test2mod()
+    test3mod()
+    
+module AppTwoRecGeneric = 
+    let test1() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = f (out r "1") (out r "2")
+        (g () : int) |> ignore
+        check "(two args at a time, rec, generic) test1" !r ["1"; "2"; "app1"; "app2"]
+        r := []
+        (g () : string) |> ignore
+        check "(two args at a time, rec, generic) test1" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = f (out r "1") (out r "2")
+        (g () : int) |> ignore
+        check "(two args at a time, rec, generic) test2" !r ["1"; "2"; "app1"; "app2"]
+        r := []
+        (g () : string) |> ignore
+        check "(two args at a time, rec, generic) test2" !r ["1"; "2"; "app1"; "app2"]
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = f (out r "1") (out r "2")
+        obj <- f
+        (g () : int) |> ignore
+        check "(two args at a time, rec, generic) test1captured" !r ["1"; "2"; "app1"; "app2"]
+        r := []
+        (g () : string) |> ignore
+        check "(two args at a time, rec, generic) test1captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = f (out r "1") (out r "2")
+        g ()
+        obj <- f
+        check "(two args at a time, rec, generic) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+    let test1top = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = f (out r "1") (out r "2")
+        g ()
+        fun () -> check "(two args at a time, rec, generic) test1top" !r ["1"; "2"; "app1"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = f (out r "1") (out r "2")
+        g ()
+        fun () -> check "(two args at a time, rec, generic) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+
+    let r1 = ref []
+    let rec f1 x = out r1 "app1"; (fun y -> out r1 "app2"; Unchecked.defaultof<'a>)
+    and g1() = f1 (out r1 "1") (out r1 "2")
+    let test1mod() = 
+        g1()
+        check "(two args at a time, rec, generic) test1mod" !r1 ["1"; "2"; "app1"; "app2"]
+
+    let r2 = ref []
+    let rec f2 x y = out r2 "app1"; out r2 "app2"; Unchecked.defaultof<'a>
+    and g2() = f2 (out r2 "1") (out r2 "2")
+    let test2mod() = 
+        g2()
+        check "(two args at a time, rec, generic) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    test1()
+    test2()
+        
+    test1captured()
+    test2captured()
+
+    test1top()
+    test2top()
+        
+    test1mod()
+    test2mod()
+    
+module AppOneRecGeneric = 
+    let test1() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        check "(one arg at a time, rec, generic) test1" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        check "(one arg at a time, rec) test2" !r ["1"; "2"; "app1"; "app2"]
+
+
+    let mutable obj = obj()
+
+    let test1captured() = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        obj <- f
+        check "(one arg at a time, rec) test1captured" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2captured() = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        obj <- f
+        check "(one arg at a time, rec, generic) test2captured" !r ["1"; "2"; "app1"; "app2"]
+
+
+    let test1top = 
+        let r = ref []
+        let rec f x = out r "app1"; (fun y -> out r "app2"; Unchecked.defaultof<'a>)
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        fun () -> check "(one arg at a time, rec, generic) test1top" !r ["1"; "app1"; "2"; "app2"]
+
+    let test2top = 
+        let r = ref []
+        let rec f x y = out r "app1"; out r "app2"; Unchecked.defaultof<'a>
+        and g() = (f (out r "1")) (out r "2")
+        g()
+        fun () -> check "(one arg at a time, rec, generic) test2top" !r ["1"; "2"; "app1"; "app2"]
+
+    let r1 = ref []
+    let rec f1 x = out r1 "app1"; (fun y -> out r1 "app2"; Unchecked.defaultof<'a>)
+    and g1() = (f1 (out r1 "1")) (out r1 "2")
+    let test1mod() = 
+        g1()
+        check "(one arg at a time, rec, generic) test1mod" !r1 ["1"; "app1"; "2"; "app2"]
+
+    let r2 = ref []
+    let rec f2 x y = out r2 "app1"; out r2 "app2"; Unchecked.defaultof<'a>
+    and g2() = (f2 (out r2 "1")) (out r2 "2")
+    let test2mod() = 
+        g2()
+        check "(one arg at a time, rec, generic) test2mod" !r2 ["1"; "2"; "app1"; "app2"]
+
+    test1()
+    test2()
+        
+    test1captured()
+    test2captured()
+
+    test1top()
+    test2top()
+        
+    test1mod()
+    test2mod()
+    
+module DuplicateTestsWithCondensedArgs = 
+    module CheckMutationOfArgumentValuesInOtherArguments = 
+        let test1232() = 
+            let mutable cell1 = 1
+            let f1 (x:System.IComparable) = printfn "hello"; (fun (y:System.IComparable) -> printfn "x = %A, y = %A" x y; ((x :?> int),(y :?> int) ))
+            let f2 (x:System.IComparable) (y:System.IComparable) = printfn "x = %A, y = %A" x y; ((x :?> int),(y :?> int) )
+            cell1 <- 1 // reset
+            let res = f1 (cell1 <- 11;  cell1) cell1
+            check "test1232 - test1" res (11,11)
+            cell1 <- 1 // reset
+            let res = f1 cell1 (cell1 <- 21;  cell1) 
+            check "test1232 - test2" res (1,21)
+            cell1 <- 1 // reset
+            let res = (f1 (cell1 <- 11;  cell1)) cell1
+            check "test1232 - test3" res (11,11)
+            cell1 <- 1 // reset
+            let res = (f1 cell1) (cell1 <- 21;  cell1) 
+            check "test1232 - test4" res (1,21)
+            cell1 <- 1 // reset
+            let res = f2 (cell1 <- 11;  cell1) cell1
+            check "test1232 - test5" res (11,11)
+            cell1 <- 1 // reset
+            let res = f2 cell1 (cell1 <- 21;  cell1) 
+            check "test1232 - test6" res (1,21)
+            cell1 <- 1 // reset
+            let res = (f2 cell1) (cell1 <- 21;  cell1) 
+            check "test1232 - test7" res (1,21)
+            cell1 <- 1 // reset
+            let res = f2 (cell1 <- 11;  cell1) cell1
+            check "test1232 - test8" res (11,11)
+            cell1 <- 1 // reset
+            let res = f2 cell1 (cell1 <- 21;  cell1) 
+            check "test1232 - test9" res (1,21)
+
+        test1232()    
+
+        let test1233() = 
+            let cell1 = ref 1
+            let f1 (x:System.IComparable) = cell1 := 4; printfn "hello"; (fun (y:System.IComparable) -> printfn "x = %A, y = %A" x y; ((x :?> int),(y :?> int),!cell1 ))
+            let f2 (x:System.IComparable) (y:System.IComparable) = printfn "x = %A, y = %A" x y; ((x :?> int),(y :?> int), !cell1 )
+            cell1 := 1
+            let res = f1 (cell1 := 11;  !cell1) !cell1
+            check "test1233 - test1" res (11,11,4)
+            cell1 := 1
+            let res = (f1 (cell1 := 11;  !cell1)) !cell1
+            check "test1233 - test2" res (11,4,4)
+            cell1 := 1
+            let res = f1 !cell1 (cell1 := 21;  !cell1) 
+            check "test1233 - test3" res (1,21,4)
+            cell1 := 1
+            let res = (f1 !cell1) (cell1 := 21;  !cell1) 
+            check "test1233 - test4" res (1,21,21)
+            cell1 := 1
+            let res = f2 (cell1 := 11;  !cell1) !cell1
+            check "test1233 - test5" res (11,11,11)
+            cell1 := 1
+            let res = (f2 (cell1 := 11;  !cell1)) !cell1
+            check "test1233 - test6" res (11,11,11)
+            cell1 := 1
+            let res = f2 !cell1 (cell1 := 21;  !cell1) 
+            check "test1233 - test7" res (1,21,21)
+            cell1 := 1
+            let res = (f2 !cell1) (cell1 := 21;  !cell1) 
+            check "test1233 - test8" res (1,21,21)
+
+
+        test1233()    
+
+module MemberAppOrder = 
+    type Foo(x:int,y:int,?z:int) =
+        let mutable a = 0
+        let mutable b = 0
+        member this.A with get() = a
+                      and set(x) = a <- x
+        member this.B with get() = b
+                      and set(x) = b <- x
+        member this.X = x
+        member this.Y = y
+        member this.Z = defaultArg z 99
+        
+    let mutable state = []
+    let out i =
+        state <- state @ [i]
+        i
+    let foo = new Foo(B=out 5, A=out 4, y=out 2, x=out 3)
+    check "cwkneccewi" state [3;2;5;4]
+    check "nvroirv" (sprintf "%d %d %d %d %d" foo.A foo.B foo.X foo.Y foo.Z) "4 5 3 2 99"
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/array/build.bat b/tests/fsharp/core/array/build.bat
new file mode 100644
index 0000000..7cec41e
--- /dev/null
+++ b/tests/fsharp/core/array/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/array/run.bat b/tests/fsharp/core/array/run.bat
new file mode 100644
index 0000000..74f0f70
--- /dev/null
+++ b/tests/fsharp/core/array/run.bat
@@ -0,0 +1,15 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
diff --git a/tests/fsharp/core/array/test.fsx b/tests/fsharp/core/array/test.fsx
new file mode 100644
index 0000000..8ba1bd0
--- /dev/null
+++ b/tests/fsharp/core/array/test.fsx
@@ -0,0 +1,1320 @@
+// #Conformance #Arrays #Stress #Structs #Mutable #ControlFlow #LetBindings 
+#if Portable
+module Core_array
+#endif
+
+#light
+let mutable failures = []
+let report_failure (s) = 
+  stderr.WriteLine " NO"; failures <- s :: failures
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+let check s b1 b2 = test s (b1 = b2)
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+  
+(* TEST SUITE FOR Array *)
+
+let test_make_get_set_length () = 
+  let arr = Array.create 3 0 in 
+  test "fewoih" (Array.get arr 0 = 0);
+  test "vvrew0" (Array.get arr 2 = 0);
+  ignore (Array.set arr 0 4);
+  test "vsdiuvs" (Array.get arr 0 = 4);
+  test "vropivrwe" (Array.length arr = 3)
+
+let test_const () = 
+  let arr =  [| 4;3;2 |]  in 
+  test "sdvjk2" (Array.get arr 0 = 4);
+  test "cedkj" (Array.get arr 2 = 2);
+  ignore (Array.set arr 0 4);
+  test "ds9023" (Array.get arr 0 = 4);
+  test "sdio2" (Array.length arr = 3)
+
+let test_const_empty () = 
+  let arr =  [| |]  in 
+  test "sdio2" (Array.length arr = 0)
+
+let test_map () = 
+  let arr = Array.map (fun x -> x + 1) ( [| 4;3;2 |]) in 
+  test "test2927: sdvjk2" (Array.get arr 0 = 5);
+  test "test2927: cedkj" (Array.get arr 2 = 3)
+
+let test_iter () = 
+  Array.iter (fun x -> test "fuo" (x <= 4)) ( [| 4;3;2 |])
+
+let test_iteri () = 
+  let arr =  [| 4;3;2 |] in 
+  Array.iteri (fun i x -> test "fuo" (arr.[i] = x)) arr
+
+let test_mapi () = 
+  let arr = [| 4;3;2 |] in 
+  let arr2 = Array.mapi (fun i x -> test "dwqfuo" (arr.[i] = x); i + x) arr in 
+  test "test2927: sdvjk2" (Array.get arr2 0 = 4);
+  test "test2927: cedkj" (Array.get arr2 2 = 4)
+
+let test_isEmpty () =
+  test "isEmpty a" (Array.isEmpty [||])
+  test "isEmpty b" (Array.isEmpty <| Array.create 0 42)
+  test "isEmpty c" <| not (Array.isEmpty <| [| 1 |])
+  test "isEmpty d" (Array.isEmpty <| Array.empty)
+
+let test_create () =
+  let arr = Array.create 10 10
+  for i in 0 .. 9 do
+      test "test_create" (arr.[i] = 10)
+
+let test_concat () =
+    let make n = [| for i in n .. n + 9 -> i |]
+    let arr = [| for i in 0..+10..50 -> make i|]
+    test "concat a" (Array.concat arr = [|0..59|])
+
+    let arr2 = [| for i in 0..50 -> [||] |]
+    test "concat b" (Array.concat arr2 = [| |])
+
+    let arr3 = [| [||]; [||]; [|1; 2|]; [||] |]
+    test "concat c" (Array.concat arr3 = [|1; 2|])
+
+let test_sub () =
+    test "sub a" (Array.sub [|0..100|] 10 20 = [|10..29|])
+    test "sub b" (Array.sub [|0..100|] 0 101 = [|0..100|])
+    test "sub c" (Array.sub [|0..100|] 0 1 = [|0|])
+    test "sub d" (Array.sub [|0..100|] 0 0 = [||])
+
+let test_fold2 () =
+    test "fold2 a"
+        (Array.fold2 (fun i j k -> i+j+k) 100 [|1;2;3|] [|1;2;3|] = 112)
+
+    test "fold2_b"
+        (Array.fold2 (fun i j k -> i-j-k) 100 [|1;2;3|] [|1;2;3|] = 100-12)
+
+let test_foldBack2 () =
+    test "foldBack2 a"
+        (Array.foldBack2 (fun i j k -> i+j+k) [|1;2;3|] [|1;2;3|] 100 = 112)
+
+    test "foldBack2_b"
+        (Array.foldBack2 (fun i j k -> k-i-j) [|1;2;3|] [|1;2;3|] 100 = 100-12)
+
+let test_scan () =
+    test "scan"
+        (Array.scan (+) 0 [|1..5|] = [|0; 1; 3; 6; 10; 15|])
+
+    test "scanBack"
+        (Array.scanBack (+) [|1..5|] 0 = [|15; 14; 12; 9; 5; 0|])
+
+let test_iter2 () =
+    let c = ref -1
+    Array.iter2 (fun x y -> incr c; test "iter2" (!c = x && !c = y)) [|0..100|] [|0..100|]
+    test "iter2" (!c = 100)
+
+let test_iteri2 () =
+    let c = ref 0
+    Array.iteri2 (fun i j k -> c := !c+i+j+k) [|1;2;3|] [|10;20;30|]
+    test "iteri2" (!c = 6+60+3)
+
+let test_map2 () =
+    test "map2"
+        (Array.map2 (+) [|0..100|] [|0..100|] = [|0..+2..200|])
+
+let test_mapi2 () =
+    test "mapi2 a"
+        (Array.mapi2 (fun i j k -> i+j+k) [|1..10|] [|1..10|] = [|2..+3..29|])
+
+    test "mapi2_b"
+        (try Array.mapi2 (fun i j k -> i+j+k) [||] [|1..10|] |> ignore; false
+         with _ -> true)
+
+let test_exists () =
+    test "exists a"
+        ([|1..100|] |> Array.exists ((=) 50))
+
+    test "exists b" <| not
+        ([|1..100|] |> Array.exists ((=) 150))
+
+let test_forall () =
+    test "forall a"
+        ([|1..100|] |> Array.forall (fun x -> x < 150))
+
+    test "forall b" <| not
+        ([|1..100|] |> Array.forall (fun x -> x < 80))
+
+let test_exists2 () =
+    test "exists2 a" <| Array.exists2 (=)
+        [|1; 2; 3; 4; 5; 6|]
+        [|2; 3; 4; 5; 6; 6|]
+
+    test "exists2 b" <| not (Array.exists2 (=)
+        [|1; 2; 3; 4; 5; 6|]
+        [|2; 3; 4; 5; 6; 7|])
+
+let test_forall2 () =
+    test "forall2 a"
+        (Array.forall2 (=) [|1..10|] [|1..10|])
+
+    test "forall2_b" <| not
+        (Array.forall2 (=) [|1;2;3;4;5|] [|1;2;3;0;5|])
+
+let test_filter () =
+    test "filter a"
+        (Array.filter (fun x -> x % 2 = 0) [|0..100|] = [|0..+2..100|])
+
+    test "filter b"
+        (Array.filter (fun x -> false) [|0..100|] = [||])
+
+    test "filter c"
+        (Array.filter (fun x -> true) [|0..100|] = [|0..100|])
+
+
+let test_partition () =
+    let p1, p2 = Array.partition (fun x -> x % 2 = 0) [|0..100|]
+    test "partition"
+        (p1 = [|0..+2..100|] && p2 = [|1..+2..100|])
+
+let test_choose () =
+    test "choose"
+        (Array.choose (fun x -> if x % 2 = 0 then Some (x/2) else None) [|0..100|] = [|0..50|])
+
+let test_find () =
+    test "find a"
+        ([|1..100|] |> Array.find (fun x -> x > 50) = 51)
+
+    test "find b"
+        (try [|1..100|] |> Array.find (fun x -> x > 180) |> ignore; false
+         with _ -> true)
+
+module Array = 
+    let findIndexi f (array : array<_>) = 
+        let len = array.Length 
+        let rec go n = 
+            if n >= len then 
+                failwith "fail"
+            elif f n array.[n] then 
+                n 
+            else 
+                go (n+1)
+        go 0
+
+    let tryFindIndexi f (array : array<_>) = 
+        let len = array.Length 
+        let rec go n = if n >= len then None elif f n array.[n] then Some n else go (n+1)
+        go 0 
+
+let test_findIndex () =
+    test "findIndex a"
+        (Array.findIndex (fun i -> i >= 4) [|0..10|] = 4)
+
+    test "findIndex b"
+        (try Array.findIndex (fun i -> i >= 20) [|0..10|] |> ignore; false
+         with _ -> true)
+   
+    test "findIndexi a"
+        (Array.findIndexi (=) [|1; 2; 3; 3; 2; 1|] = 3)
+
+    test "findIndexi b"
+        (try Array.findIndexi (=) [|1..10|] |> ignore; false
+         with _ -> true)
+
+let test_tryfind () =
+    test "tryFind"
+        ([|1..100|] |> Array.tryFind (fun x -> x > 50) = Some 51)
+
+    test "tryFind b"
+        ([|1..100|] |> Array.tryFind (fun x -> x > 180) = None)
+
+    test "tryfind_index a"
+        (Array.tryFindIndex (fun x -> x = 4) [|0..10|] = Some 4)
+
+    test "tryfind_index b"
+        (Array.tryFindIndex (fun x -> x = 42) [|0..10|] = None)
+
+    test "tryFindIndexi a"
+        (Array.tryFindIndexi (=) [|1;2;3;4;4;3;2;1|] = Some 4)
+
+    test "tryFindIndexi b"
+        (Array.tryFindIndexi (=) [|1..10|] = None)
+
+let test_first () =
+    test "first a"
+        ([|1..100|] |> Array.tryPick (fun x -> if x > 50 then Some (x*x) else None) = Some (51*51))
+
+    test "first b"
+        ([|1..100|] |> Array.tryPick (fun x -> None) = None)
+        
+    test "first c"
+        ([||] |> Array.tryPick (fun _ -> Some 42) = None)
+
+let test_sort () =
+
+    test "sort a" (Array.sort [||] = [||])
+    test "sort b" (Array.sort [|1|] = [|1|])
+    test "sort c" (Array.sort [|1;2|] = [|1;2|])
+    test "sort d" (Array.sort [|2;1|] = [|1;2|])
+    test "sort e" (Array.sort [|1..1000|] = [|1..1000|])
+    test "sort f" (Array.sort [|1000..-1..1|] = [|1..1000|])
+
+let test_sort_by () =
+
+    test "Array.sortBy a" (Array.sortBy int [||] = [||])
+    test "Array.sortBy b" (Array.sortBy int [|1|] = [|1|])
+    test "Array.sortBy c" (Array.sortBy int [|1;2|] = [|1;2|])
+    test "Array.sortBy d" (Array.sortBy int [|2;1|] = [|1;2|])
+    test "Array.sortBy e" (Array.sortBy int [|1..1000|] = [|1..1000|])
+    test "Array.sortBy f" (Array.sortBy int [|1000..-1..1|] = [|1..1000|])
+
+    let testGen s f = 
+        test ("Array.sortBy a "+s) (Array.sortBy f [||] = [||])
+        test ("Array.sortBy b "+s) (Array.sortBy f [|1|] = [|1|])
+        test ("Array.sortBy c "+s) (Array.sortBy f [|1;2|] = [|1;2|])
+        test ("Array.sortBy d "+s) (Array.sortBy f [|2;1|] = [|1;2|])
+        test ("Array.sortBy e "+s) (Array.sortBy f [|1..1000|] = [|1..1000|])
+        test ("Array.sortBy f "+s) (Array.sortBy f [|1000..-1..1|] = [|1..1000|])
+
+    // All these projects from integers preserve the expected key ordering for the tests in 'testGen()'
+    testGen "int" int
+    testGen "uint32" uint32
+    testGen "int16" int16
+    testGen "uint16" uint16
+    testGen "int64" int64
+    testGen "uint64" uint64
+    testGen "nativeint" nativeint
+    testGen "unativeint" unativeint
+    testGen "float" float
+    testGen "float32" float32
+    testGen "decimal" decimal
+
+    test "Array.sortBy g" (Array.sortBy int [|"4";"2";"3";"1";"5"|] = [|"1";"2";"3";"4";"5"|])
+    test "Array.sortBy h" (Array.sortBy abs [|1;-2;5;-4;0;-6;3|] = [|0;1;-2;3;-4;5;-6|])
+    test "Array.sortBy i" (Array.sortBy String.length [|"a";"abcd";"ab";"";"abc"|] = [|"";"a";"ab";"abc";"abcd"|])
+
+
+let test_list_stableSortBy() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sortBy snd [ for i in lo .. hi -> (i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield (i, i % 17) ])
+
+test_list_stableSortBy()         
+
+
+[<CustomEquality;CustomComparison>]
+type Key = 
+    | Key of int * int
+    interface System.IComparable with 
+        member x.CompareTo(yobj:obj) =
+            match yobj with 
+            | :? Key as y -> 
+                let (Key(y1,y2)) = y in
+                let (Key(x1,x2)) = x in
+                compare x2 y2
+            | _ -> failwith "failure"
+
+    override x.Equals(yobj) = 
+        match yobj with 
+        | :? Key as y -> 
+            let (Key(y1,y2)) = y in
+            let (Key(x1,x2)) = x in
+            x2 = y2
+        | _ -> false
+
+    override x.GetHashCode() = 
+        let (Key(x1,x2)) = x in
+        hash x2 
+
+let test_list_stableSort() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sort [ for i in lo .. hi -> Key(i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield Key(i, i % 17) ])
+
+test_list_stableSort()         
+
+let test_list_stableSortByNonIntegerKey() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sortBy (fun (Key(a,b)) -> Key(0,b)) [ for i in lo .. hi -> Key(i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield Key(i, i % 17) ])
+
+test_list_stableSortByNonIntegerKey()         
+
+
+let test_zip () =
+    test "zip"
+        (Array.zip [|1..10|] [|1..10|] = [|for i in 1..10 -> i, i|])
+
+    let unzip1, unzip2 = Array.unzip <| [|for i in 1..10 -> i, i+1|]
+    test "unzip" (unzip1 = [|1..10|] && unzip2 = [|2..11|])
+
+let test_zip3 () =
+    test "zip3"
+        (Array.zip3 [|1..10|] [|1..10|] [|1..10|] = [|for i in 1..10 -> i, i, i|])
+
+    let unzip1, unzip2, unzip3 = Array.unzip3 <| [|for i in 1..10 -> i, i+1, i+2|]
+    test "unzip3" (unzip1 = [|1..10|] && unzip2 = [|2..11|] && unzip3 = [|3..12|])
+
+
+let test_rev () =
+    test "rev a"
+        (Array.rev [|0..100|] = [|100..-1 ..0|])
+
+    test "rev b"
+        (Array.rev [|1|] = [|1|])
+
+    test "rev c"
+        (Array.rev [||] = [||])
+
+    test "rev d"
+        (Array.rev [|1; 2|] = [|2; 1|])
+
+let test_sum () =
+    test "sum a" (Array.sum [||] = 0)
+    test "sum b" (Array.sum [|42|] = 42)
+    test "sum c" (Array.sum [|42;-21|] = 21)
+    test "sum d" (Array.sum [|1..1000|] = (1000*1001) / 2)
+    test "sum e" (Array.sum [|1.;2.;3.|] = 6.)
+    test "sum f" (Array.sum [|1.;2.;infinity;3.|] = infinity)
+
+let test_sum_by () =
+    test "sum_by a" (Array.sumBy int [||] = 0)
+    test "sum_by b" (Array.sumBy int [|42|] = 42)
+    test "sum_by c" (Array.sumBy int [|42;-21|] = 21)
+    test "sum_by d" (Array.sumBy int [|1..1000|] = (1000*1001) / 2)
+    test "sum_by e" (Array.sumBy float [|1.;2.;3.|] = 6.)
+    test "sum_by f" (Array.sumBy float [|1.;2.;infinity;3.|] = infinity)
+    test "sum_by g" (Array.sumBy abs [|1; -2; 3; -4|] = 10)
+    test "sum_by h" (Array.sumBy String.length [|"abcd";"efg";"hi";"j";""|] = 10)
+
+let test_average () =
+    test "average a1" (try Array.average ([||]: float array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a2" (try Array.average ([||]: float32 array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a3" (try Array.average ([||]: decimal array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a4" (Array.average [|0.|] = 0.)
+    test "average b" (Array.average [|4.|] = 4.)
+    test "average c" (Array.average [|4.;6.|] = 5.)
+
+    test "average_by a1" (try Array.averageBy id ([||]: float array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a2" (try Array.averageBy id ([||]: float32 array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a3" (try Array.averageBy id ([||]: decimal array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a4" (Array.averageBy float [|0..1000|] = 500.)
+    test "average_by b" (Array.averageBy (String.length >> float) [|"ab";"cdef"|] = 3.)
+
+let test_min () =
+    test "min a" (Array.min [|42|] = 42)
+    test "min b" (Array.min [|42;21|] = 21)
+    test "min c" (Array.min [|'a';'b'|] = 'a')
+
+    test "max a" (Array.max [|42|] = 42)
+    test "max b" (Array.max [|42;21|] = 42)
+    test "max c" (Array.max [|'a';'b'|] = 'b')
+
+let test_min_by () =
+    test "min_by a" (Array.minBy int [|42|] = 42)
+    test "min_by b" (Array.minBy abs [|-42;-21|] = -21)
+    test "min_by c" (Array.minBy int [|'a';'b'|] = 'a')
+
+    test "max_by a" (Array.maxBy int [|42|] = 42)
+    test "max_by b" (Array.maxBy abs [|-42;-21|] = -42)
+    test "max_by c" (Array.maxBy int [|'a';'b'|] = 'b')
+
+let test_seq () =
+    test "to_seq" (Array.ofSeq [1..100] = [|1..100|])
+    test "to_seq" ([|1..100|] |> Array.toSeq |> Array.ofSeq = [|1..100|])
+
+
+let test_zero_create () = 
+  let arr = Array.zeroCreate 3 in 
+  ignore (Array.set arr 0 4);
+  ignore (Array.set arr 1 3);
+  ignore (Array.set arr 2 2);
+  test "fewoih" (Array.get arr 0 = 4);
+  test "vvrew0" (Array.get arr 1 = 3);
+  test "vvrew0" (Array.get arr 2 = 2)
+
+let test_zero_create_2 () = 
+  let arr = Array.zeroCreate 0 in 
+  test "sdio2" (Array.length arr = 0)
+
+let test_init () = 
+  let arr = Array.init 4 (fun x -> x + 1) in 
+  test "test2927: sdvjk2" (Array.get arr 0 = 1);
+  test "test2927: cedkj" (Array.get arr 2 = 3)
+
+let test_init_empty () = 
+  let arr = Array.init 0 (fun x -> x + 1) in 
+  test "test2927: sdvjk2" (Array.length arr = 0)
+
+let test_append () = 
+  let arr = Array.append ( [| "4";"3" |]) ( [| "2" |]) in
+  test "test2928: sdvjk2" (Array.get arr 0 = "4");
+  test "test2928: cedkj" (Array.get arr 2 = "2");
+  test "test2928: cedkj" (Array.length arr = 3)
+
+let test_append_empty () = 
+  let arr = Array.append ( [| |]) ( [| |]) in
+  test "test2928: cedkj" (Array.length arr = 0)
+
+let test_fill () = 
+  let arr =  [| "4";"3";"2" |] in
+  Array.fill arr 1 2 "1";
+  test "test2929: sdvjk2" (Array.get arr 0 = "4");
+  test "test2929: cedkj" (Array.get arr 2 = "1")
+
+let test_copy () = 
+  let arr =  [| "4";"3";"2" |] in
+  let arr2 =  Array.copy arr  in
+  test "test2929: sdvjk2" (Array.get arr2 0 = "4");
+  test "test2929: cedkj" (Array.get arr2 2 = "2");
+  test "feio" (not (LanguagePrimitives.PhysicalEquality arr arr2))
+
+let test_blit () = 
+  let arr =  [| "4";"3";"2";"0" |] in
+  let arr2 =  [| "4";"3";"-1"; "-1" |] in
+  Array.blit arr 1 arr2 2 2;
+  test "test2930: sdvjk2" (Array.get arr2 0 = "4");
+  test "test2930: cedkj" (Array.get arr2 1 = "3");
+  test "test2930: ceddwkj" (Array.get arr2 2 = "3");
+  test "test2930: ceqwddkj" (Array.get arr2 3 = "2")
+
+let test_of_list () = 
+  let arr = Array.ofList [ "4";"3";"2";"0" ] in
+  test "test2931: sdvjk2" (Array.get arr 0 = "4");
+  test "test2931: cedkj" (Array.get arr 1 = "3");
+  test "test2931: ceddwkj" (Array.get arr 2 = "2");
+  test "test2931: ceqwddkj" (Array.get arr 3 = "0")
+
+let test_to_list () = 
+  test "test2932" (Array.toList ( [| "4";"3";"2";"0" |]) =  [ "4";"3";"2";"0" ])
+
+let test_to_list_of_list () = 
+  test "test2933" (Array.toList (Array.ofList [ "4";"3";"2";"0" ]) = [ "4";"3";"2";"0" ])
+
+let test_fold_left () = 
+  let arr = Array.ofList [ 4;3;2;1 ] in
+  test "test2931: sdvjk2few" (Array.fold (fun x y -> x/y) (5*4*3*2*1) arr = 5)
+
+let test_fold_right () = 
+  let arr = Array.ofList [ 4;3;2;1 ] in
+  test "test2931: sdvjk2ew" (Array.foldBack (fun y x -> x/y) arr (6*4*3*2*1) = 6)
+
+let test_reduce_left () = 
+  test "test2931: array.reduce" (Array.reduce (fun x y -> x/y) [|5*4*3*2; 4;3;2;1|] = 5)
+
+let test_reduce_right () = 
+  let arr = Array.ofList [ 4;3;2;1;5 ] in
+  test "test2931: array.reduceBack" (Array.reduceBack (fun y x -> x/y) [|4;3;2;1; 5*4*3*2|] = 5)
+
+
+let _ = test_make_get_set_length ()
+let _ = test_const ()
+let _ = test_const_empty ()
+let _ = test_map ()
+let _ = test_mapi ()
+let _ = test_iter ()
+let _ = test_iteri ()
+let _ = test_mapi ()
+let _ = test_isEmpty ()
+let _ = test_create ()
+let _ = test_concat ()
+let _ = test_sub ()
+let _ = test_fold2 ()
+let _ = test_foldBack2 ()
+let _ = test_scan ()
+let _ = test_iter2 ()
+let _ = test_iteri2 ()
+let _ = test_iter ()
+let _ = test_map2 ()
+let _ = test_mapi2 ()
+let _ = test_exists ()
+let _ = test_forall ()
+let _ = test_iter ()
+let _ = test_exists2 ()
+let _ = test_forall2 ()
+let _ = test_filter ()
+let _ = test_partition ()
+let _ = test_choose ()
+let _ = test_find ()
+let _ = test_findIndex ()
+let _ = test_tryfind ()
+let _ = test_first ()
+let _ = test_sort ()
+let _ = test_sort_by ()
+let _ = test_zip ()
+let _ = test_zip3 ()
+let _ = test_rev ()
+let _ = test_sum ()
+let _ = test_sum_by ()
+let _ = test_average ()
+let _ = test_min ()
+let _ = test_min_by ()
+let _ = test_seq ()
+let _ = test_zero_create ()
+let _ = test_zero_create_2 ()
+let _ = test_append ()
+let _ = test_append_empty ()
+let _ = test_init ()
+let _ = test_init_empty ()
+let _ = test_fill ()
+let _ = test_blit ()
+let _ = test_of_list ()
+let _ = test_to_list ()
+let _ = test_to_list_of_list ()
+let _ = test_copy ()
+let _ = test_iter ()
+let _ = test_iteri ()
+let _ = test_fold_left ()
+let _ = test_fold_right ()
+let _ = test_reduce_left ()
+let _ = test_reduce_right ()
+
+module Array2Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array2D.create 3 4 0 in 
+    test "fewoih1" (Array2D.get arr 0 0 = 0);
+    test "fewoih2" (Array2D.get arr 0 1 = 0);
+    test "vvrew03" (Array2D.get arr 2 2 = 0);
+    test "vvrew04" (Array2D.get arr 2 3 = 0);
+    ignore (Array2D.set arr 0 2 4);
+    test "vsdiuvs5" (Array2D.get arr 0 2 = 4);
+    arr.[0,2] <- 2;
+    test "vsdiuvs6" (arr.[0,2] = 2);
+    test "vropivrwe7" (Array2D.length1 arr = 3);
+    test "vropivrwe8" (Array2D.length2 arr = 4)
+
+    let a = Array2D.init 10 10 (fun i j -> i,j)
+    let b = Array2D.init 2 2 (fun i j -> i+1,j+1)
+    //test "a2_sub"
+    //    (Array2D.sub a 1 1 2 2 = b)
+
+    Array2D.blit b 0 0 a 0 0 2 2
+    //test "a2_blit"
+    //      (Array2D.sub a 0 0 2 2 = b)
+
+  let _ = test_make_get_set_length ()
+
+end
+
+module Array3Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array3D.create 3 4 5 0 in 
+    test "fewoih1" (Array3D.get arr 0 0 0 = 0);
+    test "fewoih2" (Array3D.get arr 0 1 0 = 0);
+    test "vvrew03" (Array3D.get arr 2 2 2 = 0);
+    test "vvrew04" (Array3D.get arr 2 3 4 = 0);
+    ignore (Array3D.set arr 0 2 3 4);
+    test "vsdiuvs5" (Array3D.get arr 0 2 3 = 4);
+    arr.[0,2,3] <- 2;
+    test "vsdiuvs6" (arr.[0,2,3] = 2);
+    arr.[0,2,3] <- 3;
+    test "vsdiuvs" (arr.[0,2,3] = 3);
+    test "vropivrwe7" (Array3D.length1 arr = 3);
+    test "vropivrwe8" (Array3D.length2 arr = 4);
+    test "vropivrwe9" (Array3D.length3 arr = 5)
+
+  let _ = test_make_get_set_length ()
+
+end
+
+module Array4Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array4D.create 3 4 5 6 0 in 
+    arr.[0,2,3,4] <- 2;
+    test "vsdiuvsq" (arr.[0,2,3,4] = 2);
+    arr.[0,2,3,4] <- 3;
+    test "vsdiuvsw" (arr.[0,2,3,4] = 3);
+    test "vsdiuvsw" (Array4D.get arr 0 2 3 4 = 3);
+    Array4D.set arr 0 2 3 4 5;
+    test "vsdiuvsw" (Array4D.get arr 0 2 3 4 = 5);
+    test "vropivrwee" (Array4D.length1 arr = 3);
+    test "vropivrwer" (Array4D.length2 arr = 4);
+    test "vropivrwet" (Array4D.length3 arr = 5)
+    test "vropivrwey" (Array4D.length4 arr = 6)
+
+  let test_init () = 
+    let arr = Array4D.init 3 4 5 6 (fun i j k m -> i+j+k+m) in 
+    test "vsdiuvs1" (arr.[0,2,3,4] = 9);
+    test "vsdiuvs2" (arr.[0,2,3,3] = 8);
+    test "vsdiuvs3" (arr.[0,0,0,0] = 0);
+    arr.[0,2,3,4] <- 2;
+    test "vsdiuvs4" (arr.[0,2,3,4] = 2);
+    arr.[0,2,3,4] <- 3;
+    test "vsdiuvs5" (arr.[0,2,3,4] = 3);
+    test "vropivrwe1" (Array4D.length1 arr = 3);
+    test "vropivrwe2" (Array4D.length2 arr = 4);
+    test "vropivrwe3" (Array4D.length3 arr = 5)
+    test "vropivrwe4" (Array4D.length4 arr = 6)
+
+  let _ = test_make_get_set_length ()
+  let _ = test_init ()
+
+end
+
+// nb. PERF TESTING ONLY WITH v2.0 (GENERICS)
+#if PERF
+let test_map_perf () = 
+  let arr1 = [| 4;3;2 |] in 
+  let res = ref (Array.map (fun x -> x + 1) arr1) in
+  for i = 1 to 20000000 do 
+    res := Array.map (fun x -> x + 1) arr1
+  done;
+  test "test2927: sdvjk2" (Array.get !res 0 = 5)
+
+let _ = test_map_perf()
+#endif
+
+module SeqCacheAllTest = 
+    let s2 = 
+       let count = ref 0 
+       let s = Seq.cache (seq { for i in 0 .. 10 -> (incr count; i) }) :> seq<_>
+       let test0 = (!count = 0)
+       let e1 = s.GetEnumerator()
+       let test1 = (!count = 0)
+       printf "test1 = %b\n" test1;
+       for i = 1 to 1 do (e1.MoveNext() |> ignore; e1.Current |> ignore)
+       let test2 = (!count = 1)
+       printf "test2 = %b\n" test2;
+       let e2 = s.GetEnumerator()
+       for i = 1 to 5 do (e2.MoveNext() |> ignore; e2.Current |> ignore)
+       let test3 = (!count = 5)
+       printf "test3 = %b\n" test3;
+       let e3 = s.GetEnumerator()
+       for i = 1 to 5 do (e3.MoveNext() |> ignore; e3.Current |> ignore)
+       let test4 = (!count = 5)
+       printf "test4 = %b\n" test4;
+       let e4 = s.GetEnumerator()
+       for i = 1 to 3 do (e4.MoveNext() |> ignore; e4.Current |> ignore)
+       let test5 = (!count = 5)
+       printf "test5 = %b\n" test5;
+
+       let test6 = [ for x in s -> x ] = [ 0 .. 10 ]
+       printf "test6 = %b\n" test6;
+       for x in s do ()
+       let test7 = (!count = 11)
+       let test8 = [ for x in s -> x ] = [ 0 .. 10 ]
+       let test9 = !count = 11
+       test "test0" test0
+       test "test1" test1
+       test "test2" test2
+       test "test3" test3
+       test "test4" test4
+       test "test5" test5
+       test "test6" test6
+       test "test7" test7
+       test "test8" test8
+       test "test9" test9
+
+module StringSlicingTest = 
+    let s1 = "abcdef"
+    test "slice1923" (s1.[*] = s1)
+    test "slice1923" (s1.[0..] = s1)
+    test "slice1924" (s1.[1..] = "bcdef")
+    test "slice1925" (s1.[2..] = "cdef")
+    test "slice1926" (s1.[5..] = "f")
+    test "slice1927" (s1.[6..] = "")
+    test "slice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "slice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "slice1917" (s1.[..0] = "a")
+    test "slice1911" (s1.[..1] = "ab")
+    test "slice1912" (s1.[..2] = "abc")
+    test "slice1913" (s1.[..3] = "abcd")
+    test "slice1914" (s1.[..4] = "abcde")
+    test "slice1915" (s1.[..5] = "abcdef")
+    test "slice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "slice1817" (s1.[1..0] = "")
+    test "slice1811" (s1.[1..1] = "b")
+    test "slice1812" (s1.[1..2] = "bc")
+    test "slice1813" (s1.[1..3] = "bcd")
+    test "slice1814" (s1.[1..4] = "bcde")
+    test "slice1815" (s1.[1 ..5] = "bcdef")
+    test "slice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+module ArraySlicingTestBytes = 
+
+    let s1 = "abcdef"B
+    test "aslice1923" (s1.[0..] = s1)
+    test "aslice1924" (s1.[1..] = "bcdef"B)
+    test "aslice1925" (s1.[2..] = "cdef"B)
+    test "aslice1926" (s1.[5..] = "f"B)
+    test "aslice1927" (s1.[6..] = ""B)
+    test "aslice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "aslice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "aslice1917" (s1.[..0] = "a"B)
+    test "aslice1911" (s1.[..1] = "ab"B)
+    test "aslice1912" (s1.[..2] = "abc"B)
+    test "aslice1913" (s1.[..3] = "abcd"B)
+    test "aslice1914" (s1.[..4] = "abcde"B)
+    test "aslice1915" (s1.[..5] = "abcdef"B)
+    test "aslice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "aslice1817" (s1.[1..0] = ""B)
+    test "aslice1811" (s1.[1..1] = "b"B)
+    test "aslice1812" (s1.[1..2] = "bc"B)
+    test "aslice1813" (s1.[1..3] = "bcd"B)
+    test "aslice1814" (s1.[1..4] = "bcde"B)
+    test "aslice1815" (s1.[1 ..5] = "bcdef"B)
+    test "aslice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+module ArraySlicingTestInts = 
+
+    let s1 = [| 1;2;3;4;5;6 |]
+    test "aslice1923" (s1.[0..] = s1)
+    test "aslice1924" (s1.[1..] = [| 2;3;4;5;6 |])
+    test "aslice1925" (s1.[2..] = [| 3;4;5;6 |])
+    test "aslice1926" (s1.[5..] = [| 6 |])
+    test "aslice1927" (s1.[6..] = [| |])
+    test "aslice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "aslice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "aslice1917" (s1.[..0] = [| 1 |])
+    test "aslice1911" (s1.[..1] = [| 1;2|])
+    test "aslice1912" (s1.[..2] = [| 1;2;3 |])
+    test "aslice1913" (s1.[..3] = [| 1;2;3;4|])
+    test "aslice1914" (s1.[..4] = [| 1;2;3;4;5 |])
+    test "aslice1915" (s1.[..5] = [| 1;2;3;4;5;6 |])
+    test "aslice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "aslice1817" (s1.[1..0] = [|  |])
+    test "aslice1811" (s1.[1..1] = [| 2 |])
+    test "aslice1812" (s1.[1..2] = [| 2;3 |])
+    test "aslice1813" (s1.[1..3] = [| 2;3;4|])
+    test "aslice1814" (s1.[1..4] = [| 2;3;4;5|])
+    test "aslice1815" (s1.[1 ..5] = [| 2;3;4;5;6|])
+    test "aslice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+
+module Array2DSlicingTests = 
+
+    let array2d (arrs: 'a array array) = Array2D.init arrs.Length arrs.[0].Length  (fun i j -> arrs.[i].[j])
+    
+    let m1 = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                        [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |]
+    test "a2slice1923" (m1.[*,*] = m1)
+    test "a2slice1924" (m1.[0..,*] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |])
+    test "a2slice1925" (m1.[1..,*] = array2d [| //[| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |])
+    test "a2slice1926" (m1.[..0,*] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                              //[| 10.0;20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1927" (m1.[*,0..] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1928" (m1.[*,1..] = array2d [| [| 2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1929" (m1.[*,2..] = array2d [| [| 3.0;4.0;5.0;6.0 |];
+                                                [| 30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice192a" (m1.[*,3..] = array2d [| [| 4.0;5.0;6.0 |];
+                                                [| 40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice192b" (m1.[*,4..] = array2d [| [| 5.0;6.0 |];
+                                                [| 50.0;60.0 |]  
+                                            |])
+    test "a2slice192c" (m1.[*,5..] = array2d [| [| 6.0 |];
+                                                [| 60.0 |]  
+                                            |])
+    test "a2slice1930" (m1.[*, 0] = [| 1.0; 10.0 |])
+    test "a2slice1931" (m1.[1.., 3] = [| 40.0 |])
+    test "a2slice1932" (m1.[1, *] = [| 10.0;20.0;30.0;40.0;50.0;60.0 |])
+    test "a2slice1933" (m1.[0, ..3] = [| 1.0;2.0;3.0;4.0 |])
+
+    let arr2D1 = array2d [| [| 1.; 2.; 3.; 4. |];
+                            [| 5.; 6.; 7.; 8. |];
+                            [| 9.; 10.; 11.; 12. |] |]
+    arr2D1.[0, *] <- [|0.; 0.; 0.; 0.|]
+    test "a2slice1934" (arr2D1.[0,*] = [|0.; 0.; 0.; 0.|])
+    arr2D1.[*, 1] <- [|100.; 100.; 100.|]
+    test "a2slice1935" (arr2D1.[*,1] = [|100.; 100.; 100.|])
+    test "a2slice1936" (arr2D1.[*,*] = array2d [| [| 0.; 100.; 0.; 0. |];
+                                                  [| 5.; 100.; 7.; 8. |];
+                                                  [| 9.; 100.; 11.; 12. |] |])
+
+module Array3DSlicingTests = 
+
+    let array3d (arrs: 'a array array array ) = Array3D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length  (fun i j k -> arrs.[i].[j].[k])
+    
+    let m1 = array3d [| 
+                        [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                           [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                        [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                           [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+    test "a3slice1923" (m1.[*,*,*] = m1)
+    test "a3slice1924" (m1.[0..,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |])
+    test "a3slice1925" (m1.[0..0,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |] |])
+    test "a3slice1926" (m1.[1..1,*,*] = 
+                          array3d [| 
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+
+    test "a3slice1927" (m1.[*,1..1,*] = 
+                          array3d [| 
+                                    [| [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1928" (m1.[..1,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1929" (m1.[*,0..0,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];  |] |] )
+    test "a3slice1930" (m1.[*,0..1,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1931" (m1.[*,*,0..0] = 
+                          array3d [| 
+                                    [| [| 1.0|];
+                                       [| 11.0|]  |]
+                                    [| [| 10.0|];
+                                       [| 100.0 |]  |] |] )
+    test "a3slice1932" (m1.[*,*,0..5] = 
+                          array3d [|   
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+
+
+module Array4DSlicingTests = 
+
+    let array4d (arrs: 'a array array array array) = Array4D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length  arrs.[0].[0].[0].Length  (fun i j k m -> arrs.[i].[j].[k].[m])
+    
+    let m1 = array4d 
+               [|
+                 [| 
+                        [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                           [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                        [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                           [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+                 [| 
+                        [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                           [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                        [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                           [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] |]
+                |]
+    test "a4slice1923" (m1.[*,*,*,*] = m1)
+    test "a4slice1924" (m1.[0..,*,*,*] =  m1)
+    test "a4slice1925" (m1.[0..0,*,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+                              |])
+    test "a4slice1926" (m1.[1..1,*,*,*] = 
+                          array4d 
+                             [|
+                                [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] |]
+                              |])
+
+    test "a4slice1927" (m1.[*,0..0,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                               |]
+                              |])
+    test "a4slice1928" (m1.[..1,*,*,*] =  m1)
+    test "a4slice1929" (m1.[*,1..,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] 
+                               |]
+                              |])
+    test "a4slice1930" (m1.[*,0..1,*,*] =  m1)
+    test "a4slice1931" (m1.[*,*,0..0,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];  |] |]
+                              |])
+    test "a4slice1932" (m1.[*,*,*,0..5] = m1)
+
+    test "a4slice1931" (m1.[*,*,*,0..4] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0 |]  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0 |]  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0 |]  |] 
+                               |]
+                              |])
+
+module ArrayStructMutation = 
+    module Array1D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array.create 10 Unchecked.defaultof<T>
+            a.[0].i <- 27
+            check "wekvw0301" 27 a.[0].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array.create 10 Unchecked.defaultof<T>
+            a.[0].Set 27
+            a.[2].Set 27
+            check "wekvw0302" 27 a.[0].i
+            check "wekvw0303" 27 a.[2].i
+            
+    module Array2D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array2D.create 10 10 Unchecked.defaultof<T>
+            a.[0,0].i <- 27
+            check "wekvw0304" 27 a.[0,0].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array2D.create 10 10 Unchecked.defaultof<T>
+            a.[0,0].Set 27
+            a.[0,2].Set 27
+            check "wekvw0305" 27 a.[0,0].i
+            check "wekvw0306" 27 a.[0,2].i
+            
+
+    module Array3D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array3D.create 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0].i <- 27
+            a.[0,2,3].i <- 27
+            check "wekvw0307" 27 a.[0,0,0].i
+            check "wekvw0308" 27 a.[0,2,3].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array3D.create 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0].Set 27
+            a.[0,2,3].Set 27
+            check "wekvw0309" 27 a.[0,0,0].i
+            check "wekvw030q" 27 a.[0,2,3].i
+            
+    module Array4D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array4D.create 10 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0,0].i <- 27
+            a.[0,2,3,4].i <- 27
+            check "wekvw030w" 27 a.[0,0,0,0].i
+            check "wekvw030e" 27 a.[0,2,3,4].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array4D.create 10 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0,0].Set 27
+            a.[0,2,3,4].Set 27
+            check "wekvw030r" 27 a.[0,0,0,0].i 
+            check "wekvw030t" 27 a.[0,2,3,4].i
+
+module LoopTests = 
+    let loop3 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  N do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev90-%A" (a,N)) x  (if N < a then 0 else N - a + 1) 
+
+
+    do loop3 0 10
+    do loop3 0 0
+    do loop3 0 -1
+    do loop3 10  9
+
+    let loop4 a N = 
+       let mutable x = 0 in
+       for i in OperatorIntrinsics.RangeInt32 a 1 N do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev91-%A" (a,N)) x (if N < a then 0 else N - a + 1) 
+
+    do loop4 0 10
+    do loop4 0 0
+    do loop4 0 -1
+    do loop4 10  9
+
+    let loop5 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  2 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev92-%A" (a,N))  x ((if N < a then 0 else N - a + 2) / 2)
+
+    do loop5 0 10
+    do loop5 0 0
+    do loop5 0 -1
+    do loop5 10  9
+
+
+    let loop6 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  200 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev93-%A" (a,N)) x ((if N < a then 0 else N - a + 200) / 200)
+
+    do loop6 0 10
+    do loop6 0 0
+    do loop6 0 -1
+    do loop6 10  9
+
+
+    let loop7 a step N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  step .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev95-%A" (a,step,N)) x (if step < 0 then (if a < N then 0 else (a - N + abs step) / abs step) else (if N < a then 0 else N - a + step) / step)
+
+    do loop7 0 1 10
+    do loop7 0 -1 0
+    do loop7 0 2 -1
+    do loop7 10  -2 9
+
+    let loop8 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  -1 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev96-%A" (a,N))  x (abs (if a < N then 0 else (a - N + 1) / 1))
+
+    do loop8 0 10
+    do loop8 0 0
+    do loop8 0 -1
+    do loop8 10 9
+
+// Some more adhoc testing - the use of 'min' gives rise to a let binding in optimized code
+module MoreLoopTestsWithLetBindings = 
+    let loop3 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev90-%A" (a,N)) x  (if N < a then 0 else N - a + 1) 
+
+
+    do loop3 0 10
+    do loop3 0 0
+    do loop3 0 -1
+    do loop3 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop3 start finish
+
+    let loop4 a N = 
+       let mutable x = 0 in
+       for i in OperatorIntrinsics.RangeInt32 a 1 N do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev91-%A" (a,N)) x (if N < a then 0 else N - a + 1) 
+
+    do loop4 0 10
+    do loop4 0 0
+    do loop4 0 -1
+    do loop4 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop4 start finish
+
+    let loop5 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  2 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev92-%A" (a,N))  x ((if N < a then 0 else N - a + 2) / 2)
+
+    do loop5 0 10
+    do loop5 0 0
+    do loop5 0 -1
+    do loop5 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop5 start finish
+
+
+    let loop6 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  200 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev93-%A" (a,N)) x ((if N < a then 0 else N - a + 200) / 200)
+
+    do loop6 0 10
+    do loop6 0 0
+    do loop6 0 -1
+    do loop6 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop6 start finish
+
+
+    let loop7 a step N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  step .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev95-%A" (a,step,N)) x (if step < 0 then (if a < N then 0 else (a - N + abs step) / abs step) else (if N < a then 0 else N - a + step) / step)
+
+    do loop7 0 1 10
+    do loop7 0 -1 0
+    do loop7 0 2 -1
+    do loop7 10  -2 9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do for step in [-2; -1; 1; 2] do loop7 start step finish
+
+    let loop8 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  -1 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev96-%A" (a,N))  x (abs (if a < N then 0 else (a - N + 1) / 1))
+
+    do loop8 0 10
+    do loop8 0 0
+    do loop8 0 -1
+    do loop8 10 9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop8 start finish
+
+module bug872632 =
+    type MarkerStyle = 
+        | None      = 0
+        | Square    = 1
+        | Circle    = 2
+        | Diamond    = 3
+        | Triangle    = 4
+        | Triangle1   = 10
+        | Cross    = 5
+        | Star4    = 6
+        | Star5    = 7
+        | Star6    = 8
+        | Star10    = 9
+
+     
+
+    module Foo =    
+        let x = [| 
+                    MarkerStyle.Circle
+                    MarkerStyle.Cross
+                    MarkerStyle.Star6
+                    MarkerStyle.Diamond
+                    MarkerStyle.Square        
+                    MarkerStyle.Star10
+                    MarkerStyle.Triangle
+                    MarkerStyle.Triangle1
+                |] 
+
+    do check "bug872632" Foo.x.Length 8
+
+#if Portable
+#else    // this overload of CreateInstance doesn't exist in portable
+module bug6447 =
+    let a = System.Array.CreateInstance(typeof<int>, [|1|], [|1|])
+    let a1 = System.Array.CreateInstance(typeof<int>, [|1|], [|3|])
+    let a2 = System.Array.CreateInstance(typeof<int>, [|3|], [|1|])
+    
+    do check "bug6447_bound1" a a
+    do check "bug6447_bound3" a1 a1   
+    do check "bug6447_bound1_3" a2 a2
+    do check "bug6447_a_lt_a" (Unchecked.compare a a) 0
+    do check "bug6447_a_eq_a1" (Unchecked.equals a a1) false
+    do check "bug6447_a_lt_a1" (Unchecked.compare a a1) -1
+    do check "bug6447_a_lt_a1" (Unchecked.compare a1 a) 1
+    do check "bug6447_a_eq_a2" (Unchecked.equals a a2) false
+    do check "bug6447_a_lt_a2" (Unchecked.compare a a2) -1
+    do check "bug6447_a_lt_a2" (Unchecked.compare a2 a) 1
+    do check "bug6447_a1_eq_a2" (Unchecked.equals a1 a2) false
+    do check "bug6447_a1_gt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a1_lt_a2" (Unchecked.compare a1 a2) -1
+    do check "bug6447_a1_lt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a2_eq_a1" (Unchecked.equals a2 a1) false
+    do check "bug6447_a2_gt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a2_lt_a1" (Unchecked.compare a1 a2) -1
+    do check "bug6447_hash_a" (hash a) 631
+    do check "bug6447_hash_a1" (hash a1) 1893
+    do check "bug6447_hash_a2" (hash a2) 10727    
+#endif    
+    
+let aa =
+  if not failures.IsEmpty then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/attributes/build.bat b/tests/fsharp/core/attributes/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/attributes/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/attributes/cslib.cs b/tests/fsharp/core/attributes/cslib.cs
new file mode 100644
index 0000000..5ead12d
--- /dev/null
+++ b/tests/fsharp/core/attributes/cslib.cs
@@ -0,0 +1,54 @@
+namespace CSharpLibrary
+{
+
+
+    public class IntArrayPropAttribute : System.Attribute
+    {
+        int[] v;
+        public int[] Value { set { v = value; } get { return v; } }
+    }
+
+
+    public class ObjArrayPropAttribute : System.Attribute
+    {
+        object[] v;
+        public object[] Value { set { v = value; } get { return v; } }
+    }
+
+    public class AnyPropAttribute : System.Attribute
+    {
+        object v;
+        public object Value { set { v = value; } get { return v; } }
+    }
+
+    public class IntArrayAttribute : System.Attribute
+    {
+        int[] values;
+        public IntArrayAttribute(int[] value) { values = value; }
+        public int[] Value { get { return values; } }
+    }
+
+    public class ObjArrayAttribute : System.Attribute
+    {
+        object[] values;
+        public ObjArrayAttribute(object[] value) { values = value; }
+        public object[] Value { get { return values; } }
+    }
+
+
+
+    public class AnyAttribute : System.Attribute
+    {
+        object v;
+        public AnyAttribute(object value) { v = value; }
+        public object Value { get { return v; } }
+    }
+
+    [Any(new int[] { 42 })]
+    [IntArray(new int[] { 42 })]
+    [ObjArray(new object[] { 42 })]
+    [IntArrayProp(Value = new int[] { 42 })]
+    [ObjArrayProp(Value = new object[] { 42 })]
+    [AnyProp(Value = new int[] { 42 })]
+    public class TestClass { }
+}
diff --git a/tests/fsharp/core/attributes/cslib.dll b/tests/fsharp/core/attributes/cslib.dll
new file mode 100644
index 0000000..96482b4
Binary files /dev/null and b/tests/fsharp/core/attributes/cslib.dll differ
diff --git a/tests/fsharp/core/attributes/dont.use.empty.signature b/tests/fsharp/core/attributes/dont.use.empty.signature
new file mode 100644
index 0000000..1eb4099
--- /dev/null
+++ b/tests/fsharp/core/attributes/dont.use.empty.signature
@@ -0,0 +1 @@
+"indeed" 
diff --git a/tests/fsharp/core/attributes/dont.use.generated.signature b/tests/fsharp/core/attributes/dont.use.generated.signature
new file mode 100644
index 0000000..b9e931c
--- /dev/null
+++ b/tests/fsharp/core/attributes/dont.use.generated.signature
@@ -0,0 +1 @@
+because parameter names and attributes may come from the signature
diff --git a/tests/fsharp/core/attributes/dont.use.wrapper.namespace b/tests/fsharp/core/attributes/dont.use.wrapper.namespace
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/fsharp/core/attributes/dont.use.wrapper.namespace
@@ -0,0 +1 @@
+
diff --git a/tests/fsharp/core/attributes/run.bat b/tests/fsharp/core/attributes/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/attributes/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/attributes/test.fsx b/tests/fsharp/core/attributes/test.fsx
new file mode 100644
index 0000000..655e51c
--- /dev/null
+++ b/tests/fsharp/core/attributes/test.fsx
@@ -0,0 +1,1315 @@
+// #Conformance #Attributes #Interop #Regression 
+(*-------------------------------------------------------------------------
+!* attribute tests
+ *------------------------------------------------------------------------- *)
+#if Portable
+module Core_attributes
+#endif
+#light
+
+#if Portable
+#else
+#load "testlib.fsi" "testlib.fs" // a warning is expected here
+
+#r "cslib.dll"
+#endif
+
+let mutable failures : string list = []
+let report_failure msg = 
+  printf "\n................TEST '%s' FAILED...............\n" msg; failures <- failures @ [msg]
+
+let check (s:string) e r = 
+  if r = e then  stdout.WriteLine (s+": YES") 
+  else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); report_failure s)
+
+open System
+open System.Diagnostics
+
+#if Portable
+#else
+(* ATTRIBUTES *)
+
+[<LoaderOptimization(LoaderOptimization.MultiDomainHost)>] 
+
+let main = ()
+
+#endif
+    
+    
+(* attribute on a type *)
+type [< Obsolete("testing an obsolete warning is printed")>] x = X
+      
+(* attribute on a type *)
+type [<Obsolete("testing an obsolete warning is printed")>] x2 = X2
+
+let [<Obsolete("testing an obsolete warning is printed for a method")>] fx2 (x:x2) = ()
+
+let fx3 (x:x2) = fx2 x
+
+(* attribute on a method *)
+let [<Obsolete("DEBUG")>] myLoggingMethod x = stderr.WriteLine(x:string)
+
+#if Portable
+#else
+let [<STAThread>] myLoggingMethod2 x = stderr.WriteLine(x:string)
+#endif
+
+(* attribute on a type *)
+type [<Obsolete("DEBUG")>] y = Y
+
+type y2 = | [<Obsolete("Freddie")>]  Y | [<Obsolete("Mercury")>]  Z
+
+let y2f () = (Y,Z)
+
+(* attribute on a field *)
+type record = 
+    { myField1: int;
+      [<Obsolete("ABBA")>] myField2: int;
+      [<Obsolete("DEBUG")>] myDebugField3: string }
+
+let recordf x = x.myField2
+
+(*
+#r "System.Security.dll";;
+#r "System.Configuration.dll";;
+open System.Configuration
+type CustomSection = 
+class
+  inherit ConfigurationSection 
+  val fileName : string
+  new() = {inherit ConfigurationSection(); fileName = ""}
+  [<ConfigurationProperty("fileName", DefaultValue= "")>]
+  member m.FileName = m.fileName
+end;;
+*)
+
+(* attribute on a method parameter *)
+(* NOT YET: let myMethod2 x ([<Obsolete("PARAM2")>] y) = stderr.WriteLine x *)
+
+(* attribute on an instance property type *)
+(* NOT YET: let [<Obsolete("DEBUG")>] x.myDebug = x.myDebugField3 *)
+
+(* attribute on a return type *)
+(* NOT YET: let [<return: Ignore("ignore")>] myMethod3 x = x + 1 *)
+
+#if Portable
+#else
+(* BUG 428 - compile time error - on obsolete attributes *)
+let f (cert:System.Security.Cryptography.X509Certificates.X509Certificate) = 
+  let x = cert.GetName () in 
+  ()
+
+
+open System.Threading
+let test32498() = 
+  let guiTH = new Thread(new ThreadStart(fun () -> ())) in
+  guiTH.ApartmentState <- ApartmentState.STA
+
+//let [<System.Runtime.CompilerServices.CompilerGlobalScope>] id x = x
+
+//[<System.Runtime.CompilerServices.CompilerGlobalScope>] let id2 x = x
+#endif
+ 
+
+type A =
+    class
+         [<System.Obsolete("The Shock of it All!")>] new() = { }
+         [<System.Obsolete("M is old hat. Try N")>] member this.M() = ()
+         [<System.Obsolete("Hello")>] static member M2() = ()
+    end
+
+let ww (x: A) = ()
+let xx = new A()
+let yy = xx.M()
+let zz = A.M2()
+
+let checkAttributeCount s attrs n = 
+    if Array.length attrs <> n then report_failure (sprintf "incorrect number of CAs on '%s', expected %d, got %d" s n attrs.Length)
+
+module CheckAttributesExist = begin
+    open System.Reflection
+
+    [<System.Obsolete("Don't use this module!")>] 
+    module Outer = begin
+       type Inner = A | B
+       let x = 1
+       let ty = typeof<Inner> 
+       do checkAttributeCount "outer module" (ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>, false)) 1;
+    end
+end
+
+module CheckNullAttributeOnString = begin
+
+    [<System.Obsolete(null)>] 
+    module Outer = begin
+       type Inner = A | B
+       let x = 1
+       let ty = typeof<Inner> 
+       do checkAttributeCount "property f1" (ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)) 1;
+       do match ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false) with 
+          | [| (:? System.ObsoleteAttribute as ca)  |]  -> check "test423cwo3ne02" ca.Message null
+          | _ -> check "no attribute found" true false
+    end
+
+    [<System.Obsolete("")>] 
+    module Outer2 = begin
+       type Inner = A | B
+       let x = 1
+       let ty = typeof<Inner> 
+       do checkAttributeCount "property f1" (ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)) 1;
+       do match ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false) with 
+          | [| (:? System.ObsoleteAttribute as ca)  |]  -> check "test423cwo3ne02" ca.Message ""
+          | _ -> check "no attribute found" true false
+    end
+    
+    let v = Outer2.Inner.A
+
+    [<Literal>]
+    let NullLiteral : string = null
+    
+    [<System.Obsolete(NullLiteral)>] 
+    module Outer3 = begin
+       type Inner = A | B
+       let x = 1
+       let ty = typeof<Inner> 
+       do checkAttributeCount "property f1" (ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)) 1;
+       do match ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false) with 
+          | [| (:? System.ObsoleteAttribute as ca)  |]  -> check "test423cwo3ne02" ca.Message null
+          | _ -> check "no attribute found" true false
+    end
+    
+    [<Literal>]
+    let NullLiteral1 : string = null
+    
+    [<Literal>]
+    let NullLiteral2 : string = NullLiteral1
+    
+    [<System.Obsolete(NullLiteral2)>] 
+    module Outer4 = begin
+       type Inner = A | B
+       let x = 1
+       let ty = typeof<Inner> 
+       do checkAttributeCount "property f1" (ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)) 1;
+       do match ty.DeclaringType.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false) with 
+          | [| (:? System.ObsoleteAttribute as ca)  |]  -> check "test423cwo3ne02" ca.Message null
+          | _ -> check "no attribute found" true false
+    end
+    
+    
+    
+end
+
+open System
+
+/// Test the use of '|||' in attributes
+[<System.AttributeUsageAttribute(System.AttributeTargets.Assembly ||| System.AttributeTargets.Class) >]
+type BitwiseOrAttribute = class
+    inherit Attribute
+end
+
+[<System.AttributeUsageAttribute(System.AttributeTargets.Assembly ||| System.AttributeTargets.Class ||| System.AttributeTargets.Delegate) >]
+type BitwiseOrAttribute2 = class
+    inherit Attribute
+end
+           
+[<System.Reflection.AssemblyTitle("My Assembly")>]
+do ()
+
+type dummy = Dummy
+let ass = typeof<dummy>.Assembly 
+
+// Assembly attributes are currently ignored by F# Interactive, so this test
+// fails.  We ignore the failure.
+#if COMPILED
+let ca = ass.GetCustomAttributes(typeof<System.Reflection.AssemblyTitleAttribute>,false)
+do if Array.length ca <> 1 then failwith "could not find CA on assembly"
+#endif
+
+[<Obsolete("Really?")>] 
+type y3 = Y3
+
+let ca3 = typeof<y3>.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)
+do if Array.length ca3 <> 1 then failwith "could not find CA on type"
+
+[<ObsoleteAttribute("Really?")>] 
+type y4 = Y4
+
+let ca4 = typeof<y4>.GetCustomAttributes(typeof<System.ObsoleteAttribute>,false)
+do if Array.length ca4 <> 1 then failwith "could not find CA on type"
+
+
+#if Portable
+#else
+open System.Runtime.InteropServices
+
+[<DllImport("KERNEL32.DLL", EntryPoint="MoveFileW",  SetLastError=true,CharSet=CharSet.Unicode, ExactSpelling=true,CallingConvention=CallingConvention.StdCall)>]
+let MoveFile ((src : string), (dst: string)) : bool = failwith "extern"
+#endif
+
+//---------------------------------------------------------------------
+// Test we can define an attribute that accepts a named property argument
+
+
+type DontPressThisButtonAttribute = 
+  class 
+    inherit System.Attribute
+    val v: string 
+    val mutable someOtherField: string 
+    member x.SomeOtherField 
+       with get() = x.someOtherField 
+       and  set(v:string) = x.someOtherField <- v
+    member x.Message = x.v
+    new(s:string) = { inherit System.Attribute(); v=s; someOtherField="" }
+  end
+
+type [<DontPressThisButton("Please don't press this again",SomeOtherField="nor me")>] button = Buttpon
+
+let ca5 = typeof<button>.GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)
+do if Array.length ca5 <> 1 then report_failure (sprintf "could not get parameterized CA on type, num CAs = %d" (Array.length ca5))
+do if (Array.get ca5 0 :?> DontPressThisButtonAttribute).SomeOtherField <> "nor me" then failwith "unexpected value found on parameterized CA on type"
+
+
+//---------------------------------------------------------------------
+// Test we can define an attribute that accepts a named field argument
+//
+
+type DontPressThisButton2Attribute = 
+  class 
+    inherit System.Attribute
+    val v: string 
+    val mutable SomeOtherField: string 
+    member x.Message = x.v
+    new(s:string) = { inherit System.Attribute(); v=s; SomeOtherField="" }
+  end
+
+type [<DontPressThisButton2("Please don't press this again",SomeOtherField="nor me again")>] button2 = Buttpon2
+
+let ca6 = typeof<button2>.GetCustomAttributes(typeof<DontPressThisButton2Attribute>,false)
+do if Array.length ca6 <> 1 then report_failure (sprintf "could not get parameterized CA on type, num CAs = %d" (Array.length ca6))
+do if (Array.get ca6 0 :?> DontPressThisButton2Attribute).SomeOtherField <> "nor me again" then failwith "unexpected value found on parameterized CA on type"
+
+//---------------------------------------------------------------------
+// Test we can define an attribute that accepts objects and/or 
+// a negative integer
+//
+
+
+[<System.AttributeUsage (System.AttributeTargets.All,AllowMultiple=true)>]  
+type DontPressThisButton3Attribute = 
+  class 
+    inherit System.Attribute
+    val v: int 
+    val obj1: obj
+    val obj2: obj
+    member x.Number = x.v
+    member x.Object1 = x.obj1
+    member x.Object2 = x.obj2
+    new(n,obj1,obj2) = { inherit System.Attribute(); v=n; obj1= obj1; obj2=obj2  }
+  end
+
+type [<DontPressThisButton3(-1, "", -2)>] button3 = Buttpon3
+
+let ca7 = typeof<button3>.GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+do if Array.length ca7 <> 1 then report_failure (sprintf "could not get parameterized CA on type, num CAs = %d" (Array.length ca7))
+do if (Array.get ca7 0 :?> DontPressThisButton3Attribute).Number <> -1 then failwith "unexpected value found on parameterized CA on type"
+do if (Array.get ca7 0 :?> DontPressThisButton3Attribute).Object1 <> box ("") then failwith "unexpected value found on parameterized CA on type (2)"
+do if (Array.get ca7 0 :?> DontPressThisButton3Attribute).Object2    <> box (-2) then failwith "unexpected value found on parameterized CA on type (3)"
+
+
+[<DontPressThisButton3(1, "", -2)>]
+[<type: DontPressThisButton3(2, "", -2)>]
+type button4 = Buttpon4
+let ca7b = typeof<button4>.GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+do if Array.length ca7b <> 2 then report_failure (sprintf "could not get parameterized CA on type, num CAs = %d" (Array.length ca7b))
+
+[<DontPressThisButton3(1, "", -2);
+  DontPressThisButton3(2, "", -2)>]
+type button5 = Buttpon5
+let ca7c = typeof<button4>.GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+do if Array.length ca7c <> 2 then report_failure (sprintf "could not get parameterized CA on type, num CAs = %d" (Array.length ca7c))
+
+[<assembly: DontPressThisButton3(1, "", -2)>]
+do()
+
+let ca7d = 
+    let ty = typeof<button4> in
+    ty.Assembly.GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+do if Array.length ca7d <> 1 then report_failure (sprintf "could not get parameterized CA on assembly, num CAs = %d" (Array.length ca7d))
+
+#if Portable
+#else
+#if COMPILED
+[<``module``: DontPressThisButton3(1, "", -2)>]
+do()
+
+let ca7e = 
+    let ty = typeof<button4> in
+    ty.Module.GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+do if Array.length ca7e <> 1 then report_failure (sprintf "could not get parameterized CA on module, num CAs = %d" (Array.length ca7e))
+#endif
+#endif
+
+module AttributesOnUnionCases = begin
+
+    type Cases = 
+        | [<DontPressThisButton3(1, "", -2)>] 
+          Case1 of int
+        | [<DontPressThisButton3(1, "", -2)>] 
+          Case2 
+          
+    let ca7e = 
+        let ty = typeof<Cases> in
+        ty.GetMethod("NewCase1").GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+        
+    do if Array.length ca7e <> 1 then report_failure (sprintf "could not get parameterized CA on non-nullary union case, num CAs = %d" (Array.length ca7e))
+
+    let ca7f = 
+        let ty = typeof<Cases> in
+        ty.GetMethod("get_Case2").GetCustomAttributes(typeof<DontPressThisButton3Attribute>,false)
+        
+    do if Array.length ca7f <> 1 then report_failure (sprintf "could not get parameterized CA on nullary union case, num CAs = %d" (Array.length ca7f))
+
+end
+
+module CheckGenericParameterAttibutesAndNames = 
+   
+    // identical in signature and implementation
+    type Cases() = 
+        static member M<[<System.CLSCompliantAttribute(true)>] 'T>(x:'T) = x
+        static member M2<'U, 'V>(x:'U,y:'V) = x
+        static member M3(x) = x
+
+    let ca7e = typeof<Cases>.GetMethod("M").GetGenericArguments().[0].GetCustomAttributes(typeof<System.CLSCompliantAttribute>,false)
+
+    if ca7e.Length <> 1 then report_failure (sprintf "could not get parameterized CA on generic parameter, num CAs = %d" ca7e.Length)
+
+    if typeof<Cases>.GetMethod("M").GetGenericArguments().[0].Name <> "T" then report_failure "wrong name on generic parameter (A)" 
+    if typeof<Cases>.GetMethod("M2").GetGenericArguments().[0].Name <> "U" then report_failure "wrong name on generic parameter (B)" 
+    if typeof<Cases>.GetMethod("M2").GetGenericArguments().[1].Name <> "V" then report_failure "wrong name on generic parameter (C)" 
+    if typeof<Cases>.GetMethod("M3").GetGenericArguments().[0].Name <> "a" then report_failure "unexpected inferred name on generic parameter (D)" 
+
+#if Portable
+#else
+module CheckAttributesOnElementsWithSignatures = 
+
+    let checkOneAttribute msg (cas: _ []) = 
+        if cas.Length <> 1 then report_failure (sprintf "incorrect number of attributes: %s" msg)
+
+    for valName in ["x1"; "x2"; "x3"; "x4"] do 
+        checkOneAttribute ("clkjeneew1 - " + valName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("ValAttributesDifferent").GetProperty(valName).GetCustomAttributes(typeof<System.ObsoleteAttribute>,false))
+
+    for tyconName in ["C1"; "C2"; "C3"; "C4"] do 
+        checkOneAttribute ("clkjeneew2 - " + tyconName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("TyconAttributesDifferent").GetNestedType(tyconName).GetCustomAttributes(typeof<System.ObsoleteAttribute>,false))
+
+    for moduleName in ["M1"; "M2"; "M3"; "M4"] do 
+        checkOneAttribute ("clkjeneew3 - " + moduleName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("ModuleAttributesDifferent").GetNestedType(moduleName).GetCustomAttributes(typeof<System.ObsoleteAttribute>,false))
+
+    for unionCaseTypeName in ["U1"; "U2"; "U3"; "U4"] do 
+        checkOneAttribute ("clkjeneew4 - " + unionCaseTypeName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("UnionCaseAttributesDifferent").GetNestedType(unionCaseTypeName).GetMethod("NewA").GetCustomAttributes(typeof<System.ObsoleteAttribute>,false))
+
+    for methodName in ["x1"; "x2"; "x3"; "x4"] do 
+        checkOneAttribute ("clkjeneew5 - " + methodName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("ParamAttributesDifferent").GetMethod(methodName).GetParameters().[0].GetCustomAttributes(typeof<System.CLSCompliantAttribute>,false))
+
+    for methodName in ["x1"; "x2"; "x3"; "x4"] do 
+        checkOneAttribute ("clkjeneew6 - " + methodName)  (typeof<TestLibModule.ThisLibAssembly>.DeclaringType.GetNestedType("TypeParamAttributesDifferent").GetMethod(methodName).GetGenericArguments().[0].GetCustomAttributes(typeof<System.CLSCompliantAttribute>,false))
+#endif
+
+//---------------------------------------------------------------------
+// 
+module SingleParameterFix = begin
+
+
+  type C1Attribute = 
+      class 
+          inherit System.Attribute 
+          new() = { } 
+          member x.c with set(v:int) = () 
+      end
+  type C2Attribute = 
+      class 
+          inherit System.Attribute 
+          new(x:int) = { } 
+          member x.c with set(v:int) = () 
+      end
+
+  [<C1(c=3)>]
+  let c1 = ()
+
+  [<C2(3,c=3)>]
+  let c2 = ()
+end
+
+;;
+
+//---------------------------------------------------------------------
+// 
+
+
+#if Portable
+#else
+
+#r "System.Security.dll";;
+#r "System.Configuration.dll";;
+open System.Configuration;;
+
+type FSharpTestConfig = 
+  class
+    inherit ConfigurationSection 
+    new() = {inherit ConfigurationSection(); } 
+
+    member  m.get_test_string_param2() = (m.Item("test_string_param"):?>string) 
+    member  m.get_test_string_param3 = (m.Item("test_string_param"):?>string) 
+
+    [<ConfigurationProperty("foo", DefaultValue = -1)>]
+    member  m.get_test_string_param4  
+                with  get()  = (m.Item("test_string_param"):?>string) 
+
+    [<ConfigurationProperty("test_string_param",DefaultValue= "teststring")>]
+    member  m.test_string_param
+              with get()  = (m.Item("test_string_param"):?>string) 
+              and  set(v:string) = m.Item("test_string_param") <- v
+
+    [<ConfigurationProperty("test_bool_param",DefaultValue= true)>]
+    member  m.test_bool_param
+      with get()  = (m.Item("test_bool_param"):?>bool)
+      and  set(v:bool) = m.Item("test_bool_param") <- v
+  end
+
+module RandomPhilTrelfordTest = begin
+
+    open System.Diagnostics
+    open System.Configuration
+
+    type DiagDebug = System.Diagnostics.Debug
+
+    let f() = 
+      let config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) in
+      let server = config.AppSettings.Settings.get_Item("SMTPServer") in
+      printf "%s" (server.Value.ToString());
+      DiagDebug.WriteLine("Hello world")
+end
+#endif
+
+(*-------------------------------------------------------------------------
+!* thread static
+ *------------------------------------------------------------------------- *)
+
+module ThreadStaticTest = begin
+
+    open System
+    open System.Threading 
+    open System.Runtime.CompilerServices
+
+
+    let lock_obj = new Object()
+
+
+    let safe_print (s:string) = 
+        lock lock_obj
+            (fun () ->
+                stdout.WriteLine s)
+
+    let safe_fail (s:string) = 
+        lock lock_obj
+            (fun () ->
+                stdout.WriteLine s);
+        exit 1
+     
+
+    type C() = 
+        [<ThreadStatic; DefaultValue>]
+        static val mutable private n : int
+        static member N with get() = C.n and set v = C.n <- v
+
+        [<ThreadStatic; DefaultValue>]
+        static val mutable private results : int list
+        static member Results with get() = C.results and set v = C.results <- v
+
+#if Portable
+#else
+    let N = 1000
+    let main() = 
+        let t1 = 
+            new Thread(
+                fun () -> 
+                    C.N <-  0;
+                    C.Results <-  [];
+                    for x = 1 to N do 
+                        C.Results <- C.N :: C.Results;
+                        C.N <- 1 + C.N;
+                        Thread.Sleep(0)
+                    done;
+                    safe_print
+                        (Printf.sprintf "Thread 1: %s\r\n" (sprintf "%A" C.Results));
+                    if List.rev C.Results <> List.init N (fun i -> i) then 
+                      safe_fail(Printf.sprintf "Thread 1 failed to produce correct results!\r\n" )
+                    ) in
+        let t2 = 
+            new Thread(
+                fun () -> 
+                    C.N <- 0;
+                    C.Results <-  [];
+                    for x = 1 to N do 
+                        C.Results <- C.N :: C.Results;
+                        C.N <- C.N - 1;
+                        Thread.Sleep(0)
+                    done;
+                    safe_print
+                        (Printf.sprintf "Thread 2: %s\r\n" (sprintf "%A" C.Results));
+                    if List.rev C.Results <> List.init N (fun i -> -i) then 
+                      safe_fail(Printf.sprintf "Thread 2 failed to produce correct results!\r\n")
+                    ) in
+        t1.Start();
+        t2.Start();
+        safe_print "Return to end ...";
+        t1.Join();
+        t2.Join();
+        ()
+        
+
+    do main()
+#endif
+
+end
+
+
+(*-------------------------------------------------------------------------
+!* System.Runtime.InteropServices.In/OUT attributes
+ *------------------------------------------------------------------------- *)
+#if Portable
+#else
+open System
+let g   ( [<System.Runtime.InteropServices.Out>] x : int byref) = 0
+let g2 (( [<System.Runtime.InteropServices.In>]  x : int byref), ([<System.Runtime.InteropServices.Out >] y : int byref)) = 0
+let g11 ( [<System.Runtime.InteropServices.In>]  x : int byref)  ([<System.Runtime.InteropServices.Out >] y : int byref)  = 0
+#endif
+
+type C = 
+  class 
+    [<DontPressThisButtonAttribute("no!")>]
+    val f1 : int
+    [<field: DontPressThisButtonAttribute("no!")>]
+    val f2 : int
+    [<property: DontPressThisButtonAttribute("no!")>]
+    val f3 : int
+    [<field: DontPressThisButtonAttribute("no!")>]
+    [<property: DontPressThisButtonAttribute("no!")>]
+    val f4 : int
+
+    [<DontPressThisButtonAttribute("no!")>]
+    val mutable mf1 : int
+    [<field: DontPressThisButtonAttribute("no!")>]
+    val mutable mf2 : int
+    //[<property: DontPressThisButtonAttribute("no!")>]
+    //val mutable mf3 : int
+    //[<field: DontPressThisButtonAttribute("no!")>]
+    //[<property: DontPressThisButtonAttribute("no!")>]
+    //val mutable mf4 : int
+
+    static member StaticMember ( [<System.Runtime.InteropServices.Out >] p : int byref) = 0 
+    member x.InstanceMember    ( [<System.Runtime.InteropServices.Out >] p : int byref) = 0
+    member x.InstanceP 
+        with get (idx : int) = ()
+        and  set (idx : int) (v:int) = ()
+
+    [<Obsolete("obsolete")>]
+    abstract VirtualMethod1 : p : int byref -> int
+    [<Obsolete("obsolete")>]
+    default this.VirtualMethod1  (p : int byref) = 0
+
+    abstract VirtualMethod2 : p : int byref -> int
+    [<Obsolete("obsolete")>]
+    default this.VirtualMethod2  (p : int byref) = 0
+
+    [<Obsolete("obsolete")>]
+    abstract VirtualMethod3 : p : int byref -> int
+    default this.VirtualMethod3  (p : int byref) = 0
+
+    end
+
+#if Portable
+#else
+let test2179 = 
+    let ty = typeof<C> in
+
+    checkAttributeCount "property f1" (ty.GetProperty("f1").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    checkAttributeCount "property f2" (ty.GetProperty("f2").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 0;
+    checkAttributeCount "property f3" (ty.GetProperty("f3").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    checkAttributeCount "property f4" (ty.GetProperty("f4").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    let fields = ty.GetFields(Reflection.BindingFlags.NonPublic ||| Reflection.BindingFlags.Public ||| Reflection.BindingFlags.GetField ||| Reflection.BindingFlags.Instance  ||| Reflection.BindingFlags.Static) in
+    printfn "fields = %A" fields;
+    let findField nm = fields |> Array.find(fun f -> f.Name = nm) in
+    checkAttributeCount "field f1@" (findField("f1@").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 0;
+    checkAttributeCount "field f2@" (findField("f2@").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    checkAttributeCount "field f3@" (findField("f3@").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 0;
+    checkAttributeCount "field f4@" (findField("f4@").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+
+    //checkAttributeCount "property mf1" (ty.GetProperty("mf1").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    //checkAttributeCount "property mf2" (ty.GetProperty("mf2").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 0;
+    //checkAttributeCount "property mf3" (ty.GetProperty("mf3").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    //checkAttributeCount "property mf4" (ty.GetProperty("mf4").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    checkAttributeCount "field mf1" (ty.GetField("mf1").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    checkAttributeCount "field mf2" (ty.GetField("mf2").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    //checkAttributeCount "field mf3" (ty.GetField("mf3").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+    //checkAttributeCount "field mf4" (ty.GetField("mf4").GetCustomAttributes(typeof<DontPressThisButtonAttribute>,false)) 1;
+
+    checkAttributeCount "method VirtualMethod1" (ty.GetMethod("VirtualMethod1").GetCustomAttributes(typeof<ObsoleteAttribute>,false)) 1;
+    checkAttributeCount "method VirtualMethod2" (ty.GetMethod("VirtualMethod2").GetCustomAttributes(typeof<ObsoleteAttribute>,false)) 1
+    //checkAttributeCount "method VirtualMethod3" (ty.GetMethod("VirtualMethod3").GetCustomAttributes(typeof<ObsoleteAttribute>,false)) 1
+#endif
+
+let paramsOf (typ:System.Type) (methName:string) =
+  let meth = typ.GetMethod(methName) in
+  let pars = meth.GetParameters() in
+  Array.toList pars
+
+let name (x:System.Reflection.ParameterInfo) n = x.Name = n    
+
+do let [p] = paramsOf (typeof<C>) "get_InstanceP" in
+   assert(name p "idx"); printf "ok\n"
+
+do let [p;_] = paramsOf (typeof<C>) "set_InstanceP" in
+   assert(name p "idx"); printf "ok\n"
+
+do let [p] = paramsOf (typeof<C>) "StaticMember" in
+   assert(p.IsOut && name p "p"); printf "ok\n"
+
+do let [p] = paramsOf (typeof<C>) "StaticMember" in
+   assert(p.IsOut && name p "p"); printf "ok\n"
+
+#if LITERALS
+module LiteralAttributeTests = begin
+
+    [<Literal>]
+    let x = 1
+    let get_x = x
+
+    [<Literal>]
+    let x2 = 1s
+    let get_x2 = x2
+
+    [<Literal>]
+    let x3 = 1y
+    let get_x3 = x3
+
+    [<Literal>]
+    let x4 = 1uy
+    let get_x4 = x4
+
+    [<Literal>]
+    let x5 = 1us
+    let get_x5 = x5
+
+    [<Literal>]
+    let x6 = 1u
+    let get_x6 = x6
+
+    [<Literal>]
+    let x7 = 1L
+    let get_x7 = x7
+
+    [<Literal>]
+    let x8 = 1UL
+    let get_x8 = x8
+
+    [<Literal>]
+    let x9 = 'a'
+    let get_x9 = x9
+
+    [<Literal>]
+    let x10 = 0.1
+    let get_x10 = x10
+
+    [<Literal>]
+    let x11 = 0.1f
+    let get_x11 = x11
+
+    [<Literal>]
+    let s = "hello"
+    let get_s = s
+
+    let y = x
+
+    let z = x + x
+
+    let z2 = x.CompareTo(box 3)
+
+    [<System.Obsolete(s)>]
+    let z3 = 4
+
+    [<System.Obsolete(s)>]
+    type T = A | B
+
+    
+    type T2 = 
+        | [<System.Obsolete(s)>] A 
+        | B
+
+    type T3 = 
+        { [<System.Obsolete(s)>] r1: int }
+    
+end
+#endif
+
+module BasicStructuralEqHashCompareAttributeChecks = begin
+
+    type R = R of int * int
+
+    let _ = check "whjevoi1" (R(1,1+1) = R(1,2)) true
+    let _ = check "whjevoi2" (not (R(1,3) = R(1,2))) true
+    let _ = check "whjevoi3" (hash (R(1,1+1)) = hash (R(1,2))) true
+    let _ = check "whjevoi4" (R(1,2) < R(1,3))  true
+    let _ = check "whjevoi5" (R(1,2) < R(2,3))  true
+    let _ = check "whjevoi6" (R(1,2) < R(2,1))  true
+    let _ = check "whjevoi7" (R(1,2) > R(1,0))  true
+
+    type R1 = 
+        { myData : int }
+        with
+            static member Create() = { myData = 0 }
+        end
+
+    [<ReferenceEquality>]
+    type R2 = 
+        { mutable myState : int }
+        with
+            static member Fresh() = { myState = 0 }
+        end
+
+    [<ReferenceEquality; NoComparison >]
+    type R2b = 
+        { mutable myState : int }
+        with
+            static member Fresh() = { myState = 0 }
+        end
+
+    [<StructuralEquality; NoComparison >]
+    type R3 = 
+        { someType : System.Type }
+        with 
+            static member Make() = { someType = typeof<int> }
+        end
+
+
+    let _ = check "ce99pj321"  (R1.Create() = R1.Create() ) true
+    let _ = check "ce99pj322"  (R1.Create() = R1.Create() ) true
+    let _ = check "ce99pj323"  (R2.Fresh() = R2.Fresh()) false
+    let _ = check "ce99pj324"  (R2b.Fresh() = R2b.Fresh()) false
+    let _ = check "ce99pj325"  (R3. Make() = R3. Make()) true
+
+    // structural comparison raises an exception if not implemented
+    let _ = check "ce99pj32e" (try (let _ = Unchecked.compare (R2.Fresh()) (R2.Fresh()) in false) with _ -> true) true
+    let _ = check "ce99pj32p" (try (let _ = Unchecked.compare (R2b.Fresh()) (R2b.Fresh()) in false) with _ -> true) true
+    let _ = check "ce99pj32j" (try (let _ = Unchecked.compare (R3. Make()) (R3. Make()) in false) with _ -> true) true
+
+end
+
+[<System.Diagnostics.DebuggerTypeProxy(typeof<TestTypeOnTypeView>)>]
+type TestTypeOnType() = 
+    class
+       member x.P = 1
+    end
+    
+and TestTypeOnTypeView() = 
+    class
+       member x.P = 1
+    end
+
+
+module Bug1437_PS_FSharp1_0_AttributesWithArrayArguments = begin
+
+    [<System.AttributeUsageAttribute(System.AttributeTargets.Assembly) >]
+    type AttributeWithArrayArgAttribute(data: int[]) = class
+        inherit Attribute()
+    end
+
+    [<assembly:AttributeWithArrayArg ([|0;1;2|])>]
+    do ()
+
+    let ass = typeof<AttributeWithArrayArgAttribute>.Assembly 
+
+    // Assembly attributes are currently ignored by F# Interactive, so this test
+    // fails.  We ignore the failure.
+    #if COMPILED
+    let ca = ass.GetCustomAttributes(typeof<AttributeWithArrayArgAttribute>,false)
+    let _ = check "ce99pj32cweq" (Array.length ca) 1 
+    #endif
+end
+
+module Bug6161_PS_FSharp1_0_MoreAttributesWithArrayArguments = begin
+
+    type IntArrayPropAttribute() = 
+        inherit System.Attribute() 
+        let mutable attribs = [| |]
+        member x.Value with set(v:int[]) = attribs <- v and get() = attribs
+
+
+    type ObjArrayPropAttribute() = 
+        inherit System.Attribute() 
+        let mutable attribs = [| |]
+        member x.Value with set(v:obj[]) = attribs <- v and get() = attribs
+
+    type AnyArrayPropAttribute() = 
+        inherit System.Attribute() 
+        let mutable attribs = [| |]
+        member x.Value with set(v:obj[]) = attribs <- v and get() = attribs
+
+    type IntArrayAttribute(a:int[]) = 
+        inherit System.Attribute()
+        member x.Values = a
+
+    type ObjArrayAttribute(a:obj[]) = 
+        inherit System.Attribute()
+        member x.Values = a
+
+    type AnyAttribute(a:obj) = 
+        inherit System.Attribute()
+        member x.Value = a
+
+    (* works *)
+    [<IntArrayProp(Value = [| 42 |])>]
+    [<ObjArrayProp(Value = [| (42 :> obj) |])>]
+    [<IntArray [| 42 |]>]
+    [<ObjArray [| 42 |]>]
+    [<Any [| 42 |]>]
+    type T=class end
+
+    let _ = 
+        let ty = typeof<T>
+        let ca = ty.GetCustomAttributes(typeof<IntArrayPropAttribute>,false)
+        check "ce99pj32cweq1" ca.Length 1 
+        check "ce99pj32cweq2" (ca.[0].GetType()) (typeof<IntArrayPropAttribute>)
+        check "ce99pj32cweq3" (ca.[0] :?> IntArrayPropAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<ObjArrayPropAttribute>,false)
+        check "ce99pj32cweq4" ca.Length 1 
+        check "ce99pj32cweq5" (ca.[0].GetType()) (typeof<ObjArrayPropAttribute>)
+        check "ce99pj32cweq6" (ca.[0] :?> ObjArrayPropAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<IntArrayAttribute>,false)
+        check "ce99pj32cweq7" ca.Length 1 
+        check "ce99pj32cweq8" (ca.[0].GetType()) (typeof<IntArrayAttribute>)
+        check "ce99pj32cweq9" (ca.[0] :?> IntArrayAttribute).Values [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<ObjArrayAttribute>,false)
+        check "ce99pj32cweqQ" ca.Length 1 
+        check "ce99pj32cweqW" (ca.[0].GetType()) (typeof<ObjArrayAttribute>)
+        check "ce99pj32cweqE" (ca.[0] :?> ObjArrayAttribute).Values [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<AnyAttribute>,false)
+        check "ce99pj32cweqR" ca.Length 1 
+        check "ce99pj32cweqT" (ca.[0].GetType()) (typeof<AnyAttribute>)
+        check "ce99pj32cweqY" (ca.[0] :?> AnyAttribute).Value (box [| 42 |])
+
+#if Portable
+#else
+    let _ = 
+        let ty = typeof<CSharpLibrary.TestClass>
+        let ca = ty.GetCustomAttributes(typeof<CSharpLibrary.IntArrayPropAttribute>,false)
+        check "de89pj32cweq1" ca.Length 1 
+        check "de89pj32cweq2" (ca.[0].GetType()) (typeof<CSharpLibrary.IntArrayPropAttribute>)
+        check "de89pj32cweq3" (ca.[0] :?> CSharpLibrary.IntArrayPropAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<CSharpLibrary.ObjArrayPropAttribute>,false)
+        check "de89pj32cweq4" ca.Length 1 
+        check "de89pj32cweq5" (ca.[0].GetType()) (typeof<CSharpLibrary.ObjArrayPropAttribute>)
+        check "de89pj32cweq6" (ca.[0] :?> CSharpLibrary.ObjArrayPropAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<CSharpLibrary.IntArrayAttribute>,false)
+        check "de89pj32cweq7" ca.Length 1 
+        check "de89pj32cweq8" (ca.[0].GetType()) (typeof<CSharpLibrary.IntArrayAttribute>)
+        check "de89pj32cweq9" (ca.[0] :?> CSharpLibrary.IntArrayAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<CSharpLibrary.ObjArrayAttribute>,false)
+        check "de89pj32cweqQ" ca.Length 1 
+        check "de89pj32cweqW" (ca.[0].GetType()) (typeof<CSharpLibrary.ObjArrayAttribute>)
+        check "de89pj32cweqE" (ca.[0] :?> CSharpLibrary.ObjArrayAttribute).Value [| 42 |]
+
+        let ca = ty.GetCustomAttributes(typeof<CSharpLibrary.AnyAttribute>,false)
+        check "de89pj32cweqR" ca.Length 1 
+        check "de89pj32cweqT" (ca.[0].GetType()) (typeof<CSharpLibrary.AnyAttribute>)
+        check "de89pj32cweqY" (ca.[0] :?> CSharpLibrary.AnyAttribute).Value (box [| 42 |])
+#endif
+
+end
+
+
+module AttributeParamArrayArgs1 = 
+
+    [<AttributeUsage(AttributeTargets.All)>]
+    type AttributeWithParamArray([<ParamArrayAttribute>] Parameters:obj[]) =
+      inherit Attribute()
+
+    type Foo1() =
+        [<AttributeWithParamArray([| (1 :> obj) |])>]        
+        override this.ToString() = "Stuff"
+
+    type Foo2() =
+        [<AttributeWithParamArray(1)>]        
+        override this.ToString() = "Stuff"
+
+    type Foo3() =
+        [<AttributeWithParamArray()>]        
+        override this.ToString() = "Stuff"
+
+    type Foo4() =
+        [<AttributeWithParamArray(1,2)>]        
+        override this.ToString() = "Stuff"
+
+    type Foo5() =
+        [<AttributeWithParamArray(1,2,3,4,5,6,7,8)>]        
+        override this.ToString() = "Stuff"
+
+module AttributeParamArrayArgs2 = 
+
+    [<AttributeUsage(AttributeTargets.All)>]
+    type AttributeWithParamArray(x:string,[<ParamArrayAttribute>] Parameters:obj[]) =
+      inherit Attribute()
+
+    type Foo1() =
+        [<AttributeWithParamArray("1",[| (1 :> obj) |])>]        
+        override this.ToString() = "Stuff"
+
+    type Foo2() =
+        [<AttributeWithParamArray("1",1)>]        
+        override this.ToString() = "Stuff"
+
+    type Foo3() =
+        [<AttributeWithParamArray("1")>]        
+        override this.ToString() = "Stuff"
+
+    type Foo4() =
+        [<AttributeWithParamArray("1",1,2)>]        
+        override this.ToString() = "Stuff"
+
+    type Foo5() =
+        [<AttributeWithParamArray("1",1,2,3,4,5,6,7,8)>]        
+        override this.ToString() = "Stuff"
+
+module TestImplicitCOnstructorAttribute =
+    type Foo [<Obsolete("don't use")>] () =
+      member x.Bar() = 1
+
+    checkAttributeCount "Foo.new()" (typeof<Foo>.GetConstructor([| |]).GetCustomAttributes(typeof<ObsoleteAttribute>,false)) 1;
+
+module TestTypeInstantiationsInAttributes =
+
+    type ListProxy<'a>(l:List<'a>) =
+        [<DebuggerBrowsableAttribute(DebuggerBrowsableState.RootHidden)>]
+        member this.Items = 
+            Array.ofList l
+            
+    [<DebuggerDisplayAttribute("{Length}", Target=typeof<List<int>> )>]
+    type C1 = A | B
+    [<DebuggerTypeProxyAttribute(typeof<ListProxy<int>>, Target=typeof<List<C1>>)>]
+    type C2 = A | B
+    [<DebuggerTypeProxyAttribute(typeof<ListProxy<int>>, Target=typeof<List<C1[]>>)>]
+    type C3 = A | B
+    [<DebuggerTypeProxyAttribute(typeof<ListProxy<int>>, Target=typeof<List<C1>[,]>)>]
+    type C4 = A | B
+    [<DebuggerTypeProxyAttribute(typedefof<ListProxy<_>>, Target=typedefof<List<_>>)>]
+    type C5 = A | B
+    
+    let attrs1 = typeof<C1>.GetCustomAttributes(typeof<System.Diagnostics.DebuggerDisplayAttribute>,false) ;
+    match attrs1 with 
+      | [| (:? System.Diagnostics.DebuggerDisplayAttribute as ca)  |]  -> 
+          check "test423cwo3nh01" ca.Value "{Length}"
+          check "test423cwo3nh02" ca.Target typeof<List<int>>
+      | _ -> check "no attribute found" true false
+
+    let attrs2 = typeof<C2>.GetCustomAttributes(typeof<System.Diagnostics.DebuggerTypeProxyAttribute>,false) ;
+    match attrs2 with 
+      | [| (:? System.Diagnostics.DebuggerTypeProxyAttribute as ca)  |]  -> 
+          check "test423cwo3nq01" ca.ProxyTypeName (typeof<ListProxy<int>>).AssemblyQualifiedName
+          check "test423cwo3nq02" ca.Target typeof<List<C1>>
+      | _ -> check "no attribute found" true false
+
+    let attrs3 = typeof<C3>.GetCustomAttributes(typeof<System.Diagnostics.DebuggerTypeProxyAttribute>,false) ;
+    match attrs3 with 
+      | [| (:? System.Diagnostics.DebuggerTypeProxyAttribute as ca)  |]  -> 
+          check "test423cwo3nw01" ca.ProxyTypeName (typeof<ListProxy<int>>).AssemblyQualifiedName
+          check "test423cwo3nw02" ca.Target typeof<List<C1[]>>
+      | _ -> check "no attribute found" true false
+
+    let attrs4 = typeof<C4>.GetCustomAttributes(typeof<System.Diagnostics.DebuggerTypeProxyAttribute>,false) ;
+    match attrs4 with 
+      | [| (:? System.Diagnostics.DebuggerTypeProxyAttribute as ca)  |]  -> 
+          check "test423cwo3nd01" ca.ProxyTypeName (typeof<ListProxy<int>>).AssemblyQualifiedName
+          check "test423cwo3nd02" ca.Target typeof<List<C1>[,]>
+      | _ -> check "no attribute found" true false
+
+    let attrs5 = typeof<C5>.GetCustomAttributes(typeof<System.Diagnostics.DebuggerTypeProxyAttribute>,false) ;
+    match attrs5 with 
+      | [| (:? System.Diagnostics.DebuggerTypeProxyAttribute as ca)  |]  -> 
+          check "test423cwo3ng01" ca.ProxyTypeName (typedefof<ListProxy<_>>).AssemblyQualifiedName
+          check "test423cwo3ng02" ca.Target typedefof<List<_>>
+      | _ -> check "no attribute found" true false
+
+module NullsInAttributes = 
+    open System
+
+    [<AttributeUsage(AttributeTargets.Property)>]
+    type NullsAttribute(obj:obj, str:string, typ:System.Type) = 
+        inherit Attribute()
+        let mutable objprop : obj option = None
+        let mutable strprop : string option = None
+        let mutable typprop : System.Type option = None
+
+        member x.Object = obj
+        member x.String = str
+        member x.Type = typ
+        member x.ObjectProp with set v = objprop <- Some v
+        member x.StringProp with set v = strprop <- Some v
+        member x.TypeProp with set v = typprop <- Some v
+
+        member x.ObjectPropValue with get () = objprop 
+        member x.StringPropValue with get () = strprop 
+        member x.TypePropValue with get () = typprop 
+
+    type TestNullsInAttributes() = 
+       [<NullsAttribute(null, null, null)>]
+       member x.TestProperty1 = 1
+       [<NullsAttribute(null, null, null, ObjectProp=null)>]
+       member x.TestProperty2 = 1
+       [<NullsAttribute(null, null, null, StringProp=null)>]
+       member x.TestProperty3 = 1
+       [<NullsAttribute(null, null, null, TypeProp=null)>]
+       member x.TestProperty4 = 1
+       [<NullsAttribute(null, null, null, ObjectProp=null, StringProp=null, TypeProp=null)>]
+       member x.TestProperty5 = 1
+
+       [<NullsAttribute("1", "2", typeof<int16>, ObjectProp="3", StringProp="4", TypeProp=typeof<string>)>]
+       member x.TestProperty6 = 1
+       
+    //let check s b1 b2 = 
+    //    if b1 = b2 then printfn "%s OK" s
+    //    else printfn "FAIL %s: expected %A, got %A" s b2 b1
+
+    let test p (e1,e2,e3,e4,e5,e6) = 
+        check (sprintf "%s.Object" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).Object e1
+        check (sprintf "%s.String" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).String e2
+        check (sprintf "%s.Type" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).Type e3
+        check (sprintf "%s.ObjectProp" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).ObjectPropValue e4
+        check (sprintf "%s.StringProp" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).StringPropValue e5
+        check (sprintf "%s.TypeProp" p) (typeof<TestNullsInAttributes>.GetProperty(p).GetCustomAttributes(false).[0] :?> NullsAttribute).TypePropValue e6
+
+    test "TestProperty1" (null, null, null, None, None, None)
+    test "TestProperty2" (null, null, null, Some null, None, None)
+    test "TestProperty3"  (null, null, null, None, Some null, None)
+    test "TestProperty4"  (null, null, null, None, None, Some null)
+    test "TestProperty5"  (null, null, null, Some null, Some null, Some null)
+    test "TestProperty6"  (box "1", "2", typeof<int16>, Some (box "3"), Some  "4", Some typeof<string>)
+    
+#if Portable
+#else
+module Bug5762 =
+      open System
+      open System.IO
+      open System.Runtime.ConstrainedExecution
+      open System.Runtime.InteropServices
+      open System.Security.Permissions
+      open Microsoft.Win32.SafeHandles
+     
+      type LFILETIME = System.Runtime.InteropServices.ComTypes.FILETIME
+     
+      [<Serializable; StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto); BestFitMapping(false)>]
+      type WIN32_FIND_DATA =
+        [<DefaultValue>] val mutable dwFileAttributes:FileAttributes
+        [<DefaultValue>] val mutable ftCreationTime:LFILETIME
+        [<DefaultValue>] val mutable ftLastAccessTime:LFILETIME
+        [<DefaultValue>] val mutable ftLastWriteTime:LFILETIME
+        [<DefaultValue>] val mutable nFileSizeHigh:uint32
+        [<DefaultValue>] val mutable nFileSizeLow:uint32
+        [<DefaultValue>] val mutable dwReserved0:uint32
+        [<DefaultValue>] val mutable dwReserved1:uint32
+        [<DefaultValue; MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)>]
+        val mutable cFileName:string
+        [<DefaultValue; MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)>]
+        val mutable cAlternateFileName:string
+        new() = {}
+        
+      type SafeFindHandle() =
+        inherit SafeHandleZeroOrMinusOneIsInvalid(true)
+        override this.ReleaseHandle() = true
+
+      type T = class end
+      
+      [<DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
+      extern SafeFindHandle FindFirstFile(string fileName, [<Out; MarshalAs(UnmanagedType.LPStruct)>] WIN32_FIND_DATA data)
+     
+      [<DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
+      extern bool FindNextFile(SafeFindHandle hndFindFile, [<Out; MarshalAs(UnmanagedType.LPStruct)>] WIN32_FIND_DATA lpFindFileData)
+         
+     
+      let moduleType = typeof<T>.DeclaringType
+      let mFindFirstFile = moduleType.GetMethod("FindFirstFile")
+      let dataParam = mFindFirstFile.GetParameters().[1]
+      let marshalAsAttrs = dataParam.GetCustomAttributes(typeof<MarshalAsAttribute>, false)
+      check "gjhfdey547"
+        (match marshalAsAttrs with
+         | [| (:? MarshalAsAttribute as ma) |] when ma.Value = UnmanagedType.LPStruct -> true
+         | _ -> false)
+        true   
+        
+      let findDataType = typeof<WIN32_FIND_DATA>
+      check "dguyestgfuysdc"
+        (match findDataType.GetField("cFileName").GetCustomAttributes(typeof<MarshalAsAttribute>, false) with
+         | [| (:? MarshalAsAttribute as ma) |] 
+                when ma.Value = UnmanagedType.ByValTStr && ma.SizeConst = 260 ->
+                    true
+         | _ -> false)
+        true
+#endif
+     
+// test CompiledName attribute on properties        
+module Bug5936 =
+    type T() = 
+        let mutable bval = "Boo!"
+        
+        [<CompiledName "P">]
+        static member p = 1
+        
+        [<CompiledName "M">]
+        static member m() = 1
+        
+        [<CompiledName "IP">]
+        member this.ip = 1
+        
+        [<CompiledName "IM">]
+        member this.im() = 1
+        
+        // The additional applications of CompiledName to the getters and setters won't work
+        // since CompiledName has already been applied to the property
+        // CompiledName can be applied to the getter, setter or property - it will rename the
+        // property itself - you can only use it once
+        [<CompiledName "B">]
+        member this.b 
+            with get() = bval
+            and set(v) = bval <- v
+            
+        member this.c 
+            with [<CompiledName "C">] get() = bval
+            and set(v) = bval <- v
+            
+        member this.d 
+            with get() = bval
+            and [<CompiledName "D">] set(v) = bval <- v
+
+    check "dguyestgfuycntm" (typeof<T>.GetMethod "M" <> null) true
+    check "dguyestgfuycntim" (typeof<T>.GetMethod "IM" <> null) true   
+    check "dguyestgfuycntp" (typeof<T>.GetProperty "P" <> null) true  
+    check "dguyestgfuycntip" (typeof<T>.GetProperty "IP" <> null) true
+    check "dguyestgfuycntib" (typeof<T>.GetProperty "B" <> null) true
+    check "dguyestgfuycntic" (typeof<T>.GetProperty "C" <> null) true
+    check "dguyestgfuycntid" (typeof<T>.GetProperty "D" <> null) true
+
+
+
+module AttributeTestsOnExtensionProperties = 
+    [<AutoOpen>]
+    module Extensions =
+        type InlineAttribute(x: string) =
+            inherit System.Attribute()
+            override x.ToString() = "Inline"
+
+        type MyType() =
+            member x.P = 1
+
+        type MyType with
+            [<Inline "foo" >]
+            member this.ExtensionMethod() = 42
+            member this.Item
+                with    [<Inline "$this[$field]">]
+                        get (field: string) = obj ()
+
+                and     [<Inline "$this[$field]=$value">]
+                        set (field: string) (value: obj) = ()
+
+        type MyTypeIntrinsic() =
+            member x.P = 1
+
+        type MyTypeIntrinsic with
+            [<Inline "foo" >]
+            member this.ExtensionMethod() = 42
+            member this.Item
+                with    [<Inline "$this[$field]">]
+                        get (field: string) = obj ()
+
+                and     [<Inline "$this[$field]=$value">]
+                        set (field: string) (value: obj) = ()
+        type System.Object with
+            [<Inline "foo" >]
+            member this.ExtensionMethod = 42
+
+            member this.Item
+                with    [<Inline "$this[$field]">]
+                        get (field: string) = obj ()
+                and     [<Inline "$this[$field]=$value">]
+                        set (field: string) (value: obj) = ()
+
+    let test0() = 
+        match <@ MyType().["foo"] @> with
+        | Quotations.Patterns.PropertyGet(_, info, _) ->
+            info.DeclaringType.GetMethods()
+            |> Seq.map (fun m ->
+                sprintf "%s: %A" m.Name (m.GetCustomAttributes(typeof<InlineAttribute>, false)))
+            |> Seq.sort
+            |> String.concat ", "
+
+        | c -> failwithf "unreachable 1 %A" c
+
+    let test1() = 
+        match <@ MyTypeIntrinsic().["foo"] @> with
+        | Quotations.Patterns.PropertyGet(_, info, _) ->
+            info.DeclaringType.GetMethods()
+            |> Seq.map (fun m ->
+                sprintf "%s: %A" m.Name (m.GetCustomAttributes(typeof<InlineAttribute>, false)))
+            |> Seq.sort
+            |> String.concat ", "
+
+        | _ -> failwith "unreachable 1"
+
+
+    let test2() = 
+        typeof<MyType>.GetMethods()
+            |> Seq.map (fun m ->
+                sprintf "%s: %A" m.Name (m.GetCustomAttributes(typeof<InlineAttribute>, false)))
+            |> Seq.sort
+            |> String.concat ", "
+
+
+    let test3() = 
+        match <@ obj().["foo"] @> with
+        | Quotations.Patterns.Call(_, info, _) ->
+            info.DeclaringType.GetMethods()
+            |> Seq.map (fun m ->
+                sprintf "%s: %A" m.Name (m.GetCustomAttributes(typeof<InlineAttribute>, false)))
+            |> Seq.sort
+            |> String.concat ", "
+        | _ -> failwith "unreachable 3"
+
+ 
+
+    check "vwlnwer-0wreknj1" (test0()) "Equals: [||], ExtensionMethod: [|Inline|], GetHashCode: [||], GetType: [||], ToString: [||], get_Item: [|Inline|], get_P: [||], set_Item: [|Inline|]"
+
+    check "vwlnwer-0wreknj2" (test1()) "Equals: [||], ExtensionMethod: [|Inline|], GetHashCode: [||], GetType: [||], ToString: [||], get_Item: [|Inline|], get_P: [||], set_Item: [|Inline|]"
+
+    check "vwlnwer-0wreknj3" (test2()) "Equals: [||], ExtensionMethod: [|Inline|], GetHashCode: [||], GetType: [||], ToString: [||], get_Item: [|Inline|], get_P: [||], set_Item: [|Inline|]"
+
+    check "vwlnwer-0wreknj4" (test3()) "Equals: [||], GetHashCode: [||], GetType: [||], Object.get_ExtensionMethod: [|Inline|], Object.get_Item: [|Inline|], Object.set_Item: [|Inline|], ToString: [||]"
+
+
+(*-------------------------------------------------------------------------
+!* Test passed?
+ *------------------------------------------------------------------------- *)
+
+
+let aa =
+  match failures with
+  | [] -> () 
+  | _ ->
+        stdout.WriteLine "Test Failed"; exit 1
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/attributes/testlib.fs b/tests/fsharp/core/attributes/testlib.fs
new file mode 100644
index 0000000..e5f0029
--- /dev/null
+++ b/tests/fsharp/core/attributes/testlib.fs
@@ -0,0 +1,118 @@
+#light
+
+module TestLibModule
+
+module ValAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   let x1 = 1
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   let x2 = 1
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   let x3 = 1
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   let x4 = 1
+
+
+
+module TyconAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   type C1 = A | B
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   type C2 = A | B
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   type C3 = A | B
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   type C4 = A | B
+
+
+module ModuleAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   module M1 = 
+       let x = 1
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   module M2 = 
+       let x = 1
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   module M3 = 
+       let x = 1
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   module M4 = 
+       let x = 1
+
+
+module UnionCaseAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   type U1 =    
+       | [<System.ObsoleteAttribute("Text identical in both")>]
+         A of int
+       | B of string
+
+   // expect warning, and attribute from signature to be included
+   type U2 =    
+       | [<System.ObsoleteAttribute("Text differs in implementation")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U3 =    
+       | [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U4 =    
+       | //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+         A of int
+       | B of string
+
+module ParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   let x1 ([<System.CLSCompliantAttribute(true)>] p : int) = p
+
+   // differs in signature
+   let x2 ([<System.CLSCompliantAttribute(false)>] p : int) = p
+
+   // missing in signature
+   let x3 ([<System.CLSCompliantAttribute(true)>] p : int) = p
+
+   // in signature but not implementation
+   let x4 ((* [<System.CLSCompliantAttribute(true)>] *) p : int) = p
+
+module TypeParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   let x1<[<System.CLSCompliantAttribute(true)>] 'T>(x:'T) = x
+
+   // differs in signature
+   let x2<[<System.CLSCompliantAttribute(false)>] 'T>(x:'T) = x
+
+   // missing in signature
+   let x3<[<System.CLSCompliantAttribute(true)>] 'T>(x:'T) = x
+
+   // in signature but not implementation
+   let x4<(* [<System.CLSCompliantAttribute(true)>] *) 'T>(x:'T) = x
+
+
+type ThisLibAssembly = X | Y
diff --git a/tests/fsharp/core/attributes/testlib.fsi b/tests/fsharp/core/attributes/testlib.fsi
new file mode 100644
index 0000000..ba8c65f
--- /dev/null
+++ b/tests/fsharp/core/attributes/testlib.fsi
@@ -0,0 +1,102 @@
+#light
+
+
+module TestLibModule
+
+module ValAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   val x1 : int
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   val x2 : int
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   val x3 : int
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   val x4 : int
+
+module TyconAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   type C1 = A | B
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   type C2 = A | B
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   type C3 = A | B
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   type C4 = A | B
+
+module ModuleAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   module M1 = 
+       val x : int
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   module M2 = 
+       val x : int
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   module M3 = 
+       val x : int
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   module M4 = 
+       val x : int
+
+module UnionCaseAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   type U1 =    
+       | [<System.ObsoleteAttribute("Text identical in both")>]
+         A of int
+       | B of string
+
+   // expect warning, and attribute from signature to be included
+   type U2 =    
+       | [<System.ObsoleteAttribute("Text differs in signature")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U3 =    
+       // [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+       | A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U4 =    
+       | [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+         A of int
+       | B of string
+
+module ParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   val x1 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+   // differs in signature
+   val x2 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+   // missing in signature
+   val x3 : (* [<System.CLSCompliantAttribute(true)>] *) p : int -> int
+
+   // in signature but not implementation
+   val x4 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+module TypeParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   val x1< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
+
+   // differs in signature
+   val x2< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
+
+   // missing in signature
+   val x3< (* [<System.CLSCompliantAttribute(true)>] *) 'T> : 'T -> 'T
+
+   // in signature but not implementation
+   val x4< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
+
+type ThisLibAssembly 
diff --git a/tests/fsharp/core/comprehensions/build.bat b/tests/fsharp/core/comprehensions/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/comprehensions/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/comprehensions/run.bat b/tests/fsharp/core/comprehensions/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/comprehensions/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/comprehensions/test-hw.fsx b/tests/fsharp/core/comprehensions/test-hw.fsx
new file mode 100644
index 0000000..fea86ae
--- /dev/null
+++ b/tests/fsharp/core/comprehensions/test-hw.fsx
@@ -0,0 +1,1049 @@
+// #Conformance #Sequences #Regression #ControlFlow #SyntacticSugar #ComputationExpressions 
+
+//#nowarn "57"
+module Test
+
+open System.Text.RegularExpressions
+open System.IO
+open System.Xml
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+  
+
+test "coic23a" (Seq.toList { 'a' .. 'c' } = ['a';'b';'c'])
+
+test "coic23q" (Seq.toList {1 .. 0} = [])
+test "coic23w" (Seq.toList {1 .. 1} = [1])
+test "coic23e" (Seq.toList {1 .. 3} = [1;2;3])
+test "coic23r" (Seq.toList {1L .. 3L} = [1L;2L;3L])
+test "coic23t" (Seq.toList {1UL .. 3UL} = [1UL;2UL;3UL])
+test "coic23y" (Seq.toList {1ul .. 3ul} = [1ul;2ul;3ul])
+test "coic23a" (Seq.toList {1y .. 3y} = [1y;2y;3y])
+test "coic23s" (Seq.toList {1uy .. 3uy} = [1uy;2uy;3uy])
+test "coic23d" (Seq.toList {1s .. 3s} = [1s;2s;3s])
+//test "coic23" (Seq.toList {1I .. 3I} = [1I;2I;3I])
+//test "coic23" (Seq.toList {1N .. 3N} = [1N;2N;3N])
+test "coic23d" (Seq.toList {1us .. 3us} = [1us;2us;3us])
+test "coic23f" (Seq.toList {3 .. 1} = [])
+test "coic23g" (Seq.toList  (seq {1.0..3.0}) = [1.0;2.0;3.0])
+test "coic23h" (Seq.toList  (seq {1.0 .. 1.0 .. 3.0}) = [1.0;2.0;3.0])
+test "coic23j" (Seq.toList  (seq {1.0 .. 1.0 .. 2.01 }) = [1.0;2.0])
+test "coic23k" (Seq.toList  (seq {3.0 .. -1.0 .. 0.0}) = [3.0;2.0;1.0;0.0])
+test "coic23l" (Seq.toList  (seq {4.0 .. -2.0 .. 0.0}) = [4.0;2.0;0.0])
+test "coic23z" (Seq.toList  (seq {3 .. -1 .. -3}) = [3;2;1;0; -1; -2; -3])
+test "coic23x" (Seq.toList  (seq {3 .. -2 .. -3})= [3;1; -1; -3])
+
+test "coic23c" ([ 'a' .. 'c' ] = ['a';'b';'c'])
+
+test "coic23v" ([ 1 .. 0 ] = [])
+test "coic23b" ([ 1 .. 1 ] = [1])
+test "coic23n" ([ 1 .. 3 ] = [1;2;3])
+test "coic23m" ([ 1L .. 3L ]= [1L;2L;3L])
+test "coic2342" ([ 1UL .. 3UL ] = [1UL;2UL;3UL])
+test "coic233d2" ([ 1ul .. 3ul ] = [1ul;2ul;3ul])
+test "coic23t34" ([ 1y .. 3y ] = [1y;2y;3y])
+test "coic23cwe" ([ 1uy .. 3uy ] = [1uy;2uy;3uy])
+test "coic23cu" ([ 1s .. 3s ] = [1s;2s;3s])
+//test "coic23" ([ 1I .. 3I) = [1I;2I;3I])
+//test "coic23" ([ 1N .. 3N) = [1N;2N;3N])
+test "coic238n7" ([ 1us .. 3us ] = [1us;2us;3us])
+test "coic23we" ([ 3 .. 1 ] = [])
+test "coic23v38c5" ([ 1.0..3.0 ] = [1.0;2.0;3.0])
+test "coic23v5wq" ([ 1.0 .. 1.0 .. 3.0 ] = [1.0;2.0;3.0])
+test "coic23cv42" ([ 1.0 .. 1.0 .. 2.01  ] = [1.0;2.0])
+test "coic23cd2" ([ 3.0 .. -1.0 .. 0.0 ] = [3.0;2.0;1.0;0.0])
+test "coic23vq423" ([ 4.0 .. -2.0 .. 0.0 ] = [4.0;2.0;0.0])
+test "coic23jyi" ([ 3 .. -1 .. -3] = [3;2;1;0; -1; -2; -3])
+test "coic23my7" ([ 3 .. -2 .. -3 ]= [3;1; -1; -3])
+
+
+let test3198 = 
+    let mutable count = 0 in 
+    for i in {1 .. 3} do 
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+
+let test3198b = 
+    let mutable count = 0 in 
+    let ie = {1 .. 3} 
+    for i in ie do 
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+let test3198x = 
+    let mutable count = 0 in 
+    let ie = ref {1 .. 3} 
+    
+    for i in !ie do 
+        ie := {1 .. 2}
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+let test342879 = 
+    let mutable count = 0 in 
+    for i in {1 .. 3} do 
+        for j in {i .. 3} do 
+            count <- count + 1;
+            printf "i = %d\n" i 
+    test "fi3n" (count = 6)
+
+for i in {1 .. 3} do 
+    printf "i = %d\n" i 
+done
+
+
+module RegressionInAppend = begin
+    let processFile file fileHandle =
+       seq { try
+               yield (file := fileHandle; ())
+             finally
+               // Close the file.
+               file := 0 }
+
+    let process2Files file =
+       seq { for _ in processFile file 1 do
+               yield ()
+             for _ in processFile file 2 do
+               // On yield, the file should still be "open" with 2
+               //   but instead, the finally clause is called
+               //   and sets it to 0 before yield.
+               yield () }
+
+    let file = ref 0 in
+    
+    test "ce030932jc2" ([ for _ in process2Files file do yield !file 
+                          yield !file ] = [1;2;0])
+
+
+    let test1 n = 
+        let count = ref 0 
+        let s = 
+            Seq.append 
+               (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose1") } in 
+                      yield! [1;2] })
+               (Seq.append 
+                   (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose2") } in 
+                          yield! [3;4] })
+                   (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose3") } in 
+                          yield! [5;6] }));
+        let res = s |> Seq.take n |> Seq.toList in
+        res, !count
+        
+     
+    test "coc3n09" (test1(0) = ([], 0))
+    test "coc3n09" (test1(1) = ([1], 1))
+    test "coc3n09" (test1(2) = ([1;2], 1))
+    test "coc3n09" (test1(3) = ([1;2;3], 2))
+    test "coc3n09" (test1(4) = ([1;2;3;4], 2))
+    test "coc3n09" (test1(5) = ([1;2;3;4;5], 3))
+    test "coc3n09" (test1(6) = ([1;2;3;4;5;6], 3))
+
+    let test2 n = 
+        let count = ref 0 
+        let s = 
+            Seq.append 
+               (Seq.append 
+                   (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose1") } in 
+                      yield! [1;2] })
+                   (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose2") } in 
+                          yield! [3;4] }))
+               (seq { use x = { new System.IDisposable with member self.Dispose() = incr count; System.Console.WriteLine("Dispose3") } in 
+                      yield! [5;6] });
+        let res = s |> Seq.take n |> Seq.toList in
+        res, !count
+        
+     
+    test "coc3n09" (test2(0) = ([], 0))
+    test "coc3n09" (test2(1) = ([1], 1))
+    test "coc3n09" (test2(2) = ([1;2], 1))
+    test "coc3n09" (test2(3) = ([1;2;3], 2))
+    test "coc3n09" (test2(4) = ([1;2;3;4], 2))
+    test "coc3n09" (test2(5) = ([1;2;3;4;5], 3))
+    test "coc3n09" (test2(6) = ([1;2;3;4;5;6], 3))
+end
+
+
+test "coic23v34w" (Seq.toList  (seq {for i in {1 .. 3} -> i,i*i}) = [1,1;2,4;3,9] )
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+test "coic23va" (Seq.toList  (seq {for i in {1 .. 5} do
+                                       if i % 2 = 0 then yield i+100})
+                = [102;104])
+
+test "coic23eq" (Seq.toList  (seq {for i in {1 .. 3} -> i}) = [1;2;3])
+
+test "coic23avwa" (Seq.toList  (seq {for i in {1 .. 3} do
+                                         for j in {1 .. 4} -> i,j}) = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+test "coic23bvee" (Seq.toList  (seq {for i in {1 .. 3} do 
+                                         if i % 2 = 1 then 
+                                           for j in {1 .. 4} -> i,j}) = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+test "coic23wcwec" (Seq.toList  (seq {for i in {1 .. 3} do
+                                          for j in {i .. 3} -> i,j}) = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+let ie1 = [ 1 .. 1 .. 3 ]
+
+test "colc23cwe" ([ for i in ie1 do
+                    for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+test "colc23v\w" ([ for i in {1 .. 3} -> i,i*i ] = [1,1;2,4;3,9])
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+test "colc23va" ([ for i in {1 .. 5} do
+                     if i % 2 = 0 then yield i+100 ]
+                = [102;104])
+
+test "colc23eq" ( [ for i in {1 .. 3} -> i ] = [1;2;3])
+
+test "colc23avwa" ([ for i in {1 .. 3} do
+                     for j in {1 .. 4} -> i,j ] = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+test "colc23bvee" ([ for i in {1 .. 3}  do
+                     if i % 2 = 1 then 
+                        for j in {1 .. 4} -> i,j ] = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+test "colc23wcwec" ([ for i in {1 .. 3} do
+                      for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+test "colc23cwe" ([ for i in ie1 do
+                    for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+
+
+test "coac23cwe" ([|for i in ie1 do
+                    for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+test "coac23v\w" ([|for i in {1 .. 3} -> i,i*i|] = [|1,1;2,4;3,9|])
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+test "coac23va" ([|for i in {1 .. 5} do
+                    if i % 2 = 0 then yield i+100|]
+                = [|102;104|])
+
+test "coac23eq" ( [|for i in {1 .. 3} -> i|] = [|1;2;3|])
+
+test "coac23avwa" ([|for i in {1 .. 3} do
+                     for j in {1 .. 4} -> i,j|] = [|1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4|])
+
+test "coac23bvee" ([|for i in {1 .. 3} do
+                       if i % 2 = 1 then 
+                         for j in {1 .. 4} -> i,j|] = [|1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4|])
+
+
+test "coac23wcwec" ([|for i in {1 .. 3} do
+                      for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+test "coac23cwe" ([|for i in ie1 do
+                    for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+module TestSet2 = begin
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} -> 1})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 30} do if i % 2 = 0 then yield i+100})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} -> i})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do for j in {1 .. 4} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do if i % 2 = 1 then for j in {1 .. 4} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do for j in {1 .. i} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i,j in (Seq.ofList [(1,2);(3,4)]) -> i+j })
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] -> i+j})
+
+    let _ =  Seq.toList  (seq {for i in [Some "a"; None; Some "b"] -> i})
+
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"] do
+                                  let r = opt 
+                                  yield r})
+
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"] do
+                                let r = opt 
+                                yield r})
+
+    let _ =  Seq.toList  (seq {for r in [Some "a"; None; Some "b"]
+                                -> r})
+
+    let _ =  Seq.toList  (seq {for r in [Some "a"; None; Some "b"] do
+                                  yield r})
+
+(*
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"]
+                                   match opt with 
+                                   | Some r -> r})
+
+
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"]
+                                   match opt with 
+                                   | (Some r) ->> { for j in [1;2] -> j+j }
+                                   //| None ->> {for j in [1;2] -> j+j}) 
+                                   })
+
+*)
+
+(* TODO: see bug in PS - this should work *)
+(*    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"] match opt with (Some r) -> r) *)
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] do if i % 3 = 0 then yield i+j})
+
+    let _ =  Seq.toList  (seq {for i,j in [| (1,2);(3,4) |] -> i+j})
+
+    let ie1 = [ 3 .. 1 .. 5 ]
+
+    let _ =  Seq.toList  (seq {for i in ie1 do for j in {1 .. i} do yield i,j})
+end
+
+
+module SingleLineTestSet = begin
+    let test3198 = 
+        let mutable count = 0 in         for i in 1 .. 3 do             count <- count + 1;            printf "i = %d\n" i         done;        test "fi3fwfe2a" (count = 3)
+
+
+    let test3198b = 
+        let mutable count = 0 in         let ie = seq {1 .. 3} in       for i in ie do             count <- count + 1;            printf "i = %d\n" i         done;        test "fi3fwfe2b" (count = 3)
+
+    let test3198x = 
+        let mutable count = 0 in         let ie = ref (seq {1 .. 3}) in                for i in !ie do             ie := {1 .. 2};             count <- count + 1;            printf "i = %d\n" i;         done;        test "fi3fwfe2c" (count = 3)
+
+    let test342879 = 
+        let mutable count = 0 in         
+        for i in 1 .. 3 do             for j in i .. 3 do                 count <- count + 1;                printf "i = %d\n" i ;       
+        test "fi3fwfe2d" (count = 6)
+
+    let _ = for i in 1 .. 3 do         printf "i = %d\n" i     done
+
+
+    let _ = test "coic23v\w" (Seq.toList  (seq {for i in 1 .. 3 -> i,i*i}) = [1,1;2,4;3,9])
+
+    //{for x,y in [| (1,2) |]  -> x+y)
+
+
+    let _ = test "coic23va" (Seq.toList  (seq {for i in 1 .. 5 do if  i % 2 = 0 then yield i+100}) = [102;104])
+
+    let _ = test "coic23eq" (Seq.toList  (seq {for i in {1 .. 3} -> i}) = [1;2;3])
+
+    let _ = test "coic23avwa" (Seq.toList  (seq {for i in {1 .. 3} do for j in {1 .. 4} -> i,j}) = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+    let _ = test "coic23bvee" (Seq.toList  (seq {for i in {1 .. 3} do if i % 2 = 1 then for j in {1 .. 4} -> i,j}) = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+    let _ =  test "coic23wcwec" (Seq.toList  (seq {for i in {1 .. 3} do for j in {i .. 3} -> i,j}) = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+    let ie1 = [ 1 .. 1 .. 3]
+
+    let _ = test "colc23cwe" ([ for i in ie1 do for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+    let _ =   test "colc23v\w" ([ for i in {1 .. 3} -> i,i*i ] = [1,1;2,4;3,9])
+
+    //{for x,y in [| (1,2) |]  -> x+y)
+
+
+    let _ =  test "colc23va" ([ for i in {1 .. 5} do if i % 2 = 0 then yield  i+100 ] = [102;104])
+
+    let _ =  test "colc23eq" ( [ for i in {1 .. 3} -> i ] = [1;2;3])
+
+    let _ =  test "colc23avwa" ([ for i in {1 .. 3} do for j in {1 .. 4} -> i,j ] = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+    let _ =  test "colc23bvee" ([ for i in {1 .. 3} do if i % 2 = 1 then for j in {1 .. 4} -> i,j ] = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+    let _ = test "colc23wcwec" ([ for i in {1 .. 3} do for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+    let _ = test "colc23cwe" ([ for i in ie1 do for j in {i .. 3} -> i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+
+
+    let _ =  test "coac23cwe" ([|for i in ie1 do for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+    let _ =  test "coac23v\w" ([|for i in {1 .. 3} -> i,i*i|] = [|1,1;2,4;3,9|])
+
+    //{for x,y in [| (1,2) |]  -> x+y)
+
+
+    let _ =  test "coac23va" ([|for i in {1 .. 5} do if i % 2 = 0 then yield i+100|] = [|102;104|])
+
+    let _ =  test "coac23eq" ( [|for i in {1 .. 3} -> i|] = [|1;2;3|])
+
+    let _ =  test "coac23avwa" ([|for i in {1 .. 3}  do for j in {1 .. 4} -> i,j|] = [|1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4|])
+
+    let _ =  test "coac23bvee" ([|for i in {1 .. 3} do if i % 2 = 1 then for j in {1 .. 4} -> i,j|] = [|1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4|])
+
+
+    let _ =  test "coac23wcwec" ([|for i in {1 .. 3} do for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+    let _ =  test "coac23cwe" ([|for i in ie1 do for j in {i .. 3} -> i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} -> 1})
+
+    let _ =  Seq.toList  (seq {for i in 1 .. 30 do if i % 2 = 0 then yield i+100})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} -> i})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do for j in {1 .. 4} do yield i,j})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do if i % 2 = 1 then for j in {1 .. 4} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i in {1 .. 3} do for j in 1 .. i -> i,j})
+
+    let _ =  Seq.toList  (seq {for i,j in (Seq.ofList [(1,2);(3,4)]) -> i+j})
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] -> i+j})
+
+    let _ =  Seq.toList  (seq {for i in [Some "a"; None; Some "b"] -> i})
+
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"] do let r = opt in yield r})
+
+    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"]  do
+                                   let r = opt in 
+                                   yield r})
+
+    let _ =  Seq.toList  (seq {for r in [Some "a"; None; Some "b"] -> r})
+
+//    let _ =  Seq.toList  (seq {for opt in [Some "a"; None; Some "b"] match opt with (Some r) -> r}
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] do if i % 3 = 0 then yield i+j})
+
+
+    let _ =  Seq.toList  (seq {for i,j in [| (1,2);(3,4) |] -> i+j})
+    let ie2 = [ 3 .. 1 .. 5 ]
+
+    let _ =  Seq.toList  (seq {for i in ie2 do for j in 1 .. i -> i,j})
+end
+
+let ie2 = Regex.Matches("all the pretty horses","[a-z][a-z]") 
+test "coic23" 
+   (Seq.toList  (seq {for i in ie2 -> i.Value, i.Length}) = 
+      [("al", 2); ("th", 2); ("pr", 2); ("et", 2); ("ty", 2); ("ho", 2); ("rs", 2); ("es", 2)])
+
+
+
+let pickering() = 
+    let files = Directory.GetFiles(@"C:\Program Files\Microsoft Enterprise Library January 2006\", "*.csproj", SearchOption.AllDirectories)
+    for file in files do
+        let fileInfo = new FileInfo(file)
+        fileInfo.Attributes <- FileAttributes.Archive 
+        let doc = new XmlDocument()
+        doc.Load(file)
+        let nm = new XmlNamespaceManager(doc.NameTable)
+        nm.AddNamespace("msbuild", "http://schemas.microsoft.com/developer/msbuild/2003")
+        // need to pass in the namespace manager as the project files are in a name space
+        let nodes = doc.SelectNodes("/msbuild:Project/msbuild:PropertyGroup/msbuild:TreatWarningsAsErrors", nm) 
+        for node in nodes do
+            node.InnerText <- bool.FalseString
+        doc.Save(file)
+    stdin.ReadLine()
+ 
+
+for i,j in [(1,1);(2,1);(3,2)] do
+   printf "i = %d,j = %d\n" i j
+
+for Some(i,j) in [Some(1,1);None;Some(3,2)] do
+   printf "i = %d,j = %d\n" i j
+   
+
+let countc23 = ref 0 
+for i,j in [(1,1);(2,1);(3,2)] do
+   printf "i = %d,j = %d\n" i j;
+   incr countc23 
+
+for Some(i,j) in [Some(1,1);None;Some(3,2)] do
+   printf "i = %d,j = %d\n" i j
+   incr countc23
+
+test "coic23" (!countc23 = 5)
+
+let checkerboardCoordinates n = 
+    seq { for row in 1 .. n do
+           for col in 1 .. n do
+              if (row+col) % 2 = 0 then
+                  yield (row,col) }
+
+let fileInfo dir =
+    seq { for file in Directory.GetFiles(dir) do
+            let creationTime = File.GetCreationTime(file) 
+            let lastAccessTime = File.GetLastAccessTime(file) 
+            yield (file,creationTime,lastAccessTime) }
+
+let rec allFiles dir =
+    seq { for file in Directory.GetFiles(dir) do yield file
+          for subdir in Directory.GetDirectories dir do yield! (allFiles subdir) }
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+module Attempt = 
+    type Attempt<'a> = (unit -> 'a option)
+    let succeed x = (fun () -> Some(x)) 
+    let fail      = (fun () -> None) 
+    let apply (a:Attempt<'a>) = a() 
+    let bind p rest = (fun () -> match apply p with None -> None | Some r -> apply (rest r))
+    let delay f = (fun () -> apply (f ()))
+
+    type AttemptBuilder() =
+        member b.Return(x) = succeed x
+        member b.ReturnFrom(x) = x
+        member b.Bind(p,rest) = bind p rest
+        member b.Delay(f) = delay f
+        member b.Let(p,rest) = rest p 
+    let attempt = new AttemptBuilder()
+
+    let failIfBig n = attempt { if n > 1000 then return! fail else return n }
+
+    let failIfEitherBig (inp1,inp2) = 
+            attempt { let! n1 = failIfBig inp1
+                      let! n2 = failIfBig inp2 
+                      return (n1,n2) }
+
+module RandomWalk = 
+    let rnd = new System.Random() 
+    let dice p = (rnd.NextDouble() < p )
+    let walk initial upP = [| let state = ref initial 
+                              for i in 0 .. 100 do
+                                 do if dice upP then incr state else decr state
+                                 yield float !state |]
+
+
+module StringExtensionTest = 
+    module StringExtensions = 
+        type System.String with
+            member i.IsPrime = (i = "2") || (i = "3")
+
+
+    let s = "2"
+    open StringExtensions
+
+    printfn "res = %b" s.IsPrime
+
+module RandomSmallIfThenElseTest = 
+    let foo() = 
+     async 
+      { let a = 5
+        if true then  
+            do ()
+        return a }
+
+    let foo2() = 
+     async 
+      { let a = 5
+        if true then  
+            do ()
+        return a }
+
+module MoreExtensions =
+
+    open Microsoft.FSharp.Control
+    open System
+    open System.Threading
+    open System.Net
+    open System.Net.Security
+    open System.Net.Cache
+    open System.Security.Principal
+
+    type System.Data.SqlClient.SqlCommand with 
+        
+        member cmd.ExecuteReaderAsync() = 
+            Async.FromContinuations (fun (cont,econt,ccont) -> 
+                        // Note: The call to EndExecuteReader is not protected in the
+                        // exception chain. But it should not fail.
+                        cmd.BeginExecuteReader(callback=AsyncCallback(fun x -> match (try Choice1Of2(cmd.EndExecuteReader x) with e -> Choice2Of2(e)) with 
+                                                                               | Choice1Of2(res) -> cont res 
+                                                                               | Choice2Of2(exn) -> econt exn), 
+                                               stateObject=0) 
+                        |> ignore)
+
+
+    type WebRequestParameters(requestUri:Uri,AuthenticationLevel, CachePolicy, ConnectionGroupName, 
+                              ContentLength, Credentials, ImpersonationLevel, 
+                              Method, PreAuthenticate, Timeout,
+                              UseDefaultCredentials) =
+        member obj.RequestUri = requestUri
+        member obj.Apply(x: System.Net.WebRequest) = 
+            (match AuthenticationLevel with None -> () | Some(v:AuthenticationLevel) -> x.AuthenticationLevel <- v)
+            (match CachePolicy with None -> () | Some(v:RequestCachePolicy) -> x.CachePolicy <- v)
+            (match ConnectionGroupName with None -> () | Some(v) -> x.ConnectionGroupName <- v)
+            (match ContentLength with None -> () | Some(v) -> x.ContentLength <- v)
+            (match Credentials with None -> () | Some(v:ICredentials) -> x.Credentials <- v)
+            (match ImpersonationLevel with None -> () | Some(v:TokenImpersonationLevel) -> x.ImpersonationLevel <- v)
+            (match Method with None -> () | Some(v) -> x.Method <- v)
+            (match PreAuthenticate with None -> () | Some(v:AuthenticationLevel) -> x.AuthenticationLevel <- v)
+            (match Timeout with None -> () | Some(v) -> x.Timeout <- v)
+            (match UseDefaultCredentials with None -> () | Some(v) -> x.UseDefaultCredentials <- v)
+
+
+        
+    let trylet f x = (try Choice1Of2 (f x) with exn -> Choice2Of2(exn))
+    
+    let protect cont econt f x = 
+        match trylet f x with 
+        | Choice1Of2 v -> cont v
+        | Choice2Of2 exn -> econt exn
+    
+    type System.Net.WebRequest with 
+        static member Async(requestUri:Uri,?AuthenticationLevel, ?CachePolicy, ?ConnectionGroupName, 
+                            ?ContentLength, ?Credentials, ?ImpersonationLevel, 
+                            ?Method, ?PreAuthenticate, ?Timeout,
+                            ?UseDefaultCredentials) =
+  
+           let parameters = WebRequestParameters(requestUri,AuthenticationLevel, CachePolicy, ConnectionGroupName, 
+                                                 ContentLength, Credentials, ImpersonationLevel, 
+                                                 Method, PreAuthenticate, Timeout,
+                                                 UseDefaultCredentials)
+                                       
+           Async.FromContinuations (fun (cont,econt,ccont) -> 
+               let req = System.Net.WebRequest.Create(parameters.RequestUri) 
+               parameters.Apply(req);
+               req.BeginGetResponse(callback=AsyncCallback(protect cont econt req.EndGetResponse), state=0) |> ignore)
+
+        static member Async(requestUriString:string,?AuthenticationLevel, ?CachePolicy, ?ConnectionGroupName, 
+                            ?ContentLength, ?Credentials, ?ImpersonationLevel, 
+                            ?Method, ?PreAuthenticate, ?Timeout,
+                            ?UseDefaultCredentials) =
+  
+           let parameters = WebRequestParameters(Uri(requestUriString),AuthenticationLevel, CachePolicy, ConnectionGroupName, 
+                                                 ContentLength, Credentials, ImpersonationLevel, 
+                                                 Method, PreAuthenticate, Timeout,
+                                                 UseDefaultCredentials)
+                                       
+           Async.FromContinuations (fun (cont,econt,ccont) -> 
+               let req = System.Net.WebRequest.Create(parameters.RequestUri) 
+               parameters.Apply(req);
+               req.BeginGetResponse(callback=AsyncCallback(protect cont econt req.EndGetResponse), state=0) |> ignore)
+
+
+
+module SimpleAsyncWebCrawl = 
+
+    open System.Windows.Forms
+    open System.Collections.Generic
+    open System.Net
+    open System.IO
+    open MoreExtensions
+    open Microsoft.FSharp.Control
+    open System.Text.RegularExpressions
+
+    let limit = 50
+    let linkPat = "href=\s*\"[^\"h]*(http://[^&\"]*)\""
+    let getLinks (txt:string) =  [ for m in Regex.Matches(txt,linkPat)  -> m.Groups.Item(1).Value ]
+         
+    let (<--) (mp: MailboxProcessor<_>) x = mp.Post(x)
+
+
+
+
+    let webRequestSemaphore = new System.Threading.Semaphore(initialCount=2,maximumCount=2)
+    webRequestSemaphore.WaitOne() |> ignore
+    
+    /// Fetch the URL, and post the results to the collector. 
+    let collectLinksAsync (url:string) : Async<string list> =
+        async { do printfn "requesting %s" url
+                // Use an Async web request.
+                let! rsp = 
+                    async { do printfn "wait for semaphore for %s..." url
+                            let! ok = Async.AwaitWaitHandle webRequestSemaphore
+                            do printfn "got semaphore, ok = %A" ok
+                            if ok then 
+                                try 
+                                   do printfn "starting web request for %s" url
+                                   let! res = WebRequest.Async(url,Timeout=5) 
+                                   do printfn "done web request for %s" url
+                                   return res
+                                finally 
+                                   do printfn "releasing semaphore for %s" url
+                                   webRequestSemaphore.Release() |> ignore
+                            elif ok then
+                                return! failwith "hey, I thought we weren't OK"
+                            else 
+                                return! failwith "couldn't acquire a semaphore" }
+                // Get the response stream and read it
+                let! html = 
+                    async { use reader = new StreamReader(rsp.GetResponseStream()) 
+                            do printfn "reading %s" url
+                            // Note: this read should be asynchronous (todo)
+                            return reader.ReadToEnd()  }
+                // Get the links
+                do printfn "finished reading %s, scraping HTML for links" url
+                let links = getLinks html
+                // We're done
+                do printfn "got %d links" (List.length links)
+                return links }
+
+    /// 'collector' is a single global agent that receives URLs as messages. It creates processes
+    /// that send messages back to itself, hence it needs to refer to itself, hence it is marked 'rec'.
+    let collector = 
+        new Control.MailboxProcessor<_>(fun inbox ->
+            // The states of an agent form a set of mutually recursive functions
+            let rec crawl(visited : Set<string>) = 
+               async { do printfn "waiting for url ..." 
+                       //spawn all the requests
+                       let! url = inbox.Receive() 
+                       do printfn "got url %s, #visited = %d" url visited.Count
+                       // Check the limit
+                       if visited.Count < limit then
+                           // Which ones are new?
+                           if not (visited.Contains(url)) then                  
+                               // Spawn off a new asynchronous computation for the new url. Each new job collects
+                               // links and sends those links back as messages to the collector.
+                               do! Async.StartChild(async { let! links = collectLinksAsync url
+                                                                 // Send the links as messages
+                                                            for link in links do 
+                                                                    inbox <-- link }) |> Async.Ignore
+                           // Recurse into the waiting state
+                           return! crawl(visited.Add(url)) }
+
+            // the initial state            
+            crawl(Set.empty))
+                       
+    let main() = 
+        collector.Start()
+        collector <-- "http://news.google.com"
+        Async.CancelDefaultToken()
+
+
+module TryFinallySequenceExpressionTests = 
+
+    type RunExactlyOncePoint(s) = 
+        let mutable count = 0
+        member x.Run() = 
+            if count > 0 then 
+                failwithf "point %s got run more than once" s
+            else
+                printfn "got to point %s ok" s
+             
+            count <- count + 1
+        interface System.IDisposable with 
+            member x.Dispose() =  
+                if count = 0 then 
+                    failwithf "point %s never got run" s
+                else
+                    printfn "got to point %s exactly once" s
+
+    type RunNeverPoint(s) = 
+        member x.Run() = failwithf "never-run point %s got run " s
+        interface System.IDisposable with 
+            member x.Dispose() =  
+                printfn "never got to point %s - good!" s
+
+    let test3926() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew1")
+       seq { point1.Run() 
+             try 
+                 ()
+             finally 
+                  point2.Run() } |> Seq.iter ignore
+
+    test3926()
+
+    let test3926b() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew1")
+       seq { point1.Run() 
+             try 
+                 yield 1
+             finally 
+                  point2.Run() } |> Seq.iter ignore
+
+    test3926b()
+
+    let test3926c() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew1")
+       seq { point1.Run() 
+             yield 1
+             try 
+                 yield 1
+             finally 
+                  point2.Run() } |> Seq.iter ignore
+
+    test3926c()
+
+    let test3926d() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew2")
+       use point3 = new RunExactlyOncePoint("clknnew3")
+       use point4 = new RunExactlyOncePoint("clknnew4")
+       use point5 = new RunExactlyOncePoint("clknnew5")
+       seq { point1.Run() 
+             yield 1
+             try 
+                 yield 1
+                 point2.Run() 
+                 try 
+                     yield 1
+                     point3.Run() 
+                 finally 
+                      point4.Run() 
+             finally 
+                  point5.Run() } |> Seq.iter ignore
+
+    test3926d()
+
+    let test3927() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew1")
+       seq { try 
+                 ()
+             finally 
+                  point1.Run() 
+             try 
+                 ()
+             finally 
+                  point2.Run() } |> Seq.iter ignore
+
+    test3927()
+
+    let test3928() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew1")
+       seq { try 
+                 point1.Run()
+             finally 
+                  point2.Run() } |> Seq.iter ignore
+
+    test3928()
+
+    let test3929() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       seq { try 
+                 ()
+             finally 
+                  point1.Run() } |> Seq.iter ignore
+
+    test3929()
+
+    let test3930() = 
+       use point1 = new RunExactlyOncePoint("clknnew1")
+       use point2 = new RunExactlyOncePoint("clknnew2")
+       use point3 = new RunExactlyOncePoint("clknnew3")
+       use point4 = new RunExactlyOncePoint("clknnew4")
+       try 
+        seq { point1.Run()
+              try 
+                 point2.Run()
+              finally 
+                  point3.Run()
+                  failwith "fail" } |> Seq.iter ignore
+       with _ -> 
+           point4.Run()
+
+    test3930()
+
+    let test3931() = 
+       use point1 = new RunExactlyOncePoint("clknnew11")
+       use point2 = new RunExactlyOncePoint("clknnew22")
+       use never1 = new RunNeverPoint("clknnew33")
+       use never2 = new RunNeverPoint("clknnew44")
+       use never3 = new RunNeverPoint("clknnew55")
+       use never4 = new RunNeverPoint("clknnew66")
+       use never5 = new RunNeverPoint("clknnew77")
+       use never6 = new RunNeverPoint("clknnew88")
+       try 
+            seq { point1.Run()
+                  failwith ""
+                  try 
+                      never1.Run()
+                  finally 
+                      never2.Run()
+                  never3.Run()
+                  try 
+                      never4.Run()
+                  finally 
+                      never5.Run()
+                  never6.Run()
+                  yield 1  } |> Seq.iter ignore
+        with _ -> 
+            point2.Run()
+      
+    test3931()
+
+    let testve932() = 
+       use point1 = new RunExactlyOncePoint("zlknnew11")
+       use point2 = new RunExactlyOncePoint("zlknnew22")
+       use never1 = new RunNeverPoint("zlknnew33")
+       use never2 = new RunNeverPoint("zlknnew44")
+       use never3 = new RunNeverPoint("zlknnew55")
+       use never4 = new RunNeverPoint("zlknnew66")
+       use never5 = new RunNeverPoint("zlknnew77")
+       use never6 = new RunNeverPoint("zlknnew88")
+       try 
+            seq { point1.Run()
+                  try 
+                      failwith ""
+                      try 
+                          never1.Run()
+                      finally 
+                          never2.Run()
+                      never3.Run()
+                      try 
+                          never4.Run()
+                      finally 
+                          never5.Run()
+                      never6.Run()
+                  finally
+                      point2.Run()
+                  yield 1  } |> Seq.iter ignore
+        with _ -> ()
+          
+    testve932() 
+    let testve934() = 
+       use point1 = new RunExactlyOncePoint("1zlknnew11")
+       use point2 = new RunExactlyOncePoint("1zlknnew22")
+       use point3 = new RunExactlyOncePoint("1zlknnew33")
+       use never1 = new RunNeverPoint("1zlknnew3")
+       use never2 = new RunNeverPoint("1zlknnew44")
+       use never3 = new RunNeverPoint("1zlknnew55")
+       use never4 = new RunNeverPoint("1zlknnew66")
+       use never5 = new RunNeverPoint("1zlknnew77")
+       use never6 = new RunNeverPoint("1zlknnew88")
+       try 
+        seq { point1.Run()
+              try 
+                  try 
+                      failwith ""
+                      never1.Run()
+                  finally 
+                      point2.Run()
+                  never2.Run()
+                  try 
+                      never3.Run()
+                  finally 
+                      never4.Run()
+                  never5.Run()
+              finally
+                  point3.Run()
+              yield 1  } |> Seq.iter ignore
+       with _ -> ()
+      
+    testve934()
+      
+    let testve935() = 
+       use point1 = new RunExactlyOncePoint("1zlknnew11")
+       use point2 = new RunExactlyOncePoint("1zlknnew22")
+       use point3 = new RunExactlyOncePoint("1zlknnew33")
+       use point4 = new RunExactlyOncePoint("1zlknnew44")
+       use point5 = new RunExactlyOncePoint("1zlknnew55")
+       use point6 = new RunExactlyOncePoint("1zlknnew55")
+       use never1 = new RunNeverPoint("1zlknnew3")
+       use never2 = new RunNeverPoint("1zlknnew4")
+       use never3 = new RunNeverPoint("1zlknnew55")
+       try 
+            seq { point1.Run() 
+                  try 
+                      try 
+                          point2.Run()
+                      finally 
+                          point3.Run()
+                      point4.Run()
+                      try 
+                          failwith ""
+                          never1.Run()
+                      finally 
+                          point5.Run()
+                      never3.Run()
+                  finally
+                      point6.Run()
+                  yield 1  } |> Seq.iter ignore
+       with _ -> ()
+
+    testve935() 
+
+    let testve936()  = 
+       use point1 = new RunExactlyOncePoint("2zlknnew11")
+       use point2 = new RunExactlyOncePoint("2zlknnew22")
+       use point3 = new RunExactlyOncePoint("2zlknnew33")
+       use point4 = new RunExactlyOncePoint("2zlknnew44")
+       use point5 = new RunExactlyOncePoint("2zlknnew55")
+       use point6 = new RunExactlyOncePoint("2zlknnew66")
+       use never1 = new RunNeverPoint("2zlknnew3")
+       use never2 = new RunNeverPoint("2zlknnew4")
+       use never3 = new RunNeverPoint("2zlknnew55")
+       try 
+            seq { point1.Run()
+                  for x in 0..0 do
+                      try 
+                          try 
+                              point2.Run()
+                          finally 
+                              point3.Run()
+                          point4.Run()
+                          try 
+                              failwith ""
+                              never1.Run()
+                          finally 
+                              point5.Run()
+                          never2.Run()
+                      finally
+                          point6.Run()
+                      yield 1  } |> Seq.iter ignore
+       with _ -> ()
+
+    testve936() 
+    let testve937()  = 
+       use point1 = new RunExactlyOncePoint("3zlknnew11")
+       use point2 = new RunExactlyOncePoint("3zlknnew22")
+       use point3 = new RunExactlyOncePoint("3zlknnew33")
+       use point4 = new RunExactlyOncePoint("3zlknnew44")
+       use point5 = new RunExactlyOncePoint("3zlknnew55")
+       use point6 = new RunExactlyOncePoint("3zlknnew66")
+       use never1 = new RunNeverPoint("3zlknnew3")
+       use never2 = new RunNeverPoint("3zlknnew4")
+       use never3 = new RunNeverPoint("3zlknnew55")
+       try 
+            seq { point1.Run()
+                  let x = ref 0
+                  while !x = 0 do
+                      incr x 
+                      try 
+                          try 
+                              point2.Run()
+                          finally 
+                              point3.Run()
+                          point4.Run()
+                          try 
+                              failwith ""
+                              never1.Run()
+                          finally 
+                              point5.Run()
+                          never2.Run()
+                      finally
+                          point6.Run()
+                      yield 1  } |> Seq.iter ignore
+       with _ -> ()
+
+    testve937() 
diff --git a/tests/fsharp/core/comprehensions/test.fsx b/tests/fsharp/core/comprehensions/test.fsx
new file mode 100644
index 0000000..3cea280
--- /dev/null
+++ b/tests/fsharp/core/comprehensions/test.fsx
@@ -0,0 +1,1482 @@
+// #Conformance #Sequences #Regression #ControlFlow #SyntacticSugar #ComputationExpressions 
+#if Portable
+module Core_comprehensions
+#endif
+#light
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif  
+
+
+let _ = test "coic23a" (Seq.toList { 'a' .. 'c' } = ['a';'b';'c'])
+
+let _ = test "coic23q" (Seq.toList {1 .. 0} = [])
+let _ = test "coic23w" (Seq.toList {1 .. 1} = [1])
+let _ = test "coic23e" (Seq.toList {1 .. 3} = [1;2;3])
+let _ = test "coic23r" (Seq.toList {1L .. 3L} = [1L;2L;3L])
+let _ = test "coic23t" (Seq.toList {1UL .. 3UL} = [1UL;2UL;3UL])
+let _ = test "coic23y" (Seq.toList {1ul .. 3ul} = [1ul;2ul;3ul])
+let _ = test "coic23a" (Seq.toList {1y .. 3y} = [1y;2y;3y])
+let _ = test "coic23s" (Seq.toList {1uy .. 3uy} = [1uy;2uy;3uy])
+let _ = test "coic23d" (Seq.toList {1s .. 3s} = [1s;2s;3s])
+//test "coic23" (Seq.toList {1I .. 3I} = [1I;2I;3I])
+//test "coic23" (Seq.toList {1N .. 3N} = [1N;2N;3N])
+let _ = test "coic23d" (Seq.toList {1us .. 3us} = [1us;2us;3us])
+let _ = test "coic23f" (Seq.toList {3 .. 1} = [])
+let _ = test "coic23g" (Seq.toList  {1.0..3.0} = [1.0;2.0;3.0])
+let _ = test "coic23h" (Seq.toList  {1.0 .. 1.0 .. 3.0} = [1.0;2.0;3.0])
+let _ = test "coic23j" (Seq.toList  {1.0 .. 1.0 .. 2.01 } = [1.0;2.0])
+let _ = test "coic23k" (Seq.toList  {3.0 .. -1.0 .. 0.0} = [3.0;2.0;1.0;0.0])
+let _ = test "coic23l" (Seq.toList  {4.0 .. -2.0 .. 0.0} = [4.0;2.0;0.0])
+let _ = test "coic23z" (Seq.toList  {3 .. -1 .. -3} = [3;2;1;0; -1; -2; -3])
+let _ = test "coic23x" (Seq.toList  {3 .. -2 .. -3}= [3;1; -1; -3])
+
+let _ = test "coic23c" ([ 'a' .. 'c' ] = ['a';'b';'c'])
+
+let _ = test "coic23v" ([ 1 .. 0 ] = [])
+let _ = test "coic23b" ([ 1 .. 1 ] = [1])
+let _ = test "coic23n" ([ 1 .. 3 ] = [1;2;3])
+let _ = test "coic23m" ([ 1L .. 3L ]= [1L;2L;3L])
+let _ = test "coic2342" ([ 1UL .. 3UL ] = [1UL;2UL;3UL])
+let _ = test "coic233d2" ([ 1ul .. 3ul ] = [1ul;2ul;3ul])
+let _ = test "coic23t34" ([ 1y .. 3y ] = [1y;2y;3y])
+let _ = test "coic23cwe" ([ 1uy .. 3uy ] = [1uy;2uy;3uy])
+let _ = test "coic23cu" ([ 1s .. 3s ] = [1s;2s;3s])
+//test "coic23" ([ 1I .. 3I) = [1I;2I;3I])
+//test "coic23" ([ 1N .. 3N) = [1N;2N;3N])
+let _ = test "coic238n7" ([ 1us .. 3us ] = [1us;2us;3us])
+let _ = test "coic23we" ([ 3 .. 1 ] = [])
+let _ = test "coic23v38c5" ([ 1.0..3.0 ] = [1.0;2.0;3.0])
+let _ = test "coic23v5wq" ([ 1.0 .. 1.0 .. 3.0 ] = [1.0;2.0;3.0])
+let _ = test "coic23cv42" ([ 1.0 .. 1.0 .. 2.01  ] = [1.0;2.0])
+let _ = test "coic23cd2" ([ 3.0 .. -1.0 .. 0.0 ] = [3.0;2.0;1.0;0.0])
+let _ = test "coic23vq423" ([ 4.0 .. -2.0 .. 0.0 ] = [4.0;2.0;0.0])
+let _ = test "coic23jyi" ([ 3 .. -1 .. -3] = [3;2;1;0; -1; -2; -3])
+let _ = test "coic23my7" ([ 3 .. -2 .. -3 ]= [3;1; -1; -3])
+
+
+let test3198 = 
+    let mutable count = 0 in 
+    for i in seq {1 .. 3} do 
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+
+let test3198b = 
+    let mutable count = 0 in 
+    let ie = {1 .. 3} in
+    for i in ie do 
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+let test3198x = 
+    let mutable count = 0 in 
+    let ie = ref {1 .. 3} in
+    
+    for i in !ie do 
+        ie := {1 .. 2};
+        count <- count + 1;
+        printf "i = %d\n" i 
+    done;
+    test "fi3n" (count = 3)
+
+let test342879 = 
+    let mutable count = 0 in 
+    for i in seq {1 .. 3} do 
+        for j in seq {i .. 3} do 
+            count <- count + 1;
+            printf "i = %d\n" i 
+        done;
+    done;
+    test "fi3n" (count = 6)
+
+let _ = 
+  for i in seq {1 .. 3} do 
+      printf "i = %d\n" i 
+  done
+
+
+let _ = test "coic23v\w" (Seq.toList  (seq {for i in seq {1 .. 3} -> i,i*i}) = [1,1;2,4;3,9] )
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+let _ = 
+  test "coic23va" (Seq.toList  (seq {for i in seq {1 .. 5} do
+                                         if i % 2 = 0 then yield i+100})
+                  = [102;104])
+
+let _ = 
+  test "coic23eq" (Seq.toList  (seq {for i in seq {1 .. 3} -> i}) = [1;2;3])
+
+let _ = 
+  test "coic23avwa" (Seq.toList  (seq {for i in seq {1 .. 3} do
+                                           for j in seq {1 .. 4} do
+                                              yield i,j}) = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+let _ = 
+  test "coic23bvee" (Seq.toList  (seq {for i in seq {1 .. 3} do
+                                           if i % 2 = 1 then
+                                             for j in seq {1 .. 4} do yield i,j}) = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+let _ = 
+  test "coic23wcwec" (Seq.toList  (seq {for i in seq {1 .. 3} do
+                                            for j in seq {i .. 3} do yield i,j}) = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+let ie1 = [ 1 .. 1 .. 3 ]
+
+let _ = test "colc23cwe" ([ for i in ie1 do 
+                            for j in seq {i .. 3} do yield i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+let _ = test "colc23v\w" ([ for i in seq {1 .. 3} do yield i,i*i ] = [1,1;2,4;3,9])
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+let _ = test "colc23va" ([ for i in seq {1 .. 5} do
+                           if i % 2 = 0 then yield i+100 ]
+                        = [102;104])
+
+let _ = test "colc23eq" ( [ for i in seq {1 .. 3} -> i ] = [1;2;3])
+
+let _ = test "colc23avwa" ([ for i in seq {1 .. 3}  do
+                             for j in seq {1 .. 4} do yield i,j ] = [1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4])
+
+let _ = test "colc23bvee" ([ for i in seq {1 .. 3} do
+                              if i % 2 = 1 then 
+                                for j in seq {1 .. 4} do yield i,j ] = [1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4])
+
+
+let _ = test "colc23wcwec" ([ for i in seq {1 .. 3} do
+                              for j in seq {i .. 3} do yield i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+let _ = test "colc23cwe" ([ for i in ie1 do
+                            for j in seq {i .. 3} do yield i,j ] = [1,1;1,2;1,3;2,2;2,3;3,3])
+
+
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                            for j in seq {i .. 3} do yield i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23v\w" ([|for i in seq {1 .. 3} -> i,i*i|] = [|1,1;2,4;3,9|])
+
+//{for x,y in [| (1,2) |]  -> x+y)
+
+
+let _ = test "coac23va" ([|for i in seq {1 .. 5} do
+                            if i % 2 = 0 then yield i+100|]
+                        = [|102;104|])
+
+let _ = test "coac23eq" ( [|for i in seq {1 .. 3} -> i|] = [|1;2;3|])
+
+let _ = test "coac23avwa" ([|for i in seq {1 .. 3} do
+                             for j in seq {1 .. 4} do yield i,j|] = [|1,1;1,2;1,3;1,4;2,1;2,2;2,3;2,4;3,1;3,2;3,3;3,4|])
+
+let _ = test "coac23bvee" ([|for i in seq {1 .. 3} do
+                              if i % 2 = 1 then 
+                                for j in seq {1 .. 4} do yield i,j|] = [|1,1;1,2;1,3;1,4;3,1;3,2;3,3;3,4|])
+
+
+let _ = test "coac23wcwec" ([|for i in seq {1 .. 3} do
+                                for j in seq {i .. 3} do yield i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do yield i,j|] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do
+                                yield (i,j)
+                              done 
+                            done |] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([| for i in ie1 do
+                               for j in seq {i .. 3} do
+                                 yield (i,j)
+                               done 
+                             done |] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do
+                                if true then 
+                                    yield (i,j)
+                                else 
+                                    yield (i,j)
+                              done
+                            done |] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do
+                                if true then 
+                                    yield (i,j)
+                                else 
+                                    yield (i,j)
+                              done
+                            done |] = [|1,1;1,2;1,3;2,2;2,3;3,3|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do
+                                if i = j then 
+                                    yield (i+i,j+j)
+                                else 
+                                    yield (i,j)
+                              done
+                            done |] = [|2,2;1,2;1,3;4,4;2,3;6,6|])
+
+let _ = test "coac23cwe" ([|for i in ie1 do
+                              for j in seq {i .. 3} do
+                                if i = j then 
+                                    yield (i+i,j+j)
+                                else 
+                                    yield (i,j)
+                              done
+                            done |] = [|2,2;1,2;1,3;4,4;2,3;6,6|])
+
+module TestSet2 = begin
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 3} -> 1})
+
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 30} do if i % 2 = 0 then yield i+100})
+
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 3} -> i})
+
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 3} do for j in seq {1 .. 4} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 3} do if i % 2 = 1 then for j in seq {1 .. 4} -> i,j})
+
+    let _ =  Seq.toList  (seq {for i in seq {1 .. 3} do for j in seq {1 .. i} do yield i,j})
+
+    let _ =  Seq.toList  (seq {for i,j in (Seq.ofList [(1,2);(3,4)]) -> i+j })
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] -> i+j})
+
+    let _ =  Seq.toList  (seq  {for i in [Some "a"; None; Some "b"] -> i})
+
+    let _ =  Seq.toList  (seq  {for opt in [Some "a"; None; Some "b"] do
+                                     match opt with 
+                                     | Some r -> yield r
+                                     | None -> ()
+                                   done })
+
+    let _ =  Seq.toList  (seq  {for opt in [Some "a"; None; Some "b"] do
+                                     match opt with 
+                                     | Some r -> yield r
+                                     | None -> ()
+                                   done })
+
+    let _ =  Seq.toList  (seq
+                            { while false do
+                                     let opt = Some "a" in
+                                     match opt with 
+                                     | Some r -> yield r
+                                     | None -> ()
+                              done })
+
+
+    let _ =  Seq.toList  (seq {for r in [Some "a"; None; Some "b"] -> r})
+
+    let _ =  Seq.toList  (seq {for i,j in [(1,2);(3,4)] do if i % 3 = 0 then yield i+j})
+
+    let _ =  Seq.toList  (seq {for i,j in [| (1,2);(3,4) |] -> i+j})
+
+
+    let _ =  Seq.toList  (seq {for i in ie1 do for j in seq {1 .. i} -> i,j})
+end
+
+
+open System.Text.RegularExpressions
+let ie2 = Regex.Matches("all the pretty horses","[a-z][a-z]") 
+let _ = test "coic23" 
+           (Seq.toList  (seq {for i in ie2 -> i.Value, i.Length }) = 
+              [("al", 2); ("th", 2); ("pr", 2); ("et", 2); ("ty", 2); ("ho", 2); ("rs", 2); ("es", 2)])
+
+
+
+module IEnumeratorInterfaceForLoopTest = begin
+
+    open System.Collections.Generic
+    type DisposableEnumeratorInterface = 
+      class
+        new (counter) = { counter = counter } 
+        val counter : int ref 
+        interface IEnumerator<string> with 
+            member x.Current  = "DisposableEnumeratorInterface: Current"
+        end
+        interface System.Collections.IEnumerator with 
+            member x.MoveNext() = false
+            member x.Current = box "whoa"
+            member x.Reset() = ()
+        end
+        member x.Current  = "DisposableEnumeratorInterface: Current"
+        interface System.IDisposable with 
+          member x.Dispose() = incr x.counter 
+        end 
+      end
+      
+    type DisposableCollectionInterface = 
+      class
+        new (counter) = { counter = counter } 
+        val counter : int ref 
+        interface IEnumerable<string> with 
+          member x.GetEnumerator() =  (new DisposableEnumeratorInterface(x.counter)  :> IEnumerator<string>)
+        end 
+        interface System.Collections.IEnumerable with 
+          member x.GetEnumerator() =  (new DisposableEnumeratorInterface(x.counter) :> System.Collections.IEnumerator)
+        end 
+      end
+
+
+    let _ = 
+        let counter = ref 0 in 
+        for i in (new DisposableCollectionInterface(counter) :> IEnumerable<string>) do
+          failwith "No, this should not get executed, but IDisposable cleanup should occur"
+        done;
+        test "1f3oiver-90a" (!counter = 1)
+
+    let _ = 
+        let counter = ref 0 in 
+        let ie = seq { for i in (new DisposableCollectionInterface(counter) :> IEnumerable<string>) -> failwith "No, this should not get executed, but IDisposable cleanup should occur" } in
+        ie |> Seq.iter (fun _ -> failwith "this should be empty");
+        test "1f3oiver-90b" (!counter = 1)
+
+    let _ = 
+        let counter = ref 0 in 
+        for i in (new DisposableCollectionInterface(counter)) do
+          failwith "No, this should not get executed, but IDisposable cleanup should occur"
+        done;
+        test "1f3oiver-90a" (!counter = 1)
+
+    let _ = 
+        let counter = ref 0 in 
+        let ie = seq { for i in (new DisposableCollectionInterface(counter)) -> failwith "No, this should not get executed, but IDisposable cleanup should occur" } in
+        ie |> Seq.iter (fun _ -> failwith "this should be empty");
+        test "1f3oiver-90b" (!counter = 1)
+
+    let _ = 
+        let counter = ref 0 in 
+        let _ = (new DisposableCollectionInterface(counter)) |> Seq.iter (fun i -> failwith "No, this should not get executed, but IDisposable cleanup should occur") in
+        test "1f3oiver-90c" (!counter = 1)
+
+end
+
+module IEnumeratorPatternForLoopTest = begin
+
+    open System.Collections.Generic
+    type DisposableEnumeratorPattern = 
+      class
+        new (counter) = { counter = counter } 
+        val counter : int ref 
+        member x.MoveNext() = false
+        member x.Current  = "DisposableEnumeratorPattern: Current"
+        interface System.IDisposable with 
+          member x.Dispose() = incr x.counter 
+        end 
+      end
+      
+    type DisposableCollectionPattern = 
+      class
+        new (counter) = { counter = counter } 
+        val counter : int ref 
+        member x.GetEnumerator() = new DisposableEnumeratorPattern(x.counter)
+      end
+
+    let _ = 
+        let counter = ref 0 in 
+        for i in (new DisposableCollectionPattern(counter)) do
+          failwith "No, this should not get executed, but IDisposable cleanup should occur"
+        done;
+        test "1f3oiver-90a" (!counter = 1)
+
+    let _ = 
+        let counter = ref 0 in 
+        let ie = seq { for i in (new DisposableCollectionPattern(counter)) -> failwith "No, this should not get executed, but IDisposable cleanup should occur" } in
+        ie.GetEnumerator().Dispose()
+        test "1f3oiver-90b-dispose" (!counter = 0)
+        ie |> Seq.iter (fun _ -> failwith "this should be empty");
+        test "1f3oiver-90b" (!counter = 1)
+
+end
+
+module SequenceComputationExpressions = begin
+  type SequenceBuilder() =
+      class
+            member b.Zero() = Seq.empty
+            member b.ReturnFrom(x) = x
+            member b.Return(x) = Seq.singleton x
+            member b.Combine(x,y) = Seq.append x y
+            member b.Compose(p1,rest) = Seq.collect rest p1 
+            member b.Using(rf,rest) = Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.EnumerateUsing rf rest
+      end
+  
+end
+
+module MaxIntMinIntBOundaryCases = begin
+    open System
+    let check s x y = test s (x=y)
+
+    do check "r3111" [ Int64.MinValue .. Int64.MinValue] [Int64.MinValue]
+    do check "r3112" [ Int64.MaxValue .. Int64.MaxValue] [Int64.MaxValue]
+    do check "r3113" [ Int64.MaxValue - 1L .. Int64.MaxValue] [Int64.MaxValue-1L; Int64.MaxValue]
+    do check "r3114" [ Int64.MinValue.. Int64.MinValue+1L] [Int64.MinValue; Int64.MinValue+1L]
+    do check "r3115" [ Int64.MaxValue .. Int64.MaxValue-1L] []
+    do check "r3116" [ Int64.MinValue+1L.. Int64.MinValue] []
+
+    do check "r3117" [ Int32.MinValue .. Int32.MinValue] [Int32.MinValue]
+    do check "r3118" [ Int32.MaxValue .. Int32.MaxValue] [Int32.MaxValue]
+    do check "r3119" [ Int32.MaxValue - 1 .. Int32.MaxValue] [Int32.MaxValue-1; Int32.MaxValue]
+    do check "r3110" [ Int32.MinValue.. Int32.MinValue+1] [Int32.MinValue; Int32.MinValue+1]
+    do check "r311-" [ Int32.MaxValue .. Int32.MaxValue-1] []
+    do check "r311a" [ Int32.MinValue+1.. Int32.MinValue] []
+
+
+    do check "r311q" [ Int16.MinValue .. Int16.MinValue] [Int16.MinValue]
+    do check "r311w" [ Int16.MaxValue .. Int16.MaxValue] [Int16.MaxValue]
+    do check "r311e" [ Int16.MaxValue - 1s .. Int16.MaxValue] [Int16.MaxValue-1s; Int16.MaxValue]
+    do check "r311r" [ Int16.MinValue .. Int16.MinValue+1s] [Int16.MinValue; Int16.MinValue+1s]
+    do check "r311t" [ Int16.MaxValue .. Int16.MaxValue-1s] []
+    do check "r311y" [ Int16.MinValue+1s .. Int16.MinValue] []
+
+
+    do check "r311u" [ SByte.MinValue .. SByte.MinValue] [SByte.MinValue]
+    do check "r311i" [ SByte.MaxValue .. SByte.MaxValue] [SByte.MaxValue]
+    do check "r311o" [ SByte.MaxValue - 1y .. SByte.MaxValue] [SByte.MaxValue-1y; SByte.MaxValue]
+    do check "r311p" [ SByte.MinValue .. SByte.MinValue+1y] [SByte.MinValue; SByte.MinValue+1y]
+    do check "r311s" [ SByte.MaxValue .. SByte.MaxValue-1y] []
+    do check "r311d" [ SByte.MinValue+1y .. SByte.MinValue] []
+
+    do check "r311f" [ UInt64.MinValue .. UInt64.MinValue] [UInt64.MinValue]
+    do check "r311g" [ UInt64.MaxValue .. UInt64.MaxValue] [UInt64.MaxValue]
+    do check "r311h" [ UInt64.MaxValue - 1UL .. UInt64.MaxValue] [UInt64.MaxValue-1UL; UInt64.MaxValue]
+    do check "r311j" [ UInt64.MinValue.. UInt64.MinValue+1UL] [UInt64.MinValue; UInt64.MinValue+1UL]
+    do check "r311k" [ UInt64.MaxValue .. UInt64.MaxValue-1UL] []
+    do check "r311l" [ UInt64.MinValue+1UL.. UInt64.MinValue] []
+
+    do check "r311z" [ UInt32.MinValue .. UInt32.MinValue] [UInt32.MinValue]
+    do check "r311x" [ UInt32.MaxValue .. UInt32.MaxValue] [UInt32.MaxValue]
+    do check "r311c" [ UInt32.MaxValue - 1u .. UInt32.MaxValue] [UInt32.MaxValue-1u; UInt32.MaxValue]
+    do check "r311v" [ UInt32.MinValue.. UInt32.MinValue+1u] [UInt32.MinValue; UInt32.MinValue+1u]
+    do check "r311b" [ UInt32.MaxValue .. UInt32.MaxValue-1u] []
+    do check "r311n" [ UInt32.MinValue+1u.. UInt32.MinValue] []
+
+
+    do check "r311m" [ UInt16.MinValue .. UInt16.MinValue] [UInt16.MinValue]
+    do check "r311Q" [ UInt16.MaxValue .. UInt16.MaxValue] [UInt16.MaxValue]
+    do check "r311W" [ UInt16.MaxValue - 1us .. UInt16.MaxValue] [UInt16.MaxValue-1us; UInt16.MaxValue]
+    do check "r311E" [ UInt16.MinValue .. UInt16.MinValue+1us] [UInt16.MinValue; UInt16.MinValue+1us]
+    do check "r311R" [ UInt16.MaxValue .. UInt16.MaxValue-1us] []
+    do check "r311T" [ UInt16.MinValue+1us .. UInt16.MinValue] []
+
+
+    do check "r311A" [ Byte.MinValue .. Byte.MinValue] [Byte.MinValue]
+    do check "r311S" [ Byte.MaxValue .. Byte.MaxValue] [Byte.MaxValue]
+    do check "r311D" [ Byte.MaxValue - 1uy .. Byte.MaxValue] [Byte.MaxValue-1uy; Byte.MaxValue]
+    do check "r311F" [ Byte.MinValue .. Byte.MinValue+1uy] [Byte.MinValue; Byte.MinValue+1uy]
+    do check "r311G" [ Byte.MaxValue .. Byte.MaxValue-1uy] []
+    do check "r311Z" [ Byte.MinValue+1uy .. Byte.MinValue] []
+
+    let checkr s x y = test s (x= List.rev y)
+
+    do checkr "r3121" [ Int64.MinValue .. -1L .. Int64.MinValue] [Int64.MinValue]
+    do checkr "r3122" [ Int64.MaxValue .. -1L .. Int64.MaxValue] [Int64.MaxValue]
+    do checkr "r3123" [ Int64.MaxValue .. -1L .. Int64.MaxValue - 1L] [Int64.MaxValue-1L; Int64.MaxValue]
+    do checkr "r3124" [ Int64.MinValue+1L.. -1L .. Int64.MinValue] [Int64.MinValue; Int64.MinValue+1L]
+    do checkr "r3125" [ Int64.MaxValue-1L .. -1L .. Int64.MaxValue] []
+    do checkr "r3126" [ Int64.MinValue.. -1L .. Int64.MinValue+1L] []
+
+    do checkr "r3127" [ Int32.MinValue .. -1 .. Int32.MinValue] [Int32.MinValue]
+    do checkr "r3128" [ Int32.MaxValue .. -1 .. Int32.MaxValue] [Int32.MaxValue]
+    do checkr "r3129" [ Int32.MaxValue .. -1 .. Int32.MaxValue-1] [Int32.MaxValue-1; Int32.MaxValue]
+    do checkr "r3120" [ Int32.MinValue+1.. -1 .. Int32.MinValue] [Int32.MinValue; Int32.MinValue+1]
+    do checkr "r312-" [ Int32.MaxValue-1 .. -1 .. Int32.MaxValue] []
+    do checkr "r312a" [ Int32.MinValue.. -1 .. Int32.MinValue+1] []
+
+
+    do checkr "r312q" [ Int16.MinValue .. -1s .. Int16.MinValue] [Int16.MinValue]
+    do checkr "r312w" [ Int16.MaxValue .. -1s .. Int16.MaxValue] [Int16.MaxValue]
+    do checkr "r312e" [ Int16.MaxValue  .. -1s .. Int16.MaxValue-1s] [Int16.MaxValue-1s; Int16.MaxValue]
+    do checkr "r312r" [ Int16.MinValue+1s .. -1s .. Int16.MinValue] [Int16.MinValue; Int16.MinValue+1s]
+    do checkr "r312t" [ Int16.MaxValue-1s .. -1s .. Int16.MaxValue] []
+    do checkr "r312y" [ Int16.MinValue .. -1s .. Int16.MinValue+1s] []
+
+
+    do checkr "r312u" [ SByte.MinValue .. -1y .. SByte.MinValue] [SByte.MinValue]
+    do checkr "r312i" [ SByte.MaxValue .. -1y .. SByte.MaxValue] [SByte.MaxValue]
+    do checkr "r312o" [ SByte.MaxValue .. -1y .. SByte.MaxValue-1y] [SByte.MaxValue-1y; SByte.MaxValue]
+    do checkr "r312p" [ SByte.MinValue+1y .. -1y .. SByte.MinValue] [SByte.MinValue; SByte.MinValue+1y]
+    do checkr "r312s" [ SByte.MaxValue-1y .. -1y .. SByte.MaxValue] []
+    do checkr "r312d" [ SByte.MinValue .. -1y .. SByte.MinValue+1y] []
+
+end
+ 
+open System.IO
+open System.Xml
+
+let pickering() = 
+    #if Portable
+    ()
+    #else
+    let files = Directory.GetFiles(@"C:\Program Files\Microsoft Enterprise Library January 2006\", "*.csproj", SearchOption.AllDirectories) in
+    for file in files do
+        let fileInfo = new FileInfo(file) in
+        fileInfo.Attributes <- FileAttributes.Archive;
+        let doc = new XmlDocument() in
+        doc.Load(file);
+        let nm = new XmlNamespaceManager(doc.NameTable) in
+        nm.AddNamespace("msbuild", "http://schemas.microsoft.com/developer/msbuild/2003");
+        // need to pass in the namespace manager as the project files are in a name space
+        let nodes = doc.SelectNodes("/msbuild:Project/msbuild:PropertyGroup/msbuild:TreatWarningsAsErrors", nm) in
+        for node in nodes do
+            node.InnerText <- bool.FalseString
+        done;
+        doc.Save(file);
+    done;
+    stdin.ReadLine()
+    #endif
+ 
+(* Specification and discussion.
+
+   Given the comprehension [x0 .. dx .. x1].
+
+   For the purpose of specification, consider x0,dx,x1 as real numbers (in order to specify with exact arithmetic).
+   Degenerate cases:
+     When x0=x1, return [x0].
+     When dx=0,  currently, it fails.
+                 It could return either [] or [x0;x0;x0;...].
+
+   Remaining cases:
+
+   a) When interval and step are both increasing (have x0<x1 and dx>0)
+      it's intended that the sequence should be:
+
+        {zi while zi < x1} where zi = x0 + i.dx
+
+   b) When interval increases but step decrease:
+      Here are some examples:
+        [0.0 .. -1.0 .. 20.0]
+        [0.0 .. -1.0 .. infinity]
+        [0   .. -1   .. System.Int32.MaxValue]
+
+      There are two choices:
+      C1) Return an empty sequence.
+      C2) Return a sequence heading in the wrong direction until running out of values/precision.
+
+      If the later sequences are required, they can be written directly, e.g.
+        [0.0 .. -1.0 .. -infinity]
+        [0   .. -1   .. min_int]
+        
+      Choosing C1 (which is the intended current behaviour).
+
+   c) When interval and step are both decreasing, then dual of a).
+   d) When internal decrease and step increase, then dual of b).
+
+   Turning this into a brief specification for {x0 .. dx .. x1} on reals.
+   
+     If x0=x1 then [x0]
+     If dx=0 then fail.
+     If x0<x1. If dx>0 then {x0 + i.dx while <= x1}. If dx<0 then {}.
+     If x0>x1. If dx<0 then {x0 + i.dx while >= x1}. If dx>0 then {}.
+     
+   However, the types are not real, rather int or float types.   
+   The range sequence should agree with the real sequence under it's natural embedding into reals (+).   
+   (+) So, UInt32.MaxValue is considered +ve, not -1.
+
+   Rounding error optimisation:
+     With floating arithmetic (single/double),
+     when (x1-x1)/dx is clearly integral (and fits inside int32 say),
+     then can generate from the underlying int range via {x0 + i.dx}.
+     This should ensure that the endpoint is generated (in this case, assuming no multiplication error).
+   -----------------------------------------------------------------------
+
+   Problems:
+   * Unsigned types do not support negative dx. (reported by Mort).
+   
+   -----------------------------------------------------------------------
+   Implementation issues:
+   * Integer arithmetic can wrap, so termination conditions need care, e.g.   
+     When x0<x1 and dx>0 then all of the following are possible:
+             x0 + dx < x0  -- advanced beyond range, and wrapped.
+             x0 + dx = x0  -- no change, dx=0
+        x0 < x0 + dx < x1  -- advanced, still in range.
+             x0 + dx = x1  -- advanced, hit end point
+        x1 < x0 + dx       -- advanced beyond range.
+        
+   * Floating arithmetic can lose precision.
+   * Floating arithmetic can break to Infinity, (e.g. System.Double.MaxValue + System.Double.MaxValue).
+   * Floating values can include, +/- infinity and NaN. These could be x0,dx or x1.
+   
+ @"" <-- keeps emacs mode happy, please do not delete!
+*)
+
+printf "Regressions: 1017\n"
+
+let fails f = try f() |> ignore; false with e -> true
+let check str x = if x then printf "OK: %s\n" str  else (printf "FAILED: %s\n" str;  report_failure ())
+
+let rec steps x dx n = if n=0 then [] else x :: steps (x+dx) dx (n-1)
+
+(* Regression tests: integer ranges *)
+[ 10 .. 20]         = steps 10 1 11     |> check    "10..20"
+[ 10 .. 0 ]         = []                |> check    "10..0"
+[ 10 .. 10 ]        = [10]              |> check    "10..10"
+fails (fun () -> [ 10 .. 0 .. 10])      |> check    "10..0..10"
+
+(* Bug: wrapped arithmetic unsigned *)
+[ 10u .. 4294967294u .. 0u  ] = []      |> check    "overflow uint contrary"
+[ 10u .. 4294967294u .. 20u ] = [10u]   |> check    "overflow uint //"
+
+(* Bug: wrapped arithmetic signed *)
+[ 10 .. 2147483647 .. 21 ] = [10]       |> check    "overflow int contrary"
+[ 10 .. 2147483647 .. 0  ] = []         |> check    "overflow int //"
+
+(* Bug: wrapped arithmetic signed, valid inputs, x0<x1 and dx>0, but termination is incorrect *)
+[ System.Int32.MaxValue-3 .. 2 .. System.Int32.MaxValue ] = [System.Int32.MaxValue-3;System.Int32.MaxValue-1]   |> check "overflow miss endpoint"
+
+(* Bug: floating point inconstencies *)
+(* Bug: sequence not invariant under scaling *)
+(* Bug: sequence include/exclude end point when known "exact number of steps" depending on rounding error *)
+[| 0.0 .. 0.1      .. 10.0 |].Length = 101              |> check    "float exact range 101"
+[| 0.0 .. 0.01     .. 1.0  |].Length = 101              |> check    "float exact range 101 v2"
+[| 0.0 .. 0.001    .. 1.0  |].Length = 1001             |> check    "float exact range 1001"
+[| 0.0 .. 0.0001   .. 1.0  |].Length = 10001            |> check    "float exact range 10001"
+[| 0.0 .. 0.00001  .. 1.0  |].Length = 100001           |> check    "float exact range 100001"
+
+(* Float degenerate cases *)
+[ -infinity .. 1.1 .. infinity ] = [-infinity]          |> check    "-inf .. 1.1 .. inf"
+[ -infinity .. infinity .. 2.0]  = [-infinity]          |> check    "-inf .. inf .. _"
+
+
+fails (fun () -> [nan .. 1.1 .. 2.2])                   |> check    "nan .. x .. y"
+fails (fun () -> [0.0 .. nan .. 2.2])                   |> check    "x .. nan .. y"
+fails (fun () -> [0.0 .. 1.1 .. nan])                   |> check    "x .. y .. nan"
+
+
+module M = 
+    #if Portable
+    let printfn s = printfn "%s" s
+    #endif
+    do printfn "hello"
+
+module M2 = begin 
+    System.DateTime.Now
+end
+
+
+module MoreSequenceSyntaxTests = 
+    let x0i1 = seq { yield 1
+                     yield 2 }  
+    let x0i2 = seq { yield 1;
+                     yield 2 }  
+    let x0i3 = seq { yield 1
+                     yield 2; }  
+    let x0i4 = seq { yield 1;
+                     yield 2; }  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let x0i5 = seq { yield 1;
+                       yield 2; }  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let x0i6 = seq { yield 1;
+                    yield 2; }  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let x0i7 = seq { yield 1;
+                  yield 2; }  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let x0i8 = seq { yield 1;
+               yield 2; }  
+
+    let y0i1 =     [ yield 1
+                     yield 2 ]  
+    let y0i2 =     [ yield 1;
+                     yield 2 ]  
+    let y0i3 =     [ yield 1
+                     yield 2; ]  
+    let y0i4 =     [ yield 1;
+                     yield 2; ]  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let y0i5 =     [ yield 1;
+                       yield 2; ]  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let y0i6 =     [ yield 1;
+                    yield 2; ]  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let y0i7 =     [ yield 1;
+                  yield 2; ]  
+
+    // Note this is currently accepted but may be restricted at a later date.
+    let y0i8 =     [ yield 1;
+               yield 2; ]  
+
+                
+    module SeqTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a0 : seq<int> = seq { do printfn "ello hello" }  
+        let x0a0a = do ()
+        let x0a0b = do ()
+
+        let counter = ref 0
+
+        let doTest id (e:System.Collections.Generic.IEnumerable<_>) =
+            counter := 0
+            e.GetEnumerator().Dispose()
+            test id (!counter  = 0)
+            let en = e.GetEnumerator()
+            en.MoveNext() |> ignore
+            en.Dispose()
+            test id (!counter = 1)
+
+        let x0a1 =
+            seq { use e = { new System.IDisposable with member x.Dispose() = counter := !counter + 1 } 
+                  for i in 0 .. 3 do
+                      if true  then
+                          do printfn "hello"
+                      yield i*2 }
+        do doTest "x0a1" x0a1
+        let x0a2 =
+            seq { use e = { new System.IDisposable with member x.Dispose() = counter := !counter + 1 } 
+                  for i in 0 .. 3 do
+                      if true  then
+                          printfn "hello"
+                      yield i*2 }
+        do doTest "x0a2" x0a2
+        let x0a3 =
+            seq { use e = { new System.IDisposable with member x.Dispose() = counter := !counter + 1 } 
+                  for i in 0 .. 3 do
+                      if true  then
+                          printfn "hello"
+                          printfn "hello"
+                          printfn "hello"
+                          yield i*2 
+                      else 
+                          yield i*2
+                          printfn "hello"
+                          do printfn "hello"
+                          printfn "hello"
+                      yield i*2 
+                      yield i*2 }
+        do doTest "x0a1" x0a3
+        let x0a = seq { yield 1 }  
+        let x0b = seq { for x in 1..2 -> 3 }  
+        let x0c = seq { for x in 1..2 do yield 3 }  
+        let x0c2 = seq { for x = 1 to 3 do yield 3 }  
+        let x0d = seq { while false do yield 3 }  
+        let x0e = seq { let x = 1
+                        yield 1 }  
+        let x0f = seq { let f x = x + 1 
+                        yield 1 }  
+        let x0g = seq { let rec f x = f x + 1 
+                        yield 1 }  
+        let x0h = seq { do printfn "hello"
+                        yield 1 }  
+        let x0i = seq { printfn "hello"
+                        yield 1 }  
+        let x0i1 = seq { yield 1
+                         yield 2 }  
+        let x0i2 = seq { printfn "hello"
+                         yield 1
+                         yield 2 }  
+        let x0i3 = seq { yield 1
+                         printfn "hello"
+                         yield 2 }  
+        let x0i4 = seq { yield 1
+                         printfn "hello" }  
+        let x0j = seq { use x = { new System.IDisposable with 
+                                      member x.Dispose() = counter := !counter + 1 } 
+                        yield 1 } 
+        do doTest "x0j" x0j
+        let x0k = seq { try 
+                            yield 1
+                        finally 
+                            printfn "hello" }  
+
+        let x0l = [ yield 1
+                    if true then 
+                        yield 1 ] 
+
+        let evens1 n =
+            seq { for x in 1 .. n do if x % 2 = 0 then yield x }
+
+        let evens2 n =
+            seq { for x in 1 .. n do
+                   if x % 2 = 0 then yield x }
+
+        let evens3 n =
+            seq { for x in 1 .. n do
+                   if x % 2 = 0  then 
+                     for y in 1 .. n do
+                       if y % 2 = 0 then yield (x,y) }
+
+    module AsyncTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a = async { return 1 }  
+        let x0c = async { for x in 1..2 do return () }  
+        let x0d = async { while false do return () }  
+        let x0e = async { let x = 1
+                          return 1 }  
+        let x0f = async { let f x = x + 1
+                          return 1 }  
+        let x0g = async { let rec f x = f x + 1
+                          return 1 }
+        let x0h = async { do printfn "hello"
+                          return 1 } 
+        let x0i = async { printfn "hello"
+                          return 1 } 
+        let x0i2 = async { printfn "hello"
+                           return () } 
+        let x0j = async { use x = { new System.IDisposable with 
+                                        member x.Dispose() = () } 
+                          return 1 } 
+        let x0k = async { try 
+                            return 1
+                          finally 
+                            printfn "hello" }  
+        let x0l = async { try 
+                            return 1
+                          with _ ->  
+                            return 2 }  
+        let x0m = async { printfn "hello" }
+
+        let f103 () = 
+            async { do! Async.SwitchToNewThread()
+                    do! Async.SwitchToNewThread() }
+
+
+    module AmbiguityTests1 = 
+        type r = { a : int; b : int }
+        let r1 = { a = 1; b = 2 } 
+        let r2 = { r1 with a = 3 } 
+
+    module AmbiguityTests2 = 
+        let x1 = [ ] 
+        let x2 = [ 1;2;3 ] 
+
+    module ExpressionTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        module M = 
+           do printfn "hello" 
+           let x = 1
+           
+        let f101 () = 
+            do printfn "hello" 
+
+        let f102 () = 
+            do printfn "hello" 
+            do printfn "hello" 
+            1+1
+
+        let f104 () = 
+            if 1>2 then 
+                do printfn "hello"
+            else
+                do printfn "world"
+
+
+module SyncMonad = 
+    type Sync<'a> = (unit -> 'a)
+    type SyncBuilder() = 
+        member b.Bind(x,f) = f (x())
+        member b.Using(x,f) = (fun () -> use r = x in f r ())
+        member b.TryFinally(x,f) = (fun () -> try x() finally f())
+        member b.TryWith(x,f) = (fun () -> try x() with e -> f e ())
+        member b.Combine(f1,g) = (fun () -> f1(); g()())
+        member b.Delay(f) = (fun () -> f()())
+        member b.Zero() = (fun () -> ())
+        member b.Return x = (fun () -> x)
+        member b.ReturnFrom x = x
+        member b.For(e,f) = (fun () -> for x in e do f x ())
+        member b.While(gd,x) = (fun () -> while gd() do x())
+
+    let sync = SyncBuilder()
+
+
+    module SyncTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a : Sync<int> = sync { return 1 }  
+        let x0c : Sync<unit>  = sync { for x in 1..2 do return () }  
+        let x0d  : Sync<unit> = sync { while false do return () }  
+        let x0e  : Sync<int> = 
+            sync { let x = 1
+                   return 1 }  
+        let x0f  : Sync<int> = 
+            sync { let f x = x + 1
+                   return 1 }  
+        let x0g : Sync<int> = 
+            sync { let rec f x = f x + 1
+                   return 1 }
+        let x0h  : Sync<int> = 
+            sync { do printfn "hello"
+                   return 1 } 
+        let x0i  : Sync<int> = 
+            sync { printfn "hello"
+                   return 1 } 
+        let x0i2  : Sync<unit> = 
+            sync { printfn "hello"
+                   return () } 
+        let x0i2b  : Sync<unit> = 
+            sync { if true then 
+                      return () } 
+        let x0j  : Sync<int> = 
+            sync { use x = { new System.IDisposable with 
+                                 member x.Dispose() = () } 
+                   return 1 } 
+        let x0k  : Sync<int> =
+            sync { try 
+                      return 1
+                   finally 
+                      printfn "hello" }  
+        let x0l : Sync<int> = 
+            sync { try 
+                       return 1
+                   with _ ->  
+                       return 2 }  
+        let x0m : Sync<unit> = 
+           sync { printfn "hello" }
+
+
+    type ThreadBuilder () = 
+        inherit SyncBuilder()
+        member x.Run(f) = async { do! Async.SwitchToNewThread()
+                                  return f() } |> Async.RunSynchronously
+            
+    let thread = new ThreadBuilder()
+    
+    module ThreadTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a : int = thread { return 1 }  
+        let x0c : unit  = thread { for x in 1..2 do return () }  
+        let x0d  : unit = thread { while false do return () }  
+        let x0e  : int = 
+            thread { let x = 1
+                     return 1 }  
+        let x0f  : int = 
+            thread { let f x = x + 1
+                     return 1 }  
+        let x0g : int = 
+            thread { let rec f x = f x + 1
+                     return 1 }
+        let x0h  : int = 
+            thread { do printfn "hello"
+                     return 1 } 
+        let x0i  : int = 
+            thread { printfn "hello"
+                     return 1 } 
+        let x0i2  : unit = 
+            thread { printfn "hello"
+                     return () } 
+        let x0i2b  : unit = 
+            thread { if true then 
+                      return () } 
+        let x0j  : int = 
+            thread { use x = { new System.IDisposable with 
+                                 member x.Dispose() = () } 
+                     return 1 } 
+        let x0k  : int =
+            thread { try 
+                      return 1
+                     finally 
+                      printfn "hello" }  
+        let x0l : int = 
+            thread { try 
+                       return 1
+                     with _ ->  
+                       return 2 }  
+        let x0m : unit = 
+           thread { printfn "hello" }
+   
+module ContMonad = 
+    type Cont<'a> = (('a -> unit) * (exn -> unit) -> unit)
+    type ContBuilder() = 
+        member b.Bind(x:Cont<'a1>,f: 'a -> Cont<'b>) : Cont<'b> = 
+            (fun (cont,econt) -> x ((fun xv -> f xv (cont,econt)), (fun exn -> econt exn)))
+        member b.Using(r: ('r :> System.IDisposable),f : ('r -> Cont<'b>)) : Cont<'b> = 
+            (fun (cont,econt) -> f r ((fun v -> r.Dispose(); cont v),(fun exn -> r.Dispose(); econt exn)))
+        member b.TryFinally(x:Cont<'a2>,f: (unit -> unit)) = 
+            (fun (cont,econt) -> x ((fun xv -> f(); cont xv),(fun exn -> f(); econt exn)))
+        member b.TryWith(x:Cont<'a3>,f: (exn -> Cont<'a3>)) : Cont<'a3> = 
+            (fun (cont,econt) -> x (cont,(fun exn -> f exn (cont,econt))))
+        member b.Combine(x:Cont<unit>,g:Cont<'a4>) : Cont<'a4> = 
+            (fun (cont,econt) -> x ((fun () -> g (cont,econt)),econt))
+        member b.Delay(f:unit->Cont<'a5>) : Cont<'a5> = 
+            (fun (cont,econt) -> f () (cont,econt))
+        member b.Zero()  : Cont<unit> = 
+            (fun (cont,econt) -> cont ())
+        member b.Yield(cell: Cont<unit> ref) : Cont<unit> = 
+            (fun (cont,econt) -> cell := (fun (_,_) -> cont()))
+        member b.Return x = 
+            (fun (cont,econt) -> cont x)
+        //member b.For(e,f) = 
+        //    (fun (cont,econt) -> cont x)        
+        //member b.While(gd,x) = (fun () -> while gd() do x())
+
+    let cont = ContBuilder()
+
+
+    module ContTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a : Cont<int> = cont { return 1 }  
+        let x0e  : Cont<int> = 
+            cont { let x = 1
+                   return 1 }  
+        let x0f  : Cont<int> = 
+            cont { let f x = x + 1
+                   return 1 }  
+        let x0g : Cont<int> = 
+            cont { let rec f x = f x + 1
+                   return 1 }
+        let x0h  : Cont<int> = 
+            cont { do printfn "hello"
+                   return 1 } 
+        let x0i  : Cont<int> = 
+            cont { printfn "hello"
+                   return 1 } 
+        let x0i2  : Cont<unit> = 
+            cont { printfn "hello"
+                   return () } 
+        let x0i2b  : Cont<unit> = 
+            cont { if true then 
+                      return () } 
+        let x0j  : Cont<int> = 
+            cont { use x = { new System.IDisposable with 
+                                 member x.Dispose() = () } 
+                   return 1 } 
+        let x0k  : Cont<int> =
+            cont { try 
+                      return 1
+                   finally 
+                      printfn "hello" }  
+        let x0l : Cont<int> = 
+            cont { try 
+                       return 1
+                   with _ ->  
+                       return 2 }  
+        let x0m : Cont<unit> = 
+           cont { printfn "hello" }
+
+
+    module ContDisposalTest0 = 
+
+        let finished = ref false
+        let disposed = ref false
+        let failure = ref false
+        let ccont = ref (cont { return () })
+        ccont := cont { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                        yield ccont 
+                        yield ccont }        
+
+        let move() = 
+            !ccont ((fun v -> finished := true),(fun exn -> failure := true))
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); !finished)
+        test "vojwe9u0rw2" (!disposed)
+
+
+    module ContDisposalTest1 = 
+
+        let finished = ref false
+        let disposed = ref false
+        let failure = ref false
+        let ccont = ref (cont { return () })
+        ccont := cont { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                        if 6 > 0 then 
+                          yield ccont
+                        else 
+                          yield ccont
+                        if 6 < 0 then 
+                          yield ccont
+                        else 
+                          yield ccont }        
+
+
+        let move() = 
+            !ccont ((fun v -> finished := true),(fun exn -> failure := true))
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); !finished)
+        test "vojwe9u0rw2" (!disposed)
+
+
+    module ContDisposalTest2 = 
+
+        let finished = ref false
+        let disposed = ref false
+        let failure = ref false
+        let ccont = ref (cont { return () })
+        ccont := cont { use! r = cont { return ( { new System.IDisposable with member x.Dispose() = disposed := true }) } 
+                        if 6 > 0 then 
+                          yield ccont
+                        else 
+                          yield ccont
+                        if 6 < 0 then 
+                          yield ccont
+                        else 
+                          yield ccont }        
+
+
+        let move() = 
+            !ccont ((fun v -> finished := true),(fun exn -> failure := true))
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); not !finished)
+        test "vojwe9u0rw2" (not !disposed)
+        test "vojwe9u0rw1" (move(); !finished)
+        test "vojwe9u0rw2" (!disposed)
+
+
+   
+module ExistsMonad = 
+    type Exists = (unit -> bool)
+    type ExistsBuilder() = 
+        member b.Bind(x:Exists,f) :Exists = (fun () -> x() || f()())
+        member b.Using(x,f) :Exists = (fun  () -> use r = x in f r ())
+        member b.TryFinally(x:Exists,f) = (fun () -> try x() finally f())
+        member b.TryWith(x:Exists,f) :Exists = (fun () -> try x() with e -> f e ())
+        member b.Combine(x:Exists,g) :Exists = (fun () -> x() || g())
+        member b.Delay(f:unit->Exists) : Exists = (fun () -> f()())
+        member b.Zero() :Exists = (fun () -> false)
+        member b.Yield(x:bool) :Exists = (fun () -> x)
+        member b.YieldFrom(x:bool list) :Exists = (fun () -> List.exists id x)
+        member b.For(e,f: 'a -> Exists) :Exists = (fun () -> Seq.exists (fun x -> f x ()) e)
+        member b.While(gd,x:Exists) = (fun () -> let rec loop() = if gd() then x() || loop() else false in loop())
+        member b.Run(x:Exists) : bool = x ()
+
+    let exists = ExistsBuilder()
+
+            
+    for x in 0..1000 do
+                if x % 100 = 0 then printfn "searching x = %d" x
+                for y in 0..x do
+                   let z = ref 3
+                   while !z < 10 do
+                      if (x + y + !z = 2009) then 
+                          #if Portable 
+                          printfn "%s" "found it"
+                          #else
+                          printfn "found it"
+                          #endif
+                      incr z 
+
+    exists { for x in 0..1000 do
+                if x % 100 = 0 then printfn "searching x = %d" x
+                for y in 0..x do
+                   let z = ref 3
+                   while !z < 10 do
+                      yield (x + y + !z = 2009)
+                      incr z }
+
+                      
+    module ExistsTests = 
+        #if Portable
+        let printfn s = printfn "%s" s
+        #endif
+
+        let x0a : bool = exists.Run (exists.Delay(fun () -> exists.Yield(true)))
+        let x0b : bool = exists { yield true }  
+        let x0c : bool = exists { for x in 1..2 do yield true }  
+        let x0d  : bool = exists { while false do yield true }  
+        let x0e  : bool = 
+            exists { let x = 1
+                     yield true }  
+        let x0f  : bool = 
+            exists { let f x = x + 1
+                     yield true }  
+        let x0f_many  : bool = 
+            exists { let f x = x + 1
+                     yield! [true;false] }  
+        let x0g : bool = 
+            exists { let rec f x = f x + 1
+                     yield true }
+        let x0h  : bool = 
+            exists { do printfn "hello"
+                     yield true } 
+        let x0i  : bool = 
+            exists { printfn "hello"
+                     yield true } 
+        let x0i2  : bool = 
+            exists { printfn "hello"
+                     yield true } 
+        let x0j  : bool = 
+            exists { use x = { new System.IDisposable with 
+                                 member x.Dispose() = () } 
+                     yield true } 
+        let x0k  : bool =
+            exists { try 
+                       yield true
+                     finally 
+                        printfn "hello" }  
+        let x0l : bool = 
+            exists { try 
+                       yield true
+                     with _ ->  
+                       yield false }  
+        let x0m : bool = 
+           exists { printfn "hello" }
+
+
+
+module DisposalTest0a = 
+
+    let disposed = ref false
+    let x = 
+       Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.EnumerateUsing 
+             { new System.IDisposable with member x.Dispose() = disposed := true } 
+             (fun r -> [1;2])
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest0 = 
+
+    let disposed = ref false
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  yield! [1;2] }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+
+module DisposalTest1 = 
+
+    let disposed = ref false
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  yield 1
+                  yield 2 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest2 = 
+
+    let disposed = ref false
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  for x in 0 .. 1 do 
+                    yield 1 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest3 = 
+
+    let disposed = ref false
+    let i = ref 0
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  while !i < 2 do 
+                    yield 1
+                    incr i }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+    
+module DisposalTest4 = 
+
+    let disposed = ref false
+    let i = ref 0
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  if !i > 0 then 
+                    yield 1
+                  else 
+                    yield 2 
+                  if !i < 0 then 
+                    yield 1
+                  else 
+                    yield 2 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest0b = 
+
+    let disposed = ref false
+    let x = seq { use r = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  yield! [1;2] }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+
+module DisposalTest1b = 
+
+    let disposed = ref false
+    let x = seq { let rec obj = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  use r = obj
+                  yield 1
+                  yield 2 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest2b = 
+
+    let disposed = ref false
+    let x = seq { let obj = { new System.IDisposable with member x.Dispose() = disposed := true } 
+                  use r = obj
+                  for x in 0 .. 1 do 
+                    yield 1 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module DisposalTest3b = 
+
+    let disposed = ref false
+    let i = ref 0
+    let x = seq { let f() = disposed := true
+                  use r = { new System.IDisposable with member x.Dispose() = f() } 
+                  while !i < 2 do 
+                    yield 1
+                    incr i }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+    
+module DisposalTest4b = 
+
+    let disposed = ref false
+    let i = ref 0
+    let x = seq { let rec f() = disposed := true
+                  use r = { new System.IDisposable with member x.Dispose() = f() } 
+                  if !i > 0 then 
+                    yield 1
+                  else 
+                    yield 2 
+                  if !i < 0 then 
+                    yield 1
+                  else 
+                    yield 2 }        
+
+    let e = x.GetEnumerator()
+    test "vojwe9u0rw1" (e.MoveNext())
+    test "vojwe9u0rw2" (not !disposed)
+    test "vojwe9u0rw3" (e.MoveNext())
+    test "vojwe9u0rw4" (not !disposed)
+    test "vojwe9u0rw5" (not (e.MoveNext()))
+    e.Dispose()
+    test "vojwe9u0rw6" !disposed
+
+module EnumPatternWithFunkyTypes_FSharp_1_0_13904 = 
+    [<Struct>]
+    type Struct =
+        val x:int
+        val y:int
+
+    type En<'a>(mvNext:'a) =
+        member x.Current = 1
+        member x.MoveNext() = mvNext
+
+    type T<'a>(mvNext:'a) =
+        member x.GetEnumerator() = En mvNext
+
+    // This is allowed - 'a is known to be "bool"
+    let s = seq { for i in T true -> i }
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/control/build.bat b/tests/fsharp/core/control/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/control/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/control/repeat.bat b/tests/fsharp/core/control/repeat.bat
new file mode 100644
index 0000000..f618075
--- /dev/null
+++ b/tests/fsharp/core/control/repeat.bat
@@ -0,0 +1,13 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+:REPEAT
+
+call %~d0%~p0..\..\single-test-run.bat
+
+if errorlevel 1 goto :ERROR
+
+goto :REPEAT
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/control/run.bat b/tests/fsharp/core/control/run.bat
new file mode 100644
index 0000000..ba4fe87
--- /dev/null
+++ b/tests/fsharp/core/control/run.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/control/test.fsx b/tests/fsharp/core/control/test.fsx
new file mode 100644
index 0000000..2386fcb
--- /dev/null
+++ b/tests/fsharp/core/control/test.fsx
@@ -0,0 +1,2065 @@
+// #Regression #Conformance #ComputationExpressions #Async #Regression #Events #Stress
+#if Portable
+module Core_control
+#endif
+#light
+
+#if NetCore
+open System.Threading.Tasks
+#endif
+
+#nowarn "40" // recursive references
+
+let biggerThanTrampoliningLimit = 10000
+
+let failuresFile =
+   let f = 
+        System.Environment.GetEnvironmentVariable("CONTROL_FAILURES_LOG")
+   match f with
+   | "" | null -> "failures.log"
+   | _ -> f
+
+let log msg = 
+  printfn "%s" msg
+  System.IO.File.AppendAllText(failuresFile, sprintf "%A: %s\r\n" System.DateTime.Now msg)
+
+let mutable failures = []
+let syncObj = new obj()
+let report_failure s = 
+  stderr.WriteLine " NO"; 
+  lock syncObj (fun () ->
+     failures <- s :: failures;
+     log (sprintf "FAILURE: %s failed" s)
+  )
+
+#if Portable
+#else
+System.AppDomain.CurrentDomain.UnhandledException.AddHandler(
+       fun _ (args:System.UnhandledExceptionEventArgs) ->
+          lock syncObj (fun () ->
+                let e = args.ExceptionObject :?> System.Exception
+                printfn "Exception: %s at %s" (e.ToString()) e.StackTrace
+                failures <- (args.ExceptionObject :?> System.Exception).ToString() :: failures
+             )
+)
+#endif
+
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s 
+
+let checkQuiet s x1 x2 = 
+    if x1 <> x2 then 
+        (test s false; 
+         log (sprintf "expected: %A, got %A" x2 x1))
+
+let check s x1 x2 = 
+    if x1 = x2 then test s true
+    else (test s false; log (sprintf "expected: %A, got %A" x2 x1))
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+open Microsoft.FSharp.Control
+open Microsoft.FSharp.Control.WebExtensions
+
+let boxed(a:Async<'b>) : Async<obj> = async { let! res = a in return box res }
+
+type Microsoft.FSharp.Control.Async with 
+        static member Parallel2 (a:Async<'T1>,b:Async<'T2>) =
+            async { let! res = Async.Parallel [boxed a; boxed b]
+                    return (unbox<'T1>(res.[0]), unbox<'T2>(res.[1])) }
+
+        static member Parallel3 (a:Async<'T1>,b:Async<'T2>,c:Async<'T3>) =
+            async { let! res = Async.Parallel [boxed a; boxed b; boxed c]
+                    return (unbox<'T1>(res.[0]), unbox<'T2>(res.[1]), unbox<'T3>(res.[2])) }
+
+        static member Generate (n,f, ?numChunks) : Async<'T array> =
+            async { let procs = defaultArg numChunks System.Environment.ProcessorCount
+                    let resArray = Array.zeroCreate n
+                    let! res = Async.Parallel
+                                  [ for pid in 0 .. procs-1 ->
+                                        async { for i in 0 .. (n/procs+(if n%procs > pid then 1 else 0)) - 1 do
+                                                    let elem = (i + pid * (n/procs) + min (n%procs) pid)
+                                                    let! res = f elem
+                                                    do resArray.[elem] <- res;  } ]
+                    return resArray }
+
+module BasicTests = 
+    check "cew23242g" (Async.RunSynchronously (async { do () })) ()
+    check "32o8f43k1" (Async.RunSynchronously (async { return () })) ()
+    check "32o8f43k2" (Async.RunSynchronously (async { return 1 })) 1
+
+    check "32o8f43k3" (Async.RunSynchronously (async { return 1 })) 1
+
+    check "32o8f43k9" (Async.RunSynchronously (async { do! Async.Sleep(30) 
+                                                       return 1 })) 1
+
+    check "32o8f43kq" (Async.RunSynchronously (async { let x = 1 in return x })) 1
+
+    check "32o8f43kw" (try Async.RunSynchronously (async {  let x = failwith "error" in return x+1 }) with _ -> 2) 2
+
+    check "32o8f43kr" (try Async.RunSynchronously (async {  let x = failwith "error" 
+                                                            return x+1 }) with _ -> 2) 2
+
+    //check "32o8f43kt" (Async.RunSynchronously (Async.Catch (async {  do failwith "error" }))) (Choice2Of2 (Failure "error"))
+    check "32o8f43kt" (Async.RunSynchronously (Async.Catch (async {  return 1 }))) (Choice1Of2 1)
+
+    check "32o8f43kt" (Async.RunSynchronously (async {  try 
+                                                            do failwith "error" 
+                                                            return 3
+                                                        with _ -> 
+                                                            return 2 
+                                                      })) 2
+
+    check "32o8f43kt" 
+        (Async.RunSynchronously
+             (async {  try 
+                          do failwith "error" 
+                          return 3
+                       with Failure _ -> 
+                          return 2 
+                    })) 
+        2
+
+    check "32o8f43kt" 
+        (Async.RunSynchronously
+            (async {  try 
+                         try 
+                            do failwith "error" 
+                            return 3
+                         with :? System.ArgumentNullException -> 
+                            return 4 
+                       with Failure _ -> 
+                          return 2 
+                    })) 
+        2
+
+    check "32o8f43kt" (let x = ref 0 
+                       Async.RunSynchronously 
+                           (async {  try 
+                                        return ()
+                                     finally 
+                                        x := 10
+                                  });
+                       !x) 10
+
+    check "32o8f43kt" (let x = ref 0 
+                       (try 
+                           Async.RunSynchronously 
+                               (async {  try 
+                                            do failwith ""
+                                         finally 
+                                            x := 10
+                                      })
+                        with Failure _ -> ());
+                       !x) 10
+
+
+    check "32o8f43kt" (let x = ref 0 
+                       (try 
+                           Async.RunSynchronously 
+                               (async {  try 
+                                           try 
+                                              do failwith ""
+                                           finally 
+                                              x := !x + 1
+                                         finally 
+                                            x := !x + 1
+                                      })
+                        with Failure _ -> ());
+                       !x) 2
+
+    check "32o8f43kt" (let x = ref 0 
+                       (try 
+                           Async.RunSynchronously 
+                               (async {  try 
+                                           try 
+                                              return ()
+                                           finally 
+                                              do failwith ""
+                                              x := !x + 1
+                                         finally 
+                                            x := !x + 1
+                                      })
+                        with Failure _ -> ());
+                       !x) 1
+
+    check "32o8f43ky" (try Async.RunSynchronously
+                             (async {  try 
+                                         try 
+                                           do failwith "error" 
+                                           return 3
+                                         with _ -> 
+                                           do failwith "error" 
+                                           return 4
+                                       with _ -> 
+                                         return 2 
+                                    }) with _ -> 6) 2
+
+    check "32o8f43ku" (try Async.RunSynchronously 
+                               (async {  let x = failwith "error" 
+                                         do! Async.Sleep(30) 
+                                         return x+1 }) with _ -> 2) 2
+
+    check "32o8f43ki" (let p = async {  let x = failwith "error" 
+                                        return x+1 } 
+                       try Async.RunSynchronously p with _ -> 2) 2
+                       
+                        
+    check "32o8f43ko" (Async.RunSynchronously
+                          (Async.Parallel [| async { let x = 10+10 in return x+x }; 
+                                             async { let y = 20+20 in return y+y } |])) [| 40; 80 |]
+      
+    check "46sdhksdjf" 
+        begin
+            for i in 1..1000 do
+                begin
+                    Async.TryCancelled (async { while true do do! Async.Sleep(10) }, fun _ -> failwith "fail!") |> Async.Start
+                    Async.CancelDefaultToken()
+                end
+            true                    
+        end
+        true
+
+
+
+module JoinTests = 
+    let Join (a1: Async<'a>) (a2: Async<'b>) = async {
+      let! task1 = a1 |> Async.StartChild
+      let! task2 = a2 |> Async.StartChild
+      
+      let! res1 = task1
+      let! res2 = task2 
+      return (res1,res2) }
+
+    let JoinNoFailTest() = 
+        check "cvew0-9rn1" 
+             (Async.RunSynchronously (Join (async { return 1 + 1 }) 
+                                           (async { return 2 + 2 } ))) 
+             (2,4)
+        check "cvew0-9rn2" 
+             (Async.RunSynchronously (Join (async { do! Async.Sleep(30) 
+                                                    return 1 + 1 }) 
+                                           (async { do! Async.Sleep(30) 
+                                                    return 2 + 2 } ))) 
+             (2,4)
+
+    let JoinFirstFailTest() = 
+        check "cvew0-9rn3" 
+             (try 
+                 Async.RunSynchronously (Join (async { do! Async.Sleep(30) 
+                                                       failwith "fail"
+                                                       return 3+3 }) 
+                                              (async { do! Async.Sleep(30) 
+                                                       return 2 + 2 } ))
+              with _ -> 
+                 (0,0))                                               
+             (0,0)
+
+    let JoinSecondFailTest() = 
+        check "cvew0-9rn4" 
+             (try 
+                 Async.RunSynchronously (Join (async { do! Async.Sleep(30) 
+                                                       return 3+3 }) 
+                                              (async { do! Async.Sleep(30) 
+                                                       failwith "fail"
+                                                       return 2 + 2 } ))
+              with _ -> 
+                 (0,0))                                               
+             (0,0)
+
+
+    let JoinBothFailTest() = 
+        check "cvew0-9rn5d" 
+             (try 
+                 Async.RunSynchronously (Join (async { do! Async.Sleep(30) 
+                                                       failwith "fail"
+                                                       return 3+3 }) 
+                                              (async { do! Async.Sleep(30) 
+                                                       failwith "fail"
+                                                       return 2 + 2 } ))
+              with _ -> 
+                 (0,0))                                               
+             (0,0)
+
+    JoinNoFailTest()
+    JoinFirstFailTest()
+    JoinSecondFailTest()
+    JoinBothFailTest()
+
+module StartChildWaitMultipleTimes =
+    let a = async {
+                let! a = Async.StartChild(
+                            async { 
+                                do! Async.Sleep(500) 
+                                return 27 
+                            })
+                let! result  = Async.Parallel [ a; a; a; a ]
+                return result
+            }
+    check "dfhdu34y734"
+        (a |> Async.RunSynchronously)
+        [| 27; 27; 27; 27 |]
+
+module StartChildTrampoliningCheck =
+    let a = async {
+                let! a = Async.StartChild(
+                            async { 
+                                do! Async.Sleep(500) 
+                                return 27 
+                            })
+                let! result = a
+                let x = ref result
+                for i in 1..biggerThanTrampoliningLimit do
+                    x := !x + 1
+                return !x
+            }
+    check "ft6we56sgfw"
+        (a |> Async.RunSynchronously)
+        (biggerThanTrampoliningLimit+27)
+
+
+module StartChildOutsideOfAsync =
+    open System.Threading
+
+    check "dshfukeryhu8we"
+        (let b = async {return 27} |> Async.StartChild
+        (b |> Async.RunSynchronously |> Async.RunSynchronously)
+        )
+        27
+
+    check "gf6dhasdfmkerio57: StartChild cancellation"
+        begin
+            use ev0 = new ManualResetEvent(false)
+            use ev = new ManualResetEvent(false)
+            let cts = new CancellationTokenSource()
+            let child = async {
+                            try
+                                ev0.Set() |> ignore
+                                while true do
+                                    ()
+                            finally 
+                                ev.Set() |> ignore
+                        } |> Async.StartChild
+            Async.RunSynchronously(child,cancellationToken=cts.Token) |> ignore
+            ev0.WaitOne() |> ignore// wait until cancellation handler is set
+            cts.Cancel()
+            ev.WaitOne(5000)
+        end
+        true
+   
+
+check "32o8f43kaI: Spawn" 
+    (let result = ref 0
+     Async.Start(async { do printfn "hello 1"
+                         do! Async.Sleep(30) 
+                         do result := 1 });
+     while !result = 0 do 
+         printf "."
+#if NetCore
+         Task.Delay(10).Wait()
+#else
+         System.Threading.Thread.Sleep(10)
+#endif
+     !result) 1
+
+
+module FromBeginEndTests = 
+    // FromBeginEnd 
+    let FromBeginEndTest() = 
+        for completeSynchronously in [true;false] do
+         for sleep in [0;50;100] do
+          for expectedResult in [300;600] do
+           for useCancelAction in [true;false] do
+            for argCount in [0;1;2;3] do
+                let name = sprintf "cvew0-9rn5a, completeSynchronously = %A, sleep = %A, expectedResult = %A,useCancelAction = %A, argCount = %A" completeSynchronously sleep expectedResult useCancelAction argCount
+                printfn "running %s" name
+                check 
+                     name
+                     (try 
+                         Async.RunSynchronously 
+                             (async { let completed = ref completeSynchronously
+                                      let result = ref 0
+                                      let ev = new System.Threading.ManualResetEvent(completeSynchronously)
+                                      let iar = 
+                                          { new System.IAsyncResult with
+                                                member x.IsCompleted = !completed
+                                                member x.CompletedSynchronously = completeSynchronously
+                                                member x.AsyncWaitHandle = ev :> System.Threading.WaitHandle
+                                                member x.AsyncState = null }
+                                      let savedCallback = ref (None : System.AsyncCallback option)
+                                      let complete(r) = 
+                                          result := r
+                                          if completeSynchronously then 
+                                              completed := true 
+                                              if (!savedCallback).IsNone then failwith "expected a callback (loc cwowen903)"
+                                              (!savedCallback).Value.Invoke iar
+                                          else 
+#if NetCore
+                                              Task.Run(fun _ -> 
+                                                   Task.Delay(sleep).Wait()
+#else
+                                              System.Threading.ThreadPool.QueueUserWorkItem(fun _ -> 
+                                                   System.Threading.Thread.Sleep sleep
+#endif
+                                                   completed := true 
+                                                   ev.Set() |> ignore
+                                                   if (!savedCallback).IsNone then failwith "expected a callback (loc cwowen903)"
+                                                   (!savedCallback).Value.Invoke iar) |> ignore
+                                      let beginAction0(callback:System.AsyncCallback,state) = 
+                                          savedCallback := Some callback
+                                          complete(expectedResult)
+                                          iar
+                                      let beginAction1(x:int,callback:System.AsyncCallback,state) = 
+                                          savedCallback := Some callback
+                                          complete(expectedResult+x)
+                                          iar
+                                      let beginAction2(x1:int,x2:int,callback:System.AsyncCallback,state) = 
+                                          savedCallback := Some callback
+                                          complete(expectedResult+x1+x2)
+                                          iar
+                                      let beginAction3(x1:int,x2:int,x3:int,callback:System.AsyncCallback,state) = 
+                                          savedCallback := Some callback
+                                          complete(expectedResult+x1+x2+x3)
+                                          iar
+                                      let endAction(iar:System.IAsyncResult) = !result
+                                      let cancelAction = 
+                                          if useCancelAction then 
+                                              Some(fun () ->  complete(expectedResult))
+                                          else
+                                              None
+                                          
+                                      let! res = 
+                                         match argCount with 
+                                         | 0 -> Async.FromBeginEnd(beginAction0,endAction,?cancelAction=cancelAction)
+                                         | 1 -> Async.FromBeginEnd(0,beginAction1,endAction,?cancelAction=cancelAction)
+                                         | 2 -> Async.FromBeginEnd(7,-7,beginAction2,endAction,?cancelAction=cancelAction)
+                                         | 3 -> Async.FromBeginEnd(7,-3,-4,beginAction3,endAction,?cancelAction=cancelAction)
+                                         | _ -> failwith "bad argCount"
+                                      return res })
+                      with _ -> 
+                         4)                                               
+                     expectedResult
+
+    FromBeginEndTest()
+
+module Bug6078 =
+    open System
+    
+    let Test() =
+        let beginAction, endAction, _ =  Async.AsBeginEnd(fun () -> Async.Sleep(500))
+        let sleepingAsync = Async.FromBeginEnd((fun (a,b) -> beginAction((),a,b)),endAction)
+        let throwingAsync = async { raise <| new InvalidOperationException("foo") }
+        
+        for i in 1..100 do
+            check "5678w6r78w" 
+                begin
+                    try
+                        [   for j in 1..i do yield sleepingAsync; 
+                            yield throwingAsync;
+                            for j in i..1000 do yield sleepingAsync; ] |> Async.Parallel |> Async.RunSynchronously |> ignore
+                        "weird"
+                    with
+                    |    :? InvalidOperationException as e -> e.Message
+                end
+                "foo"
+    Test()
+
+module AwaitEventTests = 
+    let AwaitEventTest() = 
+        // AwaitEvent
+        for completeSynchronously in [ (* true; *) false] do
+         for sleep in [0;50;100] do
+          for expectedResult in [300;600] do
+           for useCancelAction in [true;false] do
+                let name = sprintf "cvew0-9rn5b, completeSynchronously = %A, sleep = %A, expectedResult = %A,useCancelAction = %A" completeSynchronously sleep expectedResult useCancelAction 
+                printfn "running %s" name
+                
+                check 
+                     name
+                     (try 
+                         Async.RunSynchronously 
+                             (async { let ev = new Event<_>()
+                                      let over = ref false
+                                      let complete(r) = 
+                                          if completeSynchronously then 
+                                              ev.Trigger(r)
+                                          else 
+#if NetCore
+                                              Task.Run(fun _ -> 
+                                                   Task.Delay(sleep).Wait()
+#else
+                                              System.Threading.ThreadPool.QueueUserWorkItem(fun _ -> 
+                                                   System.Threading.Thread.Sleep sleep
+#endif
+                                                   ev.Trigger(r)) |> ignore
+                                      
+                                      let cancelAction = 
+                                          if useCancelAction then 
+                                              Some(fun () ->  ev.Trigger(expectedResult))
+                                          else
+                                              None
+                                      // The completion must come after the event is triggerd
+                                      let! child = 
+                                           async { do! Async.Sleep 200;  // THIS TIME MUST BE LONG ENOUGH FOR THE EVENT HANDLER TO WIRE UP
+                                                   complete(expectedResult)   }
+                                           |> Async.StartChild
+                                      let! res = Async.AwaitEvent(ev.Publish)
+                                      for i in 1..biggerThanTrampoliningLimit do ()
+                                      over := true 
+                                      return res })
+                      with e -> 
+                         printfn "ERROR: %A" e
+                         4)                                               
+                     expectedResult
+
+
+    AwaitEventTest()
+
+
+module AsBeginEndTests = 
+
+    type AsyncRequest<'T>(p:Async<'T>) = 
+        
+        let beginAction,endAction,cancelAction = Async.AsBeginEnd (fun () -> p)
+        member this.BeginAsync(callback,state:obj) = 
+            beginAction((),callback,state)
+
+        member this.EndAsync(iar: System.IAsyncResult)  = endAction(iar)
+
+        member this.CancelAsync(iar)           = cancelAction(iar)
+        
+    type AsyncRequest1<'T>(p:int -> Async<'T>) = 
+        
+        let beginAction,endAction,cancelAction = Async.AsBeginEnd p
+        member this.BeginAsync(arg1,callback,state:obj) = 
+            beginAction(arg1,callback,state)
+
+        member this.EndAsync(iar)  = endAction(iar)
+
+        member this.CancelAsync(iar)           = cancelAction(iar)
+
+    type AsyncRequest2<'T>(p:int -> string -> Async<'T>) = 
+        
+        let beginAction,endAction,cancelAction = Async.AsBeginEnd (fun (arg1,arg2) -> p arg1 arg2)
+        member this.BeginAsync(arg1,arg2,callback,state:obj) = beginAction((arg1,arg2),callback,state)
+
+        member this.EndAsync(iar)  = endAction(iar)
+
+        member this.CancelAsync(iar)           = cancelAction(iar)
+
+    type AsyncRequest3<'T>(p:int -> string -> int -> Async<'T>) = 
+        
+        let beginAction,endAction,cancelAction = Async.AsBeginEnd (fun (arg1,arg2,arg3) -> p arg1 arg2 arg3)
+        member this.BeginAsync(arg1,arg2,arg3,callback,state:obj) = 
+            beginAction((arg1,arg2,arg3),callback,state)
+
+        member this.EndAsync(iar: System.IAsyncResult)  = 
+            endAction(iar)
+
+        member this.CancelAsync(iar)           = cancelAction(iar)
+
+
+
+
+    let AsBeginEndTest() = 
+        check
+           (sprintf "cvew0-9rn1")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,null)
+            iar.CompletedSynchronously)
+           true
+
+
+        check
+           (sprintf "cvew0-9rn2")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,null)
+            iar.IsCompleted)
+           true
+
+        check
+           (sprintf "cvew0-9rn2-state")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,box 1)
+            iar.AsyncState |> unbox<int>)
+           1
+
+        check
+           (sprintf "cvew0-9rn3")
+           (let req = AsyncRequest( async { do! Async.Sleep 100 } ) 
+            let iar = req.BeginAsync(null,null)
+            iar.IsCompleted)
+           false
+
+        check
+           (sprintf "cvew0-9rn3-state")
+           (let req = AsyncRequest( async { do! Async.Sleep 100 } ) 
+            let iar = req.BeginAsync(null,box 1)
+            iar.AsyncState |> unbox<int>)
+           1
+
+        check
+           (sprintf "cvew0-9rn4")
+           (let req = AsyncRequest( async { do! Async.Sleep 100 } ) 
+            let iar = req.BeginAsync(null,null)
+            iar.CompletedSynchronously)
+           false
+
+        check
+           (sprintf "cvew0-9rn5c")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,null)
+            req.EndAsync(iar))
+           2087
+
+        check
+           (sprintf "cvew0-9rn5c-1")
+           (let req = AsyncRequest1( fun i -> async { return i } ) 
+            let iar = req.BeginAsync(2087, null,null)
+            req.EndAsync(iar))
+           2087
+
+        check
+           (sprintf "cvew0-9rn5c-1-state")
+           (let req = AsyncRequest1( fun i -> async { return i } ) 
+            let iar = req.BeginAsync(2087, null,box 1)
+            iar.AsyncState |> unbox<int>)
+           1
+
+        check
+           (sprintf "cvew0-9rn5c-2")
+           (let req = AsyncRequest2( fun i j -> async { return i + int j } ) 
+            let iar = req.BeginAsync(2087, "1", null,null)
+            req.EndAsync(iar))
+           2088
+
+
+        check
+           (sprintf "cvew0-9rn5c-2-state")
+           (let req = AsyncRequest2( fun i j -> async { return i + int j } ) 
+            let iar = req.BeginAsync(2087, "1", null,box 10)
+            iar.AsyncState |> unbox<int>)
+           10
+
+        check
+           (sprintf "cvew0-9rn5c-3")
+           (let req = AsyncRequest3( fun i j k -> async { return i + int j + k} ) 
+            let iar = req.BeginAsync(2087, "1", 2, null,null)
+            req.EndAsync(iar))
+           2090
+
+
+        check
+           (sprintf "cvew0-9rn5c-3-state")
+           (let req = AsyncRequest3( fun i j k -> async { return i + int j + k} ) 
+            let iar = req.BeginAsync(2087, "1", 17, null,box "10")
+            iar.AsyncState |> unbox<string>)
+           "10"
+
+        check
+           (sprintf "cvew0-9rn6")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,null)
+            req.EndAsync(iar) |> ignore
+            try req.EndAsync(iar) with :? System.ObjectDisposedException -> 100)
+           100
+
+        check
+           (sprintf "cvew0-9rn7")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let iar = req.BeginAsync(null,null)
+            iar.AsyncWaitHandle.WaitOne(100,true) |> ignore
+            req.EndAsync(iar))
+           2087
+
+        check
+           (sprintf "cvew0-9rn8")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let called = ref 0
+            let iar = req.BeginAsync(System.AsyncCallback(fun _ -> called := 10),null)
+            iar.AsyncWaitHandle.WaitOne(100,true) |> ignore
+            let v = req.EndAsync(iar)
+            v + !called)
+           2097
+
+        check
+           (sprintf "cvew0-9rn9")
+           (let req = AsyncRequest( async { return 2087 } ) 
+            let called = ref 0
+            let iar = req.BeginAsync(System.AsyncCallback(fun iar -> called := req.EndAsync(iar)),null)
+            while not iar.IsCompleted do
+                 iar.AsyncWaitHandle.WaitOne(100,true) |> ignore
+            
+            !called)
+           2087
+
+
+
+        check
+           (sprintf "cvew0-9rnA")
+           (let req = AsyncRequest( async { do! Async.SwitchToNewThread()
+                                            while true do 
+                                                do! Async.Sleep 10 
+                                            return 10 } ) 
+            let iar = req.BeginAsync(null,null)
+            printfn "waiting"
+            iar.AsyncWaitHandle.WaitOne(100,true) |> ignore
+            printfn "cancelling"
+            req.CancelAsync(iar)
+            (try req.EndAsync(iar) with :? System.OperationCanceledException as e -> 100 ))
+           100
+
+    AsBeginEndTest()
+
+(*
+
+check "32o8f43kaO: Cancel a While loop" 
+    (let count = ref 0
+     let res = ref 0
+     let asyncGroup = new new System.Threading.CancellationTokenSource()
+     Async.Spawn(async { do! async { use! holder = Async.OnCancel (fun msg -> printfn "got cancellation...."; incr res) 
+                                     while true do
+                                         do! Async.Sleep(10) 
+                                         do printfn "in loop..."
+                                         do count := !count + 1 
+                                     do printfn "exited loop..." } 
+                         do printfn "exited use!..." },
+                 asyncGroup=asyncGroup);
+     while !count = 0 do 
+         do printfn "waiting to enter loop..."
+         Async.Sleep(10)
+     
+     asyncGroup.TriggerCancel "cancel"
+     while !res= 0 do 
+         do printfn "32o8f43kaP: waiting to for cancellation...."
+         Async.Sleep(10)
+     !res) 1
+
+
+check "32o8f43ka2: Cancel a For loop" 
+    (let count = ref 0
+     let res = ref 0
+     let asyncGroup = new new System.Threading.CancellationTokenSource()
+     Async.Spawn(async { do! async { use! holder = Async.OnCancel (fun msg -> printfn "got cancellation...."; incr res) 
+                                     for x in Seq.initInfinite (fun i -> i) do
+                                         do! Async.Sleep(10) 
+                                         do printfn "in loop..."
+                                         do count := !count + 1 
+                                     do printfn "exited loop without cancellation!" }
+                         do printfn "exited use without cancellation!" },
+                 asyncGroup=asyncGroup);
+     while !count = 0 do 
+         do printfn "waiting to enter loop..."
+         Async.Sleep(10)
+     
+     asyncGroup.TriggerCancel "cancel"
+     while !res= 0 do 
+         do printfn "32o8f43ka2: waiting to for cancellation...."
+         Async.Sleep(10)
+     !res) 1
+*)
+
+module OnCancelTests = 
+    check "32o8f43ka1: No cancellation" 
+        (let count = ref 0
+         let res = ref 0
+         let asyncGroup = new System.Threading.CancellationTokenSource ()
+         Async.Start(async { use! holder = Async.OnCancel (fun msg -> printfn "got cancellation...."; incr res) 
+                             do incr count
+                             return () }, asyncGroup.Token);
+         while !count = 0 do 
+             do printfn "waiting to enter cancellation section"
+#if NetCore
+             Task.Delay(10).Wait()
+#else
+             System.Threading.Thread.Sleep(10)
+#endif
+        
+         !res) 0
+
+
+#if Portable
+#else
+module SyncContextReturnTests = 
+
+    let p() = printfn "running on %A" System.Threading.SynchronizationContext.Current
+
+    let run p = Async.RunSynchronously p
+
+
+    let rec fakeCtxt = { new System.Threading.SynchronizationContext() with 
+                             member x.Post(work,state) = 
+                                 //printfn "Posting..."
+
+
+                                 System.Threading.ThreadPool.QueueUserWorkItem(System.Threading.WaitCallback(fun _ -> 
+                                     //printfn "Setting..."
+                                     System.Threading.SynchronizationContext.SetSynchronizationContext fakeCtxt
+                                     work.Invoke(state))) |> ignore }
+
+    let checkOn s expectedCtxt = 
+        check s System.Threading.SynchronizationContext.Current expectedCtxt
+
+    let setFakeContext() = 
+        async { do! Async.SwitchToNewThread()
+                let ctxt = System.Threading.SynchronizationContext.Current 
+                System.Threading.SynchronizationContext.SetSynchronizationContext fakeCtxt
+                return { new System.IDisposable with 
+                             member x.Dispose() = 
+                                 printfn "Disposing..."
+                                 // Set the synchronization context back to its original value
+                                 System.Threading.SynchronizationContext.SetSynchronizationContext ctxt }  }
+            
+    // CHeck that Async.Sleep returns to the sync context
+    async { use! holder = setFakeContext()
+            p()
+            checkOn "evrher921" fakeCtxt
+            p()
+            do! Async.Sleep 100
+            p()
+            checkOn "evrher962" fakeCtxt }
+       |> run
+
+    // CHeck that Async.AwaitWaitHandle returns to the sync context
+    async { use! holder = setFakeContext()
+            checkOn "evrher923" fakeCtxt
+            p()
+            let wh = new System.Threading.ManualResetEvent(true)
+            p()
+            let! ok = Async.AwaitWaitHandle(wh,0)
+            p()
+            checkOn "evrher964" fakeCtxt }
+       |> run
+
+    // CHeck that Async.AwaitWaitHandle returns to the sync context
+    async { use! holder = setFakeContext()
+            checkOn "evrher925" fakeCtxt
+            p()
+            let wh = new System.Threading.ManualResetEvent(true)
+            p()
+            let! ok = Async.AwaitWaitHandle(wh,-1)
+            p()
+            checkOn "evrher966" fakeCtxt }
+       |> run
+
+    // CHeck that Async.AwaitWaitHandle returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [-1; 0; 100] do
+                checkOn "evrher927" fakeCtxt
+                p()
+                let wh = new System.Threading.ManualResetEvent(true)
+                p()
+                let! ok = Async.AwaitWaitHandle(wh,timeout)
+                p()
+                checkOn "evrher968" fakeCtxt }
+       |> run
+
+    // CHeck that Async.AwaitWaitHandle returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [100] do
+                checkOn "evrher927" fakeCtxt
+                p()
+                let wh = new System.Threading.ManualResetEvent(false)
+                p()
+                // this will timeout
+                let! ok = Async.AwaitWaitHandle(wh,timeout)
+                p()
+                checkOn "evrher968" fakeCtxt }
+       |> run
+
+
+    // CHeck that Async.AwaitWaitHandle returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [1;10] do
+                checkOn "evrher929" fakeCtxt
+                let wh = new System.Threading.ManualResetEvent(false)
+                let! ok = Async.AwaitWaitHandle(wh,timeout)
+                checkOn "evrher96Q" fakeCtxt }
+       |> run
+
+    // CHeck that Async.AwaitEvent returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [1;10] do
+                checkOn "evrher92W" fakeCtxt
+                let ev = new Event<int>()
+                // Trigger the event in 400ms
+                async { do! Async.Sleep 400
+                        ev.Trigger 10 } |> Async.Start
+
+                let! args = Async.AwaitEvent(ev.Publish)
+                checkOn "evrher96E" fakeCtxt }
+       |> run
+
+
+    // CHeck that Async.FromBeginEnd returns to the sync context
+    async { use! holder = setFakeContext()
+            for completeSynchronously in [true;false] do
+             for sleep in [0;50;100] do
+              for expectedResult in [300;600] do
+               for useCancelAction in [true;false] do
+                for argCount in [0;1;2;3] do
+                    let name = sprintf "vwwegbwerben5a, completeSynchronously = %A, sleep = %A, expectedResult = %A,useCancelAction = %A, argCount = %A" completeSynchronously sleep expectedResult useCancelAction argCount
+                    printfn "running %s" name
+                    
+                    // THIS IS ONE CHECK
+                    checkOn name fakeCtxt
+                    
+                    let completed = ref completeSynchronously
+                    let result = ref 0
+                    let ev = new System.Threading.ManualResetEvent(completeSynchronously)
+                    let iar = 
+                        { new System.IAsyncResult with
+                              member x.IsCompleted = !completed
+                              member x.CompletedSynchronously = completeSynchronously
+                              member x.AsyncWaitHandle = ev :> System.Threading.WaitHandle
+                              member x.AsyncState = null }
+                    let savedCallback = ref (None : System.AsyncCallback option)
+                    let complete(r) = 
+                        result := r
+                        if completeSynchronously then 
+                            completed := true 
+                            if (!savedCallback).IsNone then failwith "expected a callback (loc cwowen903)"
+                            (!savedCallback).Value.Invoke iar
+                        else 
+                            System.Threading.ThreadPool.QueueUserWorkItem(fun _ -> 
+                                 System.Threading.Thread.Sleep sleep
+                                 completed := true 
+                                 ev.Set() |> ignore
+                                 if (!savedCallback).IsNone then failwith "expected a callback (loc cwowen903)"
+                                 (!savedCallback).Value.Invoke iar) |> ignore
+                    let beginAction0(callback:System.AsyncCallback,state) = 
+                        savedCallback := Some callback
+                        complete(expectedResult)
+                        iar
+                    let beginAction1(x:int,callback:System.AsyncCallback,state) = 
+                        savedCallback := Some callback
+                        complete(expectedResult+x)
+                        iar
+                    let beginAction2(x1:int,x2:int,callback:System.AsyncCallback,state) = 
+                        savedCallback := Some callback
+                        complete(expectedResult+x1+x2)
+                        iar
+                    let beginAction3(x1:int,x2:int,x3:int,callback:System.AsyncCallback,state) = 
+                        savedCallback := Some callback
+                        complete(expectedResult+x1+x2+x3)
+                        iar
+                    let endAction(iar:System.IAsyncResult) = !result
+                    let cancelAction = 
+                        if useCancelAction then 
+                            Some(fun () ->  complete(expectedResult))
+                        else
+                            None
+
+                    // THIS IS ONE CHECK
+                    checkOn name fakeCtxt
+                    
+                        
+                    let! res = 
+                       match argCount with 
+                       | 0 -> Async.FromBeginEnd(beginAction0,endAction,?cancelAction=cancelAction)
+                       | 1 -> Async.FromBeginEnd(0,beginAction1,endAction,?cancelAction=cancelAction)
+                       | 2 -> Async.FromBeginEnd(7,-7,beginAction2,endAction,?cancelAction=cancelAction)
+                       | 3 -> Async.FromBeginEnd(7,-3,-4,beginAction3,endAction,?cancelAction=cancelAction)
+                       | _ -> failwith "bad argCount"
+
+                    // THIS IS ONE CHECK
+                    checkOn name fakeCtxt }
+       |> run
+
+    // CHeck that Async.Parallel returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [1;10] do
+                checkOn "evrher92R" fakeCtxt
+                let ev = new Event<int>()
+
+                let! args = Async.Parallel [ for i in 0 .. 10 -> async { return i * 2 } ]
+                checkOn "evrher96T" fakeCtxt }
+       |> run
+
+
+    // CHeck that Async.Parallel returns to the sync context
+    async { use! holder = setFakeContext()
+            for timeout in [1;10] do
+                checkOn "evrher92R" fakeCtxt
+                let ev = new Event<int>()
+
+                try 
+                   let! args = Async.Parallel [ for i in 0 .. 10 -> async { failwith "" } ]
+                   checkOn "evrher96T" fakeCtxt
+                   return ()
+                with _ -> 
+                   checkOn "evrher96T" fakeCtxt }
+       |> run
+#endif
+
+module GenerateTests = 
+    for n = 0 to 20 do
+        check (sprintf "32o8f43ka2: Async.Generate, n = %d" n)
+            (Async.RunSynchronously (Async.Generate(n, (fun i -> async { return i })))) [| 0..n-1 |]
+        
+    for n = 0 to 20 do
+        check (sprintf "32o8f43ka3: Async.Generate w/- Sleep, n = %d" n) 
+            (Async.RunSynchronously (Async.Generate(n, (fun i -> async { do! Async.Sleep(1) 
+                                                                         return i })))) [| 0..n-1 |]
+
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43ka4: Async.Generate w/- last failure, n = %d" n)
+            (try Async.RunSynchronously (Async.Generate(n, (fun i -> async { if i=n-1 then return failwith "last failure" else return i }))) 
+             with Failure "last failure" -> [| 0xdeadbeef |])
+            [| 0xdeadbeef |]
+
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43ka5: Async.Generate w/- all failure, n = %d" n)
+            (try Async.RunSynchronously (Async.Generate(n, (fun i -> async { return failwith "failure" }))) 
+             with Failure "failure" -> [| 0xdeadbeef |])
+            [| 0xdeadbeef |]
+
+module ParallelTests = 
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43ka6: Async.Parallel w/- last failure, n = %d" n)
+            (try Async.RunSynchronously (Async.Parallel [ for i in 0 .. n-1 -> async { if i=n-1 then return failwith "last failure" else return i }]) 
+             with Failure "last failure" -> [| 0xdeadbeef |])
+            [| 0xdeadbeef |]
+
+
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43ka7: Async.Parallel w/- last failure and Sleep, n = %d" n)
+            (try Async.RunSynchronously (Async.Parallel [ for i in 0 .. n-1 -> async { do! Async.Sleep(1) 
+                                                                                       if i=n-1 then return failwith "last failure" else return i }]) 
+             with Failure "last failure" -> [| 0xdeadbeef |])
+            [| 0xdeadbeef |]
+
+    // This test checks that sub-processes are successfully cancelled
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43ka8: Async.Parallel w/- last failure and force cancellation, n = %d" n)
+            (try Async.RunSynchronously 
+                     (Async.Parallel 
+                         [ for i in 0 .. n-1 -> 
+                            async { // The last process is the one that causes the failure. 
+                                    do! Async.Sleep(1) 
+                                    if i=n-1 then 
+                                      return failwith "last failure" 
+                                    else 
+                                      // All the other processes just loop until they are cancelled
+                                      // Note - this doesn't return - it must be cancelled
+                                      while true do 
+                                        do! Async.Sleep(1) 
+                                      return 1 }]) 
+             with Failure "last failure" -> [| 0xabbaabba |])
+            // the expected result
+            [| 0xabbaabba |]
+
+    // This test checks that sub-processes are successfully cancelled, AND that we wait for all processes
+    // to be cancelled and finish before we return the overall result
+    for n = 2 to 20 do
+        check 
+            (sprintf "32o8f43ka9: Async.Parallel w/- last failure and cancellation with check that cleanup occurs, n = %d" n)
+            (let cleanedUp = ref false
+             try Async.RunSynchronously 
+                    (Async.Parallel 
+                        [ for i in 0 .. n-1 -> 
+                            async { // The last process is the one that causes the failure. It waits 50ms to allow
+                                    // at least one of the other processes to commence and enter its "use" region
+                                    if i=n-1 then 
+                                         do! Async.Sleep(50) 
+                                         return failwith "last failure" 
+                                    else
+                                        // All the other processes just loop until they are cancelled
+                                        // They record the fact that they were cancelled in a try/finally
+                                        // compensation handler (via a 'use'). 
+                                        //
+                                        use r = { new System.IDisposable with 
+                                                    member x.Dispose() = 
+                                                       // This gets run when the cancel happens
+                                                       // Sleep a bit to check we wait for the sleep after the cancel
+#if NetCore
+                                                       Task.Delay(10).Wait()
+#else
+                                                       System.Threading.Thread.Sleep(10)
+#endif
+                                                       cleanedUp := true } 
+                                        // Note - this doesn't return - it must be cancelled
+                                        while true do 
+                                            do! Async.Sleep(1) 
+                                        return 1 }]) 
+             with Failure "last failure" -> [| (if !cleanedUp then 0xabbaabba else 0xdeaddead) |])
+            // the expected result
+            [| 0xabbaabba |]
+
+    for n = 1 to 20 do
+        check 
+            (sprintf "32o8f43kaQ: Async.Parallel w/- all failure, n = %d" n)
+            (try Async.RunSynchronously (Async.Parallel [ for i in 0 .. n-1 -> async { return failwith "failure" }]) 
+             with Failure "failure" -> [| 0xdeadbeef |])
+            [| 0xdeadbeef |]
+            
+    for n = 0 to 20 do
+        check (sprintf "32o8f43kaW: Async.Parallel, n = %d" n) 
+            (Async.RunSynchronously (Async.Parallel( [ for i in 0 .. n-1 -> async { return i } ]))) [| 0..n-1 |]
+        
+    for n = 0 to 20 do
+        check (sprintf "32o8f43kaE: Async.Parallel with Sleep, n = %d" n) 
+            (Async.RunSynchronously (Async.Parallel( [ for i in 0 .. n-1 -> async { do! Async.Sleep(1) 
+                                                                                    return i } ]))) [| 0..n-1 |]
+        
+    check "328onic4: Async.Parallel2" (Async.RunSynchronously (Async.Parallel2(async { return 1 }, async { return 2 }))) (1,2)
+    check "328onic4: Async.Parallel3" (Async.RunSynchronously (Async.Parallel3(async { return 1 }, async { return 2 }, async { return 3 }))) (1,2,3)
+
+    for n = 0 to 20 do
+        check (sprintf "32o8f43kaR: Async.Parallel with SwitchToNewThread, n = %d" n) 
+            (Async.RunSynchronously 
+                (Async.Parallel( [ for i in 0 .. n-1 -> async { do! Async.SwitchToNewThread()
+                                                                return i } ]))) [| 0..n-1 |]
+        
+    for n = 0 to 20 do
+        check (sprintf "32o8f43kaT: Async.Parallel with SwitchToThreadPool, n = %d" n) 
+            (Async.RunSynchronously
+                (Async.Parallel( [ for i in 0 .. n-1 -> async { do! Async.SwitchToThreadPool()
+                                                                return i } ]))) [| 0..n-1 |]
+ 
+    for n = 0 to 20 do
+        check 
+            (sprintf "32o8f43kaY: Async.Parallel with FromContinuations, n = %d" n) 
+            (Async.RunSynchronously (Async.Parallel( [ for i in 0 .. n-1 -> Async.FromContinuations(fun (cont,econt,ccont) -> cont i) ])))
+            [| 0..n-1 |]
+
+
+#if NetCore
+#else
+module AsyncWaitOneTest1 = 
+        
+    check 
+        "c32398u1: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(true)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) })) 
+        true
+
+    check 
+        "c32398u2: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(true)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) })) 
+        true
+
+    check 
+        "c32398u3: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(false)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) })) 
+        false // we never set the event, so the result is false
+        
+    check 
+        "c32398u4: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(false)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = 10) })) 
+        false // we never set the event, so the result is false
+
+    check 
+        "c32398u5: AsyncWaitOne"
+        (let wh = new System.Threading.AutoResetEvent(true)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) })) 
+        true
+
+    check 
+        "c32398u6: AsyncWaitOne"
+        (let wh = new System.Threading.AutoResetEvent(true)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = 10) })) 
+        true
+
+    check 
+        "c32398u7: AsyncWaitOne"
+        (let wh = new System.Threading.AutoResetEvent(true)
+         Async.RunSynchronously (async { return! Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) })) 
+        true
+
+    check 
+        "c32398u8: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(true)
+         Async.RunSynchronously
+             (async { let! ok1 = Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) 
+                      // check the event is still set (it's a ManualResetEvent)
+                      let! ok2 = Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) 
+                      return ok1 && ok2 })) 
+        true
+
+    check 
+        "c32398u9: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(false)
+         Async.RunSynchronously 
+             (async { let! _ = Async.StartChild (async { 
+                                                        System.Threading.Thread.Sleep(100)
+                                                        let _ = wh.Set() in () })
+                      let! ok1 = Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) 
+                      // check the event is still set (it's a ManualResetEvent)
+                      let! ok2 = Async.AwaitWaitHandle(wh,millisecondsTimeout = -1) 
+                      return ok1 && ok2 })) 
+        true
+
+    check 
+        "c32398u10: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(false)
+         Async.RunSynchronously 
+             (async { let! _ = Async.StartChild (async { let _ = wh.Set() in () })
+                      // 1000 milliseconds should be enough to get the result
+                      let! ok1 = Async.AwaitWaitHandle(wh,millisecondsTimeout = 1000) 
+                      // check the event is still set (it's a ManualResetEvent)
+                      let! ok2 = Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) 
+                      return ok1 && ok2 })) 
+        true
+
+    check 
+        "c32398u11: AsyncWaitOne"
+        (let wh = new System.Threading.ManualResetEvent(false)
+         Async.RunSynchronously 
+             (async { let! _ = Async.StartChild (async {  System.Threading.Thread.Sleep(100); let _ = wh.Set() in () })
+                      // no timeout = infinite
+                      let! ok1 = Async.AwaitWaitHandle(wh) 
+                      // check the event is still set (it's a ManualResetEvent)
+                      let! ok2 = Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) 
+                      return ok1 && ok2 })) 
+        true
+
+    check 
+        "c32398u12: AsyncWaitOne"
+        (let wh = new System.Threading.AutoResetEvent(false)
+         Async.RunSynchronously 
+             (async { let! _ = Async.StartChild (async {  System.Threading.Thread.Sleep(100); let _ = wh.Set() in () })
+                      // no timeout = infinite
+                      let! ok1 = Async.AwaitWaitHandle(wh) 
+                      // check the event is not still set (it's an AutoResetEvent)
+                      let! ok2 = Async.AwaitWaitHandle(wh,millisecondsTimeout = 0) 
+                      return ok1 && not ok2 })) 
+        true
+
+(*
+let s = new System.IO.MemoryStream(1000)
+let buffer = Array.create<byte> 1000 32uy
+
+s.Read(buffer,0,10)
+Async.RunSynchronously (async { let! n = s.AsyncRead(buffer,0,10) in return n })
+
+s.Write(buffer,0,10)
+Async.RunSynchronously (async { let! n = s.AsyncRead(buffer,0,10) in return n })
+s.Length
+s.ReadByte()
+s.CanRead
+s.CanWrite
+s.GetBuffer()
+s.Seek(0L,System.IO.SeekOrigin.Begin)
+Async.RunSynchronously (async { let! n = s.AsyncRead(buffer,0,9) in return n }) = 9
+Async.RunSynchronously (async { let! n = s.AsyncRead(buffer,0,9) in return n }) = 1
+*)
+#endif
+
+#if NetCore
+#else
+module AsyncGenerateTests = 
+    for length in 1 .. 10 do
+        for chunks in 1 .. 10 do 
+            check (sprintf "c3239438u: Run/Generate, length=%d, chunks=%d" length chunks)
+                (Async.RunSynchronously(Async.Generate(length, (fun i -> async {return i}), chunks)))
+                [| 0 .. length-1|];;
+
+
+    for length in 0 .. 10 do
+        for chunks in 1 .. 10 do 
+            check (sprintf "c3239438v: Run/Generate, length=%d, chunks=%d" length chunks)
+                (try Async.RunSynchronously
+                         (Async.Generate(length, (fun i -> async { do System.Threading.Thread.Sleep(chunks)
+                                                                   return i}), chunks), timeout=length) 
+                 with :? System.TimeoutException -> [| 0 .. length-1|])
+                [| 0 .. length-1|];;
+
+    for length in 1 .. 10 do
+        for chunks in 1 .. 10 do 
+            let action i : Async<int> = 
+                async { 
+                    do System.Threading.Thread.Sleep(chunks)
+                    return i
+                } 
+            let a = async { 
+                let! child = Async.Generate(length, action, chunks) |> Async.StartChild
+                return! child
+            } 
+            check (sprintf "c3239438w: Run/StartChild/Generate, length=%d, chunks=%d" length chunks)
+                (a |>Async.RunSynchronously)
+                [| 0 .. length-1|];;
+
+
+    for length in 0 .. 10 do
+        for chunks in 1 .. 10 do 
+            let action i : Async<int> = 
+                async { 
+                    do System.Threading.Thread.Sleep(chunks)
+                    return i
+                } 
+            let a = 
+                async { 
+                    try
+                      let! result = Async.StartChild(
+                                                Async.Generate(length, action, chunks), 
+                                                millisecondsTimeout=length)
+                      return! result
+                    with :? System.TimeoutException -> return [| 0 .. length-1|]
+                }
+            check (sprintf "c3239438x: Run/StartChild/Generate, length=%d, chunks=%d" length chunks)
+                (a |>Async.RunSynchronously)
+                [| 0 .. length-1|];;
+#endif
+
+#if NetCore
+#else
+(*
+#This part of control suite disabled under bug#1809
+module ThreadAbortTests = 
+    open System.Threading
+
+    for i = 1 to 100 do 
+        let t = new Thread(new ThreadStart(fun _ -> 
+            for j in 1 .. 10 do
+                Async.RunSynchronously(async { 
+                    for i in 1 .. 10 do
+                        do printfn "running async ... j = %d, i = %d" j i
+                        do Async.Sleep(10)
+                    return () })), IsBackground=true)
+
+        t.Start()
+        Async.Sleep(1)
+        t.Abort()
+
+
+    open System.Threading
+
+    type msg = Fetch of AsyncReplyChannel<int>
+
+    let rec bp : MailboxProcessor<msg>
+       = new MailboxProcessor<msg>(fun inbox -> 
+                  let rec loop () = async { 
+                      do printfn "receiving... #msg = %d" (Seq.length bp.UnsafeMessageQueueContents)
+
+                      let! (Fetch msg) = inbox.Receive()   
+                      do Async.Sleep(10)
+                      
+                      do msg.Post(3)
+                      return! loop () }
+                  loop())
+
+    bp.Start()
+
+    bp.UnsafeMessageQueueContents              
+    for k = 1 to 100 do
+        let t = new Thread(new ThreadStart(fun _ -> 
+            for j in 1 .. 10 do
+                printfn "res = %d" (bp.PostAndReply(fun reply -> Fetch(reply)))
+            ), IsBackground=true)
+
+        printfn "starting..." 
+        t.Start()
+        Async.Sleep(10)
+        printfn "aborting..." 
+        t.Abort()
+*)
+#endif
+
+let time f x = 
+    let timer = System.Diagnostics.Stopwatch.StartNew ()
+    let res = f x
+    res, timer.Elapsed
+
+// some long computation...
+let rec fibo = function
+  | 0 | 1 -> 1
+  | n -> fibo (n - 1) + fibo (n - 2)
+
+
+let fail = async { do failwith "fail" }
+
+
+let expect_failure a =
+  async { try
+            do! a
+            return false
+          with _ -> return true }
+
+// Exception catching test
+let test1 () =
+    test "test1" (expect_failure fail |> Async.RunSynchronously)
+
+
+let catch a =
+    Async.RunSynchronously
+        (async {try let! _ = a
+                    return ()
+                with _ -> return ()})
+
+let to_be_cancelled n flag1 flag2 =
+  async { use! holder = Async.OnCancel(fun _ -> incr flag1)
+#if NetCore
+          do Task.Delay(n/8).Wait()
+#else
+          do System.Threading.Thread.Sleep (n / 8)
+#endif
+          let! _ = async { return 1 } // implicit cancellation check
+          do incr flag2}
+
+
+// Cancellation test
+let test2 () =
+    let flag1 = ref 0
+    let flag2 = ref 0
+    let n = 400
+    for i in 1 .. n / 2 do
+       catch (Async.Parallel2(fail, to_be_cancelled i flag1 flag2))
+       catch (Async.Parallel2(to_be_cancelled i flag1 flag2, fail))
+    printfn "%d, %d" !flag1 !flag2
+    test "test2 - OnCancel" (!flag1 >= 0 && !flag1 < n && !flag2 >= 0 && !flag2 < n)
+
+
+#if NetCore
+#else
+// SwitchToNewThread
+let test3 () =
+    let ids = ref []
+    let rec a n =
+        async { do ids := System.Threading.Thread.CurrentThread.ManagedThreadId :: !ids
+                do! Async.SwitchToNewThread()
+                if n < 100 then 
+                    do! a (n + 1) }
+                    
+    // on low-resouce test VMs, this might not pass on the first try.  Give a few chances.               
+    let rec doTest maxAttempts =
+        printfn "doTest, maxAttempts %d" maxAttempts
+        match maxAttempts with
+        | n when n <= 0 -> ()  // give up
+        | _ ->
+            ids := []
+            Async.RunSynchronously (a 1)
+            let res = (set !ids).Count
+            if res > 1 then ()
+            else 
+               printfn "res = %d" res
+               doTest (maxAttempts - 1)
+
+    doTest 5
+    let res = (set !ids).Count
+    test (sprintf "test3 - SwitchToNewThread  res = %d" res) (res > 1)
+#endif
+
+(*
+// Performance test (only if multi-core)
+let test4 () =
+    let fibo_1() =
+        fibo 32 |> ignore;
+        fibo 32 |> ignore;
+        fibo 32 |> ignore;
+        fibo 32
+
+    // should be at least 20% faster if multi-core
+    let fibo_2() =
+        let a1 = Async.SpawnFuture(async { return fibo 32 })
+        let a2 = Async.SpawnFuture(async { return fibo 32 })
+        let a3 = Async.SpawnFuture(async { return fibo 32 })
+        fibo 32 |> ignore
+        a1.Value |> ignore
+        a2.Value |> ignore
+        a3.Value
+
+    let (r1, t1), (r2, t2) = time fibo_1 (), time fibo_2 ()
+    test "test4 - future (multi-core)" (r1 = r2)
+    printfn "test4 - performance, ratio = %f, expect < 0.8" (float t2.Ticks / float t1.Ticks)
+    if t2.Ticks > t1.Ticks * 80L / 100L then
+        printfn "  Warning: performance test failed."
+
+*)
+
+// test thread safety (using a lock)
+let test8() =
+    printfn "test8 started"
+    let syncRoot = System.Object()
+    let k = ref 0
+    let comp _ = async { return lock syncRoot (fun () -> incr k
+#if NetCore
+                                                         Task.Delay(1).Wait()
+#else
+                                                         System.Threading.Thread.Sleep(1)
+#endif
+                                                         !k ) }
+    let arr = Async.RunSynchronously (Async.Parallel(Seq.map comp [1..50]))
+    test "test8 - lock" ((Array.sortWith compare arr) = [|1..50|])
+
+// without lock, there "must" be concurrent problems
+let test9() =
+    let syncRoot = System.Object()
+    let k = ref 0
+    let comp _ = async { do incr k
+                         do! Async.Sleep(10)
+                         return !k }
+    let arr = Async.RunSynchronously (Async.Parallel(Seq.map comp [1..100]))
+    test "test9 - no lock" ((Array.sortWith compare arr) <> [|1..100|])
+
+
+// performance of Async.Parallel
+let test10() =
+    let fibo_1() =
+        Array.init 37 fibo
+
+    // should be at least 30% faster if multi-core
+    let fibo_2() =
+        let compute n = async { return fibo n }
+        let arr = Array.init 37 compute
+        Async.RunSynchronously (Async.Parallel arr)
+
+    try
+        let (r1, t1), (r2, t2) = time fibo_1 (), time fibo_2 ()
+        test "test10 - Async.Parallel" (r1 = r2)
+        printfn "test10 - performance, ratio = %f, expect < 0.8" (float t2.Ticks / float t1.Ticks)
+        if t2.Ticks > t1.Ticks * 80L / 100L then
+            printfn "  Warning: performance test failed."
+    with
+    | e ->
+        test "test10 - Async.Parallel" false
+        printfn "%s" (e.ToString())
+
+(*
+// performance of Async.Future
+let test11() =
+    let fibo_1() =
+        Array.init 37 fibo
+
+    // should be at least 30% faster if multi-core
+    let fibo_2() =
+        let compute n = async { return fibo n }
+        let arr = Array.init 37 (fun n -> Async.SpawnFuture (compute n))
+        arr |> Array.map (fun a -> a.Value)
+  
+    let (r1, t1), (r2, t2) = time fibo_1 (), time fibo_2 ()
+    test "test11 - AsyncFuture" (r1 = r2)
+    printfn "test11 - performance, ratio = %f, expect < 0.8" (float t2.Ticks / float t1.Ticks)
+    if t2.Ticks > t1.Ticks * 80L / 100L then
+        printfn "  Warning: performance test failed."
+*)
+
+
+// performance of Async.Generate
+let test12() =
+    let fibo_1() =
+        Array.init 37 fibo
+
+    let fibo_2() =
+        let compute n = async { return fibo n }
+        Async.RunSynchronously (Async.Generate(37, compute, 37))
+
+    try
+        let (r1, t1), (r2, t2) = time fibo_1 (), time fibo_2 ()
+        test "test12 - Async.Generate" (r1 = r2)
+        printfn "test12 - performance, ratio = %f, expect < 0.8" (float t2.Ticks / float t1.Ticks)
+        if t2.Ticks > t1.Ticks * 80L / 100L then
+            printfn "  Warning: performance test failed."
+    with
+    | e ->
+        test "test12 - performance" false
+        printfn "%s" (e.ToString())
+
+
+// Self-cancellation
+let test13() =
+    let a = async {
+        try
+            do Async.CancelDefaultToken()
+            let! _ = async { return 1 } 
+            do test "test13" false
+        with
+        | _ -> do test "test13" false }
+
+    try       
+        a |> Async.RunSynchronously |> ignore
+        test "test13" false
+    with
+    | :? System.OperationCanceledException -> test "test13" true
+    | _ -> test "test13" false
+
+
+// Exceptions
+let test14() =
+    try
+        fail |> Async.RunSynchronously |> ignore
+        test "test14" false
+    with
+    | Failure "fail" -> test "test14" true
+    | e -> 
+        test "test14" false
+        printfn "test14 caught exception was: %s" (e.ToString())
+
+
+// Useful class: put "checkpoints" in the code.
+// Check they are called in the right order.
+type Path(str) =
+    let mutable current = 0
+    member p.Check n = check (str + " #" + string (current+1)) n (current+1)
+                       current <- n
+
+// Cancellation - TryCancelled
+let test15() =
+    let p = Path "test15 - cancellation"
+
+    let cancel = async {
+        do! Async.Sleep 100
+        do failwith "fail" }
+
+    let a = async {
+        try
+            use! holder = Async.OnCancel (fun _ -> p.Check 1)
+            do! Async.Sleep 200
+            do p.Check 2
+            let! _ = async { return 1 } 
+            do p.Check (-1)
+        finally
+            p.Check 3}
+    try
+        let a = Async.TryCancelled(a, (fun _ -> p.Check 4))
+        let a = Async.TryCancelled(a, (fun _ -> p.Check 5))
+        let a = Async.TryCancelled(a, (fun _ -> p.Check 6))
+        Async.Parallel2(a, cancel)
+        |> Async.RunSynchronously |> ignore
+    with _ -> ()
+#if NetCore
+    Task.Delay(300).Wait()
+#else
+    System.Threading.Thread.Sleep(300)
+#endif
+    p.Check 7
+
+// The same, without the cancellation
+let test15b() =
+    let p = Path "test15b, no cancellation"
+    let a = async {
+        try
+            use! holder = Async.OnCancel (fun _ -> p.Check -1)
+            do! Async.Sleep 200
+            do p.Check 1
+            let! _ = async { return 1 } 
+            do p.Check 2
+        finally
+            p.Check 3}
+    try
+        let a = Async.TryCancelled(a, (fun _ -> p.Check -1))
+        a |> Async.RunSynchronously |> ignore
+    with _ -> ()
+#if NetCore
+    Task.Delay(100).Wait()
+#else
+    System.Threading.Thread.Sleep(100)
+#endif
+
+test1()
+test2()
+#if NetCore
+#else
+test3()
+#endif
+test8()
+test9()
+test13()
+test14()
+// ToDo: 7/31/2008: Disabled because of probable timing issue.  QA needs to re-enable post-CTP.
+// Tracked by bug FSharp 1.0:2891
+//test15()
+// ToDo: 7/31/2008: Disabled because of probable timing issue.  QA needs to re-enable post-CTP.
+// Tracked by bug FSharp 1.0:2891
+//test15b()
+
+// performance (multi-core only)
+if System.Environment.ProcessorCount > 1 then
+    test10()
+    test12()
+
+
+
+// test cancellation, with a sub-computation
+let test22() =
+    let p = Path "test22"
+    let a = async {
+        do p.Check 1
+#if NetCore
+        do Task.Delay(200).Wait()
+#else
+        do System.Threading.Thread.Sleep(200)
+#endif
+        do p.Check 3
+        let! _ = async { return 1 } 
+        do p.Check -1
+    }
+    let run = async {
+        try
+            do! a
+            do p.Check -1
+        with _ -> do p.Check -1
+    }
+    let run = Async.TryCancelled(run, fun _ -> p.Check 4)
+    let group = new System.Threading.CancellationTokenSource()
+    Async.Start(run,group.Token)
+#if NetCore
+    Task.Delay(100).Wait()
+#else
+    System.Threading.Thread.Sleep(100)
+#endif
+    p.Check 2
+    group.Cancel()
+#if NetCore
+    Task.Delay(200).Wait()
+#else
+    System.Threading.Thread.Sleep(200)
+#endif
+    p.Check 5
+
+// ToDo: 7/25/2008: Disabled because of probable timing issue.  QA needs to re-enable post-CTP.
+// Tracked by bug FSharp 1.0:2891
+// test22()
+    
+module ParallelTest = 
+
+    let Test() =
+        let n = 10
+        let controlWasReturnedToClientAlready = ref false
+        // goal is invariant that client sees invariant 
+        // numOutstandingWorkers=0 after Async.RunSynchronously call
+        let numOutstandingWorkers = ref 0  
+        let ex = new System.Exception()
+        let failureHappened = ref false
+        try
+            let res = 
+                Async.RunSynchronously 
+                    (Async.Parallel 
+                        [for i in 0..n-1 ->
+                            async {
+                                if i=0 then
+                                    // let all other threads spin up before we fail
+                                    while !numOutstandingWorkers <> n-1 do
+                                        do! Async.Sleep(100) 
+                                    failureHappened := true
+                                    return raise ex
+                                else
+                                    use r = { new System.IDisposable with 
+                                                  member x.Dispose() = // This gets run when the cancel happens
+                                                      if i=n-1 then
+                                                          // last guy waits a long time to ensure client is blocked
+#if NetCore
+                                                          Task.Delay(200).Wait()
+#else
+                                                          System.Threading.Thread.Sleep(2000)
+#endif
+                                                      if not(!controlWasReturnedToClientAlready) then
+                                                          lock numOutstandingWorkers (fun() -> numOutstandingWorkers := !numOutstandingWorkers - 1) }
+                                    // mark that we began
+                                    lock numOutstandingWorkers (fun() -> numOutstandingWorkers := !numOutstandingWorkers + 1)
+                                    // Note - this doesn't return - it must be cancelled
+                                    while true do 
+                                        do! Async.Sleep(100*n) 
+                                    return 1 }]) 
+            ()
+        with
+            | e when obj.ReferenceEquals(e,ex) -> ()
+            | e2 -> 
+                failureHappened := true
+                check (sprintf "first exception was not returned to client, instead got: %s" (e2.ToString())) 1 0
+
+        controlWasReturnedToClientAlready := true
+
+        if !numOutstandingWorkers<> 0 then
+            failureHappened := true
+            check  "test failed because client got ahead of cleanup"    1 0
+
+        if !failureHappened = false then
+            check  "parallel-test-success"    1 1
+
+    Test()    
+
+
+#if NetCore
+#else
+// See bug 5570, check we do not switch threads
+module CheckNoPumpingOrThreadSwitchingBecauseWeTrampolineSynchronousCode =
+    let checkOnThread  msg expectedThreadId = 
+        let currentId = System.Threading.Thread.CurrentThread.ManagedThreadId
+        checkQuiet msg currentId expectedThreadId 
+
+    async { let tid = System.Threading.Thread.CurrentThread.ManagedThreadId
+            let ctxt = System.Threading.SynchronizationContext.Current
+            let state =  ref 1
+            for i = 0 to 10000 do 
+                let! res = async { return 1+i } // a bind point to a synchronous process, we do not expect this to switch threads or pump
+                
+                
+                // The execution of these Posts should be delayed until after the async has exited its synchronous code
+                if ctxt <> null then 
+                    ctxt.Post((fun _ -> 
+                        //printfn "setting, tid = %d" System.Threading.Thread.CurrentThread.ManagedThreadId; 
+                        state := 2), null) 
+                if i % 50 = 0 then printfn "tick %d..." i
+                checkOnThread "clkneoiwen thread check" tid 
+                checkQuiet "cwnewe9wecokm" !state 1 } |> Async.StartImmediate
+
+#if Portable
+#else
+open System.Windows.Forms
+
+#if COMPILED
+// See bug 5570, check we do not switch threads
+module CheckNoPumpingBecauseWeTrampolineSynchronousCode =
+    let checkOnThread  msg expectedThreadId = 
+        let currentId = System.Threading.Thread.CurrentThread.ManagedThreadId
+        checkQuiet msg currentId expectedThreadId 
+
+    let form = new System.Windows.Forms.Form()
+    form.Load.Add(fun _ -> 
+    
+        async { let tid = System.Threading.Thread.CurrentThread.ManagedThreadId
+                let ctxt = System.Threading.SynchronizationContext.Current
+                let state =  ref 1
+                for i = 0 to 10000 do 
+                    let! res = async { return 1+i } // a bind point to a synchronous process, we do not expect this to switch threads or pump
+
+                    // The execution of these Posts should be delayed until after the async has exited its synchronous code
+                    if ctxt <> null then 
+                        ctxt.Post((fun _ -> 
+                            //printfn "setting, tid = %d" System.Threading.Thread.CurrentThread.ManagedThreadId; 
+                            state := 2), null) 
+                    if i % 50 = 0 then printfn "tick %d..." i
+                    checkOnThread "clkneoiwen thread check" tid 
+                    checkQuiet "cwnewe9wecokm" !state 1 
+                Application.Exit() } 
+             |> Async.StartImmediate)
+
+    Application.Run form             
+    // Set the synchronization context back to its original value
+    System.Threading.SynchronizationContext.SetSynchronizationContext(null);
+    
+#endif
+
+#endif
+
+#endif //NetCore
+
+module CheckContinuationsMayNotBeCalledMoreThanOnce = 
+
+    (try 
+             Async.FromContinuations(fun (cont,_,_) -> cont(); cont()) |> Async.StartImmediate
+             false
+     with :? System.InvalidOperationException -> true)
+    |> check "celkner091" true
+
+    (try 
+             Async.FromContinuations(fun (cont,econt,_) -> cont (); econt (Failure "fail")) |> Async.StartImmediate
+             false
+     with :? System.InvalidOperationException -> true)
+    |> check "celkner092" true
+
+
+    (try 
+             Async.FromContinuations(fun (cont,econt,ccont) -> cont (); ccont (System.OperationCanceledException())) |> Async.StartImmediate 
+             false
+     with :? System.InvalidOperationException -> true)
+    |> check "celkner093" true
+
+
+    (try 
+             Async.FromContinuations(fun (cont,econt,ccont) -> ccont (System.OperationCanceledException()); ccont (System.OperationCanceledException())) |> Async.StartImmediate 
+             false
+     with :? System.InvalidOperationException -> true)
+    |> check "celkner094" true
+
+
+module CheckStartImmediate = 
+
+    // Check the async is executed immediately
+    (let res = ref 1
+     async { res := 2 } |> Async.StartImmediate
+     res.Value)
+    |> check "celkner091" 2
+
+
+    // Check we catch the failure immediately
+    (try 
+         async { failwith "fail" } |> Async.StartImmediate 
+         1
+     with Failure _ -> 2)
+    |> check "celkner091" 2
+
+module Bug5770 =
+    type exp = 
+        | Var of string           
+        | Lambda of string * exp           
+        | Apply of exp * exp
+    
+    let pfoldExpr varF lamF appF exp =     
+        let rec Loop e = async {
+            match e with        
+            | Var x -> return (varF x)        
+            | Lambda (x, body) -> let! bodyAcc = Loop body
+                                  return (lamF x bodyAcc)       
+            | Apply (l, r) -> let! [| lAcc; rAcc |] = [| Loop l; Loop r |] |> Async.Parallel 
+                              return (appF lAcc rAcc) }  
+        Loop exp 
+        
+    let ptoString e =    
+        pfoldExpr        
+            (fun x -> sprintf "%s" x)        
+            (fun x y -> sprintf "(\\%s.%s)" x y)        
+            (fun x y -> sprintf "(%s %s)" x y)   
+            e     
+        |> Async.RunSynchronously 
+
+    let e = Apply(Lambda("x", Var "x"), Lambda("y", Var "y"))
+    let C e = Apply(e,e)
+    let bigE = C(C(C(C(C(C(C(C(C(C(C(C(C(e)))))))))))))
+    
+    try
+        for i = 1 to 10 do
+            check (sprintf "dfgeyrtwq26: Async.Parallel spawning Parallel %d" i)
+                (ptoString bigE |> ignore; "Complete")
+                "Complete"
+    with
+    | e ->
+        check "Bug 5770" true false
+        printfn "%s" (e.ToString())
+
+
+
+module Bug6086 =
+    try
+        let count = 200000
+        let rec loop i : Async<string> = 
+            async { if i <= 0 then return "finished"
+                    else return! loop (i-1) }
+        
+        check "4dyeyuiqyhi3 - async"
+            (loop count |> Async.RunSynchronously)
+            "finished"
+        
+        let rec p i : Async<string> = async.Delay(fun () -> if i > 0 then  p (i-1) else async.Return("finished"))
+        check "4dyeyuiqyhi3 - async.Delay"
+            (loop count |> Async.RunSynchronously)
+            "finished"
+    with
+    | e ->
+        check "Bug6086" true false
+        printfn "%s" (e.ToString())
+    
+module Bug850869 =
+  let f1() = 
+    async
+      { use! a = Unchecked.defaultof<Async<System.IDisposable>>
+        return true }
+
+  let f2() = 
+    async
+      { use! A = Unchecked.defaultof<Async<System.IDisposable>>
+        return true }         
+
+module ExceptionInAsyncParallelOrHowToInvokeContinuationTwice = 
+    
+    let test() = 
+        let pair = async {
+            try
+                let! r = 
+                    [
+                        async {
+                            do! Async.Sleep 10000
+                            return failwith "Should not be exercised"
+                        }
+                        async {
+                            ignore (42/0) //this will throw
+                            return 42
+                        }
+                    ] |> Async.Parallel
+ 
+                return "OK"
+            with :? System.DivideByZeroException -> return "OOPS"
+        }
+        let counter = ref 0
+        let driver = async {
+            let! r = pair
+            incr counter
+        }
+        try
+            Async.RunSynchronously driver
+            !counter = 1
+        with
+            _ -> false
+
+    check "ExceptionInAsyncParallelOrHowToInvokeContinuationTwice" (Seq.init 30 (ignore >> test) |> Seq.forall id) true
+    
+
+
+// [Asyncs] Cancellation inside Async.AwaitWaitHandle may release source WaitHandle
+module Bug391710 =
+    open System
+    open System.Threading
+ 
+    let mutable trace = List.empty<string>
+    let Bug391710() = 
+        use s = new ManualResetEvent(false)
+        let cts = new CancellationTokenSource()
+
+        let a1 = 
+            async { let! _ok = Async.AwaitWaitHandle s
+                    trace <- List.Cons("a1", trace)
+            }
+
+        let a2 = 
+            async { let! _ok = Async.AwaitWaitHandle s
+                    trace <- List.Cons("a2", trace)
+            }
+
+        Async.Start(a1, cancellationToken = cts.Token)
+        Async.Start(a2)
+#if NetCore
+        Task.Delay(500).Wait();
+#else
+        System.Threading.Thread.Sleep(500)
+#endif
+        cts.Cancel()
+
+    try
+        Bug391710()
+#if NetCore
+        Task.Delay(500).Wait();
+#else
+        System.Threading.Thread.Sleep(2000)
+#endif
+        check "Check that cancellation of 'a1' does not trigger the signalling of 's' (Bug391710)" trace []
+    with
+    | e ->
+        check "Bug391710" true false
+        printfn "%s" (e.ToString())
+
+#if Portable
+let aa = if not failures.IsEmpty then exit 1 else stdout.WriteLine "Test Passed"; exit 0
+#else
+let _ = 
+  if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!"
+        System.IO.File.WriteAllText("test.ok","ok"); 
+// debug: why is the fsi test failing?  is it because test.ok does not exist?
+        if System.IO.File.Exists("test.ok") then
+            stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName)
+        else
+            stdout.WriteLine ("test.ok not found")
+        exit 0)
+
+#endif
\ No newline at end of file
diff --git a/tests/fsharp/core/controlChamenos/build.bat b/tests/fsharp/core/controlChamenos/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/controlChamenos/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlChamenos/run.bat b/tests/fsharp/core/controlChamenos/run.bat
new file mode 100644
index 0000000..ba4fe87
--- /dev/null
+++ b/tests/fsharp/core/controlChamenos/run.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/controlChamenos/test.fsx b/tests/fsharp/core/controlChamenos/test.fsx
new file mode 100644
index 0000000..ce0ff01
--- /dev/null
+++ b/tests/fsharp/core/controlChamenos/test.fsx
@@ -0,0 +1,150 @@
+// #Conformance #ComputationExpressions #Async 
+#if Portable
+module Core_controlChamenos
+#endif
+#light
+
+#nowarn "40" // recursive references
+
+let biggerThanTrampoliningLimit = 10000
+
+let failuresFile =
+   let f = System.Environment.GetEnvironmentVariable("CONTROL_FAILURES_LOG")
+   match f with
+   | "" | null -> "failures.log"
+   | _ -> f
+
+let log msg = 
+  printfn "%s" msg
+  System.IO.File.AppendAllText(failuresFile, sprintf "%A: %s\r\n" System.DateTime.Now msg)
+
+let mutable failures = []
+let syncObj = new obj()
+let report_failure s = 
+  stderr.WriteLine " NO"; 
+  lock syncObj (fun () ->
+     failures <- s :: failures;
+     log (sprintf "FAILURE: %s failed" s)
+  )
+
+#if Portable
+#else
+System.AppDomain.CurrentDomain.UnhandledException.AddHandler(
+       fun _ (args:System.UnhandledExceptionEventArgs) ->
+          lock syncObj (fun () ->
+                failures <- (args.ExceptionObject :?> System.Exception).ToString() :: failures
+             )
+)
+#endif
+
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s 
+
+let checkQuiet s x1 x2 = 
+    if x1 <> x2 then 
+        (test s false; printfn "expected: %A, got %A" x2 x1)
+
+let check s x1 x2 = 
+    if x1 = x2 then test s true
+    else (test s false; printfn "expected: %A, got %A" x2 x1)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+open Microsoft.FSharp.Control
+open Microsoft.FSharp.Control.WebExtensions
+
+type Color = Blue | Red | Yellow
+let complement = function
+    | (Red, Yellow) | (Yellow, Red) -> Blue
+    | (Red, Blue) | (Blue, Red) -> Yellow
+    | (Yellow, Blue) | (Blue, Yellow) -> Red
+    | (Blue, Blue) -> Blue
+    | (Red, Red) -> Red
+    | (Yellow, Yellow) -> Yellow
+
+type Message =  Color * AsyncReplyChannel<Color option>
+
+let chameleon (meetingPlace : MailboxProcessor<Message>) initial = 
+    let rec loop c meets = async  {
+            let! replyMessage = meetingPlace.PostAndAsyncReply(fun reply -> c, reply)
+            match replyMessage with     
+            | Some(newColor) -> return! loop newColor (meets + 1)
+            | None -> 
+                return meets
+        }
+    loop initial 0
+    
+
+let meetingPlace chams n = MailboxProcessor.Start(fun (processor : MailboxProcessor<Message>)->
+    let rec fadingLoop total = 
+        async   {
+            if total <> 0 then
+                let! (_, reply) = processor.Receive()
+                reply.Reply None
+                return! fadingLoop (total - 1)
+            else
+                printfn "Done"
+        }
+    let rec mainLoop curr = 
+        async   {
+            if (curr > 0) then
+                let! (color1, reply1) = processor.Receive()
+                let! (color2, reply2) = processor.Receive()
+                let newColor = complement (color1, color2)
+                reply1.Reply <| Some(newColor)
+                reply2.Reply <| Some(newColor)                
+                return! mainLoop (curr - 1)
+            else
+                return! fadingLoop chams
+        }
+    mainLoop n
+    ) 
+
+open System
+open System.Diagnostics
+
+
+let () =
+    let meetings = 100000
+    
+    let colors = [Blue; Red; Yellow; Blue]    
+    let mp = meetingPlace (colors.Length) meetings
+    let meets = 
+            colors 
+                |> List.map (chameleon mp) 
+                |> Async.Parallel 
+                |> Async.RunSynchronously 
+
+    check "Chamenos" (Seq.sum meets) (meetings*2)
+
+#if Portable
+let aa = 
+    if not failures.IsEmpty then exit 1
+    else 
+        stdout.WriteLine "Test Passed"
+        exit 0
+#else
+let _ = 
+  if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!"
+        System.IO.File.WriteAllText("test.ok","ok"); 
+// debug: why is the fsi test failing?  is it because test.ok does not exist?
+        if System.IO.File.Exists("test.ok") then
+            stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName)
+        else
+            stdout.WriteLine ("test.ok not found")
+        exit 0)
+#endif
+
diff --git a/tests/fsharp/core/controlMailbox/build.bat b/tests/fsharp/core/controlMailbox/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/controlMailbox/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlMailbox/repeat.bat b/tests/fsharp/core/controlMailbox/repeat.bat
new file mode 100644
index 0000000..f618075
--- /dev/null
+++ b/tests/fsharp/core/controlMailbox/repeat.bat
@@ -0,0 +1,13 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+:REPEAT
+
+call %~d0%~p0..\..\single-test-run.bat
+
+if errorlevel 1 goto :ERROR
+
+goto :REPEAT
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/controlMailbox/run.bat b/tests/fsharp/core/controlMailbox/run.bat
new file mode 100644
index 0000000..ba4fe87
--- /dev/null
+++ b/tests/fsharp/core/controlMailbox/run.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/controlMailbox/test.fsx b/tests/fsharp/core/controlMailbox/test.fsx
new file mode 100644
index 0000000..8288ffc
--- /dev/null
+++ b/tests/fsharp/core/controlMailbox/test.fsx
@@ -0,0 +1,644 @@
+// #Regression #Conformance #ComputationExpressions #Async #Regression #Events #Stress 
+#if Portable
+module Core_controlMailBox
+#endif
+#light
+
+#nowarn "40" // recursive references
+
+#if NetCore
+open System.Threading.Tasks
+#endif
+
+let biggerThanTrampoliningLimit = 10000
+
+let failuresFile =
+   let f = System.Environment.GetEnvironmentVariable("CONTROL_FAILURES_LOG")
+   match f with
+   | "" | null -> "failures.log"
+   | _ -> f
+
+let log msg = 
+  printfn "%s" msg
+  System.IO.File.AppendAllText(failuresFile, sprintf "%A: %s\r\n" System.DateTime.Now msg)
+
+let mutable failures = []
+let syncObj = new obj()
+let report_failure s = 
+  stderr.WriteLine " NO"; 
+  lock syncObj (fun () ->
+     failures <- s :: failures;
+     log (sprintf "FAILURE: %s failed" s)
+  )
+
+#if Portable
+#else
+System.AppDomain.CurrentDomain.UnhandledException.AddHandler(
+       fun _ (args:System.UnhandledExceptionEventArgs) ->
+          lock syncObj (fun () ->
+                let e = args.ExceptionObject :?> System.Exception
+                printfn "Exception: %s at %s" (e.ToString()) e.StackTrace
+                failures <- (args.ExceptionObject :?> System.Exception).ToString() :: failures
+             )
+)
+#endif
+
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s 
+
+let checkQuiet s x1 x2 = 
+    if x1 <> x2 then 
+        (test s false; 
+         log (sprintf "expected: %A, got %A" x2 x1))
+
+let check s x1 x2 = 
+    if x1 = x2 then test s true
+    else (test s false; log (sprintf "expected: %A, got %A" x2 x1))
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+open Microsoft.FSharp.Control
+open Microsoft.FSharp.Control.WebExtensions
+
+module MailboxProcessorBasicTests = 
+    let test() =
+        check 
+            "c32398u6: MailboxProcessor null"
+            (let mb1 = new MailboxProcessor<int>(fun inbox -> async { return () })
+             mb1.Start();
+             100)
+            100
+
+
+        check 
+            "c32398u7: MailboxProcessor Receive/PostAndReply"
+            (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> async { let! msg = inbox.Receive() 
+                                                                                         do msg.Reply(100) })
+             mb1.Start();
+             mb1.PostAndReply(fun replyChannel -> replyChannel))
+            100
+
+
+        for timeout in [-1;0;10] do
+            check 
+                (sprintf "c32398u7: MailboxProcessor Receive/TryPostAndReply, timeout = %d" timeout)
+                (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> async { let! msg = inbox.Receive() 
+                                                                                             do msg.Reply(100) })
+                 mb1.Start();
+                 mb1.PostAndReply(fun replyChannel -> replyChannel))
+                100
+
+        check 
+            "c32398u8: MailboxProcessor Receive/PostAndReply"
+            (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> async { let! replyChannel1 = inbox.Receive() 
+                                                                                         do replyChannel1.Reply(100)
+                                                                                         let! replyChannel2 = inbox.Receive() 
+                                                                                         do replyChannel2.Reply(200)  })
+             mb1.Start();
+             let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+             let reply2 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+             reply1, reply2)
+            (100,200)
+
+        check 
+            "c32398u9: MailboxProcessor TryReceive/PostAndReply"
+            (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> 
+                              async { let! msgOpt = inbox.TryReceive()
+                                      match msgOpt with
+                                      | Some(replyChannel) -> 
+                                         do replyChannel.Reply(100)
+                                         let! msgOpt = inbox.TryReceive() 
+                                         match msgOpt with 
+                                         | Some(replyChannel2) ->  
+                                             do replyChannel2.Reply(200) 
+                                         | None -> 
+                                            do failwith "failure"
+                                      | None -> 
+                                         do failwith "failure" })
+             mb1.Start();
+             let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+             let reply2 = mb1.PostAndReply(fun replyChannel-> replyChannel)
+             reply1, reply2)
+            (100,200)
+
+        for timeout in [0;10] do
+            check 
+                (sprintf "c32398u10: MailboxProcessor TryReceive/PostAndReply with TryReceive timeout, timeout=%d" timeout)
+                (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> 
+                                  async { let! msgOpt = inbox.TryReceive()
+                                          match msgOpt with
+                                          | Some(replyChannel) -> 
+                                             let! msgOpt = inbox.TryReceive(timeout=timeout) 
+                                             match msgOpt with 
+                                             | Some(_) ->  
+                                                 do replyChannel.Reply(200) 
+                                             | None -> 
+                                                 do replyChannel.Reply(100)
+                                          | None -> 
+                                             do failwith "failure" })
+                 mb1.Start();
+                 let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+                 reply1)
+                100
+
+
+        for timeout in [-1;0;10] do
+            check 
+                (sprintf "c32398u: MailboxProcessor TryReceive/PostAndReply with Receive timeout, timeout=%d" timeout)
+                (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> 
+                                  async { let! msgOpt = inbox.TryReceive()
+                                          match msgOpt with
+                                          | Some(replyChannel) -> 
+                                              try let! _ = inbox.Receive(timeout=10) 
+                                                  do failwith "Receive should have timed out"
+                                              with _ -> 
+                                                  do replyChannel.Reply(200) 
+                                          | None -> 
+                                              do failwith "failure" })
+                 mb1.Start();
+                 let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+                 reply1)
+                200
+
+
+        for timeout in [-1;0;10] do
+            check 
+                (sprintf "c32398u: MailboxProcessor TryReceive/PostAndReply with Scan timeout, timeout=%d" timeout)
+                (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> 
+                                  async { let! msgOpt = inbox.TryReceive()
+                                          match msgOpt with
+                                          | Some(replyChannel) -> 
+                                              try 
+                                                  do! inbox.Scan(timeout=10,
+                                                                 scanner=(fun _ -> failwith "Scan should have timed out"))
+                                              with _ -> 
+                                                  do replyChannel.Reply(200) 
+                                          | None -> 
+                                              do failwith "failure" })
+                 mb1.Start();
+                 let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+                 reply1)
+                200
+
+        for timeout in [-1;0;10] do
+            check 
+                (sprintf "c32398u: MailboxProcessor TryReceive/PostAndReply with TryScan timeout, timeout=%d" timeout)
+                (let mb1 = new MailboxProcessor<AsyncReplyChannel<int>>(fun inbox -> 
+                                  async { let! msgOpt = inbox.TryReceive()
+                                          match msgOpt with
+                                          | Some(replyChannel) -> 
+                                              let! scanRes = 
+                                                  inbox.TryScan(timeout=10,
+                                                                scanner=(fun _ -> failwith "TryScan should have timed out"))
+                                              match scanRes with
+                                              | None -> do replyChannel.Reply(200) 
+                                              | Some _ -> do failwith "TryScan should have failed"
+                                          | None -> 
+                                              do failwith "failure" })
+                 mb1.Start();
+                 let reply1 = mb1.PostAndReply(fun replyChannel -> replyChannel)
+                 reply1)
+                200
+
+        for n in [0; 1; 100; 1000; 100000 ] do
+            check 
+                (sprintf "c32398u: MailboxProcessor Post/Receive, n=%d" n)
+                (let received = ref 0
+                 let mb1 = new MailboxProcessor<int>(fun inbox -> 
+                    async { for i in 0 .. n-1 do 
+                                let! _ = inbox.Receive()
+                                do incr received })
+                 mb1.Start();
+                 for i in 0 .. n-1 do
+                     mb1.Post(i)
+                 while !received < n do
+                     if !received % 100 = 0 then 
+                         printfn "received = %d" !received
+#if NetCore
+                     Task.Delay(1).Wait()
+#else
+                     System.Threading.Thread.Sleep(1)
+#endif
+                 !received)
+                n
+
+        for timeout in [0; 10] do
+          for n in [0; 1; 100] do
+            check 
+                (sprintf "c32398u: MailboxProcessor Post/TryReceive, n=%d, timeout=%d" n timeout)
+                (let received = ref 0
+                 let mb1 = new MailboxProcessor<int>(fun inbox -> 
+                    async { while !received < n do 
+                                let! msgOpt = inbox.TryReceive(timeout=timeout)
+                                match msgOpt with 
+                                | None -> 
+                                    do if !received % 100 = 0 then 
+                                           printfn "timeout!, received = %d" !received
+                                | Some _ -> do incr received })
+                 mb1.Start();
+                 for i in 0 .. n-1 do
+#if NetCore
+                     Task.Delay(1).Wait();
+#else
+                     System.Threading.Thread.Sleep(1)
+#endif
+                     mb1.Post(i)
+                 while !received < n do
+                     if !received % 100 = 0 then 
+                         printfn "main thread: received = %d" !received
+#if NetCore
+                     Task.Delay(1).Wait();
+#else
+                     System.Threading.Thread.Sleep(1)
+#endif
+                 !received)
+                n
+
+        for i in 1..10 do
+            for sleep in [0;1;10] do
+                for timeout in [10;1;0] do
+                    check 
+                       (sprintf "cf72361: MailboxProcessor TryScan w/timeout=%d sleep=%d iteration=%d" timeout sleep i) 
+                       (let timedOut = ref None
+                        let mb = new MailboxProcessor<int>(fun inbox ->
+                                async {
+                                        let result = ref None
+                                        let count = ref 0
+                                        while (!result).IsNone && !count < 5 do
+                                            let! curResult = inbox.TryScan((fun i -> if i >= 0 then async { return i } |> Some  else None), timeout=timeout)
+                                            result := curResult
+                                            count := !count + 1
+                                        match !result with
+                                        |   None -> 
+                                                timedOut := Some true
+                                        |   Some i -> 
+                                                timedOut := Some false
+                                })
+                        mb.Start()
+                        let w = System.Diagnostics.Stopwatch()
+                        w.Start()
+                        while w.ElapsedMilliseconds < 1000L && (!timedOut).IsNone do
+                            mb.Post(-1)
+#if NetCore
+                            Task.Delay(1).Wait();
+#else
+                            System.Threading.Thread.Sleep(1)
+#endif
+                        mb.Post(0)
+                        !timedOut)
+                       (Some true)
+
+        check "cf72361: MailboxProcessor TryScan wo/timeout" 
+           (let timedOut = ref None
+            let mb = new MailboxProcessor<bool>(fun inbox ->
+                    async {
+                        let! result = inbox.TryScan((fun i -> if i then async { return () } |> Some  else None))
+                        match result with
+                        |   None -> timedOut := Some true
+                        |   Some () -> timedOut := Some false
+                    })
+            mb.Start()
+            let w = System.Diagnostics.Stopwatch()
+            w.Start()
+            while w.ElapsedMilliseconds < 100L do
+                mb.Post(false)
+#if NetCore
+                Task.Delay(0).Wait();
+#else
+                System.Threading.Thread.Sleep(0)
+#endif
+            let r = !timedOut
+            mb.Post(true)
+            r)
+            None
+    test()
+
+module MailboxProcessorErrorEventTests =
+    exception Err of int
+    let test() =
+        // Make sure the event doesn't get raised if no error
+        check 
+            "c32398u9330: MailboxProcessor Error (0)"
+            (let mb1 = new MailboxProcessor<int>(fun inbox -> async { return () })
+             let res = ref 100
+             mb1.Error.Add(fun _ -> res := 0)
+             mb1.Start();
+#if NetCore
+             Task.Delay(200).Wait();
+#else
+             System.Threading.Thread.Sleep(200)
+#endif
+             !res)
+            100
+
+        // Make sure the event does get raised if error
+        check 
+            "c32398u9331: MailboxProcessor Error (1)"
+            (let mb1 = new MailboxProcessor<int>(fun inbox -> async { failwith "fail" })
+             let res = ref 0
+             mb1.Error.Add(fun _ -> res := 100)
+             mb1.Start();
+#if NetCore
+             Task.Delay(200).Wait();
+#else
+             System.Threading.Thread.Sleep(200)
+#endif
+             !res)
+            100
+
+        // Make sure the event does get raised after message receive 
+        check 
+            "c32398u9332: MailboxProcessor Error (2)"
+            (let mb1 = new MailboxProcessor<int>(fun inbox -> 
+                                    async { let! msg = inbox.Receive() 
+                                            raise (Err msg) })
+             let res = ref 0
+             mb1.Error.Add(function Err n -> res := n | _ -> check "rwe90r - unexpected error" 0 1)
+             mb1.Start();
+             mb1.Post 100
+#if NetCore
+             Task.Delay(200).Wait();
+#else
+             System.Threading.Thread.Sleep(200)
+#endif
+             !res)
+            100
+    test()
+        
+type msg = Increment of int | Fetch of AsyncReplyChannel<int> | Reset
+let mailboxes() = new MailboxProcessor<msg>(fun inbox ->
+    let rec loop n =
+         async { let! msg = inbox.Receive()
+                 match msg with
+                 | Increment m -> return! loop (n + m)
+                 | Reset -> return! loop 0
+                 | Fetch chan -> do chan.Reply(n)
+                                 return! loop n }
+    loop 0)
+
+// multiple calls to Mailbox.Start
+let test5() =
+    let mailbox = mailboxes()
+    mailbox.Start()
+    let res =
+        try
+            mailbox.Start()
+            false
+        with _ -> true
+    test "test5 - Mailbox.Start" res
+
+let test6() =
+    let mailbox = mailboxes()
+    mailbox.Start()
+
+    let rec compute n =
+        async { do mailbox.Post (Increment n)
+                if n <> 0 then
+                    let! res = compute (n - 1)
+                    return n + res
+                else
+                    return 0 }
+
+    // asynchronous computations send messages to the mailbox and compute a value
+    // the mailbox computes the same thing (using messages)
+    // they should get the same result
+    let test6a() =
+       mailbox.Post(Reset)
+       let computations =
+           let arr = Async.RunSynchronously (Async.Parallel (List.map compute [1 .. 50]))
+           Seq.fold (+) 0 arr
+
+       let mails = mailbox.PostAndReply(fun chan -> Fetch chan)
+       test "test6a - mailbox & parallel" (computations = mails)
+
+    // PostAndReply
+    let test6b() =
+        mailbox.Post(Reset)
+        let computations = async {
+            let! arr = Async.Parallel (List.map compute [1 .. 100])
+            let res = Seq.fold (+) 0 arr
+            let mails = mailbox.PostAndReply(fun chan -> Fetch chan)
+            do test "test6b - mailbox & PostAndAsyncReply" (res = mails)
+        }
+        Async.RunSynchronously computations
+
+    // TryPostAndReply
+    let test6c() =
+        printfn "starting test6c"
+        mailbox.Post(Reset)
+        let computations = async {
+            let! arr = Async.Parallel (List.map compute [1 .. 100])
+            let res = Seq.fold (+) 0 arr
+            let mails = mailbox.TryPostAndReply(fun chan -> Fetch chan)
+            do test "test6c - mailbox & TryPostAndReply" (res = Option.get mails)
+        }
+        Async.RunSynchronously computations
+
+    // PostAndTryAsyncReply
+    let test6d() =
+        printfn "starting test6d"
+        mailbox.Post(Reset)
+        let computations =
+            let arr = Async.RunSynchronously (Async.Parallel (List.map compute [1 .. 50]))
+            Seq.fold (+) 0 arr
+
+        printfn "running test6d: sent messages OK"
+        let mails = mailbox.PostAndTryAsyncReply(fun chan -> Fetch chan) |> Async.RunSynchronously
+        test "test6d - mailbox & TryPostAndReply" (computations = Option.get mails)
+
+    // PostAndAsyncReply
+    let test6e() =
+        printfn "starting test6e"
+        mailbox.Post(Reset)
+        let computations =
+            let arr = Async.RunSynchronously (Async.Parallel (List.map compute [1 .. 50]))
+            Seq.fold (+) 0 arr
+
+        let mails = mailbox.PostAndAsyncReply(fun chan -> Fetch chan) |> Async.RunSynchronously
+        test "test6d - mailbox & PostAndReply" (computations = mails)
+
+    test6a()
+    test6b()
+    test6c()
+    test6d()
+    test6e()
+
+(*
+// like 6, with futures
+let test7() =
+    printfn "starting test7"
+    mailbox.Post(Reset)
+    let computations =
+        let arr = Array.init 50 (fun i -> Async.SpawnFuture (compute i))
+        arr |> Seq.fold (fun n f -> n + f.Value) 0
+
+    let mails = mailbox.PostAndReply(fun chan -> Fetch chan)
+    test "test7 - mailbox & futures" (computations = mails)
+*)
+
+
+let timeoutboxes str = new MailboxProcessor<'b>(fun inbox ->
+    async { for i in 1 .. 10 do
+#if NetCore
+                Task.Delay(200).Wait()
+#else
+                do System.Threading.Thread.Sleep 200
+#endif
+                })
+
+// Timeout
+let timeout_tpar() =
+    printfn "started timeout_tpar"
+    let tbox = timeoutboxes "timeout_tpar"
+    tbox.Start()
+    let mails = tbox.TryPostAndReply((fun chan -> Fetch chan), 50)
+    test "default timeout & TryPostAndReply" (mails = None)
+
+// Timeout
+let timeout_tpar_def() =
+    printfn "started timeout_tpar_def"
+    let tbox = timeoutboxes "timeout_tpar"
+    tbox.Start()
+    tbox.DefaultTimeout <- 50
+    let mails = tbox.TryPostAndReply((fun chan -> Fetch chan))
+    test "timeout & TryPostAndReply" (mails = None)
+
+// Timeout
+let timeout_tpara() =
+    printfn "started timeout_tpara"
+    let tbox = timeoutboxes "timeout_tpara"
+    tbox.Start()
+    let mails = tbox.PostAndTryAsyncReply((fun chan -> Fetch chan), 50) |> Async.RunSynchronously
+    test "timeout & PostAndTryAsyncReply" (mails = None)
+
+// Timeout
+let timeout_tpara_def() =
+    printfn "started timeout_tpara_def"
+    let tbox = timeoutboxes "timeout_tpara_def"
+    tbox.Start()
+    tbox.DefaultTimeout <- 50
+    let mails = tbox.PostAndTryAsyncReply((fun chan -> Fetch chan)) |> Async.RunSynchronously
+    test "default timeout & PostAndTryAsyncReply" (mails = None)
+
+
+// Timeout
+let timeout_par() =
+    printfn "started timeout_para"
+    let tbox = timeoutboxes "timeout_par"
+    tbox.Start()
+    try tbox.PostAndReply(ignore, 50)
+        test "default timeout & PostAndReply" false
+    with _ -> test "default timeout & PostAndReply" true
+
+// Timeout
+let timeout_par_def() =
+    printfn "started timeout_par"
+    let tbox = timeoutboxes "timeout_par"
+    tbox.Start()
+    tbox.DefaultTimeout <- 50
+    try tbox.PostAndReply(ignore)
+        test "timeout & PostAndReply" false
+    with _ -> test "timeout & PostAndReply" true
+
+// Timeout
+let timeout_para() =
+    printfn "started timeout_para"
+    let tbox = timeoutboxes "timeout_para"
+    tbox.Start()
+    try tbox.PostAndAsyncReply(ignore, 50) |> Async.RunSynchronously |> ignore
+        test "timeout & PostAndAsyncReply" false
+    with _ -> test "timeout & PostAndAsyncReply" true
+
+// Timeout
+let timeout_para_def() =
+    printfn "started timeout_para_def"
+    let tbox = timeoutboxes "timeout_para_def"
+    tbox.Start()
+    tbox.DefaultTimeout <- 50
+    try tbox.PostAndAsyncReply(ignore) |> Async.RunSynchronously |> ignore
+        test "default timeout & PostAndAsyncReply" false
+    with _ -> test "default timeout & PostAndAsyncReply" true
+
+// Useful class: put "checkpoints" in the code.
+// Check they are called in the right order.
+type Path(str) =
+    let mutable current = 0
+    member p.Check n = check (str + " #" + string (current+1)) n (current+1)
+                       current <- n
+
+
+test5()
+test6()
+timeout_para()
+timeout_par()
+timeout_para_def()
+timeout_par_def()
+timeout_tpara()
+timeout_tpar()
+timeout_tpara_def()
+timeout_tpar_def()
+// ToDo: 7/31/2008: Disabled because of probable timing issue.  QA needs to re-enable post-CTP.
+// Tracked by bug FSharp 1.0:2891
+//test15()
+// ToDo: 7/31/2008: Disabled because of probable timing issue.  QA needs to re-enable post-CTP.
+// Tracked by bug FSharp 1.0:2891
+//test15b()
+
+module LotsOfMessages = 
+    let test () =
+        let N = 200000
+        let count = ref N
+
+        let logger = MailboxProcessor<_>.Start(fun inbox ->
+            let rec run i = 
+                async { let! s = inbox.Receive()
+                        decr count
+                        return! run (i + 1) }
+            run 0)
+    
+        printfn "filling queue with 200K messages..."
+        
+        for i = 0 to 200000 do
+            logger.Post("Message!")
+
+        let mutable queueLength = logger.CurrentQueueLength 
+    
+        while !count > 0  do 
+            printfn "waiting for queue to drain... Done when %d reaches 0" !count
+            check "celrv09ervkn" (queueLength >= logger.CurrentQueueLength) true
+            queueLength <- logger.CurrentQueueLength 
+    
+#if NetCore
+            Task.Delay(10).Wait()
+#else
+            System.Threading.Thread.Sleep(10)
+#endif
+        check "celrv09ervknf3ew" logger.CurrentQueueLength 0
+    test()
+
+#if Portable
+let aa = if not failures.IsEmpty then exit 1 else stdout.WriteLine "Test Passed"; exit 0
+#else
+let _ = 
+  if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!"
+        System.IO.File.WriteAllText("test.ok","ok"); 
+// debug: why is the fsi test failing?  is it because test.ok does not exist?
+        if System.IO.File.Exists("test.ok") then
+            stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName)
+        else
+            stdout.WriteLine ("test.ok not found")
+        exit 0)
+#endif
\ No newline at end of file
diff --git a/tests/fsharp/core/controlStackOverflow/build.bat b/tests/fsharp/core/controlStackOverflow/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/controlStackOverflow/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlStackOverflow/run.bat b/tests/fsharp/core/controlStackOverflow/run.bat
new file mode 100644
index 0000000..ba4fe87
--- /dev/null
+++ b/tests/fsharp/core/controlStackOverflow/run.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set fsi_flags= --tailcalls
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/controlStackOverflow/test.fsx b/tests/fsharp/core/controlStackOverflow/test.fsx
new file mode 100644
index 0000000..63f3278
--- /dev/null
+++ b/tests/fsharp/core/controlStackOverflow/test.fsx
@@ -0,0 +1,436 @@
+// #Conformance #ComputationExpressions #Async 
+
+#if Portable
+module Core_controlStackOverflow
+#endif
+
+#light
+
+#nowarn "40" // recursive references
+
+#if NetCore
+open System.Threading.Tasks
+#endif
+
+let biggerThanTrampoliningLimit = 10000
+
+let failuresFile =
+   let f = System.Environment.GetEnvironmentVariable("CONTROL_FAILURES_LOG")
+   match f with
+   | "" | null -> "failures.log"
+   | _ -> f
+
+printfn "failures file: %s" failuresFile
+
+let log msg = 
+  printfn "%s" msg
+  System.IO.File.AppendAllText(failuresFile, sprintf "%A: %s\r\n" System.DateTime.Now msg)
+
+
+let mutable failures = []
+let syncObj = new obj()
+let report_failure s = 
+  stderr.WriteLine " NO"; 
+  lock syncObj (fun () ->
+     failures <- s :: failures;
+     log (sprintf "FAILURE: %s failed" s)
+  )
+
+#if Portable
+#else
+System.AppDomain.CurrentDomain.UnhandledException.AddHandler(
+       fun _ (args:System.UnhandledExceptionEventArgs) ->
+          lock syncObj (fun () ->
+                failures <- (args.ExceptionObject :?> System.Exception).ToString() :: failures
+             )
+)
+#endif
+
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s 
+
+let checkQuiet s x1 x2 = 
+    if x1 <> x2 then 
+        (test s false; printfn "expected: %A, got %A" x2 x1)
+
+let check s x1 x2 = 
+    if x1 = x2 then test s true
+    else (test s false; printfn "expected: %A, got %A" x2 x1)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(*******************************************************************************)
+open Microsoft.FSharp.Control
+open Microsoft.FSharp.Control.WebExtensions
+
+
+module StackDiveTests =
+  [<Sealed>]
+  type AsyncResultCell<'T>() =
+    let mutable result = None
+    let mutable savedConts : ('T -> unit) list = []
+    
+    let syncRoot = new obj()
+            
+    member x.RegisterResult (res:'T) =
+        let grabbedConts = 
+            lock syncRoot (fun () ->
+                if result.IsSome then  
+                    []
+                else
+                    result <- Some res;
+                    List.rev savedConts)
+        match grabbedConts with
+        |   [] -> ()
+        |   [cont] -> cont res 
+        |   otherwise -> failwith "other"
+
+    member x.AsyncResult =
+        Async.FromContinuations(fun (cont,_,_) -> 
+            let grabbedResult = 
+                lock syncRoot (fun () ->
+                    match result with
+                    | Some res -> 
+                        result
+                    | None ->
+                        savedConts <- cont::savedConts
+                        None)
+            match grabbedResult with 
+            | None -> ()
+            | Some res -> cont res) 
+  let test() =
+      let Main() =
+        async {
+
+            // Create the channels
+            let channels = [| for i in 0 .. 100000 -> new AsyncResultCell<int>() |]
+
+            // For each channel pair, start a task that takes the result from the right and sends it to the left
+            channels 
+                |> Seq.pairwise 
+                |> Seq.iter (fun (c1,c2) -> 
+                      Async.Start (async { let! res = c2.AsyncResult 
+                                           c1.RegisterResult(res + 1); }))
+
+
+            // Send the first message to the last on the right
+            channels.[100000].RegisterResult(0);
+
+            // Wait for the result from the first on the left
+            let! res = channels.[0].AsyncResult
+
+            return res
+        } |> Async.RunSynchronously
+  
+      check "albatross"
+         (Main())
+         100000
+
+      let rec so n = 
+        async { if n = 0 then return 1 
+                else
+                  let! res = so (n-1)
+                  return res + 1  }
+
+      check "whale-1"
+         (so 1000000 |> Async.RunSynchronously)
+         1000001
+
+
+      let rec so2 n = 
+        async { if n = 0 then return 1 
+                else return! so2 (n-1) }
+
+      check "whale-2"
+         (so2 1000000 |> Async.RunSynchronously)
+         1
+
+
+      let rec so3 n = 
+        async { try 
+                  if n = 0 then return 1 
+                  else return! so3 (n-1) 
+                with e -> return 3 }
+
+      check "whale-3"
+         (so3 1000000 |> Async.RunSynchronously)
+         1
+
+
+      let rec so4 n = 
+        async { try 
+                  if n = 0 then return 1 
+                  else return! so4 (n-1) 
+                finally 
+                   () }
+
+      check "whale-4"
+         (so4 1000000 |> Async.RunSynchronously)
+         1
+  
+      let justRun x = Async.FromContinuations(fun (c,e,cc) -> c x)
+      let rec so5 n =
+        async {
+            if n = 0 then return 1
+            else 
+                let! x = justRun n
+                return! so5 (n-1)
+        }
+      check "whale-5"
+         (so5 1000000 |> Async.RunSynchronously)
+         1
+     
+      let contAsync x = 
+        Async.FromContinuations(fun (c,e,cc) ->
+            Async.StartWithContinuations (async { return x },c,e,cc))
+        
+      let rec so6 n =
+            async {
+                if n = 0 then return 6
+                else 
+                    let! x = contAsync n
+                    return! so6 (n-1)
+            }
+      check "whale-6"
+          (so6 1000000 |> Async.RunSynchronously)
+          6
+
+      let throwingAsync =
+            Async.FromContinuations(fun (c,e,_) -> e <| System.InvalidOperationException())
+        
+      let rec so7 n =
+            async {
+                if n = 0 then return 7
+                else
+                    try 
+                        do! throwingAsync
+                    with
+                    | :? System.InvalidOperationException -> 
+                        let! _ = so7 (n-1)
+                        ()
+                    return 85
+            }
+      check "whale-7"
+          (so7 100000 |> Async.RunSynchronously)
+          85
+      
+      let throwingAsync' =
+            Async.FromContinuations(fun (c,e,_) -> raise <| System.InvalidOperationException())
+        
+      let rec so7' n =
+            async {
+                if n = 0 then return "7'"
+                else
+                    try 
+                        do! throwingAsync'
+                    with
+                    | :? System.InvalidOperationException -> 
+                        let! _ = so7' (n-1)
+                        ()
+                    return "7'"
+            }
+      check "whale-7'"
+          (so7' 100000 |> Async.RunSynchronously)
+          "7'"
+
+      let quwiAsync x =
+            Async.FromContinuations(fun (c,_,_) ->
+#if NetCore
+                Task.Run(
+                    fun _ -> 
+                        async { 
+                            do c x
+                            return()
+                        } |> Async.StartImmediate
+                ) |> ignore)
+#else            
+                System.Threading.ThreadPool.QueueUserWorkItem(
+                    fun _ -> 
+                        async { 
+                            do c x
+                            return()
+                        } |> Async.StartImmediate
+                ) |> ignore)
+#endif
+  
+      let rec so8 n =
+            async {
+                if n = 0 then return 8
+                else
+                    let! n = quwiAsync (n-1)
+                    for i in 1..biggerThanTrampoliningLimit do
+                        ()
+                    return! so8 n
+            }
+      check "whale-8"
+          (so8 10000 |> Async.RunSynchronously)
+          8
+
+  test()
+
+module ReturnStackoverflow =
+    let test () =
+        let rec so n = 
+          async { if n = 0 then return 1 
+                  else 
+                    try 
+                        return! so (n-1)
+                    finally ()  }
+
+        check "so-return"
+            (so 2000000 |> Async.RunSynchronously)
+            1
+
+        let rec so2 n = 
+          async { if n = 0 then new System.InvalidOperationException() |> raise
+                  else 
+                    try 
+                        return! so2 (n-1)
+                    finally ()  }
+
+        check "so-return2"
+            (try
+                so2 2000000 |> Async.RunSynchronously
+                "fail"
+             with
+             | :? System.InvalidOperationException -> "success")
+            "success"
+
+        let rec so3 n = 
+          async { if n = 0 then return 1 
+                  else 
+                    try 
+                        return! so3 (n-1)
+                    with _ -> return 3  }
+
+        check "so-return3"
+            (so3 2000000 |> Async.RunSynchronously)
+            1
+
+        let rec so4 n = 
+          async { if n = 0 then return (new System.InvalidOperationException() |> raise)
+                  else 
+                    try 
+                        return! so4 (n-1)
+                    with _ -> return 1  }
+        check "so-return4"
+            (so4 2000000 |> Async.RunSynchronously)
+            1
+
+        let rec so5 n = 
+          async { if n = 0 then return 1
+                  else 
+                    try 
+                        raise (new System.InvalidOperationException())
+                        return 27
+                    with _ -> 
+                        let! i = so5 (n-1)
+                        return i
+                }
+        check "so-return5"
+            (so5 1000000 |> Async.RunSynchronously)
+            1
+
+        let rec so6 n = 
+          async { if n = 0 then raise (new System.InvalidOperationException())
+                  else 
+                    try 
+                        raise (new System.InvalidOperationException())
+                    with _ -> 
+                        let! i = so6 (n-1)
+                        return i
+                }
+        check "so-return6"
+            (try
+                so6 1000000 |> Async.RunSynchronously
+                1
+             with 
+             | :? System.InvalidOperationException -> 42)
+            42
+
+        let cts = new System.Threading.CancellationTokenSource() in
+        let rec so7 n =
+            Async.TryCancelled(
+                async {
+                    if n = 0 then 
+                        cts.Cancel()
+                        return ()
+                    else
+                        do! so7 (n-1)
+                },
+                fun cexn -> ()
+            ) in
+        check "so-return7" 
+            (try
+                Async.RunSynchronously(so7 100000,cancellationToken=cts.Token)
+                "fail"
+             with
+             |  :? System.OperationCanceledException -> "success")
+            "success"
+
+        let rec so8 n = 
+          async { if n = 0 then return (new System.InvalidOperationException() |> raise)
+                  else 
+                    try 
+                        return! so8 (n-1)
+                    with _ -> 
+                        raise (new System.InvalidOperationException())
+                        return 1  }
+        check "so-return8"
+            (try
+                so8 2000000 |> Async.RunSynchronously            
+             with
+             | :? System.InvalidOperationException -> 56
+             )
+            56
+
+        let cts1 = new System.Threading.CancellationTokenSource() in
+        let rec so9 n =
+            Async.TryCancelled(
+                async {
+                    if n = 0 then 
+                        cts1.Cancel()
+                        return ()
+                    else
+                        do! so9 (n-1)
+                },
+                fun cexn -> raise (new System.InvalidOperationException())
+            ) in
+        check "so-return9" 
+            (try
+                Async.RunSynchronously(so9 2000000,cancellationToken=cts1.Token)
+                "fail"
+             with
+             |  :? System.OperationCanceledException -> "success")
+            "success"
+
+    test()
+(*******************************************************************************)
+#if Portable
+let aa = 
+    if not failures.IsEmpty then exit 1
+    else stdout.WriteLine "Test Passed"; exit 0
+#else
+let _ = 
+  if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!"
+        System.IO.File.WriteAllText("test.ok","ok"); 
+// debug: why is the fsi test failing?  is it because test.ok does not exist?
+        if System.IO.File.Exists("test.ok") then
+            stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName)
+        else
+            stdout.WriteLine ("test.ok not found")
+        exit 0)
+#endif
diff --git a/tests/fsharp/core/controlWebExt/build.bat b/tests/fsharp/core/controlWebExt/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/controlWebExt/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlWebExt/run.bat b/tests/fsharp/core/controlWebExt/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/controlWebExt/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/controlWebExt/test.fsx b/tests/fsharp/core/controlWebExt/test.fsx
new file mode 100644
index 0000000..d23f910
--- /dev/null
+++ b/tests/fsharp/core/controlWebExt/test.fsx
@@ -0,0 +1,162 @@
+// #Conformance #ComputationExpressions #Async 
+#light
+
+let failuresFile =
+   let f = System.Environment.GetEnvironmentVariable("CONTROL_FAILURES_LOG")
+   match f with
+   | "" | null -> "failures.log"
+   | _ -> f
+
+let log msg = 
+  printfn "%s" msg
+  System.IO.File.AppendAllText(failuresFile, sprintf "%A: %s\r\n" System.DateTime.Now msg)
+
+let mutable failures = []
+let syncObj = new obj()
+let report_failure s = 
+  stderr.WriteLine " NO"; 
+  lock syncObj (fun () ->
+     failures <- s :: failures;
+     log (sprintf "FAILURE: %s failed" s)
+  )
+
+System.AppDomain.CurrentDomain.UnhandledException.AddHandler(
+       fun _ (args:System.UnhandledExceptionEventArgs) ->
+          lock syncObj (fun () ->
+                failures <- (args.ExceptionObject :?> System.Exception).ToString() :: failures
+             )
+)
+
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s 
+let check s x1 x2 = 
+    if x1 = x2 then test s true
+    else (test s false; printfn "expected: %A, got %A" x2 x1)
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+open System.Threading
+open Microsoft.FSharp.Control
+open Microsoft.FSharp.Control.WebExtensions
+
+module WebResponseTests = 
+    open System
+    open System.IO
+    open System.Net
+    open Microsoft.FSharp.Control.WebExtensions
+
+    /// Fetch the contents of a web page
+    let httpAsync(url: string) = 
+        async { 
+            let req    = System.Net.WebRequest.Create(url) 
+            use! resp   = req.AsyncGetResponse()         // note 'use' = C# 'using'
+            use stream = resp.GetResponseStream() 
+            use reader = new StreamReader(stream) 
+            let html   = reader.ReadToEnd()
+            return html
+        }
+
+
+    //This test starts ~600 web requests plus routines to cancel them. The tests are robust 
+    //to whether there is a web connection or not � we  just catch all exceptions, and use one good URL 
+    //and one bad URL, so we know we work under both conditions. The aim of the tests is to get coverage 
+    //for cancellation logic paths � we count the number of request routines that have successfully entered 
+    //a try/finally that increments/decrements a counter. We check that the counter is zero at the end.  
+    let repeatedFetchAndCancelTest() = 
+        printfn "starting requests and cancellation routines..." 
+        let active = ref 0
+        for i = 0 to 100 do 
+          for sleep in [0;2;10] do 
+           for url in ["http://www.live.com"; "http://www.badnonexistenturl-da-da-da-da-da.com"] do 
+             let cts = new CancellationTokenSource()
+             let result = ref 0
+             
+             Async.Start (async { let incremented = ref false
+                               try 
+                                 try 
+                                   lock active (fun () -> incr active; incremented := true)
+                                   let! p1 = httpAsync(url)
+                                   let! p2 = httpAsync(url)
+                                   result := p1.Length + p2.Length 
+                                 finally
+                                   lock active (fun () -> if !incremented then decr active) 
+                               with _ -> 
+                                  return () }, cancellationToken=cts.Token)
+             System.Threading.Thread.Sleep(sleep)
+             Async.Start ( async {  do! Async.Sleep(100)
+                                    cts.Cancel() })
+        let wait = ref 0 
+        while !active <> 0 && !wait < 500 do
+            incr wait
+            printfn "final: active = %d, waiting %d" !active (!wait * 3)
+            System.Threading.Thread.Sleep(!wait * 3)
+        
+        check "WebRequest cancellation test final result" !active 0
+
+    repeatedFetchAndCancelTest()
+
+
+module WebClientTests = 
+
+    //This test starts ~600 web requests plus routines to cancel them. The tests are robust 
+    //to whether there is a web connection or not � we  just catch all exceptions, and use one good URL 
+    //and one bad URL, so we know we work under both conditions. The aim of the tests is to get coverage 
+    //for cancellation logic paths � we count the number of request routines that have successfully entered 
+    //a try/finally that increments/decrements a counter. We check that the counter is zero at the end.  
+    let repeatedFetchAndCancelTest() = 
+        printfn "starting requests and cancellation routines..." 
+        let active = ref 0
+        for i = 0 to 100 do 
+          for sleep in [0;2;10] do 
+           for url in ["http://www.live.com"; "http://www.badnonexistenturl-da-da-da-da-da.com"] do 
+             let cts = new CancellationTokenSource()
+             let result = ref 0
+             
+             Async.Start (async { let incremented = ref false
+                               try 
+                                 try 
+                                   lock active (fun () -> incr active; incremented := true)
+                                   let c = new System.Net.WebClient()
+                                   let! p1 = c.AsyncDownloadString(System.Uri(url))
+                                   let! p2 = c.AsyncDownloadString(System.Uri(url))
+                                   result := p1.Length + p2.Length 
+                                 finally
+                                   lock active (fun () -> if !incremented then decr active) 
+                               with _ -> 
+                                   return ()}, cancellationToken=cts.Token)
+
+             System.Threading.Thread.Sleep(sleep)
+             Async.Start ( async {  do! Async.Sleep(100)
+                                    cts.Cancel() })
+        let wait = ref 0 
+        while !active <> 0 && !wait < 500 do
+            incr wait
+            printfn "final: active = %d, waiting %d" !active (!wait * 3)
+            System.Threading.Thread.Sleep(!wait * 3)
+
+        printfn "final: active = %d" !active
+        check "WebClient cancellation test final result" !active 0
+
+    repeatedFetchAndCancelTest()
+
+
+let _ = 
+  if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!"
+        System.IO.File.WriteAllText("test.ok","ok"); 
+// debug: why is the fsi test failing?  is it because test.ok does not exist?
+        if System.IO.File.Exists("test.ok") then
+            stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName)
+        else
+            stdout.WriteLine ("test.ok not found")
+        exit 0)
+
diff --git a/tests/fsharp/core/controlWpf/build.bat b/tests/fsharp/core/controlWpf/build.bat
new file mode 100644
index 0000000..f352dbd
--- /dev/null
+++ b/tests/fsharp/core/controlWpf/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+ 
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlWpf/dont.pipe.to.stdin b/tests/fsharp/core/controlWpf/dont.pipe.to.stdin
new file mode 100644
index 0000000..70cbdcc
--- /dev/null
+++ b/tests/fsharp/core/controlWpf/dont.pipe.to.stdin
@@ -0,0 +1 @@
+does not support piping form stdin
diff --git a/tests/fsharp/core/controlWpf/run.bat b/tests/fsharp/core/controlWpf/run.bat
new file mode 100644
index 0000000..7b0b526
--- /dev/null
+++ b/tests/fsharp/core/controlWpf/run.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/controlWpf/test.fsx b/tests/fsharp/core/controlWpf/test.fsx
new file mode 100644
index 0000000..25ad5ef
--- /dev/null
+++ b/tests/fsharp/core/controlWpf/test.fsx
@@ -0,0 +1,39 @@
+#light
+#r "WindowsBase"
+#r "PresentationFramework"
+#r "System.Xaml"
+open System.Threading
+open System.Windows.Threading
+open System.Net
+open Microsoft.FSharp.Control.WebExtensions
+
+let dsc = new DispatcherSynchronizationContext()
+SynchronizationContext.SetSynchronizationContext(dsc)
+let thread = System.Threading.Thread.CurrentThread
+
+let app = new System.Windows.Application()
+
+async {
+    let req = WebRequest.Create("http://foo.bar.baz")
+    do!
+        async {
+            try
+                let! _ =  req.AsyncGetResponse()
+                return ()
+            with
+            |   e -> return ()
+        }
+    if not (System.Threading.Thread.CurrentThread.Equals(thread)) then
+        printfn "Test Failed"
+        app.Shutdown(128)
+    else
+        printfn "Test Passed"
+        System.IO.File.WriteAllText("test.ok","ok")
+        app.Shutdown(0)
+} |> Async.StartImmediate
+
+[<System.STAThread>]
+do ()
+
+
+app.Run()
diff --git a/tests/fsharp/core/csext/System.Core.dll b/tests/fsharp/core/csext/System.Core.dll
new file mode 100644
index 0000000..962ef8a
Binary files /dev/null and b/tests/fsharp/core/csext/System.Core.dll differ
diff --git a/tests/fsharp/core/csext/build.bat b/tests/fsharp/core/csext/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/csext/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/csext/run.bat b/tests/fsharp/core/csext/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/csext/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/csext/test.fsx b/tests/fsharp/core/csext/test.fsx
new file mode 100644
index 0000000..7e5cbe8
--- /dev/null
+++ b/tests/fsharp/core/csext/test.fsx
@@ -0,0 +1,53 @@
+// #Conformance #Structs #Interop 
+#if Portable
+module Core_csext
+#endif
+#light
+
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+open System.Linq
+
+let x = [1;2;3]
+
+let xie = (x :> seq<_>)
+
+xie.All(fun x -> x > 1)
+
+xie.Average()
+x.Average()
+
+[<Struct>]
+type S(v:int) =
+    interface System.Collections.Generic.IEnumerable<int> with 
+        member x.GetEnumerator() = (Seq.singleton v).GetEnumerator() 
+    interface System.Collections.IEnumerable with 
+        member x.GetEnumerator() = ((Seq.singleton v).GetEnumerator() :> System.Collections.IEnumerator)
+
+let s : S = S(3)
+
+s.Average()
+
+        
+[<Struct>]
+type Struct(i:int) = 
+    static let yellowStruct  = Struct(1)
+    static let blueStruct  = Struct(0)
+
+    static member YellowStruct  = yellowStruct
+    static member BlueStruct  = blueStruct
+
+
+(*--------------------*)  
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/csfromfs/Excel.dll b/tests/fsharp/core/csfromfs/Excel.dll
new file mode 100644
index 0000000..05b3dd9
Binary files /dev/null and b/tests/fsharp/core/csfromfs/Excel.dll differ
diff --git a/tests/fsharp/core/csfromfs/ProtectedMethodOpt.cs b/tests/fsharp/core/csfromfs/ProtectedMethodOpt.cs
new file mode 100644
index 0000000..e171a0e
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/ProtectedMethodOpt.cs
@@ -0,0 +1,8 @@
+namespace TestBaseClass
+{
+    public class BaseClass
+    {
+        protected static int ProtectedStatic() { return 3; }
+    }
+}
+
diff --git a/tests/fsharp/core/csfromfs/ProtectedMethodOpt.fs b/tests/fsharp/core/csfromfs/ProtectedMethodOpt.fs
new file mode 100644
index 0000000..4495669
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/ProtectedMethodOpt.fs
@@ -0,0 +1,11 @@
+open TestBaseClass
+type DerivedClass() = class
+    inherit BaseClass()
+        
+    member x.SomeMethod() = BaseClass.ProtectedStatic()
+    static member AnotherMethod() = BaseClass.ProtectedStatic()
+end
+ 
+let r1 = DerivedClass().SomeMethod()
+let r2 = DerivedClass.AnotherMethod()
+ 
diff --git a/tests/fsharp/core/csfromfs/build.bat b/tests/fsharp/core/csfromfs/build.bat
new file mode 100644
index 0000000..77aa6ce
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/build.bat
@@ -0,0 +1,212 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+REM **************************
+
+REM only a valid test if generics supported
+
+  "%FSC%" %fsc_flags% -o:collections.exe -g collections.fs
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" collections.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+REM only a valid test if generics supported
+
+  %CSC% /nologo /target:library /out:classes-lib.dll classes.cs 
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags% -r:classes-lib.dll -o:classes.exe -g classes.fs
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" classes.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+
+
+REM **************************
+
+REM only a valid test if generics supported
+  %CSC% /nologo /target:library /out:byrefs-lib.dll byrefs.cs 
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags% -r:byrefs-lib.dll -o:byrefs.exe -g byrefs.fs
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" byrefs.exe
+  @if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+%CSC% /nologo /target:library /out:methods-lib.dll methods.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:methods-lib.dll -o:methods.exe -g methods.fs
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" methods.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+%CSC% /nologo /target:library /out:events-lib.dll events.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --progress -r:events-lib.dll -o:events.exe -g events.fs
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" events.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+%CSC% /nologo /target:library /out:indexers-lib.dll indexers.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:indexers-lib.dll -o:indexers.exe -g indexers.fs
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" indexers.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+%CSC% /nologo /target:library /out:fields-lib.dll fields.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:fields-lib.dll -o:fields.exe -g fields.fs
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" fields.exe 
+  @if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+%CSC% /nologo /target:library /out:properties-lib.dll properties.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:properties-lib.dll -o:properties.exe -g properties.fs
+ at if ERRORLEVEL 1 goto Error
+
+
+  "%PEVERIFY%" properties.exe 
+  @if ERRORLEVEL 1 goto Error
+REM **************************
+
+%CSC% /nologo /target:library /out:nested-types-cslib.dll nested-types.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:nested-types-cslib.dll -o:nested-types.exe -g nested-types.fs
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" nested-types.exe
+ at if ERRORLEVEL 1 goto Error
+
+set old_fsc_flags=%fsc_flags%
+
+set fsc_flags=%fsc_flags% -r:nested-types-cslib.dll
+call ..\..\single-neg-test.bat nested-types-error
+set fsc_flags=%old_fsc_flags%
+
+ at if ERRORLEVEL 1 goto Error
+
+  
+REM **************************
+REM Dev11 bug 47156
+
+%CSC% /nologo /target:library /out:ProtectedMethodOpt_lib.dll ProtectedMethodOpt.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:ProtectedMethodOpt_lib.dll -o:ProtectedMethodOpt.exe --optimize+ ProtectedMethodOpt.fs
+ at if ERRORLEVEL 1 goto Error
+
+
+  "%PEVERIFY%" ProtectedMethodOpt.exe 
+  @if ERRORLEVEL 1 goto Error
+
+REM **************************
+REM Excel interop
+
+REM only a valid test if generics supported
+
+REM Don't try to compile without Office installed, will fail verification on Dev10
+
+set OfficeExists=0
+ at ECHO Probing for well-known Office/Excel locations. It is ok to see errors like "The system was unable to find the specified registry key..."
+REG>NUL >2&1 QUERY HKLM\SOFTWARE\Microsoft\Office\11.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+REG>NUL QUERY HKLM\SOFTWARE\Microsoft\Office\12.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+REG>NUL QUERY HKLM\SOFTWARE\Microsoft\Office\14.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+REG>NUL QUERY HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\11.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+REG>NUL QUERY HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+REG>NUL QUERY HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Excel\InstallRoot
+IF "%ERRORLEVEL%"=="0" set OfficeExists=1&&goto :EndCheckForOffice
+:EndCheckForOffice
+
+IF %OfficeExists%==1 (
+  "%FSC%" %fsc_flags% -r:Excel.dll -o:optional.exe -g optional.fs
+  @if ERRORLEVEL 1 goto Error
+   "%PEVERIFY%" optional.exe
+  @if ERRORLEVEL 1 goto Error
+)
+
+
+REM **************************
+REM Multi-module case
+
+%CSC% /nologo /target:module /out:events-lib.netmodule events.cs 
+ at if ERRORLEVEL 1 goto Error
+%CSC% /nologo /target:module /out:properties-lib.netmodule properties.cs 
+ at if ERRORLEVEL 1 goto Error
+%CSC% /nologo /target:module /out:fields-lib.netmodule fields.cs 
+ at if ERRORLEVEL 1 goto Error
+%CSC% /nologo /target:module /out:indexers-lib.netmodule indexers.cs 
+ at if ERRORLEVEL 1 goto Error
+"%ALINK%" /target:library /out:multi-module-lib.dll events-lib.netmodule properties-lib.netmodule fields-lib.netmodule indexers-lib.netmodule 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:multi-module-lib.dll -o:multi-module.exe -g properties.fs fields.fs indexers.fs events.fs 
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" multi-module.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~n0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/csfromfs/byrefs.cs b/tests/fsharp/core/csfromfs/byrefs.cs
new file mode 100644
index 0000000..4dbc503
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/byrefs.cs
@@ -0,0 +1,64 @@
+
+
+
+
+namespace Byrefs
+{
+   public class Simple
+   { 
+      public static System.DateTime DateTimeChoice(System.DateTime x, System.DateTime y, bool z) 
+       { 
+           if (z) return x; else return y; 
+       }
+      public static System.DateTime DateTimeChoiceRef(ref System.DateTime x, ref System.DateTime y, bool z) 
+       { 
+           if (z) return x; else return y; 
+       }
+      public static void DateTimeChoiceOut(ref System.DateTime x, out System.DateTime y) 
+       { 
+           y = x; 
+       }
+   }
+   public class Generic<T>
+   { 
+
+      public T Choice(T x, T y, bool z) 
+       { 
+           if (z) return x; else return y; 
+       }
+      public T ChoiceRef(ref T x, ref T y, bool z) 
+       { 
+           if (z) return x; else return y; 
+       }
+      public void ChoiceOut(ref T x, out T y) 
+       { 
+           y = x; 
+       }
+   }
+   public class MakeGenerics
+   { 
+
+      public static Generic<int> MakeGenericInt()
+       { 
+           return new Generic<int>();
+       }
+   }
+	public class ClassWithStaticMethods
+	{
+            static public void OneIntegerOutParam(out int x) { x = 3; }
+	}
+
+	public class ClassWithVirtualMethods
+	{
+            virtual public void OneIntegerOutParam(out int x) { x = 3; }
+            virtual public void TwoIntegerOutParams(out int x, out int y) { x = -1; y = -1; }
+	}
+
+
+   public delegate void DelegateWithOneOutParam(int x, out int y);
+   public delegate void DelegateWithTwoOutParams(int x, out int y, out int z);
+
+}
+
+
+
diff --git a/tests/fsharp/core/csfromfs/byrefs.fs b/tests/fsharp/core/csfromfs/byrefs.fs
new file mode 100644
index 0000000..12e6ab0
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/byrefs.fs
@@ -0,0 +1,113 @@
+#indent "off"
+
+let failures = ref false
+let report_failure s  = 
+  stderr.WriteLine ("NO: test "+s+" failed"); failures.Value <- true
+
+let test s b = 
+  if not b then (stderr.WriteLine ("FAILED: "+s); failures.Value <- true)
+
+
+open Byrefs
+
+let testByrefs = 
+  let dt1 = System.DateTime.Now in 
+  let dt2 = System.DateTime.op_Subtraction(System.DateTime.Now, new System.TimeSpan(1,0,0)) in 
+  if (Simple.DateTimeChoice(dt1,dt2,true) <> dt1) then report_failure "NO! (cwejikwe)";
+  if (Simple.DateTimeChoice(dt1,dt2,false) <> dt2) then report_failure "NO! (cfew20jikwe)";
+
+  if (Simple.DateTimeChoiceRef(ref dt1,ref dt2,true) <> dt1) then report_failure "NO! (cwej25ikwe)";
+  if (Simple.DateTimeChoiceRef(ref dt1,ref dt2,false) <> dt2) then report_failure "NO! (cfew253220jikwe)";
+
+  let mutable mdt1 = System.DateTime.Now in 
+  let mutable mdt2 = System.DateTime.op_Subtraction(System.DateTime.Now, new System.TimeSpan(1,0,0)) in 
+  if (Simple.DateTimeChoice(mdt1,mdt2,true) <> mdt1) then report_failure "NO! (cwejikwe)";
+  if (Simple.DateTimeChoice(mdt1,mdt2,false) <> mdt2) then report_failure "NO! (cfew20jikwe)";
+
+  if (Simple.DateTimeChoiceRef(&mdt1,&mdt2,true) <> mdt1) then report_failure "NO! (cwej25ikwe)";
+  if (Simple.DateTimeChoiceRef(&mdt1,&mdt2,false) <> mdt2) then report_failure "NO! (cfew253220jikwe)";
+
+  let out = ref dt1 in 
+  Simple.DateTimeChoiceOut(ref dt2,out);
+  if !out <> dt2 then report_failure "NO! (cwejikwe)";
+
+  let mutable mout = mdt1 in 
+  Simple.DateTimeChoiceOut(&mdt2,&mout);
+  if mout <> mdt2 then report_failure "NO! (cwejikwe)";
+
+  let x = MakeGenerics.MakeGenericInt() in
+  if (x.Choice(1,2,true) <> 1) then report_failure "NO! (cwejikw544se)";
+  if (x.Choice(2,3,false) <> 3) then report_failure "NO! (cfew20jikw65h6ye)";
+
+  if (x.ChoiceRef(ref 1,ref 2,true) <> 1) then report_failure "NO! (cwejwecikwe)";
+  if (x.ChoiceRef(ref 2,ref 3,false) <> 3) then report_failure "NO! (cewcfew20jikwe)";
+
+  ()
+
+
+do test "fws321" (let res = ref 0 in ClassWithStaticMethods.OneIntegerOutParam(res); !res = 3)
+
+do test "fws322" (let x = {new ClassWithVirtualMethods() 
+                           with member __.OneIntegerOutParam(res) = res <- 4; 
+                                member __.TwoIntegerOutParams(res1, res2) = res1 <- res2; res2 <- 5} in
+                  let res0 = ref 0 in 
+                  let res1 = ref 0 in 
+                  let res2 = ref 2 in 
+                  x.OneIntegerOutParam(res0); 
+                  x.TwoIntegerOutParams(res1,res2); 
+                  !res0 = 4 &&
+                  !res1 = 2 &&
+                  !res2 = 5)
+         
+do test "fws322b" (let x = {new ClassWithVirtualMethods() 
+                            with member __.OneIntegerOutParam(res) = res <- 4; 
+                                 member __.TwoIntegerOutParams(res1, res2) = res1 <- res2; res2 <- 5} in
+                  let mutable res0 = 0 in 
+                  let mutable res1 = 0 in 
+                  let mutable res2 = 2 in 
+                  x.OneIntegerOutParam(&res0); 
+                  x.TwoIntegerOutParams(&res1,&res2); 
+                  res0 = 4 &
+                  res1 = 2 &
+                  res2 = 5)
+         
+
+(*
+do test "fws323" (let f = new DelegateWithOneOutParam(fun x y -> () ) in 
+                  let res = ref 0 in 
+                  f.Invoke(3,res); 
+                  !res = 0)
+*)
+         
+(*
+do test "fws323" (let f = new DelegateWithTwoOutParams(fun x y -> y <- x) in 
+                  let res = ref 0 in 
+                  f.Invoke(3,res); 
+                  !res = 3)
+         
+*)
+
+
+
+open System
+open System.Windows.Forms
+
+let form =  
+  { new Form() 
+    with member __.WndProc(m : Message byref) = base.WndProc(&m) } ;;
+form.Visible <- true;;
+
+let timer = new Timer()
+do timer.Interval <- 200 (* ms *)
+do timer.add_Tick(new EventHandler(fun _ _ -> form.Close()));;
+do timer.Start();;
+
+Application.Run(form);;
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/csfromfs/classes.cs b/tests/fsharp/core/csfromfs/classes.cs
new file mode 100644
index 0000000..084c2c8
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/classes.cs
@@ -0,0 +1,198 @@
+
+//****************************************************************************
+// properties
+//****************************************************************************
+
+namespace TypesWithProperties
+{
+	public interface Interface
+	{
+		object objectProperty {
+			get; 
+		}
+
+		string stringProperty {
+			get;
+		}
+	}
+
+	public interface Interface2
+	{
+		object objectProperty {
+			get; 
+		}
+
+		string stringProperty {
+			get;
+		}
+	}
+
+
+	public abstract class AbstractBase
+	{
+		public abstract int splitProperty {
+			get;
+			set;
+		}
+
+		public string stringProperty {
+			get {
+				return string.Copy("foo");
+			}
+		}
+	}
+
+	public abstract class DerivedAbstractClass : AbstractBase
+	{
+		public override int splitProperty {
+			set {
+				myValue = value;
+			}
+		}
+
+		protected int myValue;
+
+		public object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		new public string stringProperty() {
+			return null;
+		}
+	}
+
+	public class DerivedClass : DerivedAbstractClass, Interface {
+		public override int splitProperty {
+			get {
+				return myValue;
+			}
+		}
+
+		new private object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		new public int stringProperty {
+			get {
+				return 0;
+			}
+		}
+	}
+
+	public class ExplicitInterfaceClass : Interface, Interface2
+	{
+		public object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+
+		public string stringProperty {
+			get {
+				return string.Copy("foo");
+			}
+		}
+
+		string Interface.stringProperty {
+			get {
+				return null;
+			}
+		}
+	}
+
+    public abstract class PartialExplicitInterfaceClass1 : Interface, Interface2
+    {
+
+        public abstract object objectProperty { get; }
+
+        string Interface.stringProperty
+        {
+            get
+            {
+                return null;
+            }
+        }
+        
+        object Interface2.objectProperty
+        {
+            get
+            {
+                return null;
+            }
+        }
+
+        string Interface2.stringProperty
+        {
+            get
+            {
+                return null;
+            }
+        }
+
+
+    }
+
+}
+public struct MyStruct
+{
+    int x;
+    public MyStruct(int x) { this.x = x; }
+}
+
+
+public struct Nested
+{
+    public int v;
+    public void setV(int V) { v = V; }
+}
+
+public struct NestedNested
+{
+    public Nested v;
+    public void setV(int V) { v.setV(V); }
+}
+
+public class Container
+{
+    public Nested nested;
+    public readonly Nested nested2;
+    public NestedNested nestedNested;
+    public readonly NestedNested nestedNested2;
+    public Container() { }
+}
+
+
+public struct MyStructGeneric<T>
+{
+    T x;
+    public MyStructGeneric(T x) { this.x = x; }
+}
+
+
+public struct NestedGeneric<T>
+{
+    public T v;
+    public void setV(T V) { v = V; }
+}
+
+public struct NestedNestedGeneric<T>
+{
+    public NestedGeneric<T> v;
+    public void setV(T V) { v.setV(V); }
+}
+
+public class ContainerGeneric<T>
+{
+    public NestedGeneric<T> nested;
+    public readonly NestedGeneric<T> nested2;
+    public NestedNestedGeneric<T> nestedNested;
+    public readonly NestedNestedGeneric<T> nestedNested2;
+    public ContainerGeneric() { }
+}
+
+
diff --git a/tests/fsharp/core/csfromfs/classes.fs b/tests/fsharp/core/csfromfs/classes.fs
new file mode 100644
index 0000000..9a7c643
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/classes.fs
@@ -0,0 +1,353 @@
+#indent "off"
+
+
+
+let failures = ref false
+let test s b = 
+  if not b 
+  then (stderr.WriteLine ("FAILED: "+s); failures.Value <- true) 
+  else (stderr.WriteLine ("PASSED: "+s))
+
+
+let myComparer = {new System.Collections.IComparer with member x.Compare(a,b) = Unchecked.compare a b}
+
+let myGComparer () = {new System.Collections.Generic.IComparer<'a>
+                      with member x.Compare(a,b) = compare a b}
+
+let myFormattable = {new System.IFormattable with member x.ToString(fmt,fmtProvider) = "<to-string>"}
+let myEnum = 
+  let start = 10 in 
+  let x = ref start in  
+  {new System.Collections.IEnumerator 
+              with member __.Current = box("x = " + string !x) 
+                   member __.MoveNext() = (x := !x - 1; (!x > 0) )
+                   member __.Reset() = x := start}
+
+let iterate (e: System.Collections.IEnumerator) f = 
+  while (e.MoveNext()) do
+    f e.Current;
+  done
+
+let _ = iterate myEnum (fun obj -> Printf.printf "item = %s\n" (unbox obj))
+
+
+let iterateG (e: 'a System.Collections.Generic.IEnumerator) f = 
+  while (e.MoveNext()) do
+    f e.Current;
+  done
+
+
+let myEnumG = 
+  let start = 10 in 
+  let x = ref start in  
+  {new System.Collections.Generic.IEnumerator<string>
+              with member __.Current = "x = "+string !x
+    interface System.Collections.IEnumerator
+      with member __.Current = box ("x = "+string !x)
+           member __.MoveNext() = (x := !x - 1; (!x > 0) )
+           member __.Reset() = x := 0
+    interface System.IDisposable
+      with member __.Dispose() = () }
+
+let _ = iterateG myEnumG (fun s -> Printf.printf "generic item = %s\n" s)
+
+
+let myEnumG2 = 
+  let start = 10 in 
+  let x = ref start in  
+  {new System.Collections.Generic.IEnumerator<string>
+      with member __.Current = "x = "+string !x
+           member __.Dispose() = ()
+    interface System.Collections.IEnumerator
+      with member __.Current = box ("x = "+string !x)
+           member __.MoveNext() = (x := !x - 1; (!x > 0) )
+           member __.Reset() = x := 0 }
+let _ = iterateG myEnumG2 (fun s -> Printf.printf "generic item = %s\n" s)
+
+
+let myForm title n =
+  let res = 
+    {new System.Windows.Forms.Form() 
+      with member __.OnPaint(args) = base.OnPaint(args);  Printf.printf "OnPaint: n = %d\n" n
+           member __.OnResize(args) = base.OnResize(args); Printf.printf "OnResize: n = %d\n" n } in
+   res.Text <- title;
+   res
+
+let [<System.Obsolete("This is obsolete")>] 
+    myComparerFactory1() = 
+    {new System.Collections.IComparer with member __.Compare(a,b) = Unchecked.compare a b}
+
+
+let form1 = myForm "Here be the main form" 3
+let form2 = myForm "Here be a dialog" 4
+
+let a = new MyStruct(4) 
+let b = new MyStruct() 
+
+let a1 = new global.MyStruct(4) 
+let b2 = new global.MyStruct() 
+
+let g164 = {new TypesWithProperties.Interface 
+         with member __.objectProperty = box(1) 
+              member __.stringProperty = "abc" }
+let _ = test "g164 vriow" (unbox g164.objectProperty = 1)
+let _ = test "g164 vr2ow" (g164.stringProperty = "abc")
+         
+let _ = {new TypesWithProperties.AbstractBase() 
+         with member __.splitProperty with get() = 1  and set x = () }
+
+open System
+(* This one once created unverifiable code *)
+let concatstring = 
+  (new Decimal(0)).ToString() ^ 
+  (new Decimal(0)).ToString() ^ 
+  (new Decimal(0)).ToString() ^ 
+  (new Decimal(0)).ToString() ^ 
+  (new Decimal(0)).ToString() ^ 
+  (new Decimal(0)).ToString() ^ 
+  "test"
+
+do Printf.printf "concatstring = %s\n" concatstring
+
+// Nb. implicit conversion from lambda expressions to delegates for member applications only
+
+let x = new System.Windows.Forms.Form()
+do x.add_Paint(fun _ _ -> ())
+
+let x2 = new global.System.Windows.Forms.Form()
+do x2.add_Paint(fun _ _ -> ())
+
+module MutableStructTests = begin
+    let test2() =
+         let o = new Container() in
+         test "mutable struct test 1" (o.nested.v = 0);
+         test "mutable struct test 2" (o.nested2.v = 0);
+         o.nested.setV(1);
+         o.nested2.setV(1);
+         test "mutable struct test 3" (o.nested.v = 1);
+         test "mutable struct test 4" (o.nested2.v = 0);
+         
+         let o = new Container() in
+         test "mutable struct test 1b" (o.nestedNested.v.v = 0);
+         test "mutable struct test 2b" (o.nestedNested2.v.v = 0);
+         o.nestedNested.setV(1);
+         o.nestedNested2.setV(1);
+         test "mutable struct test 3b" (o.nestedNested.v.v = 1);
+         test "mutable struct test 4b" (o.nestedNested2.v.v = 0);
+
+         // This uses a named-argument-constructor-property-setter for the struct
+         let o = new Container(nested=Nested(v=1)) in
+         test "mutable struct test 5" (o.nested.v = 1)
+         
+
+         
+(* THis hits an NYI:         
+         
+         let o = new Container() in
+         test "mutable struct test 1b" (o.nestedNested.v.v = 0);
+         test "mutable struct test 2b" (o.nestedNested2.v.v = 0);
+         o.nestedNested.v.v <- 1;
+         o.nestedNested2.v.v <- 1;
+         test "mutable struct test 3b" (o.nestedNested.v.v = 1);
+         test "mutable struct test 4b" (o.nestedNested2.v.v = 0)
+*)
+
+    do test2()
+
+
+    type Test = struct
+       val mutable v: int
+       member t.setV v =
+           t.v <- v
+    end
+
+    let test2131() =
+         let mutable t = new Test() in
+         test "mutable struct test 5a" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 5b" (t.v  = 1);
+
+         let (* immutable *) t = new Test() in
+         test "mutable struct test 5c" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 5d" (t.v  = 0) // immutable!
+
+    do test2131()
+
+    type TestTest = struct
+       val mutable v: Test
+       member t.setV v =
+           t.v <- v
+    end
+
+    let test31r13() =
+         let mutable t = new Test() in
+         test "mutable struct test 6" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 7" (t.v  = 1);
+         let mutable t = new Test() in
+         test "mutable struct test 8" (t.v  = 0);
+         t.v <- 1;
+         test "mutable struct test 9" (t.v  = 1);
+
+(*
+         let mutable t = new TestTest() in
+         test "mutable struct test 10" (t.v.v  = 0);
+         t.v.v <- 1;
+         test "mutable struct test 11" (t.v.v  = 1);
+
+         let mutable t = new TestTest() in
+         test "mutable struct test 12" (t.v.v  = 0);
+         t.v.setV(1);
+         test "mutable struct test 13" (t.v.v  = 1);
+
+         let t = new TestTest() in
+         test "mutable struct test 14" (t.v.v  = 0);
+         t.v.setV(1);
+         test "mutable struct test 15" (t.v.v  = 0)
+*)
+
+    do test31r13()
+end
+
+
+module MutableStructTestsGeneric = begin
+    let test2() =
+         let o = new ContainerGeneric<int>() in
+         test "mutable struct test 1" (o.nested.v = 0);
+         test "mutable struct test 2" (o.nested2.v = 0);
+         o.nested.setV(1);
+         o.nested2.setV(1);
+         test "mutable struct test 3" (o.nested.v = 1);
+         test "mutable struct test 4" (o.nested2.v = 0);
+         
+         let o = new ContainerGeneric<int>() in
+         test "mutable struct test 1b" (o.nestedNested.v.v = 0);
+         test "mutable struct test 2b" (o.nestedNested2.v.v = 0);
+         o.nestedNested.setV(1);
+         o.nestedNested2.setV(1);
+         test "mutable struct test 3b" (o.nestedNested.v.v = 1);
+         test "mutable struct test 4b" (o.nestedNested2.v.v = 0)
+         
+(* THis hits an NYI:         
+         
+         let o = new Container() in
+         test "mutable struct test 1b" (o.nestedNested.v.v = 0);
+         test "mutable struct test 2b" (o.nestedNested2.v.v = 0);
+         o.nestedNested.v.v <- 1;
+         o.nestedNested2.v.v <- 1;
+         test "mutable struct test 3b" (o.nestedNested.v.v = 1);
+         test "mutable struct test 4b" (o.nestedNested2.v.v = 0)
+*)
+
+    do test2()
+
+
+    type TestGeneric<'a> = struct
+       val mutable v: 'a
+       member t.setV v =
+           t.v <- v
+    end
+
+    let test2131() =
+         let mutable t = new TestGeneric<int>() in
+         test "mutable struct test 5a" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 5b" (t.v  = 1);
+
+         let (* immutable *) t = new TestGeneric<int>() in
+         test "mutable struct test 5c" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 5d" (t.v  = 0) // immutable!
+
+    do test2131()
+
+    type TestTestGeneric<'a> = struct
+       val mutable v: TestGeneric<'a>
+       member t.setV v =
+           t.v <- v
+    end
+
+    let test31r13() =
+         let mutable t = new TestGeneric<int>() in
+         test "mutable struct test 6" (t.v  = 0);
+         t.setV(1);
+         test "mutable struct test 7" (t.v  = 1);
+         let mutable t = new TestGeneric<int>() in
+         test "mutable struct test 8" (t.v  = 0);
+         t.v <- 1;
+         test "mutable struct test 9" (t.v  = 1);
+(*
+         let mutable t = new TestTestGeneric<int>() in
+         test "mutable struct test 10" (t.v.v  = 0);
+         t.v.v <- 1;
+         test "mutable struct test 11" (t.v.v  = 1);
+
+         let mutable t = new TestTestGeneric<int>() in
+         test "mutable struct test 12" (t.v.v  = 0);
+         t.v.setV(1);
+         test "mutable struct test 13" (t.v.v  = 1);
+
+         let t = new TestTestGeneric<int>() in
+         test "mutable struct test 14" (t.v.v  = 0);
+         t.v.setV(1);
+         test "mutable struct test 15" (t.v.v  = 0)
+*)
+    do test31r13()
+end
+
+
+module InheritAbstractBase = begin
+
+	type Inherit1() = class
+	    inherit TypesWithProperties.AbstractBase()
+	    override x.splitProperty with get() = 3 and set v = ()
+
+  end
+  let _ = Inherit1()
+
+	type Inherit2() = class
+	    inherit TypesWithProperties.DerivedAbstractClass()
+	    override x.splitProperty with get() = 3 
+
+  end
+  let _ = Inherit2()
+
+	type Inherit3() = class
+	    inherit TypesWithProperties.DerivedClass()
+	    override x.splitProperty with set v = ()
+
+  end
+  let _ = Inherit3()
+
+	type Inherit4() = class
+	    inherit TypesWithProperties.ExplicitInterfaceClass()
+
+  end
+  let _ = Inherit4()
+  
+	type Inherit5() = class
+	    inherit TypesWithProperties.ExplicitInterfaceClass()
+
+  end
+  let _ = Inherit5()
+
+	type Inherit6() = class
+	    inherit TypesWithProperties.PartialExplicitInterfaceClass1()
+	    override x.objectProperty with get() = new obj()
+
+  end
+  let _ = Inherit6()
+end
+
+                       
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
+
+
+
diff --git a/tests/fsharp/core/csfromfs/collections.fs b/tests/fsharp/core/csfromfs/collections.fs
new file mode 100644
index 0000000..66cc2c5
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/collections.fs
@@ -0,0 +1,38 @@
+#indent "off"
+
+
+
+
+let failures = ref false
+let test s b = 
+  if not b then (stderr.WriteLine ("test "+s+" failed"); failures := true)
+
+let l = new System.Collections.ArrayList()
+let _ = l.Add("abc")
+let _ = System.Console.WriteLine("{0}",l.Item(0))
+let _ = l.Add(box 1)
+let _ = System.Console.WriteLine("{0}",l.Item(0))
+let _ = System.Console.WriteLine("{0}",l.Item(1))
+let _ = test "fewoij21" ((l.Item(0) :?> string) = "abc")
+let _ = test "fewoij332" (unbox(l.Item(1)) = 1)
+
+let genericList = new System.Collections.Generic.List<_>()  (* The compiler works out that it is List<int> from the uses below *)
+
+let _ = genericList.Add(12)
+let _ = System.Console.WriteLine("{0}",box(genericList.Item(0)))
+let _ = test "fewoij21" (genericList.Item(0) = 12)
+let _ = genericList.Add(1)
+let _ = System.Console.WriteLine("{0}",box(genericList.Item(0)))
+let _ = System.Console.WriteLine("{0}",box(genericList.Item(1)))
+let _ = test "fewoij21" (genericList.Item(0) = 12)
+let _ = test "fewoij332" (genericList.Item(1) = 1)
+
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/csfromfs/events.cs b/tests/fsharp/core/csfromfs/events.cs
new file mode 100644
index 0000000..d685c99
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/events.cs
@@ -0,0 +1,39 @@
+
+using System; using System.Diagnostics;
+
+//****************************************************************************
+// Events
+//****************************************************************************
+
+namespace Events
+{
+    public delegate void Handler(int i);
+    
+    public class C : I
+    {
+        public event Handler HandlerEvent;
+        private Handler myHandler;
+        public event Handler HandlerPropEvent {
+            add { myHandler += value; }
+            remove { myHandler -= value;}
+        }
+        
+        static public event Handler HandlerEventStatic;
+        static private Handler myHandlerStatic;
+        static public event Handler HandlerPropEventStatic {
+            add { myHandlerStatic += value; }
+            remove { myHandlerStatic -= value;}
+        }
+        public event Handler InterfaceHandler;
+        public void FireHandlerEvent(int x) { HandlerEvent(x); }
+        public void FireHandlerPropEvent(int x) { myHandler(x); }
+        public static void FireHandlerEventStatic(int x) { HandlerEventStatic(x); }
+        public static void FireHandlerPropEventStatic(int x) { myHandlerStatic(x); }
+    }
+
+    public interface I
+    {
+        event Handler InterfaceHandler;
+    }
+}
+
diff --git a/tests/fsharp/core/csfromfs/events.fs b/tests/fsharp/core/csfromfs/events.fs
new file mode 100644
index 0000000..bc6c78e
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/events.fs
@@ -0,0 +1,74 @@
+#indent "off"
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine "NO"; failures := true
+
+open Events
+
+let testEvents = 
+  let handler_state = ref 10 in 
+  let handler = new Handler(fun i -> handler_state := !handler_state + i; ()) in 
+  handler.Invoke(5);
+  if !handler_state <> 15 then report_failure();
+  begin 
+    let x = new C() in 
+    let handler_state = ref 10 in 
+    x.add_HandlerEvent(new Handler(fun i -> handler_state := !handler_state + i; ()));
+    x.FireHandlerEvent(3);
+    if !handler_state <> 13 then report_failure();
+    let h2 = new Handler(fun i -> handler_state := !handler_state + i; ()) in
+    x.add_HandlerEvent(h2);
+    x.FireHandlerEvent(4);
+    if !handler_state <> 21 then report_failure();
+    x.remove_HandlerEvent(h2);
+    x.FireHandlerEvent(1);
+    if !handler_state <> 22 then report_failure();
+  end;
+  begin 
+    let x = new C() in 
+    let handler_state = ref 10 in 
+    x.add_HandlerPropEvent(new Handler(fun i -> handler_state := !handler_state + i; ()));
+    x.FireHandlerPropEvent(3);
+    if !handler_state <> 13 then report_failure();
+    let h2 = new Handler(fun i -> handler_state := !handler_state + i; ()) in
+    x.add_HandlerPropEvent(h2);
+    x.FireHandlerPropEvent(4);
+    if !handler_state <> 21 then report_failure();
+    x.remove_HandlerPropEvent(h2);
+    x.FireHandlerPropEvent(1);
+    if !handler_state <> 22 then report_failure();
+  end;
+  begin 
+    let handler_state = ref 10 in 
+    C.add_HandlerEventStatic(new Handler(fun i -> handler_state := !handler_state + i; ()));
+    C.FireHandlerEventStatic(3);
+    if !handler_state <> 13 then report_failure();
+    let h2 = new Handler(fun i -> handler_state := !handler_state + i; ()) in
+    C.add_HandlerEventStatic(h2);
+    C.FireHandlerEventStatic(4);
+    if !handler_state <> 21 then report_failure();
+    C.remove_HandlerEventStatic(h2);
+    C.FireHandlerEventStatic(1);
+    if !handler_state <> 22 then report_failure();
+  end;
+  begin 
+    let handler_state = ref 10 in 
+    C.add_HandlerPropEventStatic(new Handler(fun i -> handler_state := !handler_state + i; ()));
+    C.FireHandlerPropEventStatic(3);
+    if !handler_state <> 13 then report_failure();
+    let h2 = new Handler(fun i -> handler_state := !handler_state + i; ()) in
+    C.add_HandlerPropEventStatic(h2);
+    C.FireHandlerPropEventStatic(4);
+    if !handler_state <> 21 then report_failure();
+    C.remove_HandlerPropEventStatic(h2);
+    C.FireHandlerPropEventStatic(1);
+    if !handler_state <> 22 then report_failure();
+  end
+
+       
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/csfromfs/fields.cs b/tests/fsharp/core/csfromfs/fields.cs
new file mode 100644
index 0000000..91c6bd4
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/fields.cs
@@ -0,0 +1,50 @@
+
+using System; using System.Diagnostics;
+
+namespace CSharpFields
+{
+    public abstract class ByrefCallback { public abstract void Callback(ref S arg); }
+
+    public class Helpers { static public void CallByrefCallback(ref S arg, ByrefCallback cb) { cb.Callback(ref arg); } }
+
+
+    public struct EmptyStruct { }
+
+    public struct S
+    {
+        private int			intPropertyField;
+        public int			intProperty { get { return intPropertyField; } 
+                                                      set { intPropertyField = value; } }
+
+        public int			intField;
+        public Object		objectField;
+        public int[]		arrayField;
+        public EmptyStruct	structField;
+        static public int			intFieldStatic;
+        static public Object		objectFieldStatic;
+        static public int[]		arrayFieldStatic;
+        static public EmptyStruct	structFieldStatic;
+        public const int			intFieldConst = 3;
+        public const byte			byteFieldConst = 4;
+        public const char			charFieldConst = 'a';
+        public const string			stringFieldConst = "help";
+        public const float			singleFieldConst = 3.14F;
+        public const double			doubleFieldConst = 3.14;
+        /*	static public Object		objectFieldStatic;
+                static public int[]		arrayFieldStatic;
+                static public EmptyStruct	structFieldStatic; */
+    }
+    
+    public class C
+    {
+
+	public int			intField;
+	public Object		objectField;
+	public int[]		arrayField;
+	public EmptyStruct	structField;
+	static public int			intFieldStatic;
+	static public Object		objectFieldStatic;
+	static public int[]		arrayFieldStatic;
+	static public EmptyStruct	structFieldStatic;
+    }
+}
diff --git a/tests/fsharp/core/csfromfs/fields.fs b/tests/fsharp/core/csfromfs/fields.fs
new file mode 100644
index 0000000..4db547a
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/fields.fs
@@ -0,0 +1,114 @@
+#indent "off"
+
+
+module Fields
+
+let failures = ref false
+let report_failure s = 
+  stderr.WriteLine ("NO: test "+s+" failed"); failures := true
+
+
+let testIndexers = 
+  begin 
+    if CSharpFields.S.intFieldStatic <> 0  then report_failure "test38432"; 
+    if CSharpFields.S.objectFieldStatic <> null  then report_failure "test3823c2"; 
+    if not (CSharpFields.S.structFieldStatic.Equals(box (new CSharpFields.EmptyStruct())))  then report_failure "test382d2c2"; 
+    if CSharpFields.S.arrayFieldStatic <> null  then report_failure "tes983kjd2c2"; 
+    let s = new CSharpFields.S() in 
+    if s.intField <> 0  then report_failure "testiun2"; 
+    if s.objectField <> null  then report_failure "test9ij23c2"; 
+    if not (s.structField.Equals(box (new CSharpFields.EmptyStruct())))  then report_failure "test63h2c2"; 
+    if s.arrayField <> null  then report_failure "tes90c3ejkd2c2"; 
+
+    (* Can set fields on mutable values. *)
+    let mutable s2 = new CSharpFields.S() in 
+    if s2.intField <> 0  then report_failure "testiun2mmb";
+    if s2.intProperty <> 0  then report_failure "testi8hh6un2mmb";
+
+    s2.intField <- 1;
+    if s2.intField <> 1  then report_failure "testiun2mmm"; 
+
+    (* Can call property setters on mutable values. *)
+    s2.intProperty <- 1;
+    if s2.intProperty <> 1  then report_failure "testiuyf67m"; 
+
+    (* Can set fields in byref params. *)
+    let cb = { new  CSharpFields.ByrefCallback() with member __.Callback(arg) = arg.intField <- 4; } in
+
+    let s3 = ref (new CSharpFields.S()) in 
+    if (!s3).intField  <> 0 then report_failure "tesdce34tiun2mmb";
+    Printf.printf "(!s3).intField = %d\n" (!s3).intField;
+
+
+    CSharpFields.Helpers.CallByrefCallback(s3, cb);
+    if (!s3).intField <> 4  then report_failure "tesdetiun2mmm"; 
+
+    (* Can call property setters on  byref params. *)
+
+    let cb2 = { new  CSharpFields.ByrefCallback() with member __.Callback(arg) = arg.intProperty <- 4; } in
+    Printf.printf "(!s3).intProperty = %d\n" (!s3).intProperty;
+    if (!s3).intProperty <> 0  then report_failure "ewecew34tiun2mmb";
+
+    CSharpFields.Helpers.CallByrefCallback(s3, cb2);
+    if (!s3).intProperty <> 4  then report_failure "tesdetiun2mmm"; 
+
+
+    (* Literals - pattern matching *)
+    if not (match 3 with CSharpFields.S.intFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+    if not (match byte 4 with CSharpFields.S.byteFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+    if not (match 'a' with CSharpFields.S.charFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+    if not (match "help" with CSharpFields.S.stringFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+    if not (match 3.14f with CSharpFields.S.singleFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+    if not (match 3.14 with CSharpFields.S.doubleFieldConst -> true | _ -> false)  then report_failure "tes998u78"; 
+
+    (* Literals - expressions *)
+    if CSharpFields.S.intFieldConst <> 3  then report_failure "tes998e7322"; 
+    if CSharpFields.S.byteFieldConst <> byte 4  then report_failure "te9390e7322"; 
+    if CSharpFields.S.charFieldConst <> 'a'  then report_failure "te99dw0e7322"; 
+    if CSharpFields.S.stringFieldConst <> "help"  then report_failure "cew09dw22"; 
+    if CSharpFields.S.singleFieldConst <> 3.14f  then report_failure "dw0dw22"; 
+    if CSharpFields.S.doubleFieldConst <> 3.14  then report_failure "dw0dwdw-22"; 
+
+  end
+
+module TestGenericFields = begin
+  open System.Collections.Generic
+
+  let check s e r = if r = e then  stdout.WriteLine (s^": YES") else (stdout.WriteLine (s^": FAIL"); report_failure s)
+    
+  let testGettingGenericField1(x: KeyValuePair<_,_>) = x.Value
+(*
+  let testSettingGenericField1(x: KeyValuePair<_,_> ref) y = 
+    let mutable v = !x in 
+    v.Value <- y;
+    x := v
+*)
+  let testGettingGenericField2(x: KeyValuePair<_,_>) = x.Key
+(*
+  let testSettingGenericField2(x: KeyValuePair<_,_> ref) y = 
+    let mutable v = !x in 
+    v.Key <- y;
+    x := v
+*)
+       
+  do check "ewoi93c3" (testGettingGenericField1 (new KeyValuePair<_,_>(3,"abc"))) "abc"
+  let v1 = ref (new KeyValuePair<_,_>(3,"abc"))
+(*
+  do testSettingGenericField1 v1 "def"
+  do check "ewoi93c3" (testGettingGenericField1 !v1) "def"
+*)
+
+  do check "ewoi93c3" (testGettingGenericField2 (new KeyValuePair<_,_>(3,"abc"))) 3
+  let v2 = ref (new KeyValuePair<_,_>(3,"abc"))
+(*
+  do testSettingGenericField2 v2 4
+  do check "ewoi93c3" (testGettingGenericField2 !v2) 4
+*)
+
+end
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/csfromfs/generics.cs b/tests/fsharp/core/csfromfs/generics.cs
new file mode 100644
index 0000000..d2a5e2f
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/generics.cs
@@ -0,0 +1,610 @@
+using System;
+using System.Diagnostics;
+
+public class Utils
+{
+	public static int failures = 0;
+
+	public static void Fail(string outputString)
+	{
+		failures++;
+		Console.WriteLine(outputString + new StackTrace(true).ToString());
+	}
+	
+	public static void CheckType<U>(U parameterToCheck, Type typeToCheckAgainst)
+	{
+		if (!typeToCheckAgainst.Equals(typeof(U)))
+		{
+			Fail("Expected typeof generic method Type Parameter for parameter, '" + parameterToCheck + "', to be '" + typeToCheckAgainst + "', but found '" + typeof(U) + "'");
+		}
+
+		if (!typeToCheckAgainst.Equals(parameterToCheck.GetType()))
+		{
+			Fail("Expected Type.GetType parameter, '" + parameterToCheck + "', to be '" + typeToCheckAgainst + "', but found '" + parameterToCheck.GetType() + "'");
+		}
+	}
+
+	public static bool CompareArray<U>(U[] arrayOne, U[] arrayTwo)
+	{
+		for (int i=arrayOne.GetUpperBound(0);i>=0;i--)
+		{
+			if (arrayOne[i].Equals(arrayTwo[i]))
+			{
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public static string BuildArrayString<U>(U[] arrayToPrint)
+	{
+		string stringToReturn = typeof(U) + " {";
+		int i;
+		
+		for (i=0;i<=arrayToPrint.GetUpperBound(0);i++)
+		{
+			stringToReturn = stringToReturn + arrayToPrint[i] + ", ";
+		}
+
+		stringToReturn.Remove(stringToReturn.Length-2, 2);
+		stringToReturn = stringToReturn + "}";
+		return stringToReturn;
+	}
+}
+
+public class GenericClass<T>
+{
+	public static Type classParameterType;
+	public bool usingBaseVirtualProperty;
+	
+	public static U StaticGenericMethod<U>(U methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public static int StaticNonGenericMethodInt(int methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public static string StaticNonGenericMethodString(string methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public static int[] StaticNonGenericMethodIntArray(int[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public static string[] StaticNonGenericMethodStringArray(string[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+	
+	public static U StaticGenericMethodUsesClassTypeParam<U>(T classParameter, U methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public static int StaticNonGenericMethodIntUsesClassTypeParam(T classParameter, int methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public static string StaticNonGenericMethodStringUsesClassTypeParam(T classParameter, string methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public static int[] StaticNonGenericMethodIntArrayUsesClassTypeParam(T classParameter, int[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public static string[] StaticNonGenericMethodStringArrayUsesClassTypeParam(T classParameter, string[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public U GenericMethod<U>(U methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public int NonGenericMethodInt(int methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public string NonGenericMethodString(string methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public int[] NonGenericMethodIntArray(int[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+
+	public string[] NonGenericMethodStringArray(string[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		return methodParameter;
+	}
+	
+	public U GenericMethodUsesClassTypeParam<U>(T classParameter, U methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public int NonGenericMethodIntUsesClassTypeParam(T classParameter, int methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public string NonGenericMethodStringUsesClassTypeParam(T classParameter, string methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public int[] NonGenericMethodIntArrayUsesClassTypeParam(T classParameter, int[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public string[] NonGenericMethodStringArrayUsesClassTypeParam(T classParameter, string[] methodParameter, Type methodParameterType)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public virtual U VirtualGenericMethod<U>(U methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		return methodParameter;
+	}
+
+	public virtual int VirtualNonGenericMethodInt(int methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		return methodParameter;
+	}
+
+	public virtual string VirtualNonGenericMethodString(string methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		return methodParameter;
+	}
+
+	public virtual int[] VirtualNonGenericMethodIntArray(int[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		return methodParameter;
+	}
+
+	public virtual string[] VirtualNonGenericMethodStringArray(string[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		return methodParameter;
+	}
+	
+	public virtual U VirtualGenericMethodUsesClassTypeParam<U>(T classParameter, U methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public virtual int VirtualNonGenericMethodIntUsesClassTypeParam(T classParameter, int methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public virtual string VirtualNonGenericMethodStringUsesClassTypeParam(T classParameter, string methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public virtual int[] VirtualNonGenericMethodIntArrayUsesClassTypeParam(T classParameter, int[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public virtual string[] VirtualNonGenericMethodStringArrayUsesClassTypeParam(T classParameter, string[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		if(isBase==false){Utils.Fail("Expected to be true, but found it to be false.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public T genericField;
+	public int nongenericIntField;
+	public string nongenericStringField;
+	public int[] nongenericIntArrayField;
+	public string[] nongenericStringArrayField;	
+	
+	public T genericProperty
+	{
+		get 
+	   	{ 
+			Utils.CheckType<T>(genericField, classParameterType);
+		  	return genericField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			Utils.CheckType<T>(value, classParameterType);
+		  	genericField = value;
+	   	}
+	}
+
+	public int nongenericIntProperty
+	{
+		get 
+	   	{ 
+		  	return nongenericIntField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+		  	nongenericIntField = value;
+	   	}
+	}
+
+	public string nongenericStringProperty
+	{
+		get 
+	   	{ 
+		  	return nongenericStringField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+		  	nongenericStringField = value;
+	   	}
+	}
+
+	public int[] nongenericIntArrayProperty
+	{
+		get 
+	   	{ 
+		  	return nongenericIntArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+		  	nongenericIntArrayField = value;
+	   	}
+	}
+
+	public string[] nongenericStringArrayProperty
+	{
+		get 
+	   	{ 
+		  	return nongenericStringArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+		  	nongenericStringArrayField = value;
+	   	}
+	}
+
+	public virtual T genericVirtualProperty
+	{
+		get 
+	   	{ 
+			Utils.CheckType<T>(genericField, classParameterType);
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	return genericField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			Utils.CheckType<T>(value, classParameterType);
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	genericField = value;
+	   	}
+	}
+
+	public virtual int nongenericIntVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	return nongenericIntField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	nongenericIntField = value;
+	   	}
+	}
+
+	public virtual string nongenericStringVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	return nongenericStringField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	nongenericStringField = value;
+	   	}
+	}
+
+	public virtual int[] nongenericIntArrayVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	return nongenericIntArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	nongenericIntArrayField = value;
+	   	}
+	}
+
+	public virtual string[] nongenericStringArrayVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	return nongenericStringArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==false){Utils.Fail("Expected usingBaseVirtualProperty to be true, but found it to be false.");}
+		  	nongenericStringArrayField = value;
+	   	}
+	}
+
+	public delegate U genericDelegate<U>(U delegateParameter, Type typeOfDelegateParameter);
+	public delegate int nongenericDelegateInt(int delegateParameter, Type typeOfDelegateParameter);
+	public delegate string nongenericDelegateString(string delegateParameter, Type typeOfDelegateParameter);
+	public delegate int[] nongenericDelegateIntArray(int[] delegateParameter, Type typeOfDelegateParameter);
+	public delegate string[] nongenericDelegateStringArray(string[] delegateParameter, Type typeOfDelegateParameter);
+	public delegate U genericDelegateUsesClassTypeParam<U>(T classParameter, U delegateParameter, Type typeOfDelegateParameter);
+	public delegate int nongenericDelegateIntUsesClassTypeParam(T classParameter, int delegateParameter, Type typeOfDelegateParameter);
+	public delegate string nongenericDelegateStringUsesClassTypeParam(T classParameter, string delegateParameter, Type typeOfDelegateParameter);
+	public delegate int[] nongenericDelegateIntArrayUsesClassTypeParam(T classParameter, int[] delegateParameter, Type typeOfDelegateParameter);
+	public delegate string[] nongenericDelegateStringArrayUsesClassTypeParam(T classParameter, string[] delegateParameter, Type typeOfDelegateParameter);
+}
+
+public class GenericClassInheritsFromGenericClass<T>:GenericClass<T>
+{
+	public override U VirtualGenericMethod<U>(U methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		return methodParameter;
+	}
+
+	public override int VirtualNonGenericMethodInt(int methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		return methodParameter;
+	}
+
+	public override string VirtualNonGenericMethodString(string methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		return methodParameter;
+	}
+
+	public override int[] VirtualNonGenericMethodIntArray(int[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		return methodParameter;
+	}
+
+	public override string[] VirtualNonGenericMethodStringArray(string[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		return methodParameter;
+	}
+	
+	public override U VirtualGenericMethodUsesClassTypeParam<U>(T classParameter, U methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<U>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public override int VirtualNonGenericMethodIntUsesClassTypeParam(T classParameter, int methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public override string VirtualNonGenericMethodStringUsesClassTypeParam(T classParameter, string methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public override int[] VirtualNonGenericMethodIntArrayUsesClassTypeParam(T classParameter, int[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<int[]>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public override string[] VirtualNonGenericMethodStringArrayUsesClassTypeParam(T classParameter, string[] methodParameter, Type methodParameterType, bool isBase)
+	{
+		Utils.CheckType<string[]>(methodParameter, methodParameterType);
+		if(isBase==true){Utils.Fail("Expected to be false, but found it to be true.");}
+		Utils.CheckType<T>(classParameter, classParameterType);
+		return methodParameter;
+	}
+
+	public override T genericVirtualProperty
+	{
+		get 
+	   	{ 
+			Utils.CheckType<T>(genericField, classParameterType);
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	return genericField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			Utils.CheckType<T>(value, classParameterType);
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	genericField = value;
+	   	}
+	}
+
+	public override int nongenericIntVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	return nongenericIntField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	nongenericIntField = value;
+	   	}
+	}
+
+	public override string nongenericStringVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	return nongenericStringField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	nongenericStringField = value;
+	   	}
+	}
+
+	public override int[] nongenericIntArrayVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	return nongenericIntArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	nongenericIntArrayField = value;
+	   	}
+	}
+
+	public override string[] nongenericStringArrayVirtualProperty
+	{
+		get 
+	   	{ 
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	return nongenericStringArrayField; 
+	   	}
+
+		// Assigns to the number data member.
+		set 
+	  	{
+			//check type of value vs classTypeParameter
+			if(usingBaseVirtualProperty==true){Utils.Fail("Expected usingBaseVirtualProperty to be false, but found it to be true.");}
+		  	nongenericStringArrayField = value;
+	   	}
+	}
+}
diff --git a/tests/fsharp/core/csfromfs/indexers.cs b/tests/fsharp/core/csfromfs/indexers.cs
new file mode 100644
index 0000000..f5b1227
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/indexers.cs
@@ -0,0 +1,75 @@
+
+using System; using System.Diagnostics;
+
+
+//****************************************************************************
+// Indexers
+//****************************************************************************
+
+namespace CSharpIndexers
+{
+	public interface I
+	{
+		int this [int i] {
+			get;
+			set;
+		}
+	}
+
+	public interface I2
+	{
+		int this [int i] {
+			get;
+			set;
+		}
+		int this [string i] {
+			get;
+			set;
+		}
+	}
+
+	public class C : I
+	{
+
+		int I.this [int i] {
+			get { return 100 + i; }
+			set { return; }
+		}
+
+		
+		public virtual int this [int i] {
+			get { return 200 + i; } set { return; }
+		}
+	}
+
+	public class D : C
+	{
+		public override int this [int i] {
+                        get { return 300 + i; }
+			set { return; }
+		}
+	}
+	public class OverloadedIndexer : I2
+	{
+
+		int I2.this [int i] {
+			get { return 100 + i; }
+			set { return; }
+		}
+
+		int I2.this [string i] {
+			get { return 100 + i.Length; }
+			set { return; }
+		}
+
+		
+		public virtual int this [int i] {
+			get { return 200 + i; } set { return; }
+		}
+		public virtual int this [string i] {
+			get { return 200 + i.Length; } set { return; }
+		}
+	}
+
+}
+
diff --git a/tests/fsharp/core/csfromfs/indexers.fs b/tests/fsharp/core/csfromfs/indexers.fs
new file mode 100644
index 0000000..9b63eff
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/indexers.fs
@@ -0,0 +1,33 @@
+#indent "off"
+
+module Indexers
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine "NO"; failures := true
+
+
+let testIndexers = 
+  begin 
+    let c = new CSharpIndexers.C() in 
+    if c.Item(3) <> 203 then report_failure();
+    if (upcast c : CSharpIndexers.I).Item(3) <> 103 then report_failure(); 
+    let d = new CSharpIndexers.D() in 
+    if d.Item(3) <> 303 then report_failure();
+    if (upcast d : CSharpIndexers.C).Item(3) <> 303 then report_failure();
+  end;
+  begin 
+    let d = new CSharpIndexers.OverloadedIndexer() in 
+    if d.Item(3) <> 203 then report_failure();
+    if d.Item("2") <> 201 then report_failure();
+    if (upcast d : CSharpIndexers.I2).Item(3) <> 103 then report_failure();
+    if (upcast d : CSharpIndexers.I2).Item("4") <> 101 then report_failure();
+   
+  end
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/csfromfs/lib.cs b/tests/fsharp/core/csfromfs/lib.cs
new file mode 100644
index 0000000..f76dad3
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/lib.cs
@@ -0,0 +1,846 @@
+
+using System; using System.Diagnostics;
+
+
+//****************************************************************************
+// user defined operators
+//****************************************************************************
+
+namespace UserDefinedOperators
+{
+        class B
+        {
+            public int OpIncrement;
+            public int OpDecrement;
+            public int OpUnaryPlus;
+            public int OpUnaryNegation;
+            public int OpOnesComplement;
+            public int OpAddition;
+            public int OpSubtraction;
+            public int OpMultiply;
+            public int OpDivision;
+            public int OpModulus;
+            public int OpExclusiveOr;
+            public int OpBitwiseAnd;
+            public int OpBitwiseOr;
+            public int OpLeftShift;
+            public int OpRightShift;
+            public int OpUnsignedRightShift;
+            public int OpEquals;
+            public int OpCompare;
+        }
+
+        class C : B
+        {
+                // valid declarations
+                public static C operator ++ (C c) { return null; }
+                public static C operator -- (C c) { return null; }
+                public static int operator + (C c) { return 0; }
+                public static int operator - (C c) { return 0; }
+                public static int operator ~ (C c) { return 0; }
+                public static int operator + (C c, int i) { return 0; }
+                public static int operator - (C c, int i) { return 0; }
+                public static int operator * (C c, int i) { return 0; }
+                public static int operator / (C c, int i) { return 0; }
+                public static int operator % (C c, int i) { return 0; }
+                public static int operator ^ (C c, int i) { return 0; }
+                public static int operator & (C c, int i) { return 0; }
+                public static int operator | (C c, int i) { return 0; }
+                public static long operator <<  (C c, int i) { return 0; }
+                public static long operator >>  (C c, int i) { return 0; }
+                
+                public static int  operator < (C c, int i) { return 0; }
+                public static int  operator > (C c, int i) { return 0; }
+                public static int  operator <= (C c, int i) { return 0; }
+                public static int  operator >= (C c, int i) { return 0; }
+                public static int  operator == (C c, int i) { return 0; }
+                public static int  operator != (C c, int i) { return 0; }
+        }
+}
+
+//****************************************************************************
+// readonly modifiers
+//****************************************************************************
+
+namespace ReadOnly
+{
+        struct S
+        {
+                public int i;
+                public int Property {
+                        get {
+                                return i;
+                        }
+                        set {
+                                i = value;
+                        }
+                }
+        }
+
+        struct S2
+        {
+                readonly public S readonlyS;
+                         public S readwriteS;
+
+                readonly public int readonlyI;
+
+                public int i;
+                public S2(int value) {
+
+                                readonlyS.i = value;
+                                readonlyS.Property = value;
+                                readonlyI = value;
+                i = value;
+                readwriteS.i = value;
+                                int j = readonlyI;
+                                j = j + readonlyS.i;
+                                j = j + readonlyS.Property;
+                                
+
+                }
+        }
+
+        class Base
+        {
+                protected readonly int i;
+                public    readonly S s;
+                public             S2 s2;
+
+                Base(int q) {
+                        i = 5;
+                        s.i = 3;
+                        s.Property = 2;
+
+                        S2 localS2 = s2;
+                        i = i + s2.readonlyS.i;
+                        i = i + s2.readonlyS.Property;
+                }
+
+                class Nested 
+                {
+                        Nested(Base b) {
+                                // b.i = 5;
+                                // b.s.i = 3;
+                                // b.s.Property = 2;
+
+                                S2 localS2 = b.s2;
+                                // b.i = b.i + b.s2.readonlyS.i;
+                                // b.i = b.i + b.s2.readonlyS.Property;
+                        }
+                }
+        }
+
+        class Class
+        {
+                static void m()
+                {
+                        S2 s2 = new S2();
+
+                        int i;
+                        i = s2.i;
+
+                        i = i + s2.readonlyI;
+                        i = i + s2.readonlyS.i;
+                        i = i + s2.readonlyS.Property;
+                }
+        }
+
+}
+
+//****************************************************************************
+// user defined conversion operators
+//****************************************************************************
+
+namespace Conversions
+{
+        enum E {}
+        delegate void D();
+        struct Struct {}
+        class Class { public void m() { return; } }
+
+        struct StructConvert
+        {
+                // to/from another struct
+                public static implicit operator Struct (StructConvert s) { return new Struct(); }
+                public static explicit operator StructConvert (Struct s) { return new StructConvert(); }
+
+                // to/from a class
+                public static implicit operator Class (StructConvert s) { return new Class(); }
+                public static explicit operator StructConvert (Class c) { return new StructConvert(); }
+
+                // to/from an enum
+                // UNDONE: public static implicit operator E (StructConvert s) { return new E(); }
+                public static explicit operator StructConvert (E e) { return new StructConvert(); }
+
+                // to/from a delegate
+                public static implicit operator D (StructConvert s) { return new D((new Class()).m); }
+                public static explicit operator StructConvert (D d) { return new StructConvert(); }
+
+                // to/from a built in type
+                public static implicit operator int (StructConvert s) { return 0; }
+                public static explicit operator StructConvert (int i) { return new StructConvert(); }
+
+                // to/from an array of basic type
+                public static implicit operator int[] (StructConvert s) { return null; }
+                public static explicit operator StructConvert (int[] a) { return new StructConvert(); }
+
+                // to/from an array of reference type
+        public static implicit operator Class[,] (StructConvert s) { return null; }
+        public static explicit operator StructConvert (Class[,] a) { return new StructConvert(); }
+
+                // UNDONE: to/from a pointer type
+        }
+
+        struct ClassConvert
+        {
+                // to/from another struct
+                public static implicit operator Struct (ClassConvert s) { return new Struct(); }
+                public static explicit operator ClassConvert (Struct s) { return new ClassConvert(); }
+
+                // to/from a class
+                public static implicit operator Class (ClassConvert s) { return new Class(); }
+                public static explicit operator ClassConvert (Class c) { return new ClassConvert(); }
+
+                // to/from an enum
+                // UNDONE: public static implicit operator E (ClassConvert s) { return new E(); }
+                public static explicit operator ClassConvert (E e) { return new ClassConvert(); }
+
+                // to/from a delegate
+                public static implicit operator D (ClassConvert s) { return new D((new Class()).m); }
+                public static explicit operator ClassConvert (D d) { return new ClassConvert(); }
+
+                // to/from a built in type
+                public static implicit operator int (ClassConvert s) { return 0; }
+                public static explicit operator ClassConvert (int i) { return new ClassConvert(); }
+
+                // to/from an array of basic type
+                public static implicit operator int[] (ClassConvert s) { return null; }
+                public static explicit operator ClassConvert (int[] a) { return new ClassConvert(); }
+
+                // to/from an array of reference type
+        public static implicit operator Class[,] (ClassConvert s) { return null; }
+        public static explicit operator ClassConvert (Class[,] a) { return new ClassConvert(); }
+
+                // UNDONE: to/from a pointer type
+        }
+
+        //
+        // check hiding, and conversions between class types
+        //
+        class Base
+        {
+                public static implicit operator int (Base b) { return 0; }
+                public static implicit operator Base (int i) { return null; }
+
+                public static explicit operator Class (Base b) { return null; }
+                public static explicit operator Base (Class i) { return null; }
+        }
+
+        class Derived1 : Base
+        {
+                // check hiding
+                public static implicit operator int (Derived1 b) { return 0; }
+                public static implicit operator Derived1 (int i) { return null; }
+
+                public static explicit operator Class (Derived1 b) { return null; }
+                public static explicit operator Derived1 (Class i) { return null; }
+
+                // conversions between classes
+                public static implicit operator Derived2 (Derived1 b) { return null; }
+                public static explicit operator Derived1 (Derived2 i) { return null; }
+        }
+
+        class Derived2 : Base
+        {
+                // implicit operators hide inherited explicit operators
+                public static implicit operator Class (Derived2 b) { return null; }
+                public static implicit operator Derived2 (Class i) { return null; }
+
+                // conversions between classes
+                public static implicit operator Derived2 (Derived1 b) { return null; }
+                public static explicit operator Derived1 (Derived2 i) { return null; }
+        }
+}
+
+//****************************************************************************
+// Lookup in nested classes
+//****************************************************************************
+
+namespace Lookup
+{
+        class Outer
+        {
+                private class NestedClass
+                {
+                        private class NestedNestedClass
+                        {
+                                private class DerivedClass : Outer.NestedClass
+                                {
+                                }
+                        }
+                }
+
+                class AnotherNestedClass
+                {
+                        NestedClass field;
+
+                        object m() { return field; }
+                }
+        }
+}
+
+
+//****************************************************************************
+// Delegates
+//****************************************************************************
+
+namespace Delegates
+{
+                                        delegate void namespaceMemberDelegate();
+
+
+        public class Base
+        {
+                public          delegate void publicDelegate();
+                private         delegate void privateDelegate();
+                protected       delegate void protectedDelegate();
+                internal        delegate void internalDelegate();
+        internal protected delegate void internalprotectedDelegate();
+
+                public          delegate void newDelegate();
+        }
+
+        class Derived : Base
+        {
+                new                     delegate int newDelegate(int i);
+
+                delegate void MulticastDelegateWithManyArgs(byte a1, char a2, short a3, int a4, long a5, float a6, double a7, bool a8, decimal a9,
+                                    ref byte b1, ref char b2, ref short b3, ref int b4, ref long b5, ref float b6, ref double b7, ref bool b8, ref decimal b9,
+                                    out byte c1, out char c2, out short c3, out int c4, out long c5, out float c6, out double c7, out bool c8, out decimal c9);
+
+                delegate int DelegateWithManyArgs(byte a1, char a2, short a3, int a4, long a5, float a6, double a7, bool a8, decimal a9,
+                                    ref byte b1, ref char b2, ref short b3, ref int b4, ref long b5, ref float b6, ref double b7, ref bool b8, ref decimal b9,
+                                    out byte c1, out char c2, out short c3, out int c4, out long c5, out float c6, out double c7, out bool c8, out decimal c9);
+        }
+
+        public class DelegateTest
+        {
+                public void m()
+                {
+                        Console.WriteLine("DelegateTest.m");
+                }
+        }
+}
+
+
+//****************************************************************************
+// properties
+//****************************************************************************
+
+namespace Properties
+{
+        class Class
+        {
+                public int property {
+                        get {
+                                return propertyValue;
+                        }
+                        set {
+                                propertyValue = value;
+                        }
+                }
+
+                private int propertyValue;
+        }
+
+        interface Interface
+        {
+                Object objectProperty {
+                        get; 
+                }
+
+                String stringProperty {
+                        get;
+                }
+        }
+
+        interface Interface2
+        {
+                Object objectProperty {
+                        get; 
+                }
+
+                String stringProperty {
+                        get;
+                }
+        }
+
+        abstract class AbstractBase
+        {
+                public abstract int splitProperty {
+                        get;
+                        set;
+                }
+
+                public String stringProperty {
+                        get {
+                                return String.Copy("foo");
+                        }
+                }
+        }
+
+        abstract class DerivedAbstractClass : AbstractBase
+        {
+                public override int splitProperty {
+                        set {
+                                myValue = value;
+                        }
+                }
+
+                protected int myValue;
+
+                public Object objectProperty {
+                        get {
+                                return null;
+                        }
+                }
+
+                new public String stringProperty() {
+                        return null;
+                }
+        }
+
+        class DerivedClass : DerivedAbstractClass, Interface {
+                public override int splitProperty {
+                        get {
+                                return myValue;
+                        }
+                }
+
+                new private Object objectProperty {
+                        get {
+                                return null;
+                        }
+                }
+
+                new public int stringProperty {
+                        get {
+                                return 0;
+                        }
+                }
+        }
+
+        class ExplicitInterfaceClass : Interface, Interface2
+        {
+                public Object objectProperty {
+                        get {
+                                return null;
+                        }
+                }
+
+                Object Interface2.objectProperty {
+                        get {
+                                return null;
+                        }
+                }
+
+                public String stringProperty {
+                        get {
+                                return String.Copy("foo");
+                        }
+                }
+
+                String Interface.stringProperty {
+                        get {
+                                return null;
+                        }
+                }
+        }
+
+}
+
+struct Struct
+{
+        // fields
+        public int field;
+        public static int staticField;
+        // public int fieldWithInitializer = 3;
+        public static int staticFieldWithInitializer = 3;
+        private int privateField;
+        public static Struct staticStructWithNoInitializer;
+
+        // constructors
+        public Struct(int i) { field = 4; privateField = 2; }
+        static Struct() { staticField = 1; }
+
+        // methods
+        void ImplicitPrivateMethod() { return; }
+        public void PublicMethod() { ImplicitPrivateMethod(); return; }
+}
+
+struct EmptyStruct
+{
+}
+
+struct StructImplicitFieldInitializers
+{
+        public int                      intField;
+        public Object           objectField;
+        public int[]            arrayField;
+        public EmptyStruct      structField;
+}
+
+
+//****************************************************************************
+// interfaces
+//****************************************************************************
+interface EmptyInterface
+{
+}
+
+interface BaseInterface
+{
+        void method();
+        char bMethod();
+}
+
+interface BaseInterface2
+{
+        int method();
+}
+
+interface DerivedInterface : BaseInterface
+{
+        void method(int i);
+        int dMethod();
+}
+
+interface MultiplyDerivedInterface : DerivedInterface, EmptyInterface, BaseInterface
+{
+        int mMethod();
+}
+
+class InterfaceClass : Object, MultiplyDerivedInterface
+{
+        public interface NestedInterface : BaseInterface
+        {
+        }
+
+        public void method()            { return; }
+        public char bMethod()           { return 'a'; }
+        public void method(int i)       { return; }
+        public int dMethod()            { return 0; }
+        public int mMethod()            { return 0; }
+}
+
+class DerivedInterfaceClass : InterfaceClass, DerivedInterface, BaseInterface2
+{
+        void DerivedInterface.method(int i) { return; }
+        public new int method() { return 0; }
+
+}
+
+struct InterfaceStruct : DerivedInterface
+{
+        public interface NestedInterface : InterfaceClass.NestedInterface, MultiplyDerivedInterface
+        {
+                void method(Object o);
+        }
+
+        public void method() { return; }
+        public char bMethod() { return 'a'; }
+        public void method(int i) { return; }
+        public int dMethod() { return 0; }
+}
+
+namespace InterfaceHiding
+{
+        interface Interface
+        {
+                void method();
+        }
+
+        class Base
+        {
+                public void method() { return; }
+        }
+
+        class Derived1 : Base, Interface
+        {
+                new private void method() { return; }
+        }
+
+        class Derived2 : Base, Interface
+        {
+                new public int method;
+        }
+
+        class Derived3 : Base, Interface
+        {
+                public void method(int i) { return; }
+        }
+
+        class Derived4 : Base, Interface
+        {
+                new public int method() { return 0; }
+        }
+}
+
+namespace AbstractMethods
+{
+        abstract class Base
+        {
+                public abstract void method();
+        }
+
+        abstract class Derived2 : Base
+        {
+                // this is NOT an error since classes outside
+                // this assembly could derive from Derived2
+                // in which case they would only see Base.method()
+                new internal int method;
+        }
+
+        abstract class Foo
+        {
+                public abstract void m();
+        }
+
+        abstract class Bar : Foo
+        {
+                public override void m() { return; }
+        }
+
+        class Gar : Bar
+        {
+        }
+}
+
+namespace MemberSameNameAsParent
+{
+        namespace MemberSameNameAsParent
+        {
+                struct MemberSameNameAsParent
+                {
+                }
+        }
+
+        namespace Foo
+        {
+                class Foo
+                {
+                }
+        }
+}
+
+//****************************************************************************
+// declare
+//****************************************************************************
+namespace EmptyNamespace
+{
+}
+
+namespace Foo
+{
+    class Bar
+        {
+        }
+}
+
+namespace Bart
+{
+    internal class Bart : Foo.Bar
+        {
+        }
+
+        public class PublicClass
+        {
+        }
+
+        abstract class AbstractClass
+        {
+        }
+
+        sealed class SealedClass
+        {
+        }
+}
+
+namespace Really.Really.Really.Really.Really.Really.Really.Really.Really.Really.Really.Really.LongDottedNamespace
+{
+    using DuplicateNamespace;
+
+        class Bar : Foo
+        {
+        }
+}
+
+namespace DuplicateNamespace
+{
+    class Foo
+        {
+        }
+}
+
+namespace NotSoLong.DottedNamespace
+{
+    using Foo = DuplicateNamespace.Foo;
+
+    namespace NestedNamespace
+        {
+                class Bar : Foo
+                {
+                }
+        }
+
+        namespace AnotherNestedNamespace
+        {
+        }
+}
+
+namespace DuplicateNamespace
+{
+}
+
+namespace Bar
+{
+    class Foo
+        {
+                public class PublicClass
+                {
+                }
+
+                protected class ProtectedClass
+                {
+                }
+
+        protected internal class ProtectedInternalClass
+        {
+        }
+
+                private class PrivateClass
+                {
+                }
+        }
+}
+
+namespace Baz
+{
+    using Foo = Bar.Foo;
+
+        class Car : Foo
+        {
+        }
+
+        class Lar : Bar.Foo
+        {
+        }
+}
+
+class EmptyClass
+{
+}
+
+
+class AClass
+{
+    internal class NestedClass
+        {
+             internal class NestedNestedClass
+                 {
+                 }
+        }
+
+        public    Object newMember;
+        public int NewMethodHidesField;
+        public int NewClassHidesField;
+        internal  void meth3() {}
+
+        protected void MemberFunc() { return; }
+        protected void NewFieldHidesMethod() { return; }
+}
+
+//****************************************************************************
+// define
+//****************************************************************************
+
+abstract class SimpleDerivedClass : AClass, BaseInterface
+{
+                  int i;
+        static    int staticMember;
+        public    int publicMember;
+        protected int protectedMember;
+    internal protected int internalprotectedMember;
+        internal  int internalMember;
+        private   int privateMember;
+    new       int newMember;
+
+        new class NestedClass
+        {
+        }
+
+        new abstract public int NewMethodHidesField();
+        new protected int NewFieldHidesMethod;
+        new abstract class NewClassHidesField
+        {
+        }
+//      PEVerify does not allow overloading on ref/out until we can start using CMOD_OPT
+//      public    SimpleDerivedClass(ref int i, float j) {  }
+        public    SimpleDerivedClass(out int i, float j) { i = 3; }
+        public    SimpleDerivedClass(    int i, float j) {  }
+        protected SimpleDerivedClass(int i, byte j) { }
+        private   SimpleDerivedClass(int i, Object j) {  }
+                  SimpleDerivedClass(int i) { }
+        protected internal SimpleDerivedClass(byte i, int j) { }
+
+    static    SimpleDerivedClass() { }
+
+    // dotted member function
+        void BaseInterface.method()             { }
+        char BaseInterface.bMethod()    { return 'a'; }
+
+        void MemberFuncWithArgs(int i, int j, Object k) { }
+        void MemberFuncWithManyArgs(byte a1, char a2, short a3, int a4, long a5, float a6, double a7, bool a8, decimal a9,
+                                    byte b1, char b2, short b3, int b4, long b5, float b6, double b7, bool b8, decimal b9,
+                                    byte c1, char c2, short c3, int c4, long c5, float c6, double c7, bool c8, decimal c9)
+                                                                { }
+
+        private   int    OverloadedFunction(int i) { return privateMember; }
+        protected void   OverloadedFunction(int i, int j) { }
+        public    int    OverloadedFunction() { return 0; }
+                  int    OverloadedFunction(float i) { return 1; }
+        static           Object OverloadedFunction(Object i) { return null; }
+
+        static new void meth3() {}
+
+        const int ANOTHER_CONSTANT = CONSTANT_VALUE + 1;
+    const int CONSTANT_VALUE = 5;
+
+    new void MemberFunc() { return; }
+
+}
+
+class DerivedFromDotted : AClass.NestedClass.NestedNestedClass
+{
+}
+
+
+abstract class AbstractClass
+{
+        protected abstract void AnotherAbstractFunction();
+
+    public abstract int AbstractFunction();
+        public virtual int  VirtualFunction() { return 0; }
+        protected virtual int  AnotherVirtualFunction() { AnotherAbstractFunction(); return 0; }
+
+        protected int hiddenField;
+}
+
+abstract class DerivedClass : AbstractClass
+{
+    public override int AbstractFunction() { AnotherAbstractFunction(); return 0; }
+        public override int VirtualFunction() { return 1; }
+        new      void AnotherVirtualFunction() {}
+}
+
+
diff --git a/tests/fsharp/core/csfromfs/methods.cs b/tests/fsharp/core/csfromfs/methods.cs
new file mode 100644
index 0000000..d4aefac
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/methods.cs
@@ -0,0 +1,348 @@
+namespace Methods
+{
+    public class StaticMethodsWithRefParams
+    {
+        static public void IntegerOutParam(out int x) { x = 3; }
+    }
+
+    public class VirtualMethodsWithRefParams
+    {
+        virtual public void IntegerOutParam(out int x) { x = 3; }
+    }
+
+    public enum E { Red, Green, Blue, Black }
+    public struct OneString { public string x; public OneString(string s) { x = s; } }
+    public struct OneDouble { public double x; public OneDouble(double s) { x = s; } }
+
+    public class TestMethods<T, U>
+    {
+        T x;
+        public T m0()
+        {
+            return x;
+        }
+
+        public T withlocal_m0()
+        {
+            T local = x;
+            return local;
+        }
+
+        public T m1(T x1)
+        {
+            System.Console.WriteLine(x1);
+            return x;
+        }
+
+        public T withlocal_m1(T x1)
+        {
+            T local = x1;
+            return local;
+        }
+
+        public T inline_m1(T x1)
+        {
+            return x;
+        }
+
+        public T m2(T x1, U x2)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            return x;
+        }
+
+        public T withlocal_m2(T x1, U x2)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            return local1;
+        }
+        public T inline_m2(T x1, U x2)
+        {
+            return x;
+        }
+        public T m3<V>(T x1, U x2, V x3)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            System.Console.WriteLine(x3);
+            return x;
+        }
+        public T withlocal_m3<V>(T x1, U x2, V x3)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            V local3 = x3;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            System.Console.WriteLine(local3);
+            return local1;
+        }
+
+        public T inline_m3<V>(T x1, U x2, V x3)
+        {
+            return x;
+        }
+        public T m4<V, W>(T x1, U x2, V x3, W x4)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            System.Console.WriteLine(x3);
+            System.Console.WriteLine(x4);
+            return x;
+        }
+        public T withlocal_m4<V, W>(T x1, U x2, V x3, W x4)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            V local3 = x3;
+            W local4 = x4;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            System.Console.WriteLine(local3);
+            System.Console.WriteLine(local4);
+            return local1;
+        }
+        public T inline_m4<V, W>(T x1, U x2, V x3, W x4)
+        {
+            return x;
+        }
+        public T r1(ref T x1)
+        {
+            System.Console.WriteLine(x1);
+            return x;
+        }
+
+        public T withlocal_r1(ref T x1)
+        {
+            T local = x1;
+            return local;
+        }
+
+        public T inline_r1(ref T x1)
+        {
+            return x;
+        }
+
+        public T r2(ref T x1, ref U x2)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            return x;
+        }
+
+        public T withlocal_r2(ref T x1, ref U x2)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            return local1;
+        }
+        public T inline_r2(ref T x1, ref U x2)
+        {
+            return x;
+        }
+        public T r3<V>(ref T x1, ref U x2, ref V x3)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            System.Console.WriteLine(x3);
+            return x;
+        }
+        public T withlocal_r3<V>(ref T x1, ref U x2, ref V x3)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            V local3 = x3;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            System.Console.WriteLine(local3);
+            return local1;
+        }
+
+        public T inline_r3<V>(ref T x1, ref U x2, ref V x3)
+        {
+            return x;
+        }
+        public T r4<V, W>(ref T x1, ref U x2, ref V x3, ref W x4)
+        {
+            System.Console.WriteLine(x1);
+            System.Console.WriteLine(x2);
+            System.Console.WriteLine(x3);
+            System.Console.WriteLine(x4);
+            return x;
+        }
+        public T withlocal_r4<V, W>(ref T x1, ref U x2, ref V x3, ref W x4)
+        {
+            T local1 = x1;
+            U local2 = x2;
+            V local3 = x3;
+            W local4 = x4;
+            System.Console.WriteLine(local1);
+            System.Console.WriteLine(local2);
+            System.Console.WriteLine(local3);
+            System.Console.WriteLine(local4);
+            return local1;
+        }
+        public T inline_r4<V, W>(ref T x1, ref U x2, ref V x3, ref W x4)
+        {
+            return x;
+        }
+    }
+
+
+    namespace TestLibrary
+    {
+        public struct TestStruct
+        {
+            float value;
+            public float Value { get { return value; } }
+
+            public TestStruct(float value)
+            {
+                this.value = value;
+            }
+
+            public static TestStruct operator *(float scalar, TestStruct testStruct)
+            {
+                return new TestStruct(scalar * testStruct.Value);
+            }
+
+            public static TestStruct Add(TestStruct a, TestStruct b)
+            {
+                System.Console.WriteLine("Add by val");
+                return new TestStruct(a.Value + b.Value);
+            }
+
+            public static void Add(ref TestStruct a, ref TestStruct b, out TestStruct result)
+            {
+                System.Console.WriteLine("Add by ref");
+                result = new TestStruct(a.Value + b.Value);
+            }
+        }
+
+        public struct JustByVal
+        {
+            float value;
+            public float Value { get { return value; } }
+
+            public JustByVal(float value)
+            {
+                this.value = value;
+            }
+
+            public static JustByVal operator *(float scalar, JustByVal testStruct)
+            {
+                return new JustByVal(scalar * testStruct.Value);
+            }
+
+            public static JustByVal Add(JustByVal a, JustByVal b)
+            {
+                System.Console.WriteLine("Add by val");
+                return new JustByVal(a.Value + b.Value);
+            }
+        }
+
+        public struct JustByRef
+        {
+            float value;
+            public float Value { get { return value; } }
+
+            public JustByRef(float value)
+            {
+                this.value = value;
+            }
+
+            public static JustByRef operator *(float scalar, JustByRef testStruct)
+            {
+                return new JustByRef(scalar * testStruct.Value);
+            }
+
+            public static void Add(ref JustByRef a, ref JustByRef b, out JustByRef result)
+            {
+                System.Console.WriteLine("Add by ref");
+                result = new JustByRef(a.Value + b.Value);
+            }
+        }
+    }
+
+    public struct TestStruct
+    {
+        float value;
+        public float Value { get { return value; } }
+
+        public TestStruct(float value)
+        {
+            this.value = value;
+        }
+
+        public static TestStruct operator *(float scalar, TestStruct testStruct)
+        {
+            return new TestStruct(scalar * testStruct.Value);
+        }
+
+        public static TestStruct Add(TestStruct a, TestStruct b)
+        {
+            System.Console.WriteLine("Add by val");
+            return new TestStruct(a.Value + b.Value);
+        }
+
+        public static void Add(ref TestStruct a, ref TestStruct b, out TestStruct result)
+        {
+            System.Console.WriteLine("Add by ref");
+            result = new TestStruct(a.Value + b.Value);
+        }
+    }
+
+    public struct JustByVal
+    {
+        float value;
+        public float Value { get { return value; } }
+
+        public JustByVal(float value)
+        {
+            this.value = value;
+        }
+
+        public static JustByVal operator *(float scalar, JustByVal testStruct)
+        {
+            return new JustByVal(scalar * testStruct.Value);
+        }
+
+        public static JustByVal Add(JustByVal a, JustByVal b)
+        {
+            System.Console.WriteLine("Add by val");
+            return new JustByVal(a.Value + b.Value);
+        }
+    }
+
+    public struct JustByRef
+    {
+        float value;
+        public float Value { get { return value; } }
+
+        public JustByRef(float value)
+        {
+            this.value = value;
+        }
+
+        public static JustByRef operator *(float scalar, JustByRef testStruct)
+        {
+            return new JustByRef(scalar * testStruct.Value);
+        }
+
+        public static void Add(ref JustByRef a, ref JustByRef b, out JustByRef result)
+        {
+            System.Console.WriteLine("Add by ref");
+            result = new JustByRef(a.Value + b.Value);
+        }
+    }
+
+}
+
+
+
diff --git a/tests/fsharp/core/csfromfs/methods.fs b/tests/fsharp/core/csfromfs/methods.fs
new file mode 100644
index 0000000..575ef6e
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/methods.fs
@@ -0,0 +1,150 @@
+#indent "off"
+
+
+open Methods
+
+let failures = ref false
+let test s b = 
+  if not b then (stderr.WriteLine ("FAILED: "+s); failures := true)
+
+
+
+
+do test "fws321" (let res = ref 0 in Methods.StaticMethodsWithRefParams.IntegerOutParam(res); !res = 3)
+
+do test "fws322" (let x = {new Methods.VirtualMethodsWithRefParams() with member __.IntegerOutParam(res) = res <- 4} in
+                  let res = ref 0 in 
+                  (x.IntegerOutParam(res); !res = 4))
+         
+do test "fws3223" (let x = {new Methods.VirtualMethodsWithRefParams() with member __.IntegerOutParam(res : int byref) = res <- 4} in
+                  let res = ref 0 in 
+                  (x.IntegerOutParam(res); !res = 4))
+         
+
+let tester(x1,x2,x3,x4) = 
+  let o = new TestMethods<_,_> (* <T,U> *) () in
+  ignore (o.m0()) ;
+  ignore (o.m1(x1)) ;
+  ignore (o.inline_m1(x1) );
+  ignore (o.withlocal_m1(x1));
+  ignore (o.m2(x1,x2) );
+  ignore (o.inline_m2(x1,x2));
+  ignore (o.withlocal_m2(x1,x2));
+  ignore (o.m3 (* (<V>) *)(x1,x2,x3));
+  ignore (o.inline_m3 (* (<V>) *)(x1,x2,x3));
+  ignore (o.withlocal_m3 (* (<V>) *)(x1,x2,x3));
+  ignore (o.m4 (* (<V,W>) *)(x1,x2,x3,x4));
+  ignore (o.inline_m4 (* (<V,W>) *) (x1,x2,x3,x4));
+  ignore (o.withlocal_m4 (* (<V,W>) *) (x1,x2,x3,x4));
+  ignore (o.r1(ref x1));
+  ignore (o.inline_r1(ref x1));
+  ignore (o.withlocal_r1(ref x1));
+  ignore (o.r2(ref x1,ref x2));
+  ignore (o.inline_r2(ref x1,ref x2));
+  ignore (o.withlocal_r2(ref x1,ref x2));
+  ignore (o.r3 (* (<V>) *) (ref x1,ref x2,ref x3));
+  ignore (o.inline_r3 (* (<V>) *)(ref x1,ref x2,ref x3));
+  ignore (o.withlocal_r3 (* (<V>) *) (ref x1,ref x2,ref x3));
+  ignore (o.r4(* (<V,W>) *) (ref x1,ref x2,ref x3,ref x4));
+  ignore (o.inline_r4 (* (<V,W>) *) (ref x1,ref x2,ref x3,ref x4));
+  ignore (o.withlocal_r4 (* (<V,W>) *) (ref x1,ref x2,ref x3,ref x4))
+    
+do
+  tester (* (<int,int,int,int>) *) (1,2,3,4);
+  tester (* (<E,E,E,E>) *) (E.Red,E.Green,E.Blue,E.Black);
+  tester (* (<int,string,int,string>) *) (1,"2",3,"string4");
+  tester (* (<int,OneString,int,OneString>) *) (1,new OneString("2"),3,new OneString("string4"));
+  tester (* (<E,string,E,string>) *) (E.Red,"2",E.Blue,"string4");
+  tester (* (<int,object,int,object>) *) (1,"2",3,"string4");
+  let dt = System.DateTime.Parse("Jan 1 2001") in
+  tester (* (<DateTime,DateTime,DateTime,DateTime>) *) (dt,dt,dt,dt);
+  tester (* (<DateTime,string,DateTime,string>) *) (dt,"string2",dt,"string4");
+  tester (* (<DateTime,object,DateTime,object>) *) (dt,"string2",dt,"string4");
+  tester (* (<DateTime,int,DateTime,int>) *) (dt,2,dt,4);
+  tester (* (<double,int,double,int>) *) (1.0,2,3.0,4);
+  tester (* (<E,string,E,string>) *) (E.Red,"string2",E.Blue,"string4");
+  tester (* (<E,OneString,E,OneString>) *) (E.Red,new OneString("string2"),E.Blue,new OneString("string4"));
+  tester (* (<double,string,double,string>) *) (1.0,"string2",3.0,"string4");
+  tester (* (<OneDouble,string,double,string>) *) (new OneDouble(1.0),"string2",3.0,"string4");
+  tester (* (<double,object,double,object>) *) (1.0,"string2",3.0,"string4")
+
+let sort (f: 'a -> 'a -> int) (arr : 'a array) =
+  let len = Array.length arr in 
+  if len < 2 then () 
+  else 
+    if len = 2 then begin
+      let c = f arr.[0] arr.[1] in 
+      if c > 0 then  begin
+        let tmp = arr.[0] in 
+        arr.[0] <- arr.[1]; 
+        arr.[1] <- tmp
+      end
+    end             
+    else begin
+        System.Array.Sort( arr, 
+                          { new System.Collections.Generic.IComparer<_> 
+                              with member __.Compare(a,b) = f a b
+                       } )
+    end
+
+// Overloads
+
+open System
+
+do Console.WriteLine("res = {0}\n",Decimal.op_Addition(new Decimal(10), new Decimal(10)))
+do Console.WriteLine("res = {0}\n",(new Decimal(10)) + (new Decimal(10)))
+do Console.WriteLine("res = {0}\n",(new DateTime(1970,10,1)) + (new TimeSpan(1000000000L)))
+//do Console.WriteLine("res = {0}\n",(new DateTime(1970,10,1)) - (new TimeSpan(1000000000L)))
+//do Console.WriteLine("res = {0}\n",(new DateTime(1970,10,1)) - (new DateTime(1970,10,1)))
+do Console.WriteLine("res = {0}\n",(new Decimal(20)) / (new Decimal(10)))
+do Console.WriteLine("res = {0}\n",(new Decimal(20)) - (new Decimal(10)))
+do Console.WriteLine("res = {0}\n",(new Decimal(20)) * (new Decimal(10)))
+
+do Console.WriteLine("res = {0}\n",(new Decimal(20)) % (new Decimal(7)))
+
+
+module CheckOverloadedMethods_FSharp_1_0_4546 = begin
+
+
+    open Methods.TestLibrary
+
+    module ErrorCase1 =  begin
+        //        public static TestStruct operator *(float scalar, TestStruct testStruct)
+        //        public static TestStruct Add(TestStruct a, TestStruct b)
+        //        public static void Add(ref TestStruct a, ref TestStruct b, out TestStruct result)
+        let a = TestStruct 5.0f
+        let b = TestStruct 5.0f
+        let r = 5.0f * (TestStruct.Add(a, b))  // ERROR
+    end
+
+    module OkCase2 =  begin
+        //        public static JustByVal operator *(float scalar, JustByVal testStruct)
+        //        public static JustByVal Add(JustByVal a, JustByVal b)
+        let a = JustByVal 5.0f
+        let b = JustByVal 5.0f
+        let r = 5.0f * (JustByVal.Add (a, b))   // OK
+    end
+
+    module OkCase3 =  begin
+    //        public static JustByRef operator *(float scalar, JustByRef testStruct)
+    //        public static void Add(ref JustByRef a, ref JustByRef b, out JustByRef result)
+        let mutable a = JustByRef 5.0f
+        let mutable b = JustByRef 5.0f
+        let r =  5.0f * (JustByRef.Add (&a, &b))  // OK
+    end
+
+
+end
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
+
+
+
+
diff --git a/tests/fsharp/core/csfromfs/nested-types-error.bsl b/tests/fsharp/core/csfromfs/nested-types-error.bsl
new file mode 100644
index 0000000..9e9452c
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/nested-types-error.bsl
@@ -0,0 +1,18 @@
+
+nested-types-error.fs(8,8,8,27): typecheck error FS0491: The member or object constructor 'ProtectedMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+nested-types-error.fs(9,13,9,32): typecheck error FS0491: The member or object constructor 'ProtectedProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+nested-types-error.fs(14,8,14,27): typecheck error FS0491: The member or object constructor 'ProtectedMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+nested-types-error.fs(15,13,15,32): typecheck error FS0491: The member or object constructor 'ProtectedProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+nested-types-error.fs(18,13,18,55): typecheck error FS0801: This type has no accessible object constructors
+
+nested-types-error.fs(26,9,26,36): typecheck error FS0801: This type has no accessible object constructors
+
+nested-types-error.fs(27,9,27,57): typecheck error FS0801: This type has no accessible object constructors
+
+nested-types-error.fs(28,9,28,36): typecheck error FS0801: This type has no accessible object constructors
+
+nested-types-error.fs(29,9,29,51): typecheck error FS0801: This type has no accessible object constructors
diff --git a/tests/fsharp/core/csfromfs/nested-types-error.fs b/tests/fsharp/core/csfromfs/nested-types-error.fs
new file mode 100644
index 0000000..be87661
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/nested-types-error.fs
@@ -0,0 +1,30 @@
+module Test
+
+type T() = 
+    inherit CSLib.Outer()
+
+    let a = CSLib.Outer.ProtectedInner1()
+
+    do a.ProtectedMethod()
+    let _ = a.ProtectedProperty
+
+    let b = CSLib.Outer.ProtectedInner1.ProtectedInnerInner1()
+    
+    let c = CSLib.Outer.ProtectedInner2()
+    do c.ProtectedMethod()
+    let _ = c.ProtectedProperty
+
+    let d = CSLib.Outer.ProtectedInner3()
+    let e = CSLib.Outer.ProtectedInner3.ProtectedInner()
+    
+    let f = CSLib.Outer.PublicInner1()
+    do f.PublicMethod()
+    let _ = f.PublicProperty
+    
+    let g = CSLib.Outer.PublicInner1.ProtectedInnerInner1()
+
+let a = CSLib.Outer.ProtectedInner1()
+let b = CSLib.Outer.ProtectedInner1.ProtectedInnerInner1()
+let d = CSLib.Outer.ProtectedInner3()
+let e = CSLib.Outer.ProtectedInner3.ProtectedInner()
+let g = CSLib.Outer.PublicInner1.ProtectedInnerInner1()
\ No newline at end of file
diff --git a/tests/fsharp/core/csfromfs/nested-types.cs b/tests/fsharp/core/csfromfs/nested-types.cs
new file mode 100644
index 0000000..154f676
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/nested-types.cs
@@ -0,0 +1,80 @@
+namespace CSLib
+{
+    public class Outer
+    {
+        // protected void OuterProtectedMethod()
+        // {
+        // }
+
+        // protected int OuterProtectedProperty { get; set; }
+        
+        public class PublicInner1
+        {
+            public class ProtectedInnerInner1
+            {
+            }
+
+            public void PublicMethod()
+            {
+            }
+
+            protected void ProtectedMethod()
+            {
+            }
+
+            public int PublicProperty { get; set; }
+
+            protected int ProtectedProperty { get; set; }
+        
+        }
+
+        protected class ProtectedInner1
+        {
+            public class ProtectedInnerInner1
+            {
+            }
+
+            public ProtectedInner1()
+            {
+            }
+
+            public void PublicMethod()
+            {
+            }
+
+            protected void ProtectedMethod()
+            {
+            }
+
+            public int PublicProperty { get; set; }
+
+            protected int ProtectedProperty { get; set; }
+        }
+
+        protected class ProtectedInner2 : Outer
+        {
+            public ProtectedInner2()
+            {
+            }
+
+            public void PublicMethod()
+            {
+            }
+
+            protected void ProtectedMethod()
+            {
+            }
+
+            public int PublicProperty { get; set; }
+
+            protected int ProtectedProperty { get; set; }
+        }
+
+        protected class ProtectedInner3
+        {
+            protected class ProtectedInner
+            {
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/fsharp/core/csfromfs/nested-types.fs b/tests/fsharp/core/csfromfs/nested-types.fs
new file mode 100644
index 0000000..8ee692a
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/nested-types.fs
@@ -0,0 +1,32 @@
+module Test
+
+type T() = 
+    inherit CSLib.Outer()
+
+    let a = CSLib.Outer.ProtectedInner1()
+    do a.PublicMethod()
+    let _ = a.PublicProperty
+
+    // do a.ProtectedMethod()
+    // let _ = a.ProtectedProperty
+
+    let b = CSLib.Outer.ProtectedInner1.ProtectedInnerInner1()
+
+    let c = CSLib.Outer.ProtectedInner2()
+    // TODO: do not show them in intellisense
+    //do c.OuterProtectedMethod()
+    //let _ = c.OuterProtectedProperty
+
+    // do c.ProtectedMethod()
+    //let _ = c.ProtectedProperty
+
+    let d = CSLib.Outer.ProtectedInner3()
+    //let e = CSLib.Outer.ProtectedInner3.ProtectedInner()
+    
+    let f = CSLib.Outer.PublicInner1()
+    do f.PublicMethod()
+    let _ = f.PublicProperty
+    
+    let g = CSLib.Outer.PublicInner1.ProtectedInnerInner1()
+
+//let a = CSLib.Outer.ProtectedInner1()
\ No newline at end of file
diff --git a/tests/fsharp/core/csfromfs/optional.fs b/tests/fsharp/core/csfromfs/optional.fs
new file mode 100644
index 0000000..a622f18
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/optional.fs
@@ -0,0 +1,114 @@
+
+//#r "Excel.dll"
+
+// In Office 2003 and XP the Excel.dll defines a namespace 'Excel'
+// In Office 2007 it defines a namespace 'Microsoft.Office.Interop.Excel'
+// This hack means that we don't get an error when opening Microsoft.Office.Interop 
+// if it's not present
+open Microsoft.Office.Interop.Excel
+
+open System
+open System.Reflection
+
+// Create new Excel.Application
+let app = new ApplicationClass(Visible = true) 
+
+// Get the workbooks collection
+let workbooks = app.Workbooks
+
+// Add a new workbook
+let workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet) 
+
+// Get the worksheets collection
+let sheets = workbook.Worksheets 
+
+let worksheet = (sheets.[box 1] :?> _Worksheet) 
+
+Console.WriteLine ("Setting the value for cell")
+
+// This puts the value 5 to the cell G1 
+worksheet.Range("G1", Reflection.Missing.Value).Value2 <- 5
+
+// This sends a single dimension array to Excel 
+worksheet.Range("A1", "E1").Value2 <- [| for i in 0 .. 4 -> i * i |]
+worksheet.Range("A2", "E2").Value2 <- [| for i in 0 .. 4 -> sin (float i) |]
+
+// This sends a two dimension array to Excel 
+let array3 = Array2D.init 4 5 (fun i j -> i*10 + j) 
+worksheet.Range("A3", "E6").Value2 <- array3
+
+// This reads a two dimension array from Excel 
+let array4 = (worksheet.Range("A3", "E6").Value2 :?> obj[,]) 
+
+printf "Low: %d\n" (array4.GetLowerBound(0))
+for i=array4.GetLowerBound(0) to array4.GetUpperBound(0) do
+    for j=array4.GetLowerBound(1) to array4.GetUpperBound(1) do
+        printf "Compare %d, %d " i j;
+        if int (Array2D.get array4 i j :?> float) <> Array2D.get array3 (i-array4.GetLowerBound(0))  (j-array4.GetLowerBound(1)) then
+            Console.WriteLine ("ERROR: Comparison FAILED!")
+
+//  This fills two dimension array with points for two curves and sends it to Excel 
+let range5 = worksheet.Range("A8", "J9") 
+let array5 = 
+    Array2D.init 2 10
+        (fun i j -> 
+            let arg = (Math.PI / 10.0) * float j 
+            if i = 0 then Math.Sin(arg) else Math.Cos(arg))
+range5.Value2 <- array5
+
+// The following code would draw the chart if it wasn't for the Excel/CLR bug further below 
+range5.Select()
+
+let chartobjects = (worksheet.ChartObjects() :?> ChartObjects) 
+let chartobject = chartobjects.Add(10.0, 100.0, 450.0, 250.0) 
+
+// Make the chart
+chartobject.Chart.ChartWizard(Source = range5,
+                              Gallery = XlChartType .xl3DColumn,
+                              //Format = Missing.Value,
+                              PlotBy = XlRowCol.xlRows,
+                              //CategoryLabels = Missing.Value,
+                              //SeriesLabels = Missing.Value,
+                              HasLegend = true,
+                              Title = "Sample Chart",
+                              CategoryTitle = "Sample Category Type",
+                              ValueTitle = "Sample Value Type")
+                              //ExtraTitle = Missing.Value)
+                              
+chartobject.Chart.ChartWizard(range5,
+                              XlChartType .xl3DColumn,
+                              //Format = Missing.Value,
+                              XlRowCol.xlRows,
+                              //CategoryLabels = Missing.Value,
+                              //SeriesLabels = Missing.Value,
+                              true,
+                              Title = "Sample Chart",
+                              CategoryTitle = "Sample Category Type",
+                              ValueTitle = "Sample Value Type")
+                              //ExtraTitle = Missing.Value)
+                              
+chartobject.Chart.ChartWizard(range5,
+                              XlChartType .xl3DColumn,
+                              //Format = Missing.Value,
+                              XlRowCol.xlRows,
+                              //CategoryLabels = Missing.Value,
+                              //SeriesLabels = Missing.Value,
+                              true,
+                              ?Title = Some (box "Sample Chart"),
+                              ?CategoryTitle = Some (box "Sample Category Type"),
+                              ?ValueTitle = Some (box "Sample Value Type"))
+                              //ExtraTitle = Missing.Value)
+                              
+chartobject.Chart.ChartWizard(range5,
+                              XlChartType .xl3DColumn,
+                              ?Format = Some (box Missing.Value),
+                              ?PlotBy = Some (box XlRowCol.xlRows),
+                              ?CategoryLabels = Some (box Missing.Value),
+                              ?SeriesLabels = Some (box Missing.Value),
+                              ?HasLegend = Some (box true),
+                              ?Title = Some (box "Sample Chart"),
+                              ?CategoryTitle = Some (box "Sample Category Type"),
+                              ?ValueTitle = Some (box "Sample Value Type"))
+                              //ExtraTitle = Missing.Value)
+                              
+                              
\ No newline at end of file
diff --git a/tests/fsharp/core/csfromfs/properties.cs b/tests/fsharp/core/csfromfs/properties.cs
new file mode 100644
index 0000000..e4bfcb1
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/properties.cs
@@ -0,0 +1,214 @@
+
+//****************************************************************************
+// properties
+//****************************************************************************
+
+namespace CSharpProperties
+{
+	public class Class
+	{
+		public int prop {
+			get {
+				return propertyValue;
+			}
+			set {
+				propertyValue = value;
+			}
+		}
+
+		private int propertyValue = 12;
+        
+	}
+
+	public struct Struct
+	{
+		public int prop {
+			get {
+				return propertyValue;
+			}
+			set {
+				propertyValue = value;
+			}
+		}
+
+		private int propertyValue;
+	}
+	public interface Interface
+	{
+		object objectProperty {
+			get; 
+		}
+
+		string stringProperty {
+			get;
+		}
+	}
+
+	public interface Interface2
+	{
+		object objectProperty {
+			get; 
+		}
+
+		string stringProperty {
+			get;
+		}
+	}
+
+	public abstract class AbstractBase
+	{
+		public abstract int splitProperty {
+			get;
+			set;
+		}
+
+		public string stringProperty {
+			get {
+				return string.Copy("foo");
+			}
+		}
+	}
+
+	public abstract class DerivedAbstractClass : AbstractBase
+	{
+		public override int splitProperty {
+			set {
+				myValue = value;
+			}
+		}
+
+		protected int myValue;
+
+		public object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		new public string stringProperty() {
+			return null;
+		}
+	}
+
+	public class DerivedClass : DerivedAbstractClass, Interface {
+		public override int splitProperty {
+			get {
+				return myValue;
+			}
+		}
+
+		new private object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		new public int stringProperty {
+			get {
+				return 0;
+			}
+		}
+	}
+
+	public class ExplicitInterfaceClass : Interface, Interface2
+	{
+		public object objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		object Interface2.objectProperty {
+			get {
+				return null;
+			}
+		}
+
+		public string stringProperty {
+			get {
+				return string.Copy("foo");
+			}
+		}
+
+		string Interface.stringProperty {
+			get {
+				return null;
+			}
+		}
+	}
+	public struct StructImplementingInterface : Interface
+	{
+		public object objectProperty {
+			get {
+				return objectPropertyValue;
+			}
+			set {
+				objectPropertyValue = value;
+			}
+		}
+
+		private object objectPropertyValue;
+		public string stringProperty {
+			get {
+				return stringPropertyValue;
+			}
+			set {
+				stringPropertyValue = value;
+			}
+		}
+
+		private string stringPropertyValue;
+	}
+
+}
+
+
+// See bug 6389: used to test implicit setting of C# properties through named arguments
+namespace Ninject.Planning.Bindings
+{
+    public interface IRequest
+    {
+    }
+ 
+    public interface IBinding
+    {
+        System.Type Service { get; }
+        System.Func<IRequest, bool> Condition { get; set; }
+    }
+ 
+    public class Binding : IBinding
+    {
+
+        public System.Type Service { get; private set; }
+
+        public System.Func<IRequest, bool> Condition { get; set; }
+        
+    }
+ 
+    public class Request : IRequest
+    {
+    }
+}
+ 
+
+ 
+// See bug 6389: used to test implicit setting of C# fields through named arguments
+namespace Ninject.Planning.Bindings2
+{
+    public interface IRequest
+    {
+    }
+ 
+    public class Binding 
+    {
+
+        public System.Type Service;
+        public System.Func<IRequest, bool> Condition;
+        
+    }
+ 
+    public class Request : IRequest
+    {
+    }
+}
+ 
diff --git a/tests/fsharp/core/csfromfs/properties.fs b/tests/fsharp/core/csfromfs/properties.fs
new file mode 100644
index 0000000..68f3eef
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/properties.fs
@@ -0,0 +1,124 @@
+
+module Properties
+
+let failures = ref false
+let report_failure s  = 
+  stderr.WriteLine ("NO: test "+s+" failed"); failures := true
+
+open CSharpProperties
+
+let testProperties = 
+  let c = new Class() in 
+  if c.prop <> 12 then report_failure "fweoijwe";
+  c.prop <- 13;
+  if c.prop <> 13 then report_failure "oijeoijwe";
+  let s = new Struct() in 
+  if s.prop <> 0 then report_failure "fwe26e";
+(* BUG: mutation of structs has incorrect semantics 
+  s.prop <- 17;
+  if s.prop <> 17 then report_failure "oiuowjeoijwe"; *)
+  ()
+
+// Check that func -->delegate conversions apply for implicit property setters, for ad C#-defined type
+module FSharp_1_0_Bug_6389_Example1 = 
+    open Ninject.Planning.Bindings
+     
+    let h1 = new Binding( Condition = new System.Func<IRequest, bool>((fun x -> true)) );
+     
+    let h2 = new Binding( Condition = fun x -> true );
+     
+    // Note, this does typecheck, because uses of property setters are method calls, and hence member conversions are allowed
+    let k = new Binding();
+    k.Condition <- fun x -> false
+
+    let t1 = k.Condition.Invoke(new Request())
+    let t2 = h1.Condition.Invoke(new Request())
+    let t3 = h2.Condition.Invoke(new Request())
+
+     
+// Check same, for an F#-defined type
+module FSharp_1_0_Bug_6389_Example2 = 
+    type IRequest = interface end
+    type IBinding =
+      abstract Service : System.Type
+      abstract Condition :System.Func<IRequest, bool> with get,set
+ 
+    type Binding() = 
+      let mutable service = null
+      let mutable cond = null
+      interface IBinding with 
+ 
+        member x.Service with get() = service 
+        member x.Condition with get() = cond and set v = (cond <- v)
+      member x.Service with get() = service 
+      member x.Condition with get() = cond and set v = (cond <- v)
+ 
+    type Request()  =
+      interface IRequest
+ 
+
+    // Explicit coercion fun -> Func: no runtime exception
+    let h1 = new Binding( Condition = new System.Func<IRequest, bool>((fun x -> true)) );
+     
+    // No explicit coercion fun -> Func: runtime exception "Invalid cast..."
+    let h2 = new Binding( Condition = fun x -> true );
+     
+    // Note, this does typecheck, because uses of property setters are method calls, and hence member conversions are allowed
+    let k = new Binding();
+    k.Condition <- fun x -> false
+     
+    // Dummy code to invoke the Conditions... and see the runtime behavior
+    let t1 = k.Condition.Invoke(new Request())
+    let t2 = h1.Condition.Invoke(new Request())
+    let t3 = h2.Condition.Invoke(new Request())
+
+// Example of post-hoc setting of record fields
+module FSharp_1_0_Bug_6389_Example3 = 
+    type IRequest = interface end
+    type Binding = 
+      { Service : System.Type
+        mutable Condition : System.Func<IRequest, bool> }
+      static member Create() = { Service=null; Condition=null }
+ 
+    type Request()  =
+      interface IRequest
+
+    // Explicit coercion fun -> Func: no runtime exception
+    let h1 = Binding.Create( Condition = new System.Func<IRequest, bool>((fun x -> true)) );
+     
+    // No explicit coercion fun -> Func: runtime exception "Invalid cast..."
+    let h2 = Binding.Create( Condition = fun x -> true );
+     
+    // This does NOT type check, by design for F# v2.0, suggestion FSharp 1.0, 6495 for F# vNext. 
+    // Assignments to record fields are not method calls, hence no conversions.
+    //
+    //let k = Binding.Create();
+    //k.Condition <- fun x -> false
+     
+    // Dummy code to invoke the Conditions... and see the runtime behavior
+    let t2 = h1.Condition.Invoke(new Request())
+    let t3 = h2.Condition.Invoke(new Request())
+
+// Example of post-hoc setting of .NET fields
+module FSharp_1_0_Bug_6389_Example4 = 
+    open Ninject.Planning.Bindings2
+
+    let h1 = new Binding( Condition = new System.Func<IRequest, bool>((fun x -> true)) );
+     
+    let h2 = new Binding( Condition = fun x -> true );
+     
+    // This does NOT type check, by design for F# v2.0, suggestion FSharp 1.0, 6495 for F# vNext. 
+    // Assignments to fields are not method calls, hence no conversions.
+    //
+    //let k = Binding.Create();
+    //k.Condition <- fun x -> false
+     
+    // Dummy code to invoke the Conditions... and see the runtime behavior
+    let t2 = h1.Condition.Invoke(new Request())
+    let t3 = h2.Condition.Invoke(new Request())
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/csfromfs/run.bat b/tests/fsharp/core/csfromfs/run.bat
new file mode 100644
index 0000000..867e714
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/run.bat
@@ -0,0 +1,74 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+
+REM **************************
+
+  %CLIX% .\collections.exe
+  if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+%CLIX% .\events.exe
+if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+%CLIX% .\indexers.exe
+if ERRORLEVEL 1 goto Error
+
+
+REM **************************
+
+%CLIX% .\fields.exe
+if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+
+  %CLIX% .\byrefs.exe
+  if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+%CLIX% .\methods.exe
+if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+%CLIX% .\properties.exe
+if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+  %CLIX% .\classes.exe
+  if ERRORLEVEL 1 goto Error
+
+REM **************************
+
+  %CLIX% .\ProtectedMethodOpt.exe 
+  if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/csfromfs/test.fs b/tests/fsharp/core/csfromfs/test.fs
new file mode 100644
index 0000000..717cccb
--- /dev/null
+++ b/tests/fsharp/core/csfromfs/test.fs
@@ -0,0 +1,81 @@
+// #Conformance #Interop #Fields #MemberDefinitions #MethodsAndProperties #Events #Classes #OptionalArguments 
+#indent "off"
+
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine "NO"; failures := true
+
+
+
+(*
+let myForm n = {new Form("abc",n,4,6) with 
+                  with OnPaint ev = this.OnPaint()... this.base.OnPaint() .... Printf.printf "%d" n; 
+                  and  OnButtonClick(this,ev) = ... }
+let myForm n = {new Form() with OnPaint(ev) = Printf.printf "%d" n; }
+
+*)
+
+
+let myComparer = {new System.Collections.IComparer with Compare(a,b) = compare a b}
+let myGComparer () = {new System.Collections.Generic.IComparer<'a>
+                      with Equals(x,y) = (x = y) 
+                      and  GetHashCode(x) = Hashtbl.hash x
+                      and  Compare(a,b) = compare a b}
+let myFormattable = {new System.IFormattable with ToString(fmt,fmtProvider) = "<to-string>"}
+let myEnum = 
+  let start = 10 in 
+  let x = ref start in  
+  {new System.Collections.IEnumerator 
+              with get_Current() = box("x = "^string_of_int !x) 
+              and MoveNext() = (x := !x - 1; (!x > 0) )
+              and Reset() = x := start}
+
+let iterate (e: System.Collections.IEnumerator) f = 
+  while (e.MoveNext()) do
+    f e.Current;
+  done
+
+let _ = iterate myEnum (fun obj -> Printf.printf "item = %s\n" (unbox obj))
+
+let myEnumG = 
+  let start = 10 in 
+  let x = ref start in  
+  {new System.Collections.Generic.IEnumerator`1<string>
+              with get_Current() = "x = "^string_of_int !x
+              and MoveNext() = (x := !x - 1; (!x > 0) ) 
+              and Dispose() = () }
+
+let iterateG (e: 'a System.Collections.Generic.IEnumerator`1) f = 
+  while (e.MoveNext()) do
+    f e.Current;
+  done
+
+let _ = iterateG myEnumG (fun s -> Printf.printf "generic item = %s\n" s)
+
+
+
+let myForm title n =
+  let res = 
+    {new System.Windows.Forms.Form() 
+      with OnPaint(paintEventArgs) = Printf.printf "OnPaint: n = %d\n" n
+      and OnResize(eventArgs) = Printf.printf "OnResize: n = %d\n" n } in
+   res.Text <- title;
+   res
+
+let form1 = myForm "Here be the main form" 3
+let form2 = myForm "Here be a dialog" 4
+let _ = form2.ShowDialog()
+
+let _ = System.Windows.Forms.Application.Run(form1)
+                       
+                       
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+    else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
+
+
diff --git a/tests/fsharp/core/events/build.bat b/tests/fsharp/core/events/build.bat
new file mode 100644
index 0000000..8f7b1f9
--- /dev/null
+++ b/tests/fsharp/core/events/build.bat
@@ -0,0 +1,46 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+REM only a valid test if generics supported
+
+  "%FSC%" %fsc_flags% -a -o:test.dll -g test.fs
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test.dll
+  @if ERRORLEVEL 1 goto Error
+
+
+  %CSC% /r:"%FSCOREDLLPATH%" /reference:test.dll /debug+ testcs.cs
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" testcs.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/events/run.bat b/tests/fsharp/core/events/run.bat
new file mode 100644
index 0000000..3a96d43
--- /dev/null
+++ b/tests/fsharp/core/events/run.bat
@@ -0,0 +1,38 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+if exist test.ok (del /f /q test.ok)
+
+%CLIX% "%FSI%" test.fs && (
+dir test.ok > NUL 2>&1 ) || (
+ at echo :FSI failed;
+goto Error
+set ERRORMSG=%ERRORMSG% FSI failed;
+)
+
+%CLIX% .\testcs.exe
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/events/test.fs b/tests/fsharp/core/events/test.fs
new file mode 100644
index 0000000..f4ffaf3
--- /dev/null
+++ b/tests/fsharp/core/events/test.fs
@@ -0,0 +1,552 @@
+// #Regression #Conformance #Events #Regression #Interop 
+#light
+
+module Test
+
+let mutable failures = []
+let report_failure s =  failures <- failures @ [s]
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else stderr.WriteLine " NO"; report_failure s
+let check s b1 b2 = 
+   stderr.Write(s:string);  
+   if b1 = b2 then 
+       stderr.WriteLine " OK" 
+   else 
+       printfn ", FAILED: expected %A, got %A" b2 b1;
+       report_failure s
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+open System
+open System.Drawing
+open System.ComponentModel
+open System.Windows.Forms
+
+module EventTest2 = 
+
+    type SomeComponent() = 
+        let ev1 = new Event<string>()
+        let ev2 = new Event<EventArgs>()
+        [<CLIEvent>]    
+        member x.SomeEvent = ev1.Publish
+        [<CLIEvent>]    
+        member x.Paint = ev2.Publish
+        member x.Fire() = ev1.Trigger("hello"); ev2.Trigger(new EventArgs())
+    
+    let mk() = new SomeComponent()
+    let fire (c:SomeComponent) = c.Fire()
+
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("SomeEvent").Name) "SomeEvent"
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("SomeEvent").GetAddMethod().Name) "add_SomeEvent"
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("SomeEvent").GetRaiseMethod()) null
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("SomeEvent").GetRemoveMethod().Name) "remove_SomeEvent"
+
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("Paint").Name) "Paint"
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("Paint").GetAddMethod().Name) "add_Paint"
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("Paint").GetRaiseMethod()) null
+    check "fewnew0" (typeof<SomeComponent>.GetEvent("Paint").GetRemoveMethod().Name) "remove_Paint"
+
+module AbtsractEventTests =
+
+
+    type ChannelChangedHandler = delegate of obj * int -> unit
+
+    type C() =  
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+
+        static let defaultChannelChanged = new Event<ChannelChangedHandler,_>()
+
+        [<CLIEvent>]    
+        member self.ChannelChanged = channelChanged.Publish
+
+        member self.ChangeChannel(n) = channelChanged.Trigger(self,n)
+
+        [<CLIEvent>]    
+        static member DefaultChannelChanged = defaultChannelChanged.Publish
+
+        static member ChangeDefaultChannel(n) = defaultChannelChanged.Trigger(null,n)
+
+
+
+    type I =  
+        [<CLIEvent>]    
+        abstract member ChannelChanged : IEvent<ChannelChangedHandler,int>
+
+
+    type ImplI() =  
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+        member self.ChangeChannel(n) = channelChanged.Trigger(self,n)
+        interface I with 
+            [<CLIEvent>]    
+            member self.ChannelChanged = channelChanged.Publish
+
+
+    type FrameworkImplI() =  
+        let channelChanged = new Event<System.ComponentModel.PropertyChangedEventHandler,_>()
+        member self.ChangeChannel(n) = channelChanged.Trigger(self,n)
+        interface System.ComponentModel.INotifyPropertyChanged with 
+            [<CLIEvent>]    
+            override self.PropertyChanged = channelChanged.Publish
+
+
+    [<AbstractClass>]
+    type Base() =  
+        [<CLIEvent>]    
+        abstract member ChannelChanged : IEvent<ChannelChangedHandler,int>
+
+
+    type Derived() =  
+        inherit Base()
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+        member self.ChangeChannel(n) = channelChanged.Trigger(self,n)
+        [<CLIEvent>]    
+        override self.ChannelChanged = channelChanged.Publish
+
+    let ObjectImplI() =  
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+        channelChanged.Trigger, 
+        { new I with 
+            [<CLIEvent>]    
+            member self.ChannelChanged = channelChanged.Publish }
+
+
+    let ObjectFrameworkImplI() =  
+        let channelChanged = new Event<System.ComponentModel.PropertyChangedEventHandler,_>()
+        channelChanged.Trigger,
+        { new System.ComponentModel.INotifyPropertyChanged with 
+            [<CLIEvent>]    
+            override self.PropertyChanged = channelChanged.Publish }
+
+
+    let ObjectDerived() =  
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+        channelChanged.Trigger, 
+        { new Base() with
+              [<CLIEvent>]    
+              override self.ChannelChanged = channelChanged.Publish }
+
+
+
+
+    let test(ev:IEvent<ChannelChangedHandler,_>, change) = 
+        let r = ref 0 
+        let h1 = ChannelChangedHandler(fun sender channel -> r := channel)
+        ev.AddHandler(h1)
+        change(3)
+        check "02374enw1" !r 3
+        ev.RemoveHandler(h1)
+        change(4)
+        check "02374enw2" !r 3
+
+        let r = ref 0 
+        let h1 = ChannelChangedHandler(fun sender channel -> r := channel)
+        let h2 = ChannelChangedHandler(fun sender channel -> r := channel+1)
+        ev.AddHandler(h1)
+        ev.AddHandler(h2)
+        change(3)
+        check "02374enw1" !r 4
+        ev.RemoveHandler(h2)
+        change(5)
+        check "02374enw2" !r 5
+        ev.RemoveHandler(h1)
+        change(6)
+        check "02374enw2" !r 5
+
+    let c = C()
+    let ev1 = c.ChannelChanged
+    let ev2 = C.DefaultChannelChanged
+    let d = Derived()
+    let impl = ImplI()
+    let ev3 = d.ChannelChanged
+    let ev4 = (impl :> I).ChannelChanged
+
+
+    test(ev1,c.ChangeChannel)
+    test(ev2,C.ChangeDefaultChannel)
+    test(ev3,d.ChangeChannel)
+    test(ev4,impl.ChangeChannel)
+
+module EventCombinators = 
+
+    type ChannelChangedHandler = delegate of obj * int -> unit
+
+    module Observable = 
+        let catch (e: IObservable<'T>) = 
+            { new IObservable<_> with  
+                member __.Subscribe(o:IObserver<_>) = 
+                    e.Subscribe({ new IObserver<_> with  
+                                      member x.OnNext(v) = o.OnNext(Choice1Of2 v)
+                                      member x.OnError(e) = o.OnNext(Choice2Of2 e)
+                                      member x.OnCompleted() = o.OnCompleted() }) }
+                                
+        let empty () = 
+            { new IObservable<_> with  
+                member __.Subscribe(o:IObserver<_>) = o.OnCompleted(); { new System.IDisposable with 
+                                                                            member __.Dispose() = () }  }
+                                
+        let error f (e: IObservable<'T>) = 
+                    e.Subscribe({ new IObserver<'T> with  
+                                      member x.OnNext(v) = ()
+                                      member x.OnError(e) = f e
+                                      member x.OnCompleted() = () }) 
+                         |> ignore
+                         
+        let completed f (e: IObservable<'T>) = 
+                    e.Subscribe({ new IObserver<'T> with  
+                                      member x.OnNext(v) = ()
+                                      member x.OnError(e) = ()
+                                      member x.OnCompleted() = f () }) 
+                         |> ignore
+                         
+        let fail () = 
+            { new IObservable<_> with  
+                member __.Subscribe(o:IObserver<_>) = 
+                              o.OnError( Failure "fail"); 
+                              { new System.IDisposable with 
+                                      member __.Dispose() = () }  }
+
+        // Obervers should ignore subsequent failures
+        let failTwice () = 
+            { new IObservable<_> with  
+                member __.Subscribe(o:IObserver<_>) = 
+                              o.OnError( Failure "fail1"); 
+                              o.OnError( Failure "fail2"); 
+                              { new System.IDisposable with 
+                                      member __.Dispose() = () }  }
+
+    type C() =  
+        let channelChanged = new Event<ChannelChangedHandler,_>()
+
+        static let defaultChannelChanged = new Event<ChannelChangedHandler,_>()
+
+        [<CLIEvent>]    
+        member self.ChannelChanged = channelChanged.Publish
+
+        member self.ChangeChannel(n) = channelChanged.Trigger(self,n)
+
+        [<CLIEvent>]    
+        static member DefaultChannelChanged = defaultChannelChanged.Publish
+
+        static member ChangeDefaultChannel(n) = defaultChannelChanged.Trigger(null,n)
+
+    module TestListen = 
+        let c1 = C()
+       
+        let result = ref 0 
+        c1.ChannelChanged |> Observable.add (fun x -> result := x)
+        c1.ChangeChannel(6)
+        check "e89e0jrweoi1" !result 6
+        c1.ChannelChanged |> Observable.add (fun x -> result := x + 1)
+        c1.ChangeChannel(6)
+        check "e89e0jrweoi2" !result 7
+    
+    module TestChoose = 
+        let c2 = C()
+       
+
+        let result = ref 0 
+        c2.ChannelChanged |> Observable.choose (fun x -> None) |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi3" !result 0
+
+        c2.ChannelChanged |> Observable.choose (fun x -> Some 1) |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4d" !result 1
+
+    
+        c2.ChannelChanged |> Observable.choose (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message.Length)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4e" !result (String.length "bad choice")
+    
+        result := 0
+        Observable.empty() |> Observable.completed (fun e -> result := 101 )
+        check "e89e0jrweoi4f" !result 101
+    
+        result := 0
+        Observable.empty() |> Observable.choose (fun x -> Some 1) |> Observable.completed (fun e -> result := 101 )
+        check "e89e0jrweoi4g" !result 101
+    
+        result := 0 
+        Observable.fail() |> Observable.choose (fun x -> Some 1) |> Observable.completed (fun e -> result := 101 )
+        // completed should not be called on error
+        check "e89e0jrweoi4g" !result 0
+    
+        result := 0 
+        Observable.fail() |> Observable.choose (fun x -> Some 1) |> Observable.error (fun e -> result := 101 )
+        // OnError should be called on error
+        check "e89e0jrweoi4g" !result 101
+    
+        result := 0 
+        Observable.failTwice() |> Observable.choose (fun x -> Some 1) |> Observable.error (fun e -> result := 101 )
+        // subsequent errors should be ignored
+        check "e89e0jrweoi4g" !result 101
+    
+
+    module TestFilter = 
+        let c2 = C()
+       
+
+        let result = ref 0 
+        c2.ChannelChanged |> Observable.filter (fun x -> false) |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi5" !result 0
+
+        c2.ChannelChanged |> Observable.filter (fun x -> true) |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi6" !result 6
+    
+
+        c2.ChannelChanged |> Observable.filter (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message.Length)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4h" !result (String.length "bad choice")
+    
+        result := 0
+        Observable.empty() |> Observable.filter (fun x -> false) |> Observable.completed (fun e -> result := 101 )
+        check "e89e0jrweoi4i" !result 101
+
+        result := 0
+        Observable.empty() |> Observable.filter (fun x -> true) |> Observable.completed (fun e -> result := 101 )
+        check "e89e0jrweoi4jB" !result 101
+
+        result := 0
+        Observable.failTwice() |> Observable.filter (fun x -> true) |> Observable.error (fun e -> result := 101 )
+        check "e89e0jrweoi4jC" !result 101
+
+        result := 0
+        Observable.failTwice() |> Observable.filter (fun x -> true) |> Observable.completed (fun e -> result := 101 )
+        // completed should not be called on error
+        check "e89e0jrweoi4jC" !result 0
+
+    module TestMap = 
+        let c2 = C()
+       
+
+        let result = ref ""
+        c2.ChannelChanged |> Observable.map string |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi7" !result "6"
+
+        c2.ChannelChanged |> Observable.map (fun x -> string (x + 1)) |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi8" !result "7"
+    
+    
+
+        c2.ChannelChanged |> Observable.map (fun x -> failwith "bad choice") |> Observable.error (fun e -> result := e.Message)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4k" !result "bad choice"
+
+        result := ""
+        Observable.empty() |> Observable.map (fun x -> x + 1) |> Observable.completed (fun e -> result := !result + "101" )
+        check "e89e0jrweoi4l" !result "101"
+
+        result := ""
+        Observable.failTwice() |> Observable.map (fun x -> x + 1) |> Observable.error (fun e -> result := !result + "101" )
+        check "e89e0jrweoi4jD" !result "101"
+
+        result := ""
+        Observable.failTwice() |> Observable.map (fun x -> x + 1) |> Observable.completed (fun e -> result := !result + "101" )
+        // completed should not be called on error
+        check "e89e0jrweoi4jD" !result ""
+    
+    
+    module TestMerge = 
+        let c2 = C()
+        let c3 = C()
+       
+
+        let result = ref 0
+        (c2.ChannelChanged,c3.ChannelChanged) ||> Observable.merge |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi9" !result 6
+        c3.ChangeChannel(7)
+        check "e89e0jrweoi10" !result 7
+
+
+        result := 0
+        (Observable.empty(), Observable.empty()) ||> Observable.merge |> Observable.completed (fun () -> result := !result + 101 )
+        // should only get one completed signal
+        check "e89e0jrweoi4m" !result 101
+
+        result := 0
+        (Observable.fail(), Observable.fail()) ||> Observable.merge |> Observable.error (fun e -> result := !result + 101 )
+        // should only get one error signal
+        check "e89e0jrweoi4n" !result 101
+    
+        result := 0
+        (Observable.failTwice(), Observable.failTwice()) ||> Observable.merge |> Observable.error (fun e -> result := !result + 101 )
+        // should only get one error signal
+        check "e89e0jrweoi4n" !result 101
+    
+        result := 0
+        (Observable.failTwice(), Observable.failTwice()) ||> Observable.merge |> Observable.completed (fun e -> result := !result + 101 )
+        // completed should not be called on error
+        check "e89e0jrweoi4nX" !result 0
+    
+    module TestPairwise = 
+        let c2 = C()
+
+        let result = ref (0,0)
+        c2.ChannelChanged |> Observable.pairwise |> Observable.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi11" !result (0,0)
+        c2.ChangeChannel(7)
+        check "e89e0jrweoi12" !result (6,7)
+        c2.ChangeChannel(8)
+        check "e89e0jrweoi13" !result (7,8)
+    
+        result := (0,0)
+        Observable.failTwice() |> Observable.pairwise |> Observable.error (fun e -> result := (fst !result + 101, snd !result + 102) )
+        check "e89e0jrweoi4jA" !result (101,102)
+
+        result := (0,0)
+        Observable.empty() |> Observable.pairwise |> Observable.completed (fun e -> result := (10,11))
+        check "e89e0jrweoi4jA1" !result (10,11)
+
+        // completed should not be called on error
+        result := (0,0)
+        Observable.fail() |> Observable.pairwise |> Observable.completed (fun e -> result := (10,11))
+        check "e89e0jrweoi4jA2" !result (0,0)
+
+    
+    module TestPartition = 
+        let c2 = C()
+
+        let resulta = ref 0
+        let resultb = ref 0
+        let c2a, c2b = c2.ChannelChanged |> Observable.partition (fun x -> x < 2) 
+        c2a |> Observable.add (fun x -> resulta := x)
+        c2b |> Observable.add (fun x -> resultb := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi14a" !resulta 0
+        check "e89e0jrweoi15" !resultb 6
+
+
+        c2.ChangeChannel(7)
+        check "e89e0jrweoi16" !resulta 0
+        check "e89e0jrweoi17" !resultb 7
+
+        c2.ChangeChannel(1)
+        check "e89e0jrweoi18" !resulta 1
+        check "e89e0jrweoi19" !resultb 7
+
+        c2.ChannelChanged |> Observable.partition (fun x -> failwith "bad choice") |> fst |> Observable.error (fun e -> resulta := e.Message.Length)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4a" !resulta (String.length "bad choice")
+    
+        c2.ChannelChanged |> Observable.partition (fun x -> failwith "bad choice2") |> snd |> Observable.error (fun e -> resultb := e.Message.Length)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi4b" !resultb (String.length "bad choice2")
+    
+    
+    module TestScan = 
+        let c2 = C()
+
+        let result = ref 0
+        (0,c2.ChannelChanged) ||> Event.scan (fun z x -> z + x)  |> Event.add (fun x -> result := x)
+        c2.ChangeChannel(6)
+        check "e89e0jrweoi20" !result 6
+        c2.ChangeChannel(3)
+        check "e89e0jrweoi21" !result 9
+        c2.ChangeChannel(4)
+        check "e89e0jrweoi22" !result 13
+
+        // Add another listener. It will get trigger after the first listener, wiping out the results of the first
+        (0,c2.ChannelChanged) ||> Event.scan (fun z x -> z + x)  |> Event.add (fun x -> result := x)
+        c2.ChangeChannel(2)
+        check "e89e0jrweoi23" !result 2
+        c2.ChangeChannel(3)
+        check "e89e0jrweoi24" !result 5
+        c2.ChangeChannel(1)
+        check "e89e0jrweoi25" !result 6
+
+        // add an event scanner
+        let result2 = ref false
+        (0,c2.ChannelChanged) ||> Event.scan (fun z x -> failwith "bad choice")  |> ignore
+        (try c2.ChangeChannel(6) with e -> result2 := true)
+        check "e89e0jrweoi4c" !result2 true
+
+// See FSharp 1.0 6175
+module CheckEventMembersAreNotMoreGeneric =
+   type T() =
+      [<CLIEvent>]
+      member x.Event = Event<_>().Publish
+    
+   (T().Event : IEvent<obj>) |> ignore // this was previously giving an error saying "one type parameter expected"
+
+
+module CLIEventIsInBaseType_FSHarp_1_0_6381 = 
+    module ActualRepro = 
+        type IBase =
+            abstract BaseProp : string
+            [<CLIEvent>]
+            abstract SettingChanged : IEvent<int>
+
+        type IDerived =
+            abstract X : int
+            inherit IBase
+
+        type Foo(z : IDerived) =
+            do
+                printfn "%d" z.X // ok
+                printfn "%s" z.BaseProp   // ok
+                z.SettingChanged |> Event.add(fun x -> printfn "%d" x)  // compiler went boom
+
+    module GenericCase = 
+        type IBase<'T> =
+            abstract BaseProp : string
+            [<CLIEvent>]
+            abstract SettingChanged : IEvent<'T>
+
+        type IDerived<'T> =
+            abstract X : int
+            inherit IBase<list<'T>>
+
+        type Foo(z : IDerived<string>) =
+            do
+                printfn "%d" z.X // ok
+                printfn "%s" z.BaseProp   // ok
+                z.SettingChanged |> Event.add(fun x -> printfn "%A" x)  // compiler went boom
+
+module EventWithNonPublicDelegateTypes_DevDiv271288 =
+    // The bug was about throwing a runtime exception.
+    // The fix was in FSharp.Core
+    module ActualRepro =
+        type internal RequestFinishedDelegate = delegate of obj * unit -> unit
+        let private requestFinishedEvent = Event<RequestFinishedDelegate, unit>()
+        let _ =
+            let p = requestFinishedEvent.Publish
+            use s = p.Subscribe(fun () -> printfn "called EventWithNonPublicDelegateTypes_DevDiv271288.ActualRepro: OK")
+            requestFinishedEvent.Trigger( null, () )
+
+    // Same as above, "public" instead of "internal"
+    module WithPublic =
+        type public RequestFinishedDelegate = delegate of obj * unit -> unit 
+        let private requestFinishedEvent = Event<RequestFinishedDelegate, unit>()
+        let _ =
+            let p = requestFinishedEvent.Publish
+            use s = p.Subscribe(fun () -> printfn "called EventWithNonPublicDelegateTypes_DevDiv271288.WithPublic: OK")
+            requestFinishedEvent.Trigger( null, () )
+
+    // Similar, but involving a different signature
+    module AnotherVariation =
+        type internal RequestFinishedDelegate = delegate of obj * unit * unit -> unit // note the extra unit
+        let private requestFinishedEvent = Event<RequestFinishedDelegate, unit * unit>()
+        let _ =
+            let p = requestFinishedEvent.Publish
+            use s = p.Subscribe(fun (_,_) -> printfn "called EventWithNonPublicDelegateTypes_DevDiv271288.AnotherVariation: OK")
+            requestFinishedEvent.Trigger( null, ((), ()) )
+
+let _ = 
+  if failures.Length > 0 then (printfn "Tests Failed: %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/events/testcs.cs b/tests/fsharp/core/events/testcs.cs
new file mode 100644
index 0000000..fa35bf2
--- /dev/null
+++ b/tests/fsharp/core/events/testcs.cs
@@ -0,0 +1,42 @@
+
+using System;
+using Microsoft.FSharp;
+using Microsoft.FSharp.Core;
+using Microsoft.FSharp.Control;
+using Microsoft.FSharp.Collections;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+class Maine {
+  static int Test2() {
+    Test.EventTest2.SomeComponent ie = Test.EventTest2.mk();
+    ie.SomeEvent += onEvent;
+    FSharpHandler<string> seh = new FSharpHandler<string>(onEvent);
+    ie.SomeEvent += seh;
+    Test.EventTest2.fire(ie);
+    ie.SomeEvent -= seh;
+
+    ie.Paint += onPaint;
+    FSharpHandler<EventArgs> peh = new FSharpHandler<EventArgs>(onPaint);
+    ie.Paint += peh;
+    Test.EventTest2.fire(ie);
+    ie.Paint -= peh;
+
+    Test.EventTest2.fire(ie);
+    return 0;
+  }
+  static int Main() {
+      int res = Test2();
+      Console.WriteLine("failures = {0}", Test.failures);
+      return res;
+
+  }
+  static void onEvent(object x,string s) {
+    Console.WriteLine("onEvent, s = {0}",s);
+  }
+  static void onPaint(object sender, EventArgs ea) {
+    Console.WriteLine("onPaint, ea = {0}",ea);
+   }
+
+}
diff --git a/tests/fsharp/core/forwarders/a.cs b/tests/fsharp/core/forwarders/a.cs
new file mode 100644
index 0000000..0f6180f
--- /dev/null
+++ b/tests/fsharp/core/forwarders/a.cs
@@ -0,0 +1,71 @@
+// The test strategy here is:
+
+//   1. take a C# DLL (a.dll)
+//         - compile it in its original form (orig\a.dll)
+//         - split it in two using forwarders (into split\a.dll, split\a-part1.dll)
+//   2. compile a C# DLL (b.dll) against the unsplit original a.dll
+//
+//   3. compile an F# DLL (c.dll) against the unsplit original a.dll
+//   4. From F#, reference both the _split_ DLLs and the original b.dll and the original c.dll 
+//      and use a mix of types and functions from a.dll, b.dll and c.dll
+//
+// The aim is to shake out type identity issues assocaited with type forwarders.
+
+#if PART1
+public class C
+{
+
+}
+
+public class D
+{
+    public class E
+    {
+        public class EE
+        {
+        }
+    }
+
+
+}
+#endif
+
+
+#if PART2
+#if SPLIT
+[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(C)) ]
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(D))]
+
+// NOTE: no need to forward nested types
+//[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(D.E))]
+#endif
+
+//------------- split will happen here, all types above will be forwarded to a new assembly
+
+
+// note: can't forward generic types!! (what an awful restriction on the CLR feature!)
+public class GenericD<T>
+{
+    void Generic(T x) { } 
+
+}
+
+public class F
+{
+    static public void ConsumeC(C x) { } 
+    static public void ConsumeD(D x) { } 
+    static public void ConsumeGenericD(GenericD<C> x) { } 
+    static public void ConsumeE(D.E x) { } 
+    static public void ConsumeEE(D.E.EE x) { } 
+
+}
+
+public class G
+{
+    public class H
+    {
+    }
+
+}
+#endif
diff --git a/tests/fsharp/core/forwarders/b.cs b/tests/fsharp/core/forwarders/b.cs
new file mode 100644
index 0000000..10a18b1
--- /dev/null
+++ b/tests/fsharp/core/forwarders/b.cs
@@ -0,0 +1,22 @@
+// See notes in a.cs
+
+public class UseForwardedTypes
+{
+    static public C CreateC() { return (new C()); }
+    static public D CreateD() { return (new D()); }
+    static public GenericD<C> CreateGenericD() { return (new GenericD<C>()); }
+    static public D.E CreateE() { return (new D.E()); }
+    static public D.E.EE CreateEE() { return (new D.E.EE()); }
+
+    static public F CreateF() { return (new F()); }
+    static public G CreateG() { return (new G()); }
+    static public G.H CreateH() { return (new G.H()); }
+
+    static public void ConsumeC(C x) { F.ConsumeC(x); }
+    static public void ConsumeD(D x) { F.ConsumeD(x); }
+    static public void ConsumeGenericD(GenericD<C> x) { F.ConsumeGenericD(x);  }
+    static public void ConsumeE(D.E x) { F.ConsumeE(x); }
+    static public void ConsumeEE(D.E.EE x) { F.ConsumeEE(x); }
+
+}
+
diff --git a/tests/fsharp/core/forwarders/build.bat b/tests/fsharp/core/forwarders/build.bat
new file mode 100644
index 0000000..41965a3
--- /dev/null
+++ b/tests/fsharp/core/forwarders/build.bat
@@ -0,0 +1,75 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+REM **************************
+
+REM only a valid test if generics supported
+
+mkdir orig
+mkdir split
+%CSC% /nologo  /target:library /out:orig\a.dll /define:PART1;PART2 a.cs 
+  @if ERRORLEVEL 1 goto Error
+%CSC% /nologo  /target:library /out:orig\b.dll /r:orig\a.dll b.cs 
+  @if ERRORLEVEL 1 goto Error
+"%FSC%" -a -o:orig\c.dll -r:orig\b.dll -r:orig\a.dll c.fs
+  @if ERRORLEVEL 1 goto Error
+ 
+%CSC% /nologo  /target:library /out:split\a-part1.dll /define:PART1;SPLIT a.cs  
+  @if ERRORLEVEL 1 goto Error
+%CSC% /nologo  /target:library /r:split\a-part1.dll /out:split\a.dll /define:PART2;SPLIT a.cs
+  @if ERRORLEVEL 1 goto Error
+
+copy /y orig\b.dll split\b.dll
+copy /y orig\c.dll split\c.dll
+ 
+"%FSC%" -o:orig\test.exe -r:orig\b.dll -r:orig\a.dll test.fs
+  @if ERRORLEVEL 1 goto Error
+"%FSC%" -o:split\test.exe -r:split\b.dll -r:split\a-part1.dll -r:split\a.dll test.fs
+  @if ERRORLEVEL 1 goto Error
+"%FSC%" -o:split\test-against-c.exe -r:split\c.dll -r:split\a-part1.dll -r:split\a.dll test.fs
+  @if ERRORLEVEL 1 goto Error
+
+pushd split
+"%PEVERIFY%" a-part1.dll
+  @if ERRORLEVEL 1 goto Error
+REM "%PEVERIFY%" a.dll
+REM   @if ERRORLEVEL 1 goto Error
+"%PEVERIFY%" b.dll
+  @if ERRORLEVEL 1 goto Error
+"%PEVERIFY%" c.dll
+  @if ERRORLEVEL 1 goto Error
+"%PEVERIFY%" test.exe
+  @if ERRORLEVEL 1 goto Error
+"%PEVERIFY%" test-against-c.exe
+  @if ERRORLEVEL 1 goto Error
+popd
+
+
+
+:Ok
+echo Built fsharp %~n0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/forwarders/c.fs b/tests/fsharp/core/forwarders/c.fs
new file mode 100644
index 0000000..a7f3599
--- /dev/null
+++ b/tests/fsharp/core/forwarders/c.fs
@@ -0,0 +1,22 @@
+// See notes in a.cs
+
+
+
+module UseForwardedTypes 
+
+let CreateC() = new C()
+let CreateD() = new D()
+let CreateGenericD() = new GenericD<C>()
+let CreateE() = new D.E()
+let CreateEE() = new D.E.EE()
+
+let CreateF() = new F()
+let CreateG() = new G()
+let CreateH() = new G.H()
+
+let ConsumeC(x) = F.ConsumeC(x)
+let ConsumeD(x) = F.ConsumeD(x)
+let ConsumeGenericD(x) = F.ConsumeGenericD(x)
+let ConsumeE(x) = F.ConsumeE(x)
+let ConsumeEE(x) = F.ConsumeEE(x)
+
diff --git a/tests/fsharp/core/forwarders/test.fs b/tests/fsharp/core/forwarders/test.fs
new file mode 100644
index 0000000..69d9895
--- /dev/null
+++ b/tests/fsharp/core/forwarders/test.fs
@@ -0,0 +1,29 @@
+// #Conformance #Interop #Multitargeting 
+// See notes in a.cs
+
+
+
+let x = (new C(), new D(), new D.E(), new D.E.EE(), new F(), new G(), new G.H())
+
+let y = UseForwardedTypes.CreateC()
+
+// This tests type equivalence for forwarded types
+let z1 = (UseForwardedTypes.CreateC() = new C())
+let z2 = (UseForwardedTypes.CreateD() = new D())
+let z3 = (UseForwardedTypes.CreateGenericD() = new GenericD<C>())
+let z4 = (UseForwardedTypes.CreateE() = new D.E())
+let z4b = (UseForwardedTypes.CreateEE() = new D.E.EE())
+let z5 = (UseForwardedTypes.CreateF() = new F())
+let z6 = (UseForwardedTypes.CreateG() = new G())
+let z7 = (UseForwardedTypes.CreateH() = new G.H())
+
+UseForwardedTypes.ConsumeC(UseForwardedTypes.CreateC())
+UseForwardedTypes.ConsumeC(new C())
+UseForwardedTypes.ConsumeD(UseForwardedTypes.CreateD())
+UseForwardedTypes.ConsumeD(new D())
+UseForwardedTypes.ConsumeGenericD(new GenericD<C>())
+UseForwardedTypes.ConsumeGenericD(UseForwardedTypes.CreateGenericD())
+UseForwardedTypes.ConsumeE(UseForwardedTypes.CreateE())
+UseForwardedTypes.ConsumeE(new D.E())
+UseForwardedTypes.ConsumeEE(new D.E.EE())
+
diff --git a/tests/fsharp/core/fsfromcs/CsClient.csproj b/tests/fsharp/core/fsfromcs/CsClient.csproj
new file mode 100644
index 0000000..69290f2
--- /dev/null
+++ b/tests/fsharp/core/fsfromcs/CsClient.csproj
@@ -0,0 +1,53 @@
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{95C0CAA2-5D0A-4B10-9B4C-9B85D238586A}</ProjectGuid>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <OutputType>Exe</OutputType>
+    <NoStandardLibraries>false</NoStandardLibraries>
+    <AssemblyName>ConsoleApplication</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <RootNamespace>CsClient</RootNamespace>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core" />
+    <Reference Include="Test.PowerPack.Linq, Version=0.0.0.1, Culture=neutral, PublicKeyToken=a19089b1c74d0809, processorArchitecture=MSIL" />
+    <Reference Include="lib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>.\lib.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="test.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+  <ProjectExtensions>
+    <VisualStudio AllowExistingFolder="true" />
+  </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/fsfromcs/build.bat b/tests/fsharp/core/fsfromcs/build.bat
new file mode 100644
index 0000000..3be94f5
--- /dev/null
+++ b/tests/fsharp/core/fsfromcs/build.bat
@@ -0,0 +1,50 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+"%FSC%" %fsc_flags% -a --doc:lib.xml -o:lib.dll -g lib.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib.dll
+ at if ERRORLEVEL 1 goto Error
+
+%CSC% /nologo /r:"%FSCOREDLLPATH%" /r:System.Core.dll /r:lib.dll /out:test.exe test.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a --doc:lib--optimize.xml -o:lib--optimize.dll -g lib.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib--optimize.dll
+ at if ERRORLEVEL 1 goto Error
+
+ at if ERRORLEVEL 1 goto Error
+%CSC% /nologo /r:"%FSCOREDLLPATH%"  /r:System.Core.dll /r:lib--optimize.dll    /out:test--optimize.exe test.cs 
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/fsfromcs/lib.ml b/tests/fsharp/core/fsfromcs/lib.ml
new file mode 100644
index 0000000..4e9936f
--- /dev/null
+++ b/tests/fsharp/core/fsfromcs/lib.ml
@@ -0,0 +1,74 @@
+
+(* An F# library which we try to access from C# *)
+
+type Recd1 = { recd1field1: int }
+type Recd2 = { recd2field1: int; recd2field2: string }
+type 'a Recd3 = { recd3field1: int; recd3field2: 'a; mutable recd3field3: 'a Recd3 }
+
+(* Recd2 with fields declared in other order *)
+type RevRecd2 = {  recd2field2: string; rrecd2field1: int; }
+
+type One = One
+type Int = Int of int
+type IntPair = IntPair of int * int
+type IntPear = | IntPear : Fst: int * Snd: int -> IntPear
+type BigUnion = 
+  | A1 of int
+  | A2 of int
+  | A3 of int
+  | A4 of int
+  | A5 of int
+  | A6 of int
+  | A7 of int
+  | A8 of int
+  | A9 of int
+
+type BigEnum = 
+  | E1 
+  | E2 
+  | E3 
+  | E4 
+  | E5 
+  | E6 
+  | E7 
+  | E8 
+  | E9 
+
+type Bool = True | False
+type IntOption = Nothing | Something : Item: int  -> IntOption
+type OptionalInt = SOME of int | NONE
+type Index = Index_A of int | Index_B of int
+
+type GenericUnion<'T,'U> = 
+    | Nothing 
+    | Something of 'T * 'U
+    | SomethingElse of 'T 
+    | SomethingElseAgain of 'T 
+
+type Discr3_0_0_0 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C
+type Discr3_0_1_0 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C
+type Discr3_1_0_0 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C
+type Discr3_1_1_0 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C
+type Discr3_0_0_1 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C of string
+type Discr3_0_1_1 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C of string
+type Discr3_1_0_1 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C of string
+type Discr3_1_1_1 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C of string
+
+(* Toplevel functions *)
+let f_1 x = x+1
+let f_1_1 x y = x+y
+let f_1_1_1 x y z = x+y+z
+let f_1_1_1_1 x1 x2 x3 x4 = x1+x2+x3+x4
+let f_1_1_1_1_1 x1 x2 x3 x4 x5 = x1+x2+x3+x4+x5
+
+(* Function returning a function *)
+let f_1_effect_1 x = let x = ref 1 in fun y -> !x+y+1
+
+(* Tuple value *)
+let tup2 = (2,3)
+let tup3 = (2,3,4)
+let tup4 = (2,3,4,5)
+
+
+
+
diff --git a/tests/fsharp/core/fsfromcs/run.bat b/tests/fsharp/core/fsfromcs/run.bat
new file mode 100644
index 0000000..cd15ce9
--- /dev/null
+++ b/tests/fsharp/core/fsfromcs/run.bat
@@ -0,0 +1,33 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+
+%CLIX% .\test.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/fsfromcs/test.cs b/tests/fsharp/core/fsfromcs/test.cs
new file mode 100644
index 0000000..0d523ab
--- /dev/null
+++ b/tests/fsharp/core/fsfromcs/test.cs
@@ -0,0 +1,290 @@
+
+
+using System;
+using System.Linq;
+using Microsoft.FSharp;
+using Microsoft.FSharp.Core;
+using Microsoft.FSharp.Collections;
+
+class Maine
+{
+   static int Main()
+   {
+
+      // Some typical code
+
+        {
+            Microsoft.FSharp.Core.FSharpOption<int> x = Microsoft.FSharp.Core.FSharpOption<int>.Some(3) ;
+            System.Console.WriteLine("{0}",x.Value);
+            Microsoft.FSharp.Collections.FSharpList<int> x2 = 
+                Microsoft.FSharp.Collections.FSharpList<int>.Cons(3, Microsoft.FSharp.Collections.FSharpList<int>.Empty);
+            System.Console.WriteLine("{0}",x2.Head);
+        }
+       {
+           FSharpList<int> x = FSharpList<int>.Cons(3,(FSharpList<int>.Empty));
+
+          Console.WriteLine("x - IsCons = {0}", x != null);
+          Console.WriteLine("x - IsNil = {0}", x == null);
+          Console.WriteLine("x.Head = {0}", x.Head);
+          Console.WriteLine("x.Tail = {0}", x.Tail);
+          Console.WriteLine("x.Tail - IsNil = {0}", x.Tail);
+          switch (x.Tag) 
+          {
+              case FSharpList<int>.Tags.Cons: 
+                  Console.WriteLine("Cons({0},{1})", x.Head, x.Tail);
+                  break;
+              case FSharpList<int>.Tags.Empty: 
+                  Console.WriteLine("[]");
+                  break;
+          }
+       }
+
+       {
+           FSharpList<int> x = FSharpList<int>.Cons(3, (FSharpList<int>.Empty));
+
+          foreach (int i in x) {
+              Console.WriteLine("i = {0}", i);
+          }
+       }
+
+
+      {
+           FSharpList<int> myList = ListModule.OfArray(new int[] { 4, 5, 6 });
+
+           ListModule.Iterate
+              (FuncConvert.ToFSharpFunc((Action<int>) delegate(int i) 
+                                        { Console.WriteLine("i = {0}", i);}),
+               myList);
+
+          ListModule.Iterate<int>
+              ((Converter<int,Unit>) delegate(int i) { Console.WriteLine("i = {0} (2nd technique)", i); return null; },
+               myList);
+
+          FSharpList<string> myList2 = 
+            ListModule.Map
+              (FuncConvert.ToFSharpFunc((Converter<int,string>) delegate(int i) 
+                                        { return i.ToString() + i.ToString(); }),
+               myList);
+
+          ListModule.Iterate
+              (FuncConvert.ToFSharpFunc((Action<string>) delegate(string s) 
+                                        { Console.WriteLine("i after duplication = {0}", s);}),
+               myList2);
+
+          myList2 = 
+            ListModule.Map<int,string>
+              ((Converter<int,string>) delegate(int i) { return i.ToString() + i.ToString(); },
+               myList);
+
+          ListModule.Iterate<string>
+              (FuncConvert.ToFSharpFunc((Action<string>) delegate(string s) 
+                                        { Console.WriteLine("i after duplication (2nd technique) = {0}", s);}),
+               myList2);
+
+      }
+
+       // Construct a value of each type from the library
+
+      Lib.Recd1 r1 = new Lib.Recd1(3);
+      Lib.Recd2 r2 = new Lib.Recd2(3, "a");
+      Lib.RevRecd2 rr2 = new Lib.RevRecd2("a", 3);
+      Lib.Recd3<string> r3 = new Lib.Recd3<string>(4, "c", null);
+      r3.recd3field3 = r3;
+
+      Lib.One d10a = Lib.One.One;
+      Lib.Int d11a = Lib.Int.NewInt(3);
+      Lib.IntPair ip = Lib.IntPair.NewIntPair(3, 4);
+      Console.WriteLine("{0}", ip.Item1);
+      Console.WriteLine("{0}", ip.Item2);
+
+      Lib.IntPear ip2 = Lib.IntPear.NewIntPear(3,4);
+      Console.WriteLine("{0}", ip2.Fst);
+      Console.WriteLine("{0}", ip2.Snd);
+
+      Lib.Bool b = Lib.Bool.True;
+      Console.WriteLine("{0}", Lib.Bool.True);
+      Console.WriteLine("{0}", Lib.Bool.False);
+      //Console.WriteLine("{0}", Lib.Bool.IsTrue(b));
+      //Console.WriteLine("{0}", Lib.Bool.IsFalse(b));
+      switch (b.Tag) 
+      {
+          case Lib.Bool.Tags.True: 
+              Console.WriteLine("True");
+              break;
+          case Lib.Bool.Tags.False: 
+              Console.WriteLine("False");
+              break;
+      }
+
+      Lib.OptionalInt oint = Lib.OptionalInt.NewSOME(3);
+      Console.WriteLine("oint - IsSOME = {0}", oint != null);
+      Console.WriteLine("oint - IsNONE = {0}", oint == null);
+      Console.WriteLine("{0}", (oint as Lib.OptionalInt.SOME).Item);
+      switch (oint.Tag) 
+      {
+          case Lib.OptionalInt.Tags.SOME:
+              var c = oint as Lib.OptionalInt.SOME;
+              Console.WriteLine("SOME({0})", c.Item);
+              break;
+          case Lib.OptionalInt.Tags.NONE: 
+              Console.WriteLine("NONE");
+              break;
+      }
+
+      Lib.IntOption iopt = Lib.IntOption.Nothing;
+      Console.WriteLine("iopt - IsSomething = {0}", iopt != null);
+      Console.WriteLine("iopt - IsNothing = {0}", iopt == null);
+      switch (iopt.Tag) 
+      {
+          case Lib.IntOption.Tags.Something: 
+              Console.WriteLine("Something({0})", (iopt as Lib.IntOption.Something).Item);
+              break;
+          case Lib.IntOption.Tags.Nothing: 
+              Console.WriteLine("Nothing");
+              break;
+      }
+
+      Lib.GenericUnion<int, string> gu1 = Lib.GenericUnion<int, string>.Nothing;
+      Lib.GenericUnion<int, string> gu2 = Lib.GenericUnion<int, string>.NewSomething(3, "4");
+      Lib.GenericUnion<int, string> gu3 = Lib.GenericUnion<int, string>.NewSomethingElse(3);
+      Lib.GenericUnion<int, string> gu4 = Lib.GenericUnion<int, string>.NewSomethingElseAgain(4);
+      //Console.WriteLine("{0}", (gu1 as Lib.GenericUnion<int,string>.Cases.Nothing));
+      Console.WriteLine("{0}", (gu2 as Lib.GenericUnion<int,string>.Something).Item1);
+      Console.WriteLine("{0}", (gu3 as Lib.GenericUnion<int,string>.SomethingElse).Item);
+      Console.WriteLine("{0}", (gu4 as Lib.GenericUnion<int,string>.SomethingElseAgain).Item);
+      switch (gu1.Tag)
+      {
+          case Lib.GenericUnion<int, string>.Tags.Nothing:
+              Console.WriteLine("OK");
+              break;
+          case Lib.GenericUnion<int, string>.Tags.Something:
+          case Lib.GenericUnion<int, string>.Tags.SomethingElse:
+          case Lib.GenericUnion<int, string>.Tags.SomethingElseAgain:
+              Console.WriteLine("NOT OK");
+              throw (new System.Exception("ERROR - INCORRECT CASE TAG"));
+      }
+
+      switch (gu2.Tag)
+      {
+          case Lib.GenericUnion<int, string>.Tags.Something:
+              Console.WriteLine("OK");
+              break;
+          case Lib.GenericUnion<int, string>.Tags.Nothing:
+          case Lib.GenericUnion<int, string>.Tags.SomethingElse:
+          case Lib.GenericUnion<int, string>.Tags.SomethingElseAgain:
+              Console.WriteLine("NOT OK");
+              throw (new System.Exception("ERROR - INCORRECT CASE TAG"));
+      }
+
+      Lib.BigUnion bu1 = Lib.BigUnion.NewA1(3);
+      Lib.BigUnion bu2 = Lib.BigUnion.NewA2(3);
+      Lib.BigUnion bu3 = Lib.BigUnion.NewA3(3);
+      Lib.BigUnion bu4 = Lib.BigUnion.NewA4(3);
+      Lib.BigUnion bu5 = Lib.BigUnion.NewA5(3);
+      Lib.BigUnion bu6 = Lib.BigUnion.NewA6(3);
+      Lib.BigUnion bu7 = Lib.BigUnion.NewA7(3);
+      Lib.BigUnion bu8 = Lib.BigUnion.NewA8(3);
+      Lib.BigUnion bu9 = Lib.BigUnion.NewA9(3);
+      switch (bu1.Tag)
+      {
+          case Lib.BigUnion.Tags.A1:
+              Console.WriteLine("OK");
+              break;
+          case Lib.BigUnion.Tags.A2:
+          case Lib.BigUnion.Tags.A3:
+          case Lib.BigUnion.Tags.A4:
+          case Lib.BigUnion.Tags.A5:
+          case Lib.BigUnion.Tags.A6:
+          case Lib.BigUnion.Tags.A7:
+          case Lib.BigUnion.Tags.A8:
+          case Lib.BigUnion.Tags.A9:
+              Console.WriteLine("NOT OK");
+              throw (new System.Exception("ERROR - INCORRECT CASE TAG"));
+      }
+
+
+      Lib.BigEnum be1 = Lib.BigEnum.E1;
+      Lib.BigEnum be2 = Lib.BigEnum.E2;
+      Lib.BigEnum be3 = Lib.BigEnum.E3;
+      Lib.BigEnum be4 = Lib.BigEnum.E4;
+      Lib.BigEnum be5 = Lib.BigEnum.E5;
+      Lib.BigEnum be6 = Lib.BigEnum.E6;
+      Lib.BigEnum be7 = Lib.BigEnum.E7;
+      Lib.BigEnum be8 = Lib.BigEnum.E8;
+      Lib.BigEnum be9 = Lib.BigEnum.E9;
+      switch (be1.Tag)
+      {
+          case Lib.BigEnum.Tags.E1:
+              Console.WriteLine("OK");
+              break;
+          case Lib.BigEnum.Tags.E2:
+          case Lib.BigEnum.Tags.E3:
+          case Lib.BigEnum.Tags.E4:
+          case Lib.BigEnum.Tags.E5:
+          case Lib.BigEnum.Tags.E6:
+          case Lib.BigEnum.Tags.E7:
+          case Lib.BigEnum.Tags.E8:
+          case Lib.BigEnum.Tags.E9:
+              Console.WriteLine("NOT OK");
+              throw (new System.Exception("ERROR - INCORRECT CASE TAG"));
+      }
+
+      Lib.Index d211a = Lib.Index.NewIndex_A(3);
+
+      Lib.Bool d200b = Lib.Bool.False;
+      Lib.OptionalInt d210b = Lib.OptionalInt.NONE;
+      Lib.IntOption d201b = Lib.IntOption.NewSomething(3);
+      Lib.Index d211b = Lib.Index.NewIndex_B(4);
+
+/*
+
+type discr2_0_0 = True | False
+type discr2_0_1 = Nothing | Something of int
+type discr2_1_0 = SOME of int | NONE
+type discr2_1_1 = Index_A of int | Index_B of int
+
+type discr3_0_0_0 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C
+type discr3_0_1_0 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C
+type discr3_1_0_0 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C
+type discr3_1_1_0 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C
+type discr3_0_0_1 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C of string
+type discr3_0_1_1 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C of string
+type discr3_1_0_1 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C of string
+type discr3_1_1_1 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C of string
+*/
+
+// Toplevel functions *
+      int f_1  = Lib.f_1(1);
+      int f_1_1 = Lib.f_1_1(1,2);
+      int f_1_1_1 = Lib.f_1_1_1(1,2,3);
+      int f_1_1_1_1 = Lib.f_1_1_1_1(1,2,3,4);
+      int f_1_1_1_1_1 = Lib.f_1_1_1_1_1(1,2,3,4,5);
+#if DELEGATES
+      int f_1_effect_1 = Lib.f_1_effect_1(1)(2);
+#else
+      int f_1_effect_1 = Lib.f_1_effect_1(1).Invoke(2);
+#endif
+
+      //let f_2 x y = x+y
+      //let f_3 x y z = x+y+z
+      //let f_4 x1 x2 x3 x4 = x1+x2+x3+x4
+      //let f_5 x1 x2 x3 x4 x5 = x1+x2+x3+x4+x5
+
+      // Function returning a function 
+      //let f_1_1 x = let x = ref 1 in fun y -> !x+y+1
+
+      // Tuple value 
+      //let tup2 = (2,3)
+      //let tup3 = (2,3,4)
+      //let tup4 = (2,3,4,5)
+
+        System.Console.WriteLine("Test Passed.");
+
+      return 0;
+   }
+
+
+
+
+
+}
diff --git a/tests/fsharp/core/fsfromfsviacs/build.bat b/tests/fsharp/core/fsfromfsviacs/build.bat
new file mode 100644
index 0000000..b7688af
--- /dev/null
+++ b/tests/fsharp/core/fsfromfsviacs/build.bat
@@ -0,0 +1,46 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+"%FSC%" %fsc_flags% -a -o:lib.dll -g lib.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib.dll 
+ at if ERRORLEVEL 1 goto Error
+
+%CSC% /nologo /target:library /r:"%FSCOREDLLPATH%" /r:lib.dll /out:lib2.dll lib2.cs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:lib.dll -r:lib2.dll -o:test.exe -g test.fsx
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test.exe 
+ at if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/fsfromfsviacs/lib.ml b/tests/fsharp/core/fsfromfsviacs/lib.ml
new file mode 100644
index 0000000..f40253d
--- /dev/null
+++ b/tests/fsharp/core/fsfromfsviacs/lib.ml
@@ -0,0 +1,46 @@
+
+(* An F# library which we use in a C# library, where we in turn use both the F# component and the C# library together from F# *)
+
+type recd1 = { recd1field1: int }
+type recd2 = { recd2field1: int; recd2field2: string }
+type 'a recd3 = { recd3field1: int; recd3field2: 'a; mutable recd3field3: 'a recd3 }
+
+(* recd2 with fields declared in other order *)
+type rrecd2 = {  rrecd2field2: string; rrecd2field1: int; }
+
+type discr1_0 = Discr1_0_A
+type discr1_1 = Discr1_1_A of int
+type discr1_2 = Discr1_2_A of int * int
+
+type discr2_0_0 = Discr2_0_0_A | Discr2_0_0_B
+type discr2_0_1 = Discr2_0_1_A | Discr2_0_1_B of int
+type discr2_1_0 = Discr2_1_0_A of int | Discr2_1_0_B
+type discr2_1_1 = Discr2_1_1_A of int | Discr2_1_1_B of int
+
+type discr3_0_0_0 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C
+type discr3_0_1_0 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C
+type discr3_1_0_0 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C
+type discr3_1_1_0 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C
+type discr3_0_0_1 = Discr3_0_0_0_A | Discr3_0_0_0_B | Discr3_0_0_0_C of string
+type discr3_0_1_1 = Discr3_0_1_0_A | Discr3_0_1_0_B of int | Discr3_0_0_0_C of string
+type discr3_1_0_1 = Discr3_1_0_0_A of int | Discr3_1_0_0_B | Discr3_0_0_0_C of string
+type discr3_1_1_1 = Discr3_1_1_0_A of int | Discr3_1_1_0_B of int | Discr3_0_0_0_C of string
+
+(* Toplevel functions *)
+let f_1 x = x+1
+let f_1_1 x y = x+y
+let f_1_1_1 x y z = x+y+z
+let f_1_1_1_1 x1 x2 x3 x4 = x1+x2+x3+x4
+let f_1_1_1_1_1 x1 x2 x3 x4 x5 = x1+x2+x3+x4+x5
+
+(* Function returning a function *)
+let f_1_effect_1 x = let x = ref 1 in fun y -> !x+y+1
+
+(* Tuple value *)
+let tup2 = (2,3)
+let tup3 = (2,3,4)
+let tup4 = (2,3,4,5)
+
+
+
+
diff --git a/tests/fsharp/core/fsfromfsviacs/lib2.cs b/tests/fsharp/core/fsfromfsviacs/lib2.cs
new file mode 100644
index 0000000..c86e38e
--- /dev/null
+++ b/tests/fsharp/core/fsfromfsviacs/lib2.cs
@@ -0,0 +1,37 @@
+using Microsoft.FSharp;
+using Microsoft.FSharp.Core;
+using Microsoft.FSharp.Collections;
+
+public class Lib2
+{
+    public static Lib.recd1 r1 = new Lib.recd1(3);
+    public static Lib.recd2 r2 = new Lib.recd2(3, "a");
+    public static Lib.rrecd2 rr2 = new Lib.rrecd2("a", 3);
+    public static Lib.recd3<string> r3 = new Lib.recd3<string>(4, "c", null);
+    
+    public static Lib.discr1_0 d10a = Lib.discr1_0.Discr1_0_A;
+    public static Lib.discr1_1 d11a = Lib.discr1_1.NewDiscr1_1_A(3);
+    public static Lib.discr1_2 d12a = Lib.discr1_2.NewDiscr1_2_A(3, 4);
+    
+    public static Lib.discr2_0_0 d200a = Lib.discr2_0_0.Discr2_0_0_A;
+    public static Lib.discr2_1_0 d210a = Lib.discr2_1_0.NewDiscr2_1_0_A(3);
+    public static Lib.discr2_0_1 d201a = Lib.discr2_0_1.Discr2_0_1_A;
+    public static Lib.discr2_1_1 d211a = Lib.discr2_1_1.NewDiscr2_1_1_A(3);
+    
+    public static Lib.discr2_0_0 d200b = Lib.discr2_0_0.Discr2_0_0_B;
+    public static Lib.discr2_1_0 d210b = Lib.discr2_1_0.Discr2_1_0_B;
+    public static Lib.discr2_0_1 d201b = Lib.discr2_0_1.NewDiscr2_0_1_B(3);
+    public static Lib.discr2_1_1 d211b = Lib.discr2_1_1.NewDiscr2_1_1_B(4);
+
+    public static FSharpList<int> li1 = FSharpList<int>.Cons(3,FSharpList<int>.Empty);
+    public static FSharpList<Lib.recd1> lr1 = FSharpList<Lib.recd1>.Cons(r1,FSharpList<Lib.recd1>.Empty);
+
+    public static FSharpOption<int> oi1 = FSharpOption<int>.Some(3);
+    public static FSharpOption<Lib.recd1> or1 = FSharpOption<Lib.recd1>.Some(r1);
+
+    public static FSharpRef<int> ri1 = new FSharpRef<int>(3);
+    public static FSharpRef<Lib.recd1> rr1 = new FSharpRef<Lib.recd1>(r1);
+
+    static Lib2() {     r3.recd3field3 = r3; }
+
+}
diff --git a/tests/fsharp/core/fsfromfsviacs/run.bat b/tests/fsharp/core/fsfromfsviacs/run.bat
new file mode 100644
index 0000000..00312e5
--- /dev/null
+++ b/tests/fsharp/core/fsfromfsviacs/run.bat
@@ -0,0 +1,31 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+
+%CLIX% .\test.exe
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/fsfromfsviacs/test.fsx b/tests/fsharp/core/fsfromfsviacs/test.fsx
new file mode 100644
index 0000000..58cc486
--- /dev/null
+++ b/tests/fsharp/core/fsfromfsviacs/test.fsx
@@ -0,0 +1,54 @@
+// #Conformance #Interop #Unions 
+open Lib
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+let r1 = Lib2.r1
+let r2 = Lib2.r2
+
+let _ = test "fejio" (r2 =  { recd2field1=3; recd2field2= "a" } )
+
+let rr2 = (Lib2.rr2 : rrecd2)
+
+let _ = test "fejio2" (rr2 =  { rrecd2field2="a"; rrecd2field1= 3 } )
+
+let r3 = (Lib2.r3 : string recd3)
+
+let _ = test "fejio2dw" (r3.recd3field1=4)
+let _ = test "fejio2dw" (r3.recd3field2="c")
+let _ = test "fejio2dw" (LanguagePrimitives.PhysicalEquality r3.recd3field3  r3)
+let _ = test "fejio2dw" (Lib2.li1 = [3])
+let _ = test "fejio2dw" (Lib2.lr1 = [r1])
+let _ = test "fejio2dw" (Lib2.oi1 = Some 3)
+let _ = test "fejio2dw" (Lib2.or1 = Some r1)
+let _ = test "fejio2dw" (Lib2.ri1 = ref 3)
+let _ = test "fejio2dw" (Lib2.rr1 = ref r1)
+
+    
+(*
+    public Lib.discr1_0 d10a = Lib.discr1_0.MkDiscr1_0_A();
+    public Lib.discr1_1 d11a = Lib.discr1_1.MkDiscr1_1_A(3);
+    public Lib.discr1_2 d12a = Lib.discr1_2.MkDiscr1_2_A(3,4);
+    
+    public Lib.discr2_0_0 d200a = Lib.discr2_0_0.MkDiscr2_0_0_A();
+    public Lib.discr2_1_0 d210a = Lib.discr2_1_0.MkDiscr2_1_0_A(3);
+    public Lib.discr2_0_1 d201a = Lib.discr2_0_1.MkDiscr2_0_1_A();
+    public Lib.discr2_1_1 d211a = Lib.discr2_1_1.MkDiscr2_1_1_A(3);
+    
+    public Lib.discr2_0_0 d200b = Lib.discr2_0_0.MkDiscr2_0_0_B();
+    public Lib.discr2_1_0 d210b = Lib.discr2_1_0.MkDiscr2_1_0_B();
+    public Lib.discr2_0_1 d201b = Lib.discr2_0_1.MkDiscr2_0_1_B(3);
+    public Lib.discr2_1_1 d211b = Lib.discr2_1_1.MkDiscr2_1_1_B(4);
+
+    public List<Lib.recd1> r1 = List<int>.MkCons(3,List<int>.MkNil());
+
+*)
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/fsi-reload/build.bat b/tests/fsharp/core/fsi-reload/build.bat
new file mode 100644
index 0000000..b672f96
--- /dev/null
+++ b/tests/fsharp/core/fsi-reload/build.bat
@@ -0,0 +1,20 @@
+ at if "%_echo%"=="" echo off
+goto ok
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+REM  NOTE that this test does not do anything.
+REM  PEVERIFY not needed
+
+:Ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/fsi-reload/run.bat b/tests/fsharp/core/fsi-reload/run.bat
new file mode 100644
index 0000000..2b79f61
--- /dev/null
+++ b/tests/fsharp/core/fsi-reload/run.bat
@@ -0,0 +1,30 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+rem there is no build.bat for this testcase, so don't check for build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags%  --maxerrors:1 < test1.ml
+  if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/fsi-reload/test1.ml b/tests/fsharp/core/fsi-reload/test1.ml
new file mode 100644
index 0000000..e9f0a57
--- /dev/null
+++ b/tests/fsharp/core/fsi-reload/test1.ml
@@ -0,0 +1,77 @@
+// #Conformance #FSI 
+
+#light
+
+#load "test1a.ml";;
+
+printf "test: %d\n" Test1.x;;
+printf "test: %b\n" (Test1.X Test1.x =  Test1.X 3) ;;
+printf "test: %d\n" (3 : Test1.x_t);;
+printf "test: %d\n" Test1.Nested.x;;
+printf "test: %b\n" (Test1.Nested.X Test1.Nested.x = Test1.Nested.X 3) ;;
+printf "test: %d\n" (3 : Test1.Nested.x_t);;
+open Test1
+printf "test: %d\n" x;;
+printf "test: %b\n" (X x = X 1) ;;
+printf "test: %d\n" (1 : x_t);;
+printf "x = %d\n" Nested.x;;
+printf "x = %b\n" (Nested.X Nested.x = Nested.X 3) ;;
+printf "x = %d\n" (3 : Nested.x_t);;
+open Nested
+printf "x = %d\n" x;;
+printf "x = %b\n" (X x = X 3) ;;
+printf "x = %d\n" (3 : x_t);;
+
+#load "test1b.ml";;
+
+printf "test: %d\n" Test1.y
+printf "test: %d\n" (3 : Test1.y_t)
+open Test1
+printf "test: %d\n" y
+printf "test: %d\n" (3 : y_t)
+
+printf "test: %s\n" Test1.x;;
+printf "test: %b\n" (Test1.X Test1.x = Test1.X "a") ;;
+printf "test: %s\n" ("a\n" : Test1.x_t);;
+printf "test: %s\n" Test1.Nested.x;;
+printf "test: %b\n" (Test1.Nested.X Test1.x =  Test1.Nested.X "a") ;;
+printf "test: %s\n" ("a\n" : Test1.Nested.x_t);;
+open Test1
+printf "test: %s\n" x;;
+printf "test: %b\n" (X x = X "a") ;;
+printf "test: %s\n" ("a\n" : x_t);;
+printf "test: %s\n" Nested.x;;
+printf "test: %b\n" (Nested.X Test1.x = Nested.X "a") ;;
+printf "test: %s\n" ("a\n" : Nested.x_t);;
+open Nested
+printf "test: %s\n" x;;
+printf "test: %b\n" (X x = X "a") ;;
+printf "test: %s\n" ("a\n" : x_t);;
+
+
+// Back to test1a.  Not this all happens in one interaction.
+#load "test1a.ml"
+
+
+printf "test: %d\n" Test1.x
+printf "test: %b\n" (Test1.X Test1.x =  Test1.X 3) 
+printf "test: %d\n" (3 : Test1.x_t)
+printf "test: %d\n" Test1.Nested.x
+printf "test: %b\n" (Test1.Nested.X Test1.Nested.x = Test1.Nested.X 3) 
+printf "test: %d\n" (3 : Test1.Nested.x_t)
+open Test1
+printf "test: %d\n" x
+printf "test: %b\n" (X x = X 1) 
+printf "test: %d\n" (1 : x_t)
+printf "x = %d\n" Nested.x
+printf "x = %b\n" (Nested.X Nested.x = Nested.X 3) 
+printf "x = %d\n" (3 : Nested.x_t)
+open Nested
+printf "x = %d\n" x
+printf "x = %b\n" (X x = X 3) 
+printf "x = %d\n" (3 : x_t)
+;;
+
+begin ignore (3 : x_t); ignore (3 : Nested.x_t); ignore (3 : Test1.Nested.x_t); ignore (3 : Test1.x_t); let os = System.IO.File.CreateText "test.ok" in os.Close() end;;
+#quit;; 
+
diff --git a/tests/fsharp/core/fsi-reload/test1a.ml b/tests/fsharp/core/fsi-reload/test1a.ml
new file mode 100644
index 0000000..fe3ecf7
--- /dev/null
+++ b/tests/fsharp/core/fsi-reload/test1a.ml
@@ -0,0 +1,15 @@
+// #Conformance #FSI 
+
+module Test1
+
+let x = 1
+type x_t = int
+type t = X of int
+
+module Nested = begin
+
+  let x = 1
+  type x_t = int
+  type t = X of int
+
+end
diff --git a/tests/fsharp/core/fsi-reload/test1b.ml b/tests/fsharp/core/fsi-reload/test1b.ml
new file mode 100644
index 0000000..3c5c55e
--- /dev/null
+++ b/tests/fsharp/core/fsi-reload/test1b.ml
@@ -0,0 +1,18 @@
+// #Conformance #FSI 
+
+module Test1
+
+let x = "a"
+type x_t = string
+let y = 4
+type y_t = int
+
+type t = X of string
+
+module Nested = begin
+
+  let x = "a"
+  type x_t = string
+  type t = X of string
+
+end
diff --git a/tests/fsharp/core/fsiAndModifiers/build.bat b/tests/fsharp/core/fsiAndModifiers/build.bat
new file mode 100644
index 0000000..d0351e5
--- /dev/null
+++ b/tests/fsharp/core/fsiAndModifiers/build.bat
@@ -0,0 +1,18 @@
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if exist TestLibrary.dll (del /f /q TestLibrary.dll)
+"%FSI%" %fsi_flags%  --maxerrors:1 < prepare.fsx
+ at if ERRORLEVEL 1 goto Error
+
+:Ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/fsiAndModifiers/prepare.fsx b/tests/fsharp/core/fsiAndModifiers/prepare.fsx
new file mode 100644
index 0000000..6a5b171
--- /dev/null
+++ b/tests/fsharp/core/fsiAndModifiers/prepare.fsx
@@ -0,0 +1,34 @@
+open System
+open System.IO
+open System.Reflection
+open System.Reflection.Emit
+try
+    let name = "TestLibrary"
+    let filename = name + ".dll"
+
+    let asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(AssemblyName(name), AssemblyBuilderAccess.Save, __SOURCE_DIRECTORY__)
+    let modBuilder = asmBuilder.DefineDynamicModule(name, filename)
+    let tyBuilder = modBuilder.DefineType("TestType", TypeAttributes.Class ||| TypeAttributes.Public)
+    let methBuilder = 
+        tyBuilder.DefineMethod(
+            name = "Get", 
+            attributes = (MethodAttributes.Public ||| MethodAttributes.Static), 
+            callingConvention = CallingConventions.Standard,
+            returnType = typeof<int>,
+            returnTypeRequiredCustomModifiers = null,
+            returnTypeOptionalCustomModifiers = null,
+            parameterTypes = [| typeof<int> |],
+            parameterTypeRequiredCustomModifiers = null,
+            parameterTypeOptionalCustomModifiers = [| [| typeof<System.Runtime.CompilerServices.IsConst> |] |]
+            )
+    do
+        let ilG = methBuilder.GetILGenerator()
+        ilG.Emit(OpCodes.Ldarg_0)
+        ilG.Emit(OpCodes.Ret)
+
+    tyBuilder.CreateType() 
+    |> ignore
+
+    asmBuilder.Save(filename)
+    exit 0
+with _ -> exit 1
\ No newline at end of file
diff --git a/tests/fsharp/core/fsiAndModifiers/run.bat b/tests/fsharp/core/fsiAndModifiers/run.bat
new file mode 100644
index 0000000..e22bdbb
--- /dev/null
+++ b/tests/fsharp/core/fsiAndModifiers/run.bat
@@ -0,0 +1,30 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+rem there is no build.bat for this testcase, so don't check for build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags%  --maxerrors:1 < test.fsx
+  if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/fsiAndModifiers/test.fsx b/tests/fsharp/core/fsiAndModifiers/test.fsx
new file mode 100644
index 0000000..a009995
--- /dev/null
+++ b/tests/fsharp/core/fsiAndModifiers/test.fsx
@@ -0,0 +1,4 @@
+#r "TestLibrary.dll"
+
+let x = TestType.Get(100)
+if x = 100 then System.IO.File.WriteAllText("test.ok", "")
\ No newline at end of file
diff --git a/tests/fsharp/core/genericmeasures/build.bat b/tests/fsharp/core/genericmeasures/build.bat
new file mode 100644
index 0000000..6df2653
--- /dev/null
+++ b/tests/fsharp/core/genericmeasures/build.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/genericmeasures/run.bat b/tests/fsharp/core/genericmeasures/run.bat
new file mode 100644
index 0000000..06ffddc
--- /dev/null
+++ b/tests/fsharp/core/genericmeasures/run.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/genericmeasures/test.fsx b/tests/fsharp/core/genericmeasures/test.fsx
new file mode 100644
index 0000000..16c4bde
--- /dev/null
+++ b/tests/fsharp/core/genericmeasures/test.fsx
@@ -0,0 +1,61 @@
+#if COMPILED
+module Core_genericMeasures
+#else
+module Core_genericMeasures =
+#endif
+    [<AllowNullLiteral>]
+    type C<'T> = class end
+    
+    [<Measure>] type t
+    let f1 (_ : int<t>) = ()
+    let f2 (_ : float<t>) = ()
+    let f3 (_ : int<_>) = ()
+    let f4 (_ : float<_>) = ()
+    let f5 (_ : C<'a>) = ()
+    let f6 (_ : list<'a>) = ()
+    
+    let foo() =
+        let a = 0<_>
+        let b = 0.0<_>
+        let c = null : C<int<_>>
+        let d = null : C<float<_>>
+        let e = [] : list<int<_>>
+        let f = [] : list<float<_>>
+        let g = null : C<int<_> * _>
+        let h = null : C<_ * int<_> * _>
+        let i : List<int<_>> = List.empty
+        let j : List<float<_>> = List.empty
+    
+        f1 a
+        f2 b
+        f3 a
+        f4 b
+        f5 c
+        f5 d
+        f6 e
+        f6 f
+        f5 g
+        f5 h
+        f6 i
+        f6 j
+    
+    type T = 
+        static member Foo(_ : int<t>) = ()
+        static member Foo1(_ : int<_>) = ()
+    
+        static member Bar() =
+            let x = 0<_>
+            T.Foo(x)
+    
+        static member Baz() =
+            let x = 0<_>
+            T.Foo1(x)
+    
+    foo()
+    T.Bar()
+    T.Baz()
+    
+    let aa = 
+        stdout.WriteLine "Test Passed"
+        System.IO.File.WriteAllText("test.ok", "ok")
+        exit 0
\ No newline at end of file
diff --git a/tests/fsharp/core/hiding/build.bat b/tests/fsharp/core/hiding/build.bat
new file mode 100644
index 0000000..829c46c
--- /dev/null
+++ b/tests/fsharp/core/hiding/build.bat
@@ -0,0 +1,54 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+"%FSC%" %fsc_flags% -a --optimize -o:lib.dll lib.mli lib.ml libv.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -a --optimize -r:lib.dll -o:lib2.dll lib2.mli lib2.ml lib3.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib2.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize -r:lib.dll -r:lib2.dll -o:client.exe client.ml
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" client.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/hiding/client.ml b/tests/fsharp/core/hiding/client.ml
new file mode 100644
index 0000000..0b4946f
--- /dev/null
+++ b/tests/fsharp/core/hiding/client.ml
@@ -0,0 +1,23 @@
+
+#light
+
+do Lib2.f1 Lib.x
+do Lib2.f2 (Lib.x, Lib.x)
+
+// Check some simple cases where a separately compiled client tries to access things whose 
+// potentially-inlined-implementations might use private/internal fields, types and values
+let x = Libv.MyRecord.Create(3)
+printfn "x.TwiceX = %d" x.TwiceX
+printfn "x.TopV = %d" x.TopV
+printfn "x.X1 = %d" x.X1
+printfn "x.X2 = %d" x.X2
+    
+
+
+printfn "useInternalValue = %A" (Lib3.useInternalValue())
+
+printfn "rValue = %A" Lib3.rValue
+printfn "useInternalField = %A" (Lib3.useInternalField(Lib3.rValue))
+printfn "useInternalTag = %A" (Lib3.useInternalTag())
+printfn "useInternalType = %A" (Lib3.useInternalType())
+
diff --git a/tests/fsharp/core/hiding/lib.ml b/tests/fsharp/core/hiding/lib.ml
new file mode 100644
index 0000000..0040092
--- /dev/null
+++ b/tests/fsharp/core/hiding/lib.ml
@@ -0,0 +1,14 @@
+#light
+
+type abstractType = { xx : int }
+
+exception A
+exception B of string
+exception C = A
+
+let x = { xx = 3 }
+
+let e1 = A
+let e2 = B("a")
+let e3 = C
+
diff --git a/tests/fsharp/core/hiding/lib.mli b/tests/fsharp/core/hiding/lib.mli
new file mode 100644
index 0000000..79ba516
--- /dev/null
+++ b/tests/fsharp/core/hiding/lib.mli
@@ -0,0 +1,11 @@
+
+type abstractType
+
+val x : abstractType
+
+exception A
+exception C = A
+
+val e1: exn
+val e2: exn
+val e3: exn
diff --git a/tests/fsharp/core/hiding/lib2.ml b/tests/fsharp/core/hiding/lib2.ml
new file mode 100644
index 0000000..5f57e47
--- /dev/null
+++ b/tests/fsharp/core/hiding/lib2.ml
@@ -0,0 +1,13 @@
+
+
+type hidden = Lib.abstractType
+type 'a visible = Lib.abstractType * 'a
+
+let f1 (x: hidden) = ()
+let f2 (x: hidden visible) = ()
+
+exception D1 = Lib.A
+exception D2 = Lib.C
+
+let e3 = D1
+let e2 = D2
diff --git a/tests/fsharp/core/hiding/lib2.mli b/tests/fsharp/core/hiding/lib2.mli
new file mode 100644
index 0000000..1988cfb
--- /dev/null
+++ b/tests/fsharp/core/hiding/lib2.mli
@@ -0,0 +1,11 @@
+
+
+val f1: Lib.abstractType -> unit  (* looks OK, but optimization data may refer to hidden type *)
+val f2: Lib.abstractType * Lib.abstractType -> unit  (* looks OK, but optimization data may refer to hidden type *)
+
+
+val e2: exn
+val e3: exn
+
+exception D1 = Lib.A
+exception D2 = Lib.C
diff --git a/tests/fsharp/core/hiding/lib3.ml b/tests/fsharp/core/hiding/lib3.ml
new file mode 100644
index 0000000..47d4e07
--- /dev/null
+++ b/tests/fsharp/core/hiding/lib3.ml
@@ -0,0 +1,22 @@
+
+#light
+
+
+let internal x = System.DateTime.Now
+
+let useInternalValue() = x
+
+
+type r = internal { x : int }
+
+let rValue = { x = 1 }
+let useInternalField(r) = r.x
+
+type u = internal |  C of int
+
+let useInternalTag() = C(1)
+
+type internal x = XX | YY
+
+let useInternalType() = box XX
+
diff --git a/tests/fsharp/core/hiding/libv.ml b/tests/fsharp/core/hiding/libv.ml
new file mode 100644
index 0000000..e3d670b
--- /dev/null
+++ b/tests/fsharp/core/hiding/libv.ml
@@ -0,0 +1,15 @@
+#light
+
+
+
+
+let internal topv = 1
+type MyRecord = 
+    { x1 : int;
+      x2 : int } 
+    member obj.X1 = obj.x1
+    member obj.X2 = obj.x2
+    member obj.TopV = topv
+    member obj.TwiceX = obj.x1 + obj.x1
+    static member Create(n) = { x1 = n; x2 = n }
+    
diff --git a/tests/fsharp/core/innerpoly/build.bat b/tests/fsharp/core/innerpoly/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/innerpoly/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/innerpoly/run.bat b/tests/fsharp/core/innerpoly/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/innerpoly/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/innerpoly/test.fsx b/tests/fsharp/core/innerpoly/test.fsx
new file mode 100644
index 0000000..d0c220a
--- /dev/null
+++ b/tests/fsharp/core/innerpoly/test.fsx
@@ -0,0 +1,392 @@
+// #Conformance #Regression #LetBindings #TypeInference 
+#if Portable
+module Core_innerpoly
+#endif
+
+let failures = ref false
+let report_failure () = stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+
+module TestNullIsGeneralizeable = begin
+
+   open System.Collections.Generic
+   let nullList : List<'a> = null
+   
+   // check this is generic
+   
+   let v1 = (nullList : List<int>)
+   let v2 = (nullList : List<string>)
+end
+
+let f (x:'a) = 
+  let rec g1 y z  = g2 y z  
+  and g2 y z  = g1 y z  in
+  g1 "a" 1, g1 1 "a", g2 "a" "b", g2 3 4
+
+
+#if OCAML_RECORD_FIELDS
+type z = { x : 'a. int -> 'a }
+
+let z2 = { x = (fun x -> failwith "a") }
+
+let f3 (x:int) = failwith "a"
+let z3 = { x = f3 }
+
+let f2 n = 
+  let z2 = { x = (fun (x:int) -> failwith (string_of_int (x+n))) } in 
+  let f3 (x:int) = failwith "a" in
+  z2
+
+let _ : string = try (f2 3).x(3) ^ "unused" with Failure _ -> ""
+#endif
+
+
+
+
+let id x = x    
+
+type ('a,'b) r = {a : 'a list; b: 'b list list }
+type ('a,'b) r2 = R2 of  'a list * 'b list  list
+
+let () =
+  // yes folks, OCaml and F# support let-polymorphism for non-trivial patterns such as these
+  let a,b = None,None in 
+  let _ = (a : int option) in
+  let _ = (a : string option) in
+  let _ = (b : int option) in
+  let _ = (b : string option) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a option) in
+    let _ = (a : 'b option) in
+    let _ = (b : 'a option) in
+    let _ = (b : 'b option) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let {a=a;b=b} = {a=[];b=[[]]} in 
+  let _ = (a : int list) in
+  let _ = (a : string list) in
+  let _ = (b : int list list) in
+  let _ = (b : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a list) in
+    let _ = (a : 'a list) in
+    let _ = (b : 'b list list) in
+    let _ = (b : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let (R2(a,b)) = R2 ([],[[]]) in 
+  let _ = (a : int list) in
+  let _ = (a : string list) in
+  let _ = (b : int list list) in
+  let _ = (b : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a list) in
+    let _ = (a : 'a list) in
+    let _ = (b : 'b list list) in
+    let _ = (b : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let (R2((a as a2),(b as b2))) = R2 ([],[[]]) in 
+  let _ = (a2 : int list) in
+  let _ = (a2 : string list) in
+  let _ = (b2 : int list list) in
+  let _ = (b2 : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a2 : 'a list) in
+    let _ = (a2 : 'a list) in
+    let _ = (b2 : 'b list list) in
+    let _ = (b2 : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1;
+  // possibly-failing versions of the above
+
+  let [(a,b)] = [(None,None)] in 
+  let _ = (a : int option) in
+  let _ = (a : string option) in
+  let _ = (b : int option) in
+  let _ = (b : string option) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a option) in
+    let _ = (a : 'b option) in
+    let _ = (b : 'a option) in
+    let _ = (b : 'b option) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let [{a=a;b=b}] = [{a=[];b=[[]]}] in 
+  let _ = (a : int list) in
+  let _ = (a : string list) in
+  let _ = (b : int list list) in
+  let _ = (b : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a list) in
+    let _ = (a : 'a list) in
+    let _ = (b : 'b list list) in
+    let _ = (b : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let [(R2(a,b))] = [R2 ([],[[]])] in 
+  let _ = (a : int list) in
+  let _ = (a : string list) in
+  let _ = (b : int list list) in
+  let _ = (b : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a : 'a list) in
+    let _ = (a : 'a list) in
+    let _ = (b : 'b list list) in
+    let _ = (b : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1;
+  let [(R2((a as a2),(b as b2)))] = [R2 ([],[[]])] in 
+  let _ = (a2 : int list) in
+  let _ = (a2 : string list) in
+  let _ = (b2 : int list list) in
+  let _ = (b2 : string list list) in
+  let f (x:'a) (y:'b) =
+    let _ = (a2 : 'a list) in
+    let _ = (a2 : 'a list) in
+    let _ = (b2 : 'b list list) in
+    let _ = (b2 : 'b list list) in
+    () in
+  f 1 "a";
+  f 1 1; 
+  ()
+
+    
+
+let _ =
+      let f x = x in
+      f (printfn "%s") "Hello, world!\n";
+      f (printfn "%d") 3;
+      f (printfn "%s") "Hello, world!\n"
+
+let test5365() =
+      let f x = x in
+      f (printfn "%s") "Hello, world!\n";
+      f (printfn "%d") 3;
+      f (printfn "%s") "Hello, world!\n"
+
+do test5365() 
+do test5365() 
+
+module TestOptimizationOfTypeFunctionsWithSideEffects = begin
+    let count = ref 0
+    let f<'a> = incr count; !count
+
+
+    do test "eoeo23c1" (f<int> = 1)
+    do test "eoeo23c2" (f<int> = 2)
+    do test "eoeo23c3" (f<string> = 3)
+
+    let x1 = f<int>
+
+    do test "eoeo23c4" (x1 = 4)
+    do test "eoeo23c5" (x1 = 4)
+end
+
+module Bug1126BenjaminTeuber = begin
+    let Run() =         
+        // put in the declaration and the error vanishes
+        let PrintAll (values(* : int seq*)) =                    
+            for value in values do                            
+                printf "%i" value  
+            done 
+        let CallPrintAll (values : int seq) =        
+            printfn "Caling Sum" ;
+            values |> PrintAll in           
+            printfn "Done" ;
+        let MyFun () =                    
+            let mySeq = [5 ; 5] |> List.toSeq  in
+            mySeq |> CallPrintAll in               
+        MyFun()        
+            
+    do Run()
+end
+
+module FSharp_1_0_Bug1024 = begin
+    let count = ref 1
+    let x<'a> = (count := !count + 1); typeof<'a>
+    
+    do test "vnwo9wu1" (!count = 1)
+    let z0<'a> =  x<'a>
+    do test "vnwo9wu1" (!count = 1)
+    let z1 =  x<int>
+    do test "vnwo9wu2" (!count = 2)
+    let z2 =  x<int>
+    do test "vnwo9wu3" (!count = 3)
+
+end
+module FSharp_1_0_Bug1024B = begin
+    let count = ref 1
+    let r<'a> = (count := !count + 1); ref ([] : 'a list)
+    do test "vnwo9wu1" (!count = 1)
+    let x1 = r<int>
+
+    do test "vnwo9wu1" (!count = 2)
+    let z0 =  x1
+    do test "vnwo9wu1" (!count = 2)
+    let (z1,z2) =  (x1,x1)
+    do test "vnwo9wu2" (!count = 2)
+    let z3 =  x1
+    do test "vnwo9wu3" (!count = 2)
+
+end
+
+
+
+module CheckGenericInnerMethodWithClassConstraint = begin
+    let Main() =
+            // null Seq
+            let func x = null
+            let initFinite = Seq.init 3 func
+            let expectedNullSeq = seq [ null;null;null]
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithNullableConstraint = begin
+    let Main() =
+            // null Seq
+            let func x = System.Nullable(2) 
+            let initFinite = Seq.init 3 func
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithNullConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : null = Unchecked.defaultof<'T>
+            let initFinite = Seq.init 3 func
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithStructConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : struct = Unchecked.defaultof<'T>
+            let initFinite = Seq.init 3 func
+            
+            
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithClassConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : not struct = Unchecked.defaultof<'T>
+            let initFinite = Seq.init 3 func
+            
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithUnmanagedConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : unmanaged = Unchecked.defaultof<'T>
+            let initFinite = Seq.init<nativeint> 3 func
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithDefaultCtorConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : (new : unit -> 'T) = Unchecked.defaultof<'T>
+            let initFinite = Seq.init 3 func
+            
+            
+            printfn "%A" initFinite
+
+    Main()
+end
+
+
+module CheckGenericInnerMethodWithEnumConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : enum<int32> = Unchecked.defaultof<'T>
+            let initFinite = Seq.init<System.StringComparison> 3 func
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckGenericInnerMethodWithDelegateConstraintMicro = begin
+    let Main() =
+            // null Seq
+            let func (x:int) : 'T when 'T : delegate<System.EventArgs,unit> = Unchecked.defaultof<'T>
+            let initFinite = Seq.init<System.EventHandler> 3 func
+            printfn "%A" initFinite
+
+    Main()
+end
+
+module CheckExplicitSignatureWhichHidesDefaultConstraint_DevDiv2_FSharp_95481 = begin
+
+    let inline sincos< ^t when ^t : (static member Sin : ^t -> ^t)
+                           and ^t : (static member Cos : ^t -> ^t)> (a: ^t) =
+      let y = sin a
+      let x = cos a
+      y, x
+
+end
+
+// try a "let rec"
+module CheckExplicitSignatureWhichHidesDefaultConstraint_DevDiv2_FSharp_95481_Variation1 = begin
+
+    let rec inline sincos< ^t when ^t : (static member Sin : ^t -> ^t)
+                              and ^t : (static member Cos : ^t -> ^t)> (a: ^t) =
+      let y = sin a
+      let x = cos a
+      y, x
+
+
+end
+
+module CheckExplicitSignatureWhichHidesDefaultConstraint_DevDiv2_FSharp_95481_Variation2 = begin
+
+    let inline sincos (a: ^t) =
+      let y = sin a
+      let x = cos a
+      y, x
+
+end
+
+module InnerGenericBindingsInComputationExpressions = begin
+    let f() =
+        let r = [|
+           let N x = System.Nullable<_>(x)
+           for i in 1..3 do
+              yield N i
+          |]
+        r
+    f()
+end
+
+#if Portable
+let aa = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+    else (stdout.WriteLine "Test Passed"; exit 0)
+#else
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+#endif
\ No newline at end of file
diff --git a/tests/fsharp/core/int32/build.bat b/tests/fsharp/core/int32/build.bat
new file mode 100644
index 0000000..6df2653
--- /dev/null
+++ b/tests/fsharp/core/int32/build.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/int32/run.bat b/tests/fsharp/core/int32/run.bat
new file mode 100644
index 0000000..06ffddc
--- /dev/null
+++ b/tests/fsharp/core/int32/run.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/int32/test.fsx b/tests/fsharp/core/int32/test.fsx
new file mode 100644
index 0000000..a964ca9
--- /dev/null
+++ b/tests/fsharp/core/int32/test.fsx
@@ -0,0 +1,400 @@
+// #Conformance #Constants 
+#if Portable 
+module Core_int32
+#endif
+
+#light
+
+let failures = ref false
+let report_failure (s) = 
+  stderr.WriteLine ("NO: " + s); failures := true; failwith ""
+let test s b = if b then () else report_failure(s) 
+
+(* TEST SUITE FOR Int32 *)
+
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+
+do SetCulture()    
+#endif
+
+  
+do stdout.WriteLine "checking unchecked conversions"; 
+do test "testb3" (try nativeint 0.0 = 0n with _ -> false)
+do test "testnr6" (try int64 0.0 = 0L with _ -> false)
+do test "testn46" (try int32 0.0 = 0 with _ -> false)
+do test "testqb3" (try int16 0.0 = 0s with _ -> false)
+do test "testn4" (try sbyte 0.0 = 0y with _ -> false)
+
+do test "test4b" (try unativeint 0.0 = 0un with _ -> false)
+do test "test75j" (try uint64 0.0 = 0UL with _ -> false)
+do test "test4n6" (try uint32 0.0 = 0u with _ -> false)
+do test "testc24q" (try uint16 0.0 = 0us with _ -> false)
+do test "testv43" (try byte 0.0 = 0uy with _ -> false)
+
+do test "testv3w" (try unativeint 10.0E100 |> ignore ; true  with _ -> false)
+do test "testv3q" (try uint64 10.0E100 |> ignore ; true  with _ -> false)
+do test "testv3" (try uint32 10.0E100 |> ignore ; true  with _ -> false)
+do test "tesvtv3" (try uint16 10.0E100 |> ignore ; true  with _ -> false)
+do test "testvq34" (try byte 10.0E100 |> ignore; true with _ -> false)
+
+do test "testb4wy" (try nativeint 10.0E100 |> ignore ; true  with _ -> false)
+do test "testb4w" (try int64 10.0E100 |> ignore ; true  with _ -> false)
+do test "testnr" (try int32 10.0E100 |> ignore ; true  with _ -> false)
+do test "testjy" (try int16 10.0E100 |> ignore ; true  with _ -> false)
+do test "testny" (try sbyte 10.0E100 |> ignore; true with _ -> false)
+
+
+do test "test3fwe" (try Checked.(+) 0.0 1.0 = 1.0 with _ -> false)
+do test "testc4" (try Checked.(-) 1.0 0.0 = 1.0 with _ -> false)
+do test "testc34" (try Checked.( * ) 0.0 0.0 = 0.0 with _ -> false)
+
+do test "testv3" (try Checked.(+) 0.0f 1.0f = 1.0f with _ -> false)
+do test "testv5" (try Checked.(-) 1.0f 0.0f = 1.0f with _ -> false)
+do test "test4y5b" (try Checked.( * ) 0.0f 0.0f = 0.0f with _ -> false)
+
+do stdout.WriteLine "checking checked conversions"; 
+do test "test" (try Checked.nativeint 0.0 = 0n with _ -> false)
+do test "test" (try Checked.int64 0.0 = 0L with _ -> false)
+do test "test" (try Checked.int32 0.0 = 0 with _ -> false)
+do test "test" (try Checked.int16 0.0 = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0.0 = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0.0 = 0un with _ -> false)
+do test "test" (try Checked.uint64 0.0 = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0.0 = 0u with _ -> false)
+do test "test" (try Checked.uint16 0.0 = 0us with _ -> false)
+do test "test" (try Checked.byte 0.0 = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0.0f = 0n with _ -> false)
+do test "test" (try Checked.int64 0.0f = 0L with _ -> false)
+do test "test" (try Checked.int32 0.0f = 0 with _ -> false)
+do test "test" (try Checked.int16 0.0f = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0.0f = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0.0f = 0un with _ -> false)
+do test "test" (try Checked.uint64 0.0f = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0.0f = 0u with _ -> false)
+do test "test" (try Checked.uint16 0.0f = 0us with _ -> false)
+do test "test" (try Checked.byte 0.0f = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0L = 0n with _ -> false)
+do test "test" (try Checked.int64 0L = 0L with _ -> false)
+do test "test" (try Checked.int32 0L = 0 with _ -> false)
+do test "test" (try Checked.int16 0L = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0L = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0L = 0un with _ -> false)
+do test "test" (try Checked.uint64 0L = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0L = 0u with _ -> false)
+do test "test" (try Checked.uint16 0L = 0us with _ -> false)
+do test "test" (try Checked.byte 0L = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0UL = 0n with _ -> false)
+do test "test" (try Checked.int64 0UL = 0L with _ -> false)
+do test "test" (try Checked.int32 0UL = 0 with _ -> false)
+do test "test" (try Checked.int16 0UL = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0UL = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0UL = 0un with _ -> false)
+do test "test" (try Checked.uint64 0UL = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0UL = 0u with _ -> false)
+do test "test" (try Checked.uint16 0UL = 0us with _ -> false)
+do test "test" (try Checked.byte 0UL = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0 = 0n with _ -> false)
+do test "test" (try Checked.int64 0 = 0L with _ -> false)
+do test "test" (try Checked.int32 0 = 0 with _ -> false)
+do test "test" (try Checked.int16 0 = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0 = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0 = 0un with _ -> false)
+do test "test" (try Checked.uint64 0 = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0 = 0u with _ -> false)
+do test "test" (try Checked.uint16 0 = 0us with _ -> false)
+do test "test" (try Checked.byte 0 = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0u = 0n with _ -> false)
+do test "test" (try Checked.int64 0u = 0L with _ -> false)
+do test "test" (try Checked.int32 0u = 0 with _ -> false)
+do test "test" (try Checked.int16 0u = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0u = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0u = 0un with _ -> false)
+do test "test" (try Checked.uint64 0u = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0u = 0u with _ -> false)
+do test "test" (try Checked.uint16 0u = 0us with _ -> false)
+do test "test" (try Checked.byte 0u = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0s = 0n with _ -> false)
+do test "test" (try Checked.int64 0s = 0L with _ -> false)
+do test "test" (try Checked.int32 0s = 0 with _ -> false)
+do test "test" (try Checked.int16 0s = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0s = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0s = 0un with _ -> false)
+do test "test" (try Checked.uint64 0s = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0s = 0u with _ -> false)
+do test "test" (try Checked.uint16 0s = 0us with _ -> false)
+do test "test" (try Checked.byte 0s = 0uy with _ -> false)
+
+
+
+do test "test" (try Checked.nativeint 0us = 0n with _ -> false)
+do test "test" (try Checked.int64 0us = 0L with _ -> false)
+do test "test" (try Checked.int32 0us = 0 with _ -> false)
+do test "test" (try Checked.int16 0us = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0us = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0us = 0un with _ -> false)
+do test "test" (try Checked.uint64 0us = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0us = 0u with _ -> false)
+do test "test" (try Checked.uint16 0us = 0us with _ -> false)
+do test "test" (try Checked.byte 0us = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0uy = 0n with _ -> false)
+do test "test" (try Checked.int64 0uy = 0L with _ -> false)
+do test "test" (try Checked.int32 0uy = 0 with _ -> false)
+do test "test" (try Checked.int16 0uy = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0uy = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0uy = 0un with _ -> false)
+do test "test" (try Checked.uint64 0uy = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0uy = 0u with _ -> false)
+do test "test" (try Checked.uint16 0uy = 0us with _ -> false)
+do test "test" (try Checked.byte 0uy = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0y = 0n with _ -> false)
+do test "test" (try Checked.int64 0y = 0L with _ -> false)
+do test "test" (try Checked.int32 0y = 0 with _ -> false)
+do test "test" (try Checked.int16 0y = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0y = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0y = 0un with _ -> false)
+do test "test" (try Checked.uint64 0y = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0y = 0u with _ -> false)
+do test "test" (try Checked.uint16 0y = 0us with _ -> false)
+do test "test" (try Checked.byte 0y = 0uy with _ -> false)
+
+
+do test "test" (try Checked.nativeint 0n = 0n with _ -> false)
+do test "test" (try Checked.int64 0n = 0L with _ -> false)
+do test "test" (try Checked.int32 0n = 0 with _ -> false)
+do test "test" (try Checked.int16 0n = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0n = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0n = 0un with _ -> false)
+do test "test" (try Checked.uint64 0n = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0n = 0u with _ -> false)
+do test "test" (try Checked.uint16 0n = 0us with _ -> false)
+do test "test" (try Checked.byte 0n = 0uy with _ -> false)
+
+do test "test" (try Checked.nativeint 0un = 0n with _ -> false)
+do test "test" (try Checked.int64 0un = 0L with _ -> false)
+do test "test" (try Checked.int32 0un = 0 with _ -> false)
+do test "test" (try Checked.int16 0un = 0s with _ -> false)
+do test "test" (try Checked.sbyte 0un = 0y with _ -> false)
+
+do test "test" (try Checked.unativeint 0un = 0un with _ -> false)
+do test "test" (try Checked.uint64 0un = 0UL with _ -> false)
+do test "test" (try Checked.uint32 0un = 0u with _ -> false)
+do test "test" (try Checked.uint16 0un = 0us with _ -> false)
+do test "test" (try Checked.byte 0un = 0uy with _ -> false)
+
+
+
+do test "test" (try Checked.unativeint 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.uint64 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.uint32 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.uint16 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.byte 10.0E100 |> ignore; false with _ -> true)
+
+do test "test" (try Checked.nativeint 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.int64 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.int32 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.int16 10.0E100 |> ignore ; false with _ -> true)
+do test "test" (try Checked.sbyte 10.0E100 |> ignore; false with _ -> true)
+
+let fails f x = try ignore (f x); false with _ -> true
+let succeeds f x = not (fails f x)
+
+do stdout.WriteLine "further checks on checked conversions"; 
+do test "test" (fails Checked.byte 0xFFy)
+do test "test" (fails Checked.uint16 0xFFy)
+do test "test" (fails Checked.uint16 0xFFFFs)
+do test "test" (fails Checked.uint32 0xFFy)
+do test "test" (fails Checked.uint32 0xFFFFs)
+do test "test" (fails Checked.uint32 0xFFFFFFFF)
+do test "test" (fails Checked.uint64 0xFFy)
+do test "test" (fails Checked.uint64 0xFFFFs)
+do test "test" (fails Checked.uint64 0xFFFFFFFF)
+do test "test" (fails Checked.uint64 0xFFFFFFFFFFFFFFFFL)
+
+do test "test" (fails Checked.sbyte 0xFFuy)
+do test "test" (succeeds Checked.int16 0xFFuy)
+do test "test" (fails Checked.int16 0xFFFFus)
+do test "test" (succeeds Checked.int32 0xFFuy)
+do test "test" (succeeds Checked.int32 0xFFFFus)
+do test "test" (fails Checked.int32 0xFFFFFFFFu)
+do test "test" (succeeds Checked.int64 0xFFuy)
+do test "test" (succeeds Checked.int64 0xFFFFus)
+do test "test" (succeeds Checked.int64 0xFFFFFFFFu)
+do test "test" (fails Checked.int64 0xFFFFFFFFFFFFFFFFUL)
+do test "test" (fails Checked.int64 0x8000000000000000UL)
+do test "test" (succeeds Checked.int64 0x7FFFFFFFFFFFFFFFUL)
+
+do stdout.WriteLine "still further checks on checked conversions"; 
+do test "test" (succeeds Checked.sbyte (-0x80s))
+do test "test" (fails Checked.sbyte (-0x81s))
+do test "test" (succeeds Checked.sbyte (-0x80))
+do test "test" (fails Checked.sbyte (-0x81))
+do test "test" (succeeds Checked.sbyte (-0x80L))
+do test "test" (fails Checked.sbyte (-0x81L))
+do test "test" (succeeds Checked.sbyte (-0x80n))
+do test "test" (fails Checked.sbyte (-0x81n))
+
+do test "test" (succeeds Checked.int16 (-0x8000))
+do test "test" (fails Checked.int16 (-0x8001))
+do test "test" (succeeds Checked.int16 (-0x8000L))
+do test "test" (fails Checked.int16 (-0x8001L))
+do test "test" (succeeds Checked.int16 (-0x8000n))
+do test "test" (fails Checked.int16 (-0x8001n))
+
+do test "test" (succeeds Checked.int32 (-0x80000000L))
+do test "test" (fails Checked.int32 (-0x80000001L))
+
+
+do stdout.WriteLine "done checking checked ops"
+
+do test "test" (int32 0xFFy = -1)
+do test "test" (uint32 0xFFy = 4294967295u)
+do test "test" (int32 0xFFuy = 255)
+do test "test" (uint32 0xFFuy = 255u)
+
+module MinMaxAbs32 = begin
+        do test "ceijoe9cewz1" (min 0 -1 = -1)
+        do test "ceijoe9cewz2" (min -1 0 = -1)
+        do test "ceijoe9cewz3" (min 1 0 = 0)
+        do test "ceijoe9cewz4" (min 0 1 = 0)
+
+        do test "ceijoe9cewz5" (max 0 -1 = 0)
+        do test "ceijoe9cewz6" (max -1 0 = 0)
+        do test "ceijoe9cewz7" (max 1 0 = 1)
+        do test "ceijoe9cewz8" (max 0 1 = 1)
+        do test "ceijoe9cewz9" (max 1 1 = 1)
+        do test "ceijoe9cewz0" (max 1 1 = 1)
+
+        do test "ceijoe9cewzA" (abs 0 = 0)
+        do test "ceijoe9cewzB" (abs -1 = 1)
+        do test "ceijoe9cewzC" (abs 1 = 1)
+        do test "ceijoe9cewzD" (abs System.Int32.MaxValue = System.Int32.MaxValue)
+        do test "ceijoe9cewzE" (abs (System.Int32.MinValue + 1) = System.Int32.MaxValue)
+        do test "ceijoe9cewzF" (try abs System.Int32.MinValue |> ignore; false with :? System.OverflowException -> true)
+end
+
+module MinMaxAbs64 = begin
+        do test "ceijoe9cewz1" (min 0L -1L = -1L)
+        do test "ceijoe9cewz2" (min -1L 0L = -1L)
+        do test "ceijoe9cewz3" (min 1L 0L = 0L)
+        do test "ceijoe9cewz4" (min 0L 1L = 0L)
+
+        do test "ceijoe9cewz5" (max 0L -1L = 0L)
+        do test "ceijoe9cewz6" (max -1L 0L = 0L)
+        do test "ceijoe9cewz7" (max 1L 0L = 1L)
+        do test "ceijoe9cewz8" (max 0L 1L = 1L)
+        do test "ceijoe9cewz9" (max 1L 1L = 1L)
+        do test "ceijoe9cewz0" (max 1L 1L = 1L)
+
+        do test "ceijoe9cewzA" (abs 0L = 0L)
+        do test "ceijoe9cewzB" (abs -1L = 1L)
+        do test "ceijoe9cewzC" (abs 1L = 1L)
+        do test "ceijoe9cewzD" (abs System.Int64.MaxValue = System.Int64.MaxValue)
+        do test "ceijoe9cewzE" (abs (System.Int64.MinValue + 1L) = System.Int64.MaxValue)
+        do test "ceijoe9cewzF" (try abs System.Int64.MinValue |> ignore; false with :? System.OverflowException -> true)
+end
+
+
+module MinMaxAbs16 = begin
+        do test "ceijoe9cewz1" (min 0s -1s = -1s)
+        do test "ceijoe9cewz2" (min -1s 0s = -1s)
+        do test "ceijoe9cewz3" (min 1s 0s = 0s)
+        do test "ceijoe9cewz4" (min 0s 1s = 0s)
+
+        do test "ceijoe9cewz5" (max 0s -1s = 0s)
+        do test "ceijoe9cewz6" (max -1s 0s = 0s)
+        do test "ceijoe9cewz7" (max 1s 0s = 1s)
+        do test "ceijoe9cewz8" (max 0s 1s = 1s)
+        do test "ceijoe9cewz9" (max 1s 1s = 1s)
+        do test "ceijoe9cewz0" (max 1s 1s = 1s)
+
+        do test "ceijoe9cewzA" (abs 0s = 0s)
+        do test "ceijoe9cewzB" (abs -1s = 1s)
+        do test "ceijoe9cewzC" (abs 1s = 1s)
+        do test "ceijoe9cewzD" (abs System.Int16.MaxValue = System.Int16.MaxValue)
+        do test "ceijoe9cewzE" (abs (System.Int16.MinValue + 1s) = System.Int16.MaxValue)
+        do test "ceijoe9cewzF" (try abs System.Int16.MinValue |> ignore; false with :? System.OverflowException -> true)
+end
+
+module MinMaxAbs8 = begin
+        do test "ceijoe9cewz1" (min 0y -1y = -1y)
+        do test "ceijoe9cewz2" (min -1y 0y = -1y)
+        do test "ceijoe9cewz3" (min 1y 0y = 0y)
+        do test "ceijoe9cewz4" (min 0y 1y = 0y)
+
+        do test "ceijoe9cewz5" (max 0y -1y = 0y)
+        do test "ceijoe9cewz6" (max -1y 0y = 0y)
+        do test "ceijoe9cewz7" (max 1y 0y = 1y)
+        do test "ceijoe9cewz8" (max 0y 1y = 1y)
+        do test "ceijoe9cewz9" (max 1y 1y = 1y)
+        do test "ceijoe9cewz0" (max 1y 1y = 1y)
+
+        do test "ceijoe9cewzA" (abs 0y = 0y)
+        do test "ceijoe9cewzB" (abs -1y = 1y)
+        do test "ceijoe9cewzC" (abs 1y = 1y)
+        do test "ceijoe9cewzD" (abs System.SByte.MaxValue = System.SByte.MaxValue)
+        do test "ceijoe9cewzE" (abs (System.SByte.MinValue + 1y) = System.SByte.MaxValue)
+        do test "ceijoe9cewzF" (try abs System.SByte.MinValue |> ignore; false with :? System.OverflowException -> true)
+end
+
+module MinMaxAbsNative = begin
+        do test "ceijoe9cewz1" (min 0n -1n = -1n)
+        do test "ceijoe9cewz2" (min -1n 0n = -1n)
+        do test "ceijoe9cewz3" (min 1n 0n = 0n)
+        do test "ceijoe9cewz4" (min 0n 1n = 0n)
+
+        do test "ceijoe9cewz5" (max 0n -1n = 0n)
+        do test "ceijoe9cewz6" (max -1n 0n = 0n)
+        do test "ceijoe9cewz7" (max 1n 0n = 1n)
+        do test "ceijoe9cewz8" (max 0n 1n = 1n)
+        do test "ceijoe9cewz9" (max 1n 1n = 1n)
+        do test "ceijoe9cewz0" (max 1n 1n = 1n)
+
+        do test "ceijoe9cewzA" (abs 0n = 0n)
+        do test "ceijoe9cewzB" (abs -1n = 1n)
+        do test "ceijoe9cewzC" (abs 1n = 1n)
+        do if sizeof<nativeint> = 4 then 
+              test "ceijoe9cewzD1" (abs (nativeint System.Int32.MaxValue) = (nativeint System.Int32.MaxValue));
+              test "ceijoe9cewzF2" (abs (nativeint System.Int32.MinValue + 1n) = nativeint System.Int32.MaxValue);
+              test "ceijoe9cewzG3" (try abs (nativeint System.Int32.MinValue) |> ignore; false with :? System.OverflowException -> true)
+           elif sizeof<nativeint> = 8 then 
+              test "ceijoe9cewzD4" (abs (nativeint System.Int64.MaxValue) = (nativeint System.Int64.MaxValue));
+              test "ceijoe9cewzF5" (abs (nativeint System.Int64.MinValue + 1n) = nativeint System.Int64.MaxValue);
+              test "ceijoe9cewzG6" (try abs (nativeint System.Int64.MinValue) |> ignore; false with :? System.OverflowException -> true)
+           
+end
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/internalsvisible/build.bat b/tests/fsharp/core/internalsvisible/build.bat
new file mode 100644
index 0000000..0f6c359
--- /dev/null
+++ b/tests/fsharp/core/internalsvisible/build.bat
@@ -0,0 +1,61 @@
+if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+REM Test internals visible
+echo == Compiling F# Library
+"%FSC%" %fsc_flags% --version:1.2.3 --keyfile:key.snk -a --optimize -o:library.dll library.fsi library.fs
+ at if ERRORLEVEL 1 goto Error
+
+echo == Verifying F# Library
+"%PEVERIFY%" library.dll
+ at if ERRORLEVEL 1 goto Error
+
+echo == Compiling C# Library
+%CSC% /target:library /keyfile:key.snk /out:librarycs.dll librarycs.cs
+ at if ERRORLEVEL 1 goto Error
+
+echo == Verifying C# Library
+"%PEVERIFY%" librarycs.dll
+ at if ERRORLEVEL 1 goto Error
+
+echo == Compiling F# main referencing C# and F# libraries
+"%FSC%" %fsc_flags% --version:1.2.3 --keyfile:key.snk --optimize -r:library.dll -r:librarycs.dll -o:main.exe main.fs
+ at if ERRORLEVEL 1 goto Error
+
+echo == Verifying F# main
+"%PEVERIFY%" main.exe
+ at if ERRORLEVEL 1 goto Error
+
+echo == Run F# main. Quick test!
+main.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/internalsvisible/key.snk b/tests/fsharp/core/internalsvisible/key.snk
new file mode 100644
index 0000000..c634706
Binary files /dev/null and b/tests/fsharp/core/internalsvisible/key.snk differ
diff --git a/tests/fsharp/core/internalsvisible/library.fs b/tests/fsharp/core/internalsvisible/library.fs
new file mode 100644
index 0000000..1fd4e01
--- /dev/null
+++ b/tests/fsharp/core/internalsvisible/library.fs
@@ -0,0 +1,26 @@
+module Library
+
+open System.Runtime.CompilerServices
+// This one would trigger the warning about an invalid assembly name
+// It also makes peverify fail on main.exe
+// [<assembly:InternalsVisibleTo(",,,,,,,,")>]
+// This one exposes the library internals to the main.exe, note PublicKey obtained via:
+// secutil -hex -s main.exe 
+[<assembly:InternalsVisibleTo("main, PublicKey=0024000004800000940000000602000000240000525341310004000001000100DDA0D353F027AB6ADC878BFBFE4A07FB00FFD2EDD5F255A14C6474B7F4E561796822B6B3CF83D81716C6AFE9BE5D343D7F99EF98252EAD91E7C3C4DF043FDD71FD3130F6611C3C0F7D4F3E698491E9B74D4DE456042A737F4FC5443A98BF989B7377BEE0969C58B85C26B48EF94FFBC95E68E10545FB573243E249204921AFB8")>]
+do()
+
+module M =
+  // Recursive functions be sure they will not be inlined.
+  // If they could be inlined then the compiler could grant them accessibility and inline them,
+  // and the peverify checks for valid accessibility would be bypassed.
+  let rec private  privateF  (x:int) = if x>0 then x*2 else privateF  (x+1)
+  let rec internal internalF (x:int) = if x>0 then x*3 else internalF (x+1)
+  /// mark internal in signature file, but not at definition
+  let rec signatureInternalF (x:int) = if x>0 then x*4 else signatureInternalF (x+1)   
+  let rec public   publicF   (x:int) = if x>0 then x*5 else publicF (x+1)
+
+module internal P = 
+    type internal InternalClass(x:int) =
+        member this.X = x
+
+    let internal InternalObject = InternalClass(999)    
diff --git a/tests/fsharp/core/internalsvisible/library.fsi b/tests/fsharp/core/internalsvisible/library.fsi
new file mode 100644
index 0000000..e7c93f0
--- /dev/null
+++ b/tests/fsharp/core/internalsvisible/library.fsi
@@ -0,0 +1,14 @@
+
+module Library
+
+module M :
+  val internal internalF          : int -> int
+  val internal signatureInternalF : int -> int    
+  val publicF                     : int -> int
+
+module internal P :
+    type internal InternalClass =
+        new : int -> InternalClass
+        member X : int
+
+    val internal InternalObject : InternalClass
diff --git a/tests/fsharp/core/internalsvisible/librarycs.cs b/tests/fsharp/core/internalsvisible/librarycs.cs
new file mode 100644
index 0000000..8b2c3ea
--- /dev/null
+++ b/tests/fsharp/core/internalsvisible/librarycs.cs
@@ -0,0 +1,19 @@
+[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("main, PublicKey=0024000004800000940000000602000000240000525341310004000001000100DDA0D353F027AB6ADC878BFBFE4A07FB00FFD2EDD5F255A14C6474B7F4E561796822B6B3CF83D81716C6AFE9BE5D343D7F99EF98252EAD91E7C3C4DF043FDD71FD3130F6611C3C0F7D4F3E698491E9B74D4DE456042A737F4FC5443A98BF989B7377BEE0969C58B85C26B48EF94FFBC95E68E10545FB573243E249204921AFB8")]
+namespace LibraryCS
+{
+        public class APublicClass
+        {
+                private  static int PrivateProperty    { get { return 2; } }
+                internal static int InternalProperty   { get { return 2; } }
+        }
+        internal class AInternalClass
+        {
+                private  static int PrivateProperty    { get { return 2; } }
+                internal static int InternalProperty   { get { return 2; } }
+        }
+        internal class APrivateClass
+        {
+                private  static int PrivateProperty    { get { return 2; } }
+                internal static int InternalProperty   { get { return 2; } }
+        }       
+}
diff --git a/tests/fsharp/core/internalsvisible/main.fs b/tests/fsharp/core/internalsvisible/main.fs
new file mode 100644
index 0000000..fbe6256
--- /dev/null
+++ b/tests/fsharp/core/internalsvisible/main.fs
@@ -0,0 +1,30 @@
+
+// F# internalsVisibleTo checks
+printf "publicF   2          = %2d\n" (Library.M.publicF 2)
+printf "internalF 2          = %2d\n" (Library.M.internalF 2)
+printf "signatureInternalF 2 = %2d\n" (Library.M.signatureInternalF 2)
+
+// C# PublicClass
+printf   "APublicClass.InternalProperty   = %2d\n" LibraryCS.APublicClass.InternalProperty
+//printf "APublicClass.PrivateProperty    = %2d\n" LibraryCS.APublicClass.PrivateProperty     // private members are not visible via InternalsVisibleTo
+
+// C# InternalClass
+printf   "AInternalClass.InternalProperty = %2d\n" LibraryCS.AInternalClass.InternalProperty
+//printf "AInternalClass.PrivateProperty  = %2d\n" LibraryCS.AInternalClass.PrivateProperty   // private members are not visible via InternalsVisibleTo
+
+// C# PrivateClass (is just an internal class)
+printf   "APrivateClass.InternalProperty  = %2d\n" LibraryCS.APrivateClass.InternalProperty   // for types, private *IS* visible (private is internal)
+//printf "APrivateClass.PrivateProperty   = %2d\n" LibraryCS.APrivateClass.PrivateProperty    // private members are not visible via InternalsVisibleTo
+
+//printf "privateF  2 = %d\n"   (Library.M.privateF  2) // inaccessable
+
+
+(* Check that internalVisibleTo items can be used in internal items *)
+module internal Repro3737 =
+  let internal internalModuleInternalVal_uses_csInternalType (x : LibraryCS.AInternalClass) = 123
+  let internal internalModuleInternalVal_uses_fsInternalType (x : Library.P.InternalClass)  = 123
+  let internal internalModuleInternalVal_uses_fsInternalObject = Library.P.InternalObject
+
+  let internalModuleNormalVal_uses_csInternalType (x : LibraryCS.AInternalClass) = 123
+  let internalModuleNormalVal_uses_fsInternalType (x : Library.P.InternalClass)  = 123
+  let internalModuleNormalVal_uses_fsInternalObject = Library.P.InternalObject
diff --git a/tests/fsharp/core/lazy/build.bat b/tests/fsharp/core/lazy/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/lazy/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/lazy/run.bat b/tests/fsharp/core/lazy/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/lazy/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/lazy/test.fsx b/tests/fsharp/core/lazy/test.fsx
new file mode 100644
index 0000000..9f6e2e2
--- /dev/null
+++ b/tests/fsharp/core/lazy/test.fsx
@@ -0,0 +1,85 @@
+// #Conformance #Regression 
+#if Portable 
+module Core_lazy
+#endif
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(* TEST SUITE FOR STANDARD LIBRARY *)
+
+let x = lazy 3
+
+module Lazy =
+
+    type 'a t = 'a Microsoft.FSharp.Control.Lazy
+
+    let force (x: Microsoft.FSharp.Control.Lazy<'T>) = x.Force()
+    let force_val (x: Microsoft.FSharp.Control.Lazy<'T>) = x.Force()
+    let lazy_from_fun f = Microsoft.FSharp.Control.Lazy.Create(f)
+    let create f = Microsoft.FSharp.Control.Lazy.Create(f)
+    let lazy_from_val v = Microsoft.FSharp.Control.Lazy.CreateFromValue(v)
+    let lazy_is_val (x: Microsoft.FSharp.Control.Lazy<'T>) = x.IsValueCreated
+
+do test "fewoin" (Lazy.force x = 3)
+
+do test "fedeoin" (Lazy.force (Lazy.force (lazy (lazy 3))) = 3)
+
+do test "fedeoin" (let x = 3 in Lazy.force (Lazy.force (lazy (lazy x))) = 3)
+do test "fedeoin" (let x = 3 in Lazy.force (Lazy.force (lazy (lazy (x+x)))) = 6)
+do test "fedeoin" (let x = ref 3 in let y = lazy (x := !x + 1; 6) in ignore (Lazy.force y); ignore (Lazy.force y); !x = 4)
+do test "fedeoin" (let x = ref 3 in let y = lazy (x := !x + 1; "abc") in ignore (Lazy.force y); ignore (Lazy.force y); !x = 4)
+
+#if Portable
+#else
+module Bug5770 =
+    open System.Threading
+    do
+        for i in 1..10 do
+            let act () =
+                let foo = (lazy (new obj()))
+                let threadCount = 100
+                let arr : exn array = Array.create threadCount null
+                let count = ref 1
+                let thread i = new Thread(fun () -> 
+                                            let exn =
+                                                try let v = foo.Value in if v = null then raise (System.NullReferenceException()) else null
+                                                with e -> e
+                                            lock arr (fun () -> arr.[i] <- exn)
+                                            Interlocked.Increment(count) |> ignore)
+                for i = 1 to threadCount do (thread (i-1)).Start()
+                while !count < threadCount do ()
+                Array.forall (fun x -> match x with null -> true | e -> printfn "%A" e; false) arr
+            test (sprintf "fweuy42374: %d" i) (act())
+
+#endif
+        
+// Check these support 'null' since they are .NET types
+let x1 : System.IObservable<int> = null
+let x2 : System.IObserver<int> = null
+let x3 : System.Lazy<int> = null
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/letrec/build.bat b/tests/fsharp/core/letrec/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/letrec/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/letrec/run.bat b/tests/fsharp/core/letrec/run.bat
new file mode 100644
index 0000000..7b0b526
--- /dev/null
+++ b/tests/fsharp/core/letrec/run.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/letrec/test.fsx b/tests/fsharp/core/letrec/test.fsx
new file mode 100644
index 0000000..831996c
--- /dev/null
+++ b/tests/fsharp/core/letrec/test.fsx
@@ -0,0 +1,656 @@
+// #Conformance #LetBindings #Recursion #TypeInference #ObjectConstructors #Classes #Records 
+#if Portable
+module Core_letrec
+#endif
+
+let failures = ref false
+let report_failure s = 
+  stderr.WriteLine ("FAIL: "+s); failures := true
+
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+let test t s1 s2 = 
+  if s1 <> s2 then 
+    (stderr.WriteLine ("test "+t+" failed");
+     failures := true)
+  else
+    stdout.WriteLine ("test "+t+" succeeded")   
+
+
+
+
+(* --------------------------------------------------------------------
+ * Nested letrecs
+ * -------------------------------------------------------------------- *)
+
+let f = 
+  let x = ref 0 in 
+  fun () ->
+    x := !x + 1;
+    let rec g n = if (n = 0) then 1 else h(n-1)
+    and h n = if (n = 0) then 2 else g(n-1) in 
+    g !x
+
+do if f() <> 2 then report_failure "ewiucew"
+do if f() <> 1 then report_failure "ewiew8w"
+
+
+let nestedInnerRec2 = 
+  let x = ref 0 in 
+  fun () ->
+    x := !x + 1;
+    let rec g n = if (n = 0) then !x + 100 else h(n-1)
+    and h n = if (n = 0) then !x + 200 else g(n-1) in 
+    g !x
+
+do if nestedInnerRec2() <> 201 then report_failure "ewiucew"
+do if nestedInnerRec2() <> 102 then report_failure "ewiew8w"
+
+
+
+(* --------------------------------------------------------------------
+ * Recursion through constuctors
+ * -------------------------------------------------------------------- *)
+
+
+type myRecType = { f1: int; f2: myRecType }
+let rec x = { f1=3; f2=x }
+let rec y1 = { f1=3; f2=y2 }
+and y2 = { f1=3; f2=y1 }
+let f2 = 
+  let x = ref 0 in 
+  fun () ->
+    x := !x + 1;
+    let rec y = { f1=3; f2=y } in
+    y
+
+do if (f2()).f1 <> 3 then report_failure "ewi3dw8w"
+do if (f2()).f2.f1 <> 3 then report_failure "dwc8w"
+
+
+(* TYPEERROR: let rec a = 1 :: a *)
+
+type myRecType2 = { g1: int; g2: myRecType2 ref }
+let rec z1 = { g1=3; g2= { contents = z2 } }
+and z2 = { g1=4; g2={ contents = z1 } }
+
+do if z2.g1 <> 4 then report_failure "ewieds32w8w"
+do if z2.g2.contents.g1 <> 3 then report_failure "ceewieds32w8w"
+
+
+(* --------------------------------------------------------------------
+ * Recursion through constuctors
+ * -------------------------------------------------------------------- *)
+
+(* TYPEERROR: let rec a = a *)
+
+let rec a1 = 1 
+and b = a1
+do if a1 <> 1 then report_failure "celkewieds32w8w"
+do if b <> a1 then report_failure "cel3f98u8w"
+
+
+
+let rec a2 = test "grekjre" (b2 + 1 ) 3
+and b2  = 2
+
+(* TYPEERROR: let rec a3 = b3 and b3 = c3 and c3 = a3 *)
+
+
+let nonRecursiveImmediate () = 
+  stdout.WriteLine "Testing nonRecursiveImmediate";
+  let x = ref 1 in 
+  let rec a1 = (x := 3; !x) 
+  and b = a1 in 
+  if a1 <> 3 then report_failure "dqwij";
+  if b <> 3 then report_failure "dqwecqwij"
+
+do nonRecursiveImmediate()
+do nonRecursiveImmediate()
+
+let rec recObj = {new System.Object() with member __.GetHashCode() = (recObj.ToString()).Length}
+
+do Printf.printf "recObj.GetHashCode() = %d\n" (recObj.GetHashCode())
+do Printf.printf "recObj.ToString() = %s\n" (recObj.ToString())
+do if recObj.GetHashCode() <> (recObj.ToString()).Length then report_failure "dqwij"
+
+
+let WouldFailAtRuntimeTest () = 
+  let rec a2 = (fun x -> stdout.WriteLine "a2app"; stderr.Flush();  a2 + 2) (stdout.WriteLine "a2arg"; stderr.Flush(); 1) in 
+  a2
+
+do try WouldFailAtRuntimeTest (); report_failure "fwoi-03" with _ -> stdout.WriteLine "caught ok!"
+
+let WouldFailAtRuntimeTest2 () = 
+  let rec a2 = (fun x -> a3 + 2) 1 
+  and a3 = (fun x -> a2 + 2) 1 in 
+  a2 + a3
+
+#if Portable
+#else
+open System
+open System.Windows.Forms
+
+let rec mnuiSayHello : MenuItem = 
+  new MenuItem("&Say Hello", 
+               new EventHandler(fun sender e -> Printf.printf "Hello! Text = %s\n" mnuiSayHello.Text), 
+               Shortcut.CtrlH)
+
+(* Check that type annotations are proagated outer-to-inner *)
+let testTypeAnnotationForRecursiveBinding () = 
+   let rec x = 1
+   and _a = form.Menu <- new MainMenu();
+   and form : Form = new Form() 
+   and _b = form.Text <- "Hello" in 
+   form
+#endif
+
+(* --------------------------------------------------------------------
+ * Inner recursion where some items go TLR and others do not
+ * -------------------------------------------------------------------- *)
+
+(* TLR letrec, with only some functions going TLR.
+   Required optimisations off to hit bug.
+   Fix: use SELF-CARRYING env values.
+*)
+
+let apply f x = f x
+let dec n = (n:int) (* -1 *)
+  
+let inner () =
+  let rec
+      odd  n = if n=1 then true else not (even (dec n))
+  and even n = if n=0 then true else not (apply odd (dec n))
+  in
+  even 99
+
+
+(* --------------------------------------------------------------------
+ * Polymorphic letrec where not all bindings get qualified by all type 
+ * variables.  Surprisingly hard to get right in a type-preserving
+ * compiler.
+ * -------------------------------------------------------------------- *)
+
+module PartiallyPolymorphicLetRecTest = begin
+
+  let rec f x = g (fun y -> ())
+  and g h = ()
+
+
+  let rec f2 x = g2 (fun y -> ());  g2 (fun z -> ())
+  and g2 h = ()
+ 
+  let rec f3 x = g3 (fun y -> ());  g3 (fun z -> ())
+  and g3 h = h3 (fun z -> ())
+  and h3 h = ()
+end
+
+
+module InitializationGraphAtTopLevel = begin
+
+    let nyi2 (callback) = callback
+    let rec aaa = nyi2 (fun () -> ggg(); )
+    and ggg ()  = (bbb = false)
+    and bbb  = true
+      
+end
+
+
+(*
+module RandomStrangeCodeFromLewis = begin
+
+  // This code is erroneuos since it compares function values.
+  let fix_memo f n =
+    let memo = Hashtbl.create 100 in
+    let rec fix_memo0 f n = f_memo (fix_memo0 f_memo) n and
+        f_memo v =
+            match Hashtbl.tryfind memo v with
+                None ->
+                    let r = f v in
+                    Hashtbl.add memo v r;
+                    r
+                | Some r ->
+            r in
+    fix_memo0 f n
+end
+*)
+
+module GeneralizeObjectExpressions = begin
+
+  type ('a,'b) IPattern = interface 
+    abstract Query : ('b -> 'a option);
+    abstract Make : ('a -> 'b)
+  end
+
+  let ApCons = { new IPattern<'a * 'a list, 'a list> with 
+                           member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None 
+                           member __.Make = fun (x,xs) -> x::xs }
+  let ApNil = { new IPattern<unit, 'a list>  with 
+                           member __.Query = fun xs -> match xs with [] -> Some () | _ -> None 
+                           member __.Make = fun () -> [] }
+
+  let x1 = ApCons : IPattern<int * int list, int list>
+  let x2 = ApCons : IPattern<string * string list, string list> 
+  let y1 = ApNil : IPattern<unit, int list>
+  let y2 = ApNil : IPattern<unit, string list>
+ 
+end
+module GeneralizeObjectExpressions2 = begin
+
+  type  IPattern<'a,'b> = interface 
+    abstract Query : ('b -> 'a option);
+    abstract Make : ('a -> 'b)
+  end
+
+  let rec ApCons = { new IPattern<'a * 'a list, 'a list> with 
+                          member __.Query = fun xs -> match xs with y::ys -> Some (y,ys) | _ -> None 
+                          member __.Make = fun (x,xs) -> x::xs }
+  and ApNil = { new IPattern<unit, 'a list>  with 
+                          member __.Query = fun xs -> match xs with [] -> Some () | _ -> None 
+                          member __.Make = fun () -> [] }
+
+  let x1 = ApCons : IPattern<int * int list, int list>
+  let x2 = ApCons : IPattern<string * string list, string list>
+  let y1 = ApNil : IPattern<unit, int list>
+  let y2 = ApNil : IPattern<unit, string list>
+ 
+end
+
+module RecursiveInterfaceObjectExpressions = begin
+ 
+
+  type Expr = App of IOp * Expr | Const of float
+  and IOp = interface 
+    abstract Name : string;
+    abstract Deriv : Expr -> Expr 
+  end
+
+  let NegOp = { new IOp with member __.Name = "neg" 
+                             member __.Deriv(e) = Const (-1.0) }
+  let Neg x = App(NegOp,x)
+  let rec CosOp = { new IOp with 
+                             member __.Name = "cos" 
+                             member __.Deriv(e) = Neg(Sin(e)) }
+  and     Cos x = App(CosOp,x)
+  and     Sin x = App(SinOp,x)
+  and     SinOp = { new IOp with 
+                             member __.Name = "sin" 
+                             member __.Deriv(e) = Cos(e) }
+ 
+
+  let f nm = 
+    let NegOp = { new IOp with member __.Name = nm 
+                               member __.Deriv(e) = Const (-1.0) } in
+    let Neg x = App(NegOp,x) in
+    let rec CosOp = { new IOp with 
+                               member __.Name = nm 
+                               member __.Deriv(e) = Neg(Sin(e)) } 
+    and     Cos x = App(CosOp,x)
+    and     Sin x = App(SinOp,x)
+    and     SinOp = { new IOp with member __.Name = nm 
+                                   member __.Deriv(e) = Cos(e) } in 
+    CosOp,Cos,Sin,SinOp,Neg,NegOp
+
+  let CosOp2,Cos2,Sin2,SinOp2,Neg2,NegOp2 = f "abc"
+  let One = Const 1.0
+  let x = Cos(One)
+  let Two  = Const 2.0
+  let y = Cos2(Two)
+
+  do if CosOp.Name <> "cos" then report_failure "RecursiveInterfaceObjectExpressions: test 1"
+  do if CosOp2.Name <> "abc" then report_failure "RecursiveInterfaceObjectExpressions: test 2"
+
+  
+end
+
+#if Portable
+#else
+module RecursiveInnerConstrainedGenerics = begin
+
+    open System.Windows.Forms
+
+    let f x = 
+      let g (c : #Control) = 
+         printf "g!, x = %d\n" x;
+         printf "g!, x = %d\n" x;
+         printf "g!, x = %d\n" x;
+         printf "g!, x = %d\n" x;
+         printf "g!, x = %d\n" x;
+         printf "g!, x = %d\n" x;
+         c  in
+      // check it's been generalized and that it compiles without generating
+      // unverifiable code!!!!!!
+      g (new Form()) |> ignore;
+      g (new RichTextBox()) |> ignore
+
+    do f 3
+    do f 4
+
+    let f2 x = 
+      let rec g1 (c : #Control) y = 
+         printf "g1!, x = %d, y = %d\n" x y;
+         (g2 c (y-1) |> ignore)
+      and g2 (c : #Control) y = 
+         printf "g2!, x = %d, y = %d\n" x y;
+         (if (y >= 0) then (g1 (c) (y-1) |> ignore)) in
+      // check it's been generalized and that it compiles without generating
+      // unverifiable code!!!!!!
+      g1 (new Form()) 3 |> ignore;
+      g2 (new RichTextBox()) 3 |> ignore;
+      g1 (new RichTextBox()) 3 |> ignore;
+      g2 (new Form()) 3 |> ignore
+
+    do f2 3
+    do f2 4
+
+end
+#endif
+
+module ClassInitTests = 
+    // one initial do bindings - raises exception
+    type FooFail1() as this =
+        do 
+            printfn "hi"
+            this.Bar()
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    // two initial do bindings - raises exception
+    type FooFail2() as this =
+        do 
+            printfn "hi"
+            this.Bar()
+        do 
+            printfn "hi"
+            this.Bar()
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+    
+    // one initial let _ bindings - raises exception
+    type FooFail3() as this =        
+        let _ = 
+            printfn "hi"
+            this.Bar()
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    // one initial let _ bindings then one initial do binding - raises exception
+    type FooFail4() as this =
+        let _ =
+            printfn "hi"
+        do 
+            printfn "hi"
+            this.Bar()
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    // two initial let _ bindings - raises exception
+    type FooFail5() as this =
+        let _ =
+            printfn "hi"
+            this.Bar()
+        let _ = 
+            printfn "hi"
+            this.Bar()
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    // one initial let _ bindings then one initial do binding - raises exception
+    type FooFail6() as this =
+        let _ =
+            printfn "hi"
+            this.Bar()
+        do 
+            printfn "hi"
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    
+    // no initial do bindings - succeeds
+    type FooSucceeds() as this =
+        let x = 3
+        do 
+            printfn "bye"
+            this.Bar()
+
+        member this.Bar() = printfn "Bar %d" x
+
+    test "cneqec21" (try new FooFail1() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec22" (try new FooFail2() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec23" (try new FooFail3() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec24" (try new FooFail4() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec25" (try new FooFail5() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec26" (try new FooFail6() |> ignore; false with :? System.InvalidOperationException -> true) true
+    test "cneqec27" (try new FooSucceeds() |> ignore; false with :? System.InvalidOperationException -> true) false
+
+
+module BasicPermutations = 
+
+    module Perm1 = 
+        let rec A1 = 1 
+        and A2 = A1
+        
+        test "vsdlknv01" (A1,A2) (1,1)
+    
+    module Perm2 = 
+        let rec A1 = A2
+        and A2 = 1
+        
+        test "vsdlknv02" (A1,A2) (1,1)
+    
+    module Perm3a = 
+        let rec A1 = A2
+        and A2 = 1
+        and A3 = 1
+        
+        test "vsdlknv03" (A1,A2,A3) (1,1,1)
+        
+    module Perm3b = 
+        let rec A1 = A2
+        and A2 = A3
+        and A3 = 1
+        
+        test "vsdlknv04" (A1,A2,A3) (1,1,1)
+        
+    module Perm3c = 
+        let rec A1 = A2
+        and A2 = 1
+        and A3 = A2
+        
+        test "vsdlknv05" (A1,A2,A3) (1,1,1)
+        
+    module Perm3d = 
+        let rec A1 = A3
+        and A2 = 1
+        and A3 = 1
+        
+        test "vsdlknv06" (A1,A2,A3) (1,1,1)
+
+    module Perm3e = 
+        let rec A1 = A3
+        and A2 = A3
+        and A3 = 1
+        
+        test "vsdlknv07" (A1,A2,A3) (1,1,1)
+
+    module Perm3f = 
+        let rec A1 = A3
+        and A2 = 1
+        and A3 = A2
+        
+        test "vsdlknv08" (A1,A2,A3) (1,1,1)
+
+    module Perm3g = 
+        let rec A1 = A3
+        and A2 = A3
+        and A3 = 1
+        
+        test "vsdlknv09" (A1,A2,A3) (1,1,1)
+
+    module Perm3h = 
+        let rec A1 = 1
+        and A2 = A1
+        and A3 = A2
+        
+        test "vsdlknv0q" (A1,A2,A3) (1,1,1)
+
+    module Perm3i = 
+        let rec A1 = 1
+        and A2 = A3
+        and A3 = 1
+        
+        test "vsdlknv0w" (A1,A2,A3) (1,1,1)
+
+    module Perm4i = 
+        let rec A1 = A4
+        and A2 = 1
+        and A3 = A2
+        and A4 = A3
+        
+        test "vsdlknv0e" (A1,A2,A3,A4) (1,1,1,1)
+
+    module PermMisc = 
+        let rec A1 = A4 + 1
+        and A2 = 1
+        and A3 = A2 + 1
+        and A4 = A3 + 1
+        
+        test "vsdlknv0r" (A1,A2,A3,A4) (4,1,2,3)
+        
+    module bug162155 =
+
+        // VS2010: This works as expected (fsc.exe version: 4.0.30319.1)
+
+        // Note:  The types are mutually recursive with "and"
+
+        //        plus we're NOT using the implicit constructor
+
+        type SuperType1() =
+
+          abstract Foo : int -> int
+
+          default x.Foo a = a + 1
+
+         
+
+        and SubType1() =
+
+          inherit SuperType1()
+
+          override x.Foo a = base.Foo(a)
+
+         
+
+        // VS2010-SP1: Works as expected (fsc.exe version 4.0.40219.1)
+
+        // Note:  The types are not mutually recursive with "and"
+
+        type SuperType2() =
+
+          abstract Foo : int -> int
+
+          default x.Foo a = a + 1
+
+         
+
+        type SubType2 =
+
+          inherit SuperType2
+
+          new () = { inherit SuperType2() }
+
+          override x.Foo a = base.Foo(a)
+
+         
+
+        // VS2010-SP1: Works as expected (fsc.exe version 4.0.40219.1)
+
+        // Note:  We're using the implicit constructor
+
+        type SuperType3() =
+
+         abstract Foo : int -> int
+
+          default x.Foo a = a + 1
+
+         
+
+        type SubType3() =
+
+          inherit SuperType3()
+
+          override x.Foo a = base.Foo(a)
+
+
+
+        // VS2010-SP1: This will not work as expected (fsc.exe version 4.0.40219.1)
+        // Note:  The types are mutually recursive with "and"
+        //        plus we're NOT using the implicit constructor
+        //        this causes the base reference to fail to compile
+        type SuperType4() =
+          abstract Foo : int -> int
+          default x.Foo a = a + 1
+         
+        and SubType4 =
+          inherit SuperType4
+          new () = { inherit SuperType4() }
+         
+          // With visual studio SP1 this will not compile
+          // with the following error:
+          // 
+          // Error    1      'base' values may only be used to make direct calls 
+          // to the base implementations of overridden members <file> <line>
+          override x.Foo a = base.Foo(a)
+
+
+#if Portable
+let aa = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+    else (stdout.WriteLine "Test Passed"; exit 0)
+#else
+do 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+#endif
\ No newline at end of file
diff --git a/tests/fsharp/core/libtest/build.bat b/tests/fsharp/core/libtest/build.bat
new file mode 100644
index 0000000..f352dbd
--- /dev/null
+++ b/tests/fsharp/core/libtest/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+ 
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/libtest/run.bat b/tests/fsharp/core/libtest/run.bat
new file mode 100644
index 0000000..604aecc
--- /dev/null
+++ b/tests/fsharp/core/libtest/run.bat
@@ -0,0 +1,13 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx
new file mode 100644
index 0000000..b5185ac
--- /dev/null
+++ b/tests/fsharp/core/libtest/test.fsx
@@ -0,0 +1,5124 @@
+// #Regression #Conformance #Regression #Exceptions #Constants #LetBindings #Lists #Collections #Stress #Sequences #Optimizations #Records #Unions 
+#if Portable
+module Core_libtest
+#endif
+
+(* CONTENTS-INDEX-REGEXP = FROM>^\!\* <TO *)
+(*----------------------------------------------------------------------------
+CONTENTS-START-LINE: HERE=2 SEP=2
+ 92.    Exceptions
+ 725.   check the same for GetHashCode
+ 797.   check we can resolve overlapping constructor names using type names
+ 828.   hashing of large terms that contain back pointers (are infinite)
+ 833.   Equality tests over structured values for data likely to contain
+ 1266.  Equality tests over structured values for data likely to contain
+ 1325.  List library 
+ 1656.  Infinite data structure tests
+ 1689.  Perf tests
+ 1943.  Calling conventions.  These are used in method pointer types.
+ 2297.  foreach/to_seq
+ 2351.  foreachG/to_seq
+ 2401.  Generic formatting
+ 2492.  For loop variables can escape
+ 2499.  Type tests
+ 2511.  streams
+ 2587.  type syntax
+ 3316.  check optimizations 
+ 3402.  BUG 868: repro - mod_float
+ 3414.  misc tests of IEnumerable functions
+ 3454.  systematic tests of IEnumerable functions
+ 3520.  record effect order
+ 3700.  BUG 709: repro
+ 3736.  BUG 701: possible repro
+ 3781.  BUG 737: repro - do not expand sharing in large constants...
+ 3881.  set union - timings w.r.t. "union by fold"
+ 3961.  set/map filter: was bug
+ 4010.  Bug 1028: conversion functions like int32 do not accept strings, suggested by Mort.
+ 4393.  Bug 1029: Support conversion functions named after C# type names? e.g. uint for uint32
+ 4425.  BUG 945: comment lexing does not handle slash-quote inside quoted strings
+ 4436.  BUG 946: comment lexing does not handle double-quote and backslash inside @-strings
+ 4448.  BUG 1080: Seq.cache_all does not have the properties of cache
+ 4511.  BUG 747: Parsing (expr :> type) as top-level expression in fsi requires brackets, grammar issue
+ 4525.  BUG 1049: Adding string : 'a -> string, test cases.
+ 4579.  BUG 1178: Seq.init and Seq.initInfinite implemented using Seq.unfold which evaluates Current on every step
+ 4609.  BUG 1482: Seq.initInfinite overflow and Seq.init negative count to be trapped
+ 4748.  BUG 1477: struct with field offset attributes on fields throws assertions in fsi
+ 4765.  BUG 1561: (-star-star-) opens a comment but does not close it and other XML Doc issues.
+ 4782.  BUG 1750: ilxgen stack incorrect during multi-branch match tests
+ 4799.  BUG 2247: Unverifiable code from struct valued tyfunc
+ 4820.  BUG 1190, 3569: record and list patterns do not permit trailing seperator
+ 4840.  BUG 3808
+ 4853.  BUG 3947
+ 4874.  BUG 4063: ilreflect ctor emit regression - Type/TypeBuilder change
+ 4899.  BUG 4139: %A formatter does not accept width, e.g. printf "%10000A"
+ 4910.  BUG 1043: Can (-star-) again be lexed specially and recognised as bracket-star-bracket?
+ 4924.  Tail-cons optimized operators temporarily put 'null' in lists
+ 5030.  Bug 4884: another TaggedCollections issue - same type fails cast
+ 5048.  wrap up
+CONTENTS-END-LINE:
+----------------------------------------------------------------------------*)
+
+#nowarn "62"
+#nowarn "44"
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+(* TEST SUITE FOR STANDARD LIBRARY *)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s^": YES") 
+  else (stdout.WriteLine ("\n***** "^s^": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+
+  
+let format_uint64 outc formatc width left_justify add_zeros num_prefix_if_pos (n:uint64) = 
+  let _ = match formatc with 'd' | 'i' | 'u' -> 10UL | 'o' -> 8UL | 'x' | 'X' -> 16UL in
+  failwith "hello"
+
+
+(*---------------------------------------------------------------------------
+!* Exceptions
+ *--------------------------------------------------------------------------- *)
+
+let myFunc x y = 
+  if x > y then stdout.WriteLine "greater";
+  if x < y then stdout.WriteLine "less";
+  try 
+    if x = y then stdout.WriteLine "equal";
+    failwith "fail";
+    reportFailure "ABCDE"
+  with Failure s -> 
+    stdout.WriteLine "caught!";
+
+let _ = myFunc 1 4
+let _ = myFunc "a" "b"
+let _ = myFunc "c" "b"
+let _ = myFunc "c" "c"
+let _ =
+   myFunc 
+     begin 
+      try 
+        failwith "string1";
+      with Failure s -> 
+        s;
+     end
+     begin 
+      try 
+        failwith "string2";
+      with Failure s -> 
+        s;
+     end
+
+let _ =
+   myFunc 
+     begin 
+      try
+       begin 
+        try 
+         failwith "yes";
+        with e -> 
+         reraise (); failwith "no"
+       end
+      with Failure "yes" -> "yes"
+     end
+     begin 
+      try
+       begin 
+        try 
+         failwith "yes";
+        with e -> 
+         reraise (); failwith "no"
+       end
+      with Failure "yes" -> "yes"
+     end
+
+
+//---------------------------------------------------------------------------
+// Basic operations 
+//--------------------------------------------------------------------------- 
+
+#if INVARIANT_CULTURE_STRING_COMPARISON
+// These check we are using InvariantCulture string comparison, not Ordinal comparison
+let _ = check "vknwwer41" (";" >  "0") false
+let _ = check "vknwwer42" (";" >= "0") false
+let _ = check "vknwwer43" (";" =  "0") false
+let _ = check "vknwwer44" (";" <> "0") true
+let _ = check "vknwwer53" (";" <= "0") true
+let _ = check "vknwwer54" (";" <  "0") true
+let _ = check "vknwwer55" (compare ";" "0") -1
+let _ = check "vknwwer55" (compare "0" ";") 1
+
+(*
+// check consistency with characters
+let _ = check "vknwwer41" (';' >  '0') false
+let _ = check "vknwwer42" (';' >= '0') false
+let _ = check "vknwwer43" (';' =  '0') false
+let _ = check "vknwwer44" (';' <> '0') true
+let _ = check "vknwwer53" (';' <= '0') true
+let _ = check "vknwwer54" (';' <  '0') true
+let _ = check "vknwwer55" (compare ';' '0') -1
+let _ = check "vknwwer55" (compare '0' ';') 1
+*)
+
+// check consistency with lists of strings
+let _ = check "vknwwer41" ([";"] >  ["0"]) false
+let _ = check "vknwwer42" ([";"] >= ["0"]) false
+let _ = check "vknwwer43" ([";"] =  ["0"]) false
+let _ = check "vknwwer44" ([";"] <> ["0"]) true
+let _ = check "vknwwer53" ([";"] <= ["0"]) true
+let _ = check "vknwwer54" ([";"] <  ["0"]) true
+let _ = check "vknwwer55" (compare [";"] ["0"]) -1
+let _ = check "vknwwer55" (compare ["0"] [";"]) 1
+
+(*
+// check consistency with lists of chars
+let _ = check "vknwwer41" ([';'] >  ['0']) false
+let _ = check "vknwwer42" ([';'] >= ['0']) false
+let _ = check "vknwwer43" ([';'] =  ['0']) false
+let _ = check "vknwwer44" ([';'] <> ['0']) true
+let _ = check "vknwwer53" ([';'] <= ['0']) true
+let _ = check "vknwwer54" ([';'] <  ['0']) true
+let _ = check "vknwwer55" (compare [';'] ['0']) -1
+let _ = check "vknwwer55" (compare ['0'] [';']) 1
+*)
+#endif
+
+let getObjectHashCode (x:'a) = (box x).GetHashCode()
+let (===) (x:'a) (y:'a) = (box x).Equals(box y)
+
+let _ = stdout.WriteLine "90erw9"
+let _ = if true && true then stdout.WriteLine "YES" else  reportFailure "intial test"
+let _ = if true && false then reportFailure "basic test 1" else  stdout.WriteLine "YES"
+let _ = if false && true then reportFailure "basic test 2" else  stdout.WriteLine "YES"
+let _ = if false && false then reportFailure "basic test 3" else  stdout.WriteLine "YES"
+let _ = if true || true then stdout.WriteLine "YES" else  reportFailure "basic test Q1"
+let _ = if true || false then stdout.WriteLine "YES" else  reportFailure "basic test Q2"
+let _ = if false || true then stdout.WriteLine "YES" else  reportFailure "basic test Q3"
+let _ = if false || false then reportFailure "basic test 4" else  stdout.WriteLine "YES"
+
+let _ = stdout.WriteLine "vwlkew0"
+let _ = if true && true then stdout.WriteLine "YES" else  reportFailure "basic test Q4"
+let _ = if true && false then reportFailure "basic test 5" else  stdout.WriteLine "YES"
+let _ = if false && true then reportFailure "basic test 6" else  stdout.WriteLine "YES"
+let _ = if false && false then reportFailure "basic test 7" else  stdout.WriteLine "YES"
+let _ = if true || true then stdout.WriteLine "YES" else  reportFailure "basic test Q5"
+let _ = if true || false then stdout.WriteLine "YES" else  reportFailure "basic test Q6"
+let _ = if false || true then stdout.WriteLine "YES" else  reportFailure "basic test Q7"
+let _ = if false || false then reportFailure "basic test 8" else  stdout.WriteLine "YES"
+
+let _ = stdout.WriteLine "vr90vr90"
+let truE () = (stdout.WriteLine "."; true)
+let falsE () = (stdout.WriteLine "."; false)
+let _ = if truE() && truE() then stdout.WriteLine "YES" else  reportFailure "basic test Q8"
+let _ = if truE() && falsE() then reportFailure "basic test 9" else  stdout.WriteLine "YES"
+let _ = if falsE() && truE() then reportFailure "basic test 10" else  stdout.WriteLine "YES"
+let _ = if falsE() && falsE() then reportFailure "basic test 11" else  stdout.WriteLine "YES"
+let _ = if truE() || truE() then stdout.WriteLine "YES" else  reportFailure "basic test Q9"
+let _ = if truE() || falsE() then stdout.WriteLine "YES" else  reportFailure "basic test Q10"
+let _ = if falsE() || truE() then stdout.WriteLine "YES" else  reportFailure "basic test Q11"
+let _ = if falsE() || falsE() then reportFailure "basic test 12" else  stdout.WriteLine "YES"
+
+let _ = stdout.WriteLine "tgbri123d: "
+let truERR () = (reportFailure "basic test 13" ; true)
+let falsERR () = (reportFailure "basic test 14" ; false)
+let _ = if false && truERR() then reportFailure "basic test 15" else  stdout.WriteLine "YES"
+let _ = if false && falsERR() then reportFailure "basic test 16" else  stdout.WriteLine "YES"
+let _ = if true || truERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q12"
+let _ = if true || falsERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q13"
+
+let _ = stdout.WriteLine "d298c123d: "
+let _ = if falsE() && truERR() then reportFailure "basic test 17" else  stdout.WriteLine "YES"
+let _ = if falsE() && falsERR() then reportFailure "basic test 18" else  stdout.WriteLine "YES"
+let _ = if truE() || truERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q14"
+let _ = if truE() || falsERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q15"
+
+let _ = stdout.WriteLine "ddwqd123d: "
+let _ = if falsE() && truERR() then reportFailure "basic test 19" else  stdout.WriteLine "YES"
+let _ = if falsE() && falsERR() then reportFailure "basic test 20" else  stdout.WriteLine "YES"
+let _ = if truE() || truERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q16"
+let _ = if truE() || falsERR() then stdout.WriteLine "YES" else  reportFailure "basic test Q17"
+
+
+let _ = stdout.WriteLine "d3wq123d: "
+let _ = if 1 = 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q18"
+let _ = if 1 === 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q19"
+let _ = if 1 < 2 then stdout.WriteLine "YES" else  reportFailure "basic test Q20"
+let _ = if 2 > 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q21"
+let _ = if 2 >= 2 then stdout.WriteLine "YES" else  reportFailure "basic test Q22"
+let _ = if 1 <= 2  then stdout.WriteLine "YES" else  reportFailure "basic test Q23"
+let _ = if 2 <= 2 then stdout.WriteLine "YES" else  reportFailure "basic test Q24"
+let _ = if 'c' < 'd' then stdout.WriteLine "YES" else  reportFailure "basic test Q25"
+let _ = if 'c' <= 'c' then stdout.WriteLine "YES" else  reportFailure "basic test Q26"
+let _ = if 'c' < 'c' then reportFailure "basic test 21" else  stdout.WriteLine "YES"
+
+let printString (s:string) = System.Console.Write s
+let printInt (i:int) = System.Console.Write (string i)
+let printNewLine () = System.Console.WriteLine ()
+
+type fpclass = 
+  | CaseA
+  | CaseB
+  | CaseC
+  | CaseD
+
+let _ = printString "d3123d: "; if CaseA = CaseA then stdout.WriteLine "YES" else  reportFailure "basic test Q27"
+(*let _ = if FP_subnormal = FP_subnormal then stdout.WriteLine "YES" else  reportFailure "basic test Q28" *)
+let _ = if CaseB = CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q29"
+let _ = if CaseB === CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q30"
+let _ = if CaseC = CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q31"
+let _ = if CaseD = CaseD  then stdout.WriteLine "YES" else  reportFailure "basic test Q32"
+let _ = if CaseD === CaseD  then stdout.WriteLine "YES" else  reportFailure "basic test Q33"
+let _ = if CaseA <= CaseA then stdout.WriteLine "YES" else  reportFailure "basic test Q34"
+(* let _ = if FP_subnormal <= FP_subnormal then stdout.WriteLine "YES" else  reportFailure "basic test Q35"*)
+let _ = if CaseB <= CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q36"
+let _ = if CaseC <= CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q37"
+let _ = if CaseD <= CaseD  then stdout.WriteLine "YES" else  reportFailure "basic test Q38"
+let _ = if CaseA >= CaseA then stdout.WriteLine "YES" else  reportFailure "basic test Q39"
+(* let _ = if FP_subnormal >= FP_subnormal then stdout.WriteLine "YES" else  reportFailure "basic test Q40" *)
+let _ = if CaseB >= CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q41"
+let _ = if CaseC >= CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q42"
+let _ = if CaseD >= CaseD  then stdout.WriteLine "YES" else  reportFailure "basic test Q43"
+
+let _ = printString "d1t43: "; if CaseA < CaseA then reportFailure "basic test 22" else  stdout.WriteLine "YES"
+(* let _ = if CaseA < FP_subnormal then stdout.WriteLine "YES" else  reportFailure "basic test Q44"*)
+let _ = if CaseA < CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q45"
+let _ = if CaseA < CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q46"
+let _ = if CaseA < CaseD then stdout.WriteLine "YES" else  reportFailure "basic test Q47"
+
+(* let _ =  printString "er321: "; if FP_subnormal < CaseA then reportFailure "basic test Q48" else  stdout.WriteLine "YES" 
+let _ = if FP_subnormal < FP_subnormal then reportFailure "basic test Q49" else  stdout.WriteLine "YES"
+let _ = if FP_subnormal < CaseB then stdout.WriteLine "YES" else  reportFailure "basic test Q50"
+let _ = if FP_subnormal < CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q51"
+let _ = if FP_subnormal < CaseD then stdout.WriteLine "YES" else  reportFailure "basic test Q52" *)
+
+let _ =  printString "ff23f2: ";if CaseB < CaseA then reportFailure "basic test 23" else  stdout.WriteLine "YES"
+(* let _ = if CaseB < FP_subnormal then reportFailure "basic test Q53" else  stdout.WriteLine "YES" *)
+let _ = if CaseB < CaseB then reportFailure "basic test 24" else  stdout.WriteLine "YES"
+let _ = if CaseB < CaseC then stdout.WriteLine "YES" else  reportFailure "basic test Q54"
+let _ = if CaseB < CaseD then stdout.WriteLine "YES" else  reportFailure "basic test Q55"
+
+let _ =  printString "f2234g54: ";if CaseC < CaseA then reportFailure "basic test 25" else  stdout.WriteLine "YES"
+(* let _ = if CaseC < FP_subnormal then reportFailure "basic test Q56" else  stdout.WriteLine "YES" *)
+let _ = if CaseC < CaseB then reportFailure "basic test 26" else  stdout.WriteLine "YES"
+let _ = if CaseC < CaseC then reportFailure "basic test 27" else  stdout.WriteLine "YES"
+let _ = if CaseC < CaseD then stdout.WriteLine "YES" else  reportFailure "basic test Q57"
+
+let _ = printString "dw432b4: "; if CaseD < CaseA then reportFailure "basic test 28" else  stdout.WriteLine "YES"
+(* let _ = if CaseD < FP_subnormal then reportFailure "basic test Q58" else  stdout.WriteLine "YES" *)
+let _ = if CaseD < CaseB then reportFailure "basic test 29" else  stdout.WriteLine "YES"
+let _ = if CaseD < CaseC then reportFailure "basic test 30" else  stdout.WriteLine "YES"
+let _ = if CaseD < CaseD then reportFailure "basic test 31" else  stdout.WriteLine "YES"
+
+let _ = printString "fdew093 "; if 1 < 2 then stdout.WriteLine "YES" else  reportFailure "basic test Q59"
+let _ = if 1 < 1 then reportFailure "basic test 32" else  stdout.WriteLine "YES"
+let _ = if 1 < 0 then reportFailure "basic test 33" else  stdout.WriteLine "YES"
+let _ = if -1 < 0 then stdout.WriteLine "YES" else  reportFailure "basic test Q60"
+let _ = if -1 < 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q61"
+
+let _ = stdout.WriteLine "dwqfwe3t:"
+let _ = printInt (compare "abc" "def"); printNewLine()
+let _ = printInt (compare "def" "abc"); printNewLine()
+let _ = printInt (compare "abc" "abc"); printNewLine()
+let _ = printInt (compare "aaa" "abc"); printNewLine()
+let _ = printInt (compare "abc" "aaa"); printNewLine()
+let _ = printInt (compare "longlonglong" "short"); printNewLine() 
+let _ = printInt (compare "short" "longlonglong"); printNewLine() 
+let _ = printInt (compare "" "a"); printNewLine() 
+let _ = printInt (compare "a" ""); printNewLine() 
+
+let _ = printString "grfwe3t "
+let _ = if "abc" < "def" then stdout.WriteLine "YES" else  reportFailure "basic test Q62"
+let _ = if "def" < "abc" then reportFailure "basic test 34" else  stdout.WriteLine "YES"
+let _ = if "abc" < "abc" then reportFailure "basic test 35" else  stdout.WriteLine "YES"
+let _ = if "aaa" < "abc" then stdout.WriteLine "YES" else  reportFailure "basic test Q63"
+let _ = if "abc" < "aaa" then reportFailure "basic test 36" else  stdout.WriteLine "YES"
+let _ = if "longlonglong" < "short" then stdout.WriteLine "YES" else  reportFailure "basic test Q64"
+let _ = if "short" < "longlonglong" then reportFailure "basic test 37" else  stdout.WriteLine "YES"
+let _ = if "" < "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q65"
+let _ = if "a" < "" then reportFailure "basic test 38" else  stdout.WriteLine "YES"
+
+let _ = printString "df32v4 "
+let _ = if "abc" = "def" then reportFailure "basic test 39" else  stdout.WriteLine "YES"
+let _ = if "abc" === "def" then reportFailure "basic test 40" else  stdout.WriteLine "YES"
+let _ = if "def" = "abc" then reportFailure "basic test 41" else  stdout.WriteLine "YES"
+let _ = if "def" === "abc" then reportFailure "basic test 42" else  stdout.WriteLine "YES"
+let _ = if "abc" = "abc" then stdout.WriteLine "YES" else  reportFailure "basic test Q66"
+let _ = if "abc" === "abc" then stdout.WriteLine "YES" else  reportFailure "basic test Q67"
+let _ = if "aaa" = "abc" then reportFailure "basic test 43" else  stdout.WriteLine "YES"
+let _ = if "aaa" === "abc" then reportFailure "basic test 44" else  stdout.WriteLine "YES"
+let _ = if "abc" = "aaa" then reportFailure "basic test 45" else  stdout.WriteLine "YES"
+let _ = if "abc" === "aaa" then reportFailure "basic test 46" else  stdout.WriteLine "YES"
+let _ = if "longlonglong" = "short" then reportFailure "basic test 47" else  stdout.WriteLine "YES"
+let _ = if "longlonglong" === "short" then reportFailure "basic test 48" else  stdout.WriteLine "YES"
+let _ = if "short" = "longlonglong" then reportFailure "basic test 49" else  stdout.WriteLine "YES"
+let _ = if "short" === "longlonglong" then reportFailure "basic test 50" else  stdout.WriteLine "YES"
+let _ = if "" = "" then stdout.WriteLine "YES" else  reportFailure "basic test Q68"
+let _ = if "" === "" then stdout.WriteLine "YES" else  reportFailure "basic test Q69"
+let _ = if "" = "a" then reportFailure "basic test 51" else  stdout.WriteLine "YES"
+let _ = if "" === "a" then reportFailure "basic test 52" else  stdout.WriteLine "YES"
+let _ = if "a" = "" then reportFailure "basic test 53" else  stdout.WriteLine "YES"
+let _ = if "a" === "" then reportFailure "basic test 54" else  stdout.WriteLine "YES"
+
+
+
+
+type abcde = A of int | B of abcde | C of string | D  | E
+let _ = printString "32432465: "; if A 1 = A 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q70"
+let _ = if B E = B E then stdout.WriteLine "YES" else  reportFailure "basic test Q71"
+let _ = if B E === B E then stdout.WriteLine "YES" else  reportFailure "basic test Q72"
+let _ = if C "3" = C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q73"
+let _ = if C "3" === C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q74"
+let _ = if D = D then stdout.WriteLine "YES" else  reportFailure "basic test Q75"
+let _ = if D === D then stdout.WriteLine "YES" else  reportFailure "basic test Q76"
+let _ = if E = E  then stdout.WriteLine "YES" else  reportFailure "basic test Q77"
+let _ = if E === E  then stdout.WriteLine "YES" else  reportFailure "basic test Q78"
+let _ =  printString "320-vrklm: "; if A 1 <= A 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q79"
+let _ = if B E <= B E then stdout.WriteLine "YES" else  reportFailure "basic test Q80"
+let _ = if C "3" <= C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q81"
+let _ = if D <= D then stdout.WriteLine "YES" else  reportFailure "basic test Q82"
+let _ = if E <= E  then stdout.WriteLine "YES" else  reportFailure "basic test Q83"
+let _ =  printString "9032c32nij: "; if A 1 >= A 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q84"
+let _ = if B E >= B E then stdout.WriteLine "YES" else  reportFailure "basic test Q85"
+let _ = if C "3" >= C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q86"
+let _ = if D >= D then stdout.WriteLine "YES" else  reportFailure "basic test Q87"
+let _ = if E >= E  then stdout.WriteLine "YES" else  reportFailure "basic test Q88"
+
+
+let _ =  printString "98vriu32: ";if A 1 < A 1 then reportFailure "basic test Q89" else  stdout.WriteLine "YES"
+let _ = if A 1 < B E then stdout.WriteLine "YES" else  reportFailure "basic test Q90"
+let _ = if A 1 < C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q91"
+let _ = if A 1 < D then stdout.WriteLine "YES" else  reportFailure "basic test Q92"
+let _ = if A 1 < E then stdout.WriteLine "YES" else  reportFailure "basic test Q93"
+
+let _ = if B E < A 1 then reportFailure "basic test 55" else  stdout.WriteLine "YES"
+let _ = if B E < B E then reportFailure "basic test 56" else  stdout.WriteLine "YES"
+let _ = if B E < C "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q94"
+let _ = if B E < D then stdout.WriteLine "YES" else  reportFailure "basic test Q95"
+let _ = if B E < E then stdout.WriteLine "YES" else  reportFailure "basic test Q96"
+
+let _ = if C "3" < A 1 then reportFailure "basic test 57" else  stdout.WriteLine "YES"
+let _ = if C "3" < B E then reportFailure "basic test 58" else  stdout.WriteLine "YES"
+let _ = if C "3" < C "3" then reportFailure "basic test 59" else  stdout.WriteLine "YES"
+let _ = if C "3" < D then stdout.WriteLine "YES" else  reportFailure "basic test Q97"
+let _ = if C "3" < E then stdout.WriteLine "YES" else  reportFailure "basic test Q99"
+
+let _ = if D < A 1 then reportFailure "basic test 60" else  stdout.WriteLine "YES"
+let _ = if D < B E then reportFailure "basic test 61" else  stdout.WriteLine "YES"
+let _ = if D < C "3" then reportFailure "basic test 62" else  stdout.WriteLine "YES"
+let _ = if D < D then reportFailure "basic test 63" else  stdout.WriteLine "YES"
+let _ = if D < E then stdout.WriteLine "YES" else  reportFailure "basic test Q100"
+
+let _ = if E < A 1 then reportFailure "basic test 64" else  stdout.WriteLine "YES"
+let _ = if E < B E then reportFailure "basic test 65" else  stdout.WriteLine "YES"
+let _ = if E < C "3" then reportFailure "basic test 66" else  stdout.WriteLine "YES"
+let _ = if E < D then reportFailure "basic test 67" else  stdout.WriteLine "YES"
+let _ = if E < E then reportFailure "basic test 68" else  stdout.WriteLine "YES"
+
+
+(* We put this test in as well as ILX uses a different rep. past 4 non-nullary constructors *)
+type abcde2 = Z2 | A2 of int | B2 of abcde2 | C2 of string | D2 of string 
+let _ = printString "32432ew465: "; if A2 1 = A2 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q101"
+let _ = printString "32432ew465: "; if A2 1 === A2 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q102"
+let _ = if B2 Z2 = B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q103"
+let _ = if B2 Z2 === B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q104"
+let _ = if C2 "3" = C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q105"
+let _ = if C2 "3" === C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q106"
+let _ = if D2 "a" = D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q107"
+let _ = if D2 "a" === D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q108"
+let _ = if Z2 = Z2  then stdout.WriteLine "YES" else  reportFailure "basic test Q109"
+let _ = if Z2 === Z2  then stdout.WriteLine "YES" else  reportFailure "basic test Q110"
+let _ =  printString "3vwa20-vrklm: "; if A2 1 <= A2 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q111"
+let _ = if B2 Z2 <= B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q112"
+let _ = if C2 "3" <= C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q113"
+let _ = if D2 "a" <= D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q114"
+let _ = if Z2 <= Z2  then stdout.WriteLine "YES" else  reportFailure "basic test Q115"
+let _ =  printString "9vaw032c32nij: "; if A2 1 >= A2 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q116"
+let _ = if B2 Z2 >= B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q117"
+let _ = if C2 "3" >= C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q118"
+let _ = if D2 "a" >= D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q119"
+let _ = if Z2 >= Z2  then stdout.WriteLine "YES" else  reportFailure "basic test Q120"
+
+let _ =  printString "vae98vriu32: "
+
+let _ = if Z2 < A2 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q121"
+let _ = if Z2 < B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q122"
+let _ = if Z2 < C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q123"
+let _ = if Z2 < D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q124"
+let _ = if Z2 < Z2 then reportFailure "basic test 69" else  stdout.WriteLine "YES"
+
+let _ =  printString "vae98312332: "
+
+let _ = if None < None then reportFailure "basic test 70" else  stdout.WriteLine "YES"
+let _ = if None > None then reportFailure "basic test 71" else  stdout.WriteLine "YES"
+let _ = if [] < [] then reportFailure "basic test 72" else  stdout.WriteLine "YES"
+let _ = if [] > [] then reportFailure "basic test 73" else  stdout.WriteLine "YES"
+let _ = if None <= None then stdout.WriteLine "YES" else  reportFailure "basic test Q125"
+let _ = if None >= None then stdout.WriteLine "YES" else  reportFailure "basic test Q126"
+let _ = if [] <= [] then stdout.WriteLine "YES" else  reportFailure "basic test Q127"
+let _ = if [] >= [] then stdout.WriteLine "YES" else  reportFailure "basic test Q128"
+
+let _ =  printString "rege98312332: "
+
+let _ = if A2 1 < Z2 then reportFailure "basic test 74" else  stdout.WriteLine "YES"
+let _ = if A2 1 < A2 1 then reportFailure "basic test 75" else  stdout.WriteLine "YES"
+let _ = if A2 1 < B2 Z2 then stdout.WriteLine "YES" else  reportFailure "basic test Q129"
+let _ = if A2 1 < C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q130"
+let _ = if A2 1 < D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q131"
+
+let _ =  printString "328we32: "
+
+let _ = if B2 Z2 < Z2 then reportFailure "basic test 76" else  stdout.WriteLine "YES"
+let _ = if B2 Z2 < A2 1 then reportFailure "basic test 77" else  stdout.WriteLine "YES"
+let _ = if B2 Z2 < B2 Z2 then reportFailure "basic test 78" else  stdout.WriteLine "YES"
+let _ = if B2 Z2 < C2 "3" then stdout.WriteLine "YES" else  reportFailure "basic test Q132"
+let _ = if B2 Z2 < D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q133"
+
+let _ =  printString "ewknjs232: "
+
+let _ = if C2 "3" < Z2 then reportFailure "basic test 79" else  stdout.WriteLine "YES"
+let _ = if C2 "3" < A2 1 then reportFailure "basic test 80" else  stdout.WriteLine "YES"
+let _ = if C2 "3" < B2 Z2 then reportFailure "basic test 81" else  stdout.WriteLine "YES"
+let _ = if C2 "3" < C2 "3" then reportFailure "basic test 82" else  stdout.WriteLine "YES"
+let _ = if C2 "3" < D2 "a" then stdout.WriteLine "YES" else  reportFailure "basic test Q134"
+
+let _ =  printString "v30js232: "
+
+let _ = if D2 "a" < Z2 then reportFailure "basic test 83" else  stdout.WriteLine "YES"
+let _ = if D2 "a" < A2 1 then reportFailure "basic test 84" else  stdout.WriteLine "YES"
+let _ = if D2 "a" < B2 Z2 then reportFailure "basic test 85" else  stdout.WriteLine "YES"
+let _ = if D2 "a" < C2 "3" then reportFailure "basic test 86" else  stdout.WriteLine "YES"
+let _ = if D2 "a" < D2 "a" then reportFailure "basic test 87" else  stdout.WriteLine "YES"
+
+let _ =  printString "erv9232: "
+
+exception E1 of int
+exception E2 of int
+exception E3 of int * exn
+let _ = printString "exception equality 1"; if (E1(1) = E1(1)) then stdout.WriteLine "YES" else  reportFailure "basic test Q135"
+let _ = printString "exception equality 2"; if (E1(1) <> E2(1)) then stdout.WriteLine "YES" else  reportFailure "basic test Q136"
+
+let _ = printString "exception equality 3"; if (E3(1,E1(2)) = E3(1,E1(2))) then stdout.WriteLine "YES" else  reportFailure "basic test Q137"
+let _ = printString "exception equality 4"; if (E3(1,E1(2)) <> E3(1,E2(2))) then stdout.WriteLine "YES" else  reportFailure "basic test Q138"
+
+
+let _ = printString "match []? "; if (match [] with [] -> true | _ -> false) then stdout.WriteLine "YES" else  reportFailure "basic test Q139"
+let _ = printString "[] = []? "; if ([] = []) then stdout.WriteLine "YES" else  reportFailure "basic test Q140"
+
+let _ = printString "2033elk "
+let _ = if 1 = 0 then reportFailure "basic test 88" else  stdout.WriteLine "YES"
+let _ = if 0 = 1 then reportFailure "basic test 89" else  stdout.WriteLine "YES"
+let _ = if -1 = -1 then stdout.WriteLine "YES" else  reportFailure "basic test Q141"
+
+let _ = printString "209fedq3lk "
+let _ = if 1 = 0 then reportFailure "basic test 90" else  stdout.WriteLine "YES"
+let _ = if 1 === 0 then reportFailure "basic test 91" else  stdout.WriteLine "YES"
+let _ = if 0 = 1 then reportFailure "basic test 92" else  stdout.WriteLine "YES"
+let _ = if 0 === 1 then reportFailure "basic test 93" else  stdout.WriteLine "YES"
+let _ = if -1 = -1 then stdout.WriteLine "YES" else  reportFailure "basic test Q142"
+let _ = if -1 === -1 then stdout.WriteLine "YES" else  reportFailure "basic test Q143"
+let _ = if 1 = 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q144"
+let _ = if 1 === 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q145"
+let _ = if (LanguagePrimitives.PhysicalEquality CaseB  CaseC) then reportFailure "basic test 94" else  stdout.WriteLine "YES"
+let _ = if (CaseB === CaseC) then reportFailure "basic test 95" else  stdout.WriteLine "YES"
+
+let _ = if (LanguagePrimitives.PhysicalEquality (ref 1) (ref 1)) then reportFailure "basic test 96" else  stdout.WriteLine "YES"
+
+
+type abc = A | B | C
+
+
+do test "cwewvewho5" (match box(None: int option) with :? option<int> as v -> (v = None) | _ -> false)
+
+
+do test "cwewe0981" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<int>(box(1)) = 1 )
+do test "cwewe0982" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<string>(box(1))); false with :? System.InvalidCastException -> true))
+do test "cwewe0983" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<int>(null)); false with :? System.NullReferenceException -> true))
+do test "cwewe0984" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<string>(box("a")) = "a")
+do test "cwewe0985" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<string>(null) = null)
+do test "cwewe0986" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<int option>(box(None: int option)) = None)
+do test "cwewe0987" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<string option>(box(None: int option))     = None)
+do test "cwewe0988" (LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<int list>(box([]: int list))    = [])
+do test "cwewe0989" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<int list>(null)); false with :? System.NullReferenceException -> true))
+do test "cwewe0980" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxGeneric<string list>(null)); false with :? System.NullReferenceException -> true))
+
+do test "cwewe0981" (unbox<int>(box(1)) = 1 )
+do test "cwewe0982" ((try ignore(unbox<string>(box(1))); false with :? System.InvalidCastException -> true))
+do test "cwewe0983" ((try ignore(unbox<int>(null)); false with :? System.NullReferenceException -> true))
+do test "cwewe0984" (unbox<string>(box("a")) = "a")
+do test "cwewe0985" (unbox<string>(null) = null)
+do test "cwewe0986" (unbox<int option>(box(None: int option)) = None)
+do test "cwewe0987" (unbox<string option>(box(None: int option))     = None)
+do test "cwewe0988" (unbox<int list>(box([]: int list))    = [])
+do test "cwewe0989" ((try ignore(unbox<int list>(null)); false with :? System.NullReferenceException -> true))
+do test "cwewe0980" ((try ignore(unbox<string list>(null)); false with :? System.NullReferenceException -> true))
+
+do test "cwewe098q" (LanguagePrimitives.IntrinsicFunctions.UnboxFast<int>(box(1)) = 1)
+do test "cwewe098w" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxFast<string>(box(1))); false with :? System.InvalidCastException -> true))
+do test "cwewe098e" ((try ignore(LanguagePrimitives.IntrinsicFunctions.UnboxFast<int>(null)); false with :? System.NullReferenceException -> true))
+do test "cwewe098r" (LanguagePrimitives.IntrinsicFunctions.UnboxFast<string>(box("a")) = "a")
+do test "cwewe098t" (LanguagePrimitives.IntrinsicFunctions.UnboxFast<string>(null) = null)
+do test "cwewe098y" (LanguagePrimitives.IntrinsicFunctions.UnboxFast<int option>(box(None: int option)) = None)
+do test "cwewe098u" (LanguagePrimitives.IntrinsicFunctions.UnboxFast<string option>(box(None: int option))     = None)
+//These don't qualify for the quick entry
+// unbox_quick<int list>(box([]: int list))    = []
+// (try ignore(unbox_quick<int list>(null)); false with :? System.NullReferenceException -> true)
+// (try ignore(unbox_quick<string list>(null)); false with :? System.NullReferenceException -> true)
+
+
+do test "cwewe098a" (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<int>(box(1)) )
+do test "cwewe098s" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<int>(null)))
+do test "cwewe098d" (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<string>(box("a")) )
+do test "cwewe098f" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<string>(null)))
+do test "cwewe098g" (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<int option>(box(None: int option)) )
+do test "cwewe098h" (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<string option>(box(None: int option))     )
+do test "cwewe098j" (LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<int list>(box([]: int list)) )
+do test "cwewe098k" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<int list>(null)))
+do test "cwewe098l" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestGeneric<string list>(null)))
+
+do test "cwewe098z" (LanguagePrimitives.IntrinsicFunctions.TypeTestFast<int>(box(1)) )
+do test "cwewe098x" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestFast<int>(null)))
+do test "cwewe098c" (LanguagePrimitives.IntrinsicFunctions.TypeTestFast<string>(box("a")) )
+do test "cwewe098v" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestFast<string>(null)))
+do test "cwewe098b" (LanguagePrimitives.IntrinsicFunctions.TypeTestFast<int list>(box([]: int list)) )
+do test "cwewe098n" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestFast<int list>(null)))
+do test "cwewe098m" (not(LanguagePrimitives.IntrinsicFunctions.TypeTestFast<string list>(null)))
+
+(*
+let istype<'a>(obj:obj) = (obj :? 'a) 
+let _ = 
+    test "cwewe098z" (istype<int>(box(1)) );
+    test "cwewe098x" (not(istype<int>(null)));
+    test "cwewe098c" (istype<string>(box("a")) );
+    test "cwewe098v" (not(istype<string>(null)));
+    test "cwewe098b" (istype<int list>(box([]: int list)) );
+    test "cwewe098n" (not(istype<int list>(null)));
+    test "cwewe098m" (not(istype<string list>(null)));
+    ()
+
+*)
+
+do test "cwewvewho1" (match box(1) with :? int as v -> v = 1 | _ -> true)
+do test "cwewvewho2" (match (null:obj) with :? int -> false | _ -> true)
+do test "cwewvewho3" (match box("a") with :? string as v -> v = "a" | _ -> true)
+do test "cwewvewho4" (match (null:obj) with :? string -> false | _ -> true)
+do test "cwewvewho5" (match box(None: int option) with :? option<int> as v -> (v = None) | _ -> false)
+do test "cwewvewho6" (match (null:obj)                  with :? option<int> as v -> (v = None) | _ -> false)
+do test "cwewvewho7" (match box(None: int option) with :? option<string> as v -> (v = None) | _ -> false)
+do test "cwewvewho8" (match (null:obj)            with :? option<string> as v -> (v = None) | _ -> false)
+do test "cwewvewho9" (match box(Some 3)    with :? option<int> as v -> (v = Some(3)) | _ -> false)
+do test "cwewvewho0" (match box(Some 3)    with :? option<string> -> false | _ -> true)
+do test "cwewvewho-" (match box([3])    with :? list<int> as v -> (v = [3]) | _ -> false)
+do test "cwewvewhoa" (match box([3])    with :? list<string> as v -> false | _ -> true)
+
+do test "cwewvewhos" (match (null:obj)    with :? list<int> as v -> false | _ -> true)
+
+let pattest<'a> (obj:obj) fail (succeed : 'a -> bool) = match obj  with :? 'a as x -> succeed x | _ -> fail()
+
+do test "cwewvewhoq" (pattest<int>   (box(1))                       (fun () -> false) (fun v -> v = 1))
+do test "cwewvewhow" (pattest<int>   (null)                         (fun () -> true ) (fun _ -> false))
+do test "cwewvewhoe" (pattest<string>(box("a"))                     (fun () -> false) (fun v -> v = "a"))
+do test "cwewvewhor" (pattest<string>(null)                         (fun () -> true)  (fun _ -> false))
+do test "cwewvewhot" (pattest<int option>   (box(None: int option)) (fun () -> false) (function None -> true | _ -> false))
+do test "cwewvewhoy" (pattest<int option>   (null)                  (fun () -> false) (function None -> true | _ -> false))
+do test "cwewvewhou" (pattest<string option>(box(None: int option)) (fun () -> false) (function None -> true | _ -> false))
+do test "cwewvewhoi" (pattest<string option>(null)                  (fun () -> false) (function None -> true | _ -> false))
+do test "cwewvewhoo" (pattest<int option>   (box(Some 3))           (fun () -> false) (function Some 3 -> true | _ -> false))
+do test "cwewvewhop" (pattest<string option>(box(Some 3))           (fun () -> true)  (fun _ -> false))
+do test "cwewvewhog" (pattest<string list>  (box(["1"]))            (fun () -> false) (fun _ -> true))
+do test "cwewvewhoj" (pattest<string list>  null                    (fun () -> true)  (fun _ -> false))
+
+
+
+
+
+let _ = printString "string list structural equality (1): "; if ["abc"] = ["def"] then reportFailure "basic test Q146" else  stdout.WriteLine "YES"
+let _ = printString "string list object equality (1): "; if ["abc"] === ["def"] then reportFailure "basic test Q147" else  stdout.WriteLine "YES"
+let _ = printString "string list structural equality (2): ";  if ["abc"] = ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q148"
+let _ = printString "string list object equality (2): ";  if ["abc"] === ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q149"
+let _ = printString "hash respects equality (1): "; if hash [] = hash [] then stdout.WriteLine "YES" else  reportFailure "basic test Q150"
+let _ = printString "hash respects equality (2): "; if hash [1] = hash [1] then stdout.WriteLine "YES" else  reportFailure "basic test Q151"
+let _ = printString "hash respects equality (1a): "; if hash A = hash A then stdout.WriteLine "YES" else  reportFailure "basic test Q152"
+let _ = printString "hash respects equality (3): "; if hash ["abc"] = hash ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q153"
+let _ = printString "hash respects equality (4): "; if hash ("abc","def") = hash ("abc","def") then stdout.WriteLine "YES" else  reportFailure "basic test Q154"
+let _ = printString "hash respects equality (4a): "; if hash (A,"def") = hash (A,"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q155"
+let _ = printString "hash respects equality (4b): "; if hash ([],"def") = hash ([],"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q156"
+let _ = printString "hash respects equality (4c): "; if hash ([],[]) = hash ([],[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q157"
+let _ = printString "hash respects equality (4d): "; if hash (A,B) = hash (A,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q158"
+let _ = printString "hash respects equality (5): "; if hash ("abc","def","efg") = hash ("abc","def","efg") then stdout.WriteLine "YES" else  reportFailure "basic test Q159"
+let _ = printString "hash respects equality (6): "; if hash ("abc","def","efg","") = hash ("abc","def","efg","") then stdout.WriteLine "YES" else  reportFailure "basic test Q160"
+let _ = printString "hash respects equality (7): "; if hash ("abc","def","efg","","q") = hash ("abc","def","efg","","q") then stdout.WriteLine "YES" else  reportFailure "basic test Q161"
+let _ = printString "hash respects equality (8): "; if hash ("abc","def","efg","","q","r") = hash ("abc","def","efg","","q","r") then stdout.WriteLine "YES" else  reportFailure "basic test Q162"
+let _ = printString "hash respects equality (9): "; if hash ("abc","def","efg","","q","r","s") = hash ("abc","def","efg","","q","r","s") then stdout.WriteLine "YES" else  reportFailure "basic test Q163"
+let _ = printString "hash respects equality (int array,10): "; if hash [| 1 |] = hash [| 1 |] then stdout.WriteLine "YES" else  reportFailure "basic test Q164"
+let _ = printString "hash respects equality (string array,11): "; if hash [| "a" |] = hash [| "a" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q165"
+let _ = printString "hash respects equality (string array,12): "; if hash [| "a";"b" |] = hash [| "a";"b" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q166"
+let _ = printString "hash respects equality (byte array,12): "; if hash "abc"B = hash "abc"B then stdout.WriteLine "YES" else  reportFailure "basic test Q167"
+let _ = printString "hash respects equality (byte array,12): "; if hash ""B = hash ""B then stdout.WriteLine "YES" else  reportFailure "basic test Q169"
+let _ = printString "hash respects equality (byte array,12): "; if hash [| |] = hash [| |] then stdout.WriteLine "YES" else  reportFailure "basic test Q170"
+
+
+let _ = printString "hash is interesting (1): "; if hash "abc" = hash "def" then  reportFailure "basic test Q171" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (2): "; if hash 0 = hash 1 then  reportFailure "basic test Q172" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (3): "; if hash [0] = hash [1] then  reportFailure "basic test Q173" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (4): "; if hash (0,3) = hash (1,3) then  reportFailure "basic test Q174" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (5): "; if hash {contents=3} = hash {contents=4} then  reportFailure "basic test Q175" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (6): "; if hash [0;1;2] = hash [0;1;3] then  reportFailure "basic test Q176" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if hash [0;1;2;3;4;5] = hash [0;1;2;3;4;6] then  reportFailure "basic test Q177" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if hash [0;1;2;3;4] = hash [0;1;2;3;6] then  reportFailure "basic test Q178" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if hash [0;1;2;3;4;5;6;7] = hash [0;1;2;3;4;5;6;8] then  reportFailure "basic test Q179" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (8): "; if hash [0;1;2;3;4;5;6;7;8] = hash [0;1;2;3;4;5;6;7;9] then  reportFailure "basic test Q180" else stdout.WriteLine "YES"
+
+let _ = printString "hash is interesting (9): "; if hash [[0];[1];[2]] = hash [[0];[1];[3]] then  reportFailure "basic test Q181" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (10): "; if hash [[0];[1];[2];[3];[4];[5]] = hash [[0];[1];[2];[3];[4];[6]] then  reportFailure "basic test Q182" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (11): "; if hash [[0];[1];[2];[3];[4];[5];[6]] = hash [[0];[1];[2];[3];[4];[5];[7]] then  reportFailure "basic test Q183" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (bytearray 1): "; if hash "abc"B = hash "abd"B then  reportFailure "basic test Q184" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (string array 1): "; if hash [| "abc"; "e" |] = hash [| "abc"; "d" |] then  reportFailure "basic test Q185" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (intarray 1): "; if hash [| 3; 4 |] = hash [| 3; 5 |] then  reportFailure "basic test Q186" else stdout.WriteLine "YES"
+
+(* F# compiler does many special tricks to get fast type-specific structural hashing. *)
+(* A compiler could only work out that the following hash is type-specific if it inlines *)
+(* the whole function, which is very unlikely. *)
+let genericHash x =
+  stdout.WriteLine "genericHash - hopefully not inlined\n";
+  let r = ref 0 in 
+  for i = 1 to 100 do r := !r + 1; done;
+  for i = 1 to 100 do r := !r + 1; done;
+  for i = 1 to 100 do r := !r + 1; done;
+  for i = 1 to 100 do r := !r + 1; done;
+  (!r - 400) + hash x
+
+
+type T = T of int * int
+
+
+let hashes = 
+   [hash (T(1, 1)) ;
+    hash (T(4, -1)) ;
+    hash (T(2, 0)) ;
+    hash (T(0, 1)) ;
+    hash (T(-2, 2)) ]
+
+let _ = check "df390enj" (hashes |> Set.ofList |> Set.toList |> List.length) hashes.Length
+
+let _ = printString "type specific hash matches generic hash (1): "; if hash [] = genericHash [] then stdout.WriteLine "YES" else  reportFailure "basic test Q187"
+let _ = printString "type specific hash matches generic hash (2): "; if hash [1] = genericHash [1] then stdout.WriteLine "YES" else  reportFailure "basic test Q188"
+let _ = printString "type specific hash matches generic hash (1a): "; if hash A = genericHash A then stdout.WriteLine "YES" else  reportFailure "basic test Q189"
+let _ = printString "type specific hash matches generic hash (3): "; if hash ["abc"] = genericHash ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q190"
+let _ = printString "type specific hash matches generic hash (4): "; if hash ("abc","def") = genericHash ("abc","def") then stdout.WriteLine "YES" else  reportFailure "basic test Q191"
+let _ = printString "type specific hash matches generic hash (4a): "; if hash (A,"def") = genericHash (A,"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q192"
+let _ = printString "type specific hash matches generic hash (4b): "; if hash ([],"def") = genericHash ([],"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q193"
+let _ = printString "type specific hash matches generic hash (4c): "; if hash ([],[]) = genericHash ([],[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q194"
+let _ = printString "type specific hash matches generic hash (4d): "; if hash (A,B) = genericHash (A,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q195"
+let _ = printString "type specific hash matches generic hash (5): "; if hash ("abc","def","efg") = genericHash ("abc","def","efg") then stdout.WriteLine "YES" else  reportFailure "basic test Q196"
+let _ = printString "type specific hash matches generic hash (6): "; if hash ("abc","def","efg","") = genericHash ("abc","def","efg","") then stdout.WriteLine "YES" else  reportFailure "basic test Q197"
+let _ = printString "type specific hash matches generic hash (7): "; if hash ("abc","def","efg","","q") = genericHash ("abc","def","efg","","q") then stdout.WriteLine "YES" else  reportFailure "basic test Q198"
+let _ = printString "type specific hash matches generic hash (8): "; if hash ("abc","def","efg","","q","r") = genericHash ("abc","def","efg","","q","r") then stdout.WriteLine "YES" else  reportFailure "basic test Q199"
+let _ = printString "type specific hash matches generic hash (9): "; if hash ("abc","def","efg","","q","r","s") = genericHash ("abc","def","efg","","q","r","s") then stdout.WriteLine "YES" else  reportFailure "basic test Q200"
+let _ = printString "type specific hash matches generic hash (int array,10): "; if hash [| 1 |] = genericHash [| 1 |] then stdout.WriteLine "YES" else  reportFailure "basic test Q201"
+let _ = printString "type specific hash matches generic hash (string array,11): "; if hash [| "a" |] = genericHash [| "a" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q202"
+let _ = printString "type specific hash matches generic hash (string array,12): "; if hash [| "a";"b" |] = genericHash [| "a";"b" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q203"
+let _ = printString "type specific hash matches generic hash (byte array,12): "; if hash "abc"B = genericHash "abc"B then stdout.WriteLine "YES" else  reportFailure "basic test Q204"
+let _ = printString "type specific hash matches generic hash (byte array,12): "; if hash ""B = genericHash ""B then stdout.WriteLine "YES" else  reportFailure "basic test Q205"
+let _ = printString "type specific hash matches generic hash (byte array,12): "; if hash [| |] = genericHash [| |] then stdout.WriteLine "YES" else  reportFailure "basic test Q206"
+
+
+(*---------------------------------------------------------------------------
+!* check the same for GetHashCode
+ *--------------------------------------------------------------------------- *)
+
+
+let _ = printString "hash 1 = "; printInt (getObjectHashCode 1); printNewLine()
+let _ = printString "hash [] = "; printInt (getObjectHashCode []); printNewLine()
+let _ = printString "hash [1] = "; printInt (getObjectHashCode [1]); printNewLine()
+let _ = printString "hash [2] = "; printInt (getObjectHashCode [2]); printNewLine()
+let r3339 = ref 1 
+let _ = printString "hash 2 = "; printInt (getObjectHashCode 2); printNewLine()
+let _ = printString "hash 6 = "; printInt (getObjectHashCode 6); printNewLine()
+let _ = printString "hash \"abc\" = "; printInt (getObjectHashCode "abc"); printNewLine()
+let _ = printString "hash \"abd\" = "; printInt (getObjectHashCode "abd"); printNewLine()
+let _ = printString "hash \"\" = "; printInt (getObjectHashCode ""); printNewLine()
+
+
+let _ = printString "hash respects equality (1): "; if getObjectHashCode [] = getObjectHashCode [] then stdout.WriteLine "YES" else  reportFailure "basic test Q207"
+let _ = printString "hash respects equality (2): "; if getObjectHashCode [1] = getObjectHashCode [1] then stdout.WriteLine "YES" else  reportFailure "basic test Q208"
+let _ = printString "hash respects equality (1a): "; if getObjectHashCode A = getObjectHashCode A then stdout.WriteLine "YES" else  reportFailure "basic test Q209"
+let _ = printString "hash respects equality (3): "; if getObjectHashCode ["abc"] = getObjectHashCode ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q210"
+let _ = printString "hash respects equality (4): "; if getObjectHashCode ("abc","def") = getObjectHashCode ("abc","def") then stdout.WriteLine "YES" else  reportFailure "basic test Q211"
+let _ = printString "hash respects equality (4a): "; if getObjectHashCode (A,"def") = getObjectHashCode (A,"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q212"
+let _ = printString "hash respects equality (4b): "; if getObjectHashCode ([],"def") = getObjectHashCode ([],"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q213"
+let _ = printString "hash respects equality (4c): "; if getObjectHashCode ([],[]) = getObjectHashCode ([],[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q214"
+let _ = printString "hash respects equality (4d): "; if getObjectHashCode (A,B) = getObjectHashCode (A,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q215"
+let _ = printString "hash respects equality (5): "; if getObjectHashCode ("abc","def","efg") = getObjectHashCode ("abc","def","efg") then stdout.WriteLine "YES" else  reportFailure "basic test Q216"
+let _ = printString "hash respects equality (6): "; if getObjectHashCode ("abc","def","efg","") = getObjectHashCode ("abc","def","efg","") then stdout.WriteLine "YES" else  reportFailure "basic test Q217"
+let _ = printString "hash respects equality (7): "; if getObjectHashCode ("abc","def","efg","","q") = getObjectHashCode ("abc","def","efg","","q") then stdout.WriteLine "YES" else  reportFailure "basic test Q218"
+let _ = printString "hash respects equality (8): "; if getObjectHashCode ("abc","def","efg","","q","r") = getObjectHashCode ("abc","def","efg","","q","r") then stdout.WriteLine "YES" else  reportFailure "basic test Q219"
+let _ = printString "hash respects equality (9): "; if getObjectHashCode ("abc","def","efg","","q","r","s") = getObjectHashCode ("abc","def","efg","","q","r","s") then stdout.WriteLine "YES" else  reportFailure "basic test Q220"
+
+(* NOTE: GetHashCode guarantees do not apply to mutable data structures 
+
+let _ = printString "hash respects equality (int array,10): "; if getObjectHashCode [| 1 |] = getObjectHashCode [| 1 |] then stdout.WriteLine "YES" else  reportFailure "basic test Q221"
+let _ = printString "hash respects equality (string array,11): "; if getObjectHashCode [| "a" |] = getObjectHashCode [| "a" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q222"
+let _ = printString "hash respects equality (string array,12): "; if getObjectHashCode [| "a";"b" |] = getObjectHashCode [| "a";"b" |] then stdout.WriteLine "YES" else  reportFailure "basic test Q223"
+let _ = printString "hash respects equality (byte array,12): "; if getObjectHashCode "abc"B = getObjectHashCode "abc"B then stdout.WriteLine "YES" else  reportFailure "basic test Q224"
+let _ = printString "hash respects equality (byte array,12): "; if getObjectHashCode ""B = getObjectHashCode ""B then stdout.WriteLine "YES" else  reportFailure "basic test Q225"
+*)
+
+
+let _ = printString "hash is interesting (1): "; if getObjectHashCode "abc" = getObjectHashCode "def" then  reportFailure "basic test Q226" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (2): "; if getObjectHashCode 0 = getObjectHashCode 1 then  reportFailure "basic test Q227" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (3): "; if getObjectHashCode [0] = getObjectHashCode [1] then  reportFailure "basic test Q228" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (4): "; if getObjectHashCode (0,3) = getObjectHashCode (1,3) then  reportFailure "basic test Q229" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (6): "; if getObjectHashCode [0;1;2] = getObjectHashCode [0;1;3] then  reportFailure "basic test Q230" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if getObjectHashCode [0;1;2;3;4;5] = getObjectHashCode [0;1;2;3;4;6] then  reportFailure "basic test Q231" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if getObjectHashCode [0;1;2;3;4] = getObjectHashCode [0;1;2;3;6] then  reportFailure "basic test Q232" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (7): "; if getObjectHashCode [0;1;2;3;4;5;6;7] = getObjectHashCode [0;1;2;3;4;5;6;8] then  reportFailure "basic test Q233" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (8): "; if getObjectHashCode [0;1;2;3;4;5;6;7;8] = getObjectHashCode [0;1;2;3;4;5;6;7;9] then  reportFailure "basic test Q234" else stdout.WriteLine "YES"
+
+let _ = printString "hash is interesting (9): "; if getObjectHashCode [[0];[1];[2]] = getObjectHashCode [[0];[1];[3]] then  reportFailure "basic test Q235" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (10): "; if getObjectHashCode [[0];[1];[2];[3];[4];[5]] = getObjectHashCode [[0];[1];[2];[3];[4];[6]] then  reportFailure "basic test Q236" else stdout.WriteLine "YES"
+let _ = printString "hash is interesting (11): "; if getObjectHashCode [[0];[1];[2];[3];[4];[5];[6]] = getObjectHashCode [[0];[1];[2];[3];[4];[5];[7]] then  reportFailure "basic test Q237" else stdout.WriteLine "YES"
+
+let _ = printString "type specific hash matches generic hash (1): "; if getObjectHashCode [] = genericHash [] then stdout.WriteLine "YES" else  reportFailure "basic test Q238"
+let _ = printString "type specific hash matches generic hash (2): "; if getObjectHashCode [1] = genericHash [1] then stdout.WriteLine "YES" else  reportFailure "basic test Q239"
+let _ = printString "type specific hash matches generic hash (1a): "; if getObjectHashCode A = genericHash A then stdout.WriteLine "YES" else  reportFailure "basic test Q240"
+let _ = printString "type specific hash matches generic hash (3): "; if getObjectHashCode ["abc"] = genericHash ["abc"] then stdout.WriteLine "YES" else  reportFailure "basic test Q241"
+let _ = printString "type specific hash matches generic hash (4): "; if getObjectHashCode ("abc","def") = genericHash ("abc","def") then stdout.WriteLine "YES" else  reportFailure "basic test Q242"
+let _ = printString "type specific hash matches generic hash (4a): "; if getObjectHashCode (A,"def") = genericHash (A,"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q243"
+let _ = printString "type specific hash matches generic hash (4b): "; if getObjectHashCode ([],"def") = genericHash ([],"def") then stdout.WriteLine "YES" else  reportFailure "basic test Q244"
+let _ = printString "type specific hash matches generic hash (4c): "; if getObjectHashCode ([],[]) = genericHash ([],[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q245"
+let _ = printString "type specific hash matches generic hash (4d): "; if getObjectHashCode (A,B) = genericHash (A,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q246"
+let _ = printString "type specific hash matches generic hash (5): "; if getObjectHashCode ("abc","def","efg") = genericHash ("abc","def","efg") then stdout.WriteLine "YES" else  reportFailure "basic test Q247"
+let _ = printString "type specific hash matches generic hash (6): "; if getObjectHashCode ("abc","def","efg","") = genericHash ("abc","def","efg","") then stdout.WriteLine "YES" else  reportFailure "basic test Q248"
+let _ = printString "type specific hash matches generic hash (7): "; if getObjectHashCode ("abc","def","efg","","q") = genericHash ("abc","def","efg","","q") then stdout.WriteLine "YES" else  reportFailure "basic test Q249"
+let _ = printString "type specific hash matches generic hash (8): "; if getObjectHashCode ("abc","def","efg","","q","r") = genericHash ("abc","def","efg","","q","r") then stdout.WriteLine "YES" else  reportFailure "basic test Q250"
+let _ = printString "type specific hash matches generic hash (9): "; if getObjectHashCode ("abc","def","efg","","q","r","s") = genericHash ("abc","def","efg","","q","r","s") then stdout.WriteLine "YES" else  reportFailure "basic test Q251"
+
+
+(*---------------------------------------------------------------------------
+!* check we can resolve overlapping constructor names using type names
+ *--------------------------------------------------------------------------- *)
+
+module OverlappingCOnstructorNames = begin
+
+  type XY = X | Y
+  type YZ = Y | Z
+
+  let x0 = X
+  let x1 = XY.X
+  let y0 = Y
+  let y1 = XY.Y
+  let y2 = YZ.Y
+  let z0 = Z
+  let z2 = YZ.Z
+
+
+  let f xy = 
+    match xy with 
+    | XY.X -> "X"
+    |  XY.Y -> "Y"
+
+  let g yz = 
+    match yz with 
+    | YZ.Y -> "X"
+    | YZ.Z -> "Y"
+
+end
+
+
+(*---------------------------------------------------------------------------
+!* hashing of large terms that contain back pointers (are infinite)
+ *--------------------------------------------------------------------------- *)
+
+
+(*---------------------------------------------------------------------------
+!* Equality tests over structured values for data likely to contain
+ * values represented by "null" 
+ *--------------------------------------------------------------------------- *)
+
+let _ = printString "tuple inequality null test (1): "; if (1,2) = (1,3) then reportFailure "basic test Q252" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (2): "; if ([],2) = ([],1) then reportFailure "basic test Q253" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (3): "; if (1,[]) = (2,[]) then reportFailure "basic test Q254" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (4): "; if (1,2,3) = (1,2,4) then reportFailure "basic test Q255" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (5): "; if ([],2,3) = ([],2,4) then reportFailure "basic test Q256" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (6): "; if (1,[],2) = (1,[],3) then reportFailure "basic test Q257" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (7): "; if (1,2,[]) = (1,3,[]) then reportFailure "basic test Q258" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (8): "; if (1,2,3,4) = (1,2,3,5) then reportFailure "basic test Q259" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (9): "; if ([],2,3,4) = ([],2,4,4) then reportFailure "basic test Q260" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (10): "; if (1,[],3,4) = (1,[],3,5) then reportFailure "basic test Q261" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (11): "; if (1,2,[],4) = (1,2,[],5) then reportFailure "basic test Q262" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (12): "; if (1,2,3,[]) = (1,2,4,[]) then reportFailure "basic test Q263" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (13): "; if (1,2,3,4,5) = (1,2,3,4,6) then reportFailure "basic test Q264" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (14): "; if ([],2,3,4,5) = ([],2,3,5,5) then reportFailure "basic test Q265" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (15): "; if (1,[],3,4,5) = (1,[],3,6,5) then reportFailure "basic test Q266" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (16): "; if (1,2,[],4,5) = (1,2,[],3,5) then reportFailure "basic test Q267" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (17): "; if (1,2,3,[],5) = (1,2,3,[],6) then reportFailure "basic test Q268" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (18): "; if (1,2,3,4,[]) = (1,7,3,4,[]) then reportFailure "basic test Q269" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,7) then reportFailure "basic test Q270" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (20): "; if ([],2,3,4,5,6) = ([],2,3,4,5,7) then reportFailure "basic test Q271" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (21): "; if (1,[],3,4,5,6) = (1,[],3,4,5,7) then reportFailure "basic test Q272" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (22): "; if (1,2,[],4,5,6) = (1,2,[],4,5,7) then reportFailure "basic test Q273" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (23): "; if (1,2,3,[],5,6) = (1,2,3,[],5,7) then reportFailure "basic test Q274" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (24): "; if (1,2,3,4,[],6) = (1,2,3,4,[],7) then reportFailure "basic test Q275" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (25): "; if (1,2,3,4,5,[]) = (1,2,3,4,6,[]) then reportFailure "basic test Q276" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple equality null test (1): "; if (1,2) = (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q277"
+let _ = printString "tuple equality null test (2): "; if ([],2) = ([],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q278"
+let _ = printString "tuple equality null test (3): "; if (1,[]) = (1,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q279"
+let _ = printString "tuple equality null test (4): "; if (1,2,3) = (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q280"
+let _ = printString "tuple equality null test (5): "; if ([],2,3) = ([],2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q281"
+let _ = printString "tuple equality null test (6): "; if (1,[],2) = (1,[],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q282"
+let _ = printString "tuple equality null test (7): "; if (1,2,[]) = (1,2,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q283"
+let _ = printString "tuple equality null test (8): "; if (1,2,3,4) = (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q284"
+let _ = printString "tuple equality null test (9): "; if ([],2,3,4) = ([],2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q285"
+let _ = printString "tuple equality null test (10): "; if (1,[],3,4) = (1,[],3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q286"
+let _ = printString "tuple equality null test (11): "; if (1,2,[],4) = (1,2,[],4) then stdout.WriteLine "YES" else  reportFailure "basic test Q287"
+let _ = printString "tuple equality null test (12): "; if (1,2,3,[]) = (1,2,3,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q288"
+let _ = printString "tuple equality null test (13): "; if (1,2,3,4,5) = (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q289"
+let _ = printString "tuple equality null test (14): "; if ([],2,3,4,5) = ([],2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q290"
+let _ = printString "tuple equality null test (15): "; if (1,[],3,4,5) = (1,[],3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q291"
+let _ = printString "tuple equality null test (16): "; if (1,2,[],4,5) = (1,2,[],4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q292"
+let _ = printString "tuple equality null test (17): "; if (1,2,3,[],5) = (1,2,3,[],5) then stdout.WriteLine "YES" else  reportFailure "basic test Q293"
+let _ = printString "tuple equality null test (18): "; if (1,2,3,4,[]) = (1,2,3,4,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q294"
+let _ = printString "tuple equality null test (19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q295"
+let _ = printString "tuple equality null test (20): "; if ([],2,3,4,5,6) = ([],2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q296"
+let _ = printString "tuple equality null test (21): "; if (1,[],3,4,5,6) = (1,[],3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q297"
+let _ = printString "tuple equality null test (22): "; if (1,2,[],4,5,6) = (1,2,[],4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q298"
+let _ = printString "tuple equality null test (23): "; if (1,2,3,[],5,6) = (1,2,3,[],5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q299"
+let _ = printString "tuple equality null test (24): "; if (1,2,3,4,[],6) = (1,2,3,4,[],6) then stdout.WriteLine "YES" else  reportFailure "basic test Q300"
+let _ = printString "tuple equality null test (25): "; if (1,2,3,4,5,[]) = (1,2,3,4,5,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q301"
+
+let _ = printString "tuple inequality null test (a1): "; if (1,2) = (1,3) then reportFailure "basic test Q302" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a2): "; if (A,2) = (A,1) then reportFailure "basic test Q303" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a3): "; if (1,A) = (2,A) then reportFailure "basic test Q304" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a4): "; if (1,2,3) = (1,2,4) then reportFailure "basic test Q305" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a5): "; if (A,2,3) = (A,2,4) then reportFailure "basic test Q306" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a6): "; if (1,A,2) = (1,A,3) then reportFailure "basic test Q307" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a7): "; if (1,2,A) = (1,3,A) then reportFailure "basic test Q308" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a8): "; if (1,2,3,4) = (1,2,3,5) then reportFailure "basic test Q309" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a9): "; if (A,2,3,4) = (A,2,4,4) then reportFailure "basic test Q310" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a10): "; if (1,A,3,4) = (1,A,3,5) then reportFailure "basic test Q311" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a11): "; if (1,2,A,4) = (1,2,A,5) then reportFailure "basic test Q312" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a12): "; if (1,2,3,A) = (1,2,4,A) then reportFailure "basic test Q313" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a13): "; if (1,2,3,4,5) = (1,2,3,4,6) then reportFailure "basic test Q314" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a14): "; if (A,2,3,4,5) = (A,2,3,5,5) then reportFailure "basic test Q315" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a15): "; if (1,A,3,4,5) = (1,A,3,6,5) then reportFailure "basic test Q316" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a16): "; if (1,2,A,4,5) = (1,2,A,3,5) then reportFailure "basic test Q317" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a17): "; if (1,2,3,A,5) = (1,2,3,A,6) then reportFailure "basic test Q318" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a18): "; if (1,2,3,4,A) = (1,7,3,4,A) then reportFailure "basic test Q319" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,7) then reportFailure "basic test Q320" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a20): "; if (A,2,3,4,5,6) = (A,2,3,4,5,7) then reportFailure "basic test Q321" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a21): "; if (1,A,3,4,5,6) = (1,A,3,4,5,7) then reportFailure "basic test Q322" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a22): "; if (1,2,A,4,5,6) = (1,2,A,4,5,7) then reportFailure "basic test Q323" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a23): "; if (1,2,3,A,5,6) = (1,2,3,A,5,7) then reportFailure "basic test Q324" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a24): "; if (1,2,3,4,A,6) = (1,2,3,4,A,7) then reportFailure "basic test Q325" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (a25): "; if (1,2,3,4,5,A) = (1,2,3,4,6,A) then reportFailure "basic test Q326" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple equality null test (a1): "; if (1,2) = (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q327"
+let _ = printString "tuple equality null test (a2): "; if (A,2) = (A,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q328"
+let _ = printString "tuple equality null test (a3): "; if (1,A) = (1,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q329"
+let _ = printString "tuple equality null test (a4): "; if (1,2,3) = (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q330"
+let _ = printString "tuple equality null test (a5): "; if (A,2,3) = (A,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q331"
+let _ = printString "tuple equality null test (a6): "; if (1,A,2) = (1,A,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q332"
+let _ = printString "tuple equality null test (a7): "; if (1,2,A) = (1,2,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q333"
+let _ = printString "tuple equality null test (a8): "; if (1,2,3,4) = (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q334"
+let _ = printString "tuple equality null test (a9): "; if (A,2,3,4) = (A,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q335"
+let _ = printString "tuple equality null test (a10): "; if (1,A,3,4) = (1,A,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q336"
+let _ = printString "tuple equality null test (a11): "; if (1,2,A,4) = (1,2,A,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q337"
+let _ = printString "tuple equality null test (a12): "; if (1,2,3,A) = (1,2,3,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q338"
+let _ = printString "tuple equality null test (a13): "; if (1,2,3,4,5) = (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q339"
+let _ = printString "tuple equality null test (a14): "; if (A,2,3,4,5) = (A,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q340"
+let _ = printString "tuple equality null test (a15): "; if (1,A,3,4,5) = (1,A,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q341"
+let _ = printString "tuple equality null test (a16): "; if (1,2,A,4,5) = (1,2,A,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q342"
+let _ = printString "tuple equality null test (a17): "; if (1,2,3,A,5) = (1,2,3,A,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q343"
+let _ = printString "tuple equality null test (a18): "; if (1,2,3,4,A) = (1,2,3,4,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q344"
+let _ = printString "tuple equality null test (a19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q345"
+let _ = printString "tuple equality null test (a20): "; if (A,2,3,4,5,6) = (A,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q346"
+let _ = printString "tuple equality null test (a21): "; if (1,A,3,4,5,6) = (1,A,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q347"
+let _ = printString "tuple equality null test (a22): "; if (1,2,A,4,5,6) = (1,2,A,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q348"
+let _ = printString "tuple equality null test (a23): "; if (1,2,3,A,5,6) = (1,2,3,A,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q349"
+let _ = printString "tuple equality null test (a24): "; if (1,2,3,4,A,6) = (1,2,3,4,A,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q350"
+let _ = printString "tuple equality null test (a25): "; if (1,2,3,4,5,A) = (1,2,3,4,5,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q351"
+
+let _ = printString "tuple inequality null test (b1): "; if (1,2) = (1,3) then reportFailure "basic test Q351" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b2): "; if (B,2) = (B,1) then reportFailure "basic test Q352" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b3): "; if (1,B) = (2,B) then reportFailure "basic test Q353" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b4): "; if (1,2,3) = (1,2,4) then reportFailure "basic test Q354" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b5): "; if (B,2,3) = (B,2,4) then reportFailure "basic test Q355" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b6): "; if (1,B,2) = (1,B,3) then reportFailure "basic test Q356" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b7): "; if (1,2,B) = (1,3,B) then reportFailure "basic test Q357" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b8): "; if (1,2,3,4) = (1,2,3,5) then reportFailure "basic test Q358" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b9): "; if (B,2,3,4) = (B,2,4,4) then reportFailure "basic test Q359" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b10): "; if (1,B,3,4) = (1,B,3,5) then reportFailure "basic test Q360" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b11): "; if (1,2,B,4) = (1,2,B,5) then reportFailure "basic test Q361" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b12): "; if (1,2,3,B) = (1,2,4,B) then reportFailure "basic test Q362" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b13): "; if (1,2,3,4,5) = (1,2,3,4,6) then reportFailure "basic test Q363" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b14): "; if (B,2,3,4,5) = (B,2,3,5,5) then reportFailure "basic test Q364" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b15): "; if (1,B,3,4,5) = (1,B,3,6,5) then reportFailure "basic test Q365" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b16): "; if (1,2,B,4,5) = (1,2,B,3,5) then reportFailure "basic test Q366" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b17): "; if (1,2,3,B,5) = (1,2,3,B,6) then reportFailure "basic test Q367" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b18): "; if (1,2,3,4,B) = (1,7,3,4,B) then reportFailure "basic test Q368" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,7) then reportFailure "basic test Q369" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b20): "; if (B,2,3,4,5,6) = (B,2,3,4,5,7) then reportFailure "basic test Q370" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b21): "; if (1,B,3,4,5,6) = (1,B,3,4,5,7) then reportFailure "basic test Q371" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b22): "; if (1,2,B,4,5,6) = (1,2,B,4,5,7) then reportFailure "basic test Q372" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b23): "; if (1,2,3,B,5,6) = (1,2,3,B,5,7) then reportFailure "basic test Q373" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b24): "; if (1,2,3,4,B,6) = (1,2,3,4,B,7) then reportFailure "basic test Q374" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b25): "; if (1,2,3,4,5,B) = (1,2,3,4,6,B) then reportFailure "basic test Q375" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple equality null test (b1): "; if (1,2) = (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b2): "; if (B,2) = (B,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b3): "; if (1,B) = (1,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b4): "; if (1,2,3) = (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b5): "; if (B,2,3) = (B,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b6): "; if (1,B,2) = (1,B,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b7): "; if (1,2,B) = (1,2,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b8): "; if (1,2,3,4) = (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b9): "; if (B,2,3,4) = (B,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b10): "; if (1,B,3,4) = (1,B,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b11): "; if (1,2,B,4) = (1,2,B,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b12): "; if (1,2,3,B) = (1,2,3,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b13): "; if (1,2,3,4,5) = (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b14): "; if (B,2,3,4,5) = (B,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b15): "; if (1,B,3,4,5) = (1,B,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b16): "; if (1,2,B,4,5) = (1,2,B,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b17): "; if (1,2,3,B,5) = (1,2,3,B,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b18): "; if (1,2,3,4,B) = (1,2,3,4,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b20): "; if (B,2,3,4,5,6) = (B,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b21): "; if (1,B,3,4,5,6) = (1,B,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b22): "; if (1,2,B,4,5,6) = (1,2,B,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b23): "; if (1,2,3,B,5,6) = (1,2,3,B,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b24): "; if (1,2,3,4,B,6) = (1,2,3,4,B,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b25): "; if (1,2,3,4,5,B) = (1,2,3,4,5,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "tuple inequality null test (b1): "; if (1,2) = (1,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b2): "; if (C,2) = (C,1) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b3): "; if (1,C) = (2,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b4): "; if (1,2,3) = (1,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b5): "; if (C,2,3) = (C,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b6): "; if (1,C,2) = (1,C,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b7): "; if (1,2,C) = (1,3,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b8): "; if (1,2,3,4) = (1,2,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b9): "; if (C,2,3,4) = (C,2,4,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b10): "; if (1,C,3,4) = (1,C,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b11): "; if (1,2,C,4) = (1,2,C,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b12): "; if (1,2,3,C) = (1,2,4,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b13): "; if (1,2,3,4,5) = (1,2,3,4,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b14): "; if (C,2,3,4,5) = (C,2,3,5,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b15): "; if (1,C,3,4,5) = (1,C,3,6,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b16): "; if (1,2,C,4,5) = (1,2,C,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b17): "; if (1,2,3,C,5) = (1,2,3,C,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b18): "; if (1,2,3,4,C) = (1,7,3,4,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b20): "; if (C,2,3,4,5,6) = (C,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b21): "; if (1,C,3,4,5,6) = (1,C,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b22): "; if (1,2,C,4,5,6) = (1,2,C,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b23): "; if (1,2,3,C,5,6) = (1,2,3,C,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b24): "; if (1,2,3,4,C,6) = (1,2,3,4,C,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple inequality null test (b25): "; if (1,2,3,4,5,C) = (1,2,3,4,6,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple equality null test (b1): "; if (1,2) = (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b2): "; if (C,2) = (C,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b3): "; if (1,C) = (1,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b4): "; if (1,2,3) = (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b5): "; if (C,2,3) = (C,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b6): "; if (1,C,2) = (1,C,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b7): "; if (1,2,C) = (1,2,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b8): "; if (1,2,3,4) = (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b9): "; if (C,2,3,4) = (C,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b10): "; if (1,C,3,4) = (1,C,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b11): "; if (1,2,C,4) = (1,2,C,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b12): "; if (1,2,3,C) = (1,2,3,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b13): "; if (1,2,3,4,5) = (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b14): "; if (C,2,3,4,5) = (C,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b15): "; if (1,C,3,4,5) = (1,C,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b16): "; if (1,2,C,4,5) = (1,2,C,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b17): "; if (1,2,3,C,5) = (1,2,3,C,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b18): "; if (1,2,3,4,C) = (1,2,3,4,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b19): "; if (1,2,3,4,5,6) = (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b20): "; if (C,2,3,4,5,6) = (C,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b21): "; if (1,C,3,4,5,6) = (1,C,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b22): "; if (1,2,C,4,5,6) = (1,2,C,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b23): "; if (1,2,3,C,5,6) = (1,2,3,C,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b24): "; if (1,2,3,4,C,6) = (1,2,3,4,C,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple equality null test (b25): "; if (1,2,3,4,5,C) = (1,2,3,4,5,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+
+let _ = printString "tuple object inequality null test (1): "; if (1,2) === (1,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (2): "; if ([],2) === ([],1) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (3): "; if (1,[]) === (2,[]) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (4): "; if (1,2,3) === (1,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (5): "; if ([],2,3) === ([],2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (6): "; if (1,[],2) === (1,[],3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (7): "; if (1,2,[]) === (1,3,[]) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (8): "; if (1,2,3,4) === (1,2,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (9): "; if ([],2,3,4) === ([],2,4,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (10): "; if (1,[],3,4) === (1,[],3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (11): "; if (1,2,[],4) === (1,2,[],5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (12): "; if (1,2,3,[]) === (1,2,4,[]) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (13): "; if (1,2,3,4,5) === (1,2,3,4,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (14): "; if ([],2,3,4,5) === ([],2,3,5,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (15): "; if (1,[],3,4,5) === (1,[],3,6,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (16): "; if (1,2,[],4,5) === (1,2,[],3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (17): "; if (1,2,3,[],5) === (1,2,3,[],6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (18): "; if (1,2,3,4,[]) === (1,7,3,4,[]) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (20): "; if ([],2,3,4,5,6) === ([],2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (21): "; if (1,[],3,4,5,6) === (1,[],3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (22): "; if (1,2,[],4,5,6) === (1,2,[],4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (23): "; if (1,2,3,[],5,6) === (1,2,3,[],5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (24): "; if (1,2,3,4,[],6) === (1,2,3,4,[],7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (25): "; if (1,2,3,4,5,[]) === (1,2,3,4,6,[]) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple object equality null test (1): "; if (1,2) === (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (2): "; if ([],2) === ([],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (3): "; if (1,[]) === (1,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (4): "; if (1,2,3) === (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (5): "; if ([],2,3) === ([],2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (6): "; if (1,[],2) === (1,[],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (7): "; if (1,2,[]) === (1,2,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (8): "; if (1,2,3,4) === (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (9): "; if ([],2,3,4) === ([],2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (10): "; if (1,[],3,4) === (1,[],3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (11): "; if (1,2,[],4) === (1,2,[],4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (12): "; if (1,2,3,[]) === (1,2,3,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (13): "; if (1,2,3,4,5) === (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (14): "; if ([],2,3,4,5) === ([],2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (15): "; if (1,[],3,4,5) === (1,[],3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (16): "; if (1,2,[],4,5) === (1,2,[],4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (17): "; if (1,2,3,[],5) === (1,2,3,[],5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (18): "; if (1,2,3,4,[]) === (1,2,3,4,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (20): "; if ([],2,3,4,5,6) === ([],2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (21): "; if (1,[],3,4,5,6) === (1,[],3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (22): "; if (1,2,[],4,5,6) === (1,2,[],4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (23): "; if (1,2,3,[],5,6) === (1,2,3,[],5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (24): "; if (1,2,3,4,[],6) === (1,2,3,4,[],6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (25): "; if (1,2,3,4,5,[]) === (1,2,3,4,5,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "tuple object inequality null test (a1): "; if (1,2) === (1,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a2): "; if (A,2) === (A,1) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a3): "; if (1,A) === (2,A) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a4): "; if (1,2,3) === (1,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a5): "; if (A,2,3) === (A,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a6): "; if (1,A,2) === (1,A,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a7): "; if (1,2,A) === (1,3,A) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a8): "; if (1,2,3,4) === (1,2,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a9): "; if (A,2,3,4) === (A,2,4,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a10): "; if (1,A,3,4) === (1,A,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a11): "; if (1,2,A,4) === (1,2,A,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a12): "; if (1,2,3,A) === (1,2,4,A) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a13): "; if (1,2,3,4,5) === (1,2,3,4,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a14): "; if (A,2,3,4,5) === (A,2,3,5,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a15): "; if (1,A,3,4,5) === (1,A,3,6,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a16): "; if (1,2,A,4,5) === (1,2,A,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a17): "; if (1,2,3,A,5) === (1,2,3,A,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a18): "; if (1,2,3,4,A) === (1,7,3,4,A) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a20): "; if (A,2,3,4,5,6) === (A,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a21): "; if (1,A,3,4,5,6) === (1,A,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a22): "; if (1,2,A,4,5,6) === (1,2,A,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a23): "; if (1,2,3,A,5,6) === (1,2,3,A,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a24): "; if (1,2,3,4,A,6) === (1,2,3,4,A,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (a25): "; if (1,2,3,4,5,A) === (1,2,3,4,6,A) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple object equality null test (a1): "; if (1,2) === (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a2): "; if (A,2) === (A,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a3): "; if (1,A) === (1,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a4): "; if (1,2,3) === (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a5): "; if (A,2,3) === (A,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a6): "; if (1,A,2) === (1,A,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a7): "; if (1,2,A) === (1,2,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a8): "; if (1,2,3,4) === (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a9): "; if (A,2,3,4) === (A,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a10): "; if (1,A,3,4) === (1,A,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a11): "; if (1,2,A,4) === (1,2,A,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a12): "; if (1,2,3,A) === (1,2,3,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a13): "; if (1,2,3,4,5) === (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a14): "; if (A,2,3,4,5) === (A,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a15): "; if (1,A,3,4,5) === (1,A,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a16): "; if (1,2,A,4,5) === (1,2,A,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a17): "; if (1,2,3,A,5) === (1,2,3,A,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a18): "; if (1,2,3,4,A) === (1,2,3,4,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a20): "; if (A,2,3,4,5,6) === (A,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a21): "; if (1,A,3,4,5,6) === (1,A,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a22): "; if (1,2,A,4,5,6) === (1,2,A,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a23): "; if (1,2,3,A,5,6) === (1,2,3,A,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a24): "; if (1,2,3,4,A,6) === (1,2,3,4,A,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (a25): "; if (1,2,3,4,5,A) === (1,2,3,4,5,A) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "tuple object inequality null test (b1): "; if (1,2) === (1,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b2): "; if (B,2) === (B,1) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b3): "; if (1,B) === (2,B) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b4): "; if (1,2,3) === (1,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b5): "; if (B,2,3) === (B,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b6): "; if (1,B,2) === (1,B,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b7): "; if (1,2,B) === (1,3,B) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b8): "; if (1,2,3,4) === (1,2,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b9): "; if (B,2,3,4) === (B,2,4,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b10): "; if (1,B,3,4) === (1,B,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b11): "; if (1,2,B,4) === (1,2,B,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b12): "; if (1,2,3,B) === (1,2,4,B) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b13): "; if (1,2,3,4,5) === (1,2,3,4,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b14): "; if (B,2,3,4,5) === (B,2,3,5,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b15): "; if (1,B,3,4,5) === (1,B,3,6,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b16): "; if (1,2,B,4,5) === (1,2,B,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b17): "; if (1,2,3,B,5) === (1,2,3,B,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b18): "; if (1,2,3,4,B) === (1,7,3,4,B) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b20): "; if (B,2,3,4,5,6) === (B,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b21): "; if (1,B,3,4,5,6) === (1,B,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b22): "; if (1,2,B,4,5,6) === (1,2,B,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b23): "; if (1,2,3,B,5,6) === (1,2,3,B,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b24): "; if (1,2,3,4,B,6) === (1,2,3,4,B,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b25): "; if (1,2,3,4,5,B) === (1,2,3,4,6,B) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple object equality null test (b1): "; if (1,2) === (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b2): "; if (B,2) === (B,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b3): "; if (1,B) === (1,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b4): "; if (1,2,3) === (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b5): "; if (B,2,3) === (B,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b6): "; if (1,B,2) === (1,B,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b7): "; if (1,2,B) === (1,2,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b8): "; if (1,2,3,4) === (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b9): "; if (B,2,3,4) === (B,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b10): "; if (1,B,3,4) === (1,B,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b11): "; if (1,2,B,4) === (1,2,B,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b12): "; if (1,2,3,B) === (1,2,3,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b13): "; if (1,2,3,4,5) === (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b14): "; if (B,2,3,4,5) === (B,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b15): "; if (1,B,3,4,5) === (1,B,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b16): "; if (1,2,B,4,5) === (1,2,B,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b17): "; if (1,2,3,B,5) === (1,2,3,B,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b18): "; if (1,2,3,4,B) === (1,2,3,4,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b20): "; if (B,2,3,4,5,6) === (B,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b21): "; if (1,B,3,4,5,6) === (1,B,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b22): "; if (1,2,B,4,5,6) === (1,2,B,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b23): "; if (1,2,3,B,5,6) === (1,2,3,B,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b24): "; if (1,2,3,4,B,6) === (1,2,3,4,B,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b25): "; if (1,2,3,4,5,B) === (1,2,3,4,5,B) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "tuple object inequality null test (b1): "; if (1,2) === (1,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b2): "; if (C,2) === (C,1) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b3): "; if (1,C) === (2,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b4): "; if (1,2,3) === (1,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b5): "; if (C,2,3) === (C,2,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b6): "; if (1,C,2) === (1,C,3) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b7): "; if (1,2,C) === (1,3,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b8): "; if (1,2,3,4) === (1,2,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b9): "; if (C,2,3,4) === (C,2,4,4) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b10): "; if (1,C,3,4) === (1,C,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b11): "; if (1,2,C,4) === (1,2,C,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b12): "; if (1,2,3,C) === (1,2,4,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b13): "; if (1,2,3,4,5) === (1,2,3,4,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b14): "; if (C,2,3,4,5) === (C,2,3,5,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b15): "; if (1,C,3,4,5) === (1,C,3,6,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b16): "; if (1,2,C,4,5) === (1,2,C,3,5) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b17): "; if (1,2,3,C,5) === (1,2,3,C,6) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b18): "; if (1,2,3,4,C) === (1,7,3,4,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b20): "; if (C,2,3,4,5,6) === (C,2,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b21): "; if (1,C,3,4,5,6) === (1,C,3,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b22): "; if (1,2,C,4,5,6) === (1,2,C,4,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b23): "; if (1,2,3,C,5,6) === (1,2,3,C,5,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b24): "; if (1,2,3,4,C,6) === (1,2,3,4,C,7) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+let _ = printString "tuple object inequality null test (b25): "; if (1,2,3,4,5,C) === (1,2,3,4,6,C) then reportFailure "basic test Q" else  stdout.WriteLine "YES"
+
+let _ = printString "tuple object equality null test (b1): "; if (1,2) === (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b2): "; if (C,2) === (C,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b3): "; if (1,C) === (1,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b4): "; if (1,2,3) === (1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b5): "; if (C,2,3) === (C,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b6): "; if (1,C,2) === (1,C,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b7): "; if (1,2,C) === (1,2,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b8): "; if (1,2,3,4) === (1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b9): "; if (C,2,3,4) === (C,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b10): "; if (1,C,3,4) === (1,C,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b11): "; if (1,2,C,4) === (1,2,C,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b12): "; if (1,2,3,C) === (1,2,3,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b13): "; if (1,2,3,4,5) === (1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b14): "; if (C,2,3,4,5) === (C,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b15): "; if (1,C,3,4,5) === (1,C,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b16): "; if (1,2,C,4,5) === (1,2,C,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b17): "; if (1,2,3,C,5) === (1,2,3,C,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b18): "; if (1,2,3,4,C) === (1,2,3,4,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b19): "; if (1,2,3,4,5,6) === (1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b20): "; if (C,2,3,4,5,6) === (C,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b21): "; if (1,C,3,4,5,6) === (1,C,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b22): "; if (1,2,C,4,5,6) === (1,2,C,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b23): "; if (1,2,3,C,5,6) === (1,2,3,C,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b24): "; if (1,2,3,4,C,6) === (1,2,3,4,C,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "tuple object equality null test (b25): "; if (1,2,3,4,5,C) === (1,2,3,4,5,C) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+let _ = printString "ref equality test (b25): "; if ref 1 = ref 1 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "ref equality test (b25): "; if ref 1 <> ref 2 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "compaure nativeint test (b25): "; if compare [0n] [1n] = -(compare [1n] [0n]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "compaure nativeint test (b25): "; if compare [0un] [1un] = -(compare [1un] [0un]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "compaure nativeint test (b25): "; if compare [0un] [0un] = 0 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "compaure nativeint test (b25): "; if compare [0n] [0n] = 0 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+(*---------------------------------------------------------------------------
+!* Equality tests over structured values for data likely to contain
+ * values represented by "null" 
+ *--------------------------------------------------------------------------- *)
+
+type ('a,'b) a2 = A2 of 'a * 'b
+type ('a,'b,'c) a3 = A3 of 'a * 'b * 'c
+type ('a,'b,'c,'d) a4 = A4 of 'a * 'b * 'c * 'd
+type ('a,'b,'c,'d,'e) a5 = A5 of 'a * 'b * 'c * 'd * 'e
+type ('a,'b,'c,'d,'e,'f) a6 = A6 of 'a * 'b * 'c * 'd * 'e * 'f
+let _ = printString "data equality null test (1): "; if A2 (1,2) = A2 (1,2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (2): "; if A2 ([],2) = A2 ([],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (3): "; if A2 (1,[]) = A2 (1,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (4): "; if A3(1,2,3) = A3(1,2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (5): "; if A3([],2,3) = A3([],2,3) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (6): "; if A3(1,[],2) = A3(1,[],2) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (7): "; if A3(1,2,[]) = A3(1,2,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (8): "; if A4(1,2,3,4) = A4(1,2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (9): "; if A4([],2,3,4) = A4([],2,3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (10): "; if A4(1,[],3,4) = A4(1,[],3,4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (11): "; if A4(1,2,[],4) = A4(1,2,[],4) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (12): "; if A4(1,2,3,[]) = A4(1,2,3,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (13): "; if A5(1,2,3,4,5) = A5(1,2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (14): "; if A5([],2,3,4,5) = A5([],2,3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (15): "; if A5(1,[],3,4,5) = A5(1,[],3,4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (16): "; if A5(1,2,[],4,5) = A5(1,2,[],4,5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (17): "; if A5(1,2,3,[],5) = A5(1,2,3,[],5) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (18): "; if A5(1,2,3,4,[]) = A5(1,2,3,4,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (19): "; if A6(1,2,3,4,5,6) = A6(1,2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (20): "; if A6([],2,3,4,5,6) = A6([],2,3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (21): "; if A6(1,[],3,4,5,6) = A6(1,[],3,4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (22): "; if A6(1,2,[],4,5,6) = A6(1,2,[],4,5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (23): "; if A6(1,2,3,[],5,6) = A6(1,2,3,[],5,6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (24): "; if A6(1,2,3,4,[],6) = A6(1,2,3,4,[],6) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "data equality null test (25): "; if A6(1,2,3,4,5,[]) = A6(1,2,3,4,5,[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "map test (1): "; if List.map (fun x -> x+1) [] = [] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "map test (2): "; if List.map (fun x -> x+1) [1] = [2] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "map test (3): "; if List.map (fun x -> x+1) [2;1] = [3;2] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "append test (1): "; if [2] @ [] = [2] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "append test (2): "; if [] @ [2] = [2] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "append test (3): "; if [2] @ [1] = [2;1] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "append test (4): "; if [3;2] @ [1] = [3;2;1] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "append test (5): "; if [3;2] @ [1;0] = [3;2;1;0] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "concat test (1): "; if List.concat [[2]] = [2] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "concat test (2): "; if List.concat [[]] = [] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "concat test (3): "; if List.concat [[2];[1]] = [2;1] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "combine test (1): "; if List.zip [] [] = [] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "combine test (2): "; if List.zip [1] [2] = [(1,2)] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "combine test (3): "; if List.zip [1.0;2.0] [2.0;3.0] = [(1.0,2.0);(2.0,3.0)] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "split test (1): "; if List.unzip [(1.0,2.0);(2.0,3.0)] = ([1.0;2.0],[2.0;3.0]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "split test (2): "; if List.unzip [] = ([],[]) then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printfn "reduce test"; if List.reduce (fun x y -> x/y) [5*4*3*2; 4;3;2;1] = 5 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printfn "reduceBack test"; if List.reduceBack (fun y x -> x/y) [4;3;2;1; 5*4*3*2] = 5 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+(*---------------------------------------------------------------------------
+!* List library 
+ *--------------------------------------------------------------------------- *)
+
+
+let pri s l = printString s; printString ": "; List.iter printInt l; printNewLine ()
+
+let _ = pri "none" [1;2;3;4;5;6]
+let _ = pri "rev" (List.rev [6;5;4;3;2;1])
+let _ = pri "@" ([1;2;3] @ [4;5;6])
+let _ = pri "map" (List.map (fun x -> x + 1) ([1;2;3]))
+let _ = pri "concat" (List.concat [[1;2]; [3;4]; [5;6]])
+
+let prs s l = printString s; printString ": "; List.iter printString l; printNewLine ()
+let _ = prs "none" ["1";"2";"3";"4";"5";"6"]
+let _ = prs "rev" (List.rev ["6";"5";"4";"3";"2";"1"])
+let _ = prs "map" (List.map (fun x -> x ^ ".0") (["1";"2";"3"]))
+let _ = prs "@" (["1";"2";"3"] @ ["4";"5";"6"])
+let _ = prs "concat" (List.concat [["1";"2"]; ["3";"4"]; ["5";"6"]])
+
+let _ = test "List.empty" (List.empty |> List.length = 0)
+let _ = test "List.empty" (List.empty = [])
+let _ = test "List.head" (List.head [1..4] = 1)
+let _ = test "List.head" (try List.head []; false with _ -> true)
+let _ = test "List.tail" (List.tail [1..10] = [2..10])
+let _ = test "List.tail" (try List.tail []; false with _ -> true)
+let _ = test "List.init" (List.init 20 (fun x -> x+1) = [1..20])
+let _ = test "List.fold2" (List.fold2 (fun i j k -> i+j+k) 100 [1;2;3] [1;2;3] = 112)
+let _ = test "List.fold2" (List.fold2 (fun i j k -> i-j-k) 100 [1;2;3] [1;2;3] = 100-12)
+let _ = test "List.foldBack2" (List.foldBack2 (fun i j k -> i+j+k) [1;2;3] [1;2;3] 100 = 112)
+let _ = test "List.foldBack2" (List.foldBack2 (fun i j k -> k-i-j) [1;2;3] [1;2;3] 100 = 100-12)
+
+let _ = test "List.scan" (List.scan (+) 0 [1..5] = [0; 1; 3; 6; 10; 15])
+
+let _ = test "List.scanBack" (List.scanBack (+) [1..5] 0 = [15; 14; 12; 9; 5; 0])
+
+let _ = test "List.tryFindIndex" (List.tryFindIndex (fun x -> x = 4) [0..10] = Some 4)
+
+let _ = test "List.tryfind_index_b" (List.tryFindIndex (fun x -> x = 42) [0..10] = None)
+
+
+let c = ref -1
+do List.iter (fun x -> incr c; test "List.iter" (x = !c)) [0..100]
+let _ = test "List.iter" (!c = 100)
+
+let _ = test "List.map" ([1..100] |> List.map ((+) 1) = [2..101])
+
+let _ = test "List.mapi" ([0..100] |> List.mapi (+) = [0..+2..200])
+
+do c := -1
+do List.iteri (fun i x -> incr c; test "List.iteri" (x = !c && i = !c)) [0..100]
+let _ = test "List.iteri" (!c = 100)
+
+let _ = test "List.exists" ([1..100] |> List.exists ((=) 50))
+
+let _ = test "List.exists b" <| not ([1..100] |> List.exists ((=) 150))
+
+let _ = test "List.forall" ([1..100] |> List.forall (fun x -> x < 150))
+
+let _ = test "List.forall b" <| not ([1..100] |> List.forall (fun x -> x < 80))
+
+let _ = test "List.find" ([1..100] |> List.find (fun x -> x > 50) = 51)
+
+let _ = test "List.find b" (try [1..100] |> List.find (fun x -> x > 180) |> ignore; false with _ -> true)
+
+let _ = test "List.tryPick" ([1..100] |> List.tryPick (fun x -> if x > 50 then Some (x*x) else None) = Some (51*51))
+
+let _ = test "List.tryPick b" ([1..100] |> List.tryPick (fun x -> None) = None)
+        
+let _ = test "List.tryPick c" ([] |> List.tryPick (fun _ -> Some 42) = None)
+
+let _ = test "List.tryFind" ([1..100] |> List.tryFind (fun x -> x > 50) = Some 51)
+
+let _ = test "List.tryFind b" ([1..100] |> List.tryFind (fun x -> x > 180) = None)
+
+do c := -1
+do List.iter2 (fun x y -> incr c; test "List.iter2" (!c = x && !c = y)) [0..100] [0..100]
+let _ = test "List.iter2" (!c = 100)
+
+let _ = test "List.map2" (List.map2 (+) [0..100] [0..100] = [0..+2..200])
+
+let _ = test "List.choose" (List.choose (fun x -> if x % 2 = 0 then Some (x/2) else None) [0..100] = [0..50])
+
+let _ = test "List.filter" (List.filter (fun x -> x % 2 = 0) [0..100] = [0..+2..100])
+
+let _ = test "List.filter b" (List.filter (fun x -> false) [0..100] = [])
+
+let _ = test "List.filter c" (List.filter (fun x -> true) [0..100] = [0..100])
+
+let p1, p2 = List.partition (fun x -> x % 2 = 0) [0..100]
+let _ = test "List.partition" (p1 = [0..+2..100] && p2 = [1..+2..100])
+
+let _ = test "List.rev" (List.rev [0..100] = [100..-1 ..0])
+
+let _ = test "List.rev b" (List.rev [1] = [1])
+
+let _ = test "List.rev c" (List.rev [] = [])
+
+let _ = test "List.rev d" (List.rev [1; 2] = [2; 1])
+
+
+
+module MinMaxAverageSum = begin
+        do test "ceijoe9cewz" (Seq.sum [] = 0)
+        do test "ceijoe9cewx" (Seq.sum [1;2;3] = 6)
+        do test "ceijoe9cewv" (Seq.sum [0.0;1.0] = 1.0)
+        do test "ceijoe9cewc" (Seq.average [1.0;2.0;3.0] = 2.0)
+        do test "ceijoe9cewb" (Seq.averageBy id [1.0;2.0;3.0] = 2.0)
+        do test "ceijoe9cewn" (Seq.averageBy id [1.0M;2.0M;3.0M] = 2.0M)
+        do test "ceijoe9cewm" (Seq.sum [System.Int32.MinValue;System.Int32.MaxValue] = -1)
+        do test "ceijoe9cewaa" (Seq.sum [System.Int32.MaxValue;System.Int32.MinValue] = -1)
+        do test "ceijoe9cewss" (Seq.sum [System.Int32.MinValue;1;-1] = System.Int32.MinValue)
+        //printfn "res = %g" (Seq.averageBy id [])
+        //printfn "res = %g" (Seq.average { 0.0 .. 100000.0 })
+
+        do test "ceijoe9cew1dd" (Seq.min [1;2;3] = 1)
+        do test "ceijoe9cew2ff" (Seq.min [3;2;1] = 1)
+
+        do test "ceijoe9cew3gg" (Seq.max [1;2;3] = 3)
+        do test "ceijoe9cew4hh" (Seq.max [3;2;1] = 3)
+
+
+        do test "ceijoe9cew5jj" (Seq.min [1.0;2.0;3.0] = 1.0)
+        do test "ceijoe9cew6kk" (Seq.min [3.0;2.0;1.0] = 1.0)
+
+        do test "ceijoe9cew7" (Seq.max [1.0;2.0;3.0] = 3.0)
+        do test "ceijoe9cew8" (Seq.max [3.0;2.0;1.0] = 3.0)
+
+        do test "ceijoe9cew9" (Seq.min [1.0M;2.0M;3.0M] = 1.0M)
+        do test "ceijoe9cewq" (Seq.min [3.0M;2.0M;1.0M] = 1.0M)
+
+        do test "ceijoe9ceww" (Seq.max [1.0M;2.0M;3.0M] = 3.0M)
+        do test "ceijoe9cewe" (Seq.max [3.0M;2.0M;1.0M] = 3.0M)
+
+        do test "ceijoe9cewz" (List.sum [] = 0)
+        do test "ceijoe9cewx" (List.sum [1;2;3] = 6)
+        do test "ceijoe9cewv" (List.sum [0.0;1.0] = 1.0)
+        do test "ceijoe9cewc" (List.average [1.0;2.0;3.0] = 2.0)
+        do test "ceijoe9cewb" (List.averageBy id [1.0;2.0;3.0] = 2.0)
+        do test "ceijoe9cewn" (List.averageBy id [1.0M;2.0M;3.0M] = 2.0M)
+        do test "ceijoe9cewm" (List.sum [System.Int32.MinValue;System.Int32.MaxValue] = -1)
+        do test "ceijoe9cewaa" (List.sum [System.Int32.MaxValue;System.Int32.MinValue] = -1)
+        do test "ceijoe9cewss" (List.sum [System.Int32.MinValue;1;-1] = System.Int32.MinValue)
+        //printfn "res = %g" (List.averageBy id [])
+        //printfn "res = %g" (List.average { 0.0 .. 100000.0 })
+
+        do test "ceijoe9cew1dd" (List.min [1;2;3] = 1)
+        do test "ceijoe9cew2ff" (List.min [3;2;1] = 1)
+
+        do test "ceijoe9cew3gg" (List.max [1;2;3] = 3)
+        do test "ceijoe9cew4hh" (List.max [3;2;1] = 3)
+
+
+        do test "ceijoe9cew5jj" (List.min [1.0;2.0;3.0] = 1.0)
+        do test "ceijoe9cew6kk" (List.min [3.0;2.0;1.0] = 1.0)
+
+        do test "ceijoe9cew7" (List.max [1.0;2.0;3.0] = 3.0)
+        do test "ceijoe9cew8" (List.max [3.0;2.0;1.0] = 3.0)
+
+        do test "ceijoe9cew9" (List.min [1.0M;2.0M;3.0M] = 1.0M)
+        do test "ceijoe9cewq" (List.min [3.0M;2.0M;1.0M] = 1.0M)
+
+        do test "ceijoe9ceww" (List.max [1.0M;2.0M;3.0M] = 3.0M)
+        do test "ceijoe9cewe" (List.max [3.0M;2.0M;1.0M] = 3.0M)
+end
+
+
+module Pow = begin
+        do test "cnod90km1" (pown 2.0 -3 = 0.125)
+        do test "cnod90km2" (pown 2.0 -2 = 0.25)
+        do test "cnod90km3" (pown 2.0 -1 = 0.5)
+        do test "cnod90km4" (pown 2.0 0 = 1.0)
+        do test "cnod90km5" (pown 2.0 1 = 2.0)
+        do test "cnod90km6" (pown 2.0 2 = 4.0)
+        do test "cnod90km7" (pown 2.0 3 = 8.0)
+        do test "cnod90km8" (pown 2.0 4 = 16.0)
+        do test "cnod90km9" (pown 2.0 5 = 32.0)
+
+        do for exp in -5 .. 5 do 
+             test "cnod90kma" (pown 0.5 exp = 0.5 ** float exp);
+             test "cnod90kmb" (pown 1.0 exp = 1.0 ** float exp);
+             test "cnod90kmc" (pown 2.0 exp = 2.0 ** float exp);
+             test "cnod90kmd" (pown 3.0 exp = 3.0 ** float exp)
+           done
+
+        do for exp in [ 5 .. -1 .. -5 ] @ [System.Int32.MinValue;System.Int32.MaxValue] do 
+               // check powers of 0
+               printfn "exp = %d" exp;
+               test "cnod90kme" (pown 0.0f exp = (if exp = 0 then 1.0f else if exp < 0 then infinityf else 0.0f));
+               test "cnod90kmf" (pown 0.0 exp = (if exp = 0 then 1.0 else if exp < 0 then infinity else 0.0));
+               if exp >= 0 then (
+                   test "cnod90kmg" (pown 0 exp = (if exp = 0 then 1 else 0));
+                   test "cnod90kmh" (pown 0u exp = (if exp = 0 then 1u else 0u));
+                   test "cnod90kmi" (pown 0us exp = (if exp = 0 then 1us else 0us));
+                   test "cnod90kmj" (pown 0s exp = (if exp = 0 then 1s else 0s));
+                   test "cnod90kmk" (pown 0L exp = (if exp = 0 then 1L else 0L));
+                   test "cnod90kml" (pown 0UL exp = (if exp = 0 then 1UL else 0UL));
+                   test "cnod90kmm" (pown 0n exp = (if exp = 0 then 1n else 0n));
+                   test "cnod90kmn" (pown 0un exp = (if exp = 0 then 1un else 0un));
+                   test "cnod90kmo" (pown 0y exp = (if exp = 0 then 1y else 0y));
+                   test "cnod90kmp" (pown 0uy exp = (if exp = 0 then 1uy else 0uy));
+                   test "cnod90kmq" (pown 0M exp = (if exp = 0 then 1M else 0M));
+               ) else (
+                   test "cnod90kmgE" (try pown 0 exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmhE" (try pown 0u exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmiE" (try pown 0us exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmjE" (try pown 0s exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmE" (try pown 0L exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmhE" (try pown 0UL exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmtE" (try pown 0n exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmhrE" (try pown 0un exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmheE" (try pown 0y exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmhfrE" (try pown 0uy exp; false with :? System.DivideByZeroException -> true);
+                   test "cnod90kmhvreE" (try pown 0M exp; false with :? System.DivideByZeroException -> true);
+               );
+               
+               // check powerrs of -1
+               test "cnod90kmr" (pown -1.0f exp = (if exp % 2 = 0 then 1.0f else -1.0f));
+               test "cnod90kms" (pown -1.0 exp = (if exp % 2 = 0 then 1.0 else -1.0));
+               test "cnod90kmt" (pown -1.0M exp = (if exp % 2 = 0 then 1.0M else -1.0M));
+               test "cnod90kmu" (pown -1 exp = (if exp % 2 = 0 then 1 else -1));
+               test "cnod90kmv" (pown -1L exp = (if exp % 2 = 0 then 1L else -1L));
+               test "cnod90kmw" (pown -1s exp = (if exp % 2 = 0 then 1s else -1s));
+               test "cnod90kmx" (pown -1y exp = (if exp % 2 = 0 then 1y else -1y));
+               test "cnod90kmy" (pown -1n exp = (if exp % 2 = 0 then 1n else -1n));
+               test "cnod90kmz" (pown 1.0f exp = 1.0f);
+               test "cnod90kmaa" (pown 1.0 exp = 1.0)
+           done
+
+        do for baseIdx in [-5 .. 5]  do 
+               // check x^0
+               test "cnod90kmbb2" (pown (float32 baseIdx) 0 = 1.0f);
+               test "cnod90kmcc2" (pown (float baseIdx) 0 = 1.0);
+               test "cnod90kmcc3" (pown (decimal baseIdx) 0 = 1M);
+               test "cnod90kmcc4" (pown (nativeint baseIdx) 0 = 1n);
+               test "cnod90kmcc5" (pown (unativeint baseIdx) 0 = 1un);
+               test "cnod90kmcc6" (pown (int64 baseIdx) 0 = 1L);
+               test "cnod90kmcc7" (pown (uint64 baseIdx) 0 = 1UL);
+               test "cnod90kmcc8" (pown (int32 baseIdx) 0 = 1);
+               test "cnod90kmcc9" (pown (uint32 baseIdx) 0 = 1u);
+               test "cnod90kmcca" (pown (int16 baseIdx) 0 = 1s);
+               test "cnod90kmccs" (pown (uint16 baseIdx) 0 = 1us);
+               test "cnod90kmccd" (pown (byte baseIdx) 0 = 1uy);
+               test "cnod90kmccf" (pown (sbyte baseIdx) 0 = 1y);
+
+               // check x^1
+               test "cnod90kmbb21" (pown (float32 baseIdx) 1 = (float32 baseIdx));
+               test "cnod90kmbb22" (pown (decimal baseIdx) 1 = (decimal baseIdx));
+               test "cnod90kmbb23" (pown (nativeint baseIdx) 1 = (nativeint baseIdx));
+               test "cnod90kmbb24" (pown (float baseIdx) 1 = (float baseIdx));
+               test "cnod90kmbb25" (pown (unativeint baseIdx) 1 = (unativeint baseIdx));
+               test "cnod90kmbb26" (pown (int64 baseIdx) 1 = (int64 baseIdx));
+               test "cnod90kmbb27" (pown (uint64 baseIdx) 1 = (uint64 baseIdx));
+               test "cnod90kmbb28" (pown (uint16 baseIdx) 1 = (uint16 baseIdx));
+               test "cnod90kmbb29" (pown (int16 baseIdx) 1 = (int16 baseIdx));
+               test "cnod90kmbb2q" (pown (byte baseIdx) 1 = (byte baseIdx));
+               test "cnod90kmbb2w" (pown (sbyte baseIdx) 1 = (sbyte baseIdx));
+               
+               // check x^2
+               test "cnod90kmbb11" (pown (float32 baseIdx) 2 = (float32 baseIdx) * (float32 baseIdx));
+               test "cnod90kmbb12" (pown (decimal baseIdx) 2 = (decimal baseIdx) * (decimal baseIdx));
+               test "cnod90kmbb13" (pown (nativeint baseIdx) 2 = (nativeint baseIdx) * (nativeint baseIdx));
+               test "cnod90kmbb14" (pown (float baseIdx) 2 = (float baseIdx) * (float baseIdx));
+               test "cnod90kmbb16" (pown (int64 baseIdx) 2 = (int64 baseIdx) * (int64 baseIdx));
+               test "cnod90kmbb19" (pown (int16 baseIdx) 2 = (int16 baseIdx) * (int16 baseIdx));
+               test "cnod90kmbb1b" (pown (sbyte baseIdx) 2 = (sbyte baseIdx) * (sbyte baseIdx));
+               if baseIdx >= 0 then  (
+                   test "cnod90kmbb15" (pown (unativeint baseIdx) 2 = (unativeint baseIdx) * (unativeint baseIdx));
+                   test "cnod90kmbb17" (pown (uint64 baseIdx) 2 = (uint64 baseIdx) * (uint64 baseIdx));
+                   test "cnod90kmbb18" (pown (uint16 baseIdx) 2 = (uint16 baseIdx) * (uint16 baseIdx));
+                   test "cnod90kmbb1a" (pown (byte baseIdx) 2 = (byte baseIdx) * (byte baseIdx));
+               )
+           done
+end
+
+module TakeUntilSkipWhile = begin
+
+    do test "oewvjrrovvr1" ([ ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ ])
+    do test "oewvjrrovvr2" ([ 1 ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ 1 ])
+    do test "oewvjrrovvr3" ([ 1;2;3;4;5 ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ 1..5 ])
+    do test "oewvjrrovvr4" ([ 1;2;3;4;5;6 ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ 1..5 ])
+    do test "oewvjrrovvr5" ([ 1;2;3;4;5;6;7 ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ 1..5 ])
+    do test "oewvjrrovvr6" ([ 1;2;3;4;5;6;5;4;3;2;1 ] |> Seq.takeWhile (fun x -> x <= 5) |> Seq.toList = [ 1..5 ])
+
+    do test "oewvjrrovvr7" ([ 1;2;3;4;5 ] |> Seq.skipWhile (fun x -> x <= 5) |> Seq.toList = [  ])
+    do test "oewvjrrovvr8" ([ 1;2;3;4;5;6 ] |> Seq.skipWhile (fun x -> x <= 5) |> Seq.toList = [ 6 ])
+    do test "oewvjrrovvr9" ([ 1;2;3;4;5;6;7 ] |> Seq.skipWhile (fun x -> x <= 5) |> Seq.toList = [ 6;7 ])
+    do test "oewvjrrovvra" ([ 1;2;3;4;5;6;5;4;3;2;1 ] |> Seq.skipWhile (fun x -> x <= 5) |> Seq.toList = [ 6;5;4;3;2;1 ])
+
+end
+
+
+(*---------------------------------------------------------------------------
+!* Infinite data structure tests
+ *--------------------------------------------------------------------------- *)
+
+(*
+type ilist = Cons of int * ilist
+
+let test () = let rec list = Cons (1,list)  in list
+
+let test2 () = let rec list2 = (1 :: list2)  in list2
+let pri2 s l = printString s; printString ": "; List.iter printInt l; printNewLine ()
+let _ = pri2 "infinite list" (test2())
+
+let pri3 s l = printString s; printString ": "; List.iter printInt l; printNewLine ()
+let test3 () = let rec list3 = (1 :: list4) and list4 = 2::list3  in list3
+let _ = pri3 "infinite list" (test3())
+*
+type r4 = { cells: r4 list; tag: int }
+
+let rec pri4a x  =  printInt x.tag; pri4b x.cells
+and pri4b l = iter pri4a l
+
+let test4 () = 
+  let rec r1 = { cells = list3; tag = 1} 
+  and  r2 = { cells = list4; tag = 2} 
+  and list3 = r2 :: list4
+  and list4 = r1::list3  in
+  r1
+
+let _ = pri4a(test4())
+*)
+
+
+(*---------------------------------------------------------------------------
+!* Perf tests
+ *--------------------------------------------------------------------------- *)
+
+
+let listtest1 () = 
+  let pri2 s l = printString s; printString ": "; List.iter printInt l; printNewLine () in 
+  let r = ref [] in 
+  for i = 1 to 100 do
+    r := i :: !r;
+    for j = 1 to 100 do
+      let _ = List.rev !r  in ()
+    done;
+  done;
+  pri2 "list: " !r
+
+let _ = listtest1()
+
+(*
+let pri s l = printString s; printString ": "; List.iter printInt l; printNewLine ()
+  let irev (l : int list) = 
+   let res = ref [] in 
+   let curr = ref l in 
+   while (match curr.contents with [] -> false | _ -> true) do
+     match curr.contents with 
+       (h::t) -> res.contents <- h :: !res; curr.contents <- t;
+   done;
+   !res
+let r = ref [] 
+let _ = 
+  for i = 1 to 100 do
+    r := i :: r.contents;
+    for j = 1 to 100 do
+      let _ = irev r.contents in ()
+    done;
+  done
+let _ = pri "list: " r.contents
+*)
+
+   
+(*
+let pri s l = printString s; printString ": "; List.iter printInt l; printNewLine ()
+type iiref= { mutable icontents: int list}
+let iiref x = { icontents = x }
+let (!!!!) r = r.icontents
+let (<--) r  x = r.icontents <- x
+
+let irev l = 
+   let res = iiref [] in 
+   let curr = iiref l in 
+   while (match !!!!curr with [] -> false | _ -> true) do
+     match !!!!curr with 
+       (h::t) -> res <-- h :: !!!!res; curr <-- t;
+   done;
+   !!!!res
+
+let r = iiref []
+let test() = 
+  for i = 1 to 600 do
+    r <-- i :: !!!!r;
+    for j = 1 to 600 do
+      let _ = irev !!!!r in ()
+    done;
+  done
+let _ = test()
+let _ = pri "list: "  !!!!r
+*)
+
+
+(*
+type ilist = Nil | Cons of int * ilist
+let rec iiter f = function Nil -> () | Cons (h,t) -> (f h; iiter f t)
+let pri s l = printString s; printString ": "; iiter printInt l; printNewLine ()
+type iref= { mutable icontents: ilist}
+let iref x = { icontents = x }
+let (!!!!) r = r.icontents
+let (<--) r  x = r.icontents <- x
+
+let irev l = 
+   let res = iref Nil in 
+   let curr = iref l in 
+   while (match !!!!curr with Nil -> false | _ -> true) do
+     match !!!!curr with 
+       Cons(h,t) -> res <-- Cons (h, !!!!res); curr <-- t;
+   done;
+   !!!!res
+
+let r = iref Nil
+let test() = 
+  for i = 1 to 600 do
+    r <-- Cons (i,!!!!r);
+    for j = 1 to 600 do
+      let _ = irev !!!!r in ()
+    done;
+  done
+let _ = test()
+let _ = pri "list: "  !!!!r
+*)
+
+(*
+type flist = Nil | Cons of float * flist
+let rec fiter f = function Nil -> () | Cons (h,t) -> (f h; fiter f t)
+let pri s l = printString s; printString ": "; fiter print_float l; printNewLine ()
+type fref= { mutable fcontents: flist}
+let fref x = { fcontents = x }
+let (!!!!) r = r.fcontents
+let (<--) r  x = r.fcontents <- x
+
+let frev l = 
+   let res = fref Nil in 
+   let curr = fref l in 
+   while (match !!!!curr with Nil -> false | _ -> true) do
+     match !!!!curr with 
+       Cons(h,t) -> res <-- Cons (h, !!!!res); curr <-- t;
+   done;
+   !!!!res
+
+let r = fref Nil
+let test() = 
+  for i = 1 to 600 do
+    r <-- Cons (float i,!!!!r);
+    for j = 1 to 600 do
+      let _ = frev !!!!r in ()
+    done;
+  done
+let _ = test()
+let _ = pri "list: "  !!!!r
+*)
+
+
+(* let rec not_inlined b = if b then not_inlined false else b *)
+let not_inlined x = x
+let inlined (x1:int) (x2:int) (x3:int) (x4:int) (x5:int) = 
+  let not_eliminated = not_inlined 1 in 
+  let not_eliminated2 = not_inlined 2 in 
+  not_eliminated
+let test2() = 
+  let eliminated_to_value = inlined 1 1 1 1 1 in 
+  let not_eliminated = not_inlined 2 in 
+  eliminated_to_value
+
+let _ = test2()
+
+let ldexp22 (x:float) (n:int) = x * (2.0 ** float n)
+
+(*
+let rec fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
+let rec for_all : ('a -> bool) -> 'a list -> bool
+let rec exists : ('a -> bool) -> 'a list -> bool
+let rec for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
+let rec exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
+let rec mem : 'a -> 'a list -> bool
+let rec memq : 'a -> 'a list -> bool
+let rec find : ('a -> bool) -> 'a list -> 'a
+let rec filter : ('a -> bool) -> 'a list -> 'a list
+let rec find_all : ('a -> bool) -> 'a list -> 'a list
+let rec partition : ('a -> bool) -> 'a list -> 'a list * 'a list
+let rec assoc : 'a -> ('a * 'b) list -> 'b
+let rec assq : 'a -> ('a * 'b) list -> 'b
+let rec mem_assoc : 'a -> ('a * 'b) list -> bool
+let rec mem_assq : 'a -> ('a * 'b) list -> bool
+let rec remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
+let rec remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
+let rec split : ('a * 'b) list -> 'a list * 'b list
+let rec combine : 'a list -> 'b list -> ('a * 'b) list
+let rec sort : ('a -> 'a -> int) -> 'a list -> 'a list
+let rec stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
+*)
+
+let g x = match x with 2.0  -> 3.0
+
+let _ = g 2.0
+let _ = g (1.0 + 1.0)
+
+
+type u16 = U16 of int 
+type i32 = I32 of int32 
+type bytes = Bytes of string
+
+type assembly_name = string (* uses exact comparisons.  TODO: ECMA Partition 2 is inconsistent about this. *)
+type module_name = string (* uses exact comparisons. TODO: ECMA Partition 2 is inconsistent about this. *)
+type locale = (* should use case-insensitive comparison *)
+  | Locale_bytes of bytes (* unicode *)
+  | Locale_string of string
+
+type assembly_ref = 
+    { assemRefName: assembly_name;
+      assemRefHash: bytes option;
+      (* Note: only one of the following two are ever present. *)
+      assemRefPublicKeyToken: bytes option; 
+      assemRefPublicKey: bytes option;
+      assemRefVersion: (i32 * i32 * i32 * i32) option;
+      assemRefLocale: locale option } 
+
+type modul_ref = 
+    { modulRefName: module_name;
+      modulRefNoMetadata: bool; (* only for file references *)
+      modulRefHash: bytes option; (* only for file references *)
+    }
+
+type scope_ref = 
+  | ScopeRef of assembly_ref * modul_ref option 
+
+(* TODO: check the array types that are relevant for binding etc. *)
+type array_bounds =  ((i32 * i32 option) list) option
+type type_ref = 
+  | TypeRef of (scope_ref * string list * string)
+  | TypeRef_array of array_bounds * bool
+
+type typ = 
+  | Type_void                   (* -- Used only in return and pointer types. *)
+  | Type_value of type_spec      (* -- Unboxed types, including built-in types. *)
+  | Type_boxed of type_spec      (* -- Nb. used for both boxed value classes *)
+                                (*    and classes. *)
+  | Type_ptr of typ             (* -- Unmanaged pointers.  Nb. the type is *)
+                                (*    effectively for tools and for binding *)
+                                (*    only, not by the verifier. *)
+  | Type_byref of typ           (* -- Managed pointers. *)
+  | Type_typedref
+  | Type_fptr of callsig (* -- Code pointers. *)
+  | Type_modified of            (* -- Custom modifiers. *)
+        bool *                  (*   -- True if modifier is "required" *)
+        typ *                   (*   -- the class of the custom modifier *)
+        typ                     (*   -- the type being modified *)
+
+(* MS-ILX *) | Type_unit                      (* -- empty value *)
+(* MS-ILX *) | Type_forall of genparam * typ (* -- indexed outside-in *) 
+(* MS-ILX *) | Type_tyvar of u16              (* -- reference a generic arg *)
+(* MS-ILX *) | Type_tyrepvar of u16   
+(* MS-ILX *) | Type_func of typ list * typ  
+
+and type_spec = TypeSpec of type_ref (* MS-ILX *) * genactuals
+and callsig =  Callsig of callconv * typ list * typ  
+
+(* MS-ILX *) (* ----------------------------------------------------------
+(* MS-ILX *)  * Generic parameters, i.e. parameters reified statically. 
+(* MS-ILX *)  * Currently only two kinds of parameters are supported in  
+(* MS-ILX *)  * the term structure: types and type representations. 
+(* MS-ILX *)  * Type representations are only used internally.
+(* MS-ILX *)  * --------------------------------------------------------- *)
+(* MS-ILX *) 
+(* MS-ILX *) and genparams = genparam list
+(* MS-ILX *) and genactuals = genactual list
+(* MS-ILX *) and genactual = 
+(* MS-ILX *)   | GenActual_type of typ
+(* MS-ILX *)   | GenActual_tyrep of typ
+(* MS-ILX *) and genparam = 
+(* MS-ILX *)   | GenFormal_type
+(* MS-ILX *)   | GenFormal_tyrep of exn  
+(* MS-ILX *)          (* For internal use only. *)                       
+(* MS-ILX *)          (* We use exn as an annotation here. *)            
+(* MS-ILX *)          (* Types are still used as actuals for type-reps *)
+
+
+(* --------------------------------------------------------------------
+!* Calling conventions.  These are used in method pointer types.
+ * -------------------------------------------------------------------- *)
+
+and bcallconv = 
+  | CC_cdecl 
+  | CC_stdcall 
+  | CC_thiscall 
+  | CC_fastcall 
+  | CC_default
+  | CC_vararg
+      
+and hasthis = 
+  | CC_instance
+  | CC_instance_explicit
+  | CC_static
+
+and callconv = Callconv of hasthis * bcallconv
+
+let mk_empty_gactuals = ([]: genactuals)
+let mk_mono_tspec tref =  TypeSpec (tref, mk_empty_gactuals)
+let mscorlib_assembly_name =  "mscorlib"
+let mscorlib_module_name =  "CommonLanguageRuntimeLibrary"
+let mk_simple_assref n = 
+  { assemRefName=n;
+    assemRefHash=None;
+    assemRefPublicKeyToken=None;
+    assemRefPublicKey=None;
+    assemRefVersion=None;
+    assemRefLocale=None; } 
+let mscorlib_aref = mk_simple_assref mscorlib_assembly_name
+let mscorlib_scoref = ScopeRef(mscorlib_aref,None)
+let mk_nested_tref (scope,l,nm) =  TypeRef (scope,l,nm)
+let mk_tref (scope,nm) =  mk_nested_tref (scope,[],nm)
+
+let tname_Object1 = "System.Object"
+let tref_Object1 = mk_tref (mscorlib_scoref,tname_Object1)
+let tspec_Object1 = mk_mono_tspec tref_Object1
+let typ_Object1 = Type_boxed tspec_Object1
+
+let tname_Object2 = "System.Object"
+let tref_Object2 = mk_tref (mscorlib_scoref,tname_Object2)
+let tspec_Object2 = mk_mono_tspec tref_Object2
+let typ_Object2 = Type_boxed tspec_Object2
+
+
+
+let _ = printString "advanced equality test (1): "; if tname_Object1 = tname_Object2 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "advanced equality test (9): "; if (mscorlib_scoref,[],tname_Object1) =(mscorlib_scoref,[],tname_Object2)  then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "advanced equality test (10): "; if tref_Object1 = tref_Object2 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "advanced equality test (11): "; if typ_Object1 = typ_Object2 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+let _ = printString "array equality test (1): "; if [| 1 |] = [| 1 |] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "arr equality test (4): "; if [| |]  = [| |] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+let _ = printString "arr hash-respects-equality test (4): "; if hash [| |] = hash [| |] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+let _ = printString "array equality test (1): "; if [| 1 |] = [| 1 |] then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+
+(*
+let  f x = 
+   let g a b c d = (a=1) && (b = 2) && (c = 3) && (d = 4) && (x = 5) in 
+   let bigcheck h (a:int) (b:int) (c:int) (d:int) = 
+      h a b c d && 
+      h a b c d && 
+      (let f1 = h a in 
+       let f2 = f1 b in 
+       let f3 = f2 c in 
+        f3 d) && 
+      (let f1 = h a b in 
+       let f2 = f1 c in 
+        f2 d) && 
+      (let f1 = h a b c in 
+        f1 d) && 
+      (let f1 = h a in 
+       let f2 = f1 b c in 
+        f2 d) && 
+      (let f1 = h a in 
+       let f2 = f1 b in 
+        f2 c d) && 
+      (let f1 = h a b in 
+        f1 c d) && 
+      (let f1 = h a in 
+        f1 b c d) in  
+   bigcheck g 1 2 3 4
+
+let _ = if (f 5) then  stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+
+let sort_test cmp ans = 
+  for i0 = 0 to 5 do 
+    for i1 = 0 to 5 do 
+      for i2 = 0 to 5 do
+        for i3 = 0 to 5 do
+          for i4 = 0 to 5 do
+            for i5 = 0 to 5 do
+              if i0 <> i1 && i0 <> i2 && i0 <> i3 && i0 <> i4 && i0 <> i5 &
+               i1 <> i2 && i1 <> i3 && i1 <> i4 && i1 <> i5 &
+               i2 <> i3 && i2 <> i4 && i2 <> i5 &
+               i3 <> i4 && i3 <> i5 &
+               i4 <> i5 then 
+              let a = Array.create 6 0 in
+              a.(i0) <- 0;
+              a.(i1) <- 1;
+              a.(i2) <- 2;
+              a.(i3) <- 3;
+              a.(i4) <- 4;
+              a.(i5) <- 5;
+              (* list sort *)
+              let l = Array.toList a in 
+              let res = List.sortWith cmp l in
+              if (res<> ans) then begin
+                let printInt n = printString (string_of_int n) in
+                printString "List.sort ";
+                printInt a.(0);
+                printInt a.[1];
+                printInt a.[2];
+                printInt a.(3);
+                printInt a.(4);
+                printInt a.(5);
+                printString " = ";
+                let resa = Array.ofList res in 
+                printInt resa.(i0);
+                printInt resa.(i1);
+                printInt resa.(i2);
+                printInt resa.(i3);
+                printInt resa.(i4);
+                printInt resa.(i5);
+                reportFailure "unlabelled test"
+              end;
+              (* array sort *)
+              let resa = Array.copy a in
+              Array.sortInPlaceWith cmp resa; (* mutates resa array *)
+              let res = Array.toList resa in
+              if (res<> ans) then begin
+                let printInt n = printString (string_of_int n) in
+                printString "Array.sort ";
+                printInt a.(0);
+                printInt a.[1];
+                printInt a.[2];
+                printInt a.(3);
+                printInt a.(4);
+                printInt a.(5);
+                printString " = ";
+                (* recall Array.list_of resa = res *)
+                printInt resa.(i0);
+                printInt resa.(i1);
+                printInt resa.(i2);
+                printInt resa.(i3);
+                printInt resa.(i4);
+                printInt resa.(i5);
+                reportFailure "unlabelled test"
+              end
+          done;
+        done;
+      done;
+    done;
+    done;
+  done
+  
+let _ = sort_test compare [0;1;2;3;4;5]
+let _ = sort_test (fun x y -> -(compare x y)) [5;4;3;2;1;0]
+*)
+module StrangeOperatorTest = begin
+  let (&&&) x y = x^y
+  let (<<<) (x:string) (y:string) = x ^y^x
+
+  let e1 = ("0" &&& ("1" <<< "2"))
+  let e2= (("0" &&& "1") <<< "2") 
+  let e3= ("0" &&& "1" <<< "2") 
+
+  let _ = if (e1 <> e2) then stderr.WriteLine "Control Passed" else stderr.WriteLine "Control Failed"
+  let _ = if (e1 = e3) then (stderr.WriteLine "Parsed to Right!  Wrong!" ; reportFailure "parsing")
+  let _ = if (e2 = e3) then stderr.WriteLine "Parsed to Left - correct!" 
+
+end
+
+//let _ = if (3 then do ignore(4)) = 3 then stderr.WriteLine "OK!" else (stderr.WriteLine "Wrong!" ; reportFailure "unlabelled test")
+//let _ = let x = ref 1 in if (!x then do x := !x + 1) = 1 then stderr.WriteLine "OK!" else (stderr.WriteLine "Wrong!" ; reportFailure "unlabelled test")
+
+
+(* Check codegen for using functions of type (unit -> _) as first class values. *)
+let _ = List.map printNewLine [(); (); ()]
+
+(* Check codegen for tail recursive functions with argument and return types involving "unit" *)
+let rec  unitElimTailRecursion1() = stdout.WriteLine "loop"; (unitElimTailRecursion1() : string)
+let rec  unitElimTailRecursion2((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion2((),()) : string)
+let rec  unitElimTailRecursion3() = stdout.WriteLine "loop"; (unitElimTailRecursion3() : unit)
+let rec  unitElimTailRecursion4((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion4((),()) : unit)
+let rec  unitElimTailRecursion5() = stdout.WriteLine "loop"; (unitElimTailRecursion5() : 'a)
+let rec  unitElimTailRecursion6((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion6((),()) : 'a)
+
+(* Check codegen for inner tail recursive functions with argument and return types involving "unit". *)
+let innerUnitElimTailRecursion1 () = 
+  let rec  unitElimTailRecursion1() = stdout.WriteLine "loop"; (unitElimTailRecursion1() : string) in 
+  let rec  unitElimTailRecursion2((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion2((),()) : string) in
+  let rec  unitElimTailRecursion3() = stdout.WriteLine "loop"; (unitElimTailRecursion3() : unit) in
+  let rec  unitElimTailRecursion4((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion4((),()) : unit) in 
+  let rec  unitElimTailRecursion5() = stdout.WriteLine "loop"; (unitElimTailRecursion5() : 'a) in 
+  let rec  unitElimTailRecursion6((),()) = stdout.WriteLine "loop"; (unitElimTailRecursion6((),()) : 'a) in 
+  (unitElimTailRecursion1, unitElimTailRecursion2, unitElimTailRecursion3, unitElimTailRecursion4, unitElimTailRecursion5, unitElimTailRecursion6)
+
+(* Check codegen for tail recursive functions with argument types involving " int * int" *)
+let rec  tupleElimTailRecursion1((x:int), (y:int)) = stdout.WriteLine "loop"; (tupleElimTailRecursion1(x,y) : string)
+let rec  tupleElimTailRecursion2((x1:int), (y1:int)) ((x2:int), (y2:int)) = stdout.WriteLine "loop"; (tupleElimTailRecursion2(x2,y2) (x1,y1) : string)
+
+let innerTupleElimTailRecursion1 () = 
+  let rec  tupleElimTailRecursion1((x:int), (y:int)) = stdout.WriteLine "loop"; (tupleElimTailRecursion1(x,y) : string) in 
+  let rec  tupleElimTailRecursion2((x1:int), (y1:int)) ((x2:int), (y2:int)) = stdout.WriteLine "loop"; (tupleElimTailRecursion2(x2,y2) (x1,y1) : string) in 
+  tupleElimTailRecursion1, tupleElimTailRecursion2
+
+let test3d9cw90 () = 
+  let set = (Set.add 1 (Set.add 0 (Set.add 1 (Set.add 5 (Set.add 4 (Set.add 3 Set.empty)))))) in 
+  let i = (set :> seq<_>).GetEnumerator() in 
+  check "set iterator" true  (i.MoveNext());
+  check "set iterator" 0  i.Current;
+  check "set iterator" true  (i.MoveNext());
+  check "set iterator" 1  i.Current;
+  check "set iterator" true  (i.MoveNext());
+  check "set iterator" 3  i.Current;
+  check "set iterator" true  (i.MoveNext());
+  check "set iterator" 4  i.Current;
+  check "set iterator" true  (i.MoveNext());
+  check "set iterator" 5  i.Current;
+  check "set iterator" false  (i.MoveNext())
+
+do test3d9cw90 ()
+
+do check "set comparison" 0 ((Seq.compareWith Operators.compare) Set.empty Set.empty)
+do check "set comparison" 0   ((Seq.compareWith Operators.compare) (Set.add 1 Set.empty) (Set.add 1 Set.empty))
+do check "set comparison" 0   ((Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 Set.empty)) (Set.add 2 (Set.add 1 Set.empty)))
+do check "set comparison" 0   ((Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 (Set.add 3 Set.empty))) (Set.add 3 (Set.add 2 (Set.add 1 Set.empty))))
+   
+   
+do check "set comparison" (-1) ((Seq.compareWith Operators.compare) Set.empty (Set.add 1 Set.empty))
+do check "set comparison" (-1)  ((Seq.compareWith Operators.compare) (Set.add 1 Set.empty) (Set.add 2 Set.empty))
+do check "set comparison" (-1)  ((Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 Set.empty)) (Set.add 3 (Set.add 1 Set.empty)))
+do check "set comparison" (-1)  ((Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 (Set.add 3 Set.empty))) (Set.add 4 (Set.add 2 (Set.add 1 Set.empty))))
+
+let checkReflexive f x y = (f x y = - f y x)
+
+do check "set comparison" true (checkReflexive (Seq.compareWith Operators.compare) Set.empty (Set.add 1 Set.empty))
+do check "set comparison" true (checkReflexive (Seq.compareWith Operators.compare) (Set.add 1 Set.empty) (Set.add 2 Set.empty))
+do check "set comparison" true (checkReflexive (Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 Set.empty)) (Set.add 3 (Set.add 1 Set.empty)))
+do check "set comparison" true (checkReflexive (Seq.compareWith Operators.compare) (Set.add 1 (Set.add 2 (Set.add 3 Set.empty))) (Set.add 4 (Set.add 2 (Set.add 1 Set.empty))))
+
+
+
+
+(*================================================================================*)
+    
+(* Set ordering - tests *)
+                 
+let rec nlist i n =
+  if n=0 then [] else
+  if n % 2 = 1 then i :: nlist (i+1) (n / 2)
+               else      nlist (i+1) (n / 2)
+
+let orderTest n m =
+    //printf "Check sorted-list order against ordered-set order: n=%-10d m=%-10d\n" n m;
+    let nL = nlist 0 n in
+    let nS = Set.ofList nL in
+    let mL = nlist 0 m in
+    let mS = Set.ofList mL in
+    test "vwnwer" (compare nL mL = Seq.compareWith Operators.compare nS mS)
+
+let nMax = 4096 * 4096
+let ran = new System.Random()  
+let testOrder() = orderTest (ran.Next(nMax)) (ran.Next(nMax))
+do  for i = 1 to 1000 do testOrder() done
+  
+(*================================================================================*)  
+
+
+
+
+(*
+let test2398985() = 
+  let l = ReadonlyArray.ofList [1;2;3] in
+  let res = ref 2 in 
+  for i in ReadonlyArray.toSeq l do res := !res + i done;
+  check "test2398985: ReadonlyArray.toSeq" 8 !res
+
+do test2398985()
+*)
+
+let test2398986() = 
+  let l = Array.ofList [1;2;3] in
+  let res = ref 2 in 
+  for i in Array.toSeq l do res := !res + i done;
+  check "test2398986: Array.toSeq" 8 !res
+
+do test2398986()
+
+let test2398987() = 
+  let l = Set.ofList [1;2;3] in
+  let res = ref 2 in 
+  for i in Set.toSeq l do res := !res + i done;
+  check "test2398987: Idioms.foreach, Set.toSeq" 8 !res
+
+do test2398987()
+
+let test2398987b() = 
+  let l = Set.ofList [1;2;3] in
+  let res = ref 2 in 
+  for i in l do res := !res + i done;
+  check "test2398987: Idioms.foreach, Set.toSeq" 8 !res
+
+do test2398987b()
+
+
+(*---------------------------------------------------------------------------
+!* foreachG/to_seq
+ *--------------------------------------------------------------------------- *)
+
+
+
+let foreach e f = Seq.iter f e
+let test2398993() = 
+  let l = [1;2;3] in
+  let res = ref 2 in 
+  foreach (List.toSeq l) (fun i -> res := !res + i);
+  check "test2398993: foreach, List.toSeq" 8 !res
+
+do test2398993()
+
+(*
+let test2398995() = 
+  let l = ReadonlyArray.ofList [1;2;3] in
+  let res = ref 2 in 
+  foreach (ReadonlyArray.toSeq l) (fun i -> res := !res + i);
+  check "test2398995: foreach, ReadonlyArray.toSeq" 8 !res
+
+do test2398995()
+*)
+
+let test2398996() = 
+  let l = Array.ofList [1;2;3] in
+  let res = ref 2 in 
+  foreach (Array.toSeq l) (fun i -> res := !res + i);
+  check "test2398996: foreach, Array.toSeq" 8 !res
+
+do test2398996()
+
+let test2398997() = 
+  let l = Set.ofList [1;2;3] in
+  let res = ref 2 in 
+  foreach (Set.toSeq l) (fun i -> res := !res + i);
+  check "test2398997: foreach, Set.toSeq" 8 !res
+
+do test2398997()
+
+
+(*---------------------------------------------------------------------------
+!* Generic formatting
+ *--------------------------------------------------------------------------- *)
+
+// See FSHARP1.0:4797
+// On NetFx4.0 and above we do not emit the 'I' suffix
+let bigintsuffix = if (System.Environment.Version.Major, System.Environment.Version.Minor) > (2,0) then "" else "I"
+
+do check "generic format 1"  "[1; 2]" (sprintf "%A" [1;2])
+do check "generic format 2"  "Some [1; 2]" (sprintf "%A" (Some [1;2]))
+do check "generic format a"  "1y" (sprintf "%A" 1y)
+do check "generic format b"  "1uy" (sprintf "%A" 1uy)
+do check "generic format c"  "1s" (sprintf "%A" 1s)
+do check "generic format d"  "1us" (sprintf "%A" 1us)
+do check "generic format e"  "1" (sprintf "%A" 1)
+do check "generic format f"  "1u" (sprintf "%A" 1ul)
+do check "generic format g"  "1L" (sprintf "%A" 1L)
+do check "generic format i"  ("1" + bigintsuffix) (sprintf "%A" 1I)
+do check "generic format j"  "1.0" (sprintf "%A" 1.0)
+do check "generic format k"  "1.01" (sprintf "%A" 1.01)
+do check "generic format l"  "1000.0" (sprintf "%A" 1000.0)
+
+do check "generic format m"  "-1y" (sprintf "%A" (-1y))
+do check "generic format n"  "-1s" (sprintf "%A" (-1s))
+do check "generic format o"  "-1" (sprintf "%A" (-1))
+do check "generic format p"  "-1L" (sprintf "%A" (-1L))
+do check "generic format r"  ("-1" + bigintsuffix)  (sprintf "%A" (-1I))
+
+
+(*---------------------------------------------------------------------------
+!* For loop variables can escape
+ *--------------------------------------------------------------------------- *)
+
+do for i = 1 to 10 do List.iter (fun x -> Printf.printf "x = %d\n" x) (List.map (fun x -> x + i) [1;2;3]) done
+
+
+(*---------------------------------------------------------------------------
+!* Type tests
+ *--------------------------------------------------------------------------- *)
+
+do check "type test string" "right" (match box("right") with | :? System.String as s -> s | _ -> "wrong")
+do check "type test string (2)" "right" (match box("right") with| :? System.Int32 -> "wrong"  | :? System.String as s -> s | _ -> "wrong")
+do check "type test int32" "right" (match box(1) with | :? System.String -> "wrong" | :? System.Int32 -> "right" | _ -> "wrong")
+do check "type test int32 (2)" "right" (match box(1) with | :? System.Int32 -> "right" | :? System.String -> "wrong"  | _ -> "wrong")
+do check "type test int32 (3)" 4 (match box(4) with | :? System.Int32 as d -> d | :? System.String -> 3  | _ -> 2)
+do check "type test double" 1.0 (match box(1.0) with | :? System.Int32 -> 3.14 | :? System.Double as d -> d  | _ -> 2.71)
+
+
+
+(*---------------------------------------------------------------------------
+!* type syntax
+ *--------------------------------------------------------------------------- *)
+
+module TypeSyntax = begin
+ let x1  = [Map.add 1 (Map.add 1 1 Map.empty) Map.empty]
+ let x2 : Map<'a,'b> list  = [Map.empty]
+ let x3 : Map<'a,'b> list  = []
+
+end
+
+module IEnumerableTests = begin
+
+  // This one gave a stack overflow when we weren't tail-calling on 64-bit
+  do check "Seq.filter-length" ({ 1 .. 1000000 } |> Seq.filter (fun n -> n <> 1) |> Seq.length) 999999
+  do check "Seq.filter-length" ({ 1 .. 1000000 } |> Seq.filter (fun n -> n = 1) |> Seq.length) 1
+  do check "Seq.filter-length" ({ 1 .. 1000000 } |> Seq.filter (fun n -> n % 2 = 0) |> Seq.length) 500000
+
+  do check "IEnumerableTest.empty-length" (Seq.length Seq.empty) 0
+  do check "IEnumerableTest.length-of-array" (Seq.length [| 1;2;3 |]) 3
+  do check "IEnumerableTest.head-of-array" (Seq.head [| 1;2;3 |]) 1
+  do check "IEnumerableTest.take-0-of-array" (Seq.take 0 [| 1;2;3 |] |> Seq.toList) []
+  do check "IEnumerableTest.take-1-of-array" (Seq.take 1 [| 1;2;3 |] |> Seq.toList) [1]
+  do check "IEnumerableTest.take-3-of-array" (Seq.take 3 [| 1;2;3 |] |> Seq.toList) [1;2;3]
+  do check "IEnumerableTest.nonempty-true" (Seq.isEmpty [| 1;2;3 |]) false
+  do check "IEnumerableTest.nonempty-false" (Seq.isEmpty [| |]) true
+  do check "IEnumerableTest.fold" (Seq.fold (+) 0 [| 1;2;3 |]   ) 6
+  do check "IEnumerableTest.unfold" (Seq.unfold (fun _ -> None) 1 |> Seq.toArray) [| |]
+  do check "IEnumerableTest.unfold" (Seq.unfold (fun x -> if x = 1 then Some("a",2) else  None) 1 |> Seq.toArray) [| "a" |]
+  do check "IEnumerableTest.exists" (Seq.exists ((=) "a") [| |]) false
+  do check "IEnumerableTest.exists" (Seq.exists ((=) "a") [| "a" |]) true
+  do check "IEnumerableTest.exists" (Seq.exists ((=) "a") [| "1"; "a" |]) true
+  do check "IEnumerableTest.exists" (Seq.forall ((=) "a") [| |]) true
+  do check "IEnumerableTest.exists" (Seq.forall ((=) "a") [| "a" |]) true
+  do check "IEnumerableTest.exists" (Seq.forall ((=) "a") [| "1"; "a" |]) false
+  do check "IEnumerableTest.map on finite" ([| "a" |] |> Seq.map (fun x -> x.Length) |> Seq.toArray) [| 1 |]
+  do check "IEnumerableTest.filter on finite" ([| "a";"ab";"a" |] |> Seq.filter (fun x -> x.Length = 1) |> Seq.toArray) [| "a";"a" |]
+  do check "IEnumerableTest.choose on finite" ([| "a";"ab";"a" |] |> Seq.choose (fun x -> if x.Length = 1 then Some(x^"a") else None) |> Seq.toArray) [| "aa";"aa" |]
+  do check "Seq.tryPick on finite (succeeding)" ([| "a";"ab";"a" |] |> Seq.tryPick (fun x -> if x.Length = 1 then Some(x^"a") else None)) (Some "aa")
+  do check "Seq.tryPick on finite (failing)" ([| "a";"ab";"a" |] |> Seq.tryPick (fun x -> if x.Length = 6 then Some(x^"a") else None)) None
+  do check "IEnumerableTest.find on finite (succeeding)" ([| "a";"ab";"a" |] |> Seq.find (fun x -> x.Length = 1)) "a"
+  do check "IEnumerableTest.find on finite (failing)" (try Some ([| "a";"ab";"a" |] |> Seq.find (fun x -> x.Length = 6)) with :? System.Collections.Generic.KeyNotFoundException -> None) None
+  do check "IEnumerableTest.map_with_type (string up to obj,finite)" ([| "a" |] |> Seq.cast |> Seq.toArray) [| ("a" :> obj) |]
+  do check "IEnumerableTest.map_with_type (obj down to string, finite)" ([| ("a" :> obj) |] |> Seq.cast |> Seq.toArray) [| "a" |]
+  do check "IEnumerableTest.append, finite, finite" (Seq.append [| "a" |] [| "b" |]  |> Seq.toArray) [| "a"; "b" |]
+  do check "IEnumerableTest.concat, finite" (Seq.concat [| [| "a" |]; [| |]; [| "b";"c" |] |]  |> Seq.toList) [ "a";"b";"c" ]
+  do check "IEnumerableTest.init_infinite, then take" (Seq.take 2 (Seq.initInfinite (fun i -> i+1)) |> Seq.toList) [ 1;2 ]
+  do check "IEnumerableTest.to_array, empty" (Seq.init 0 (fun i -> i+1) |> Seq.toArray) [|  |]
+  do check "IEnumerableTest.to_array, small" (Seq.init 1 (fun i -> i+1) |> Seq.toArray) [| 1 |]
+  do check "IEnumerableTest.to_array, large" (Seq.init 100000 (fun i -> i+1) |> Seq.toArray |> Array.length) 100000
+  do check "IEnumerableTest.to_array, very large" (Seq.init 1000000 (fun i -> i+1) |> Seq.toArray |> Array.length) 1000000
+  do check "IEnumerableTest.to_list, empty" (Seq.init 0 (fun i -> i+1) |> Seq.toList) [  ]
+  do check "IEnumerableTest.to_list, small" (Seq.init 1 (fun i -> i+1) |> Seq.toList) [ 1 ]
+  do check "IEnumerableTest.to_list, large" (Seq.init 100000 (fun i -> i+1) |> Seq.toList |> List.length) 100000
+  do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> Seq.toList |> List.length) 1000000
+  do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> List.ofSeq |> List.length) 1000000
+  do check "List.unzip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> List.ofSeq |> List.unzip |> fst |> List.length) 1000000
+  let dup x = x,x
+  let uncurry f (x,y) = f x y
+  do check "List.zip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> List.ofSeq |> dup |> uncurry List.zip |> List.length) 1000000
+  
+(*
+  // Currently disabled, since IStructuralEquatable.Equals will cause this to stack overflow around 140000 elements
+  do check "List.sort, large" ((Seq.init 140000 (fun i -> 139999 - i) |> List.ofSeq |> List.sort) = 
+                               (Seq.init 140000 (fun i -> i) |> List.ofSeq |> List.sort))   true
+*)
+
+  
+  do check "Seq.singleton" (Seq.singleton 42 |> Seq.length) 1
+  do check "Seq.singleton" (Seq.singleton 42 |> Seq.toList) [42]
+
+  do check "Seq.truncate" (Seq.truncate 20 [1..100] |> Seq.toList) [1..20]
+  do check "Seq.truncate" (Seq.truncate 1 [1..100] |> Seq.toList) [1]
+  do check "Seq.truncate" (Seq.truncate 0 [1..100] |> Seq.toList) []
+
+  do check "Seq.scan" (Seq.scan (+) 0 [|1..5|] |> Seq.toArray) [|0; 1; 3; 6; 10; 15|]
+  //do check "Seq.scan1" (Seq.scan1 (+) [|1..5|] |> Seq.toArray) [|3; 6; 10; 15|]
+
+  do check "Seq.exists2" (Seq.exists2 (=) [|1; 2; 3; 4; 5; 6|] [|2; 3; 4; 5; 6; 6|]) true
+  do check "Seq.exists2" (Seq.exists2 (=) [|1; 2; 3; 4; 5; 6|] [|2; 3; 4; 5; 6; 7|]) false
+
+  do check "Seq.forall2" (Seq.forall2 (=) [|1..10|] [|1..10|]) true
+  do check "Seq.forall2" (Seq.forall2 (=) [|1;2;3;4;5|] [|1;2;3;0;5|]) false
+
+
+//  do check "Seq.find_index" (Seq.find_index (fun i -> i >= 4) [|0..10|]) 4
+//  do check "Seq.find_index" (try Seq.find_index (fun i -> i >= 20) [|0..10|] |> ignore; false
+//                             with _ -> true) true
+   
+//  do check "Seq.find_indexi" (Seq.find_indexi (=) [|1; 2; 3; 3; 2; 1|]) 3
+//  do check "Seq.find_indexi" (try Seq.find_indexi (=) [|1..10|] |> ignore; false
+//                              with _ -> true) true
+
+  do check "Seq.tryFind" ([|1..100|] |> Seq.tryFind (fun x -> x > 50)) (Some 51)
+  do check "Seq.tryFind" ([|1..100|] |> Seq.tryFind (fun x -> x > 180)) None
+
+//   do check "Seq.tryfind_index" (Seq.tryfind_index (fun x -> x = 4) [|0..10|]) (Some 4)
+//   do check "Seq.tryfind_index" (Seq.tryfind_index (fun x -> x = 42) [|0..10|]) None
+
+//   do check "Seq.tryfind_indexi" (Seq.tryfind_indexi (=) [|1;2;3;4;4;3;2;1|]) (Some 4)
+//   do check "Seq.tryfind_indexi" (Seq.tryfind_indexi (=) [|1..10|]) None
+
+  do check "Seq.compareWith" (Seq.compareWith compare [1;2] [2;1]) -1
+  do check "Seq.compareWith" (Seq.compareWith compare [2;1] [1;2])  1
+  do check "Seq.compareWith" (Seq.compareWith compare [1;2] [1;2])  0
+  do check "Seq.compareWith" (Seq.compareWith compare []    [1;2]) -1
+
+  do check "Seq.ofList" (Seq.toList (Seq.ofList [1..20])) [1..20]
+
+  do check "Seq.cast" (Seq.cast [1..10] |> Seq.toList) [1..10]
+  do check "Seq.collect" (Seq.collect (fun i -> [i*10 .. i*10+9]) [0..9] |> Seq.toList) [0..99]
+
+  let c = ref -1
+  do Seq.iter2 (fun x y -> incr c; test "Seq.iter2" (!c = x && !c = y)) [0..10] [0..10]
+  do check "Seq.iter2" !c 10
+
+  do check "Seq.zip"
+       (Seq.zip [1..10] [2..11] |> Seq.toList) [for i in 1..10 -> i, i+1]
+
+
+  do check "Seq.zip3"
+       (Seq.zip3 [1..10] [2..11] [3..12] |> Seq.toList) [for i in 1..10 -> i, i+1, i+2]
+
+  do c := -1
+  do Seq.iteri (fun n x -> incr c; test "Seq.iter2" (!c = n && !c+1 = x)) [1..11]
+  do check "Seq.iter2" !c 10
+
+  do check "Seq.pairwise" (Seq.pairwise [1..20] |> Seq.toList) [for i in 1 .. 19 -> i, i+1]
+
+  do check "Seq.windowed 1" (Seq.windowed 1 [1..20] |> Seq.toList) [for i in 1 .. 20 -> [|i|]]
+  do check "Seq.windowed 2" (Seq.windowed 2 [1..20] |> Seq.toList) [for i in 1 .. 19 -> [|i; i+1|]]
+  do check "Seq.windowed 3" (Seq.windowed 3 [1..20] |> Seq.toList) [for i in 1 .. 18 -> [|i; i+1; i+2|]]
+  do check "Seq.windowed 4" (Seq.windowed 4 [1..20] |> Seq.toList) [for i in 1 .. 17 -> [|i; i+1; i+2; i+3|]]
+
+  let group = Seq.groupBy (fun x -> x % 5) [1..100]
+  do for n, s in group do
+      check "Seq.groupBy" (Seq.forall (fun x -> x % 5 = n) s) true
+     done
+  do check "Seq.groupBy" ([for n,_ in group -> n] |> List.sort) [0..4]
+
+  let sorted = Seq.sortBy abs [2; 4; 3; -5; 2; -4; -8; 0; 5; 2]
+  do check "Seq.sortBy" (Seq.pairwise sorted |> Seq.forall (fun (x, y) -> abs x <= abs y)) true
+
+  let counts = Seq.countBy id [for i in 1..10 do yield! [10..-1..i] done]
+  do check "Seq.countBy" (counts |> Seq.toList) [for i in 10..-1..1 -> i, i]
+
+  do check "Seq.sum" (Seq.sum [1..100]) (100*101/2)
+  do check "Seq.sumBy" (Seq.sumBy float [1..100]) (100.*101./2.)
+
+  do check "Seq.average" (Seq.average [1.; 2.; 3.]) 2.
+  do check "Seq.averageBy" (Seq.averageBy float [0..100]) 50.
+  do check "Seq.min" (Seq.min [1; 4; 2; 5; 8; 4; 0; 3]) 0
+  do check "Seq.max" (Seq.max [1; 4; 2; 5; 8; 4; 0; 3]) 8
+  #if Portable
+  #else // strings don't have enumerators on portable
+  do check "Seq.minBy" (Seq.minBy int "this is a test") ' '
+  do check "Seq.maxBy" (Seq.maxBy int "this is a test") 't'
+  #endif
+
+  // Test where the key includes null values
+  do check "dict - option key" (dict [ (None,10); (Some 3, 220) ]).[None] 10
+  do check "dict - option key" (dict [ (None,10); (Some 3, 220) ]).[Some 3] 220
+  do check "dict - option key" (([ (None,10); (Some 3, 220) ] |> Seq.groupBy fst) |> Seq.length) 2
+  do check "dict - option key" (([ (None,10); (Some 3, 220); (None,10); (Some 3, 220) ] |> Seq.distinct ) |> Seq.length) 2
+  do check "dict - option key" (([ (None,10); (Some 3, 220); (None,10); (Some 4, 220) ] |> Seq.distinctBy fst) |> Seq.length) 3
+  do check "dict - option key" (([ (None,10); (Some 3, 220); (None,10); (Some 4, 220) ] |> Seq.countBy fst) |> Seq.length) 3
+
+  // Test where the key includes null values
+  do check "dict - option key" (dict [ ([| |],10); ([| 3 |], 220) ]).[[| |]] 10
+  do check "dict - option key" (dict [ ([| |],10); ([| 3 |], 220) ]).[[| 3 |]] 220
+  do check "dict - option key" (([ ([| |],10); ([| 3 |], 220) ] |> Seq.groupBy fst) |> Seq.length) 2
+  do check "dict - option key" (([ ([| |],10); ([| 3 |], 220); ([| |],10); ([| 3 |], 220) ] |> Seq.distinct ) |> Seq.length) 2
+  do check "dict - option key" (([ ([| |],10); ([| 3 |], 220); ([| |],10); ([| 4 |], 220) ] |> Seq.distinctBy fst) |> Seq.length) 3
+  do check "dict - option key" (([ ([| |],10); ([| 3 |], 220); ([| |],10); ([| 4 |], 220) ] |> Seq.countBy fst) |> Seq.length) 3
+
+end
+
+module SeqTestsOnEnumerableEnforcingDisposalAtEnd = begin
+   
+   let numActiveEnumerators = ref 0
+   
+   let countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd (seq: seq<'a>) =
+       let enumerator() = 
+                 numActiveEnumerators := !numActiveEnumerators + 1;
+                 let disposed = ref false in
+                 let endReached = ref false in
+                 let ie = seq.GetEnumerator() in
+                 { new System.Collections.Generic.IEnumerator<'a> with 
+                      member x.Current =
+                          test "rvlrve0" (not !endReached);
+                          test "rvlrve1" (not !disposed);
+                          ie.Current
+                      member x.Dispose() = 
+                          test "rvlrve2" !endReached;
+                          test "rvlrve4" (not !disposed);
+                          numActiveEnumerators := !numActiveEnumerators - 1;
+                          disposed := true;
+                          ie.Dispose() 
+                   interface System.Collections.IEnumerator with 
+                      member x.MoveNext() = 
+                          test "rvlrve0" (not !endReached);
+                          test "rvlrve3" (not !disposed);
+                          endReached := not (ie.MoveNext());
+                          not !endReached
+                      member x.Current = 
+                          test "qrvlrve0" (not !endReached);
+                          test "qrvlrve1" (not !disposed);
+                          box ie.Current
+                      member x.Reset() = 
+                          ie.Reset()
+                   } in
+
+       { new seq<'a> with 
+             member x.GetEnumerator() =  enumerator() 
+         interface System.Collections.IEnumerable with 
+             member x.GetEnumerator() =  (enumerator() :> _) }
+
+   let countEnumeratorsAndCheckedDisposedAtMostOnce (seq: seq<'a>) =
+       let enumerator() = 
+                 let disposed = ref false in
+                 let endReached = ref false in
+                 let ie = seq.GetEnumerator() in
+                 numActiveEnumerators := !numActiveEnumerators + 1;
+                 { new System.Collections.Generic.IEnumerator<'a> with 
+                      member x.Current =
+                          test "qrvlrve0" (not !endReached);
+                          test "qrvlrve1" (not !disposed);
+                          ie.Current
+                      member x.Dispose() = 
+                          test "qrvlrve4" (not !disposed);
+                          numActiveEnumerators := !numActiveEnumerators - 1;
+                          disposed := true;
+                          ie.Dispose() 
+                   interface System.Collections.IEnumerator with 
+                      member x.MoveNext() = 
+                          test "qrvlrve0" (not !endReached);
+                          test "qrvlrve3" (not !disposed);
+                          endReached := not (ie.MoveNext());
+                          not !endReached
+                      member x.Current = 
+                          test "qrvlrve0" (not !endReached);
+                          test "qrvlrve1" (not !disposed);
+                          box ie.Current
+                      member x.Reset() = 
+                          ie.Reset()
+                   } in
+
+       { new seq<'a> with 
+             member x.GetEnumerator() =  enumerator() 
+         interface System.Collections.IEnumerable with 
+             member x.GetEnumerator() =  (enumerator() :> _) }
+
+   // This one gave a stack overflow when we weren't tail-calling on 64-bit
+   do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n <> 1) |> Seq.length) 999999
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n = 1) |> Seq.length) 1
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.filter-length" ({ 1 .. 1000000 } |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.filter (fun n -> n % 2 = 0) |> Seq.length) 500000
+   do check "<dispoal>" !numActiveEnumerators 0
+    
+   do check "IEnumerableTest.empty-length" (Seq.length (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd Seq.empty)) 0
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.length-of-array" (Seq.length (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [| 1;2;3 |])) 3
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.head-of-array" (Seq.head (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |])) 1
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.take-0-of-array" (Seq.take 0 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) []
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.take-1-of-array" (Seq.take 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) [1]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.take-3-of-array" (Seq.take 3 (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |]) |> Seq.toList) [1;2;3]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.nonempty-true" (Seq.isEmpty (countEnumeratorsAndCheckedDisposedAtMostOnce [| 1;2;3 |])) false
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.nonempty-false" (Seq.isEmpty (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.fold" (Seq.fold (+) 0 (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [| 1;2;3 |])   ) 6
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.unfold" (Seq.unfold (fun _ -> None) 1 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.unfold" (Seq.unfold (fun x -> if x = 1 then Some("a",2) else  None) 1 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a" |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) false
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "a" |])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.exists" (Seq.exists ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "1"; "a" |])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+
+
+   do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| |])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "a" |])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.exists" (Seq.forall ((=) "a") (countEnumeratorsAndCheckedDisposedAtMostOnce [| "1"; "a" |])) false
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "IEnumerableTest.map on finite" ([| "a" |] |> Seq.map (fun x -> x.Length) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| 1 |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.filter on finite" ([| "a";"ab";"a" |] |> Seq.filter (fun x -> x.Length = 1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a";"a" |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.choose on finite" ([| "a";"ab";"a" |] |> Seq.choose (fun x -> if x.Length = 1 then Some(x^"a") else None) |> Seq.toArray) [| "aa";"aa" |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.pick on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.pick (fun x -> if x.Length = 1 then Some(x^"a") else None)) "aa"
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.tryPick on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryPick (fun x -> if x.Length = 1 then Some(x^"a") else None)) (Some "aa")
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.tryPick on finite (failing)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryPick (fun x -> if x.Length = 6 then Some(x^"a") else None)) None
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.find on finite (succeeding)" ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.find (fun x -> x.Length = 1)) "a"
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.find on finite (failing)" (try Some ([| "a";"ab";"a" |] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.find (fun x -> x.Length = 6)) with :? System.Collections.Generic.KeyNotFoundException -> None) None
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.map_with_type (string up to obj,finite)" ([| "a" |] |> Seq.cast |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| ("a" :> obj) |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.map_with_type (obj down to string, finite)" ([| ("a" :> obj) |] |> Seq.cast |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a" |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.append, finite, finite" (Seq.append [| "a" |] [| "b" |]  |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| "a"; "b" |]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+
+
+   do check "IEnumerableTest.concat, finite" (Seq.concat [| [| "a" |]; [| |]; [| "b";"c" |] |]  |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [ "a";"b";"c" ]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.init_infinite, then take" (Seq.take 2 (countEnumeratorsAndCheckedDisposedAtMostOnce (Seq.initInfinite (fun i -> i+1))) |> Seq.toList) [ 1;2 ]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_array, empty" (Seq.init 0 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [|  |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_array, small" (Seq.init 1 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray) [| 1 |]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_array, large" (Seq.init 100000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray |> Array.length) 100000
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_array, very large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toArray |> Array.length) 1000000
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_list, empty" (Seq.init 0 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [  ]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_list, small" (Seq.init 1 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [ 1 ]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_list, large" (Seq.init 100000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList |> List.length) 100000
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList |> List.length) 1000000
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "IEnumerableTest.to_list, large" (Seq.init 1000000 (fun i -> i+1) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.length) 1000000
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "List.unzip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.unzip |> fst |> List.length) 1000000
+   do check "<dispoal>" !numActiveEnumerators 0
+   let dup x = x,x
+   let uncurry f (x,y) = f x y
+    
+   do check "List.zip, large" (Seq.init 1000000 (fun i -> (i,i+1)) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> dup |> uncurry List.zip |> List.length) 1000000
+   do check "<dispoal>" !numActiveEnumerators 0
+    
+(*
+    // Currently disabled, since IStructuralEquatable.Equals will cause this to stack overflow around 140000 elements
+    do check "List.sort, large" ((Seq.init 140000 (fun i -> 139999 - i) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.sort) = 
+                                 (Seq.init 140000 (fun i -> i) |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> List.ofSeq |> List.sort))   true
+    do check "<dispoal>" !numActiveEnumerators 0
+*)
+    
+   do check "Seq.singleton" (Seq.singleton 42 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.length) 1
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.singleton" (Seq.singleton 42 |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd |> Seq.toList) [42]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.truncate" (Seq.truncate 20 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) [1..20]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.truncate" (Seq.truncate 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) [1]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.truncate" (Seq.truncate 0 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100]) |> Seq.toList) []
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.scan" (Seq.scan (+) 0 (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [|1..5|]) |> Seq.toArray) [|0; 1; 3; 6; 10; 15|]
+   do check "<dispoal>" !numActiveEnumerators 0
+   //do check "Seq.scan1" (Seq.scan1 (+) (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [|1..5|]) |> Seq.toArray) [|3; 6; 10; 15|]
+   //do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.exists2" (Seq.exists2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1; 2; 3; 4; 5; 6|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|2; 3; 4; 5; 6; 6|])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.exists2" (Seq.exists2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1; 2; 3; 4; 5; 6|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|2; 3; 4; 5; 6; 7|])) false
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.forall2" (Seq.forall2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1..10|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1..10|])) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.forall2" (Seq.forall2 (=) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1;2;3;4;5|]) (countEnumeratorsAndCheckedDisposedAtMostOnce [|1;2;3;0;5|])) false
+   do check "<dispoal>" !numActiveEnumerators 0
+
+
+
+   do check "Seq.tryFind" ([|1..100|] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryFind (fun x -> x > 50)) (Some 51)
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.tryFind" ([|1..100|] |> countEnumeratorsAndCheckedDisposedAtMostOnce |> Seq.tryFind (fun x -> x > 180)) None
+   do check "<dispoal>" !numActiveEnumerators 0
+
+
+   do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]) (countEnumeratorsAndCheckedDisposedAtMostOnce [2;1])) -1
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [2;1]) (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]))  1
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]) (countEnumeratorsAndCheckedDisposedAtMostOnce [1;2]))  0
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.compareWith" (Seq.compareWith compare (countEnumeratorsAndCheckedDisposedAtMostOnce []) (countEnumeratorsAndCheckedDisposedAtMostOnce    [1;2])) -1
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.collect" (Seq.collect (fun i -> [i*10 .. i*10+9]) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..9]) |> Seq.toList) [0..99]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   let c = ref -1
+   do Seq.iter2 (fun x y -> incr c; test "Seq.iter2" (!c = x && !c = y)) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..10]) (countEnumeratorsAndCheckedDisposedAtMostOnce [0..10])
+   do check "Seq.iter2" !c 10
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.zip"
+         (Seq.zip [1..10] (countEnumeratorsAndCheckedDisposedAtMostOnce [2..11]) |> Seq.toList) [for i in 1..10 -> i, i+1]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+
+   do check "Seq.zip3"
+         (Seq.zip3 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..10]) (countEnumeratorsAndCheckedDisposedAtMostOnce [2..11]) (countEnumeratorsAndCheckedDisposedAtMostOnce [3..12]) |> Seq.toList) [for i in 1..10 -> i, i+1, i+2]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do c := -1
+   do Seq.iteri (fun n x -> incr c; test "Seq.iter2" (!c = n && !c+1 = x)) (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1..11])
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.iter2" !c 10
+
+   do check "Seq.pairwise" (Seq.pairwise (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 19 -> i, i+1]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.windowed 1" (Seq.windowed 1 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 20 -> [|i|]]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.windowed 2" (Seq.windowed 2 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 19 -> [|i; i+1|]]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.windowed 3" (Seq.windowed 3 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 18 -> [|i; i+1; i+2|]]
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.windowed 4" (Seq.windowed 4 (countEnumeratorsAndCheckedDisposedAtMostOnce [1..20]) |> Seq.toList) [for i in 1 .. 17 -> [|i; i+1; i+2; i+3|]]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   let group = Seq.groupBy (fun x -> x % 5) (countEnumeratorsAndCheckedDisposedAtMostOnce [1..100])
+   do for n, s in group do
+        check "Seq.groupBy" (Seq.forall (fun x -> x % 5 = n) s) true;
+        check "<dispoal>" !numActiveEnumerators 0
+      done
+
+   let sorted = Seq.sortBy abs (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [2; 4; 3; -5; 2; -4; -8; 0; 5; 2])
+   do check "Seq.sortBy" (Seq.pairwise sorted |> Seq.forall (fun (x, y) -> abs x <= abs y)) true
+   do check "<dispoal>" !numActiveEnumerators 0
+   let counts = Seq.countBy id (countEnumeratorsAndCheckedDisposedAtMostOnce [for i in 1..10 do yield! [10..-1..i] done ])
+   do check "Seq.countBy" (counts |> Seq.toList) [for i in 10..-1..1 -> i, i]
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.sum" (Seq.sum (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1..100])) (100*101/2)
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.sumBy" (Seq.sumBy float [1..100]) (100.*101./2.)
+   do check "<dispoal>" !numActiveEnumerators 0
+
+   do check "Seq.average" (Seq.average (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1.; 2.; 3.])) 2.
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.averageBy" (Seq.averageBy float (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [0..100])) 50.
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.min" (Seq.min (countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd [1; 4; 2; 5; 8; 4; 0; 3])) 0
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.max" (Seq.max (countEnumeratorsAndCheckedDisposedAtMostOnce [1; 4; 2; 5; 8; 4; 0; 3])) 8
+   do check "<dispoal>" !numActiveEnumerators 0
+   #if Portable
+   #else // strings don't have enumerators in portable
+   do check "Seq.minBy" (Seq.minBy int (countEnumeratorsAndCheckedDisposedAtMostOnce "this is a test")) ' '
+   do check "<dispoal>" !numActiveEnumerators 0
+   do check "Seq.maxBy" (Seq.maxBy int (countEnumeratorsAndCheckedDisposedAtMostOnce "this is a test")) 't'
+   do check "<dispoal>" !numActiveEnumerators 0
+   #endif
+
+end
+
+let (lsr) (a:int) (b:int) = int32 (uint32 a >>> b)
+let (lsl) (a:int) (b:int) = a <<< b
+let (lor) (a:int) (b:int) = a ||| b
+let (lxor) (a:int) (b:int) = a ^^^ b
+let (land) (a:int) (b:int) = a &&& b
+// check precedence of lsl, lsr etc.
+let _ = fun (x:int) -> x > x lsr 1
+let _ = fun (x:int) -> x > (x lsr 1)
+let _ = fun (x:int) -> x > x lsl 1
+let _ = fun (x:int) -> x > (x lsl 1)
+let _ = fun (x:int) -> x > x lor 1
+let _ = fun (x:int) -> x > (x lor 1)
+let _ = fun (x:int) -> x > x lxor 1
+let _ = fun (x:int) -> x > (x lxor 1)
+let _ = fun (x:int) -> x > x land 1
+let _ = fun (x:int) -> x > (x land 1)
+
+
+// check ordering of NaN
+(*
+The predefined floating-point comparison operators are:
+bool operator ==(float x, float y);
+bool operator ==(double x, double y);
+bool operator !=(float x, float y);
+bool operator !=(double x, double y);
+bool operator <(float x, float y);
+bool operator <(double x, double y);
+bool operator >(float x, float y);
+bool operator >(double x, double y);
+bool operator <=(float x, float y);
+bool operator <=(double x, double y);
+bool operator >=(float x, float y);
+bool operator >=(double x, double y);
+The operators compare the operands according to the rules of the IEC 60559 standard:
+If either operand is NaN, the result is false for all operators except !=, for which the result is true. For
+any two operands, x != y always produces the same result as !(x == y). However, when one or both
+operands are NaN, the <, >, <=, and >= operators do not produce the same results as the logical negation of
+the opposite operator. [Example: If either of x and y is NaN, then x < y is false, but !(x >= y) is true.
+end example]
+? When neither operand is NaN, the operators compare the values of the two floating-point operands with
+respect to the ordering
+-inf < ?max < ? < ?min < ?0.0 == +0.0 < +min < ? < +max < +inf
+where min and max are the smallest and largest positive finite values that can be represented in the given
+floating-point format. Notable effects of this ordering are:
+o Negative and positive zeros are considered equal.
+o A negative infinity is considered less than all other values, but equal to another negative infinity.
+o A positive infinity is considered greater than all other values, but equal to another positive infinity.
+*)
+open System
+
+let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0))
+let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0))
+
+do printf "checking floating point relational operators\n"
+let _ = check "d3wiojd30a" ((Double.NaN > Double.NaN)) false
+let _ = check "d3wiojd30a" (if (Double.NaN > Double.NaN) then "a" else "b") "b"
+let _ = check "d3wiojd30b" ((Double.NaN >= Double.NaN)) false
+let _ = check "d3wiojd30b" (if (Double.NaN >= Double.NaN) then "a" else "b") "b"
+let _ = check "d3wiojd30c" ((Double.NaN < Double.NaN)) false
+let _ = check "d3wiojd30c" (if (Double.NaN < Double.NaN) then "a" else "b") "b"
+let _ = check "d3wiojd30d" ((Double.NaN <= Double.NaN)) false
+let _ = check "d3wiojd30d" (if (Double.NaN <= Double.NaN) then "a" else "b") "b"
+let _ = check "d3wiojd30e" ((Double.NaN = Double.NaN)) false
+let _ = check "d3wiojd30e" (if (Double.NaN = Double.NaN) then "a" else "b") "b"
+let _ = check "d3wiojd30q" ((Double.NaN <> Double.NaN)) true
+let _ = check "d3wiojd30w" ((Double.NaN > 1.0)) false
+let _ = check "d3wiojd30e" ((Double.NaN >= 1.0)) false
+let _ = check "d3wiojd30r" ((Double.NaN < 1.0)) false
+let _ = check "d3wiojd30t" ((Double.NaN <= 1.0)) false
+let _ = check "d3wiojd30y" ((Double.NaN = 1.0)) false
+let _ = check "d3wiojd30u" ((Double.NaN <> 1.0)) true
+let _ = check "d3wiojd30i" ((1.0 > Double.NaN)) false
+let _ = check "d3wiojd30o" ((1.0 >= Double.NaN)) false
+let _ = check "d3wiojd30p" ((1.0 < Double.NaN)) false
+let _ = check "d3wiojd30a" ((1.0 <= Double.NaN)) false
+let _ = check "d3wiojd30s" ((1.0 = Double.NaN)) false
+let _ = check "d3wiojd30d" ((1.0 <> Double.NaN)) true
+let _ = check "d3wiojd30a" ((nan1 > Double.NaN)) false
+let _ = check "d3wiojd30b" ((nan1 >= nan2)) false
+let _ = check "d3wiojd30c" ((nan1 < nan2)) false
+let _ = check "d3wiojd30d" ((nan1 <= nan2)) false
+let _ = check "d3wiojd30e" ((nan1 = nan2)) false
+let _ = check "d3wiojd30q" ((nan1 <> nan2)) true
+let _ = check "d3wiojd30w" ((nan1 > 1.0)) false
+let _ = check "d3wiojd30e" ((nan1 >= 1.0)) false
+let _ = check "d3wiojd30r" ((nan1 < 1.0)) false
+let _ = check "d3wiojd30t" ((nan1 <= 1.0)) false
+let _ = check "d3wiojd30y" ((nan1 = 1.0)) false
+let _ = check "d3wiojd30u" ((nan1 <> 1.0)) true
+let _ = check "d3wiojd30i" ((1.0 > nan2)) false
+let _ = check "d3wiojd30o" ((1.0 >= nan2)) false
+let _ = check "d3wiojd30p" ((1.0 < nan2)) false
+let _ = check "d3wiojd30a" ((1.0 <= nan2)) false
+let _ = check "d3wiojd30s" ((1.0 = nan2)) false
+let _ = check "d3wiojd30d" ((1.0 <> nan2)) true
+let _ = check "d3wiojd30f" ((Double.NegativeInfinity = Double.NegativeInfinity)) true
+let _ = check "d3wiojd30g" ((Double.NegativeInfinity < Double.PositiveInfinity)) true
+let _ = check "d3wiojd30h" ((Double.NegativeInfinity > Double.PositiveInfinity)) false
+let _ = check "d3wiojd30j" ((Double.NegativeInfinity <= Double.NegativeInfinity)) true
+
+module FloatingPointStructured = begin
+    type www = W of float
+
+    do printf "checking floating point relational operators on structured data\n"
+    // NOTE: SPECIFICATION: The relational operators work differently when applied to
+    // floats embedded in structured data than when applied to raw floats. 
+
+    let _ = check "d3wiojd31q" ((W Double.NaN > W Double.NaN)) false
+    let _ = check "d3wiojd31w" ((W Double.NaN >= W Double.NaN)) false
+    let _ = check "d3wiojd31e" ((W Double.NaN < W Double.NaN)) false
+    let _ = check "d3wiojd31r" ((W Double.NaN <= W Double.NaN)) false
+    let _ = check "d3wiojd31ty" ((W Double.NaN = W Double.NaN)) false
+    let _ = check "d3wiojd31y" ((W Double.NaN <> W Double.NaN)) true
+    let _ = check "d3wiojd31dy" (0 = compare (W Double.NaN) (W Double.NaN)) true
+    let _ = check "d3wiojd31u" ((W Double.NaN > W 1.0)) false
+    let _ = check "d3wiojd31i" ((W Double.NaN >= W 1.0)) false
+    let _ = check "d3wiojd31o" ((W Double.NaN < W 1.0)) false
+    let _ = check "d3wiojd31p" ((W Double.NaN <= W 1.0)) false
+    let _ = check "d3wiojd31a" ((W Double.NaN = W 1.0)) false
+    let _ = check "d3wiojd31s" ((W Double.NaN <> W 1.0)) true
+    let _ = check "d3wiojd31d" ((W 1.0 > W Double.NaN)) false
+    let _ = check "d3wiojd31f" ((W 1.0 >= W Double.NaN)) false
+    let _ = check "d3wiojd31g" ((W 1.0 < W Double.NaN)) false
+    let _ = check "d3wiojd31h" ((W 1.0 <= W Double.NaN)) false
+    let _ = check "d3wiojd31j" ((W 1.0 = W Double.NaN)) false
+    let _ = check "d3wiojd31k" ((W 1.0 <> W Double.NaN)) true
+    let _ = check "d3wiojd31l" ((W Double.NegativeInfinity = W Double.NegativeInfinity)) true
+    let _ = check "d3wiojd31c" ((W Double.NegativeInfinity < W Double.PositiveInfinity)) true
+    let _ = check "d3wiojd3xx" ((W Double.NegativeInfinity > W Double.PositiveInfinity)) false
+    let _ = check "d3wiojd31z" ((W Double.NegativeInfinity <= W Double.NegativeInfinity)) true
+end
+
+module FloatingPointStructuredPoly = begin
+    type 'a www = W of 'a
+
+    do printf "checking floating point relational operators on polymorphic structured data\n"
+
+    let _ = check "d3wiojd32q" ((W Double.NaN > W Double.NaN)) false
+    let _ = check "d3wiojd32w" ((W Double.NaN >= W Double.NaN)) false
+    let _ = check "d3wiojd32e" ((W Double.NaN < W Double.NaN)) false
+    let _ = check "d3wiojd32r" ((W Double.NaN <= W Double.NaN)) false
+    let _ = check "d3wiojd32t" ((W Double.NaN = W Double.NaN)) false
+    let _ = check "d3wiojd32dt" ((W Double.NaN).Equals(W Double.NaN)) true
+    let _ = check "d3wiojd32y" ((W Double.NaN <> W Double.NaN)) true
+    let _ = check "d3wiojd32u" ((W Double.NaN > W 1.0)) false
+    let _ = check "d3wiojd32i" ((W Double.NaN >= W 1.0)) false
+    let _ = check "d3wiojd32o" ((W Double.NaN < W 1.0)) false
+    let _ = check "d3wiojd32p" ((W Double.NaN <= W 1.0)) false
+    let _ = check "d3wiojd32a" ((W Double.NaN = W 1.0)) false
+    let _ = check "d3wiojd32s" ((W Double.NaN <> W 1.0)) true
+    let _ = check "d3wiojd32d" ((W 1.0 > W Double.NaN)) false
+    let _ = check "d3wiojd32f" ((W 1.0 >= W Double.NaN)) false
+    let _ = check "d3wiojd32g" ((W 1.0 < W Double.NaN)) false
+    let _ = check "d3wiojd32h" ((W 1.0 <= W Double.NaN)) false
+    let _ = check "d3wiojd32j" ((W 1.0 = W Double.NaN)) false
+    let _ = check "d3wiojd32k" ((W 1.0 <> W Double.NaN)) true
+    let _ = check "d3wiojd32l" ((W Double.NegativeInfinity = W Double.NegativeInfinity)) true
+    let _ = check "d3wiojd32z" ((W Double.NegativeInfinity < W Double.PositiveInfinity)) true
+    let _ = check "d3wiojd32x" ((W Double.NegativeInfinity > W Double.PositiveInfinity)) false
+    let _ = check "d3wiojd32c" ((W Double.NegativeInfinity <= W Double.NegativeInfinity)) true
+end
+
+module MoreStructuralEqHashCompareNaNChecks = begin
+    let test398275413() =
+        let floats = [1.0; 0.0; System.Double.NaN; System.Double.NegativeInfinity; System.Double.PositiveInfinity; nan] in
+        for x in floats do
+          for y in floats do
+            let xnan = System.Double.IsNaN(x) in
+            let ynan = System.Double.IsNaN(y) in
+            let test1 x y op b = if not b then (printfn "\n****failure on %A %s %A\n" x op y; reportFailure "unlabelled test") in
+            if (xnan && not(ynan)) || (ynan && not(xnan)) then (
+                
+                let testEq x y = 
+                    test1 x y "=" ((x = y) = false);
+                    test1 x y "<>" ((x <> y) = true) in
+                let testRel x y = 
+                    test1 x y "<" ((x < y) = false );
+                    test1 x y ">" ((x > y) = false );
+                    test1 x y ">=" ((x >= y) = false);
+                    test1 x y "<=" ((x <= y) = false) in
+                testEq x y; 
+                testEq [x] [y];
+                testEq [| x |] [| y |];
+                testEq (x,x) (y,y);
+                testEq (x,1) (y,1);
+                testEq (1,x) (1,y);
+
+                testRel x y;
+
+                testRel [x] [y];
+                testRel [| x |] [| y |];
+                testRel (x,x) (y,y);
+                testRel (x,1) (y,1);
+                testRel (1,x) (1,y);
+            );
+            if xnan && ynan  then
+               test1 x y "compare" ((compare x y) = 0)
+          done
+        done            
+
+    let _ = test398275413()
+
+    let test398275414() =
+        let floats = [1.0f; 0.0f; System.Single.NaN; System.Single.NegativeInfinity; System.Single.PositiveInfinity; nanf] in
+        for x in floats do
+          for y in floats do
+            let xnan = System.Single.IsNaN(x) in
+            let ynan = System.Single.IsNaN(y) in
+            let test1 x y op b = if not b then (printfn "\n****failure on %A %s %A\n" x op y; reportFailure "unlabelled test") in
+            if (xnan && not(ynan)) || (ynan && not(xnan)) then (
+                
+                let testEq x y = 
+                    test1 x y "=" ((x = y) = false);
+                    test1 x y "<>" ((x <> y) = true) in
+                let testRel x y = 
+                    test1 x y "<" ((x < y) = false );
+                    test1 x y ">" ((x > y) = false );
+                    test1 x y ">=" ((x >= y) = false);
+                    test1 x y "<=" ((x <= y) = false) in
+                testEq x y; 
+                testEq [x] [y];
+                testEq [| x |] [| y |];
+                testEq (x,x) (y,y);
+                testEq (x,1) (y,1);
+                testEq (1,x) (1,y);
+
+                testRel x y;
+
+                testRel [x] [y];
+                testRel [| x |] [| y |];
+                testRel (x,x) (y,y);
+                testRel (x,1) (y,1);
+                testRel (1,x) (1,y);
+            );
+            if xnan && ynan  then
+               test1 x y "compare" ((compare x y) = 0)
+          done
+        done            
+
+    let _ = test398275414()
+    
+    type A<'a,'b> = {h : 'a ; w : 'b}
+    type C<'T> = {n : string ; s : 'T}
+    type D = {x : float ; y : float}
+    type D2 = {x2 : float32 ; y2 : float32}
+    exception E of float 
+    exception E2 of float32
+    type F = | F of float
+    type F2 = | F2 of float32
+
+    // Test ER semantics for obj.Equals and PER semantics for (=)
+    let test398275415() =
+    
+        let l1 = [nan; 1.0] in
+        let l2 = [nan; 1.0] in
+        
+        let a1 = [|nan; 1.0|] in
+        let a2 = [|nan; 1.0|] in
+        
+        let t1 = (nan, 1.0) in
+        let t2 = (nan, 1.0) in
+        
+        let d1 = {x=1.0;y=nan} in
+        let d2 = {x=1.0;y=nan} in
+        
+        let e1 = E nan in
+        let e2 = E nan in
+        
+        let f1 = F nan in
+        let f2 = F nan in
+        
+        
+        let j1 : C<A<float,float>> = {n="Foo" ; s={h=5.9 ; w=nan}} in
+        let j2 : C<A<float,float>> = {n="Foo" ; s={h=5.9 ; w=nan}} in
+
+        let jT1 = ("Foo", {h=5.9 ; w=nan}) in
+        let jT2 = ("Foo", {h=5.9 ; w=nan}) in
+        let id x = x in
+        
+        let testER x y f = if f(not(x.Equals(y))) then (printfn "\n****failure on %A %A\n" x y ; reportFailure "unlabelled test") in
+        let testPER x y f = if f((x = y)) then (printfn "\n****failure on %A %A\n" x y ; reportFailure "unlabelled test") in
+        
+        testER l1 l2 id ;
+        testER l2 l1 id ;
+        testPER l1 l2 id ;
+        testPER l2 l1 id ;
+        
+        testER a1 a2 not ;
+        testER a2 a1 not ;
+        testPER a1 a2 id ;
+        testPER a2 a1 id ;
+        
+        testER t1 t2 id ;
+        testER t2 t1 id ;
+        testPER t1 t2 id ;
+        testPER t2 t1 id ;
+        
+        testER j1 j2 id ;
+        testER j2 j1 id ;
+        testPER j1 j2 id ;
+        testPER j2 j1 id ;
+        
+        testER jT1 jT2 id ;
+        testER jT2 jT1 id ;
+        testPER jT1 jT2 id ;
+        testPER jT2 jT1 id ;
+        
+        testER d1 d2 id ;
+        testER d2 d1 id ;
+        testPER d1 d2 id ;
+        testPER d2 d1 id ;
+        
+        testER e1 e2 id ;
+        testER e2 e1 id ;
+        testPER e1 e2 id ;
+        testPER e2 e1 id ;
+        
+        testER f1 f2 id ;
+        testER f2 f1 id ;
+        testPER f1 f2 id ;
+        testPER f2 f1 id       
+
+
+    let _ = test398275415()
+
+    // Test ER semantics for obj.Equals and PER semantics for (=)
+    let test398275416() =
+    
+        let l1 = [nanf; 1.0f] in
+        let l2 = [nanf; 1.0f] in
+        
+        let a1 = [|nanf; 1.0f|] in
+        let a2 = [|nanf; 1.0f|] in
+        
+        let t1 = (nanf, 1.0f) in
+        let t2 = (nanf, 1.0f) in
+        
+        let d1 = {x2=1.0f;y2=nanf} in
+        let d2 = {x2=1.0f;y2=nanf} in
+        
+        let e1 = E2 nanf in
+        let e2 = E2 nanf in
+        
+        let f1 = F2 nanf in
+        let f2 = F2 nanf in        
+        
+        let j1 : C<A<float32,float32>> = {n="Foo" ; s={h=5.9f ; w=nanf}} in
+        let j2 : C<A<float32,float32>> = {n="Foo" ; s={h=5.9f ; w=nanf}} in
+
+        let jT1 = ("Foo", {h=5.9f ; w=nanf}) in
+        let jT2 = ("Foo", {h=5.9f ; w=nanf}) in
+        let id x = x in
+        
+        let testER x y f = if f(not(x.Equals(y))) then (printfn "\n****failure on %A %A\n" x y ; reportFailure "unlabelled test") in
+        let testPER x y f = if f((x = y)) then (printfn "\n****failure on %A %A\n" x y ; reportFailure "unlabelled test") in
+        
+        testER l1 l2 id ;
+        testER l2 l1 id ;
+        testPER l1 l2 id ;
+        testPER l2 l1 id ;
+        
+        testER a1 a2 not ;
+        testER a2 a1 not ;
+        testPER a1 a2 id ;
+        testPER a2 a1 id ;
+        
+        testER t1 t2 id ;
+        testER t2 t1 id ;
+        testPER t1 t2 id ;
+        testPER t2 t1 id ;
+        
+        testER j1 j2 id ;
+        testER j2 j1 id ;
+        testPER j1 j2 id ;
+        testPER j2 j1 id ;
+        
+        testER jT1 jT2 id ;
+        testER jT2 jT1 id ;
+        testPER jT1 jT2 id ;
+        testPER jT2 jT1 id ;
+        
+        testER d1 d2 id ;
+        testER d2 d1 id ;
+        testPER d1 d2 id ;
+        testPER d2 d1 id ;
+        
+        testER e1 e2 id ;
+        testER e2 e1 id ;
+        testPER e1 e2 id ;
+        testPER e2 e1 id ;
+        
+        testER f1 f2 id ;
+        testER f2 f1 id ;
+        testPER f1 f2 id ;
+        testPER f2 f1 id
+        
+        
+    let _ = test398275416()    
+    
+end
+
+// This test tests basic behavior of IEquatable<T> and IComparable<T> augmentations     
+module GenericComparisonAndEquality = begin
+    open System.Collections.Generic
+    open System
+    
+    // over records and unions   
+    [<StructuralEquality ; StructuralComparison>]
+    type UnionTypeA =
+        | Foo of float
+        | Int of int
+        | Recursive of UnionTypeA
+
+    [<StructuralEquality ; StructuralComparison>]
+    type RecordTypeA<'T> = {f1 : string ; f2 : 'T}
+
+    #if Portable
+    #else
+    // IComparable<T>
+    let _ = 
+        
+        let sl = SortedList<RecordTypeA<float>,string>() in
+        sl.Add({f1="joj";f2=69.0},"prg") ;
+        sl.Add({f1="bri";f2=68.0},"prg") ;
+        sl.Add({f1="jom";f2=70.0},"prg") ;
+        sl.Add({f1="tmi";f2=75.0},"lde") ;
+        
+        // add items to sl2 in a different order than sl1
+        let sl2 = SortedList<RecordTypeA<float>,string>() in
+        sl2.Add({f1="jom";f2=70.0},"prg") ;
+        sl2.Add({f1="bri";f2=68.0},"prg") ;
+        sl2.Add({f1="joj";f2=69.0},"prg") ;
+        sl2.Add({f1="tmi";f2=75.0},"lde") ;
+        
+        let sl3 = SortedList<UnionTypeA, float>() in
+        sl3.Add(Foo(2.0), 0.0) ;
+        sl3.Add(Int(1), 1.0) ;
+        sl3.Add(Recursive(Foo(3.0)),2.0) ;
+        
+        let sl4 = SortedList<UnionTypeA, float>() in
+        sl4.Add(Foo(2.0), 0.0) ;
+        sl4.Add(Int(1), 1.0) ;
+        sl4.Add(Recursive(Foo(3.0)),2.0) ;
+           
+
+        let l1 = List.ofSeq sl.Keys in
+        let l2 = List.ofSeq sl2.Keys in
+        
+        let l3 = List.ofSeq sl3.Keys in
+        let l4 = List.ofSeq sl4.Keys in
+        
+        check "d3wiojd32icr" (l1 = l2) true ;
+        check "d3wiojd32icu" (l3 = l4) true              
+    #endif
+
+    // IEquatable<T>        
+    let _ = 
+        
+        let l = List<RecordTypeA<float>>() in
+        l.Add({f1="joj";f2=69.0}) ;
+        l.Add({f1="bri";f2=68.0}) ;
+        l.Add({f1="jom";f2=70.0}) ;
+        l.Add({f1="tmi";f2=75.0}) ;
+        
+        let l2 = List<UnionTypeA>() in
+        l2.Add(Foo(2.0)) ;
+        l2.Add(Int(1)) ;
+        l2.Add(Recursive(Foo(3.0))) ;
+        
+        check "d3wiojd32ier" (l.Contains({f1="joj";f2=69.0})) true ;
+        check "d3wiojd32ieu" (l2.Contains(Recursive(Foo(3.0)))) true 
+
+end
+
+
+(*---------------------------------------------------------------------------
+!* check optimizations 
+ *--------------------------------------------------------------------------- *)
+
+module Optimiations = begin
+
+    let _ = check "opt.oi20c77u" (1 + 1) (2)
+    let _ = check "opt.oi20c77i" (-1 + 1) (0)
+    let _ = check "opt.oi20c77o" (1 + 2) (3)
+    let _ = check "opt.oi20c77p" (2 + 1) (3)
+    let _ = check "opt.oi20c77a" (1 * 0) (0)
+    let _ = check "opt.oi20c77s" (0 * 1) (0)
+    let _ = check "opt.oi20c77d" (2 * 2) (4)
+    let _ = check "opt.oi20c77f" (2 * 3) (6)
+    let _ = check "opt.oi20c77g" (-2 * 3) (-6)
+    let _ = check "opt.oi20c77h" (1 - 2) (-1)
+    let _ = check "opt.oi20c77j" (2 - 1) (1)
+
+    let _ = check "opt.oi20c77uL" (1L + 1L) (2L)
+    let _ = check "opt.oi20c77iL" (-1L + 1L) (0L)
+    let _ = check "opt.oi20c77oL" (1L + 2L) (3L)
+    let _ = check "opt.oi20c77pL" (2L + 1L) (3L)
+    let _ = check "opt.oi20c77aL" (1L * 0L) (0L)
+    let _ = check "opt.oi20c77sL" (0L * 1L) (0L)
+    let _ = check "opt.oi20c77dL" (2L * 2L) (4L)
+    let _ = check "opt.oi20c77fL" (2L * 3L) (6L)
+    let _ = check "opt.oi20c77gL" (-2L * 3L) (-6L)
+    let _ = check "opt.oi20c77hL" (1L - 2L) (-1L)
+    let _ = check "opt.oi20c77jL" (2L - 1L) (1L)
+
+    let _ = check "opt.oi20cnq" (1 <<< 0) (1)
+    let _ = check "opt.oi20cnw" (1 <<< 1) (2)
+    let _ = check "opt.oi20cne" (1 <<< 2) (4)
+    let _ = check "opt.oi20cnr" (1 <<< 31) (0x80000000)
+    let _ = check "opt.oi20cnt" (1 <<< 32) (1)
+    let _ = check "opt.oi20cny" (1 <<< 33) (2)
+    let _ = check "opt.oi20cnu" (1 <<< 63) (0x80000000)
+
+    let _ = check "or.oi20cnq" (1 ||| 0) (1)
+    let _ = check "or.oi20cnw" (1 ||| 1) (1)
+    let _ = check "or.oi20cne" (1 ||| 2) (3)
+    let _ = check "or.oi20cnr" (0x80808080 ||| 0x08080808) (0x88888888)
+    let _ = check "or.oi20cnr" (0x8080808080808080L ||| 0x0808080808080808L) (0x8888888888888888L)
+
+    let _ = check "and.oi20cnq" (1 &&& 0) (0)
+    let _ = check "and.oi20cnw" (1 &&& 1) (1)
+    let _ = check "and.oi20cne" (1 &&& 2) (0)
+    let _ = check "and.oi20cnr" (0x80808080 &&& 0x08080808) (0)
+    let _ = check "and.oi20cnr" (0x8080808080808080L &&& 0x0808080808080808L) (0L)
+
+    let _ = check "opt.oi20cna" (1L <<< 0) (1L)
+    let _ = check "opt.oi20cns" (1L <<< 1) (2L)
+    let _ = check "opt.oi20cnd" (1L <<< 2) (4L)
+    let _ = check "opt.oi20cnf" (1L <<< 31) (0x80000000L)
+    let _ = check "opt.oi20cng" (1L <<< 32) (0x100000000L)
+    let _ = check "opt.oi20cnh" (1L <<< 63) (0x8000000000000000L)
+    let _ = check "opt.oi20cnj" (1L <<< 64) (1L)
+    let _ = check "opt.oi20cnk" (1L <<< 127) (0x8000000000000000L)
+
+    let _ = check "opt.oi20cnza" (0x80000000l >>> 0) (0x80000000)
+    let _ = check "opt.oi20cnxa" (0x80000000l >>> 1) (0xC0000000)
+    let _ = check "opt.oi20cnca" (0x80000000l >>> 31) (0xFFFFFFFF)
+    let _ = check "opt.oi20cnva" (0x80000000l >>> 32) (0x80000000)
+
+    let _ = check "opt.oi20cnzb" (0x80000000ul >>> 0) (0x80000000ul)
+    let _ = check "opt.oi20cnxb" (0x80000000ul >>> 1) (0x40000000ul)
+    let _ = check "opt.oi20cncb" (0x80000000ul >>> 31) (1ul)
+    let _ = check "opt.oi20cnvb" (0x80000000ul >>> 32) (0x80000000ul)
+
+    let _ = check "opt.oi20c77qa" (0x80000000UL >>> 0) (0x80000000UL)
+    let _ = check "opt.oi20c77wa" (0x80000000UL >>> 1) (0x40000000UL)
+    let _ = check "opt.oi20c77ea" (0x80000000UL >>> 31) (1UL)
+    let _ = check "opt.oi20c77ra" (0x80000000UL >>> 32) (0UL)
+    let _ = check "opt.oi20c77ta" (0x8000000000000000UL >>> 63) (1UL)
+    let _ = check "opt.oi20c77ya" (0x8000000000000000UL >>> 64) (0x8000000000000000UL)
+
+    let _ = check "opt.oi20c77qb" (0x80000000L >>> 0) (0x80000000L)
+    let _ = check "opt.oi20c77wb" (0x80000000L >>> 1) (0x40000000L)
+    let _ = check "opt.oi20c77ebb" (0x80000000L >>> 31) (1L)
+    let _ = check "opt.oi20c77rb" (0x80000000L >>> 32) (0L)
+    let _ = check "opt.oi20c77tb" (0x8000000000000000L >>> 63) (0xFFFFFFFFFFFFFFFFL)
+    let _ = check "opt.oi20c77yb" (0x8000000000000000L >>> 64) (0x8000000000000000L)
+
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 868: repro - mod_float
+ *--------------------------------------------------------------------------- *)
+
+let mod_float (x:float) (y:float) = x % y
+
+do check "mod_floatvrve" (mod_float  3.0  2.0)  1.0
+do check "mod_float3121" (mod_float  3.0 -2.0)  1.0
+do check "mod_float2e12" (mod_float -3.0  2.0)  -1.0
+do check "mod_floatve23" (mod_float -3.0 -2.0)  -1.0    
+do check "mod_floatvr24" (mod_float  3.0  1.0)  0.0
+do check "mod_floatcw34" (mod_float  3.0 -1.0)  0.0
+
+
+(*---------------------------------------------------------------------------
+!* misc tests of IEnumerable functions
+ *--------------------------------------------------------------------------- *)
+
+module Seq = 
+
+    let generate openf compute closef = 
+        seq { let r = openf() 
+              try 
+                let x = ref None
+                while (x := compute r; (!x).IsSome) do
+                    yield (!x).Value
+              finally
+                 closef r }
+
+module MiscIEnumerableTests = begin
+
+    open System.Net
+    open System.IO
+
+    #if Portable
+    #else
+    /// generate the sequence of lines read off an internet connection
+    let httpSeq (nm:string) = 
+           Seq.generate 
+             (fun () -> new StreamReader(((WebRequest.Create(nm)).GetResponse()).GetResponseStream()) ) 
+             (fun os -> try Some(os.ReadLine()) with _ -> None) 
+             (fun os -> os.Close())
+    #endif
+
+    /// generate an infinite sequence using an functional cursor
+    let dataSeq1 = Seq.unfold (fun s -> Some(s,s+1)) 0
+
+    /// generate an infinite sequence using an imperative cursor
+    let dataSeq2 = Seq.generate 
+                      (fun () -> ref 0) 
+                      (fun r -> r := !r + 1; Some(!r)) 
+                      (fun r -> ())
+end
+
+
+(*---------------------------------------------------------------------------
+!* systematic tests of IEnumerable functions
+ *--------------------------------------------------------------------------- *)
+
+(* Assertive IEnumerators should:
+   a) fail if .Current is called before .MoveNext().
+   b) return the items in order.
+   c) allow for calling .Current multiple times without "effects".
+   d) fail if .Current is called after .MoveNext() returned false.
+   e) fail if .MoveNext is called after it returned false.
+*)   
+
+
+let expectFailure desc thunk = try thunk(); printf "expectFailure: no exn from %s " desc; reportFailure "unlabelled test" with e -> ()
+
+open System.Collections.Generic
+
+let checkIEnumerable (ie:'a System.Collections.Generic.IEnumerable) =
+  let e = ie.GetEnumerator() in e.Dispose()
+  let e = ie.GetEnumerator() in
+  expectFailure "checkIEnumerable: current before next" (fun () -> e.Current |> ignore);
+  expectFailure "checkIEnumerable: current before next" (fun () -> e.Current |> ignore);
+  let mutable ritems = [] in
+  while e.MoveNext() do
+    let xA = e.Current in
+    let xB = e.Current in
+    test "vwnwer" (xA = xB);
+    ritems <- xA :: ritems
+  done;
+  expectFailure "checkIEnumerable: .Current  should fail after .MoveNext() return false" (fun () -> e.Current |> ignore);
+  test "vwnwer" (e.MoveNext() = false);
+  //expectFailure "checkIEnumerable: .MoveNext should fail after .MoveNext() return false" (fun () -> e.MoveNext());
+  (* again! *)
+  expectFailure "checkIEnumerable: .Current  should fail after .MoveNext() return false" (fun () -> e.Current |> ignore); 
+  test "vwnwer" (e.MoveNext() = false); 
+  //expectFailure "checkIEnumerable: .MoveNext should fail after .MoveNext() return false" (fun () -> e.MoveNext());
+  List.rev ritems
+
+let xxs  = [  0;1;2;3;4;5;6;7;8;9  ]
+let xxa  = [| 0;1;2;3;4;5;6;7;8;9 |]  
+let xie = Seq.ofArray xxa
+let verify = test ""
+
+do verify(xxs = checkIEnumerable xie)
+do printf "Test c2eh2\n"; stdout.Flush(); let pred x = x<4                 in verify(List.choose (fun x -> if pred x then Some x else None)  xxs = checkIEnumerable (Seq.choose (fun x -> if pred x then Some x else None) xie))
+do printf "Test c2e23ch2\n"; stdout.Flush();  let pred x = x<4                 in verify(List.filter pred xxs = checkIEnumerable (Seq.filter pred xie))
+do printf "Test cc42eh2\n"; stdout.Flush();  let pred x = x%3=0               in verify(List.filter pred xxs = checkIEnumerable (Seq.filter pred xie))
+do printf "Test c2f3eh2\n"; stdout.Flush();  let pred x = x%3=0               in verify(List.choose (fun x -> if pred x then Some x else None)  xxs = checkIEnumerable (Seq.choose (fun x -> if pred x then Some x else None) xie))
+do printf "Test c2eh2\n"; stdout.Flush();  let pred x = x>100               in verify(List.filter pred xxs = checkIEnumerable (Seq.filter pred xie))
+do printf "Test c2egr3h2\n"; stdout.Flush();  let pred x = x>100               in verify(List.choose (fun x -> if pred x then Some x else None)  xxs = checkIEnumerable (Seq.choose (fun x -> if pred x then Some x else None) xie))
+do printf "Test c2eh2\n"; stdout.Flush();  let f   x  = x*2                 in verify(List.map  f xxs = checkIEnumerable (Seq.map  f xie))
+// disabling this guy for now, as it's failing
+// do printf "Test cvaw2eh2\n"; stdout.Flush(); verify ([ 2;3 ] = checkIEnumerable (Seq.generate (fun () -> ref 1) (fun r -> incr r; if !r > 3 then None else Some(!r)) (fun r -> ())))
+do printf "Test c2r5eh2\n"; stdout.Flush();  let f i x  = x*20+i              in verify(List.mapi f xxs = checkIEnumerable (Seq.mapi f xie))
+do printf "Test c2vreeh2\n"; stdout.Flush();  let f _ x  = x*x                 in verify(List.map2 f xxs xxs = checkIEnumerable (Seq.map2 f xie xie))
+do printf "Test c2vreeh2\n"; stdout.Flush();  let f _ x  = x*x                 in verify(List.map2 f xxs xxs = checkIEnumerable (Seq.map2 f xie xie))
+do let f _ x  = x*x                 in verify(List.concat [] = checkIEnumerable (Seq.concat [| |]))
+do let f _ x  = x*x                 in verify(List.concat [xxs] = checkIEnumerable (Seq.concat [|  xie |]))
+do let f _ x  = x*x                 in verify(List.concat [xxs;xxs] = checkIEnumerable (Seq.concat [| xie; xie |]))
+do let f _ x  = x*x                 in verify(List.concat [xxs;xxs;xxs] = checkIEnumerable (Seq.concat [| xie; xie;xie |]))
+do printf "Test c25reh2\n"; stdout.Flush();  let f _ x  = x*x                 in verify(List.append xxs xxs = checkIEnumerable (Seq.append xie xie))
+do printf "Test c27mog7keh2\n"; stdout.Flush();  let f x    = if x%2 =0 then Some x
+                                                              else None in verify(List.choose f xxs = checkIEnumerable (Seq.choose f xie))
+do printf "Test c2e8,h2\n"; stdout.Flush();  let f z x  = (z+1) * x % 1397    in verify(List.fold f 2 xxs = Seq.fold f 2 xie)
+do printfn "seq reduce"; if Seq.reduce (fun x y -> x/y) [5*4*3*2; 4;3;2;1] = 5 then stdout.WriteLine "YES" else  reportFailure "basic test Q"
+
+do printf "Test c2grgeh2\n"; stdout.Flush();  verify(List.nth xxs 3 = Seq.nth 3 xie)  (* err: args wrong way around for List.nth *)
+
+
+(*---------------------------------------------------------------------------
+!* record effect order
+ *--------------------------------------------------------------------------- *)
+
+let last = ref (-1)
+let increasing n = if !last < n then ( last := n; n ) else (printf "increasing failed for %d\n" n; reportFailure "unlabelled test"; n)
+
+do increasing 0 |> ignore
+do increasing 1 |> ignore
+
+type recordAB = { a : int; b : int }
+
+let ab1 = {a = increasing 2;
+           b = increasing 3;}
+
+let ab2 = {b = increasing 4;
+           a = increasing 5;
+          }
+
+type recordABC = { mutable a : int; b : int; c : int }
+
+do printf "abc1a\n"
+let abc1a = {a = increasing 6;
+             b = increasing 7;
+             c = increasing 8;}
+
+do printf "abc1b\n"  
+let abc1b = {b = increasing 9;
+             c = increasing 10;
+             a = increasing 11;}
+
+do printf "abc1c\n"    
+let abc1c = {c = increasing 12;
+             a = increasing 13;
+             b = increasing 14;
+            }
+
+do printf "abc2a\n"      
+let abc2a = {abc1a with
+               b = increasing 15;
+               c = increasing 16;}
+
+do printf "abc2b\n"        
+let abc2b = {abc1a with
+               c = increasing 17;
+               a = increasing 18;}
+
+do printf "abc2c\n"          
+let abc2c = {abc1a with
+               a = increasing 19;
+               b = increasing 20;}
+
+module FloatParseTests = begin
+    let to_bits (x:float) = System.BitConverter.DoubleToInt64Bits(x)
+    let of_bits (x:int64) = System.BitConverter.Int64BitsToDouble(x)
+
+    let to_string (x:float) = (box x).ToString()
+    let of_string (s:string) = 
+      (* Note System.Double.Parse doesn't handle -0.0 correctly (it returns +0.0) *)
+      let s = s.Trim()  
+      let l = s.Length 
+      let p = 0 
+      let p,sign = if (l >= p + 1 && s.[p] = '-') then 1,false else 0,true 
+      let n = 
+        try 
+          if p >= l then raise (new System.FormatException()) 
+          System.Double.Parse(s.[p..],System.Globalization.CultureInfo.InvariantCulture)
+        with :? System.FormatException -> failwith "Float.of_string"
+      if sign then n else -n
+
+    do check "FloatParse.1" (to_bits (of_string "0.0")) 0L
+    do check "FloatParse.0" (to_bits (of_string "-0.0"))      0x8000000000000000L // (-9223372036854775808L)
+    do check "FloatParse.2" (to_bits (of_string "-1E-127"))   0xa591544581b7dec2L // (-6516334528322609470L)
+    do check "FloatParse.3" (to_bits (of_string "-1E-323"))   0x8000000000000002L // (-9223372036854775806L)
+    do check "FloatParse.4" (to_bits (of_string "-1E-324"))   0x8000000000000000L // (-9223372036854775808L)
+    do check "FloatParse.5" (to_bits (of_string "-1E-325"))   0x8000000000000000L // (-9223372036854775808L)
+    do check "FloatParse.6" (to_bits (of_string "1E-325")) 0L
+    do check "FloatParse.7" (to_bits (of_string "1E-322")) 20L
+    do check "FloatParse.8" (to_bits (of_string "1E-323")) 2L
+    do check "FloatParse.9" (to_bits (of_string "1E-324")) 0L
+    do check "FloatParse.A" (to_bits (of_string "Infinity"))  0x7ff0000000000000L // 9218868437227405312L
+    do check "FloatParse.B" (to_bits (of_string "-Infinity")) 0xfff0000000000000L // (-4503599627370496L)
+    do check "FloatParse.C" (to_bits (of_string "NaN"))       0xfff8000000000000L  // (-2251799813685248L)
+    do check "FloatParse.D" (to_bits (of_string "-NaN"))    ( // http://en.wikipedia.org/wiki/NaN
+                                                              let bit64 = System.IntPtr.Size = 8 in
+                                                              if bit64 && System.Environment.Version.Major < 4 then
+                                                                  // 64-bit (on NetFx2.0) seems to have same repr for -nan and nan
+                                                                  0xfff8000000000000L // (-2251799813685248L)
+                                                              else
+                                                                  // 64-bit (on NetFx4.0) and 32-bit (any NetFx) seems to flip the sign bit on negation.
+                                                                  // However:
+                                                                  // it seems nan has the negative-bit set from the start,
+                                                                  // and -nan then has the negative-bit cleared!
+                                                                  0x7ff8000000000000L // 9221120237041090560L
+                                                            )
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 709: repro
+ *--------------------------------------------------------------------------- *)
+(*
+// Currently disabled, because IStructuralEquatable.GetHashCode does not support limited hashing
+module CyclicHash = begin
+    type cons = {x : int; mutable xs : cons option}
+    let cycle n =
+      let start = {x = 0; xs = None} in
+      let rec loop cell i =
+        if i >= n then
+          cell.xs <- Some start
+        else (
+          let next = {x = i; xs = None} in
+          cell.xs <- Some next;
+          loop next (i+1)
+        )
+      in
+      loop start 1;
+      start
+
+    type 'a nest = Leaf of 'a | Nest of 'a nest
+    let rec nest n x = if n>0 then Nest(nest (n-1) x) else Leaf x
+
+    let xs = Array.init 100 (fun n -> cycle n)
+    let n = 1
+
+    do
+      for n = 1 to 200 do // <--- should exceed max number of nodes used to hash
+        printf "Hashing array of cyclic structures in %d nest = %d\n" n (hash (nest n xs))
+      done
+
+end
+*)
+
+
+(*---------------------------------------------------------------------------
+!* BUG 701: possible repro
+ *--------------------------------------------------------------------------- *)
+
+(*
+#r "dnAnalytics.dll"
+open dnAnalytics.LinearAlgebra
+
+//   Matrix.op_multiply : Matrix * Vector -> Vector
+//   Matrix.op_multiply : Matrix * Matrix -> Matrix
+//   Matrix.op_multiply : float  * Matrix -> Matrix
+//   Matrix.op_multiply : Matrix * float  -> Matrix
+//   etc...
+
+let gpPredict (kinv:Matrix) (cx:Vector) = 
+        let tmpA = Matrix.op_Multiply(kinv,cx) in
+        let tmpB = kinv * cx in
+        12
+29/09/2006 06:43        Resolved as Fixed by dsyme
+fixed by reverting change in 1.1.12.3
+*)
+
+(*
+
+BUG:
+type Vector = VECTOR
+type Matrix = class
+  val i : int
+  new i = {i=i}
+  static member ( * )((x:Matrix),(y:Vector)) = (y:Vector)
+  static member ( * )((x:Matrix),(y:Matrix)) = (y:Matrix)
+  static member ( * )((x:float),(y:Matrix)) = (y:Matrix)
+  static member ( * )((x:Matrix),(y:float)) = (x:Matrix)   
+end
+
+let gpPredict (kinv:Matrix) (cx:Vector) = 
+        let tmpA = Matrix.op_Multiply(kinv,cx) in
+        let tmpB = kinv * cx in
+        12
+*)
+
+
+(*---------------------------------------------------------------------------
+!* BUG 737: repro - do not expand sharing in large constants...
+ *--------------------------------------------------------------------------- *)
+    
+module BigMamaConstants = begin
+    type constant = Leaf of string | List of constant list
+    let leaf s = Leaf s
+    let list xs  = List xs
+    let constant_test () =
+     let a,b,c = leaf "a",leaf "b",leaf "c" in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     let a,b,c = list [a;b],list [b;c],list [c;a] in
+     a,b,c
+
+end
+
+module StringForAll = begin
+    let _ = "123" |> String.forall (fun c ->  System.Char.IsDigit(c)) |> check "4287fejlk2" true
+    let _ = "123a" |> String.forall (fun c ->  System.Char.IsDigit(c))  |> check "4287f62k2" false
+    let _ = "123a1" |> String.forall (fun c ->  System.Char.IsDigit(c))  |> check "4287wfg2ejlk2" false
+    let _ = "" |> String.forall (fun c ->  System.Char.IsDigit(c))  |> check "4287fbt42" true
+    let _ = "123" |> String.exists (fun c ->  System.Char.IsDigit(c))  |> check "428btwt4ejlk2" true
+    let _ = "123a" |> String.exists (fun c ->  System.Char.IsDigit(c))  |> check "42bwejlk2" true
+    let _ = "123a1" |> String.exists (fun c ->  System.Char.IsDigit(c))  |> check "42b4wt4btwejlk2" true
+    let _ = "" |> String.exists (fun c ->  System.Char.IsDigit(c))  |> check "428bt4w2" false
+    let _ = "a" |> String.exists (fun c ->  System.Char.IsDigit(c))  |> check "428b4wtw4jlk2" false
+
+end
+   
+module RecordLabelTest1 = begin
+ type r = { a: int; b : int }
+ let f x = { x with a = 3 }
+end
+
+module RecordLabelTest2 = begin
+ module SomeOtherPath = begin
+    type r = { a: int; b : int }
+ end
+ let f1 x = { x with SomeOtherPath.a = 3 }
+ let f2 x = { x with SomeOtherPath.r.a = 3 }
+ let f3 (x:SomeOtherPath.r) = { x with a = 3 }
+ open SomeOtherPath
+ let f4 (x:r) = { x with a = 3 }
+ let f5 x = { x with a = 3 }
+end
+
+
+(*---------------------------------------------------------------------------
+!* set union - timings w.r.t. "union by fold"
+ *--------------------------------------------------------------------------- *)
+
+module SetTests = begin
+    let union0 xs ys = Set.fold (fun ys x -> Set.add x ys) ys xs 
+    let union1 xs ys = Set.union xs ys
+
+    let randomInts n =
+      let r = new System.Random() in
+      let rec collect s n = if n>0 then collect (Set.add (r.Next()) s) (n-1) else s in
+      collect Set.empty n
+    let rec rapp2 n f x y = if n=1 then f x y else (let z = f x y in rapp2 (n-1) f x y)
+
+    let time f =
+      let sw = new System.Diagnostics.Stopwatch() in
+      sw.Reset(); sw.Start();
+      let res = f() in
+      float sw.ElapsedMilliseconds / 1000.0
+
+    let unionTest n (nx,ny) =
+      let check (xs:'a Set) = 
+    #if DEBUG
+    #if Portable
+    #else
+          test "vwnwer" (xs.CheckBalanceInvariant);
+    #endif
+    #endif
+          xs in
+      let xs = randomInts nx |> check in
+      let ys = randomInts ny |> check in
+      (* time union ops *)
+      let t0 = time (fun () -> rapp2 n union0 xs ys) in
+      let t1 = time (fun () -> rapp2 n union1 xs ys) in
+      test "vwnwer" (Set.toList (union0 xs ys |> check) = Set.toList (union1 xs ys |> check));
+      printf "-- Union times: (fold = %.6f) (divquonq = %.6f) with t0 = %f on sizes %8d,%-8d and x %d\n" (t0/t0) (t1/t0) t0 nx ny n;
+
+      let test_fold() =
+          let m = Set.ofList [for i in 1..20 -> i] in
+          test "fold 1" (Set.fold (fun acc _ -> acc + 1) 0 m = 20);
+          test "fold 2" (Set.foldBack (fun _ acc -> acc + 1) m 0 = 20);
+          test "fold 3" (Set.fold (fun acc n -> acc + " " + string n) "0" m = String.concat " " [for i in 0..20 -> string i]);
+          test "fold 4" (Set.foldBack (fun n acc -> acc + " " + string n) m "21" = String.concat " " [for i in 21..-1..1 -> string i]);
+          let mmax x y = if x > y then x else y in
+          test "fold 5" (Set.foldBack mmax m 0 = 20);
+          test "fold 6" (m |> Set.fold mmax 0 = 20);
+      in test_fold ()
+
+
+    (* A sample of set sizes for timings *)    
+    do unionTest 500   (100   ,100)
+    do unionTest 500    (100  ,10000)
+    do unionTest 500    (100  ,100)
+    do unionTest 50     (1000 ,1000)
+    #if PERF
+    do unionTest 5      (10000,10000)
+    #endif
+    do unionTest 2000  (10   ,10)
+    do unionTest 20000 (5    ,5)
+    do unionTest 20000 (5    ,10)
+    do unionTest 20000 (5    ,20)
+    do unionTest 20000 (5    ,30)
+    #if PERF
+    do unionTest 900000 (4     ,8)
+    do unionTest 900000 (2     ,10)
+    #endif
+    do unionTest 5000   (100   ,10000)
+end
+
+let checkEqualInt x y = if x<>y then (printf "%d <> %d" x y; reportFailure "unlabelled test")
+do checkEqualInt 1  (int32 1u)
+do checkEqualInt 12 (int32 12u)
+do checkEqualInt 1  (int 1uy)
+do checkEqualInt 12 (int 12uy)
+
+(*---------------------------------------------------------------------------
+!* set/map filter: was bug
+ *--------------------------------------------------------------------------- *)
+do printf "FilterTests: next:\n"; stdout.Flush()
+module FilterTests = begin
+    do printf "FilterTests: start:\n"          
+    let check s e r = 
+      if r = e then  stdout.WriteLine (s^": YES") 
+      else (stdout.WriteLine ("\n***** "^s^": FAIL\n"); reportFailure "basic test Q")
+        
+    let degen() = 
+        let map = 
+            Map.add 1 () 
+             (Map.add 2 () 
+               (Map.add 3 () 
+                 (Map.add 4 () 
+                   (Map.add 5 () Map.empty)))) in
+        let map2 = Map.filter (fun i () -> i < 3) map in
+        Map.toList map2 |> List.map fst
+    do  check "Map.filter (degen)" (degen()) [1;2]
+
+
+    let checkFilters pred xs =
+      let xz = Set.ofList xs in
+      let xz = Set.filter pred xz in
+      let xz = Set.toList xz in
+      let xm = Map.ofList (List.map (fun x -> (x,x)) xs) in
+      let xm = Map.filter (fun x y -> pred x) xm in
+      let xm = Map.toList xm |> List.map fst in
+      let xs = List.filter pred xs in
+      check "Set.filter" (List.sort xs) (List.sort xz);
+      check "Set.filter" (List.sortWith Operators.compare xs) (List.sortWith Operators.compare xz);
+      check "Map.filter" (List.sort xs) (List.sort xm);
+      check "Map.filter" (List.sortWith Operators.compare xs) (List.sortWith Operators.compare xm)
+
+
+    do for i = 0 to 100 do
+        printf "Checking %d " i; checkFilters (fun x -> x<20) [0..i]
+       done
+
+    do printf "FilterTests: end:\n"
+end
+
+
+
+let _ = assert(1=1) 
+
+
+(*---------------------------------------------------------------------------
+!* Bug 1028: conversion functions like int32 do not accept strings, suggested by Mort.
+ *--------------------------------------------------------------------------- *)
+
+do printf "Check bug 1028: conversion functions like int32 do not accept strings, suggested by Mort.\n"
+do check "1028: byte"   (byte   "123") 123uy
+do check "1028: sbyte"  (sbyte  "123") 123y
+do check "1028: int16"  (int16  "123") 123s
+do check "1028: uint16" (uint16 "123") 123us
+do check "1028: int32"  (int32  "123") 123
+do check "1028: uint32" (uint32 "123") 123u
+do check "1028: int64"  (int64  "123") 123L
+do check "1028: uint64" (uint64 "123") 123uL
+
+do check "coiewj01" (char 32) ' '
+do check "coiewj02" (char 32.0) ' '
+do check "coiewj03" (char 32.0f) ' '
+do check "coiewj04" (char 32uy) ' '
+do check "coiewj05" (char 32y) ' '
+do check "coiewj06" (char 32s) ' '
+do check "coiewj07" (char 32us) ' '
+do check "coiewj08" (char 32L) ' '
+do check "coiewj09" (char 32UL) ' '
+do check "coiewj0q" (char 32u) ' '
+do check "coiewj0w" (char 32n) ' '
+do check "coiewj0e" (char 32un) ' '
+
+
+do check "coiewj0r" (Checked.char 32) ' '
+do check "coiewj0t" (Checked.char 32.0) ' '
+do check "coiewj0y" (Checked.char 32.0f) ' '
+do check "coiewj0u" (Checked.char 32uy) ' '
+do check "coiewj0i" (Checked.char 32y) ' '
+do check "coiewj0o" (Checked.char 32s) ' '
+do check "coiewj0p" (Checked.char 32us) ' '
+do check "coiewj0a" (Checked.char 32L) ' '
+do check "coiewj0s" (Checked.char 32UL) ' '
+do check "coiewj0d" (Checked.char 32u) ' '
+do check "coiewj0f" (Checked.char 32n) ' '
+do check "coiewj0g" (Checked.char 32un) ' '
+
+do check "coiewj0z" (try Checked.char (-1) with _ -> ' ') ' '
+do check "coiewj0x" (try Checked.char (-1.0) with _ -> ' ') ' '
+do check "coiewj0c" (try Checked.char (-1.0f) with _ -> ' ') ' '
+do check "coiewj0v" (try Checked.char (-1y) with _ -> ' ') ' '
+do check "coiewj0b" (try Checked.char (-1s) with _ -> ' ') ' '
+do check "coiewj0n" (try Checked.char (-1L) with _ -> ' ') ' '
+do check "coiewj0m" (try Checked.char (-1n) with _ -> ' ') ' '
+
+
+do check "coiewj0aa" (try Checked.char (0x10000) with _ -> ' ') ' '
+do check "coiewj0ss" (try Checked.char (65537.0) with _ -> ' ') ' '
+do check "coiewj0dd" (try Checked.char (65537.0f) with _ -> ' ') ' '
+do check "coiewj0ff" (try Checked.char (0x10000L) with _ -> ' ') ' '
+do check "coiewj0gg" (try Checked.char (0x10000n) with _ -> ' ') ' '
+
+do check "coiewj0z" (try Checked.uint16 (-1) with _ -> 17us) 17us
+do check "coiewj0x" (try Checked.uint16 (-1.0) with _ -> 17us) 17us
+do check "coiewj0c" (try Checked.uint16 (-1.0f) with _ -> 17us) 17us
+do check "coiewj0v" (try Checked.uint16 (-1y) with _ -> 17us) 17us
+do check "coiewj0b" (try Checked.uint16 (-1s) with _ -> 17us) 17us
+do check "coiewj0n" (try Checked.uint16 (-1L) with _ -> 17us) 17us
+do check "coiewj0m" (try Checked.uint16 (-1n) with _ -> 17us) 17us
+
+do check "coiewj0aa" (try Checked.uint16 (0x10000) with _ -> 17us) 17us
+do check "coiewj0ss" (try Checked.uint16 (65537.0) with _ -> 17us) 17us
+do check "coiewj0dd" (try Checked.uint16 (65537.0f) with _ -> 17us) 17us
+do check "coiewj0ff" (try Checked.uint16 (0x10000L) with _ -> 17us) 17us
+do check "coiewj0gg" (try Checked.uint16 (0x10000n) with _ -> 17us) 17us
+
+
+do check "clwnwe9831" (sprintf "%A" 1) "1"
+do check "clwnwe9832" (sprintf "%A" 10.0) "10.0"
+do check "clwnwe9833" (sprintf "%A" 10.0f) "10.0f"
+do check "clwnwe9834" (sprintf "%A" 1s) "1s"
+do check "clwnwe9835" (sprintf "%A" 1us) "1us"
+do check "clwnwe9836" (sprintf "%A" 'c') "'c'"
+do check "clwnwe9837" (sprintf "%A" "c") "\"c\""
+do check "clwnwe9838" (sprintf "%A" 1y) "1y"
+do check "clwnwe9839" (sprintf "%A" 1uy) "1uy"
+do check "clwnwe983q" (sprintf "%A" 1L) "1L"
+do check "clwnwe983w" (sprintf "%A" 1UL) "1UL"
+do check "clwnwe983e" (sprintf "%A" 1u) "1u"
+do check "clwnwe983r" (sprintf "%A" [1]) "[1]"
+do check "clwnwe983t" (sprintf "%A" [1;2]) "[1; 2]"
+do check "clwnwe983y" (sprintf "%A" [1,2]) "[(1, 2)]"
+do check "clwnwe983u" (sprintf "%A" (1,2)) "(1, 2)"
+do check "clwnwe983i" (sprintf "%A" (1,2,3)) "(1, 2, 3)"
+do check "clwnwe983o" (sprintf "%A" (Some(1))) "Some 1"
+do check "clwnwe983p" (sprintf "%A" (Some(Some(1)))) "Some (Some 1)"
+
+do check "clwnwe91" 10m 10m
+do check "clwnwe92" 10m 10.000m
+do check "clwnwe93" 1000000000m 1000000000m
+do check "clwnwe94" (4294967296000000000m.ToString()) "4294967296000000000"
+#if Portable
+#else
+do check "clwnwe95" (10.000m.ToString(System.Globalization.CultureInfo.GetCultureInfo(1033).NumberFormat)) "10.000"  // The actual output of a vanilla .ToString() depends on current culture UI. For this reason I am specifying the en-us culture.
+#endif
+do check "clwnwe96" (10m.ToString()) "10"
+do check "clwnwe97" (sprintf "%A" 10m) "10M"
+do check "clwnwe98" (sprintf "%A" 10M) "10M"
+do check "clwnwe99" (sprintf "%A" 10.00M) "10.00M"
+do check "clwnwe9q" (sprintf "%A" -10.00M) "-10.00M"
+do check "clwnwe9w" (sprintf "%A" -0.00M) "0.00M"
+do check "clwnwe9w" (sprintf "%A" 0.00M) "0.00M"
+do check "clwnwe9e" (sprintf "%A" -0M) "0M"
+do check "clwnwe9r" (sprintf "%A" 0M) "0M"
+do check "clwnwe9t" (sprintf "%A" (+0M)) "0M"
+do check "clwnwe9t1" (sprintf "%A" 18446744073709551616000000000m) "18446744073709551616000000000M"
+do check "clwnwe9t2" (sprintf "%A" -79228162514264337593543950335m) "-79228162514264337593543950335M"
+do check "clwnwe9t3" (sprintf "%A" -0.0000000000000000002147483647m) "-0.0000000000000000002147483647M"
+do check "clwnwe9t4" (sprintf "%A" (10.00M + 10M)) "20.00M"
+do check "clwnwe9t5" (sprintf "%A" (10.00M + 10M)) "20.00M"
+
+do check "clwnwe9t6" 13.00M (10.00M + decimal 3.0)
+do check "clwnwe9t8" 13.00M (10.00M + decimal 3)
+do check "clwnwe9t9" 13.00M (10.00M + decimal 3y)
+do check "clwnwe9tq" 13.00M (10.00M + decimal 3uy)
+do check "clwnwe9tw" 13.00M (10.00M + decimal 3us)
+do check "clwnwe9te" 13.00M (10.00M + decimal 3s)
+do check "clwnwe9tr" 13.00M (10.00M + decimal 3l)
+do check "clwnwe9tt" 13.00M (10.00M + decimal 3ul)
+do check "clwnwe9ty" 13.00M (10.00M + decimal 3L)
+do check "clwnwe9tu" 13.00M (10.00M + decimal 3UL)
+do check "clwnwe9ti" 13.00M (10.00M + decimal 3n)
+do check "clwnwe9to" 13.00M (10.00M + decimal 3un)
+do check "clwnwe9tp" 13.00M (10.00M + decimal 3.0f)
+
+do check "clwnwe9ta" 13.00 (float 13.00M)
+do check "clwnwe9ts" 13 (int32 13.00M)
+do check "clwnwe9td" 13s (int16 13.00M)
+do check "clwnwe9tf" 13y (sbyte 13.00M)
+do check "clwnwe9tg" 13L (int64 13.00M)
+do check "clwnwe9th" 13u (uint32 13.00M)
+do check "clwnwe9tj" 13us (uint16 13.00M)
+do check "clwnwe9tk" 13uy (byte 13.00M)
+do check "clwnwe9tl" 13UL (uint64 13.00M)
+
+do check "lkvcnwd09a" 10.0M (20.0M - 10.00M)
+do check "lkvcnwd09s" 200.000M (20.0M * 10.00M)
+do check "lkvcnwd09d" 2.0M (20.0M / 10.00M)
+do check "lkvcnwd09f" 0.0M (20.0M % 10.00M)
+do check "lkvcnwd09g" 2.0M (20.0M % 6.00M)
+do check "lkvcnwd09h" 20.0M (floor 20.300M)
+do check "lkvcnwd09j" 20.0 (floor 20.300)
+do check "lkvcnwd09k" 20.0f (floor 20.300f)
+#if Portable
+// bug 500323
+#else
+do check "lkvcnwd09l" 20.0M (round 20.300M)
+do check "lkvcnwd09z" 20.0M (round 20.500M)
+do check "lkvcnwd09x" 22.0M (round 21.500M)
+#endif
+do check "lkvcnwd09c" 20.0 (round 20.300)
+do check "lkvcnwd09v" 20.0 (round 20.500)
+do check "lkvcnwd09b" 22.0 (round 21.500)
+do check "lkvcnwd09n" 1 (sign 20.300)
+do check "lkvcnwd09m" (-1) (sign (-20.300))
+do check "lkvcnwd091" (-1) (sign (-20))
+do check "lkvcnwd092" 1 (sign 20)
+do check "lkvcnwd093" 0 (sign 0)
+do check "lkvcnwd094" 0 (sign (-0))
+do check "lkvcnwd095" 0 (sign (-0))
+do check "lkvcnwd096" 0 (sign 0y)
+do check "lkvcnwd097" 0 (sign 0s)
+do check "lkvcnwd098" 0 (sign 0L)
+
+do check "lkvcnwd099" 1 (sign 1y)
+do check "lkvcnwd09q" 1 (sign 1s)
+do check "lkvcnwd09w" 1 (sign 1L)
+
+do check "lkvcnwd09e" (-1) (sign (-1y))
+do check "lkvcnwd09r" (-1) (sign (-1s))
+do check "lkvcnwd09t" (-1) (sign (-1L))
+
+// Check potential optimization bugs
+
+do check "cenonoiwe1" (3 > 1) true
+do check "cenonoiwe2" (3y > 1y) true
+do check "cenonoiwe3" (3uy > 1uy) true
+do check "cenonoiwe4" (3s > 1s) true
+do check "cenonoiwe5" (3us > 1us) true
+do check "cenonoiwe6" (3 > 1) true
+do check "cenonoiwe7" (3u > 1u) true
+do check "cenonoiwe8" (3L > 1L) true
+do check "cenonoiwe9" (3UL > 1UL) true
+
+do check "cenonoiweq" (3 >= 1) true
+do check "cenonoiwew" (3y >= 1y) true
+do check "cenonoiwee" (3uy >= 1uy) true
+do check "cenonoiwer" (3s >= 1s) true
+do check "cenonoiwet" (3us >= 1us) true
+do check "cenonoiwey" (3 >= 1) true
+do check "cenonoiweu" (3u >= 1u) true
+do check "cenonoiwei" (3L >= 1L) true
+do check "cenonoiweo" (3UL >= 1UL) true
+
+do check "cenonoiwea" (3 >= 3) true
+do check "cenonoiwes" (3y >= 3y) true
+do check "cenonoiwed" (3uy >= 3uy) true
+do check "cenonoiwef" (3s >= 3s) true
+do check "cenonoiweg" (3us >= 3us) true
+do check "cenonoiweh" (3 >= 3) true
+do check "cenonoiwej" (3u >= 3u) true
+do check "cenonoiwek" (3L >= 3L) true
+do check "cenonoiwel" (3UL >= 3UL) true
+
+
+do check "cenonoiwd1" (3 < 1) false
+do check "cenonoiwd2" (3y < 1y) false
+do check "cenonoiwd3" (3uy < 1uy) false
+do check "cenonoiwd4" (3s < 1s) false
+do check "cenonoiwd5" (3us < 1us) false
+do check "cenonoiwd6" (3 < 1) false
+do check "cenonoiwd7" (3u < 1u) false
+do check "cenonoiwd8" (3L < 1L) false
+do check "cenonoiwd9" (3UL < 1UL) false
+
+do check "cenonoiwdq" (3 <= 1) false
+do check "cenonoiwdw" (3y <= 1y) false
+do check "cenonoiwde" (3uy <= 1uy) false
+do check "cenonoiwdr" (3s <= 1s) false
+do check "cenonoiwdt" (3us <= 1us) false
+do check "cenonoiwdy" (3 <= 1) false
+do check "cenonoiwdu" (3u <= 1u) false
+do check "cenonoiwdi" (3L <= 1L) false
+do check "cenonoiwdo" (3UL <= 1UL) false
+
+do check "cenonoiwda" (3 <= 3) true
+do check "cenonoiwds" (3y <= 3y) true
+do check "cenonoiwdd" (3uy <= 3uy) true
+do check "cenonoiwdf" (3s <= 3s) true
+do check "cenonoiwdg" (3us <= 3us) true
+do check "cenonoiwdh" (3 <= 3) true
+do check "cenonoiwdj" (3u <= 3u) true
+do check "cenonoiwdk" (3L <= 3L) true
+do check "cenonoiwdl" (3UL <= 3UL) true
+
+do check "cenonoiwdz" (4 + 2) 6
+do check "cenonoiwdx" (4y + 2y) 6y
+do check "cenonoiwdc" (4uy + 2uy) 6uy
+do check "cenonoiwdv" (4s + 2s) 6s
+do check "cenonoiwdb" (4us + 2us) 6us
+do check "cenonoiwdn" (4 + 2) 6
+do check "cenonoiwdm" (4u + 2u) 6u
+do check "cenonoiwdl" (4L + 2L) 6L
+do check "cenonoiwdp" (4UL + 2UL) 6UL
+
+do check "cenonoiwc1" (4 - 2) 2
+do check "cenonoiwc2" (4y - 2y) 2y
+do check "cenonoiwc3" (4uy - 2uy) 2uy
+do check "cenonoiwc4" (4s - 2s) 2s
+do check "cenonoiwc5" (4us - 2us) 2us
+do check "cenonoiwc6" (4 - 2) 2
+do check "cenonoiwc7" (4u - 2u) 2u
+do check "cenonoiwc8" (4L - 2L) 2L
+do check "cenonoiwc9" (4UL - 2UL) 2UL
+
+do check "cenonoiwcq" (4 * 2) 8
+do check "cenonoiwcw" (4y * 2y) 8y
+do check "cenonoiwce" (4uy * 2uy) 8uy
+do check "cenonoiwcr" (4s * 2s) 8s
+do check "cenonoiwct" (4us * 2us) 8us
+do check "cenonoiwcy" (4 * 2) 8
+do check "cenonoiwcu" (4u * 2u) 8u
+do check "cenonoiwci" (4L * 2L) 8L
+do check "cenonoiwco" (4UL * 2UL) 8UL
+
+do check "cenonoiwc" (4 / 2) 2
+do check "cenonoiwc" (4y / 2y) 2y
+do check "cenonoiwc" (4uy / 2uy) 2uy
+do check "cenonoiwc" (4s / 2s) 2s
+do check "cenonoiwc" (4us / 2us) 2us
+do check "cenonoiwc" (4 / 2) 2
+do check "cenonoiwc" (4u / 2u) 2u
+do check "cenonoiwc" (4L / 2L) 2L
+do check "cenonoiwc" (4UL / 2UL) 2UL
+
+do check "cenonoiwc" (-(4)) (-4)
+do check "cenonoiwc" (-(4y)) (-4y)
+do check "cenonoiwc" (-(4s)) (-4s)
+do check "cenonoiwc" (-(4L)) (-4L)
+
+
+do check "cenonoiwc" (4 % 3) 1
+do check "cenonoiwc" (4y % 3y) 1y
+do check "cenonoiwc" (4uy % 3uy) 1uy
+do check "cenonoiwc" (4s % 3s) 1s
+do check "cenonoiwc" (4us % 3us) 1us
+do check "cenonoiwc" (4 % 3) 1
+do check "cenonoiwc" (4u % 3u) 1u
+do check "cenonoiwc" (4L % 3L) 1L
+do check "cenonoiwc" (4UL % 3UL) 1UL
+
+do check "cenonoiwc" (0b010 <<< 3) 0b010000
+do check "cenonoiwc" (0b010y <<< 3) 0b010000y
+do check "cenonoiwc" (0b010uy <<< 3) 0b010000uy
+do check "cenonoiwc" (0b010s <<< 3) 0b010000s
+do check "cenonoiwc" (0b010us <<< 3) 0b010000us
+do check "cenonoiwc" (0b010u <<< 3) 0b010000u
+do check "cenonoiwc" (0b010L <<< 3) 0b010000L
+do check "cenonoiwc" (0b010UL <<< 3) 0b010000UL
+
+do check "cenonoiwc" (0b010000 >>> 3) 0b010
+do check "cenonoiwc" (0b010000y >>> 3) 0b010y
+do check "cenonoiwc" (0b010000uy >>> 3) 0b010uy
+do check "cenonoiwc" (0b010000s >>> 3) 0b010s
+do check "cenonoiwc" (0b010000us >>> 3) 0b010us
+do check "cenonoiwc" (0b010000u >>> 3) 0b010u
+do check "cenonoiwc" (0b010000L >>> 3) 0b010L
+do check "cenonoiwc" (0b010000UL >>> 3) 0b010UL
+
+do check "cenonoiwc" (sbyte 4) 4y
+do check "cenonoiwc" (byte 4) 4uy
+do check "cenonoiwc" (int16 4) 4s
+do check "cenonoiwc" (uint16 4) 4us
+do check "cenonoiwc" (int32 4) 4
+do check "cenonoiwc" (uint32 4) 4u
+do check "cenonoiwc" (int64 4) 4L
+do check "cenonoiwc" (uint64 4) 4UL
+
+do check "cenonoiwc" (sbyte 4y) 4y
+do check "cenonoiwc" (byte 4y) 4uy
+do check "cenonoiwc" (int16 4y) 4s
+do check "cenonoiwc" (uint16 4y) 4us
+do check "cenonoiwc" (int32 4y) 4
+do check "cenonoiwc" (uint32 4y) 4u
+do check "cenonoiwc" (int64 4y) 4L
+do check "cenonoiwc" (uint64 4y) 4UL
+
+
+do check "cenonoiwc" (sbyte 4uy) 4y
+do check "cenonoiwc" (byte 4uy) 4uy
+do check "cenonoiwc" (int16 4uy) 4s
+do check "cenonoiwc" (uint16 4uy) 4us
+do check "cenonoiwc" (int32 4uy) 4
+do check "cenonoiwc" (uint32 4uy) 4u
+do check "cenonoiwc" (int64 4uy) 4L
+do check "cenonoiwc" (uint64 4uy) 4UL
+
+
+do check "cenonoiwc" (sbyte 4s) 4y
+do check "cenonoiwc" (byte 4s) 4uy
+do check "cenonoiwc" (int16 4s) 4s
+do check "cenonoiwc" (uint16 4s) 4us
+do check "cenonoiwc" (int32 4s) 4
+do check "cenonoiwc" (uint32 4s) 4u
+do check "cenonoiwc" (int64 4s) 4L
+do check "cenonoiwc" (uint64 4s) 4UL
+
+do check "cenonoiwc" (sbyte 4us) 4y
+do check "cenonoiwc" (byte 4us) 4uy
+do check "cenonoiwc" (int16 4us) 4s
+do check "cenonoiwc" (uint16 4us) 4us
+do check "cenonoiwc" (int32 4us) 4
+do check "cenonoiwc" (uint32 4us) 4u
+do check "cenonoiwc" (int64 4us) 4L
+do check "cenonoiwc" (uint64 4us) 4UL
+
+do check "cenonoiwc" (sbyte 4u) 4y
+do check "cenonoiwc" (byte 4u) 4uy
+do check "cenonoiwc" (int16 4u) 4s
+do check "cenonoiwc" (uint16 4u) 4us
+do check "cenonoiwc" (int32 4u) 4
+do check "cenonoiwc" (uint32 4u) 4u
+do check "cenonoiwc" (int64 4u) 4L
+do check "cenonoiwc" (uint64 4u) 4UL
+
+do check "cenonoiwc" (sbyte 4L) 4y
+do check "cenonoiwc" (byte 4L) 4uy
+do check "cenonoiwc" (int16 4L) 4s
+do check "cenonoiwc" (uint16 4L) 4us
+do check "cenonoiwc" (int32 4L) 4
+do check "cenonoiwc" (uint32 4L) 4u
+do check "cenonoiwc" (int64 4L) 4L
+do check "cenonoiwc" (uint64 4L) 4UL
+
+
+do check "cenonoiwc" (sbyte 4UL) 4y
+do check "cenonoiwc" (byte 4UL) 4uy
+do check "cenonoiwc" (int16 4UL) 4s
+do check "cenonoiwc" (uint16 4UL) 4us
+do check "cenonoiwc" (int32 4UL) 4
+do check "cenonoiwc" (uint32 4UL) 4u
+do check "cenonoiwc" (int64 4UL) 4L
+do check "cenonoiwc" (uint64 4UL) 4UL
+do check "cenonoiwc" (match null with null -> 2 | _ -> 1) 2
+
+
+(*---------------------------------------------------------------------------
+!* Bug 1029: Support conversion functions named after C# type names? e.g. uint for uint32
+ *--------------------------------------------------------------------------- *)
+
+do check "1029: byte"   (byte   "123") 123uy
+do check "1029: sbyte"  (sbyte  "123") 123y
+(*
+do printf "Check bug 1029: Support conversion functions named after C# type names? e.g. uint for uint32\n"
+do check "1029: short"  (short  "123") 123s
+do check "1029: ushort" (ushort "123") 123us
+do check "1029: int"    (int    "123") 123
+do check "1029: uint"   (uint   "123") 123u
+do check "1029: long"   (int64  "123") 123L
+do check "1029: ulong"  (uint64 "123") 123uL    
+do check "1029: int8"   (int8   "123") 123y
+do check "1029: uint8"  (uint8  "123") 123uy
+*)
+
+do check "1029: int16"  (int16  "123") 123s
+do check "1029: uint16" (uint16 "123") 123us
+do check "1029: int32"  (int32  "123") 123
+do check "1029: uint32" (uint32 "123") 123u
+do check "1029: int64"  (int64  "123") 123L
+do check "1029: uint64" (uint64 "123") 123uL
+
+do check "1029: float32" (float32 "1.2") 1.2f    
+do check "1029: float"   (float   "1.2") 1.2
+
+do check "1029: single"  (single  "1.2") 1.2f
+do check "1029: double"  (double  "1.2") 1.2
+
+
+(*---------------------------------------------------------------------------
+!* BUG 945: comment lexing does not handle slash-quote inside quoted strings
+ *--------------------------------------------------------------------------- *)
+
+(* THIS COMMENT IS THE TEST, DO NOT DELETE
+   let x = "abc"
+   let x = "abc\""
+   let x = "\"abc"
+*)
+
+
+(*---------------------------------------------------------------------------
+!* BUG 946: comment lexing does not handle double-quote and backslash inside @-strings
+ *--------------------------------------------------------------------------- *)
+
+(* THIS COMMENT IS THE TEST, DO NOT DELETE
+   let x = @"abc"
+   let x = @"abc\"
+   let x = @"\a\bc\"
+   let x = @"abc\""and still @-string here tested be ending as follows \"
+*)
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1080: Seq.cache_all does not have the properties of cache
+ *--------------------------------------------------------------------------- *)
+
+
+module SeqCacheTests = begin
+    let countStart = ref 0
+    let countIter  = ref 0
+    let countStop  = ref 0
+    let oneUseSequence =
+        Seq.generate (fun () -> incr countStart; ref 0)
+                     (fun r  -> incr countIter;  incr r; if !r=10 then None else Some !r)
+                     (fun r  -> incr countStop)
+    let manyUseSeq = Seq.cache oneUseSequence
+
+    do check "Bug1080" (!countStart,!countIter,!countStop) (0,0,0)
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 0  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 2  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 3  |> Seq.toArray in
+      ()
+    manyUseSeq (* In fsi, printing forces some walking of manyUseSeq *)
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 6   |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 100 |> Seq.toArray in
+      ()
+    do check "Bug1080" (!countStart,!countIter,!countStop) (1,10,1)
+    
+    do (box manyUseSeq :?> System.IDisposable) .Dispose() 
+    do countStart := 0; countIter  := 0; countStop  := 0
+
+    do check "Bug1080" (!countStart,!countIter,!countStop) (0,0,0)
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 0  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 2  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 3  |> Seq.toArray in
+      ()
+    manyUseSeq (* In fsi, printing forces some walking of manyUseSeq *)
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 6   |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 100 |> Seq.toArray in
+      ()
+    do check "Bug1080" (!countStart,!countIter,!countStop) (1,10,1)
+    do (box manyUseSeq :?> System.IDisposable) .Dispose() 
+    do countStart := 0; countIter  := 0; countStop  := 0
+    do check "Bug1080" (!countStart,!countIter,!countStop) (0,0,0)
+
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 0  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 2  |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 3  |> Seq.toArray in
+      ()
+    manyUseSeq (* In fsi, printing forces some walking of manyUseSeq *)
+    let () =
+      let xs = manyUseSeq |> Seq.truncate 6   |> Seq.toArray in
+      let xs = manyUseSeq |> Seq.truncate 100 |> Seq.toArray in
+      ()
+
+    do check "Bug1080" (!countStart,!countIter,!countStop) (1,10,1)
+
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 747: Parsing (expr :> type) as top-level expression in fsi requires brackets, grammar issue
+ *--------------------------------------------------------------------------- *)
+
+(*Pending inclusion...
+(* Do not delete  below, they are part of the test, since they delimit the interactions *)
+
+12 : int                 (* <-- without brackets, this was rejected by fsi *)
+"12" :> System.Object    (* <-- without brackets, this was rejected by fsi *)
+(box "12") :?> string    (* <-- without brackets, this was rejected by fsi *)
+  
+*)
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1049: Adding string : 'a -> string, test cases.
+ *--------------------------------------------------------------------------- *)
+
+do printf "Bug1049: string conversion checks\n"
+do check "Bug1049.int8"       (string 123y)     "123"
+do check "Bug1049.int16"      (string 123s)     "123"
+do check "Bug1049.int32"      (string 123)      "123"
+do check "Bug1049.int64"      (string 123L)     "123"
+do check "Bug1049.nativeint"  (string 123n)     "123"
+    
+do check "Bug1049.-int8"      (string (-123y))  "-123"
+do check "Bug1049.-int16"     (string (-123s))  "-123"
+do check "Bug1049.-int32"     (string (-123))   "-123"
+do check "Bug1049.-int64"     (string (-123L))  "-123"
+do check "Bug1049.-nativeint" (string (-123n))  "-123"
+    
+do check "Bug1049.uint8"      (string 123uy)    "123"
+do check "Bug1049.uint16"     (string 123us)    "123"
+do check "Bug1049.uint32"     (string 123u)     "123"
+do check "Bug1049.uint64"     (string 123uL)    "123"
+do check "Bug1049.unativeint" (string 123un)    "123"
+
+do check "Bug1049.float64"    (string 1.234)                           "1.234"
+do check "Bug1049.float64"    (string (-1.234))                        "-1.234"
+do check "Bug1049.float64"    (string System.Double.NaN)               "NaN"
+do check "Bug1049.float64"    (string System.Double.PositiveInfinity)  "Infinity"
+do check "Bug1049.float64"    (string System.Double.NegativeInfinity)  "-Infinity"
+do check "Bug1049.float64"    (string nan)                             "NaN"
+do check "Bug1049.float64"    (string infinity)                        "Infinity"
+do check "Bug1049.float64"    (string (-infinity))                     "-Infinity"
+
+do check "Bug1049.float32"    (string 1.234f)                          "1.234"
+do check "Bug1049.float32"    (string (-1.234f))                       "-1.234"
+do check "Bug1049.float32"    (string System.Single.NaN)               "NaN"
+do check "Bug1049.float32"    (string System.Single.PositiveInfinity)  "Infinity"
+do check "Bug1049.float32"    (string System.Single.NegativeInfinity)  "-Infinity"
+
+type ToStringClass(x) =
+  class
+    override this.ToString() = x
+  end
+do check "Bug1049.customClass" (string (ToStringClass("fred"))) "fred"
+
+[<Struct>]
+type ToStringStruct =
+  struct
+    val x : int
+    new(x) = {x=x}
+    override this.ToString() = string this.x
+  end
+do check "Bug1049.customStruct" (string (ToStringStruct(123))) "123"
+
+type ToStringEnum = 
+    | A = 1
+    | B = 2
+do check "bug5995.Enum.A" (string ToStringEnum.A) "A"
+do check "bug5995.Enum.B" (string ToStringEnum.B) "B"    
+
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1178: Seq.init and Seq.initInfinite implemented using Seq.unfold which evaluates Current on every step
+ *--------------------------------------------------------------------------- *)
+
+module Check1178 = begin
+  do printf "\n\nTest 1178: check finite/infinite sequences have lazy (f i) for each i\n\n"  
+  (* Test cases for Seq.nth. *)
+  let counter = ref 0
+  let reset r = r := 0
+  let fails f = try f() |> ignore;false with _ -> true
+  let claim x = check "Bugs 1178/1482" x true
+  
+  (* Bug 1178: Check Seq.init only computes f on the items requested *)
+  let initial_100 = Seq.init 100 (fun i -> incr counter; i)
+  do reset counter; claim(Seq.nth 0  initial_100=0);  claim(!counter = 1)
+  do reset counter; claim(Seq.nth 50 initial_100=50); claim(!counter = 1)
+  do reset counter; claim(fails (fun () -> Seq.nth 100 initial_100));   claim(!counter = 0)
+  do reset counter; claim(fails (fun () -> Seq.nth (-10) initial_100)); claim(!counter = 0)
+
+  let initial_w = Seq.initInfinite (fun i -> incr counter; i)
+  do reset counter; claim(Seq.nth 0  initial_w=0);  claim(!counter = 1)
+  do reset counter; claim(Seq.nth 50 initial_w=50); claim(!counter = 1)
+  do reset counter; claim(fails (fun () -> Seq.nth (-10) initial_w)); claim(!counter = 0)
+  do reset counter; claim(fails (fun () -> Seq.nth (-1) initial_w)); claim(!counter = 0)
+
+  (* Check *)
+  let on p f x y = f (p x) (p y)
+  do claim(on Seq.toArray (=) (Seq.init 10 (fun x -> x*10)) (seq { for x in 0 .. 9 -> x*10 }))
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1482: Seq.initInfinite overflow and Seq.init negative count to be trapped
+ *--------------------------------------------------------------------------- *)
+
+#if LONGTESTS
+  do printf "\n\nTest 1482: check that an infinite sequence fails after i = Int32.MaxValue. This may take ~40 seconds.\n\n"
+  do claim(fails (fun () -> Seq.length initial_w))
+#endif
+end
+
+module IntegerLoopsWithMinAndMaxIntAndKnownBounds =  begin
+    let x0() = 
+      let r = new ResizeArray<_>() in
+      for i = 0 to 10 do
+         r.Add i
+      done;
+      check "clkevrw1" (List.ofSeq r) [ 0 .. 10]
+
+    let x1() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MinValue to System.Int32.MinValue + 2 do
+        r.Add i
+     done;
+     check "clkevrw2" (List.ofSeq r) [System.Int32.MinValue .. System.Int32.MinValue + 2]
+
+    let x2() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue - 3 to System.Int32.MaxValue - 1 do
+        r.Add i
+     done;
+     check "clkevrw3" (List.ofSeq r) [System.Int32.MaxValue - 3 .. System.Int32.MaxValue - 1]
+
+    let x3() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue - 3 to System.Int32.MaxValue  do
+        r.Add i 
+     done;
+     check "clkevrw4" (List.ofSeq r) [System.Int32.MaxValue - 3 .. System.Int32.MaxValue ]
+
+    let x4() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue to System.Int32.MaxValue  do
+        r.Add i
+     done;
+     check "clkevrw5" (List.ofSeq r) [System.Int32.MaxValue .. System.Int32.MaxValue ]
+
+    let x5() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MinValue to System.Int32.MinValue do
+        r.Add i
+     done;
+     check "clkevrw6" (List.ofSeq r) [System.Int32.MinValue .. System.Int32.MinValue ]
+
+    let x6() = 
+      for lower in [ -5 .. 5 ] do
+         for upper in [ -5 .. 5 ] do
+              let r = new ResizeArray<_>() in
+              for i = lower to upper do
+                 r.Add i
+              done;
+              check "clkevrw7" (List.ofSeq r) [ lower .. upper ]
+         done;
+      done
+    do x0()
+    do x1()
+    do x2()
+    do x3()
+    do x4()
+    do x5()
+    do x6()
+end
+
+module IntegerLoopsWithMinAndMaxIntAndKnownBoundsGoingDown = begin
+
+    let x0() = 
+      let r = new ResizeArray<_>() in
+      for i = 10 downto 0 do
+         r.Add i
+      done;
+      check "clkevrw1" (List.ofSeq r |> List.rev) [ 0 .. 10]
+
+    let x1() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MinValue + 2 downto System.Int32.MinValue do
+        r.Add i
+     done;
+     check "clkevrw2" (List.ofSeq r |> List.rev) [System.Int32.MinValue .. System.Int32.MinValue + 2]
+
+    let x2() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue - 1 downto System.Int32.MaxValue - 3 do
+        r.Add i
+     done;
+     check "clkevrw3" (List.ofSeq r |> List.rev) [System.Int32.MaxValue - 3 .. System.Int32.MaxValue - 1]
+
+    let x3() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue downto System.Int32.MaxValue - 3  do
+        r.Add i 
+     done;
+     check "clkevrw4" (List.ofSeq r |> List.rev) [System.Int32.MaxValue - 3 .. System.Int32.MaxValue ]
+
+    let x4() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MaxValue downto System.Int32.MaxValue  do
+        r.Add i
+     done;
+     check "clkevrw5" (List.ofSeq r |> List.rev) [System.Int32.MaxValue .. System.Int32.MaxValue ]
+
+    let x5() = 
+     let r = new ResizeArray<_>() in
+     for i = System.Int32.MinValue downto System.Int32.MinValue do
+        r.Add i
+     done;
+     check "clkevrw6" (List.ofSeq r |> List.rev) [System.Int32.MinValue .. System.Int32.MinValue ]
+
+    let x6() = 
+      for lower in [ -5 .. 5 ] do
+         for upper in [ -5 .. 5 ] do
+              let r = new ResizeArray<_>() in
+              for i = upper downto lower  do
+                 r.Add i
+              done;
+              check "clkevrw7" (List.ofSeq r |> List.rev) [ lower .. upper ]
+          done;
+      done
+ 
+    do x0()
+    do x1()
+    do x2()
+    do x3()
+    do x4()
+    do x5()
+    do x6()
+
+
+end 
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1477: struct with field offset attributes on fields throws assertions in fsi
+ *--------------------------------------------------------------------------- *)
+
+module Check1477 = begin
+  (* FSI ilreflect regression *)
+  open System.Runtime.InteropServices
+  [<Struct>] 
+  [<StructLayout(LayoutKind.Explicit)>]
+  type Align16 = struct
+    [<FieldOffset(0)>]
+    val x0      : string
+    [<FieldOffset(8)>]
+    val x1      : string
+  end
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1561: (-star-star-) opens a comment but does not close it and other XML Doc issues.
+ *--------------------------------------------------------------------------- *)
+
+(* QA note: how to test for XML doc? Programatically? *)
+module Check1561 = begin
+ (** Should be XML Doc *)
+ let itemA = () 
+ (** Should be XML Doc too even with a * inside *)      
+ let itemB = ()
+ (*** No longer XML Doc, since it starts with 3 stars *)
+ let itemC = ()
+ (**)
+ let itemD = ()
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1750: ilxgen stack incorrect during multi-branch match tests
+ *--------------------------------------------------------------------------- *)
+
+module Repro1750 = begin
+    let rec loop x = loop x
+    let f p x =
+      let test = 
+        match int16 x with
+          | 0s  when (try p x finally ()) -> 3
+    (*    | 1  when (for x = 1 to 100 do printf "" done; true) -> 3 *)
+          | _ -> 5
+      in
+      loop test
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 2247: Unverifiable code from struct valued tyfunc
+ *--------------------------------------------------------------------------- *)
+
+module Repro2247 = begin
+
+  [<Struct>]
+  type MyLazy<'a> = struct
+    [<DefaultValue(false)>]
+    val mutable f : unit -> int
+    member this.InitFun ff = this.f <- ff
+  end
+
+  let my_lazy_from_fun f =
+    let r = MyLazy<_>() in    (* Keep this binding, required for repro *)
+    r                         (* Warning: Fragile repro *)
+
+  (* With optimisations off, code failed to verify *)
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1190, 3569: record and list patterns do not permit trailing seperator
+ *--------------------------------------------------------------------------- *)
+
+module Repro_1190 = begin
+  type R = {p:int;q:int}
+  let fA {p=p;q=q}  = p+q
+  let fB {p=p;q=q;} = p+q (* Fix 1190 *)
+end
+
+module Repro_3569 = begin
+  let f    []     = 12
+(*let fx   [;]    = 12 -- this is not permitted *)
+  let fA   [p]    = p
+  let fAx  [p;]   = p       
+  let fAA  [p;q]  = p+q
+  let fAAx [p;q;] = p+q (* Fix 3569 *)
+end
+
+
+
+
+(*---------------------------------------------------------------------------
+!* BUG 3947
+ *--------------------------------------------------------------------------- *)
+
+module Repro_3947 = begin
+  type          PublicType   = PTA | PTB of int
+  type internal InternalType = ITA | ITB of int
+#if COMPILING_WITH_EMPTY_SIGNATURE
+  // PublicType is not actually public if there is a signature
+#else
+  do  check "Bug3947.Public%A"    (sprintf "%A (%A)"   PTA (PTB 2)) "PTA (PTB 2)"
+#endif
+  do  check "Bug3947.Public%+A"   (sprintf "%+A (%+A)" PTA (PTB 2)) "PTA (PTB 2)"
+  do  check "Bug3947.Internal%+A" (sprintf "%+A (%+A)" ITA (ITB 2)) "ITA (ITB 2)"
+
+  // The follow are not very useful outputs, but adding regression tests to pick up any changes...
+  do  check "Bug3947.Internal%A.ITA" true (let str = sprintf "%A" ITA     in str.EndsWith("InternalType+_ITA"))
+  do  check "Bug3947.Internal%A.ITB" true (let str = sprintf "%A" (ITB 2) in str.EndsWith("InternalType+ITB"))
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 4063: ilreflect ctor emit regression - Type/TypeBuilder change
+ *--------------------------------------------------------------------------- *)
+
+let _ = printf "========== Bug 4063 repro ==========\n"
+
+// ctor case
+type 'a T4063 = AT4063 of 'a
+let valAT3063 = AT4063 12
+
+type M4036<'a> = class new(x:'a) = {} end
+let v4063 =  M4036<int>(1)
+
+// method case?
+type Taaaaa<'a>() = class end
+type Taaaaa2<'a>() = class inherit Taaaaa<'a>() member x.M() = x end
+
+// method case?
+type Tbbbbb<'a>(x:'a) = class member this.M() = x end
+type T2bbbbbb(x) = class inherit Tbbbbb<string>(x) end
+(let t2 = T2bbbbbb("2") in t2.M)
+
+let _ = printf "========== Bug 4063 done. ==========\n"
+
+
+(*---------------------------------------------------------------------------
+!* BUG 4139: %A formatter does not accept width, e.g. printf "%10000A"
+ *--------------------------------------------------------------------------- *)
+
+module Check4139 = begin
+  do  check "Bug4139.percent.A" (sprintf "%8A"   [1..10]) "[1; 2; 3;\n 4; 5; 6;\n 7; 8; 9;\n 10]"
+  do  check "Bug4139.percent.A" (sprintf "%8.4A" [1..10]) "[1; 2; 3;\n 4; ...]"
+  do  check "Bug4139.percent.A" (sprintf "%0.4A" [1..10]) "[1; 2; 3; 4; ...]"
+end
+
+
+(*---------------------------------------------------------------------------
+!* BUG 1043: Can (-star-) again be lexed specially and recognised as bracket-star-bracket?
+ *--------------------------------------------------------------------------- *)
+
+(* Make this the last test since it confuses fontification in tuareg mode *)  
+module Check1043 = begin
+ (* LBRACKET STAR RBRACKET becomes a valid operator identifier *)
+ let (*) = 12            
+ let x   = (*)           
+ let f (*) = 12 + (*) 
+ let x24 = f 12
+end
+
+
+(*---------------------------------------------------------------------------
+!* Tail-cons optimized operators temporarily put 'null' in lists
+ *--------------------------------------------------------------------------- *)
+
+let rec checkForNoNullsInList a = 
+  test "non-null list check" (match box a with null -> false | _ -> true);
+  match a with 
+  | [] -> ()
+  | h::t -> checkForNoNullsInList t
+    
+
+module TestNoNullElementsInListChainFromPartition = begin
+
+
+
+ let test l = 
+   printfn "testing %A" l;
+   let a,b = List.partition (fun x -> x = 1) l in
+   checkForNoNullsInList a;
+   checkForNoNullsInList b
+
+
+ let _ = 
+  test []
+
+ let _ = 
+  for i in [1;2] do 
+       test [i]
+  done
+
+ let _ = 
+  for i in [1;2] do 
+    for j in [1;2] do 
+       test [i;j]
+    done
+  done
+
+ let _ = 
+  for i in [1;2] do 
+    for j in [1;2] do 
+      for k in [1;2] do 
+        test [i;j;k]
+      done
+    done
+  done
+
+end
+
+module TestNoNullElementsInListChainFromInit = begin
+
+
+
+ let test n x = 
+   printfn "testing %A" n;
+   let a = List.init n x in
+   checkForNoNullsInList a
+
+
+ let _ = 
+  for i in 0..5 do
+      test i (fun i -> i + 1)
+
+  done
+
+end
+
+
+module TestNoNullElementsInListChainFromUnzip = begin
+
+
+
+ let test x = 
+   printfn "testing %A" x;
+   let a,b = List.unzip x in
+   checkForNoNullsInList a;
+   checkForNoNullsInList b
+
+
+ let _ = 
+  for i in 0..5 do
+      test (List.init i (fun i -> (i,i)))
+
+  done
+
+end
+
+
+module TestNoNullElementsInListChainFromUnzip3 = begin
+
+ let test x = 
+   printfn "testing %A" x;
+   let a,b,c = List.unzip3 x in
+   checkForNoNullsInList a;
+   checkForNoNullsInList b;
+   checkForNoNullsInList c
+
+
+ let _ = 
+  for i in 0..5 do
+      test (List.init i (fun i -> (i,i,i)))
+
+  done
+
+end
+
+module TestListToString = begin
+
+  do check "lknsdv0vrknl0" ([].ToString())  "[]"
+  do check "lknsdv0vrknl1" ([1].ToString())  "[1]"
+  do check "lknsdv0vrknl2" ([1; 2].ToString())  "[1; 2]"
+  do check "lknsdv0vrknl3" ([1; 2; 3].ToString())  "[1; 2; 3]"
+  do check "lknsdv0vrknl4" ([1; 2; 3; 4].ToString())  "[1; 2; 3; ... ]"
+  do check "lknsdv0vrknl5" (["1"].ToString())  "[1]"  // unfortunate but true - no quotes
+  do check "lknsdv0vrknl6" (["1"; null].ToString())  "[1; null]"
+  do check "lknsdv0vrknl7" ([None].ToString())  "[null]" // unfortunate but true
+
+  do check "lknsdv0vrknl01" (Some(1).ToString())  "Some(1)" 
+  do check "lknsdv0vrknl02" (Some(None).ToString())  "Some(null)" // unfortunate but true
+  do check "lknsdv0vrknl03" (Some(1,2).ToString())  "Some((1, 2))" // unfortunate but true
+  do check "lknsdv0vrknl04" (Some(Some(1)).ToString())  "Some(Some(1))"
+end
+
+
+
+module SetToString = begin
+    do check "cewjhnkrveo1" ((set []).ToString()) "set []"
+    do check "cewjhnkrveo2" ((set [1]).ToString()) "set [1]"
+    do check "cewjhnkrveo3" ((set [1;2]).ToString()) "set [1; 2]"
+    do check "cewjhnkrveo4" ((set [1;2;3]).ToString()) "set [1; 2; 3]"
+    do check "cewjhnkrveo5" ((set [3;2;1]).ToString()) "set [1; 2; 3]"
+    do check "cewjhnkrveo6" ((set [2;3;4]).ToString()) "set [2; 3; 4]"
+    do check "cewjhnkrveo7" ((set [1;2;3;4]).ToString()) "set [1; 2; 3; ... ]"
+    do check "cewjhnkrveo8" ((set [4;3;2;1]).ToString()) "set [1; 2; 3; ... ]"
+
+    do check "cewjhnkrveo11" ((Map.ofList []).ToString()) "map []"
+    do check "cewjhnkrveo21" ((Map.ofList [(1,10)]).ToString()) "map [(1, 10)]"
+    do check "cewjhnkrveo31" ((Map.ofList [(1,10);(2,20)]).ToString()) "map [(1, 10); (2, 20)]"
+    do check "cewjhnkrveo41" ((Map.ofList [(1,10);(2,20);(3,30)]).ToString()) "map [(1, 10); (2, 20); (3, 30)]"
+    do check "cewjhnkrveo51" ((Map.ofList [(3,30);(2,20);(1,10)]).ToString()) "map [(1, 10); (2, 20); (3, 30)]"
+    do check "cewjhnkrveo61" ((Map.ofList [(2,20);(3,30);(4,40)]).ToString()) "map [(2, 20); (3, 30); (4, 40)]"
+    do check "cewjhnkrveo71" ((Map.ofList [(1,10);(2,20);(3,30);(4,40)]).ToString()) "map [(1, 10); (2, 20); (3, 30); ... ]"
+    do check "cewjhnkrveo81" ((Map.ofList [(4,40);(3,30);(2,20);(1,10)]).ToString()) "map [(1, 10); (2, 20); (3, 30); ... ]"
+
+    do check "cewjhnkrveo1p" ((set []) |> sprintf "%A") "set []"
+    do check "cewjhnkrveo2p" ((set [1]) |> sprintf "%A") "set [1]"
+    do check "cewjhnkrveo3p" ((set [1;2]) |> sprintf "%A") "set [1; 2]"
+    do check "cewjhnkrveo4p" ((set [1;2;3]) |> sprintf "%A") "set [1; 2; 3]"
+    do check "cewjhnkrveo5p" ((set [3;2;1]) |> sprintf "%A") "set [1; 2; 3]"
+    do check "cewjhnkrveo6p" ((set [2;3;4]) |> sprintf "%A") "set [2; 3; 4]"
+    do check "cewjhnkrveo7p" ((set [1;2;3;4]) |> sprintf "%A") "set [1; 2; 3; 4]"
+    do check "cewjhnkrveo8p" ((set [4;3;2;1]) |> sprintf "%A") "set [1; 2; 3; 4]"
+
+    do check "cewjhnkrveo11p" ((Map.ofList []) |> sprintf "%A") "map []"
+    do check "cewjhnkrveo21p" ((Map.ofList [(1,10)]) |> sprintf "%A") "map [(1, 10)]"
+    do check "cewjhnkrveo31p" ((Map.ofList [(1,10);(2,20)]) |> sprintf "%A") "map [(1, 10); (2, 20)]"
+    do check "cewjhnkrveo41p" ((Map.ofList [(1,10);(2,20);(3,30)]) |> sprintf "%A") "map [(1, 10); (2, 20); (3, 30)]"
+    do check "cewjhnkrveo51p" ((Map.ofList [(3,30);(2,20);(1,10)]) |> sprintf "%A") "map [(1, 10); (2, 20); (3, 30)]"
+    do check "cewjhnkrveo61p" ((Map.ofList [(2,20);(3,30);(4,40)]) |> sprintf "%A") "map [(2, 20); (3, 30); (4, 40)]"
+    do check "cewjhnkrveo71p" ((Map.ofList [(1,10);(2,20);(3,30);(4,40)]) |> sprintf "%A") "map [(1, 10); (2, 20); (3, 30); (4, 40)]"
+    do check "cewjhnkrveo81p" ((Map.ofList [(4,40);(3,30);(2,20);(1,10)]) |> sprintf "%A") "map [(1, 10); (2, 20); (3, 30); (4, 40)]"
+end
+
+(*---------------------------------------------------------------------------
+!* Bug 5816: Unable to define mutually recursive types with mutually recursive generic constraints within FSI
+ *--------------------------------------------------------------------------- *)
+module Bug5816 = begin
+  type IView<'v, 'vm when 'v :> IView<'v,'vm> and 'vm :> IViewModel<'v,'vm>> = interface
+        abstract ViewModel : 'vm
+    end 
+  and IViewModel<'v, 'vm when 'v :> IView<'v,'vm> and 'vm :> IViewModel<'v,'vm>> = interface
+        abstract View : 'v
+    end 
+end
+(*---------------------------------------------------------------------------
+!* Bug 5825: Constraints with nested types
+ *--------------------------------------------------------------------------- *)
+module Bug5825 = begin
+  type I = interface
+        abstract member m : unit 
+    end
+  type C() = class
+        interface I with 
+            member this.m = () 
+        end
+    end
+  let f (c : #C) = () 
+end
+
+module Bug5981 = begin
+    // guard against type variable tokens leaking into the IL stream
+    // (in this case, we're trying to ensure that the lambda is handled properly)
+    let t1 = Array2D.init 2 2 (fun x y -> x,y)
+    
+    // test basic use of indirect calling
+    let t2 = Array2D.zeroCreate<int> 10 10
+    
+    let throwAnException (a: int) =
+        raise (System.Exception("Foo!"))
+        Array2D.zeroCreate<'T> a a
+            
+    let throwAnExceptionUnit () =
+        raise (System.Exception("Foo!"))
+        Array2D.zeroCreate<'T> 10 10
+        
+    // ensure that TargetInvocationException is properly unwrapped
+    do test "cwewe0982" ((try throwAnException<int>(10) |> ignore ; false with | :? System.Reflection.TargetInvocationException -> false | _ -> true))
+    
+    // same as above, making sure that we handle methods that take no args properly
+    do test "cwewe0982" ((try throwAnExceptionUnit<int>() |> ignore ; false with | :? System.Reflection.TargetInvocationException -> false | _ -> true))
+        
+end
+
+module Bug920236 = 
+  open System.Collections
+  open System.Collections.Generic
+
+  type Arr(a : int[]) =
+      interface IEnumerable with
+          member this.GetEnumerator() = 
+              let i = ref -1
+              { new IEnumerator with
+                  member this.Reset() = failwith "not supported"
+                  member this.MoveNext() = incr i; !i < a.Length
+                  member this.Current = box (a.[!i]) 
+              }
+
+  let a = Arr([|1|])
+  let result = ref []
+  for i in a do
+      result := i::(!result)  
+  do test "hfduweyr" (!result = [box 1])
+    
+
+module TripleQuoteStrings = 
+
+    check "ckjenew-0ecwe1" """Hello world""" "Hello world"
+    check "ckjenew-0ecwe2" """Hello "world""" "Hello \"world"
+    check "ckjenew-0ecwe3" """Hello ""world""" "Hello \"\"world"
+#if INTERACTIVE // FSI prints \r\n or \n depending on PIPE vs FEED so we'll just skip it
+#else
+    check "ckjenew-0ecwe4" """Hello 
+""world""" "Hello \r\n\"\"world"
+#endif
+    // cehcek there is no escaping...
+    check "ckjenew-0ecwe5" """Hello \"world""" "Hello \\\"world"
+    check "ckjenew-0ecwe6" """Hello \\"world""" "Hello \\\\\"world"
+    check "ckjenew-0ecwe7" """Hello \nworld""" "Hello \\nworld"
+    check "ckjenew-0ecwe8" """Hello \""" "Hello \\"
+    check "ckjenew-0ecwe9" """Hello \\""" "Hello \\\\"
+    check "ckjenew-0ecwe10" """Hello \n""" "Hello \\n"
+
+    // check some embedded comment terminators
+    check "ckjenew-0ecwe11" (* """Hello *) world""" *) """Hello world""" "Hello world"
+    check "ckjenew-0ecwe1" (* (* """Hello *) world""" *) *) """Hello world""" "Hello world"
+    check "ckjenew-0ecwe2" (* """Hello *) "world""" *) """Hello "world""" "Hello \"world"
+
+
+module FloatInRegisterConvertsToFloat = 
+
+    let simpleTest() = 
+        let x : float = -1.7976931348623157E+308 
+        let sum = x + x 
+        let equal = (sum = float (x + x))
+        test "vw09rwejkn" equal 
+
+    simpleTest()
+(*---------------------------------------------------------------------------
+!* Bug 122495: Bad code generation in code involving structs/property settings/slice operator
+ *--------------------------------------------------------------------------- *)  
+module bug122495 =
+    [<Struct>]
+    [<NoComparison;NoEquality>]
+    type C =
+        [<DefaultValue>]
+        val mutable private goo : byte []
+        // Note: you need some kind of side effect or use of 'x' here
+        member this.P with set(x) = this.goo <- x
+    
+    let a = [|0uy..10uy|]
+    // this should not throw an InvalidProgramException    
+    let c = C( P = a.[0..1])
+
+
+#if Portable
+#else
+(*---------------------------------------------------------------------------
+!* Bug 33760: wrong codegen for params[] Action overload
+ *--------------------------------------------------------------------------- *)      
+module bug33760 =
+    open System
+    open System.Threading.Tasks
+    
+    type C() = 
+        static member M1([<ParamArray>] arg: System.Action []) = ()
+
+    // these just need to typecheck
+    C.M1(fun () -> ())
+    Parallel.Invoke(fun () -> ())
+#endif
+
+
+module Regression_139182 = 
+    [<Struct>]
+    type S =
+      member x.TheMethod() = x.TheMethod() : int64
+    let theMethod (s:S) = s.TheMethod()
+    type T() =
+      static let s = S()
+      static let str = "test"
+      let s2 = S()
+      static member Prop1 = s.TheMethod()                // error FS0422
+      static member Prop2 = theMethod s                  // ok
+      static member Prop3 = let s' = s in s'.TheMethod() // ok
+      static member Prop4 = str.ToLower()                // ok
+      member x.Prop5      = s2.TheMethod()               // ok
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/lift/build.bat b/tests/fsharp/core/lift/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/lift/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/lift/run.bat b/tests/fsharp/core/lift/run.bat
new file mode 100644
index 0000000..7b0b526
--- /dev/null
+++ b/tests/fsharp/core/lift/run.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/lift/test.fsx b/tests/fsharp/core/lift/test.fsx
new file mode 100644
index 0000000..4d5f54f
--- /dev/null
+++ b/tests/fsharp/core/lift/test.fsx
@@ -0,0 +1,69 @@
+// #Conformance #Regression 
+#if Portable
+module Core_lift
+#endif
+let failures = ref false
+let report_failure s  = 
+  stderr.WriteLine ("NO: test "^s^" failed"); failures := true
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(* one lifted binding, one lifted expression *)
+let test2924 () = 
+  let constt = [2;3;4]  (* closed *) in 
+  List.map (fun i -> i+2)  (* closed *) constt
+
+let _ = if test2924 () <> [4;5;6]  then report_failure "iniiu9"
+
+(* two lifted expressions *)
+let test2925 () = 
+  List.map (fun i -> i + 6)  (* closed *) [2;3;4]  (* closed *)
+
+let _ = if test2925 () <> [8;9;10] then report_failure "iniiu9h39"
+
+(* one lifted binding, one lifted expression *)
+let test2926 () = 
+  let f = fun i -> i+i+i  (* closed *) in 
+  List.map f [2;3;4]  (* closed *)
+
+let _ = if test2926 () <> [6;9;12] then report_failure "iui2iu284"
+
+(* one lifted binding, one lifted nested binding, one lifted expression *)
+let test2946 () = 
+  let f = fun i -> i+i+i  (* closed *) in 
+  List.map f ((let g = (fun j -> j+j) (* closed *) in  g 1):: [3;4;])  (* closed *)
+
+let _ = if test2946 () <> [6;9;12] then report_failure "72uiu284"
+
+(* make sure references don't get lifted *)
+let test2947 () = 
+  let f () = let x = ref 1 (* not closed *) in (fun i -> x := !x + i; !x  (* not closed *)) in 
+  if (f () 3 <> 4) then report_failure "jd23er84";
+  (* this would fail if we had listed the "ref" expression *)
+  if (f () 3 <> 4) then report_failure "jdbtr284";
+  (* these check we don't do any silly optimizations in the presence of side effects *)
+  let f2 = f () in 
+  if (f2 3 <> 4) then report_failure "jd2dvr4";
+  if (f2 3 <> 7) then report_failure "jd232d"
+
+let _ = test2947()
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/load-script/1.fsx b/tests/fsharp/core/load-script/1.fsx
new file mode 100644
index 0000000..2da7b48
--- /dev/null
+++ b/tests/fsharp/core/load-script/1.fsx
@@ -0,0 +1,2 @@
+// #Conformance #FSI 
+printfn "Hello"
diff --git a/tests/fsharp/core/load-script/2.fsx b/tests/fsharp/core/load-script/2.fsx
new file mode 100644
index 0000000..c001ca9
--- /dev/null
+++ b/tests/fsharp/core/load-script/2.fsx
@@ -0,0 +1,3 @@
+// #Conformance #FSI 
+#load "1.fsx"
+printfn "World"
diff --git a/tests/fsharp/core/load-script/3.fsx b/tests/fsharp/core/load-script/3.fsx
new file mode 100644
index 0000000..ccdf099
--- /dev/null
+++ b/tests/fsharp/core/load-script/3.fsx
@@ -0,0 +1,3 @@
+// #Conformance #FSI 
+#load "2.fsx"
+printfn "-the end"
diff --git a/tests/fsharp/core/load-script/FlagCheck.fs b/tests/fsharp/core/load-script/FlagCheck.fs
new file mode 100644
index 0000000..e32787b
--- /dev/null
+++ b/tests/fsharp/core/load-script/FlagCheck.fs
@@ -0,0 +1,8 @@
+// #Conformance #FSI 
+#nowarn "22"
+#if INTERACTIVE
+printfn "INTERACTIVE is defined"
+#endif
+#if COMPILED
+printfn "COMPILED is defined"
+#endif
diff --git a/tests/fsharp/core/load-script/FlagCheck.fsx b/tests/fsharp/core/load-script/FlagCheck.fsx
new file mode 100644
index 0000000..b54f260
--- /dev/null
+++ b/tests/fsharp/core/load-script/FlagCheck.fsx
@@ -0,0 +1,7 @@
+// #Conformance #FSI 
+#if INTERACTIVE
+printfn "INTERACTIVE is defined"
+#endif
+#if COMPILED
+printfn "COMPILED is defined"
+#endif
diff --git a/tests/fsharp/core/load-script/ProjectDriver.fsx b/tests/fsharp/core/load-script/ProjectDriver.fsx
new file mode 100644
index 0000000..e614c5a
--- /dev/null
+++ b/tests/fsharp/core/load-script/ProjectDriver.fsx
@@ -0,0 +1,11 @@
+// #Conformance #FSI 
+#load "ThisProject.fsx"
+
+[<System.Obsolete("x")>]
+let fn x = 0
+let y = fn 1 // This would be an 'obsolete' warning but ThisProject.fsx nowarns it
+
+printfn "Result = %d" (Namespace.Type.Method())
+
+let rf = typeof<System.Web.Mobile.CookielessData>
+printfn "Type from referenced assembly = %s" (rf.ToString())
diff --git a/tests/fsharp/core/load-script/ProjectFile.fs b/tests/fsharp/core/load-script/ProjectFile.fs
new file mode 100644
index 0000000..b985d35
--- /dev/null
+++ b/tests/fsharp/core/load-script/ProjectFile.fs
@@ -0,0 +1,4 @@
+// #Conformance #FSI 
+namespace Namespace
+type Type = 
+    static member Method() = 99
diff --git a/tests/fsharp/core/load-script/ThisProject.fsx b/tests/fsharp/core/load-script/ThisProject.fsx
new file mode 100644
index 0000000..b4af5a6
--- /dev/null
+++ b/tests/fsharp/core/load-script/ThisProject.fsx
@@ -0,0 +1,4 @@
+// #Conformance #FSI 
+#nowarn "44" // This construct is deprecated
+#load "ProjectFile.fs"
+#r "System.Web.Mobile.dll"
diff --git a/tests/fsharp/core/load-script/build.bat b/tests/fsharp/core/load-script/build.bat
new file mode 100644
index 0000000..8c614c2
--- /dev/null
+++ b/tests/fsharp/core/load-script/build.bat
@@ -0,0 +1,53 @@
+if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+script > out.txt 2>&1
+
+if NOT EXIST out.bsl COPY out.txt
+
+%FSDIFF% out.txt out.bsl > out.diff
+%FSDIFF% z.output.fsi.help.txt z.output.fsi.help.bsl > z.output.fsi.help.diff
+
+echo ======== Differences From ========
+TYPE  out.diff
+echo ========= Differences To =========
+
+
+for /f %%c IN (out.diff do (
+  echo NOTE -------------------------------------
+  echo NOTE ---------- THERE ARE DIFFs ----------
+  echo NOTE -------------------------------------
+  echo .  
+  echo To update baselines: "sd edit *bsl", "del *bsl", "build.bat" regenerates bsl, "sd diff ...", check what changed.  
+  goto Error
+)
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+rem Hardwire ERRORLEVEL to be 1, since routes in here from diff check do not have ERRORLEVEL set
+rem call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/load-script/load-FlagCheckFs.fsx b/tests/fsharp/core/load-script/load-FlagCheckFs.fsx
new file mode 100644
index 0000000..695af91
--- /dev/null
+++ b/tests/fsharp/core/load-script/load-FlagCheckFs.fsx
@@ -0,0 +1,3 @@
+// #Conformance #FSI 
+#nowarn "222"
+#load "flagcheck.fs"
diff --git a/tests/fsharp/core/load-script/multiple-load-1.fsx b/tests/fsharp/core/load-script/multiple-load-1.fsx
new file mode 100644
index 0000000..6ab6b1d
--- /dev/null
+++ b/tests/fsharp/core/load-script/multiple-load-1.fsx
@@ -0,0 +1,2 @@
+// #Conformance #FSI 
+#load "1.fsx" "2.fsx" "3.fsx"
diff --git a/tests/fsharp/core/load-script/multiple-load-2.fsx b/tests/fsharp/core/load-script/multiple-load-2.fsx
new file mode 100644
index 0000000..6ab6b1d
--- /dev/null
+++ b/tests/fsharp/core/load-script/multiple-load-2.fsx
@@ -0,0 +1,2 @@
+// #Conformance #FSI 
+#load "1.fsx" "2.fsx" "3.fsx"
diff --git a/tests/fsharp/core/load-script/out.bsl b/tests/fsharp/core/load-script/out.bsl
new file mode 100644
index 0000000..91ab454
--- /dev/null
+++ b/tests/fsharp/core/load-script/out.bsl
@@ -0,0 +1,77 @@
+
+1.fsx
+
+
+printfn "Hello"
+
+2.fsx
+
+
+#load "1.fsx"
+printfn "World"
+
+3.fsx
+
+
+#load "2.fsx"
+printfn "-the end"
+Test 1=================================================
+Hello
+World
+-the end
+Test 2=================================================
+Hello
+World
+-the end
+Test 3=================================================
+
+> [Loading D:\staging\staging\src\tests\fsharp\core\load-script\1.fsx
+ Loading D:\staging\staging\src\tests\fsharp\core\load-script\2.fsx
+ Loading D:\staging\staging\src\tests\fsharp\core\load-script\3.fsx]
+Hello
+World
+-the end
+
+namespace FSI_0002
+
+
+namespace FSI_0002
+
+
+namespace FSI_0002
+
+> 
+Test 4=================================================
+Test 5=================================================
+
+usesfsi.fsx(1,1): error FS0039: The namespace or module 'fsi' is not defined
+Test 6=================================================
+Test 7=================================================
+Hello
+Test 8=================================================
+Hello
+World
+-the end
+Test 9=================================================
+Hello
+World
+-the end
+Test 10=================================================
+Hello
+World
+-the end
+Test 11=================================================
+COMPILED is defined
+Test 12=================================================
+COMPILED is defined
+Test 13=================================================
+INTERACTIVE is defined
+Test 14=================================================
+INTERACTIVE is defined
+Test 15=================================================
+Result = 99
+Type from referenced assembly = System.Web.Mobile.CookielessData
+Test 16=================================================
+Result = 99
+Type from referenced assembly = System.Web.Mobile.CookielessData
+Done ==================================================
diff --git a/tests/fsharp/core/load-script/pipescr b/tests/fsharp/core/load-script/pipescr
new file mode 100644
index 0000000..87ea8f9
--- /dev/null
+++ b/tests/fsharp/core/load-script/pipescr
@@ -0,0 +1,2 @@
+#load "3.fsx";;
+#quit;;
diff --git a/tests/fsharp/core/load-script/script.bat b/tests/fsharp/core/load-script/script.bat
new file mode 100644
index 0000000..6f482f5
--- /dev/null
+++ b/tests/fsharp/core/load-script/script.bat
@@ -0,0 +1,45 @@
+ at echo off
+del 3.exe 2>nul 1>nul
+type 1.fsx 2.fsx 3.fsx
+echo Test 1=================================================
+%FSC% 3.fsx --nologo
+3.exe
+del 3.exe
+echo Test 2=================================================
+%FSI% 3.fsx
+echo Test 3=================================================
+%FSI% --nologo < pipescr
+echo.
+echo Test 4=================================================
+%FSI% usesfsi.fsx
+echo Test 5=================================================
+%FSC% usesfsi.fsx --nologo
+echo Test 6=================================================
+%FSC% usesfsi.fsx --nologo -r FSharp.Compiler.Interactive.Settings
+echo Test 7=================================================
+%FSI% 1.fsx 2.fsx 3.fsx
+echo Test 8=================================================
+%FSI% 3.fsx 2.fsx 1.fsx
+echo Test 9=================================================
+%FSI% multiple-load-1.fsx
+echo Test 10=================================================
+%FSI% multiple-load-2.fsx
+echo Test 11=================================================
+%FSC% FlagCheck.fs --nologo
+FlagCheck.exe
+del FlagCheck.exe
+echo Test 12=================================================
+%FSC% FlagCheck.fsx  --nologo
+FlagCheck.exe
+del FlagCheck.exe
+echo Test 13=================================================
+%FSI% load-FlagCheckFs.fsx
+echo Test 14=================================================
+%FSI% FlagCheck.fsx
+echo Test 15=================================================
+%FSI% ProjectDriver.fsx
+echo Test 16=================================================
+%FSC% ProjectDriver.fsx --nologo
+ProjectDriver.exe
+del ProjectDriver.exe
+echo Done ==================================================
diff --git a/tests/fsharp/core/load-script/usesfsi.fsx b/tests/fsharp/core/load-script/usesfsi.fsx
new file mode 100644
index 0000000..b98c78e
--- /dev/null
+++ b/tests/fsharp/core/load-script/usesfsi.fsx
@@ -0,0 +1,2 @@
+// #Conformance #FSI 
+fsi.CommandLineArgs
diff --git a/tests/fsharp/core/longnames/build.bat b/tests/fsharp/core/longnames/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/longnames/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/longnames/dont.use.generated.signature b/tests/fsharp/core/longnames/dont.use.generated.signature
new file mode 100644
index 0000000..37c38b5
--- /dev/null
+++ b/tests/fsharp/core/longnames/dont.use.generated.signature
@@ -0,0 +1 @@
+"hello" 
diff --git a/tests/fsharp/core/longnames/run.bat b/tests/fsharp/core/longnames/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/longnames/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/longnames/test.fsx b/tests/fsharp/core/longnames/test.fsx
new file mode 100644
index 0000000..e4b1b87
--- /dev/null
+++ b/tests/fsharp/core/longnames/test.fsx
@@ -0,0 +1,422 @@
+// #Conformance #ObjectConstructors 
+#if Portable
+module Core_longnames
+#endif
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(* Some test expressions *)
+
+(* Can we access an F# constructor via a long path *)
+let v0 = Microsoft.FSharp.Core.Some("")
+let v0b = Microsoft.FSharp.Core.Option.Some("")
+let v0c = Microsoft.FSharp.Core.option.Some("")
+
+(* Can we access an F# nullary constructor via a long path *)
+let v1 = (Microsoft.FSharp.Core.None : int option)
+let v1b = (Microsoft.FSharp.Core.Option.None : int option)
+let v1c = (Microsoft.FSharp.Core.option.None : int option)
+
+(* Can we access an F# type name via a long path *)
+let v2 = (None : int Microsoft.FSharp.Core.Option)
+
+(* Can we access an F# field name via a long path *)
+let v3 = { Microsoft.FSharp.Core.contents = 1 }
+let v3b = { Microsoft.FSharp.Core.Ref.contents = 1 }
+let v3c = { Microsoft.FSharp.Core.ref.contents = 1 }
+let v3d = { contents = 1 }
+let v3e = { Ref.contents = 1 }
+let v3f = { ref.contents = 1 }
+let v3g = { Core.contents = 1 }
+let v3h = { Core.Ref.contents = 1 }
+let v3i = { Core.ref.contents = 1 }
+
+(* Can we construct a "ref" value *)
+let v4 = ref 1
+
+(* Can we access an F# exception constructor via a long path *)
+let v5 = (Microsoft.FSharp.Core.MatchFailureException("1",2,2) : exn)
+
+(* Can we construct a "lazy" value *)
+let v6 = lazy 1
+
+(* Can we pattern match against a constructor specified via a long path *)
+let v7 = 
+  match v0 with 
+  | Microsoft.FSharp.Core.Some(x) -> x
+  | _ -> failwith ""
+let v7b2 = 
+  match v0 with 
+  | option.Some(x) -> x
+  | _ -> failwith ""
+let v7b3 = 
+  match v0 with 
+  | Option.Some(x) -> x
+  | _ -> failwith ""
+let v7b = 
+  match v0 with 
+  | Microsoft.FSharp.Core.option.Some(x) -> x
+  | _ -> failwith ""
+let v7c = 
+  match v0 with 
+  | Microsoft.FSharp.Core.Option.Some(x) -> x
+  | _ -> failwith ""
+
+
+(* Can we pattern match against a nullary constructor specified via a long path *)
+let v8 = 
+  match v1 with 
+  | Microsoft.FSharp.Core.None -> 1
+  | _ -> failwith ""
+let v8b = 
+  match v1 with 
+  | Microsoft.FSharp.Core.Option.None -> 1
+  | _ -> failwith ""
+let v8c = 
+  match v1 with 
+  | Microsoft.FSharp.Core.option.None -> 1
+  | _ -> failwith ""
+
+(* Can we pattern match against an exception constructor specified via a long path *)
+let v9 = 
+  match v5 with 
+  | Microsoft.FSharp.Core.MatchFailureException _ -> 1
+  | _ -> 2
+
+
+(* Can we access an F# constructor via a long path *)
+let v10 = Microsoft.FSharp.Core.Some(1)
+
+
+(* Can we pattern match against a constructor specified via a long path *)
+let v11 = 
+  match v10 with 
+  | Microsoft.FSharp.Core.Some(x) -> x
+  | _ -> failwith ""
+
+let v12 = 
+  match v10 with 
+  | Microsoft.FSharp.Core.Some(x) -> x
+  | _ -> failwith ""
+
+let v13 = Microsoft.FSharp.Core.Some(1)
+
+#if Portable
+#else
+(* check lid setting bug *)
+
+open System.Diagnostics
+let doubleLidSetter () =
+  let p : Process = new Process() in
+  p.StartInfo.set_FileName("child.exe"); // OK
+  p.StartInfo.FileName <- "child.exe";   // was not OK, now fixed
+  ()
+#endif
+
+module NameResolutionExample1Bug1218 = begin
+    type S = 
+        | A
+        | B 
+        with 
+          static member C = "ONE"
+        end
+
+    type U = class 
+        [<DefaultValue>]
+        static val mutable private d : int
+        static member D with get() = U.d and set v = U.d <- v
+    end
+
+    type s = 
+        | S 
+        | U
+        with 
+          member x.A = 1
+          member x.C = 1
+          member x.D = "1"
+        end
+
+    let _ = (S.A : S)  // the type constraint proves that this currently resolves to type S, constructor A
+    let _ = (S.C : string)  // the type constraint proves that this currently resolves to type S, property C
+    let _ = (U.D : int)  // the type constraint proves that this currently resolves to type S, static value D
+end
+
+module NameResolutionExample2Bug1218 = begin
+    type S = 
+        | A
+        | B 
+
+    type s = class 
+        new () = { } 
+        member x.A = 1
+    end
+    
+    let S : s = new s()
+    
+    let _ = (S.A : int)  // the type constraint proves that this currently resolves to value S, member A, i.e. value lookups take precedence over types
+    let _ = (fun (S : s) -> S.A : int)  // the type constraint proves that this currently resolves to value S, member A, i.e. value lookups take precedence over types
+end
+
+module LookupStaticFieldInType = begin
+
+    type TypeInfoResult = 
+       | Unknown = 0
+       // .NET reference types
+       | Null_CanArise_Allowed_NotTrueValue = 1
+       // F# types with [<PermitNull>]
+       | Null_CanArise_Allowed_TrueValue = 2
+       // F# types
+       | Null_CanArise_NotAllowed = 3
+       // structs
+       | Null_Never = 4
+       
+
+    type TypeInfo<'a>() = class
+       [<DefaultValue>]
+       static val mutable private info : TypeInfoResult
+       static member TypeInfo 
+                with get() = 
+                 if TypeInfo<'a>.info = TypeInfoResult.Unknown then (
+                     let nullness = 
+                         let ty = typeof<'a> in
+                         if ty.IsValueType 
+                         then TypeInfoResult.Null_Never else
+                         let mappingAttrs = ty.GetCustomAttributes(typeof<CompilationMappingAttribute>,false) in
+                         if mappingAttrs.Length = 0 
+                         then TypeInfoResult.Null_CanArise_Allowed_NotTrueValue
+                         else                      
+                             let reprAttrs = ty.GetCustomAttributes(typeof<CompilationRepresentationAttribute>,false) in
+                             if reprAttrs.Length = 0 
+                             then TypeInfoResult.Null_CanArise_NotAllowed 
+                             else
+                                 let reprAttr = reprAttrs.[0]  in
+                                 let reprAttr = (failwith "" : CompilationRepresentationAttribute ) in
+                                 if true 
+                                 then TypeInfoResult.Null_CanArise_NotAllowed
+                                 else TypeInfoResult.Null_CanArise_Allowed_TrueValue in
+                     // The lookup on this line was failing to resolve
+                     TypeInfo<'a>.info <- nullness
+                 );
+                 TypeInfo<'a>.info
+    end
+end
+
+
+module TestsForUsingTypeNamesAsValuesWhenTheTypeHasAConstructor = begin
+    // All the tests in this file relate to FSharp 1.0 bug 4379:	Testing fix	name resolution is weird when T constructor shadows method of same name
+    module Test0 = begin
+        let x = obj()
+
+        let foo x = x + 1
+
+        type foo() = class end
+
+        let y = foo()  // still does not compile, and this is not shadowing!
+
+        let x2 = ref 1
+    end
+    module Test1 =  begin
+        let _ = Set<int> [3;4;5]
+        let _ = Set [3;4;5]
+    end
+    module Test2 =  begin
+        type Set() = class
+            let x = 1
+            static member Foo = 1
+        end
+            
+        type Set<'T,'Tag>() =  class
+            let x = 1
+            static member Foo = 1
+        end
+
+        let _ = Set()
+        //Set<>()
+        let _ = Set<_> [3;4;5]
+        let _ = Set<int,int>()
+        let _ = Set<int,int>.Foo
+
+    //let x : obj list = [ 1;2;3;4]
+    end
+    module Test3a =   begin
+        let f()  = 
+            float 1.0 |> ignore;
+            decimal 1.0 |> ignore;
+            float32 1.0 |> ignore;
+            sbyte 1.0 |> ignore;
+            byte 1.0 |> ignore;
+            int16 1.0 |> ignore;
+            uint16 1.0 |> ignore;
+            int32 1.0 |> ignore;
+            int64 1.0 |> ignore;
+            uint32 1.0 |> ignore;
+            uint64 1.0 |> ignore;
+            string 1.0 |> ignore;
+            unativeint 1.0 |> ignore;
+            nativeint 1.0 |> ignore
+
+    end
+    module Test3b =  begin
+        open Microsoft.FSharp.Core
+        let f()  = 
+            float 1.0 |> ignore;
+            decimal 1.0 |> ignore;
+            float32 1.0 |> ignore;
+            sbyte 1.0 |> ignore;
+            byte 1.0 |> ignore;
+            int16 1.0 |> ignore;
+            uint16 1.0 |> ignore;
+            int32 1.0 |> ignore;
+            int64 1.0 |> ignore;
+            uint32 1.0 |> ignore;
+            uint64 1.0 |> ignore;
+            string 1.0 |> ignore;
+            unativeint 1.0 |> ignore;
+            nativeint 1.0 |> ignore;
+    end 
+    module Test3c =  begin
+        open Microsoft.FSharp.Core.Operators
+        open Microsoft.FSharp.Core
+        let x3 = float 1.0
+    end
+
+    module Test3d =  begin
+        open System
+            // This is somewhat perversely using the type name 'decimal' as a constructor, but it is legal
+        let x3 = Decimal 1.0
+        let x4 = decimal 1.0
+    end
+    module Test3e =  begin
+        let x3 = System.Decimal 1.0
+        let x4 = decimal 1.0
+    end
+    module Test3f =  begin
+            // This is somewhat perversely using the type name 'decimal' as a constructor, but it is legal
+            Microsoft.FSharp.Core.decimal 1.0 |> ignore;
+            // This is somewhat perversely using the type name 'string' as a constructor
+            Microsoft.FSharp.Core.string ('3',100) |> ignore
+    end
+    module Test7 =  begin
+        open System
+        let x3 = Decimal 1.0
+        let x4 = decimal 1.0
+    end
+
+    module TestValuesGetAddedAfterTypes =  begin
+
+        module M = begin
+            type string = System.String
+      
+            let string (x:int,y:int) = "1"
+        end
+        
+        open M
+        
+        let x = string (1,1)
+
+    end
+    module TestValuesGetAddedAfterTypes2 =  begin
+
+        module M = begin
+            let string (x:int,y:int) = "1"
+
+            type string = System.String
+        end
+        open M
+        
+        let x = string (1,1)
+
+    end
+    module TestAUtoOpenNestedModulesGetAddedAfterTypes2 =  begin
+
+        module M = begin
+            type string = System.String
+            [<AutoOpen>]
+            module M2 = begin
+                let string (v:int,y:int) = 3
+            end
+        end
+        open M
+        
+        let x = string (1,1)
+
+    end
+    module TestAUtoOpenNestedModulesGetAddedAfterVals =  begin
+
+        module M = begin
+            let string(x:string,y:string,z:string) = 23
+            [<AutoOpen>]
+            module M2 = begin
+                let string (v:int,y:int) = 3
+            end
+        end
+        open M
+        
+        // The module M2 gets auto-opened after the values for "M" get added , hence this typechecks OK
+        let x = string (1,1)
+
+    end
+    module TestAUtoOpenNestedModulesGetAddedInOrder =  begin
+
+        module M = begin
+            let string(x:string,y:string,z:string) = 23
+            [<AutoOpen>]
+            module M2 = begin
+                let string (v:int,y:int) = 3
+            end
+            [<AutoOpen>]
+            module M3 =  begin
+                let string (v:int,y:int,z:int) = 3
+            end
+        end
+        open M
+        
+        // The auto-open modules get added in declaration order 
+        let x = string (1,1,3)
+
+    end 
+    // AutoOpen modules get auto-opened in the order they appear in the referenced signature
+    module TestAUtoOpenNestedModulesGetAddedInOrder_ReverseAlphabetical = begin
+
+        module M = begin
+            let string(x:string,y:string,z:string) = 23
+            [<AutoOpen>]
+            module M3 = begin
+                let string (v:int,y:int) = 3
+            end
+            [<AutoOpen>]
+            module M2 =  begin
+                let string (v:int,y:int,z:int) = 3
+            end
+        end
+        open M
+        
+        // The auto-open modules get added in declaration order 
+        let x = string (1,1,3)
+    end
+
+end
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/core/map/build.bat b/tests/fsharp/core/map/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/map/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/map/run.bat b/tests/fsharp/core/map/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/map/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/map/test.fsx b/tests/fsharp/core/map/test.fsx
new file mode 100644
index 0000000..dc855c9
--- /dev/null
+++ b/tests/fsharp/core/map/test.fsx
@@ -0,0 +1,172 @@
+// #Conformance #Regression #Collections 
+#if Portable
+module Core_map
+#endif
+
+#light
+let failures = ref false
+let report_failure () = failures := true
+let test s b = if b then stdout.WriteLine ("OK: "+s) else (stdout.WriteLine (" FAILED: "+s); report_failure() )
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(* TEST SUITE FOR STANDARD LIBRARY *)
+  
+let test_eq_range n m x = 
+  for i = n to m do 
+    test "ew9wef" (Map.find i x = i * 100);
+  done;
+  for i = n to m do 
+    test "ew9wef" (Map.tryFind i x = Some (i * 100));
+  done;
+  for i = m+1 to m+100 do 
+    test "ew9wef" (Map.tryFind i x = None);
+  done;
+  for i = m+1 to m+5 do 
+    test "ew9cwef" ((try Some(Map.find i x) with :? System.Collections.Generic.KeyNotFoundException -> None) = None);
+  done
+
+let test39342() = 
+  let x = Map.empty in 
+  let x = Map.add 1 100 x in
+  let x = Map.add 2 200 x in
+  let x = Map.add 3 300 x in
+  let x = Map.add 4 400 x in
+  let x = Map.add 5 500 x in
+  let x = Map.add 6 600 x in
+  let x = Map.add 7 700 x in
+  let x = Map.add 8 800 x in
+  let x = Map.add 9 900 x in
+  let x = Map.add 10 1000 x in
+  let x = Map.add 11 1100 x in
+  let x = Map.add 12 1200 x in
+  let x = Map.add 13 1300 x in
+  let x = Map.add 14 1400 x in
+  let x = Map.add 15 1500 x in
+  test_eq_range 1 15 x 
+
+do test39342()
+
+let test39343() = 
+  let x = Map.empty in 
+  let x = Map.add 15 1500 x in
+  let x = Map.add 14 1400 x in
+  let x = Map.add 13 1300 x in
+  let x = Map.add 12 1200 x in
+  let x = Map.add 11 1100 x in
+  let x = Map.add 10 1000 x in
+  let x = Map.add 9 900 x in
+  let x = Map.add 8 800 x in
+  let x = Map.add 7 700 x in
+  let x = Map.add 6 600 x in
+  let x = Map.add 5 500 x in
+  let x = Map.add 4 400 x in
+  let x = Map.add 3 300 x in
+  let x = Map.add 2 200 x in
+  let x = Map.add 1 100 x in
+  test_eq_range 1 15 x 
+
+do test39343()
+
+let test39344() = 
+  let x = Map.empty in 
+  let x = Map.add 4 400 x in
+  test_eq_range 4 4 x 
+
+do test39344()
+
+let test39345() = 
+  let x = Map.empty in 
+  let x = Map.add 4 400 x in
+  let x = Map.add 4 400 x in
+  test_eq_range 4 4 x 
+
+do test39345()
+
+
+let test39346() = 
+  let x = Map.empty in 
+  let x = Map.add 4 400 x in
+  let x = Map.remove 4 x in
+  test_eq_range 4 3 x 
+
+do test39346()
+
+let test39347() = 
+  let x = Map.empty in 
+  let x = Map.add 1 100 x in
+  let x = Map.add 2 200 x in
+  let x = Map.add 3 300 x in
+  let x = Map.add 4 400 x in
+  let x = Map.add 5 500 x in
+  let x = Map.add 6 600 x in
+  let x = Map.add 7 700 x in
+  let x = Map.add 8 800 x in
+  let x = Map.add 9 900 x in
+  let x = Map.add 10 1000 x in
+  let x = Map.add 11 1100 x in
+  let x = Map.add 12 1200 x in
+  let x = Map.add 13 1300 x in
+  let x = Map.add 14 1400 x in
+  let x = Map.add 15 1500 x in
+  let x = Map.remove 3 x in
+  let x = Map.remove 2 x in
+  let x = Map.remove 1 x in
+  let x = Map.remove 15 x in
+  test_eq_range 4 14 x 
+
+do test39347()
+
+let test_fold() =
+    let m = Map.ofList [for i in 1..20 -> i, i] in
+    test "fold 1" (Map.fold (fun acc _ _ -> acc + 1) 0 m = 20);
+    test "fold 2" (Map.foldBack (fun _ _ acc -> acc + 1) m 0 = 20);
+    test "fold 3" (Map.fold (fun acc n _ -> acc + " " + string n) "0" m = String.concat " " [for i in 0..20 -> string i]);
+    test "fold 4" (Map.foldBack (fun n _ acc -> acc + " " + string n) m "21" = String.concat " " [for i in 21..-1..1 -> string i]);
+    test "fold 5" (Map.foldBack (fun _ -> max) m 0 = 20);
+    test "fold 6" (Map.fold (fun acc n _ -> max acc n) 0 m = 20)
+
+do test_fold()
+
+let testEqNoComparison () = 
+    let this = Map.ofArray [| 1, obj() |] 
+    let that = Map.ofArray [| 1, obj() |] 
+    let that2 = Map.ofArray [| 2, obj() |] 
+    test "eq 1a" (this = this)
+    test "eq 1b" (that = that)
+    test "eq 1c" (that2 = that2)
+    test "eq 2a" (this <> that2)
+    for i in 0 .. 6 do 
+        for j in 0 .. 6 do
+            let m1 = Map.ofArray [| for x in 1 .. i -> x, obj() |] 
+            let m2 = Map.ofArray [| for x in 1 .. j -> x, obj() |] 
+            test "eq 3" ((m1 = m2) = (i = 0 && j = 0))
+            test "eq 4" ((m1 = m1) = true)
+            test "eq 5" ((m2 = m2) = true)
+
+do testEqNoComparison()
+
+// Adhoc test, bug 6307:
+module Bug_FSharp_1_0_6307 = 
+    // below works
+    let i : global.System.Int32 = 0
+    // below does not parse
+    let t = typeof<global.System.Int32>
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/math/lalgebra/test.fsx b/tests/fsharp/core/math/lalgebra/test.fsx
new file mode 100644
index 0000000..73207f9
--- /dev/null
+++ b/tests/fsharp/core/math/lalgebra/test.fsx
@@ -0,0 +1,308 @@
+// #Conformance #Regression 
+#light
+
+// CONTENTS-INDEX-REGEXP = FROM>^\//! <TO 
+//----------------------------------------------------------------------------
+//CONTENTS-START-LINE: HERE=2 SEP=2
+// 22.    TESTS HERE......
+// 26.    Finish
+//CONTENTS-END-LINE:
+//----------------------------------------------------------------------------
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure();;
+
+#nowarn "0049";;
+
+#r "FSharp.Math.Providers.dll"
+
+open System
+open Math
+open Math.Notation
+open Microsoft.FSharp.Math.Experimental.LinearAlgebra
+
+
+//! TESTS HERE......
+//------------------
+
+// These are some helper routines to "roughly" test for equality.
+
+/// This function returns a float number that is the next larger number than abs(x)
+/// when represented as a float.
+let eps(x) = 2.0**(-52.0 + (log (abs x))/(log 2.0))
+/// This function tests for equality using relative errors.
+let eq (x:float) (y:float) = if x = 0.0 && y < 1e-5 then true
+                             elif y = 0.0 && x < 1e-5 then true
+                             elif (abs (x-y)) <= 1e-5*abs(x) then true
+                             elif (abs (x-y)) <= 1e-5*abs(y) then true
+                             elif x = y then true
+                             else false
+
+/// This function tests two vectors for equality.
+let eqv (x:vector) (y:vector) = Vector.foldi (fun i acc a -> acc && (eq a y.[i])) true x
+
+/// This function tests two matrices for equality.
+let eqm (x:matrix) (y:matrix) = Matrix.foldi (fun i j acc a -> acc && (eq a y.[i,j])) true x
+
+/// Checks whether matrix A is lower triangular.
+let IsLowerTriangular A = A |> Matrix.foralli (fun i j aij -> i >= j || aij = 0.0)
+
+
+
+(*printf @"
+//----------------------------------------------------------------------------
+//
+// FLab.LinearAlgebra
+//
+//  These tests generate random matrices but do not yet check whether they
+//  are singular or not. Hence, there is an almost zero probability that the
+//  some procedures crach because of this reason.
+//
+//----------------------------------------------------------------------------
+"*)
+let rnd = new System.Random()
+
+let RegressionTest provider maxDimension =
+    let mutable acc = true
+    
+    do
+(*        printf @"
+          SolveTriangularLinearSystem
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random lower triangular matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> if i>j then rnd.NextDouble() elif i=j then 1.0 else 0.0)
+                let x = Vector.init n (fun i -> rnd.NextDouble())
+                let v = A*x
+                let y = SolveTriangularLinearSystem A v true
+                //assert(eqv x y)
+                acc <- acc && (eqv x y)
+            
+            // Generate random upper triangular matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> if i<j then rnd.NextDouble() elif i=j then 1.0 else 0.0)
+                let x = Vector.init n (fun i -> rnd.NextDouble())
+                let v = A*x
+                let y = SolveTriangularLinearSystem A v false
+                //assert(eqv x y)
+                acc <- acc && (eqv x y)
+        test (provider ^ ": SolveTriangularLinearSystem") acc
+
+    do
+(*        printf @"
+          SolveTriangularLinearSystems
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random lower triangular matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> if i>j then rnd.NextDouble() elif i=j then 1.0 else 0.0)
+                let X = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let B = A*X
+                let Y = SolveTriangularLinearSystems A B true
+                //assert(eqm X Y)
+                acc <- acc && (eqm X Y)
+            
+            // Generate random upper triangular matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> if i<j then rnd.NextDouble() elif i=j then 1.0 else 0.0)
+                let X = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let B = A*X
+                let Y = SolveTriangularLinearSystems A B false
+                //assert(eqm X Y)
+                acc <- acc && (eqm X Y)
+        test (provider ^ ": SolveTriangularLinearSystems") acc
+    
+    do
+(*        printf @"
+          SolveLinearSystem
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun _ _ -> rnd.NextDouble())
+                let x = Vector.init n (fun i -> rnd.NextDouble())
+                let v = A*x
+                let y = SolveLinearSystem A v
+                //assert(eqv x y)
+                acc <- acc && (eqv x y)
+            
+            // Generate random matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun _ _ -> rnd.NextDouble())
+                let x = Vector.init n (fun i -> rnd.NextDouble())
+                let v = A*x
+                let y = SolveLinearSystem A v
+                //assert(eqv x y)
+                acc <- acc && (eqv x y)
+        test (provider ^ ": SolveTriangularLinearSystem") acc
+
+    do
+(*        printf @"
+          SolveLinearSystems
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun _ _ -> rnd.NextDouble())
+                let X = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let B = A*X
+                let Y = SolveLinearSystems A B
+                //assert(eqm X Y)
+                acc <- acc && (eqm X Y)
+            
+            // Generate random matrices and solutions.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun _ _ -> rnd.NextDouble())
+                let X = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let B = A*X
+                let Y = SolveLinearSystems A B
+                //assert(eqm X Y)
+                acc <- acc && (eqm X Y)
+        test (provider ^ ": SolveTriangularLinearSystems") acc
+
+    do
+(*        printf @"
+          LU
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random square matrices and compute their LU factorization.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let P,L,U = LU A
+                //assert(eqm (A.PermuteRows P) (L*U) && IsLowerTriangular L && IsLowerTriangular U.T)
+                acc <- acc && (eqm (A.PermuteRows P) (L*U) && IsLowerTriangular L && IsLowerTriangular U.Transpose)
+        test (provider ^ ": LU") acc
+
+    do
+(*        printf @"
+          Determinant
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate random square matrices and multiply them and check determinant.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let B = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let dA = Determinant A
+                let dB = Determinant B
+                let dAB = Determinant (A*B)
+                //assert(eq (dA * dB) dAB)
+                acc <- acc && (eq (dA * dB) dAB)
+        test (provider ^ ": Determinant") acc
+
+    do
+(*        printf @"
+          Inverse
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate a random square matrix and compute its inverse, there is an almost zero probability that it is singular.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let Ainv = Inverse A
+                let I = Matrix.identity n
+                //assert(eqm (A * Ainv) I)
+                acc <- acc && (eqm (A * Ainv) I)
+        test (provider ^ ": Inverse") acc
+
+    do
+(*        printf @"
+          QR
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate a random square matrix and compute its QR decomposition.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let Q,R = QR A
+                //assert(eqm (Q * R) A)
+                acc <- acc && (eqm (Q * R) A)
+        test (provider ^ ": QR") acc
+
+    do
+(*        printf @"
+          Cholesky
+        "*)
+        acc <- true
+        for n=1 to maxDimension do
+            // Generate a random square matrix, and compute QR to get a random orthogonal matrix Q. Then
+            // generate a diagonal matrix with positive entries V and compute QVQ' to get a random positive
+            // definite matrix.
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let Q,_ = QR A
+                let B = Q * (Matrix.init n n (fun i j -> if i = j then rnd.NextDouble() else 0.0)) * Q.Transpose
+                let C = Cholesky B
+                //assert(eqm (C.T * C) B)
+                acc <- acc && (eqm (C.Transpose * C) B)
+        test (provider ^ ": Cholesky") acc
+
+    do
+(*        printf @"
+          Hessenberg
+        "*)
+      if provider = "Managed" then (* JAMES! *)      
+        acc <- true
+        for n=1 to maxDimension do
+            for i=1 to 10 do
+                let A = Matrix.init n n (fun i j -> rnd.NextDouble())
+                let Q,H = Hessenberg A
+                let isHessenberg A = Matrix.foldi (fun i j acc aij -> if i > j+1 then (acc && (abs aij) < 1e-5) else acc) true A
+                let QH = Q * H
+                //assert(eqm (Q * H) A)
+                acc <- acc && (eqm (Q * H) A)
+                //assert(isHessenberg H)
+                acc <- acc && (isHessenberg H)
+        test (provider ^ ": Hessenberg") acc
+    ()
+
+    do
+(*        printf @"
+          LeastSquares
+        "*)
+      if provider <> "Managed" then (* JAMES! *)
+        acc <- true
+        for n=10 to maxDimension do
+            for i=1 to 10 do
+                let A = Matrix.init n (n+rnd.Next(10)-5) (fun i j -> rnd.NextDouble())
+                let b = Vector.init n (fun i -> rnd.NextDouble())
+                let x = LeastSquares A b
+                //assert(eqv (A.T * (A * x)) (A.T * b))
+                acc <- acc && (eqv (A.Transpose * (A * x)) (A.Transpose * b))
+        test (provider ^ ": LeastSquares") acc
+    ()
+
+let maxDimension = 50
+
+// Test the managed code
+Lapack.Stop()
+printf "\nService Status: %s\n\n" (Lapack.Status())
+RegressionTest "Managed" maxDimension
+
+// Test the Intel MKL code
+Lapack.StartWith(MKLProvider)
+printf "\nService Status: %s\n\n" (Lapack.Status())
+RegressionTest "Intel MKL" maxDimension
+
+// Test the netlib code
+Lapack.StartWith(NetlibProvider)
+printf "\nService Status: %s\n\n" (Lapack.Status())
+RegressionTest "Netlib" maxDimension
+  
+
+//! Finish
+//--------  
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/math/lapack/LAPACK.dll b/tests/fsharp/core/math/lapack/LAPACK.dll
new file mode 100644
index 0000000..0619623
Binary files /dev/null and b/tests/fsharp/core/math/lapack/LAPACK.dll differ
diff --git a/tests/fsharp/core/math/lapack/blas.dll b/tests/fsharp/core/math/lapack/blas.dll
new file mode 100644
index 0000000..680efa9
Binary files /dev/null and b/tests/fsharp/core/math/lapack/blas.dll differ
diff --git a/tests/fsharp/core/math/lapack/build.bat b/tests/fsharp/core/math/lapack/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/math/lapack/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/math/lapack/dont.run.peverify b/tests/fsharp/core/math/lapack/dont.run.peverify
new file mode 100644
index 0000000..db8f73b
--- /dev/null
+++ b/tests/fsharp/core/math/lapack/dont.run.peverify
@@ -0,0 +1 @@
+unverifiable 
diff --git a/tests/fsharp/core/math/lapack/dont.use.wrapper.namespace b/tests/fsharp/core/math/lapack/dont.use.wrapper.namespace
new file mode 100644
index 0000000..c929649
--- /dev/null
+++ b/tests/fsharp/core/math/lapack/dont.use.wrapper.namespace
@@ -0,0 +1 @@
+blah 
diff --git a/tests/fsharp/core/math/lapack/run.bat b/tests/fsharp/core/math/lapack/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/core/math/lapack/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/math/lapack/test.fsx b/tests/fsharp/core/math/lapack/test.fsx
new file mode 100644
index 0000000..7932618
--- /dev/null
+++ b/tests/fsharp/core/math/lapack/test.fsx
@@ -0,0 +1,75 @@
+// #Regression #Conformance #Interop 
+//----------------------------------------------------------------------------
+// (c) Microsoft Corporation 2005-2006.  
+//
+// Tutorial Part 1. Understanding interfacing between F# and C/Fortran code
+// Tutorial Part 2. Binding to LAPACK.
+// Tutorial Part 3. Managing Fortran v. C Matrix Layout
+// Tutorial Part 4. Pinning F# Matrix and Vector objects
+// Tutorial Part 5. Building some high-level mutating routines 
+// Tutorial Part 6. Building some easy-to-use high-level applicative routines 
+// Tutorial Part 7. Reusing the primitive bindings on other similarly shaped data structures
+
+#light
+
+#nowarn "0044"  // suppress warnings about the use of native pointer features to interoperate with native code
+#nowarn "0051"  // suppress warnings about the use of byref features to interoperate with native code
+#nowarn "0049"  // turn off warnings about using upper case identifiers for variables (e.g. matrices)
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+//namespace Microsoft.FSharp.Math.Bindings.LAPACK
+
+
+module AdhocNativeTests = begin
+    let f (x : nativeptr<int>) = x
+
+    let mutable x = 1
+
+    do f &&x // sanity check to make sure method can be called
+
+    [<AbstractClass>]
+    type C() = 
+      class
+        abstract AM : nativeptr<int> -> nativeptr<int>
+        static member M(x : nativeptr<int>) = x
+        member a.IM(x : nativeptr<int>) = x
+      end
+
+    type D() = 
+      class
+        inherit C()
+        override a.AM(x : nativeptr<int>) = x
+        static member M(x : nativeptr<int>) = x
+      end
+
+    type DD() = 
+      class
+        inherit System.Text.Decoder()
+        override x.GetChars(a:nativeptr<byte>,b:int,c:nativeptr<char>,d:int,e:bool) = 0
+        override x.GetChars(a:byte[],b:int,c:int,d:char[],e:int) = 0
+        override x.GetCharCount(a:byte[],b:int,d:int) = 0
+      end
+
+    do C.M &&x // sanity check to make sure method can be called
+    let d = D() 
+    let p2 = d.AM &&x // sanity check to make sure method can be called
+    let p3 = d.IM &&x // sanity check to make sure method can be called
+
+    let dd = DD() 
+
+    let mutable b = 0uy
+    let mutable c = '0'
+    do dd.GetChars(&&b, 0, &&c, 0, true) // sanity check to make sure method can be called
+end
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/math/numbers/build.bat b/tests/fsharp/core/math/numbers/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/math/numbers/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/math/numbers/run.bat b/tests/fsharp/core/math/numbers/run.bat
new file mode 100644
index 0000000..d727c6c
--- /dev/null
+++ b/tests/fsharp/core/math/numbers/run.bat
@@ -0,0 +1,10 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+
+
+
diff --git a/tests/fsharp/core/math/numbers/test.fsx b/tests/fsharp/core/math/numbers/test.fsx
new file mode 100644
index 0000000..14c7d82
--- /dev/null
+++ b/tests/fsharp/core/math/numbers/test.fsx
@@ -0,0 +1,276 @@
+// #Regression #Conformance #Regression 
+#light
+#nowarn "49";;
+#nowarn "44";;
+#nowarn "62";;
+#nowarn "35";;
+                           
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure()
+
+(* START *)
+
+open Microsoft.FSharp.Math
+let throws f = try f() |> ignore; false with e -> true
+// Test functions
+let fail() = report_failure()//failwith "Failed"
+let checkEq desc a b = if a<>b then printf "Failed %s. %A <> %A\n" desc a b; fail()
+
+#if FIXED_3481
+// BigInt tests.
+throws(fun () -> int32 (bigint System.Int32.MaxValue + 1I))
+throws(fun () -> int32 (bigint System.Int32.MinValue - 1I))
+// expected exceptions...
+#endif 
+
+// Regression 3481: Tables
+  
+// 2^n-1,2^n,2^n+1
+let positive32s =
+        [(0          , 1          , 2);
+         (1          , 2          , 3);
+         (3          , 4          , 5);
+         (7          , 8          , 9);
+         (15         , 16         , 17);
+         (31         , 32         , 33);
+         (63         , 64         , 65);
+         (127        , 128        , 129);
+         (255        , 256        , 257);
+         (511        , 512        , 513);
+         (1023       , 1024       , 1025);
+         (2047       , 2048       , 2049);
+         (4095       , 4096       , 4097);
+         (8191       , 8192       , 8193);
+         (16383      , 16384      , 16385);
+         (32767      , 32768      , 32769);
+         (65535      , 65536      , 65537);
+         (131071     , 131072     , 131073);
+         (262143     , 262144     , 262145);
+         (524287     , 524288     , 524289);
+         (1048575    , 1048576    , 1048577);
+         (2097151    , 2097152    , 2097153);
+         (4194303    , 4194304    , 4194305);
+         (8388607    , 8388608    , 8388609);
+         (16777215   , 16777216   , 16777217);
+         (33554431   , 33554432   , 33554433);
+         (67108863   , 67108864   , 67108865);
+         (134217727  , 134217728  , 134217729);
+         (268435455  , 268435456  , 268435457);
+         (536870911  , 536870912  , 536870913);
+         (1073741823 , 1073741824 , 1073741825);
+         (2147483647 , 999        , 999); (* MaxValue is 2^31-1 *)
+         (999        , 999        , 999)]
+
+// -2^n-1,-2^n,-2^n+1
+let negative32s =
+        [(-2          , -1          , 0);
+         (-3          , -2          , -1);
+         (-5          , -4          , -3);
+         (-9          , -8          , -7);
+         (-17         , -16         , -15);
+         (-33         , -32         , -31);
+         (-65         , -64         , -63);
+         (-129        , -128        , -127);
+         (-257        , -256        , -255);
+         (-513        , -512        , -511);
+         (-1025       , -1024       , -1023);
+         (-2049       , -2048       , -2047);
+         (-4097       , -4096       , -4095);
+         (-8193       , -8192       , -8191);
+         (-16385      , -16384      , -16383);
+         (-32769      , -32768      , -32767);
+         (-65537      , -65536      , -65535);
+         (-131073     , -131072     , -131071);
+         (-262145     , -262144     , -262143);
+         (-524289     , -524288     , -524287);
+         (-1048577    , -1048576    , -1048575);
+         (-2097153    , -2097152    , -2097151);
+         (-4194305    , -4194304    , -4194303);
+         (-8388609    , -8388608    , -8388607);
+         (-16777217   , -16777216   , -16777215);
+         (-33554433   , -33554432   , -33554431);
+         (-67108865   , -67108864   , -67108863);
+         (-134217729  , -134217728  , -134217727);
+         (-268435457  , -268435456  , -268435455);
+         (-536870913  , -536870912  , -536870911);
+         (-1073741825 , -1073741824 , -1073741823);
+         (999         , -2147483648 , -2147483647); (* MinValue is -2^31 *)
+         (999         , 999         , 999)]  
+
+// 2^n-1,2^n,2^n+1
+let positive64s =
+        [(0L                   , 1L                   , 2L);
+         (1L                   , 2L                   , 3L);
+         (3L                   , 4L                   , 5L);
+         (7L                   , 8L                   , 9L);
+         (15L                  , 16L                  , 17L);
+         (31L                  , 32L                  , 33L);
+         (63L                  , 64L                  , 65L);
+         (127L                 , 128L                 , 129L);
+         (255L                 , 256L                 , 257L);
+         (511L                 , 512L                 , 513L);
+         (1023L                , 1024L                , 1025L);
+         (2047L                , 2048L                , 2049L);
+         (4095L                , 4096L                , 4097L);
+         (8191L                , 8192L                , 8193L);
+         (16383L               , 16384L               , 16385L);
+         (32767L               , 32768L               , 32769L);
+         (65535L               , 65536L               , 65537L);
+         (131071L              , 131072L              , 131073L);
+         (262143L              , 262144L              , 262145L);
+         (524287L              , 524288L              , 524289L);
+         (1048575L             , 1048576L             , 1048577L);
+         (2097151L             , 2097152L             , 2097153L);
+         (4194303L             , 4194304L             , 4194305L);
+         (8388607L             , 8388608L             , 8388609L);
+         (16777215L            , 16777216L            , 16777217L);
+         (33554431L            , 33554432L            , 33554433L);
+         (67108863L            , 67108864L            , 67108865L);
+         (134217727L           , 134217728L           , 134217729L);
+         (268435455L           , 268435456L           , 268435457L);
+         (536870911L           , 536870912L           , 536870913L);
+         (1073741823L          , 1073741824L          , 1073741825L);
+         (2147483647L          , 2147483648L          , 2147483649L);
+         (4294967295L          , 4294967296L          , 4294967297L);
+         (8589934591L          , 8589934592L          , 8589934593L);
+         (17179869183L         , 17179869184L         , 17179869185L);
+         (34359738367L         , 34359738368L         , 34359738369L);
+         (68719476735L         , 68719476736L         , 68719476737L);
+         (137438953471L        , 137438953472L        , 137438953473L);
+         (274877906943L        , 274877906944L        , 274877906945L);
+         (549755813887L        , 549755813888L        , 549755813889L);
+         (1099511627775L       , 1099511627776L       , 1099511627777L);
+         (2199023255551L       , 2199023255552L       , 2199023255553L);
+         (4398046511103L       , 4398046511104L       , 4398046511105L);
+         (8796093022207L       , 8796093022208L       , 8796093022209L);
+         (17592186044415L      , 17592186044416L      , 17592186044417L);
+         (35184372088831L      , 35184372088832L      , 35184372088833L);
+         (70368744177663L      , 70368744177664L      , 70368744177665L);
+         (140737488355327L     , 140737488355328L     , 140737488355329L);
+         (281474976710655L     , 281474976710656L     , 281474976710657L);
+         (562949953421311L     , 562949953421312L     , 562949953421313L);
+         (1125899906842623L    , 1125899906842624L    , 1125899906842625L);
+         (2251799813685247L    , 2251799813685248L    , 2251799813685249L);
+         (4503599627370495L    , 4503599627370496L    , 4503599627370497L);
+         (9007199254740991L    , 9007199254740992L    , 9007199254740993L);
+         (18014398509481983L   , 18014398509481984L   , 18014398509481985L);
+         (36028797018963967L   , 36028797018963968L   , 36028797018963969L);
+         (72057594037927935L   , 72057594037927936L   , 72057594037927937L);
+         (144115188075855871L  , 144115188075855872L  , 144115188075855873L);
+         (288230376151711743L  , 288230376151711744L  , 288230376151711745L);
+         (576460752303423487L  , 576460752303423488L  , 576460752303423489L);
+         (1152921504606846975L , 1152921504606846976L , 1152921504606846977L);
+         (2305843009213693951L , 2305843009213693952L , 2305843009213693953L);
+         (4611686018427387903L , 4611686018427387904L , 4611686018427387905L);
+         (9223372036854775807L , 999L                 , 999L); (* MaxValue is 2^63-1 *)
+         (999L                 , 999L                 , 999L)]  
+
+// -2^n-1,-2^n,-2^n+1
+let negative64s =
+        [(-2L                   , -1L                   , 0L);
+         (-3L                   , -2L                   , -1L);
+         (-5L                   , -4L                   , -3L);
+         (-9L                   , -8L                   , -7L);
+         (-17L                  , -16L                  , -15L);
+         (-33L                  , -32L                  , -31L);
+         (-65L                  , -64L                  , -63L);
+         (-129L                 , -128L                 , -127L);
+         (-257L                 , -256L                 , -255L);
+         (-513L                 , -512L                 , -511L);
+         (-1025L                , -1024L                , -1023L);
+         (-2049L                , -2048L                , -2047L);
+         (-4097L                , -4096L                , -4095L);
+         (-8193L                , -8192L                , -8191L);
+         (-16385L               , -16384L               , -16383L);
+         (-32769L               , -32768L               , -32767L);
+         (-65537L               , -65536L               , -65535L);
+         (-131073L              , -131072L              , -131071L);
+         (-262145L              , -262144L              , -262143L);
+         (-524289L              , -524288L              , -524287L);
+         (-1048577L             , -1048576L             , -1048575L);
+         (-2097153L             , -2097152L             , -2097151L);
+         (-4194305L             , -4194304L             , -4194303L);
+         (-8388609L             , -8388608L             , -8388607L);
+         (-16777217L            , -16777216L            , -16777215L);
+         (-33554433L            , -33554432L            , -33554431L);
+         (-67108865L            , -67108864L            , -67108863L);
+         (-134217729L           , -134217728L           , -134217727L);
+         (-268435457L           , -268435456L           , -268435455L);
+         (-536870913L           , -536870912L           , -536870911L);
+         (-1073741825L          , -1073741824L          , -1073741823L);
+         (-2147483649L          , -2147483648L          , -2147483647L);
+         (-4294967297L          , -4294967296L          , -4294967295L);
+         (-8589934593L          , -8589934592L          , -8589934591L);
+         (-17179869185L         , -17179869184L         , -17179869183L);
+         (-34359738369L         , -34359738368L         , -34359738367L);
+         (-68719476737L         , -68719476736L         , -68719476735L);
+         (-137438953473L        , -137438953472L        , -137438953471L);
+         (-274877906945L        , -274877906944L        , -274877906943L);
+         (-549755813889L        , -549755813888L        , -549755813887L);
+         (-1099511627777L       , -1099511627776L       , -1099511627775L);
+         (-2199023255553L       , -2199023255552L       , -2199023255551L);
+         (-4398046511105L       , -4398046511104L       , -4398046511103L);
+         (-8796093022209L       , -8796093022208L       , -8796093022207L);
+         (-17592186044417L      , -17592186044416L      , -17592186044415L);
+         (-35184372088833L      , -35184372088832L      , -35184372088831L);
+         (-70368744177665L      , -70368744177664L      , -70368744177663L);
+         (-140737488355329L     , -140737488355328L     , -140737488355327L);
+         (-281474976710657L     , -281474976710656L     , -281474976710655L);
+         (-562949953421313L     , -562949953421312L     , -562949953421311L);
+         (-1125899906842625L    , -1125899906842624L    , -1125899906842623L);
+         (-2251799813685249L    , -2251799813685248L    , -2251799813685247L);
+         (-4503599627370497L    , -4503599627370496L    , -4503599627370495L);
+         (-9007199254740993L    , -9007199254740992L    , -9007199254740991L);
+         (-18014398509481985L   , -18014398509481984L   , -18014398509481983L);
+         (-36028797018963969L   , -36028797018963968L   , -36028797018963967L);
+         (-72057594037927937L   , -72057594037927936L   , -72057594037927935L);
+         (-144115188075855873L  , -144115188075855872L  , -144115188075855871L);
+         (-288230376151711745L  , -288230376151711744L  , -288230376151711743L);
+         (-576460752303423489L  , -576460752303423488L  , -576460752303423487L);
+         (-1152921504606846977L , -1152921504606846976L , -1152921504606846975L);
+         (-2305843009213693953L , -2305843009213693952L , -2305843009213693951L);
+         (-4611686018427387905L , -4611686018427387904L , -4611686018427387903L);
+         (999L                  , -9223372036854775808L , -9223372036854775807L); (* MinValue is -2^63 *)
+         (999L                  , 999L                  , 999L)]
+
+
+// Regression 3481: ToInt32
+//let triple k n project =
+//  let x = k * BigInteger.Pow(2I,BigInteger(n:int)) in project (x - 1I),project x,project (x + 1I)
+//      
+//let triple32 k n = triple k n (fun x -> try int32 x with :? System.OverflowException -> 999)
+//let triple64 k n = triple k n (fun x -> try int64 x with :? System.OverflowException -> 999L)
+//
+//      
+//printf "Checking BigInt ToInt32 and ToInt64\n"
+//checkEq "BigInt.ToInt32 positives" positive32s (List.map (triple32  1I) [0 .. 32])
+//checkEq "BigInt.ToInt32 negatives" negative32s (List.map (triple32 -1I) [0 .. 32])
+//checkEq "BigInt.ToInt64 positives" positive64s (List.map (triple64  1I) [0 .. 64])
+//checkEq "BigInt.ToInt64 positives" negative64s (List.map (triple64 -1I) [0 .. 64])
+//;;
+
+// Sanity check: check tables with int32 computations
+let rec pow n i = if i=0 then 1 else n * pow n (i-1);; // naive
+printf "Checking BigInt ToInt32 tables\n"
+checkEq "positive32s" positive32s
+        [ for i in 0 .. 30 do
+            yield (pow 2 i  - 1,pow 2 i,pow 2 i + 1)
+          yield   (pow 2 31 - 1,999    ,999)
+          yield   (999         ,999    ,999)      
+        ];;
+checkEq "negative32s" negative32s
+        [ for i in 0 .. 30 do
+            yield (-pow 2 i  - 1,-pow 2 i         ,-pow 2 i + 1)
+          yield   (999          ,-pow 2 30 * 2    ,-pow 2 30 * 2 + 1)
+          yield   (999          ,999              ,999)      
+        ];;
+
+(* END *)  
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/math/numbersVS2008/build.bat b/tests/fsharp/core/math/numbersVS2008/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/math/numbersVS2008/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/math/numbersVS2008/run.bat b/tests/fsharp/core/math/numbersVS2008/run.bat
new file mode 100644
index 0000000..d727c6c
--- /dev/null
+++ b/tests/fsharp/core/math/numbersVS2008/run.bat
@@ -0,0 +1,10 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+
+
+
diff --git a/tests/fsharp/core/math/numbersVS2008/test.fsx b/tests/fsharp/core/math/numbersVS2008/test.fsx
new file mode 100644
index 0000000..05112e0
--- /dev/null
+++ b/tests/fsharp/core/math/numbersVS2008/test.fsx
@@ -0,0 +1,259 @@
+// #Regression #Conformance #Regression 
+#light
+#nowarn "49";;
+#nowarn "44";;
+#nowarn "62";;
+#nowarn "35";;
+
+//
+// The tests in this file used to be in ..\numbers\test.ml, but I moved them here since
+// they do not work against Dev10: BigInteger.Pow() does not have the (BigInteger,BigInteger) -> BigInteger
+// overload in NetFx4.0
+// *** DO NOT ADD TESTS THAT WORK ON BOTH DEV10 and VS2008 TO THIS FILE ***
+//
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure()
+
+(* START *)
+
+// Misc construction.
+open Microsoft.FSharp.Math
+open System.Numerics
+let fail() = report_failure()//failwith "Failed"
+let checkEq desc a b = if a<>b then printf "Failed %s. %A <> %A\n" desc a b; fail()
+
+// Regression 3481: Tables
+  
+// 2^n-1,2^n,2^n+1
+let positive32s =
+        [(0          , 1          , 2);
+         (1          , 2          , 3);
+         (3          , 4          , 5);
+         (7          , 8          , 9);
+         (15         , 16         , 17);
+         (31         , 32         , 33);
+         (63         , 64         , 65);
+         (127        , 128        , 129);
+         (255        , 256        , 257);
+         (511        , 512        , 513);
+         (1023       , 1024       , 1025);
+         (2047       , 2048       , 2049);
+         (4095       , 4096       , 4097);
+         (8191       , 8192       , 8193);
+         (16383      , 16384      , 16385);
+         (32767      , 32768      , 32769);
+         (65535      , 65536      , 65537);
+         (131071     , 131072     , 131073);
+         (262143     , 262144     , 262145);
+         (524287     , 524288     , 524289);
+         (1048575    , 1048576    , 1048577);
+         (2097151    , 2097152    , 2097153);
+         (4194303    , 4194304    , 4194305);
+         (8388607    , 8388608    , 8388609);
+         (16777215   , 16777216   , 16777217);
+         (33554431   , 33554432   , 33554433);
+         (67108863   , 67108864   , 67108865);
+         (134217727  , 134217728  , 134217729);
+         (268435455  , 268435456  , 268435457);
+         (536870911  , 536870912  , 536870913);
+         (1073741823 , 1073741824 , 1073741825);
+         (2147483647 , 999        , 999); (* MaxValue is 2^31-1 *)
+         (999        , 999        , 999)]
+
+// -2^n-1,-2^n,-2^n+1
+let negative32s =
+        [(-2          , -1          , 0);
+         (-3          , -2          , -1);
+         (-5          , -4          , -3);
+         (-9          , -8          , -7);
+         (-17         , -16         , -15);
+         (-33         , -32         , -31);
+         (-65         , -64         , -63);
+         (-129        , -128        , -127);
+         (-257        , -256        , -255);
+         (-513        , -512        , -511);
+         (-1025       , -1024       , -1023);
+         (-2049       , -2048       , -2047);
+         (-4097       , -4096       , -4095);
+         (-8193       , -8192       , -8191);
+         (-16385      , -16384      , -16383);
+         (-32769      , -32768      , -32767);
+         (-65537      , -65536      , -65535);
+         (-131073     , -131072     , -131071);
+         (-262145     , -262144     , -262143);
+         (-524289     , -524288     , -524287);
+         (-1048577    , -1048576    , -1048575);
+         (-2097153    , -2097152    , -2097151);
+         (-4194305    , -4194304    , -4194303);
+         (-8388609    , -8388608    , -8388607);
+         (-16777217   , -16777216   , -16777215);
+         (-33554433   , -33554432   , -33554431);
+         (-67108865   , -67108864   , -67108863);
+         (-134217729  , -134217728  , -134217727);
+         (-268435457  , -268435456  , -268435455);
+         (-536870913  , -536870912  , -536870911);
+         (-1073741825 , -1073741824 , -1073741823);
+         (999         , -2147483648 , -2147483647); (* MinValue is -2^31 *)
+         (999         , 999         , 999)]  
+
+// 2^n-1,2^n,2^n+1
+let positive64s =
+        [(0L                   , 1L                   , 2L);
+         (1L                   , 2L                   , 3L);
+         (3L                   , 4L                   , 5L);
+         (7L                   , 8L                   , 9L);
+         (15L                  , 16L                  , 17L);
+         (31L                  , 32L                  , 33L);
+         (63L                  , 64L                  , 65L);
+         (127L                 , 128L                 , 129L);
+         (255L                 , 256L                 , 257L);
+         (511L                 , 512L                 , 513L);
+         (1023L                , 1024L                , 1025L);
+         (2047L                , 2048L                , 2049L);
+         (4095L                , 4096L                , 4097L);
+         (8191L                , 8192L                , 8193L);
+         (16383L               , 16384L               , 16385L);
+         (32767L               , 32768L               , 32769L);
+         (65535L               , 65536L               , 65537L);
+         (131071L              , 131072L              , 131073L);
+         (262143L              , 262144L              , 262145L);
+         (524287L              , 524288L              , 524289L);
+         (1048575L             , 1048576L             , 1048577L);
+         (2097151L             , 2097152L             , 2097153L);
+         (4194303L             , 4194304L             , 4194305L);
+         (8388607L             , 8388608L             , 8388609L);
+         (16777215L            , 16777216L            , 16777217L);
+         (33554431L            , 33554432L            , 33554433L);
+         (67108863L            , 67108864L            , 67108865L);
+         (134217727L           , 134217728L           , 134217729L);
+         (268435455L           , 268435456L           , 268435457L);
+         (536870911L           , 536870912L           , 536870913L);
+         (1073741823L          , 1073741824L          , 1073741825L);
+         (2147483647L          , 2147483648L          , 2147483649L);
+         (4294967295L          , 4294967296L          , 4294967297L);
+         (8589934591L          , 8589934592L          , 8589934593L);
+         (17179869183L         , 17179869184L         , 17179869185L);
+         (34359738367L         , 34359738368L         , 34359738369L);
+         (68719476735L         , 68719476736L         , 68719476737L);
+         (137438953471L        , 137438953472L        , 137438953473L);
+         (274877906943L        , 274877906944L        , 274877906945L);
+         (549755813887L        , 549755813888L        , 549755813889L);
+         (1099511627775L       , 1099511627776L       , 1099511627777L);
+         (2199023255551L       , 2199023255552L       , 2199023255553L);
+         (4398046511103L       , 4398046511104L       , 4398046511105L);
+         (8796093022207L       , 8796093022208L       , 8796093022209L);
+         (17592186044415L      , 17592186044416L      , 17592186044417L);
+         (35184372088831L      , 35184372088832L      , 35184372088833L);
+         (70368744177663L      , 70368744177664L      , 70368744177665L);
+         (140737488355327L     , 140737488355328L     , 140737488355329L);
+         (281474976710655L     , 281474976710656L     , 281474976710657L);
+         (562949953421311L     , 562949953421312L     , 562949953421313L);
+         (1125899906842623L    , 1125899906842624L    , 1125899906842625L);
+         (2251799813685247L    , 2251799813685248L    , 2251799813685249L);
+         (4503599627370495L    , 4503599627370496L    , 4503599627370497L);
+         (9007199254740991L    , 9007199254740992L    , 9007199254740993L);
+         (18014398509481983L   , 18014398509481984L   , 18014398509481985L);
+         (36028797018963967L   , 36028797018963968L   , 36028797018963969L);
+         (72057594037927935L   , 72057594037927936L   , 72057594037927937L);
+         (144115188075855871L  , 144115188075855872L  , 144115188075855873L);
+         (288230376151711743L  , 288230376151711744L  , 288230376151711745L);
+         (576460752303423487L  , 576460752303423488L  , 576460752303423489L);
+         (1152921504606846975L , 1152921504606846976L , 1152921504606846977L);
+         (2305843009213693951L , 2305843009213693952L , 2305843009213693953L);
+         (4611686018427387903L , 4611686018427387904L , 4611686018427387905L);
+         (9223372036854775807L , 999L                 , 999L); (* MaxValue is 2^63-1 *)
+         (999L                 , 999L                 , 999L)]  
+
+// -2^n-1,-2^n,-2^n+1
+let negative64s =
+        [(-2L                   , -1L                   , 0L);
+         (-3L                   , -2L                   , -1L);
+         (-5L                   , -4L                   , -3L);
+         (-9L                   , -8L                   , -7L);
+         (-17L                  , -16L                  , -15L);
+         (-33L                  , -32L                  , -31L);
+         (-65L                  , -64L                  , -63L);
+         (-129L                 , -128L                 , -127L);
+         (-257L                 , -256L                 , -255L);
+         (-513L                 , -512L                 , -511L);
+         (-1025L                , -1024L                , -1023L);
+         (-2049L                , -2048L                , -2047L);
+         (-4097L                , -4096L                , -4095L);
+         (-8193L                , -8192L                , -8191L);
+         (-16385L               , -16384L               , -16383L);
+         (-32769L               , -32768L               , -32767L);
+         (-65537L               , -65536L               , -65535L);
+         (-131073L              , -131072L              , -131071L);
+         (-262145L              , -262144L              , -262143L);
+         (-524289L              , -524288L              , -524287L);
+         (-1048577L             , -1048576L             , -1048575L);
+         (-2097153L             , -2097152L             , -2097151L);
+         (-4194305L             , -4194304L             , -4194303L);
+         (-8388609L             , -8388608L             , -8388607L);
+         (-16777217L            , -16777216L            , -16777215L);
+         (-33554433L            , -33554432L            , -33554431L);
+         (-67108865L            , -67108864L            , -67108863L);
+         (-134217729L           , -134217728L           , -134217727L);
+         (-268435457L           , -268435456L           , -268435455L);
+         (-536870913L           , -536870912L           , -536870911L);
+         (-1073741825L          , -1073741824L          , -1073741823L);
+         (-2147483649L          , -2147483648L          , -2147483647L);
+         (-4294967297L          , -4294967296L          , -4294967295L);
+         (-8589934593L          , -8589934592L          , -8589934591L);
+         (-17179869185L         , -17179869184L         , -17179869183L);
+         (-34359738369L         , -34359738368L         , -34359738367L);
+         (-68719476737L         , -68719476736L         , -68719476735L);
+         (-137438953473L        , -137438953472L        , -137438953471L);
+         (-274877906945L        , -274877906944L        , -274877906943L);
+         (-549755813889L        , -549755813888L        , -549755813887L);
+         (-1099511627777L       , -1099511627776L       , -1099511627775L);
+         (-2199023255553L       , -2199023255552L       , -2199023255551L);
+         (-4398046511105L       , -4398046511104L       , -4398046511103L);
+         (-8796093022209L       , -8796093022208L       , -8796093022207L);
+         (-17592186044417L      , -17592186044416L      , -17592186044415L);
+         (-35184372088833L      , -35184372088832L      , -35184372088831L);
+         (-70368744177665L      , -70368744177664L      , -70368744177663L);
+         (-140737488355329L     , -140737488355328L     , -140737488355327L);
+         (-281474976710657L     , -281474976710656L     , -281474976710655L);
+         (-562949953421313L     , -562949953421312L     , -562949953421311L);
+         (-1125899906842625L    , -1125899906842624L    , -1125899906842623L);
+         (-2251799813685249L    , -2251799813685248L    , -2251799813685247L);
+         (-4503599627370497L    , -4503599627370496L    , -4503599627370495L);
+         (-9007199254740993L    , -9007199254740992L    , -9007199254740991L);
+         (-18014398509481985L   , -18014398509481984L   , -18014398509481983L);
+         (-36028797018963969L   , -36028797018963968L   , -36028797018963967L);
+         (-72057594037927937L   , -72057594037927936L   , -72057594037927935L);
+         (-144115188075855873L  , -144115188075855872L  , -144115188075855871L);
+         (-288230376151711745L  , -288230376151711744L  , -288230376151711743L);
+         (-576460752303423489L  , -576460752303423488L  , -576460752303423487L);
+         (-1152921504606846977L , -1152921504606846976L , -1152921504606846975L);
+         (-2305843009213693953L , -2305843009213693952L , -2305843009213693951L);
+         (-4611686018427387905L , -4611686018427387904L , -4611686018427387903L);
+         (999L                  , -9223372036854775808L , -9223372036854775807L); (* MinValue is -2^63 *)
+         (999L                  , 999L                  , 999L)]
+
+// Regression 3481: ToInt32
+let triple k n project =
+  let x = k * BigInteger.Pow(2I,n) in project (x - 1I),project x,project (x + 1I)
+      
+let triple32 k n = triple k n (fun x -> try int32 x with :? System.OverflowException -> 999)
+let triple64 k n = triple k n (fun x -> try int64 x with :? System.OverflowException -> 999L)
+          
+printf "Checking BigInt ToInt32 and ToInt64\n"
+checkEq "BigInt.ToInt32 positives" positive32s (List.map (triple32  1I) [0 .. 32])
+checkEq "BigInt.ToInt32 negatives" negative32s (List.map (triple32 -1I) [0 .. 32])
+checkEq "BigInt.ToInt64 positives" positive64s (List.map (triple64  1I) [0 .. 64])
+checkEq "BigInt.ToInt64 positives" negative64s (List.map (triple64 -1I) [0 .. 64])
+;;
+
+
+(* END *)  
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
diff --git a/tests/fsharp/core/math/tdirs b/tests/fsharp/core/math/tdirs
new file mode 100644
index 0000000..c89fd95
--- /dev/null
+++ b/tests/fsharp/core/math/tdirs
@@ -0,0 +1,3 @@
+lapack
+numbers
+numericVS2008
diff --git a/tests/fsharp/core/measures/build.bat b/tests/fsharp/core/measures/build.bat
new file mode 100644
index 0000000..6df2653
--- /dev/null
+++ b/tests/fsharp/core/measures/build.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/measures/run.bat b/tests/fsharp/core/measures/run.bat
new file mode 100644
index 0000000..06ffddc
--- /dev/null
+++ b/tests/fsharp/core/measures/run.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/measures/test.fsx b/tests/fsharp/core/measures/test.fsx
new file mode 100644
index 0000000..c816107
--- /dev/null
+++ b/tests/fsharp/core/measures/test.fsx
@@ -0,0 +1,616 @@
+// #Conformance #UnitsOfMeasure #Constants 
+#if Portable
+module Core_measures
+#endif
+#light
+
+let failures = ref false
+let report_failure (s) = 
+  stderr.WriteLine ("NO: " + s); failures := true; failwith ""
+let test s b = if b then () else report_failure(s) 
+
+(* TEST SUITE FOR Operators on units-of-measure *)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+
+do SetCulture()    
+#endif
+
+[<Measure>] type kg
+[<Measure>] type s
+[<Measure>] type m
+
+[<Measure>] type sqrm = m^2
+
+// Now some measures with members
+
+[<Measure>] 
+type lb =
+  static member fromKg (x:float<kg>) = x*2.2<lb/kg>
+  
+// Augmentation
+type s with
+  static member Name = "seconds"
+
+type s with
+  static member Symbol = "s"
+
+type lb with
+  static member Name = "pounds"
+
+type area = float<sqrm>
+type intarea = int<sqrm>
+
+module GENERICS =
+
+  let f<'a when 'a:struct>(x:'a) = 1
+  let x1 = f<float<kg>>(3.0<kg>)
+  let x2 = f<float32<s>>(4.0f<s>)
+  let x3 = f(5.0M<sqrm>)
+
+module FLOAT =
+
+ // set up bindings
+ let x1 = 2.0<kg> + 4.0<kg>
+ let x2 = 2.0<s> - 4.0<s>
+ let x3 = 2.0<m> / 4.0<s>
+ let x3a = 2.0<m> / 4.0<m>
+ let x3b = 1.0 / 4.0<s>
+ let x3c = 1.0<m> / 4.0
+ let x4 = 2.0<m> * 4.0<s>
+ let x4a = 2.0<m> * 4.0<m>
+ let x4b = 2.0 * 4.0<m>
+ let x4c = 2.0<m> * 4.0
+ let x5 = 5.0<m> % 3.0<m>
+ let x6 = - (2.0<m>)
+ let x7 = abs (-2.0<m>)
+ let x8 = sqrt (4.0<sqrm>)
+ let x9 = [ 1.0<m> .. 1.0<m> .. 4.0<m> ]
+ let x10 = sign (3.0<m/s>)
+ let x11 = atan2 4.4<s^3> 5.4<s^3>
+ let x11a : float<1> = acos 4.4<1> 
+ let x11b : float<1> = asin 4.4<1> 
+ let x11c : float<1> = atan 4.4<1> 
+ let x11d : float<1> = ceil 4.4<1> 
+ let x11e : float<1> = cos 4.4<1> 
+ let x11f : float<1> = cosh 4.4<1> 
+ let x11g : float<1> = exp 4.4<1> 
+ let x11h : float<1> = floor 4.4<1> 
+ let x11i : float<1> = log 4.4<1> 
+ let x11j : float<1> = log10 4.4<1> 
+ let x11k : float<1> = 4.4<1> ** 3.0<1>
+ let x11l : float<1> = pown 4.4<1> 3
+ let x11m : float<1> = round 4.4<1> 
+ let x11n : int = sign 4.4<1> 
+ let x11o : float<1> = sin 4.4<1> 
+ let x11p : float<1> = sinh 4.4<1> 
+ let x11q : float<1> = sqrt 4.4<1> 
+ let x11r : float<1> = tan 4.4<1> 
+ let x11s : float<1> = tanh 4.4<1> 
+ let x12 = Seq.sum [2.0<sqrm>; 3.0<m^2>]
+ let x12a = Seq.sumBy (fun x -> x*x) [(2.0<sqrm> : area); 3.0<m^2>]
+ let x13 = (Seq.average [2.0<sqrm>; 3.0<m^2>]) : area
+ let x13a = Seq.averageBy (fun x -> x*x) [2.0<m^2/m>; 3.0<m>]
+ let x14 = x13 + x13a
+ let x15 = 5.0<m> < 3.0<m>
+ let x16 = 5.0<m> <= 3.0<m>
+ let x17 = 5.0<m> > 3.0<m>
+ let x18 = 5.0<m> >= 3.0<m>
+ let x19 = max 5.0<m> 3.0<m>
+ let x20 = min 5.0<m> 3.0<m>
+ let x21 = typeof<float<m>>
+ let x22<[<Measure>] 'a>() = typeof<float<'a>>
+
+ // Force trig functions etc to be dimensionless
+ let x23a = acos (4.4<_>)
+ let x23b = asin (4.4<_>)
+ let x23c = atan (4.4<_>)
+ let x23d = ceil (4.4<_>)
+ let x23e = cos (4.4<_>)
+ let x23f = cosh (4.4<_>)
+ let x23g = exp (4.4<_>)
+ let x23h = floor (4.4<_>)
+ let x23i = log (4.4<_>)
+ let x23j = log10 (4.4<_>)
+ let x23k = 4.4<_> ** 3.0<_>
+ let x23l = pown (4.4<_>) 3
+ let x23m = round (4.4<_>)
+ let x23o = sin (4.4<_>)
+ let x23p = sinh (4.4<_>)
+ let x23r = tan (4.4<_>)
+ let x23s = tanh (4.4<_>)
+#if Portable
+#else
+ let x23t = truncate (4.5<_>)
+#endif
+ // check the types and values!
+ test "x1" (x1 = 6.0<kg>)
+ test "x2" (x2 = -2.0<s>)
+ test "x3" (x3 = 0.5<m/s>)
+ test "x3a" (x3a = 0.5)
+ test "x3b" (x3b = 0.25<1/s>)
+ test "x3c" (x3c = 0.25<m>)
+ test "x4" (x4 = 8.0<m s>)
+ test "x4a" (x4a = 8.0<m^2>)
+ test "x4b" (x4b = 8.0<m>)
+ test "x4c" (x4c = 8.0<m>)
+ test "x5" (x5 = 2.0<m>)
+ test "x6" (x6 = -2.0<m>)
+ test "x7" (x7 = 2.0<m>)
+ test "x8" (x8 = 2.0<m>)
+ test "x9" (x9 = [1.0<m>; 2.0<m>; 3.0<m>; 4.0<m>])
+ test "x10" (x10 = 1)
+ test "x12" (x12 = 5.0<m^2>)
+ test "x12a" (x12a = 13.0<m^4>)
+ test "x13" (x13 = 2.5<m^2>)
+ test "x13a" (x13a = 6.5<m^2>)
+ test "x14" (x14 = 9.0<m^2>)
+ test "x15" (x15 = false)
+ test "x16" (x16 = false)
+ test "x17" (x17 = true)
+ test "x18" (x18 = true)
+ test "x19" (x19 = 5.0<m>)
+ test "x20" (x20 = 3.0<m>)
+ test "x21" (x21 = typeof<float>)
+ test "x22" (x22<m>() = typeof<float>)
+  
+
+module INT =
+
+ // set up bindings
+ let x1 = 2<kg> + 4<kg>
+ let x2 = 2<s> - 4<s>
+ let x3 = 8<m> / 4<s>
+ let x3a = 8<m> / 4<m>
+ let x3b = 8 / 4<s>
+ let x3c = 8<m> / 4
+ let x4 = 2<m> * 4<s>
+ let x4a = 2<m> * 4<m>
+ let x4b = 2 * 4<m>
+ let x4c = 2<m> * 4
+ let x5 = 5<m> % 3<m>
+ let x6 = - (2<m>)
+ let x7 = abs (-2<m>)
+ let x9 = [ 1<m> .. 1<m> .. 4<m> ]
+ let x10 = sign (3<m/s>)
+ let x11n : int = sign 4<1> 
+ let x12 = Seq.sum [2<sqrm>; 3<m^2>]
+ let x12a = Seq.sumBy (fun x -> x*x) [(2<sqrm> : intarea); 3<m^2>]
+ let x15 = 5<m> < 3<m>
+ let x16 = 5<m> <= 3<m>
+ let x17 = 5<m> > 3<m>
+ let x18 = 5<m> >= 3<m>
+ let x19 = max 5<m> 3<m>
+ let x20 = min 5<m> 3<m>
+ let x21 = typeof<int<m>>
+ let x22<[<Measure>] 'a>() = typeof<int<'a>>
+
+ // Force bitwise functions etc to be dimensionless
+ let x23a = 4<_> ||| 8<_>
+ let x23b = 3<_> &&& 1<_>
+ let x23c = ~~~ 1<_>
+ let x23d = 2<_> >>> 1<_>
+ let x23e = 2<_> <<< 1<_>
+ let x23f = 3<_> ^^^ 3<_>
+
+ // check the types and values!
+ test "x1" (x1 = 6<kg>)
+ test "x2" (x2 = -2<s>)
+ test "x3" (x3 = 2<m/s>)
+ test "x3a" (x3a = 2)
+ test "x3b" (x3b = 2<1/s>)
+ test "x3c" (x3c = 2<m>)
+ test "x4" (x4 = 8<m s>)
+ test "x4a" (x4a = 8<m^2>)
+ test "x4b" (x4b = 8<m>)
+ test "x4c" (x4c = 8<m>)
+ test "x5" (x5 = 2<m>)
+ test "x6" (x6 = -2<m>)
+ test "x7" (x7 = 2<m>)
+ test "x9" (x9 = [1<m>; 2<m>; 3<m>; 4<m>])
+ test "x10" (x10 = 1)
+ test "x12" (x12 = 5<m^2>)
+ test "x12a" (x12a = 13<m^4>)
+ test "x15" (x15 = false)
+ test "x16" (x16 = false)
+ test "x17" (x17 = true)
+ test "x18" (x18 = true)
+ test "x19" (x19 = 5<m>)
+ test "x20" (x20 = 3<m>)
+ test "x21" (x21 = typeof<int>)
+ test "x22" (x22<m>() = typeof<int>)
+  
+
+module FLOAT32 =
+
+ let y1 = 2.0f<kg> + 4.0f<kg>
+ let y2 = 2.0f<s> - 4.0f<s>
+ let y3 = 2.0f<m> / 4.0f<s>
+ let y3a = 2.0f<m> / 4.0f<m>
+ let y3b = 1.0f / 4.0f<s>
+ let y3c = 1.0f<m> / 4.0f
+ let y4 = 2.0f<m> * 4.0f<s>
+ let y4a = 2.0f<m> * 4.0f<m>
+ let y4b = 2.0f * 4.0f<m>
+ let y4c = 2.0f<m> * 4.0f
+ let y5 = 5.0f<m> % 3.0f<m>
+ let y6 = - (2.0f<m>)
+ let y7 = abs (2.0f<m>)
+ let y8 = sqrt (4.0f<sqrm>)
+ let y9 = [ 1.0f<m> .. 1.0f<m> .. 4.0f<m> ]
+ let y10 = sign (3.0f<m/s>)
+ let y11 = atan2 4.4f<s^3> 5.4f<s^3>
+ let x11a : float32<1> = acos 4.4f<1> 
+ let x11b : float32<1> = asin 4.4f<1> 
+ let x11c : float32<1> = atan 4.4f<1> 
+ let x11d : float32<1> = ceil 4.4f<1> 
+ let x11e : float32<1> = cos 4.4f<1> 
+ let x11f : float32<1> = cosh 4.4f<1> 
+ let x11g : float32<1> = exp 4.4f<1> 
+ let x11h : float32<1> = floor 4.4f<1> 
+ let x11i : float32<1> = log 4.4f<1> 
+ let x11j : float32<1> = log10 4.4f<1> 
+ let x11k : float32<1> = 4.4f<1> ** 3.0f<1>
+ let x11l : float32<1> = pown 4.4f<1> 3
+ let x11m : float32<1> = round 4.4f<1> 
+ let x11n : int = sign 4.4f<1> 
+ let x11o : float32<1> = sin 4.4f<1> 
+ let x11p : float32<1> = sinh 4.4f<1> 
+ let x11q : float32<1> = sqrt 4.4f<1> 
+ let x11r : float32<1> = tan 4.4f<1> 
+ let x11s : float32<1> = tanh 4.4f<1> 
+ let y12 = Seq.sum [2.0f<sqrm>; 3.0f<m^2>]
+ let y12a = Seq.sumBy (fun y -> y*y) [2.0f<sqrm>; 3.0f<m^2>]
+ let y13 = Seq.average [2.0f<sqrm>; 3.0f<m^2>]
+ let y13a = Seq.averageBy (fun y -> y*y) [2.0f<sqrm>; 3.0f<m^2>]
+
+ // check the types and values!
+ test "y1" (y1 = 6.0f<kg>)
+ test "y2" (y2 = -2.0f<s>)
+ test "y3" (y3 = 0.5f<m/s>)
+ test "y3a" (y3a = 0.5f)
+ test "y3b" (y3b = 0.25f<1/s>)
+ test "y3c" (y3c = 0.25f<m>)
+ test "y4" (y4 = 8.0f<m s>)
+ test "y4a" (y4a = 8.0f<m^2>)
+ test "y4b" (y4b = 8.0f<m>)
+ test "y4c" (y4c = 8.0f<m>)
+ test "y5" (y5 = 2.0f<m>)
+ test "y6" (y6 = -2.0f<m>)
+ test "y7" (y7 = 2.0f<m>)
+ test "y8" (y8 = 2.0f<m>)
+ test "y9" (y9 = [1.0f<m>; 2.0f<m>; 3.0f<m>; 4.0f<m>])
+ test "y10" (y10 = 1)
+ test "y12" (y12 = 5.0f<m^2>)
+ test "y12a" (y12a = 13.0f<m^4>)
+ test "y13" (y13 = 2.5f<m^2>)
+ test "y13a" (y13a = 6.5f<m^4>)
+  
+
+module DECIMAL =
+
+ let z1 = 2.0M<kg> + 4.0M<kg>
+ let z2 = 2.0M<s> - 4.0M<s>
+ let z3 = 2.0M<m> / 4.0M<s>
+ let z3a = 2.0M<m> / 4.0M<m>
+ let z3b = 1.0M / 4.0M<s>
+ let z3c = 1.0M<m> / 4.0M
+ let z4 = 2.0M<m> * 4.0M<s>
+ let z4a = 2.0M<m> * 4.0M<m>
+ let z4b = 2.0M * 4.0M<m>
+ let z4c = 2.0M<m> * 4.0M
+ let z5 = 5.0M<m> % 3.0M<m>
+ let z6 = - (2.0M<m>)
+ let z7 = abs (2.0M<m>)
+// let z9 = [ 1.0M<m> .. 4.0M<m> ]
+ let z10 = sign (3.0M<m/s>)
+
+ let x1d : decimal = ceil 4.4M 
+ let x1h : decimal = floor 4.4M 
+ let x1l : decimal = pown 4.4M 3
+#if Portable
+#else
+ let x1m : decimal = round 4.4M 
+#endif
+ let x1n : int = sign 4.4M 
+
+ //let x11d : decimal<1> = ceil 4.4M<1> 
+ //let x11h : decimal<1> = floor 4.4M<1> 
+ //let x11m : decimal<1> = round 4.4M<1> 
+ let x11l : decimal<1> = pown 4.4M<1> 3
+ let x11n : int = sign 4.4M<1> 
+
+ let z12 = Seq.sum [2.0M<sqrm>; 3.0M<m^2>]
+ let z12a = Seq.sumBy (fun z -> z*z) [2.0M<sqrm>; 3.0M<m^2>]
+ let z13 = Seq.average [2.0M<sqrm>; 3.0M<m^2>]
+ let z13a = Seq.averageBy (fun z -> z*z) [2.0M<sqrm>; 3.0M<m^2>]
+
+
+ // check the types and values!
+ test "z1" (z1 = 6.0M<kg>)
+ test "z2" (z2 = -2.0M<s>)
+ test "z3" (z3 = 0.5M<m/s>)
+ test "z3a" (z3a = 0.5M)
+ test "z3b" (z3b = 0.25M<1/s>)
+ test "z3c" (z3c = 0.25M<m>)
+ test "z4" (z4 = 8.0M<m s>)
+ test "z4a" (z4a = 8.0M<m^2>)
+ test "z4b" (z4b = 8.0M<m>)
+ test "z4c" (z4c = 8.0M<m>)
+ test "z5" (z5 = 2.0M<m>)
+ test "z6" (z6 = -2.0M<m>)
+ test "z7" (z7 = 2.0M<m>)
+ test "z10" (z10 = 1)
+ test "z12" (z12 = 5.0M<m^2>)
+ test "z12a" (z12a = 13.0M<m^4>)
+ test "z13" (z13 = 2.5M<m^2>)
+ test "z13a" (z13a = 6.5M<m^4>)
+  
+
+module FLOAT_CHECKED =
+ open Microsoft.FSharp.Core.Operators.Checked
+
+ // set up bindings
+ let x1 = 2.0<kg> + 4.0<kg>
+ let x2 = 2.0<s> - 4.0<s>
+ let x3 = 2.0<m> / 4.0<s>
+ let x3a = 2.0<m> / 4.0<m>
+ let x3b = 1.0 / 4.0<s>
+ let x3c = 1.0<m> / 4.0
+ let x4 = 2.0<m> * 4.0<s>
+ let x4a = 2.0<m> * 4.0<m>
+ let x4b = 2.0 * 4.0<m>
+ let x4c = 2.0<m> * 4.0
+ let x5 = 5.0<m> % 3.0<m>
+ let x6 = - (2.0<m>)
+ let x7 = abs (-2.0<m>)
+ let x8 = sqrt (4.0<sqrm>)
+ let x9 = [ 1.0<m> .. 1.0<m> .. 4.0<m> ]
+ let x10 = sign (3.0<m/s>)
+ let x11 = atan2 4.4<s^3> 5.4<s^3>
+ let x12 = Seq.sum [2.0<sqrm>; 3.0<m^2>]
+ let x12a = Seq.sumBy (fun x -> x*x) [(2.0<sqrm> : area); 3.0<m^2>]
+ let x13 = (Seq.average [2.0<sqrm>; 3.0<m^2>]) : area
+ let x13a = Seq.averageBy (fun x -> x*x) [2.0<m^2/m>; 3.0<m>]
+ let x14 = x13 + x13a
+
+ // check the types and values!
+ test "x1" (x1 = 6.0<kg>)
+ test "x2" (x2 = -2.0<s>)
+ test "x3" (x3 = 0.5<m/s>)
+ test "x3a" (x3a = 0.5)
+ test "x3b" (x3b = 0.25<1/s>)
+ test "x3c" (x3c = 0.25<m>)
+ test "x4" (x4 = 8.0<m s>)
+ test "x4a" (x4a = 8.0<m^2>)
+ test "x4b" (x4b = 8.0<m>)
+ test "x4c" (x4c = 8.0<m>)
+ test "x5" (x5 = 2.0<m>)
+ test "x6" (x6 = -2.0<m>)
+ test "x7" (x7 = 2.0<m>)
+ test "x8" (x8 = 2.0<m>)
+ test "x9" (x9 = [1.0<m>; 2.0<m>; 3.0<m>; 4.0<m>])
+ test "x10" (x10 = 1)
+ test "x12" (x12 = 5.0<m^2>)
+ test "x12a" (x12a = 13.0<m^4>)
+ test "x13" (x13 = 2.5<m^2>)
+ test "x13a" (x13a = 6.5<m^2>)
+  
+
+module FLOAT32_CHECKED =
+ open Microsoft.FSharp.Core.Operators.Checked
+
+ let y1 = 2.0f<kg> + 4.0f<kg>
+ let y2 = 2.0f<s> - 4.0f<s>
+ let y3 = 2.0f<m> / 4.0f<s>
+ let y3a = 2.0f<m> / 4.0f<m>
+ let y3b = 1.0f / 4.0f<s>
+ let y3c = 1.0f<m> / 4.0f
+ let y4 = 2.0f<m> * 4.0f<s>
+ let y4a = 2.0f<m> * 4.0f<m>
+ let y4b = 2.0f * 4.0f<m>
+ let y4c = 2.0f<m> * 4.0f
+ let y5 = 5.0f<m> % 3.0f<m>
+ let y6 = - (2.0f<m>)
+ let y7 = abs (2.0f<m>)
+ let y8 = sqrt (4.0f<sqrm>)
+ let y9 = [ 1.0f<m> .. 1.0f<m> .. 4.0f<m> ]
+ let y10 = sign (3.0f<m/s>)
+ let y11 = atan2 4.4f<s^3> 5.4f<s^3>
+ let y12 = Seq.sum [2.0f<sqrm>; 3.0f<m^2>]
+ let y12a = Seq.sumBy (fun y -> y*y) [2.0f<sqrm>; 3.0f<m^2>]
+ let y13 = Seq.average [2.0f<sqrm>; 3.0f<m^2>]
+ let y13a = Seq.averageBy (fun y -> y*y) [2.0f<sqrm>; 3.0f<m^2>]
+
+ // check the types and values!
+ test "y1" (y1 = 6.0f<kg>)
+ test "y2" (y2 = -2.0f<s>)
+ test "y3" (y3 = 0.5f<m/s>)
+ test "y3a" (y3a = 0.5f)
+ test "y3b" (y3b = 0.25f<1/s>)
+ test "y3c" (y3c = 0.25f<m>)
+ test "y4" (y4 = 8.0f<m s>)
+ test "y4a" (y4a = 8.0f<m^2>)
+ test "y4b" (y4b = 8.0f<m>)
+ test "y4c" (y4c = 8.0f<m>)
+ test "y5" (y5 = 2.0f<m>)
+ test "y6" (y6 = -2.0f<m>)
+ test "y7" (y7 = 2.0f<m>)
+ test "y8" (y8 = 2.0f<m>)
+ test "y9" (y9 = [1.0f<m>; 2.0f<m>; 3.0f<m>; 4.0f<m>])
+ test "y10" (y10 = 1)
+ test "y12" (y12 = 5.0f<m^2>)
+ test "y12a" (y12a = 13.0f<m^4>)
+ test "y13" (y13 = 2.5f<m^2>)
+ test "y13a" (y13a = 6.5f<m^4>)
+  
+
+module DECIMAL_CHECKED =
+ open Microsoft.FSharp.Core.Operators.Checked
+
+ let z1 = 2.0M<kg> + 4.0M<kg>
+ let z2 = 2.0M<s> - 4.0M<s>
+ let z3 = 2.0M<m> / 4.0M<s>
+ let z3a = 2.0M<m> / 4.0M<m>
+ let z3b = 1.0M / 4.0M<s>
+ let z3c = 1.0M<m> / 4.0M
+ let z4 = 2.0M<m> * 4.0M<s>
+ let z4a = 2.0M<m> * 4.0M<m>
+ let z4b = 2.0M * 4.0M<m>
+ let z4c = 2.0M<m> * 4.0M
+ let z5 = 5.0M<m> % 3.0M<m>
+ let z6 = - (2.0M<m>)
+ let z7 = abs (2.0M<m>)
+// let z9 = [ 1.0M<m> .. 4.0M<m> ]
+ let z10 = sign (3.0M<m/s>)
+ let z12 = Seq.sum [2.0M<sqrm>; 3.0M<m^2>]
+ let z12a = Seq.sumBy (fun z -> z*z) [2.0M<sqrm>; 3.0M<m^2>]
+ let z13 = Seq.average [2.0M<sqrm>; 3.0M<m^2>]
+ let z13a = Seq.averageBy (fun z -> z*z) [2.0M<sqrm>; 3.0M<m^2>]
+
+
+ // check the types and values!
+ test "z1" (z1 = 6.0M<kg>)
+ test "z2" (z2 = -2.0M<s>)
+ test "z3" (z3 = 0.5M<m/s>)
+ test "z3a" (z3a = 0.5M)
+ test "z3b" (z3b = 0.25M<1/s>)
+ test "z3c" (z3c = 0.25M<m>)
+ test "z4" (z4 = 8.0M<m s>)
+ test "z4a" (z4a = 8.0M<m^2>)
+ test "z4b" (z4b = 8.0M<m>)
+ test "z4c" (z4c = 8.0M<m>)
+ test "z5" (z5 = 2.0M<m>)
+ test "z6" (z6 = -2.0M<m>)
+ test "z7" (z7 = 2.0M<m>)
+ test "z10" (z10 = 1)
+ test "z12" (z12 = 5.0M<m^2>)
+ test "z12a" (z12a = 13.0M<m^4>)
+ test "z13" (z13 = 2.5M<m^2>)
+ test "z13a" (z13a = 6.5M<m^4>)
+  
+
+module MembersTest =
+    let f = 2.0<kg>
+    let s = 2.0f<kg>
+    let d = 2.0M<kg>
+
+    test "f" (f.ToString().Equals("2"))
+    test "s" (s.ToString().Equals("2"))
+    test "d" (d.ToString().Equals("2.0"))
+
+    let fc = (f :> System.IComparable<float<kg>>).CompareTo(f+f)
+    let sc = (s :> System.IComparable<float32<kg>>).CompareTo(s+s)
+    let dc = (d :> System.IComparable<decimal<kg>>).CompareTo(d+d)
+    test "fc" (fc = -1)
+    test "sc" (sc = -1)
+    test "dc" (dc = -1)
+
+    let f1 = (f :> System.IFormattable)
+    let f2 = (f :> System.IComparable)
+    let f3 = (f :> System.IEquatable<float<kg>>)
+#if Portable
+#else // double does not implement IConvertible on portable
+    let f4 = (f :> System.IConvertible)
+#endif
+  
+module WrappedFloatTypeTest = 
+    type C<[<Measure>] 'T> (v:float<'T>) = 
+        member x.V : float<'T> = v // note, a type annotation is needed here to allow generic recursion
+        static member (+) (c1:C<'T>,c2:C<'T>) = C<'T>(c1.V + c2.V)
+        static member (*) (c1:C<'T>,c2:C<'U>) = C<'T 'U>(c1.V * c2.V)
+        static member (/) (c1:C<'T>,c2:C<'U>) = C<'T / 'U>(c1.V / c2.V)
+        static member (-) (c1:C<'T>,c2:C<'T>) = C<'T>(c1.V - c2.V)
+        static member Sqrt (c1:C<_>) = C<_>(sqrt c1.V)
+        static member Abs (c1:C<_>) = C<_>(abs c1.V)
+        static member Acos (c1:C<1>) = C<1>(acos c1.V)
+        static member Asin (c1:C<1>) = C<1>(asin c1.V)
+        static member Atan (c1:C<1>) = C<1>(atan c1.V)
+        static member Atan2 (c1:C<'u>,c2:C<'u>) = C<1>(atan2 c1.V c2.V)
+        static member Ceiling (c1:C<1>) = C<1>(ceil c1.V)
+        static member Floor (c1:C<1>) = C<1>(floor c1.V)
+        member c1.Sign = sign c1.V
+        static member Round (c1:C<1>) = C<1>(round c1.V)
+#if LOGC
+        static member Log (c1:C<'u>) = LogC<'u>(log (float c1.V))
+#else
+        static member Exp (c1:C<1>) = C<1>(exp (float c1.V))
+        static member Log (c1:C<1>) = C<1>(log (float c1.V))
+#endif
+        static member Log10 (c1:C<1>) = C<1>(log10 (float c1.V))
+        static member Cos (c1:C<1>) = C<1>(cos c1.V)
+        static member Cosh (c1:C<1>) = C<1>(cosh c1.V)
+        static member Sin (c1:C<1>) = C<1>(sin c1.V)
+        static member Sinh (c1:C<1>) = C<1>(sinh c1.V)
+        static member Tanh (c1:C<1>) = C<1>(tan c1.V)
+#if Portable
+#else
+        static member Truncate (c1:C<1>) = C<1>(truncate c1.V)
+#endif
+        static member Pow (c1:C<1>,c2:C<1>) = C<1>( c1.V ** c2.V)
+        static member Mul (c1:C<'T>,c2:C<'U>) = C<'T 'U>(c1.V * c2.V)
+#if LOGC
+    and LogC<[<Measure>] 'T> (v:float) = 
+        member x.UnsafeV = v
+        static member Exp (c1:LogC<'U>) = C<'U>(exp c1.UnsafeV |> box |> unbox)
+#endif
+   
+    [<Measure>] 
+    type kg
+
+    //let v1 = pown 3.0<kg> 2 
+   // let v2 = pown 3.0<kg> 1
+   // let x = acos (3.0<_>)
+    //acosr 3.0  : 3.0<radians>
+    
+    let c1 = C<kg>(3.0<kg>)
+    let c2 = C<kg>(4.0<kg>)
+
+    let c3 = c1 + c2
+    let c5 = c1 * c2         
+    let c6 = c1 / c2         
+    let c7 = c1 - c2  
+    let c8a : C<kg^2> = c1 * c1        
+    let c8b = C<kg>.Sqrt c8a
+    let c8 = sqrt c8a
+    let c9 = acos (C<1>(0.5))
+    let c11 = abs (C<1>(0.5))
+    let c12 = asin (C<1>(0.5))
+    let c13 = atan (C<1>(0.5))
+    let c14 = atan2 (C<1>(0.5)) (C<1>(0.5))
+    let c15 = atan2 (C<kg>(0.5<kg>)) (C<kg>(0.5<kg>))
+    let c16 = ceil (C<1>(0.5))
+    let c17 = exp (C<1>(0.5))
+    let c18 = floor (C<1>(0.5))
+    let c19 = sign (C<1>(0.5))
+    let c20 = sign (C<1>(0.5))
+    let c21 = round (C<1>(0.5))
+    let c22 = log (C<1>(0.5))
+    let c23 = log10 (C<1>(0.5))
+    let c24 = cos (C<1>(0.5))
+    let c25 = cosh (C<1>(0.5))
+    let c26 = sin (C<1>(0.5))
+    let c27 = sinh (C<1>(0.5))
+    let c28 = tanh (C<1>(0.5))
+#if Portable
+#else
+    let c29 = truncate (C<1>(0.5))
+#endif
+    let c30 =  C<1>(0.5) ** C<1>(2.0)
+    let c31 =  C<1>.Mul (C<1>(0.5),C<1>(2.0))
+    let c32 =  C<kg>.Mul (C<kg>(0.5<kg>),C<kg>(2.0<kg>))
+
+let aa =
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+    else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/members/absil.fs b/tests/fsharp/core/members/absil.fs
new file mode 100644
index 0000000..ad00bf0
--- /dev/null
+++ b/tests/fsharp/core/members/absil.fs
@@ -0,0 +1,49 @@
+#indent "off"
+
+
+
+  type MyComponent =
+    { noiseListeners: ListenerList<NoiseLevel>;
+      paintListeners: ListenerListForDelegateType<PaintEventHandler,PaintEventArgs> }
+    member this.OnNoise() = noiseListeners.AsEvent
+    member this.OnPaint() = paintListeners.AsEvent
+
+  let NewMyComponent () = 
+    let noiseListeners = NewListenerList() in 
+    let paintListeners = NewListenerListForDelegateType() in 
+    let fireNoise() = noiseListeners.Fire(noiseLevel) in 
+    let firePaint() = paintListeners.Fire(noiseLevel) in 
+    // Here we would connect to some other resource that triggers events
+    // and call fireNoise and firePaint in response
+    { noiseListeners = noiseListeners;
+      paintListeners = paintListeners }
+
+type code = 
+    | BasicBlock of basic_block
+    | GroupBlock of local_debug_info list * code list
+    | RestrictBlock of CodeLabel list * code
+    | TryBlock of code * seh
+    
+    member this.X() = match this with ...
+    static member op_Addition(a,b) = GroupBlock([],[a;b])
+    static member op_Implicit(a: code, b: ICode) = match this with ...
+
+    interface Object 
+      with this.ToString() = ()
+      and this.GetHashCode() = ()
+      and this.Finalize() = ()
+    interface IComparable
+      with this.CompareTo(that) = ()
+
+  member this.Name = ()
+  member this.X = ()
+
+type local = 
+    { localType: Type;
+      localPinned: bool  }
+    interface Object 
+      with ToString(this) = ()
+      and GetHashCode(this) = ()
+      and Finalize(this) = ()
+    interface IComparable
+      with StructuralComparisonFastTo(this,that) = ()
diff --git a/tests/fsharp/core/members/absil.fsi b/tests/fsharp/core/members/absil.fsi
new file mode 100644
index 0000000..ed03372
--- /dev/null
+++ b/tests/fsharp/core/members/absil.fsi
@@ -0,0 +1,1859 @@
+#indent "off"
+
+open System
+
+  type Bytes = Byte[]
+
+  type Guid = Option<Bytes>
+
+  type Document = 
+    { Language: Option<Guid>;
+      Vendor: Option<Guid>;
+      Type: Option<Guid>;
+      File: string; }
+
+  type SourceAnnotation = 
+    { Document: Document;
+      Line: int;
+      Column: int;
+      EndLine: int;
+      EndColumn: int }
+
+  type AssemblyName = string
+  type ModuleName = string
+  type Locale = string
+
+  type PublicKeyInfo = 
+    | PublicKey of Bytes
+    | PublicKeyToken of Bytes
+
+  type VersionInfo = UInt16 * UInt16 * UInt16 * UInt16
+
+  type AssemblyRef = 
+    { Name: string;
+      Hash: Option<Bytes>;
+      PublicKeyInfo: Option<PublicKeyInfo>;
+      Version: Option<VersionInfo>; 
+      Locale: Option<Locale>; } 
+
+  type ModuleRef = 
+    { Name: string;
+      NoMetadata: bool;
+      Hash: Option<Bytes>; } 
+
+  type ScopeRef = 
+    | Local 
+    | Module of ModuleRef  
+    | Assembly of AssemblyRef 
+
+  type BasicCallconv = 
+    | Default
+    | Cdecl 
+    | Stdcall 
+    | Thiscall 
+    | Fastcall 
+    | Vararg
+      
+  type HasThis = 
+    | Instance           (* accepts an implicit 'this' pointer *)
+    | InstanceExplicit  (* any 'this' pointer is made explicit (C++ only) *)
+    | Static             (* no 'this' pointer is passed *)
+
+  type Callconv 
+    static member InstanceCallconv: Callconv
+    static member StaticCallconv: Callconv
+    member IsVararg: bool
+    member IsStatic: bool
+    member HasThis: HasThis
+    member BasicCallconv: BasicCallconv
+
+
+  val is_vararg_callconv: Callconv -> bool
+  val is_static_callconv: Callconv -> bool
+
+  type ArrayShape
+    member Details: (Int32 option * Int32 option) list 
+    member Rank: Int32
+    static member SingleDimensional: ArrayShape
+
+  // various constructors here
+  val ArrayShape: (Int32 option * Int32 option) list -> ArrayShape
+
+  val rank_of_arrayshape: ArrayShape -> Int32
+  val sdshape: ArrayShape (* bounds for a single dimensional, zero based array *)
+
+
+
+  type TypeRef 
+     member TypeName:  string
+     member FullTypeName:  string
+     member EnclosingTypeNames: List<string>
+     member ScopeRef: ScopeRef
+
+  val tname_of_tref: TypeRef -> string
+  val nested_tname_of_tref: TypeRef -> string
+  val enclosing_tnames_of_tref: TypeRef -> List<string>
+  val scoref_of_tref: TypeRef -> ScopeRef
+
+  type TypeSpec 
+    member TypeRef: TypeSpec -> TypeRef
+    member TypeName: TypeSpec -> string
+    member FullTypeName: TypeSpec -> string
+    member ScopeRef: TypeSpec -> ScopeRef
+    member EnclosingTypeNames: TypeSpec -> List<string>
+    
+  and Type 
+  // member Details: (?k:TypeKind. TypeDetails<TypeKind>)
+  // These properties let you access the contents of a type in a
+  // semi-safe way - they may throw exceptions.  They could be 
+  // given different names.
+    member Shape: ArrayShape
+    member ElementType: Type
+    member TypeSpec: TypeSpec
+    member ParamaterIndex: UInt16
+    member IsRequired: bool
+    member CustomModifier: Type
+    member ModifiedType: Type
+    member Kind: TypeKind
+    member Void: Type
+    static member Array: ArrayShape * Type -> Type
+    static member Value: TypeSpec -> Type
+    static member Boxed: TypeSpec -> Type
+    static member Ptr: Type -> Type
+    static member Byref: Type -> Type
+    static member Fptr: Callsig -> Type
+    static member Tyvar: Callsig -> Type
+    static member Modified: bool * Type * Type -> Type
+
+  and TypeKind = 
+    | Void     
+    | Array 
+    | Value 
+    | Boxed 
+    | Ptr 
+    | Byref
+    | Fptr 
+    | Tyvar
+    | Modified
+
+  // These let you access the contents of a type in a
+  // safe way - you may only access the given contents when the
+  // given constraints hold.  You must unpack the existential result
+  // returned by Details.
+(*
+  type TypeDetails<k:TypeKind> =
+    member Shape: ArrayShape when k = Array
+    member ElementType: Type when k = Array or K = Ptr or k = Byref
+    member TypeSpec: TypeSpec when k = Value or k = Boxed
+    member Callsig: Callsig when k = Fptr
+    member ParamaterIndex: UInt16 when k = Tyvar
+    member IsRequired: bool when k = Modified
+    member CustomModifier: Type when k = Modified
+    member ModifiedType: Type when k = Modified
+*)
+
+  and Instantiation = List<Type>
+
+  and GenericParams = GenericParam list
+  and GenericParam
+   member Name: string
+   member Constraints: List<Type>
+
+  val tref_of_tspec: TypeSpec -> TypeRef
+  val inst_of_tspec: TypeSpec -> Instantiation
+  val tname_of_tspec: TypeSpec -> string
+  val scoref_of_tspec: TypeSpec -> ScopeRef
+  val enclosing_tnames_of_tspec: TypeSpec -> List<string>
+
+
+  type boxity = AsObject | AsValue
+
+  val is_array_ty: Type -> bool
+  val dest_array_ty: Type -> ArrayShape * Type
+
+  val tspec_of_typ: Type -> TypeSpec
+  val boxity_of_typ: Type -> boxity
+  val tref_of_typ: Type -> TypeRef
+  val is_tref_typ: Type -> bool
+  val inst_of_typ: Type -> Instantiation
+  val is_tyvar_ty: Type -> bool
+
+
+  type CallSig =  
+    { Callconv: Callconv;
+      ArgTypes: List<Type>;
+      ReturnType: Type }
+
+  val Callconv_of_CallSig: CallSig -> Callconv
+  val args_of_CallSig: CallSig -> List<Type>
+  val ret_of_CallSig: CallSig -> Type
+
+
+// F# library signature:
+
+  //-------------------------------------------------------------------------
+  // This is the primitive interface for implementing events corresponding to 
+  // any delegate type.
+  //
+  // Note 'a and 'args must correspond - if they do not runtime exceptions will arise.
+  // We could add a constrinat of the form 
+  //    when 'a :> delegate(object * 'arg -> void)
+  type EventForDelegateType<'a> =
+    { Add: 'a -> unit;
+      Remove: 'a -> unit }
+
+  type ListenerListForDelegateType<'a,'arg> =
+    { Fire: 'arg -> unit;
+      AsEvent: EventForDelegateType<'a> }
+ 
+  val ListenerListForDelegateType: unit -> ListenerListForDelegateType<'a,'arg>  when 'a :> System.Delegate
+
+  // This is for the common case for F# where the event type is EventHandler<T>
+  type Event<'a> = EventForDelegateType< EventHandler<'a> >
+
+  type ListenerList<'a> =
+    { Fire: 'a -> unit;
+      AsEvent: Event<'a> }
+
+  val NewListenerList: unit -> ListenerList<'a>  
+  
+// A component signature:
+
+  type NoiseLevel = Double
+  
+  type MyComponent 
+    member OnNoise: Event<NoiseLevel>
+    member OnPaint: EventForDelegateType<PaintEventHandler>
+    
+  val NewMyComponent: unit -> MyComponent
+  
+    
+
+  type MethodRef 
+    member Name: string
+    member Callconv: Callconv
+    member Return: Type
+    member ArgTypes: List<Type>
+    member Parent: TypeRef 
+    member GenericArity: int
+    member CallSig: CallSig
+    member Rename: MethodRef -> MethodRef
+    member Relocate: Type -> MethodRef
+
+(* Functional View *)
+  val name_of_mref: MethodRef -> string
+  val callconv_of_mref: MethodRef -> Callconv
+  val ret_of_mref: MethodRef -> Type
+  val args_of_mref: MethodRef -> List<Type>
+  val tref_of_mref: MethodRef -> TypeRef 
+  val parent_of_mref: MethodRef -> TypeRef (* same as tref_of_mref *)
+  val genarity_of_mref: MethodRef -> int
+  val callsig_of_mref: MethodRef -> CallSig
+  val rename_mref: string -> MethodRef -> MethodRef
+  val relocate_mref: Type -> MethodRef -> MethodRef
+
+  type FieldRef 
+    member Type: FieldRef
+    member Name: string
+    member TypeRef: TypeRef
+
+  val typ_of_fref: FieldRef -> Type
+  val name_of_fref: FieldRef -> string
+  val tref_of_fref: FieldRef -> TypeRef
+
+
+  type MethodSpec
+    member EnclosingType: Type
+    member MethodInstantiation: Instantiation
+    member Callconv: Callconv
+    member Name: string
+    member FormalMethodRef: MethodRef
+    member FormalReturnType: Type
+    member FormalArgTypes: List<Type>
+    member FormalParent: TypeRef
+    member FormalCallsig: CallSig
+    member ActualReturnType: Type
+    member ActualArgTypes: List<Type>
+    member ActualParent: TypeRef
+    member ActualCallsig: CallSig
+    member GenericArity: int
+
+  val enclosing_typ_of_mspec: MethodSpec -> Type
+  val minst_of_mspec: MethodSpec -> Instantiation
+  val callconv_of_mspec: MethodSpec -> Callconv
+  val name_of_mspec: MethodSpec -> string
+
+  val formal_mref_of_mspec: MethodSpec -> MethodRef
+  val formal_ret_of_mspec: MethodSpec -> Type
+  val formal_args_of_mspec: MethodSpec -> List<Type>
+  val formal_parent_of_mspec: MethodSpec -> TypeRef
+  val formal_CallSig_of_mspec: MethodSpec -> CallSig
+
+  val active_inst_of_mspec: MethodSpec -> Instantiation
+  val actual_ret_of_mspec: MethodSpec -> Type
+  val actual_args_of_mspec: MethodSpec -> List<Type>
+  val actual_CallSig_of_mspec: MethodSpec -> CallSig
+
+  val genarity_of_mspec: MethodSpec -> int
+
+
+  type FieldSpec
+    member FieldRef: FieldRef
+    member EnclosingType: Type
+    member FormalType: Type
+    member TypeInstantiation: Instantiation
+    member ActualType: Type
+    member Name: string
+    member FormalParent: TypeRef
+
+
+  val fref_of_fspec: FieldSpec -> FieldRef
+  val enclosing_typ_of_fspec: FieldSpec -> Type
+  val formal_typ_of_fspec: FieldSpec -> Type
+  val active_inst_of_fspec: FieldSpec -> Instantiation
+  val actual_typ_of_fspec: FieldSpec -> Type
+  val name_of_fspec: FieldSpec -> string
+  val tref_of_fspec: FieldSpec -> TypeRef
+
+  type CodeLabel = string
+
+
+  type BasicType = 
+  | DT_R
+  | DT_I1
+  | DT_U1
+  | DT_I2
+  | DT_U2
+  | DT_I4
+  | DT_U4
+  | DT_I8
+  | DT_U8
+  | DT_R4
+  | DT_R8
+  | DT_I
+  | DT_U
+  | DT_REF
+
+  type LdtokenInfo = 
+  | Token_type of Type 
+  | Token_method of MethodSpec 
+  | Token_field of FieldSpec
+
+  type LdcInfo = 
+  | NUM_I4 of Int32
+  | NUM_I8 of Int64
+  | NUM_R4 of Single
+  | NUM_R8 of Double
+
+  type Tailness = 
+  | Tailcall
+  | Normalcall
+
+  type Alignment = 
+  | Aligned
+  | Unaligned_1
+  | Unaligned_2
+  | Unaligned_4
+
+  type Volatility = 
+  | Volatile
+  | Nonvolatile
+
+  type Readonly = 
+  | ReadonlyAddress
+  | NormalAddress
+
+  type VarargTypes = Option< List<Type> >
+
+  type CompareOp =
+  | BI_beq        
+  | BI_bge        
+  | BI_bge_un     
+  | BI_bgt        
+  | BI_bgt_un        
+  | BI_ble        
+  | BI_ble_un        
+  | BI_blt        
+  | BI_blt_un 
+  | BI_bne_un 
+  | BI_brfalse 
+  | BI_brtrue 
+
+  type ArithmeticOp =
+  | AI_add    
+  | AI_add_ovf
+  | AI_add_ovf_un
+  | AI_and    
+  | AI_div   
+  | AI_div_un
+  | AI_ceq      
+  | AI_cgt      
+  | AI_cgt_un   
+  | AI_clt     
+  | AI_clt_un  
+  | AI_conv      of BasicType
+  | AI_conv_ovf  of BasicType
+  | AI_conv_ovf_un  of BasicType
+  | AI_mul       
+  | AI_mul_ovf   
+  | AI_mul_ovf_un
+  | AI_rem       
+  | AI_rem_un       
+  | AI_shl       
+  | AI_shr       
+  | AI_shr_un
+  | AI_sub       
+  | AI_sub_ovf   
+  | AI_sub_ovf_un   
+  | AI_xor       
+  | AI_or        
+  | AI_neg       
+  | AI_not       
+  | AI_ldnull    
+  | AI_dup       
+  | AI_pop
+  | AI_ckfinite 
+  | AI_nop
+  | AI_ldc       of BasicType * LdcInfo
+
+  // A discriminated union automatically defines a kind and a "details"?
+
+  type Instr = 
+  (* Basic *)
+  | I_arith of ArithmeticOp
+  | I_ldarg     of UInt16
+  | I_ldarga    of UInt16
+  | I_ldind     of Alignment * Volatility * BasicType
+  | I_ldloc     of UInt16
+  | I_ldloca    of UInt16
+  | I_starg     of UInt16
+  | I_stind     of  Alignment * Volatility * BasicType
+  | I_stloc     of UInt16
+
+  (* Control transfer *)
+  | I_br    of  CodeLabel
+  | I_jmp   of MethodSpec
+  | I_brcmp of CompareOp * CodeLabel * CodeLabel (* second label is fall-through *)
+  | I_switch    of (CodeLabel list * CodeLabel) (* last label is fallthrough *)
+  | I_ret 
+
+   (* Method call *)
+  | I_call     of Tailness * MethodSpec * VarargTypes
+  | I_callvirt of Tailness * MethodSpec * VarargTypes
+  | I_callconstraint of Tailness * Type * MethodSpec * VarargTypes
+  | I_calli    of Tailness * CallSig * VarargTypes
+  | I_ldftn    of MethodSpec
+  | I_newobj  of MethodSpec  * VarargTypes
+  
+  (* Exceptions *)
+  | I_throw
+  | I_endfinally
+  | I_endfilter
+  | I_leave     of  CodeLabel
+
+  (* Object instructions *)
+  | I_ldsfld      of Volatility * FieldSpec
+  | I_ldfld       of Alignment * Volatility * FieldSpec
+  | I_ldsflda     of FieldSpec
+  | I_ldflda      of FieldSpec 
+  | I_stsfld      of Volatility  *  FieldSpec
+  | I_stfld       of Alignment * Volatility * FieldSpec
+  | I_ldstr       of Bytes  (* Beware!  This is a unicode encoding of the string! *)
+  | I_isinst      of Type
+  | I_castclass   of Type
+  | I_ldtoken     of LdtokenInfo
+  | I_ldvirtftn   of MethodSpec
+
+  (* Value type instructions *)
+  | I_cpobj       of Type
+  | I_initobj     of Type
+  | I_ldobj       of Alignment * Volatility * Type
+  | I_stobj       of Alignment * Volatility * Type
+  | I_box         of Type
+  | I_unbox       of Type
+  | I_unbox_any   of Type
+  | I_sizeof      of Type
+
+  | I_ldelem      of BasicType
+  | I_stelem      of BasicType
+  | I_ldelema     of Readonly * ArrayShape * Type (* ArrayShape = sdshape for single dimensional arrays *)
+  | I_ldelem_any  of ArrayShape * Type (* ArrayShape = sdshape for single dimensional arrays *)
+  | I_stelem_any  of ArrayShape * Type (* ArrayShape = sdshape for single dimensional arrays *)
+  | I_newarr      of ArrayShape * Type (* ArrayShape = sdshape for single dimensional arrays *)
+  | I_ldlen
+
+  | I_mkrefany    of Type
+  | I_refanytype  
+  | I_refanyval   of Type
+  | I_rethrow
+
+  | I_break 
+  | I_seqpoint of SourceAnnotation 
+
+  | I_arglist  
+
+  | I_localloc
+  | I_cpblk of Alignment * Volatility
+  | I_initblk of Alignment  * Volatility
+
+
+type basic_block = 
+    { bblockLabel: CodeLabel;
+      bblockInstrs: Instr array }
+
+val label_of_bblock: basic_block -> CodeLabel
+val instrs_of_bblock: basic_block -> Instr array
+val destinations_of_bblock: basic_block -> List<CodeLabel>
+val fallthrough_of_bblock: basic_block -> CodeLabel option
+val last_of_bblock: basic_block -> Instr
+
+val instr_is_bblock_end: Instr -> bool
+val instr_is_tailcall: Instr -> bool
+
+
+
+type local_debug_info = 
+    { localNum: int;
+      localName: string; }
+
+type Code = 
+    | BasicBlock of basic_block
+    | GroupBlock of local_debug_info list * Code list
+    | RestrictBlock of List<CodeLabel> * Code
+    | TryBlock of Code * seh
+
+  member Name: string
+  member X : int
+  
+and seh =
+  | FaultBlock of Code 
+  | FinallyBlock of Code
+  | FilterCatchBlock of (filter * Code) list
+and filter = 
+  | TypeFilter of Type
+  | CodeFilter of Code
+
+val entries_of_code: Code -> List<CodeLabel>
+val exits_of_code: Code -> List<CodeLabel>
+val unique_entry_of_code: Code -> CodeLabel
+val unique_exit_of_code: Code -> CodeLabel
+
+(* -------------------------------------------------------------------- 
+ * Field Init
+ * -------------------------------------------------------------------- *)
+
+type FieldInit = 
+  | FieldInit_Bytes of Bytes
+  | FieldInit_bool of bool
+  | FieldInit_char of UInt16
+  | FieldInit_Int8 of sbyte
+  | FieldInit_Int16 of Int16
+  | FieldInit_Int32 of Int32
+  | FieldInit_Int64 of Int64
+  | FieldInit_UInt8 of byte
+  | FieldInit_UInt16 of UInt16
+  | FieldInit_UInt32 of UInt32
+  | FieldInit_UInt64 of UInt64
+  | FieldInit_Single of Single
+  | FieldInit_Double of Double
+  | FieldInit_ref
+
+(* -------------------------------------------------------------------- 
+ * Native Types, for marshalling to the native C interface.
+ * These are taken directly from the ILASM syntax, and don't really
+ * correspond yet to the ECMA Spec (Partition II, 7.4).  
+ * -------------------------------------------------------------------- *)
+
+type native_type =
+  | NativeType_empty
+  | NativeType_custom of Bytes * string * string * Bytes (* guid,nativeTypeName,custMarshallerName,cookieString *)
+  | NativeType_fixed_sysstring of Int32
+  | NativeType_fixed_array of Int32
+  | NativeType_currency
+  | NativeType_lpstr
+  | NativeType_lpwstr
+  | NativeType_lptstr
+  | NativeType_byvalstr
+  | NativeType_tbstr
+  | NativeType_lpstruct
+  | NativeType_struct
+  | NativeType_void
+  | NativeType_bool
+  | NativeType_Int8
+  | NativeType_Int16
+  | NativeType_Int32
+  | NativeType_Int64
+  | NativeType_Single
+  | NativeType_Double
+  | NativeType_unsigned_Int8
+  | NativeType_unsigned_Int16
+  | NativeType_unsigned_Int32
+  | NativeType_unsigned_Int64
+  | NativeType_array of native_type option * (Int32 * Int32 option) option (* optional idx of parameter giving size plus optional additive i.e. num elems *)
+  | NativeType_int
+  | NativeType_unsigned_int
+  | NativeType_method
+  | NativeType_as_any
+  | (* COM interop *) NativeType_bstr
+  | (* COM interop *) NativeType_iunknown
+  | (* COM interop *) NativeType_idsipatch
+  | (* COM interop *) NativeType_interface
+  | (* COM interop *) NativeType_error               
+  | (* COM interop *) NativeType_safe_array of variant_type * string option 
+  | (* COM interop *) NativeType_ansi_bstr
+  | (* COM interop *) NativeType_variant_bool
+
+and variant_type = 
+  | VariantType_empty
+  | VariantType_null
+  | VariantType_variant
+  | VariantType_currency
+  | VariantType_decimal               
+  | VariantType_date               
+  | VariantType_bstr               
+  | VariantType_lpstr               
+  | VariantType_lpwstr               
+  | VariantType_iunknown               
+  | VariantType_idispatch               
+  | VariantType_safearray               
+  | VariantType_error               
+  | VariantType_hresult               
+  | VariantType_carray               
+  | VariantType_userdefined               
+  | VariantType_record               
+  | VariantType_filetime
+  | VariantType_blob               
+  | VariantType_stream               
+  | VariantType_storage               
+  | VariantType_streamed_object               
+  | VariantType_stored_object               
+  | VariantType_blob_object               
+  | VariantType_cf                
+  | VariantType_clsid
+  | VariantType_void 
+  | VariantType_bool
+  | VariantType_Int8
+  | VariantType_Int16                
+  | VariantType_Int32                
+  | VariantType_Int64                
+  | VariantType_Single                
+  | VariantType_Double                
+  | VariantType_unsigned_Int8                
+  | VariantType_unsigned_Int16                
+  | VariantType_unsigned_Int32                
+  | VariantType_unsigned_Int64                
+  | VariantType_ptr                
+  | VariantType_array of variant_type                
+  | VariantType_vector of variant_type                
+  | VariantType_byref of variant_type                
+  | VariantType_int                
+  | VariantType_unsigned_int                
+
+
+(* -------------------------------------------------------------------- 
+ * Local variables
+ * -------------------------------------------------------------------- *)
+
+type local = 
+    { localType: Type;
+      localPinned: bool  }
+    :> Object 
+    :> IComparable
+
+
+val typ_of_local: local -> Type
+
+(* -------------------------------------------------------------------- 
+ * IL method bodies
+ * -------------------------------------------------------------------- *)
+
+type CILMethodBody = 
+    { ilZeroInit: bool;
+      ilMaxStack: Int32; (* strictly speakin should be a UInt16 *)
+      ilNoInlining: bool;
+      ilLocals: local list;
+      ilCode: Code;
+      ilSource: Option<SourceAnnotation> }
+
+val locals_of_ilmbody: CILMethodBody -> local list
+val code_of_ilmbody: CILMethodBody -> Code
+
+(* -------------------------------------------------------------------- 
+ * Member Access
+ * -------------------------------------------------------------------- *)
+
+type MemberAccess = 
+  | MemAccess_assembly
+  | MemAccess_compilercontrolled
+  | MemAccess_famandassem
+  | MemAccess_famorassem
+  | MemAccess_family
+  | MemAccess_private 
+  | MemAccess_public 
+
+(* --------------------------------------------------------------------
+ * Custom attributes: @todo: provide a helper to parse the Bytes 
+ * to CustomAttribute_elem's as best as possible.  
+ * -------------------------------------------------------------------- *)
+
+type CustomAttributeElement = 
+  | String of String  
+  | Bool of Boolean
+  | Char of Char
+  | Int8 of SByte
+  | Int16 of Int16
+  | Int32 of Int32
+  | Int64 of Int64
+  | UInt8 of byte
+  | UInt16 of UInt16
+  | UInt32 of UInt32
+  | UInt64 of UInt64
+  | Single of Single
+  | Double of Double
+  | Type of TypeRef  
+  | Enum of Type * CustomAttributeElement
+
+type CustomAttribute =
+    { customMethod: MethodSpec;  
+      customData: Bytes }
+
+type CustomAttributes (* Equivalent to CustomAttribute list - use helpers below to construct/destruct these *)
+
+val dest_CustomAttributes: CustomAttributes -> CustomAttribute list
+
+(* -------------------------------------------------------------------- 
+ * Method parameters and return values
+ * -------------------------------------------------------------------- *)
+
+type param = 
+    { Name: string option;
+      Type: Type;
+      Default: Option<FieldInit>;  
+      Marshal: native_type option; (* Marshalling map for parameters. COM Interop only. *)
+      In: bool;
+      Out: bool;
+      Optional: bool;
+      CustomAttrs: CustomAttributes }
+
+val name_of_param: param -> string option
+val typ_of_param: param -> Type
+
+(* -------------------------------------------------------------------- 
+ * Method return values
+ * -------------------------------------------------------------------- *)
+
+type ReturnSpec = 
+    { returnMarshal: native_type option;
+      returnType: Type; }
+
+val typ_of_return: ReturnSpec -> Type
+
+(* -------------------------------------------------------------------- 
+ * Security Permissions
+ * 
+ * Attached to various structures...
+ * -------------------------------------------------------------------- *)
+
+type SecurityAction = 
+  | Request 
+  | Demand
+  | Assert
+  | Deny
+  | Permitonly
+  | Linkcheck 
+  | Inheritcheck
+  | Reqmin
+  | Reqopt
+  | Reqrefuse
+  | Prejitgrant
+  | Prejitdeny
+  | Noncasdemand
+  | Noncaslinkdemand
+  | Noncasinheritance
+
+type PermissionValue = 
+    Bool of bool
+  | Int32 of Int32
+  | String of string
+  | EnumInt8 of TypeRef * sbyte
+  | EnumInt16 of TypeRef * Int16
+  | EnumInt32 of TypeRef * Int32
+
+type permission = 
+  | Permission of SecurityAction * Type * (string * PermissionValue) list
+  | PermissionSet of SecurityAction * Bytes
+
+type SecurityDecls (* Opaque type equivalent to permission list - use helpers below to construct/destruct these *)
+
+val dest_SecurityDecls: SecurityDecls -> permission list
+
+(* -------------------------------------------------------------------- 
+ * PInvoke attributes.
+ * -------------------------------------------------------------------- *)
+
+type pinvoke_Callconv = 
+  | PInvoke_CC_none
+  | PInvoke_CC_cdecl
+  | PInvoke_CC_stdcall
+  | PInvoke_CC_thiscall
+  | PInvoke_CC_fastcall
+  | PInvoke_CC_winapi
+
+type pinvoke_encoding = 
+  | PInvoke_Encoding_none
+  | PInvoke_Encoding_ansi
+  | PInvoke_Encoding_unicode
+  | PInvoke_Encoding_autochar
+
+type pinvoke_attr =  
+    { pinvokeWhere: ModuleRef;
+      pinvokeName: string;
+      pinvokeCallconv: pinvoke_Callconv;
+      pinvokeEncoding: pinvoke_encoding;
+      pinvokeNoMangle: bool;
+      pinvokeLastErr: bool }
+
+
+type OverridesSpec = OverridesSpec of MethodRef * Type
+
+val enclosing_typ_of_ospec: OverridesSpec -> Type
+val formal_mref_of_ospec: OverridesSpec -> MethodRef
+val Callconv_of_ospec: OverridesSpec -> Callconv
+val formal_ret_of_ospec: OverridesSpec -> Type
+val formal_args_of_ospec: OverridesSpec -> List<Type>
+val tref_of_ospec: OverridesSpec -> TypeRef
+val name_of_ospec: OverridesSpec -> string
+val formal_CallSig_of_ospec: OverridesSpec -> CallSig
+val actual_CallSig_of_ospec: OverridesSpec -> CallSig
+
+
+type virtual_info = 
+    { Final: bool; 
+      Newslot: bool; 
+      Abstract: bool;
+      Overrides: OverridesSpec option; }
+
+type method_kind = 
+  | Static 
+  | Cctor 
+  | Ctor 
+  | Nonvirtual 
+  | Virtual of virtual_info
+
+type MethodBody_details = 
+  | MethodBody_il of CILMethodBody
+  | MethodBody_pinvoke of pinvoke_attr       (* platform invoke to native  *)
+  | MethodBody_abstract
+  | MethodBody_native
+
+type method_code_kind =
+  | MethodCodeKind_il
+  | MethodCodeKind_native
+  | MethodCodeKind_runtime
+
+type MethodBody (* isomorphic to MethodBody_details *)
+
+val dest_mbody : MethodBody -> MethodBody_details 
+
+type MethodDef = 
+    { mdName: string;
+      mdKind: method_kind;
+      mdCallconv: Callconv;
+      mdParams: List<Param>;
+      mdReturn: ReturnSpec;
+      mdAccess: MemberAccess;
+      mdBody: MethodBody;   
+      mdCodeKind: method_code_kind;   
+      mdInternalCall: bool;
+      mdManaged: bool;
+      mdForwardRef: bool;
+      mdSecurityDecls: SecurityDecls;
+      mdEntrypoint:bool;
+      mdReqSecObj: bool;
+      mdHideBySig: bool;
+      mdSpecialName: bool;
+      mdUnmanagedExport: bool; (* -- The method is exported to unmanaged code using COM interop. *)
+      mdSynchronized: bool;
+      mdPreserveSig: bool;
+      mdMustRun: bool; (* Whidbey feature: SafeHandle finalizer must be run *)
+      mdExport: (Int32 * string option) option; 
+      mdVtableEntry: (Int32 * Int32) option;
+     
+      (* MS-GENERICS *) mdGenericParams: GenericParams;
+      mdCustomAttrs: CustomAttributes; }
+
+val name_of_mdef: MethodDef -> string
+val num_args: MethodDef -> int
+val mdef_is_virt: MethodDef -> bool
+val mdef_is_il: MethodDef -> bool
+val params_of_mdef: MethodDef -> List<Param>
+val Callconv_of_mdef: MethodDef -> Callconv
+val ilmbody_of_mdef: MethodDef -> CILMethodBody
+val code_of_mdef: MethodDef -> Code
+val entry_of_mdef: MethodDef -> CodeLabel
+val CallSig_of_mdef: MethodDef -> CallSig
+
+(* -------------------------------------------------------------------- 
+ * Delegates.  Derived functions for telling if a method/class definition 
+ * is really a delegate.  Also for telling if method signatures refer to 
+ * delegate methods.
+ * -------------------------------------------------------------------- *)
+
+(* these are approximations: you have to check that the type def is actually a delegate as well *)
+val is_delegate_ctor: MethodDef -> bool
+val is_delegate_invoke: MethodDef -> bool
+val dest_delegate_invoke: MethodDef -> List<Type> * Type
+val is_delegate_begin_invoke: MethodDef -> bool
+val is_delegate_end_invoke: MethodDef -> bool
+val dest_delegate_begin_end_invoke: MethodDef -> MethodDef -> List<Type> * Type
+
+(* -------------------------------------------------------------------- 
+ * Tables of methods.  Logically equivalent to a list of methods but
+ * the table is kept in a form optimized for looking up methods by 
+ * name and arity.
+ * -------------------------------------------------------------------- *)
+
+type MethodDefs (* abstract type equivalent to [MethodDef list] *)
+
+val dest_mdefs: MethodDefs -> MethodDef list
+val filter_mdefs: (MethodDef -> bool) -> MethodDefs -> MethodDefs
+val find_mdefs_by_arity: string * int -> MethodDefs -> MethodDef list
+
+(* -------------------------------------------------------------------- 
+ * Field definitions
+ * -------------------------------------------------------------------- *)
+
+type FieldDef = 
+    { Name: string;
+      Type: Type;
+      Static: bool;
+      Access: MemberAccess;
+      Data:  Option<Bytes>;
+      Init: Option<FieldInit>;  
+      Offset:  Int32 option; (* The explicit offset in Bytes when explicit layout is used. *)
+      SpecialName: bool;
+      Marshal: native_type option; 
+      NotSerialized: bool;
+      Literal: bool ;
+      InitOnly: bool;
+      CustomAttrs: CustomAttributes; }
+
+val typ_of_fdef : FieldDef -> Type
+val name_of_fdef: FieldDef -> string
+
+(* -------------------------------------------------------------------- 
+ * Tables of FieldDefs.  Logically equivalent to a list of FieldDefs but
+ * the table is kept in a form optimized for looking up FieldDefs by 
+ * name.
+ * -------------------------------------------------------------------- *)
+
+type FieldDefs (* Abstract type qquivalent to a list of FieldDefs *)
+
+val dest_fdefs: FieldDefs -> FieldDef list
+val filter_fdefs: (FieldDef -> bool) -> FieldDefs -> FieldDefs
+val find_fdef: string -> FieldDefs -> FieldDef list
+
+(* -------------------------------------------------------------------- 
+ * Event definitions
+ * -------------------------------------------------------------------- *)
+
+type EventDef = 
+    { eventType: Type option; 
+      eventName: string;
+      eventRTSpecialName: bool;
+      eventSpecialName: bool;
+      eventAddOn: MethodRef; 
+      eventRemoveOn: MethodRef;
+      eventFire: Option<MethodRef>;
+      eventOther: MethodRef list;
+      eventCustomAttrs: CustomAttributes; }
+
+(* -------------------------------------------------------------------- 
+ * Table of those events in a type definition.
+ * -------------------------------------------------------------------- *)
+
+type EventDefs
+
+val dest_events: EventDefs -> EventDef list
+val filter_events: (EventDef -> bool) -> EventDefs -> EventDefs
+
+(* -------------------------------------------------------------------- 
+ * Property definitions
+ * -------------------------------------------------------------------- *)
+
+type PropertyDef = 
+    { propName: string;
+      propRTSpecialName: bool;
+      propSpecialName: bool;
+      propSet: Option<MethodRef>;
+      propGet: Option<MethodRef>;
+      propCallconv: HasThis;
+      propType: Type;          
+      propInit: Option<FieldInit>;
+      propArgs: List<Type>;
+      propCustomAttrs: CustomAttributes; }
+
+(* -------------------------------------------------------------------- 
+ * Table of those properties in a type definition.
+ * -------------------------------------------------------------------- *)
+
+type ILPropertyDefs
+
+val dest_properties: properties -> PropertyDef  list
+val filter_properties: (PropertyDef -> bool) -> ILPropertyDefs -> ILPropertyDefs
+
+(* ------------------------------------------------------------------ 
+ * Method Impls
+ * 
+ * If there is an entry (pms --> ms) in this table, then method [ms] 
+ * is used to implement method [pms] for the purposes of this class 
+ * and its subclasses. 
+ * ------------------------------------------------------------------ *)
+
+type MethodImpl = 
+   { mimplOverrides: OverridesSpec;
+     mimplOverrideBy: MethodSpec }
+
+type MethodImpls
+
+val dest_mimpls: MethodImpls -> MethodImpl list
+
+(* ------------------------------------------------------------------ 
+ * Type Access, Layout etc.
+ * ------------------------------------------------------------------ *)
+
+type TypeLayout =
+  | TypeLayout_auto
+  | TypeLayout_sequential of TypeLayout_info
+  | TypeLayout_explicit of TypeLayout_info 
+
+and TypeLayout_info =
+    { typeSize: Int32 option;
+      typePack: UInt16 option } 
+
+type TypeInit =
+  | TypeInit_beforefield
+  | TypeInit_onany
+
+type TypeEncoding =
+  | TypeEncoding_ansi
+  | TypeEncoding_autochar
+  | TypeEncoding_unicode
+
+type TypeDefAccess = 
+  | TypeAccess_public 
+  | TypeAccess_private
+  | TypeAccess_nested of MemberAccess 
+
+type delegate_kind = Multicast | Singlecast
+type delegate_info =  
+    { delKind: delegate_kind;  
+      delAsync: bool;
+      delArgs: List<Type>;
+      delRet: Type }
+
+type enum_info =  
+    { enumValues: (string * FieldInit) list;  
+      enumType: Type }
+
+val values_of_enum_info: enum_info -> (string * FieldInit) list
+val typ_of_enum_info: enum_info -> Type
+
+type TypeDefKind = 
+  | TypeDef_class
+  | TypeDef_valuetype
+  | TypeDef_interface
+  | TypeDef_enum of enum_info
+  | TypeDef_delegate of delegate_info
+
+
+val split_type_name: string -> List<string> * string
+
+
+type TypeDef =  
+    { tdKind: TypeDefKind;
+      tdName: string;  
+      tdGenericParams: GenericParams;
+      tdAccess: TypeDefAccess;  
+      tdAbstract: bool;
+      tdSealed: bool; 
+      tdSerializable: bool; 
+      tdComInterop: bool; (* Class or interface generated for COM interop *) 
+      tdLayout: TypeLayout;
+      tdSpecialName: bool;
+      tdEncoding: TypeEncoding;
+      tdNested: TypeDefs;
+      tdImplements: List<Type>;  
+      tdExtends: Type option; 
+      tdMethodDefs: MethodDefs;
+      tdSecurityDecls: SecurityDecls;
+      tdFieldDefs: FieldDefs;
+      tdMethodImpls: MethodImpls;
+      tdInitSemantics: TypeInit;
+      tdEvents: EventDefs;
+      tdProperties: ILPropertyDefs;
+      tdCustomAttrs: CustomAttributes; }
+
+and TypeDefs (* abstract type equivalent to "TypeDef list" *)
+
+val kind_of_tdef: TypeDef -> TypeDefKind
+val name_of_tdef: TypeDef -> string
+val gparams_of_tdef: TypeDef -> GenericParams
+val FieldDefs_of_tdef: TypeDef -> FieldDefs
+val methods_of_tdef: TypeDef -> MethodDefs
+val mimpls_of_tdef: TypeDef -> MethodImpls
+val properties_of_tdef: TypeDef -> ILPropertyDefs
+val events_of_tdef: TypeDef -> EventDefs
+val nested_of_tdef: TypeDef -> TypeDefs
+val extends_of_tdef: TypeDef -> Type option
+val implements_of_tdef: TypeDef -> List<Type>
+val access_of_tdef: TypeDef -> TypeAccess
+val layout_of_tdef: TypeDef -> TypeLayout
+val sealed_of_tdef: TypeDef -> bool
+val abstract_of_tdef: TypeDef -> bool
+val serializable_of_tdef: TypeDef -> bool
+val CustomAttributes_of_tdef: TypeDef -> CustomAttributes
+val SecurityDecls_of_tdef: TypeDef -> SecurityDecls
+val encoding_of_tdef: TypeDef -> TypeEncoding
+val initsemantics_of_tdef: TypeDef -> TypeInit
+
+val is_value_tdef: TypeDef -> bool
+
+val name_of_nested_tdef: TypeDef list * TypeDef -> string
+val gparams_of_nested_tdef: TypeDef list * TypeDef -> GenericParams
+
+val iter_tdefs: (TypeDef -> unit) -> TypeDefs -> unit
+val dest_tdefs: TypeDefs -> TypeDef  list
+val find_tdef: string -> TypeDefs -> TypeDef
+
+val dest_lazy_tdefs: TypeDefs -> (string * TypeDef Lazy.t) list
+val iter_lazy_tdefs: (string -> TypeDef Lazy.t -> unit) -> TypeDefs -> unit
+
+val tname_for_toplevel: string
+val is_toplevel_tname: string -> bool
+val dest_tdefs_with_toplevel_first: TypeDefs -> TypeDef list
+
+(* -------------------------------------------------------------------- 
+ * "Classes Elsewhere" - classes in auxillary modules.
+ *
+ * Manifests include declarations for all the classes in an 
+ * assembly, regardless of which module they are in.
+ *
+ * The ".class extern" construct describes so-called exported Types -- 
+ * these are public classes defined in the auxillary modules of this assembly,
+ * i.e. modules other than the manifest-carrying module. 
+ * 
+ * For example, if you have a two-module 
+ * assembly (A.DLL and B.DLL), and the manifest resides in the A.DLL, 
+ * then in the manifest all the public classes declared in B.DLL should
+ * be defined as exported Types, i.e., as ".class extern". The public classes 
+ * defined in A.DLL should not be defined as ".class extern" -- they are 
+ * already available in the manifest-carrying module. The union of all 
+ * public classes defined in the manifest-carrying module and all 
+ * exported Types defined there is the set of all classes exposed by 
+ * this assembly. Thus, by analysing the metadata of the manifest-carrying 
+ * module of an assembly, you can identify all the classes exposed by 
+ * this assembly, and where to find them.
+ *
+ * Nested classes found in external modules should also be located in 
+ * this table, suitably nested inside another "class_elsewhere"
+ * definition.
+ * -------------------------------------------------------------------- *)
+
+(* these are only found in the "Nested" field of class_elsewhere objects *)
+type nested_class_elsewhere = 
+    { Name: string;
+      Access: MemberAccess;
+      Nested: nested_classes_elsewhere;
+      CustomAttrs: CustomAttributes } 
+
+and nested_classes_elsewhere
+
+(* these are only found in the classes_elsewhere table in the manifest *)
+type class_elsewhere = 
+    { Module: ModuleRef;
+      Name: string;
+      Access: TypeDefAccess;
+      Nested: nested_classes_elsewhere;
+      CustomAttrs: CustomAttributes } 
+
+type classes_elsewhere
+
+val dest_nested_classes_elsewhere: nested_classes_elsewhere -> nested_class_elsewhere  list
+val dest_classes_elsewhere: classes_elsewhere -> class_elsewhere list
+val find_class_elsewhere: string -> classes_elsewhere -> class_elsewhere
+
+(* -------------------------------------------------------------------- 
+ * "Manifest Resources" are chunks of resource data, being one of:
+ *   - the data section of the current module (Bytes of resource given directly) 
+ *   - in an external file in this assembly (offset given in the resource_where field) 
+ *   - as a resources in another assembly of the same name.  
+ * -------------------------------------------------------------------- *)
+
+type resource_access = 
+  | Public 
+  | Private 
+type resource_where = 
+  | Local of Bytes 
+  | File of ModuleRef * Int32
+  | Assembly of AssemblyRef
+
+type Resource = 
+    { Name: string;
+      Where: resource_where;
+      Access: resource_access;
+      CustomAttrs: CustomAttributes }
+
+(* -------------------------------------------------------------------- 
+ * Table of resources in a module
+ * -------------------------------------------------------------------- *)
+
+type Resources
+
+val dest_resources: Resources -> Resource  list
+
+(* -------------------------------------------------------------------- 
+ * Fixups are pretty obscure stuff for C++ code.  These are not
+ * yet correctly represented in the AbstractIL syntax.
+ * -------------------------------------------------------------------- *)
+
+(* type fixup = Fixup of (Int32 * List<string> * data_label) *)
+(* type fixups = fixup list *)
+
+(* -------------------------------------------------------------------- 
+ * Manifests, The "main" module of an assembly, and Assemblies. 
+ * 
+ * The main module of an assembly is a module plus some manifest information.
+ *
+ * An assembly is built by joining together a "main" module plus 
+ * several auxiliary modules. 
+ * -------------------------------------------------------------------- *)
+
+type manifest = 
+    { Name: string;
+      AuxModuleHashAlgorithm: Int32; 
+      SecurityDecls: SecurityDecls;
+      PublicKey: Option<Bytes>;  
+      Version: VersionInfo option;
+      Locale: Locale option;
+      CustomAttrs: CustomAttributes;
+      EnableJITOptimizations: bool;
+      DLL: bool;
+      NoAppDomain: bool;
+      NoProcess: bool;
+      NoMachine: bool;
+      ClassesElsewhere: classes_elsewhere;
+      EntrypointElsewhere: ModuleRef option;
+    } 
+
+(* -------------------------------------------------------------------- 
+ * One module in the "current" assembly, either a main-module or
+ * an auxiliary module.  The main module will have a manifest.
+ *
+ * The abbreviation "modul" is used frequently throught the OCaml source
+ * code because "module" is a resesrved word in OCaml.
+ * -------------------------------------------------------------------- *)
+
+type modul = 
+    { Manifest: manifest option;
+      CustomAttrs: CustomAttributes;
+      Name: string;
+      TypeDefs: TypeDefs;
+      SubSystem: Int32;
+      ILonly: bool;
+      32bit: bool;
+      VirtAlignment: Int32;
+      PhysAlignment: Int32;
+      ImageBase: Int32;
+      Resources: Resources; 
+      NativeResources: Bytes Lazy.t option; (* e.g. win86 resources, as the exact contents of a .res or .obj file *)
+    }
+
+val manifest_of_mainmod: modul -> manifest
+val module_is_mainmod: modul -> bool
+val assname_of_mainmod: modul -> AssemblyName
+
+(* ====================================================================
+ * PART 2
+ * 
+ * Making metadata.  Where no explicit static member 
+ * is given, you should create the concrete datatype directly, 
+ * e.g. by filling in all appropriate record FieldDefs.
+ * ==================================================================== *)
+
+(* -------------------------------------------------------------------- 
+ * Generate references to existing assemblies and modules
+ * -------------------------------------------------------------------- *)
+
+val mk_simple_assref: AssemblyName -> AssemblyRef
+val mk_simple_modref: ModuleName -> ModuleRef
+
+val mk_simple_scoref_from_assname: AssemblyName -> ScopeRef 
+val mk_simple_scoref_from_assref: AssemblyRef -> ScopeRef 
+
+val assref_for_manifest: manifest -> AssemblyRef
+val assref_for_mainmod: modul -> AssemblyRef
+
+(* -------------------------------------------------------------------- 
+ * Take apart MethodSpecs
+ * -------------------------------------------------------------------- *)
+
+val rename_mspec: string -> MethodSpec -> MethodSpec
+val relocate_mspec: Type -> MethodSpec -> MethodSpec (* deprecated *)
+
+(* -------------------------------------------------------------------- 
+ * Make type refs
+ * -------------------------------------------------------------------- *)
+
+val mk_empty_gparams: GenericParams
+val mk_empty_gactuals: Instantiation
+val mk_tyvar_ty: UInt16 -> Type
+val mk_Type: Type -> Type
+
+val mk_nested_tref: ScopeRef * List<string> * string -> TypeRef
+val mk_tref: ScopeRef * string -> TypeRef
+val mk_tref_in_tref: TypeRef * string -> TypeRef
+
+(* -------------------------------------------------------------------- 
+ * Make type specs
+ * -------------------------------------------------------------------- *)
+
+val mk_nongeneric_tspec: TypeRef -> TypeSpec
+val mk_tspec: TypeRef * Instantiation -> TypeSpec
+val mk_Callconv: HasThis -> Callconv
+
+(* -------------------------------------------------------------------- 
+ * Make Types
+ * -------------------------------------------------------------------- *)
+
+val mk_typ: boxity -> TypeSpec -> Type
+val mk_named_typ: boxity -> TypeRef -> Instantiation -> Type
+val mk_boxed_typ: TypeRef -> Instantiation -> Type
+val mk_value_typ: TypeRef -> Instantiation -> Type
+val mk_nongeneric_boxed_typ: TypeRef -> Type
+val mk_nongeneric_value_typ: TypeRef -> Type
+
+val mk_array_ty: Type * ArrayShape -> Type
+val mk_sdarray_ty: Type -> Type
+
+(* -------------------------------------------------------------------- 
+ * Make method references and specs
+ * -------------------------------------------------------------------- *)
+
+(* Construct references to any kind of method *)
+val mk_mref: TypeRef * Callconv * string * int * List<Type> * Type -> MethodRef
+val mk_mspec: MethodRef * boxity * Instantiation * Instantiation -> MethodSpec
+val mk_mspec_in_typ: Type * Callconv * string * List<Type> * Type * Instantiation -> MethodSpec
+
+(* Construct references to methods on a given type *)
+val mk_nongeneric_mspec_in_typ: Type * Callconv * string * List<Type> * Type -> MethodSpec
+
+(* Construct references to methods given a TypeSpec *)
+val mk_mspec_in_tspec: TypeSpec * boxity * Callconv * string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_nongeneric_mspec_in_tspec: TypeSpec * boxity * Callconv * string * List<Type> * Type -> MethodSpec
+
+(* Construct references to instance methods *)
+val mk_instance_mspec_in_tref: TypeRef * boxity * string * List<Type> * Type * Instantiation * Instantiation -> MethodSpec
+val mk_instance_mspec_in_tspec: TypeSpec * boxity * string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_instance_mspec_in_boxed_tspec: TypeSpec * string * List<Type> * Type * Instantiation -> MethodSpec
+
+(* Construct references to non-generic methods *)
+val mk_nongeneric_mspec_in_tref: TypeRef * boxity * Callconv * string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_nongeneric_mspec_in_nongeneric_tref: TypeRef * boxity * Callconv * string * List<Type> * Type -> MethodSpec
+
+(* Construct references to non-generic instance methods *)
+val mk_instance_nongeneric_mspec_in_tref: TypeRef * boxity * string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_instance_nongeneric_mspec_in_tspec: TypeSpec * boxity * string * List<Type> * Type -> MethodSpec
+val mk_instance_nongeneric_mspec_in_boxed_tspec: TypeSpec * string * List<Type> * Type -> MethodSpec
+val mk_instance_nongeneric_mspec_in_nongeneric_boxed_tref: TypeRef * string * List<Type> * Type -> MethodSpec
+
+(* Construct references to static methods *)
+val mk_static_mspec_in_nongeneric_boxed_tref: TypeRef * string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_static_mspec_in_boxed_tspec: TypeSpec * string * List<Type> * Type * Instantiation -> MethodSpec
+
+(* Construct references to static, non-generic methods *)
+val mk_static_nongeneric_mspec_in_nongeneric_boxed_tref: TypeRef * string * List<Type> * Type -> MethodSpec
+val mk_static_nongeneric_mspec_in_boxed_tspec: TypeSpec * string * List<Type> * Type -> MethodSpec
+
+(* Construct references to toplevel methods in modules.  Usually compiler generated. *)
+val mk_toplevel_static_mspec: ScopeRef -> string * List<Type> * Type * Instantiation -> MethodSpec
+val mk_toplevel_static_nongeneric_mspec: ScopeRef -> string * List<Type> * Type -> MethodSpec
+
+(* Construct references to constructors *)
+val mk_ctor_mspec: TypeRef * boxity * List<Type> * Instantiation -> MethodSpec
+val mk_nongeneric_ctor_mspec: TypeRef * boxity * List<Type> -> MethodSpec
+val mk_ctor_mspec_for_boxed_tspec: TypeSpec * List<Type> -> MethodSpec
+val mk_ctor_mspec_for_typ: Type * List<Type> -> MethodSpec
+val mk_ctor_mspec_for_nongeneric_boxed_tref: TypeRef * List<Type> -> MethodSpec
+
+(* Construct references to FieldDefs *)
+val mk_fref_in_tref: TypeRef * string * Type -> FieldRef
+val mk_fspec: FieldRef * Type -> FieldSpec
+val mk_fspec_in_typ: Type * string * Type -> FieldSpec
+val mk_fspec_in_tspec: TypeSpec * boxity * string * Type -> FieldSpec
+val mk_fspec_in_boxed_tspec: TypeSpec * string * Type -> FieldSpec
+val mk_fspec_in_nongeneric_boxed_tref: TypeRef * string * Type -> FieldSpec
+
+val ref_to_field_in_tdef: ScopeRef -> TypeDef -> string * Type -> FieldSpec
+val mk_mspec_to_mdef: Type * MethodDef * Instantiation -> MethodSpec
+
+val mk_CallSig: Callconv * List<Type> * Type -> CallSig
+
+(* -------------------------------------------------------------------- 
+ * Make generalized verions of possibly-generic Types,
+ * e.g. Given the TypeDef for List, return the type "List<T>".
+ * -------------------------------------------------------------------- *)
+
+val generalize_tref: TypeRef -> GenericParam list -> TypeSpec
+val generalize_tdef: ScopeRef -> TypeDef -> TypeSpec
+val generalize_nested_tdef: ScopeRef -> TypeDef list * TypeDef -> TypeSpec
+
+val gparams_add: GenericParams -> GenericParams -> GenericParams
+val gparam_of_gactual: Type -> GenericParam
+val gparams_of_inst: Instantiation -> GenericParam list
+val generalize_gparams: GenericParam list -> List<Type>
+
+(* -------------------------------------------------------------------- 
+ * Custom attributes 
+ * -------------------------------------------------------------------- *)
+
+val mk_CustomAttributeibute: 
+    TypeRef * 
+    List<CustomAttributeElement> (* fixed args: values and implicit Types *) * 
+    List<(FieldSpec * bool * CustomAttributeElement)> (* named args: vluaes and flags indicating if they are FieldDefs or properties *) 
+      -> CustomAttribute
+
+(* -------------------------------------------------------------------- 
+ * Making code.
+ * -------------------------------------------------------------------- *)
+
+val check_code:  Code -> Code
+val new_generator: unit -> (string -> string)
+val generate_CodeLabel: string -> CodeLabel
+
+(* Make some code that is a straight line sequence of instructions. *)
+(* The function will add a "return" if the last instruction is not an exiting instruction *)
+val nonbranching_instrs_to_code:  Instr list -> Code
+
+(* For "join_code c1 c2", the unique exit of c1 should be the entry of c2, and the *)
+(* label is then hidden in the result. *)
+val join_code: Code -> Code -> Code
+
+(* Some more primitive helpers *)
+val mk_bblock: basic_block -> Code
+val mk_scope_block: local_debug_info list * Code -> Code
+val mk_group_block: List<CodeLabel> * Code list -> Code
+val mk_try_finally_block: Code * CodeLabel * Code -> Code
+val mk_try_fault_block: Code * CodeLabel * Code -> Code
+
+type ('a, 'b) choice = Choice1of2 of 'a | Choice2of2 of 'b
+
+val mk_try_multi_filter_catch_block:
+  Code * (((CodeLabel * Code), typ) choice * (CodeLabel * Code)) list -> Code
+
+(* -------------------------------------------------------------------- 
+ * Injecting code into existing code blocks.  A branch will
+ * be added from the given instructions to the (unique) entry of
+ * the code, and the first instruction will be the new entry
+ * of the method.  The instructions should be non-branching.
+ *
+ * If you need to inject more complicated code sequences at the
+ * start of a method, you can use "join_code" on the underlying "code"
+ * for the method.
+ * -------------------------------------------------------------------- *)
+
+val prepend_instrs_to_code: Instr list -> Code -> Code
+val prepend_instrs_to_ilmbody: Instr list -> CILMethodBody -> CILMethodBody
+val prepend_instrs_to_mdef: Instr list -> MethodDef -> MethodDef
+
+(* -------------------------------------------------------------------- 
+ * Default values for some of the strange flags in a module.
+ * -------------------------------------------------------------------- *)
+
+val default_modulSubSystem: Int32
+val default_modulVirtAlignment: Int32
+val default_modulPhysAlignment: Int32
+val default_modulImageBase: Int32
+
+(* -------------------------------------------------------------------- 
+ * Helper to check a class is really an enum
+ * -------------------------------------------------------------------- *)
+val check_enum_FieldDefs:
+   TypeRef -> FieldDef list -> Type * FieldDef list
+
+(* -------------------------------------------------------------------- 
+ * Derived functions for making some instructions
+ * -------------------------------------------------------------------- *)
+
+val mk_normal_call: MethodSpec -> Instr
+val mk_normal_callvirt: MethodSpec -> Instr
+val mk_normal_newobj: MethodSpec -> Instr
+val mk_mscorlib_exn_newobj: string -> Instr
+val mk_nongeneric_call_superclass_constructor: boxity -> TypeRef -> Instr list
+val mk_call_superclass_constructor: TypeSpec -> Instr list
+val mk_normal_stfld: FieldSpec -> Instr
+val mk_normal_stsfld: FieldSpec -> Instr
+val mk_normal_ldsfld: FieldSpec -> Instr
+val mk_normal_ldfld: FieldSpec -> Instr
+val mk_normal_ldflda: FieldSpec -> Instr
+val mk_normal_stind: BasicType -> Instr
+val mk_normal_ldind: BasicType -> Instr
+val mk_normal_cpind: BasicType -> Instr list
+val mk_writeline_call: Instr
+val mk_ldc_Int32: Int32 -> Instr
+
+val mk_param: string option * Type -> param
+val mk_unnamed_param: Type -> param
+val mk_named_param: string * Type -> param
+val mk_return: Type -> ReturnSpec
+val mk_void_return: ReturnSpec
+val mk_local: Type -> local
+
+val mk_ilmbody: bool (* initlocals? *) * local list * int * Code * Option<SourceAnnotation> -> CILMethodBody
+val mk_impl: bool * local list * int * Code * Option<SourceAnnotation> -> MethodBody_details
+
+val mk_ctor: MemberAccess * List<Param> * MethodBody_details -> MethodDef
+val mk_nongeneric_nothing_ctor: Option<SourceAnnotation> -> TypeRef -> boxity -> List<Param> -> MethodDef
+val mk_nothing_ctor: Option<SourceAnnotation> -> TypeSpec -> List<Param> -> MethodDef
+val mk_static_mdef: GenericParams * string * MemberAccess * List<Param> * Type * MethodBody_details -> MethodDef
+val mk_static_nongeneric_mdef: string * MemberAccess * List<Param> * Type * MethodBody_details -> MethodDef
+val mk_cctor: MethodBody_details -> MethodDef
+val mk_generic_virtual_mdef: string * MemberAccess * GenericParams * (Type * List<Type> * typ) option * List<Param> * Type * MethodBody_details -> MethodDef
+val mk_nongeneric_virtual_mdef: string * MemberAccess * (Type * List<Type> * typ) option * List<Param> * Type * MethodBody_details -> MethodDef
+val mk_instance_nongeneric_mdef: string * MemberAccess * List<Param> * Type * MethodBody_details -> MethodDef
+val mk_normal_virtual_mdef: string * MemberAccess * List<Param> * Type * MethodBody_details -> MethodDef
+
+val gen_mk_fdef:
+  bool (* static? *) * string * Type * Option<FieldInit> *  Option<Bytes> * MemberAccess -> FieldDef
+val mk_fdef: string * Type * Option<FieldInit> * MemberAccess -> FieldDef
+val mk_static_fdef:
+  string * Type * Option<FieldInit> * Option<Bytes> * MemberAccess -> FieldDef
+
+val add_mdef_to_tdef: MethodDef -> TypeDef -> TypeDef
+val mk_generic_class: string * TypeDefAccess * GenericParams * Type * List<Type> * MethodDefs * FieldDefs -> TypeDef
+val mk_simple_tdef: string * TypeDefAccess * MethodDefs * FieldDefs -> TypeDef
+val mk_toplevel_tdef: MethodDefs * FieldDefs -> TypeDef
+val add_fdef_to_tdef: FieldDef -> TypeDef -> TypeDef
+
+val mk_rawdata_vtdef:  string * Int32 (* size *) * UInt16 (* pack *) -> TypeDef
+
+val tref_for_tdef: ScopeRef -> TypeDef -> TypeRef
+val tref_for_nested_tdef: ScopeRef -> TypeDef list * TypeDef -> TypeRef
+val tspec_for_nested_tdef: ScopeRef -> TypeDef list * TypeDef -> TypeSpec
+
+val prepend_instrs_to_cctor: Instr list -> Option<SourceAnnotation> -> TypeDef -> TypeDef
+
+type tmps = { num_old_locals: int; mutable newlocals: local list; } 
+val alloc_tmp: tmps -> local -> UInt16
+
+val mk_storage_ctor: Option<SourceAnnotation> -> Instr list -> TypeSpec -> (string * typ) list -> MethodDef
+val mk_simple_storage_ctor: Option<SourceAnnotation> -> TypeSpec option -> TypeSpec -> (string * typ) list -> MethodDef
+
+val and_Tailness: Tailness -> bool -> Tailness
+
+val mk_ctor_mspec_for_delegate_tdef: ScopeRef * TypeDef * Instantiation -> MethodSpec 
+
+val tref_for_toplevel: ScopeRef -> TypeRef
+val tspec_for_toplevel: ScopeRef -> TypeSpec
+val typ_for_toplevel: ScopeRef -> Type
+
+val mk_CustomAttributes: CustomAttribute list -> CustomAttributes
+val mk_lazy_CustomAttributes: (CustomAttribute list) Lazy.t -> CustomAttributes
+val add_CustomAttribute: CustomAttribute -> CustomAttributes -> CustomAttributes
+
+val mk_SecurityDecls: permission list -> SecurityDecls
+val mk_lazy_SecurityDecls: (permission list) Lazy.t -> SecurityDecls
+val add_security_decl: permission -> SecurityDecls -> SecurityDecls
+
+val mk_mbody : MethodBody_details -> MethodBody
+val mk_lazy_mbody : MethodBody_details Lazy.t -> MethodBody
+
+val mk_events: EventDef list -> EventDefs
+val mk_lazy_events: (EventDef list) Lazy.t -> EventDefs
+val add_event: EventDef -> EventDefs -> EventDefs
+
+val mk_properties: PropertyDef list -> ILPropertyDefs
+val mk_lazy_properties: (PropertyDef list) Lazy.t -> ILPropertyDefs
+val add_property: PropertyDef -> ILPropertyDefs -> ILPropertyDefs
+
+val mk_mdefs: MethodDef list -> MethodDefs
+val mk_lazy_mdefs: (MethodDef list) Lazy.t -> MethodDefs
+val add_mdef:  MethodDef -> MethodDefs -> MethodDefs
+
+val mk_fdefs: FieldDef list -> FieldDefs
+val mk_lazy_fdefs: (FieldDef list) Lazy.t -> FieldDefs
+val add_fdef: FieldDef -> FieldDefs -> FieldDefs
+
+val mk_mimpls: MethodImpl list -> MethodImpls
+val mk_lazy_mimpls: (MethodImpl list) Lazy.t -> MethodImpls
+val add_mimpl: MethodImpl -> MethodImpls -> MethodImpls
+
+val mk_tdefs: TypeDef  list -> TypeDefs
+val mk_lazy_tdefs: ((string * TypeDef Lazy.t) list) Lazy.t -> TypeDefs
+val add_tdef: TypeDef -> TypeDefs -> TypeDefs
+
+val add_nested_class_elsewhere: nested_class_elsewhere -> nested_classes_elsewhere -> nested_classes_elsewhere
+val mk_nested_classes_elsewhere: nested_class_elsewhere list -> nested_classes_elsewhere
+val mk_lazy_nested_classes_elsewhere: (nested_class_elsewhere list) Lazy.t -> nested_classes_elsewhere
+
+val mk_classes_elsewhere: class_elsewhere list -> classes_elsewhere
+val mk_lazy_classes_elsewhere: (class_elsewhere list) Lazy.t -> classes_elsewhere
+val add_class_elsewhere: class_elsewhere -> classes_elsewhere -> classes_elsewhere
+
+val mk_resources: Resource list -> Resources
+val add_resource: Resource -> Resources -> Resources
+val mk_lazy_resources: (Resource list) Lazy.t -> Resources
+
+exception Not_unique_field of FieldDef
+exception Not_unique_method of MethodDef
+exception Not_unique_type of string
+
+val mk_simple_mainmod: AssemblyName -> ModuleName -> bool (* dll? *) -> TypeDefs -> modul
+val mk_modul_fragment: ModuleName -> TypeDefs -> modul
+val add_toplevel_mdef: MethodDef -> modul -> modul
+
+
+(* ====================================================================
+ * PART 3: Utilities
+ * ==================================================================== *)
+
+val rescope_scoref: ScopeRef -> ScopeRef -> ScopeRef
+val rescope_tspec: ScopeRef -> TypeSpec -> TypeSpec
+val rescope_typ: ScopeRef -> Type -> Type
+val rescope_mspec: ScopeRef -> MethodSpec -> MethodSpec
+val rescope_ospec: ScopeRef -> OverridesSpec -> OverridesSpec
+val rescope_mref: ScopeRef -> MethodRef -> MethodRef 
+val rescope_fref: ScopeRef -> FieldRef -> FieldRef
+val rescope_fspec: ScopeRef -> FieldSpec -> FieldSpec
+
+
+type seh_clause = 
+  | SEH_finally of (CodeLabel * CodeLabel)
+  | SEH_fault  of (CodeLabel * CodeLabel)
+  | SEH_filter_catch of (CodeLabel * CodeLabel) * (CodeLabel * CodeLabel)
+  | SEH_type_catch of Type * (CodeLabel * CodeLabel)
+
+type exception_spec = 
+    { exnRange: (CodeLabel * CodeLabel);
+      exnClauses: seh_clause list }
+
+type local_spec = 
+    { locRange: (CodeLabel * CodeLabel);
+      locInfos: local_debug_info list }
+
+val build_code:
+    string ->
+    (CodeLabel -> int) -> 
+    Instr array -> 
+    exception_spec list -> 
+    local_spec list -> 
+    Code
+
+val inst_tspec_aux: int -> Instantiation -> TypeSpec -> TypeSpec
+val inst_typ_aux: int -> Instantiation -> Type -> Type
+val inst_Type_aux: int -> Instantiation -> Type -> Type
+val inst_inst_aux: int -> Instantiation -> Instantiation -> Instantiation
+val inst_CallSig_aux: int -> Instantiation -> CallSig -> CallSig
+val inst_typ: Instantiation -> Type -> Type
+val inst_inst: Instantiation -> Instantiation -> Instantiation
+val inst_tspec: Instantiation -> TypeSpec -> TypeSpec
+val inst_CallSig: Instantiation -> CallSig -> CallSig
+
+val inst_read: Instantiation -> UInt16 -> Type
+val inst_add: Instantiation -> Instantiation -> Instantiation
+
+
+val ecma_public_token: PublicKeyInfo
+
+val mscorlib_assembly_name: string
+val mscorlib_module_name: string
+val mscorlib_aref: AssemblyRef
+val mscorlib_scoref: ScopeRef
+
+val tname_Object: string
+val tref_Object: TypeRef
+val tspec_Object: TypeSpec
+val typ_Object: typ
+val tname_String: string
+val tref_String: TypeRef
+val tspec_String: TypeSpec
+val typ_String: typ
+val tname_AsyncCallback: string
+val tref_AsyncCallback: TypeRef
+val tspec_AsyncCallback: TypeSpec
+val typ_AsyncCallback: typ
+val tname_IAsyncResult: string
+val tref_IAsyncResult: TypeRef
+val tspec_IAsyncResult: TypeSpec
+val typ_IAsyncResult: typ
+val tname_IComparable: string
+val tref_IComparable: TypeRef
+val tspec_IComparable: TypeSpec
+val typ_IComparable: typ
+val tname_Type: string
+val tref_Type: TypeRef
+val tspec_Type: TypeSpec
+val typ_Type: typ
+val tname_Delegate: string
+val tref_Delegate: TypeRef
+val tspec_Delegate: TypeSpec
+val typ_Delegate: typ
+val tname_ValueType: string
+val tref_ValueType: TypeRef
+val tspec_ValueType: TypeSpec
+val typ_ValueType: typ
+val tname_Enum: string
+val tref_Enum: TypeRef
+val tspec_Enum: TypeSpec
+val typ_Enum: typ
+val tname_TypedReference: string
+val tref_TypedReference: TypeRef
+val tspec_TypedReference: TypeSpec
+val typ_TypedReference: typ
+
+val tname_MulticastDelegate: string
+val tref_MulticastDelegate: TypeRef
+val tspec_MulticastDelegate: TypeSpec
+val typ_MulticastDelegate: typ
+val tname_Array: string
+val tref_Array: TypeRef
+val tspec_Array: TypeSpec
+val typ_Array: typ
+val tname_Int64: string
+val tref_Int64: TypeRef
+val tname_UInt64: string
+val tref_UInt64: TypeRef
+val tname_Int32: string
+val tref_Int32: TypeRef
+val tname_UInt32: string
+val tref_UInt32: TypeRef
+val tname_Int16: string
+val tref_Int16: TypeRef
+val tname_UInt16: string
+val tref_UInt16: TypeRef
+val tname_SByte: string
+val tref_SByte: TypeRef
+val tname_Byte: string
+val tref_Byte: TypeRef
+val tname_Single: string
+val tref_Single: TypeRef
+val tname_Double: string
+val tref_Double: TypeRef
+val tname_NativeFloat: string
+val tref_NativeFloat: TypeRef
+val tname_Bool: string
+val tref_Bool: TypeRef
+val tname_Char: string
+val tref_Char: TypeRef
+val tname_IntPtr: string
+val tref_IntPtr: TypeRef
+val tname_UIntPtr: string
+val tref_UIntPtr: TypeRef
+val tspec_Int64: TypeSpec
+val tspec_UInt64: TypeSpec
+val tspec_Int32: TypeSpec
+val tspec_UInt32: TypeSpec
+val tspec_Int16: TypeSpec
+val tspec_UInt16: TypeSpec
+val tspec_SByte: TypeSpec
+val tspec_Byte: TypeSpec
+val tspec_Single: TypeSpec
+val tspec_Double: TypeSpec
+val tspec_NativeFloat: TypeSpec
+val tspec_IntPtr: TypeSpec
+val tspec_UIntPtr: TypeSpec
+val tspec_Char: TypeSpec
+val tspec_Bool: TypeSpec
+val typ_Int8: Type
+val typ_Int16: Type
+val typ_Int32: Type
+val typ_Int64: Type
+val typ_UInt8: Type
+val typ_UInt16: Type
+val typ_UInt32: Type
+val typ_UInt64: Type
+val typ_Single: Type
+val typ_Double: Type
+val typ_bool: Type
+val typ_char: Type
+val typ_int: Type
+val typ_uint: Type
+val tname_RuntimeArgumentHandle: string
+val tref_RuntimeArgumentHandle: TypeRef
+val tspec_RuntimeArgumentHandle: TypeSpec
+val typ_RuntimeArgumentHandle: Type
+val tname_RuntimeTypeHandle: string
+val tref_RuntimeTypeHandle: TypeRef
+val tspec_RuntimeTypeHandle: TypeSpec
+val typ_RuntimeTypeHandle: Type
+val tname_RuntimeMethodHandle: string
+val tref_RuntimeMethodHandle: TypeRef
+val tspec_RuntimeMethodHandle: TypeSpec
+val typ_RuntimeMethodHandle: Type
+val tname_RuntimeFieldHandle: string
+val tref_RuntimeFieldHandle: TypeRef
+val tspec_RuntimeFieldHandle: TypeSpec
+val typ_RuntimeFieldHandle: Type
+
+val typ_Byte: Type
+val typ_Int16: Type
+val typ_Int32: Type
+val typ_Int64: Type
+val typ_SByte: Type
+val typ_UInt16: Type
+val typ_UInt32: Type
+val typ_UInt64: Type
+val typ_Single: Type
+val typ_Double: Type
+val typ_NativeFloat: Type
+val typ_Bool: Type
+val typ_Char: Type
+val typ_IntPtr: Type
+val typ_UIntPtr: Type
+
+val tname_Exception: string
+val tref_Exception: TypeRef
+val tspec_Exception: TypeSpec
+val typ_Exception: Type
+
+(* Some commonly used methods *)
+val mspec_Object_Equals: MethodSpec
+val mspec_Object_GetHashCode: MethodSpec
+val mspec_IComparable_CompareTo: MethodSpec
+val mspec_Console_WriteLine: MethodSpec
+val mspec_RuntimeHelpers_InitializeArray: MethodSpec 
+
+val mk_DebuggableAttribute: bool (* debug tracking *) * bool (* disable JIT optimizations *) -> CustomAttribute
+
+val mk_DebuggerHiddenAttribute: CustomAttribute
+val mk_DebuggerStepThroughAttribute: CustomAttribute
+
+val mk_RunClassConstructor: TypeSpec -> Instr list
+
+val typ_is_SystemMulticastDelegate: Type -> bool
+val typ_is_SystemDelegate: Type -> bool
+val typ_is_SystemValueType: Type -> bool
+val typ_is_SystemEnum: Type -> bool
+
+val token_from_public_key: Bytes -> Bytes
+
+val parse_version: string -> VersionInfo
+
+val info_for_delegate: string * MethodDefs -> delegate_info
+val info_for_enum: string * FieldDefs -> enum_info
+
+val intern_Bytes: Bytes -> Bytes
+val intern_string: string -> string
+val intern_tref: TypeRef -> TypeRef
+val intern_tspec: TypeSpec -> TypeSpec
+val intern_typ: Type -> Type
+val intern_instr: Instr -> Instr
+
+type refs = 
+    { refsAssembly: AssemblyRef list; 
+      refsModul: ModuleRef list; }
+
+val refs_of_module: modul -> refs
+val combine_refs: refs -> refs -> refs
+val empty_refs: refs
+
diff --git a/tests/fsharp/core/members/basics/build.bat b/tests/fsharp/core/members/basics/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/members/basics/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/members/basics/run.bat b/tests/fsharp/core/members/basics/run.bat
new file mode 100644
index 0000000..37699c3
--- /dev/null
+++ b/tests/fsharp/core/members/basics/run.bat
@@ -0,0 +1,14 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\..\config.bat
+
+call %~d0%~p0..\..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
diff --git a/tests/fsharp/core/members/basics/test-hw.fsx b/tests/fsharp/core/members/basics/test-hw.fsx
new file mode 100644
index 0000000..686f77d
--- /dev/null
+++ b/tests/fsharp/core/members/basics/test-hw.fsx
@@ -0,0 +1,5577 @@
+// #Regression #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression 
+#light
+
+module Tests
+
+let mutable failures = []
+let report_failure s = 
+  stderr.WriteLine " NO"; failures <- s :: failures
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s
+let check s v1 v2 = test s (v1 = v2)
+
+//--------------------------------------------------------------
+// Test defining a record using object-expression syntax
+
+type RecordType = { a: int; mutable b: int }
+
+let rval = { new RecordType with a = 1 and b = 2 }
+let rvalaaa2 = { new RecordType 
+                        with a = 1 
+                        and b = 2 }
+
+test "fweoew091" (rval.a = 1)
+test "fweoew092" (rval.b = 2)
+rval.b <- 3
+test "fweoew093" (rval.b = 3)
+
+type RecordType2<'a,'b> = { a: 'a; mutable b: 'b }
+
+let rval2 = { new RecordType2<int,int> with a = 1 and b = 2 }
+
+test "fweoew091" (rval2.a = 1)
+test "fweoew092" (rval2.b = 2)
+rval2.b <- 3
+test "fweoew093" (rval2.b = 3)
+
+let f(x) = 
+  { new RecordType2<'a,int> with a = x and b = 2 }
+
+test "fweoew091" ((f(1)).a = 1)
+test "fweoew092" ((f(1)).b = 2)
+(f(1)).b <- 3
+test "fweoew093" ((f(1)).b = 2)
+
+
+open System
+open System.Collections
+open System.Windows.Forms
+
+//-----------------------------------------
+// Some simple object-expression tests
+
+let x0 = { new System.Object() with member __.GetHashCode() = 3 }
+let x1 = { new System.Windows.Forms.Form() with member __.GetHashCode() = 3 }
+
+//-----------------------------------------
+// Test defining an F# class
+
+
+type ClassType1 =
+  class
+     inherit System.Object 
+     val someField : string
+
+     interface IEnumerable 
+
+     abstract VirtualMethod1: string -> int
+     abstract VirtualMethod2: string * string -> int
+     abstract VirtualMethod1PostHoc: string -> int
+     abstract VirtualMethod2PostHoc: string * string -> int
+     default x.VirtualMethod1(s) = 3
+     default x.VirtualMethod2(s1,s2) = 3
+
+     new(s: string) = { inherit System.Object(); someField = "abc" }
+  end
+
+type ClassType1
+  with 
+     default x.VirtualMethod1PostHoc(s) = 3
+     default x.VirtualMethod2PostHoc(s1,s2) = 3
+     new(s1,s2) =  
+       { inherit System.Object(); someField = "constructor2" + s1 + s2 }
+  end
+
+
+open System.Collections
+type ClassType1 
+  with 
+    member x.GetEnumerator() = failwith "no implementation" 
+    interface IEnumerable 
+      with 
+        member x.GetEnumerator() = failwith "no implementation" 
+      end 
+    end
+let x = 1
+
+let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 }
+let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 }
+let x4 = { new ClassType1("a") with 
+                 member __.VirtualMethod1(s) = 5 
+                 member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length }
+
+
+
+test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+
+test "e09wckj2ddwdw" (try ignore(((x2 :> obj) :?> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+test "e09wckj2defwe" (x2.VirtualMethod1("abc") = 3)
+test "e09wckd2jfew3" (x3.VirtualMethod1("abc") = 4)
+test "e09wckf3q2j" (x4.VirtualMethod1("abc") = 5)
+test "e09wckj321" (x4.VirtualMethod2("abc","d") = 4)
+
+
+//-----------------------------------------
+// Test inheriting from an F# type
+
+
+type ClassType2 =
+  class
+     inherit ClassType1 
+     val someField2 : string
+
+     override x.VirtualMethod1(s) = 2001
+     override x.VirtualMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2
+
+     new(s) = { inherit ClassType1(s); someField2 = s }
+  end
+
+
+let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 }
+let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 }
+let x42 = { new ClassType2("abcd")  with
+              member __.VirtualMethod1(s) = 5004 
+              member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length }
+
+test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true)
+test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true)
+
+test "e09wckjd3" (x22.VirtualMethod1("abc") = 2001)
+test "e09wckjd3" (x32.VirtualMethod1("abc") = 4002)
+test "e09wckjfew" (x42.VirtualMethod1("abc") = 5004)
+test "e09wckjd3" (x22.VirtualMethod2("abcd","dqw") = 8)
+test "e09wckjd3" (x32.VirtualMethod2("abcd","dqw") = 10)
+
+
+
+//-----------------------------------------
+// Test defining an F# class
+
+
+module AbstractClassTest = begin
+
+    [<AbstractClass>]
+    type ClassType1 =
+      class
+         inherit System.Object 
+         val someField : string
+
+         interface IEnumerable 
+
+         abstract AbstractMethod1: string -> int
+         abstract AbstractMethod2: string * string -> int
+
+         new(s: string) = { inherit System.Object(); someField = "abc" }
+      end
+
+    type ClassType1
+      with 
+         interface IEnumerable with 
+            member x.GetEnumerator() = failwith "no implementation"
+         end
+
+      end
+
+    //let shouldGiveError1 = { new ClassType1("a") with GetHashCode() = 3 }
+    //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 }
+    //let shouldGiveError3a = new ClassType1("a")
+    let x4 = { new ClassType1("a") with 
+                  member __.AbstractMethod1(s) = 5 
+                  member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length }
+
+
+    do test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+
+    test "e09wckj2ddwdw" (try ignore(((x2 :> obj) :?> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+    test "e09wckf3q2j" (x4.AbstractMethod1("abc") = 5)
+    test "e09wckj321" (x4.AbstractMethod2("abc","d") = 4)
+
+
+    type ClassType2 =
+      class
+         inherit ClassType1 
+         val someField2 : string
+
+         override x.AbstractMethod1(s) = 2001
+         override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2
+
+         new(s) = { inherit ClassType1(s); someField2 = s }
+      end
+
+
+    let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 }
+    let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 }
+    let x42 = { new ClassType2("abcd")  with
+                  member __.AbstractMethod1(s) = 5004 
+                  member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length }
+
+    do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true)
+    do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true)
+
+    test "e09wckjd3" (x22.AbstractMethod1("abc") = 2001)
+    test "e09wckjd3" (x32.AbstractMethod1("abc") = 4002)
+    test "e09wckjfew" (x42.AbstractMethod1("abc") = 5004)
+    test "e09wckjd3" (x22.AbstractMethod2("abcd","dqw") = 8)
+    test "e09wckjd3" (x32.AbstractMethod2("abcd","dqw") = 10)
+
+    type ClassType3 =
+      class
+         inherit ClassType2
+         val someField3 : string
+
+         override x.AbstractMethod1(s) = 2001
+         override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 + x.someField3.Length
+
+         new(s) = { inherit ClassType2(s); someField3 = s }
+      end
+
+
+
+end
+
+//-----------------------------------------
+//-----------------------------------------
+
+
+
+
+// Various rejected syntaxes for constructors:
+//   new(s: string) = { base=new Form(); x = "abc" }
+//   new ClassType1(s: string) : base() = { x = "abc" }
+//   new(s: string) = { inherit Form(); x = "abc" }
+//   member ClassType1(s: string) = new { inherit Form(); x = "abc" }
+//   member ClassType1(s: string) = { inherit Form(); x = "abc" }
+//   initializer(s: string) = { inherit Form(); x = "abc" }
+//   new ClassType1(s: string) = { inherit Form(); x = "abc" }
+
+//     new(s: string) = { inherit Form(); x = "abc" }
+
+//     new((s: string), (s2:string)) = { inherit Form(); x = s }
+
+
+//     abstract AbstractProperty: string
+//     abstract AbstractMutableProperty: string with get,set
+
+
+//     new(s: string) = { new ClassType1 with base=new Object() and x = "abc" }
+//     new(s: string) = { new ClassType1 with base=new Form() and x = "abc" }
+//     new(s: string) = ((new System.Object()) :?> ClassType1)
+ 
+
+//-----------------------------------------
+// Thorough testing of members for records.
+
+module RecordTypeTest = begin
+
+    type AbstractType = 
+      { instanceField: string;
+        mutable mutableInstanceField: string;
+        instanceArray: string array;
+        instanceArray2: string array array;
+        mutableInstanceArray: string array;
+        mutableInstanceArray2: string array array; 
+        recursiveInstance: AbstractType;
+        }
+
+    let staticField = "staticField"
+    let mutableStaticField = ref "mutableStaticFieldInitialValue"
+    let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |]
+    let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |]
+
+    let NewAbstractValue(s) = 
+      let rec self =
+        { instanceField=s;
+          mutableInstanceField=s;
+          instanceArray=[| s;s |];
+          instanceArray2=[| [| s;s |];[| s;s |] |];
+          mutableInstanceArray =[| s;s |];
+          mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; 
+          recursiveInstance=self;
+        } 
+      self
+
+    type AbstractType 
+     with 
+      // properties
+      member x.ToString() = x.instanceField
+      member x.InstanceProperty = x.instanceField+".InstanceProperty"
+      member x.RecursiveInstance = x.recursiveInstance
+      member x.RecursiveInstanceMethod() = x.recursiveInstance
+      member x.MutableInstanceProperty
+        with get() = x.mutableInstanceField
+        and set(v:string) = x.mutableInstanceField <- v
+        
+      member x.InstanceIndexerCount = Array.length x.instanceArray
+
+      member x.InstanceIndexer
+         with get(idx) = x.instanceArray.[idx]
+      member x.InstanceIndexer2
+         with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2]
+      member x.InstanceIndexer2Count1 = 2
+      member x.InstanceIndexer2Count2 = 2
+
+      member x.MutableInstanceIndexerCount = Array.length x.mutableInstanceArray
+
+      member x.MutableInstanceIndexer
+         with get (idx1) = x.mutableInstanceArray.[idx1]
+         and  set (idx1) (v:string) = x.mutableInstanceArray.[idx1] <- v
+
+      member x.MutableInstanceIndexer2
+         with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2]
+         and  set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v
+      member x.MutableInstanceIndexer2Count1 = 2
+      member x.MutableInstanceIndexer2Count2 = 2
+
+      static member StaticProperty = staticField
+      static member MutableStaticProperty
+              with get() = !mutableStaticField
+              and  set(v:string) = mutableStaticField := v
+        
+      static member StaticIndexer
+              with get(idx) = staticArray.[idx]
+         
+      static member StaticIndexerCount = Array.length staticArray
+
+      static member MutableStaticIndexer
+              with get(idx:int) = mutableStaticArray.[idx]
+              and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member MutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.InstanceMethod(s1:string) = Printf.sprintf "%s.InstanceMethod(%s)" x.instanceField s1
+      static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+      // private versions of the above
+      member x.PrivateInstanceProperty = x.instanceField+".InstanceProperty"
+      member x.PrivateMutableInstanceProperty
+        with get() = x.mutableInstanceField
+        and  set(v:string) = x.mutableInstanceField <- v
+        
+      member x.PrivateInstanceIndexerCount = Array.length x.instanceArray
+
+      member x.PrivateInstanceIndexer
+         with get(idx) = x.instanceArray.[idx]
+      member x.PrivateInstanceIndexer2
+         with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2]
+      member x.PrivateInstanceIndexer2Count1 = 2
+      member x.PrivateInstanceIndexer2Count2 = 2
+
+      member x.PrivateMutableInstanceIndexerCount = Array.length x.mutableInstanceArray
+
+      member x.PrivateMutableInstanceIndexer
+         with get (idx1) = x.mutableInstanceArray.[idx1]
+         and  set (idx1) (v:string) = x.mutableInstanceArray.[idx1] <- v
+
+      member x.PrivateMutableInstanceIndexer2
+         with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2]
+         and  set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v
+      member x.PrivateMutableInstanceIndexer2Count1 = 2
+      member x.PrivateMutableInstanceIndexer2Count2 = 2
+
+      static member PrivateStaticProperty = staticField
+      static member PrivateMutableStaticProperty
+              with get() = !mutableStaticField
+              and  set(v:string) = mutableStaticField := v
+        
+      static member PrivateStaticIndexer
+              with get(idx) = staticArray.[idx]
+         
+      static member PrivateStaticIndexerCount = Array.length staticArray
+
+      static member PrivateMutableStaticIndexer
+              with get(idx:int) = mutableStaticArray.[idx]
+              and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "%s.InstanceMethod(%s)" x.instanceField s1
+      static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+
+     end
+
+
+
+    // Test accesses of static properties, methods
+    do System.Console.WriteLine("AbstractType.StaticProperty = {0}", AbstractType.StaticProperty)
+    do AbstractType.MutableStaticProperty <- "MutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.StaticIndexer(0) = {0}", AbstractType.StaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.StaticMethod(abc,def) = {0}", AbstractType.StaticMethod("abc","def") )
+    do System.Console.WriteLine("AbstractType.PrivateStaticProperty = {0}", AbstractType.PrivateStaticProperty )
+    do AbstractType.PrivateMutableStaticProperty <- "PrivateMutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.PrivateStaticIndexer(0) = {0}", AbstractType.PrivateStaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.PrivateStaticMethod(abc,def) = {0}", AbstractType.PrivateStaticMethod("abc","def") )
+
+    // Torture this poor object
+    let xval = NewAbstractValue("abc")
+
+    // Test dynamic rediscovery of type
+    do test "e09wckdw" (not ((xval :> obj) :? IEnumerable))
+    do test "e09wckdwddw" (not ((xval :> obj) :? string))
+    do test "e09dwdw" (not ((xval :> obj) :? list<int>))
+    do test "e09dwwd2" ((xval :> obj) :? AbstractType)
+
+    // Test access of instance properties, methods through variables
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do xval.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do xval.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do xval.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do xval.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do xval.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc..PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path field lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.recursiveInstance.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.recursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.recursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.recursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.recursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do xval.recursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.recursiveInstance.MutableInstanceIndexer(0) )
+    do xval.recursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.recursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.recursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.recursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.recursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.recursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.recursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.recursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.recursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+    do xval.recursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.recursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+
+
+    // repeat all the above through a long-path property lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.RecursiveInstance.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path method lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", (xval.RecursiveInstanceMethod()).instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", (xval.RecursiveInstanceMethod()).InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+
+end
+
+//-----------------------------------------
+// Thorough testing of members for records.
+
+module UnionTypeTest = begin
+
+    type AbstractType =  A of AbstractType | B of string
+
+    let staticField = "staticField"
+    let mutableStaticField = ref "mutableStaticFieldInitialValue"
+    let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |]
+    let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |]
+
+    let NewAbstractValue(s) = B(s)
+
+    type AbstractType 
+     with 
+      // properties
+      member x.ToString() = match x with A _ -> "A" | B(s) -> "B"
+      member x.InstanceProperty = "instanceProperty"
+      member x.RecursiveInstance = match x with A y -> y | B s -> x
+      member x.RecursiveInstanceMethod() =  x.RecursiveInstance
+      member x.MutableInstanceProperty
+        with get() = x.InstanceProperty
+        and  set(v:string) = Printf.printf "called MutableInstanceProperty.set\n"
+        
+      member x.InstanceIndexerCount = 1
+
+      member x.InstanceIndexer
+         with get(idx) = "a"
+      member x.InstanceIndexer2
+         with get(idx1,idx2) = "a"
+      member x.InstanceIndexer2Count1 = 2
+      member x.InstanceIndexer2Count2 = 2
+
+      member x.MutableInstanceIndexerCount = 1
+
+      member x.MutableInstanceIndexer
+         with get (idx1) = "a"
+         and  set (idx1) (v:string) =  Printf.printf "called MutableInstanceIndexer.set\n"
+
+      member x.MutableInstanceIndexer2
+         with get (idx1,idx2) = "a"
+         and  set (idx1,idx2) (v:string) =  Printf.printf "called MutableInstanceIndexer2.set\n"
+      member x.MutableInstanceIndexer2Count1 = 2
+      member x.MutableInstanceIndexer2Count2 = 2
+
+      static member StaticProperty = staticField
+      static member MutableStaticProperty
+              with get() = !mutableStaticField
+              and  set(v:string) = mutableStaticField := v
+        
+      static member StaticIndexer
+              with get(idx) = staticArray.[idx]
+         
+      static member StaticIndexerCount = Array.length staticArray
+
+      static member MutableStaticIndexer
+              with get(idx:int) = mutableStaticArray.[idx]
+              and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member MutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1
+      static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+      // private versions of the above
+      member x.PrivateInstanceProperty = "InstanceProperty"
+      member x.PrivateMutableInstanceProperty
+        with get() = "a"
+        and  set(v:string) = Printf.printf "called mutator\n"
+        
+      member x.PrivateInstanceIndexerCount = 1
+
+      member x.PrivateInstanceIndexer
+         with get(idx) = "b"
+      member x.PrivateInstanceIndexer2
+         with get(idx1,idx2) = "c"
+      member x.PrivateInstanceIndexer2Count1 = 1
+      member x.PrivateInstanceIndexer2Count2 = 1
+
+      member x.PrivateMutableInstanceIndexerCount = 3
+
+      member x.PrivateMutableInstanceIndexer
+         with get (idx1) = "a"
+         and  set (idx1) (v:string) = Printf.printf "called mutator\n"
+
+      member x.PrivateMutableInstanceIndexer2
+         with get (idx1,idx2) = "a"
+         and  set (idx1,idx2) (v:string) = Printf.printf "called mutator\n"
+      member x.PrivateMutableInstanceIndexer2Count1 = 2
+      member x.PrivateMutableInstanceIndexer2Count2 = 2
+
+      static member PrivateStaticProperty = staticField
+      static member PrivateMutableStaticProperty
+              with get() = !mutableStaticField
+              and  set(v:string) = mutableStaticField := v
+        
+      static member PrivateStaticIndexer
+              with get(idx) = staticArray.[idx]
+         
+      static member PrivateStaticIndexerCount = Array.length staticArray
+
+      static member PrivateMutableStaticIndexer
+              with get(idx:int) = mutableStaticArray.[idx]
+              and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)"  s1
+      static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+    end
+
+
+
+    // Test accesses of static properties, methods
+    do System.Console.WriteLine("AbstractType.StaticProperty = {0}", AbstractType.StaticProperty)
+    do AbstractType.MutableStaticProperty <- "MutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.StaticIndexer(0) = {0}", AbstractType.StaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.StaticMethod(abc,def) = {0}", AbstractType.StaticMethod("abc","def") )
+    do System.Console.WriteLine("AbstractType.PrivateStaticProperty = {0}", AbstractType.PrivateStaticProperty )
+    do AbstractType.PrivateMutableStaticProperty <- "PrivateMutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.PrivateStaticIndexer(0) = {0}", AbstractType.PrivateStaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.PrivateStaticMethod(abc,def) = {0}", AbstractType.PrivateStaticMethod("abc","def") )
+
+    // Torture this poor object
+    let xval = NewAbstractValue("abc")
+
+    // Test dynamic rediscovery of type
+    do test "e09wckdw" (not ((xval :> obj) :? IEnumerable))
+    do test "e09wckdwddw" (not ((xval :> obj) :? string))
+    do test "e09dwdw" (not ((xval :> obj) :? list<int>))
+    do test "e09dwwd2" ((xval :> obj) :? AbstractType)
+
+    // Test access of instance properties, methods through variables
+
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do xval.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do xval.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do xval.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do xval.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do xval.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc..PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path field lookup
+
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+
+    // repeat all the above through a long-path property lookup
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path method lookup
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", (xval.RecursiveInstanceMethod()).InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+
+end
+
+
+//---------------------------------------------------------------------
+// Test that we can change the default structural comparison semantics
+
+
+module OverrideIComparableOnClassTest = begin
+
+  type MyStringClass = 
+    class 
+      val cache: int 
+      val v: string 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v 
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) 
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringClass).v ) = 0
+      end 
+      member x.Length = x.cache
+      new(s:string) = { inherit Object(); cache=s.Length; v=s }
+    end
+
+  let s1 = new MyStringClass("abc")
+  let s2 = new MyStringClass("def")
+  let s3 = new MyStringClass("abc")
+  let s4 = new MyStringClass("abcd")
+  do test "cepoiwelk" (s1.Length = 3)
+  do test "cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringClass) (s2:MyStringClass) = 
+    test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v))
+    test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v))
+    test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v))
+    test "cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v))
+    test "cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v))
+    test "cepoiwelk6" ((s1 <> s2) = (s1.v <> s2.v))
+    Printf.printf "hash s1 = %d\n" (hash(s1))
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v))
+    test "cepoiwelk7" (hash(s1) = hash(s1.v))
+    test "cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIComparableOnRecordTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringClass = { cache: int; v: string  }
+    with 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v 
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) 
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringClass).v ) = 0
+      end 
+      member x.Length = x.cache
+      static member Create(s:string) = { cache=s.Length; v=s }
+    end
+
+
+  let s1 = MyStringClass.Create("abc")
+  let s2 = MyStringClass.Create("def")
+  let s3 = MyStringClass.Create("abc")
+  let s4 = MyStringClass.Create("abcd")
+  do test "recd-cepoiwelk" (s1.Length = 3)
+  do test "recd-cepoiwelk" (s2.Length = 3)
+  let testc s1 s2 = 
+    test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v))
+    test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v))
+    test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v))
+    test "recd-cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v))
+    test "recd-cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v))
+    test "recd-cepoiwelk6" ((s1 <> s2) = (s1.v <> s2.v))
+    Printf.printf "hash s1 = %d\n" (hash(s1))
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v))
+    test "recd-cepoiwelk7" (hash(s1) = hash(s1.v))
+    test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIComparableOnUnionTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringClass = A of int * string | B of int * string
+    with 
+      member x.Value = match x with A(_,s) | B(_,s) -> s 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.Value (y :?> MyStringClass).Value
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.Value)
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = x.Value = (y :?> MyStringClass).Value
+      end 
+      member x.Length = match x with A(n,_) | B(n,_) -> n
+      static member Create(s:string) = A(s.Length,s)
+    end
+
+
+  let s1 = MyStringClass.Create("abc")
+  let s2 = MyStringClass.Create("def")
+  let s3 = MyStringClass.Create("abc")
+  let s4 = MyStringClass.Create("abcd")
+  do test "union-cepoiwelk" (s1.Length = 3)
+  do test "union-cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringClass) (s2:MyStringClass) = 
+    test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value))
+    test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value))
+    test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value))
+    test "union-cepoiwelk4" ((s1 <= s2) = (s1.Value <= s2.Value))
+    test "union-cepoiwelk5" ((s1 >= s2) = (s1.Value >= s2.Value))
+    test "union-cepoiwelk6" ((s1 <> s2) = (s1.Value <> s2.Value))
+    Printf.printf "hash s1 = %d\n" (hash(s1))
+    Printf.printf "hash s1.Value = %d\n" (hash(s1.Value))
+    test "union-cepoiwelk7" (hash(s1) = hash(s1.Value))
+    test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+//---------------------------------------------------------------------
+// Test we can define an attribute
+
+
+type DontPressThisButtonAttribute = 
+  class 
+    inherit System.Attribute
+    val v: string 
+    member x.Message = x.v
+    new(s:string) = { inherit System.Attribute(); v=s }
+  end
+
+// BUG:
+type [<DontPressThisButton("Please don't press this again")>] button = Buttpon
+let [<DontPressThisButton("Please don't press this again")>] button () = 1
+
+
+//---------------------------------------------------------------------
+// Test we can use base calls
+
+
+open System.Windows.Forms
+
+type MyCanvas2 = 
+  class 
+    inherit Form 
+    override x.OnPaint(args) =  Printf.printf "OnPaint\n"; base.OnPaint(args)
+
+    new() = { inherit Form(); }
+  end
+
+let form2 = new MyCanvas2()
+
+
+//---------------------------------------------------------------------
+// Test we can inherit from the Event<'a> type to define our listeners
+
+let (|>) x f = f x
+
+(*
+type MyEventListeners<'a>  =
+  class
+    inherit Event<'a> 
+
+    val mutable listeners2: (Handler<'a>) list 
+
+    member l.Fire(x : 'a) = 
+      let arg = new SimpleEventArgs<_>(x) 
+      l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) 
+
+    new() = 
+      { inherit Event<'a>(); 
+        listeners2 = [] }
+
+  end
+
+*)
+
+(*
+type MyCanvas2 = 
+  class 
+    inherit Form
+    member x.Redraw : Event<PaintEventArgs>
+    new: unit -> MyCanvas2
+  end
+*)
+
+(*
+type MyCanvas2 = 
+  class 
+    inherit Form
+    val redrawListeners: MyEventListeners<PaintEventArgs>
+    member x.Redraw = x.redrawListeners
+    override x.OnPaint(args) = x.redrawListeners.Fire(args)
+
+    new() = { inherit Form(); redrawListeners= new MyEventListeners<PaintEventArgs>() }
+  end
+*)
+
+(*
+class MyCanvas2() =
+  let l = MyEventListeners<PaintEventArgs>() 
+  object
+    inherit Form()
+    member x.Redraw = l
+    override x.OnPaint(args) = l.Fire(args)
+  end
+
+class MyCanvas2 =
+  let l = MyEventListeners<PaintEventArgs>() 
+  object
+    inherit Form
+    member x.Redraw = l
+    override x.OnPaint(args) = l.Fire(args)
+  end
+*)
+
+(*
+let form = new MyCanvas2()
+// form.Paint.Add(...)
+// form.add_Paint(...)
+form.Redraw.AddHandler(new Handler(fun _ args -> Printf.printf "OnRedraw\n"))
+form.Redraw.Add(fun args -> Printf.printf "OnRedraw\n")
+
+
+form.Activate()
+Application.Run(form)
+*)
+
+//x.add_Redraw
+
+//---------------------------------------------------------------------
+// Test we can define an exception
+
+type MyException =
+  class 
+    inherit System.Exception
+    val v: string 
+    member x.Message = x.v
+    new(s:string) = { inherit System.Exception(); v=s }
+  end
+
+let _ = try raise(new MyException("help!")) with :? MyException as me -> Printf.printf "message = %s\n" me.Message
+
+//---------------------------------------------------------------------
+// Test we can define and subscribe to an interface
+
+(*
+type IMyInterface =
+  interface
+    abstract MyMethod: string -> int
+  end
+*)
+
+// type IMyStructuralConstraint = < MyMethod: string -> int >
+// 'a :> < MyMethod: string -> int >
+// 'a :> IMyStructuralConstraint
+// 'a : IMyStructuralConstraint
+
+
+//---------------------------------------------------------------------
+// Test we can define and subscribe to a generic interface
+
+    
+//---------------------------------------------------------------------
+// Test we can define a struct
+
+
+(*
+type MyStruct =
+  struct
+    val x: int
+    val y: int
+  end
+*)
+
+
+//---------------------------------------------------------------------
+// Test we can define a generic struct
+
+//---------------------------------------------------------------------
+// Test we can define a class with no fields
+
+type NoFieldClass = 
+  class 
+    new() = { inherit System.Object() }
+  end
+
+//---------------------------------------------------------------------
+// Test we can implement more than one interface on a class
+
+module MultiInterfaceTest = begin
+  type PrivateInterfaceA1 = interface abstract M1 : unit -> unit end
+  type PrivateInterfaceA2 = interface abstract M2 : unit -> unit end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1 with 
+        member x.M1() = ()
+      end
+      interface PrivateInterfaceA2 with 
+        member x.M2() = ()
+      end
+   end
+end
+
+module MultiInterfaceTestNameConflict = begin
+  type PrivateInterfaceA1 = interface abstract M : unit -> unit end
+  type PrivateInterfaceA2 = interface abstract M : unit -> unit end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1 with 
+        member x.M() = ()
+      end
+      interface PrivateInterfaceA2 with 
+        member x.M() = ()
+      end
+   end
+end
+
+
+module GenericMultiInterfaceTestNameConflict = begin
+  type PrivateInterfaceA1<'a> = interface abstract M : 'a -> 'a end
+  type PrivateInterfaceA2<'a> = interface abstract M : 'a -> 'a end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1<string> with 
+        member x.M(y) = y
+      end
+      interface PrivateInterfaceA2<int> with 
+        member x.M(y) = y
+      end
+   end
+end
+
+
+module DeepInterfaceInheritance = begin
+  type InterfaceA1 = interface abstract M1 : int -> int end
+  type InterfaceA2 = interface inherit InterfaceA1 abstract M2 : int -> int end
+  type InterfaceA3 = interface inherit InterfaceA1  inherit InterfaceA2 abstract M3 : int -> int end
+
+  type C1 = 
+    class 
+      interface InterfaceA2 with 
+        member x.M1(y) = y 
+        member x.M2(y) = y + y 
+      end
+      new() = { inherit Object(); }
+   end
+  type C2 = 
+    class 
+      interface InterfaceA3 with 
+        member x.M1(y) = y
+        member x.M2(y) = y + y
+        member x.M3(y) = y + y + y
+      end
+      new() = { inherit Object(); }
+   end
+  type C3 = 
+    class 
+      interface InterfaceA2 with 
+        member x.M1(y) = y
+        member x.M2(y) = y + y
+      end
+      interface InterfaceA3 with 
+        member x.M3(y) = y + y + y
+      end
+      new() = { inherit Object(); }
+   end
+
+  do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(4) = 8)
+   
+  do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2(4) = 8)
+  do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(4) = 12)
+  do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(4) = 4)
+  do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2(4) = 8)
+   
+  do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2(4) = 8)
+  do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(4) = 12)
+  do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(4) = 4)
+  do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2(4) = 8)
+   
+end
+
+module DeepGenericInterfaceInheritance = begin
+  type InterfaceA1<'a> = interface abstract M1 : 'a -> 'a end
+  type InterfaceA2<'b> = interface inherit InterfaceA1<'b list> abstract M2 : 'b * 'b list -> 'b list end
+  type InterfaceA3 = interface inherit InterfaceA2<string>  abstract M3 : string list -> string list end
+
+  type C1 = 
+    class 
+      interface InterfaceA2<int> with 
+        member this.M1(y) = 1::y 
+        member this.M2(x,y) = x::y
+      end
+      new() = { inherit Object(); }
+   end
+  type C2 = 
+    class 
+      interface InterfaceA3 with 
+        member this.M1(y) = "a" :: y
+        member this.M2(x,y) = x :: y
+        member this.M3(y) = "a" :: "b" :: "c" :: y
+      end
+      new() = { inherit Object(); }
+   end
+  type C3 = 
+    class 
+      interface InterfaceA2<string> with 
+        member this.M1(y) = "a" :: y
+        member this.M2(x,y) = x :: y
+      end
+      interface InterfaceA3 with 
+        member x.M3(y) = "a" :: "b" :: "c" :: y
+      end
+      new() = { inherit Object(); }
+   end
+
+  test "fewopvrej1" (((new C1()) :> InterfaceA1<int list>).M1([1]) = [1;1])
+  test "fewopvrej2" (((new C1()) :> InterfaceA2<int>).M2(3,[1]) = [3;1])
+   
+  test "fewopvrej3" (((new C2()) :> InterfaceA1<string list>).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej4" (((new C2()) :> InterfaceA2<string>).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej4" (((new C2()) :> InterfaceA2<string>).M2("a",["hi"]) = ["a";"hi"])
+  test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"])
+  test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej7" (((new C2()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"])
+   
+  test "fewopvrej8" (((new C3()) :> InterfaceA1<string list>).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej8" (((new C3()) :> InterfaceA2<string>).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej9" (((new C3()) :> InterfaceA2<string>).M2("a",["hi"]) = ["a";"hi"])
+  test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"])
+  test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"])
+  test "fewopvrej12" (((new C3()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"])
+   
+end
+
+
+module PointTest =  begin
+
+
+  type Point =
+   class
+     new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } 
+     val x_init : int
+     val mutable x : int
+     member p.X = p.x
+     member p.Offset = p.x - p.x_init
+     member p.Move d1 d2 = p.x <- p.x + d1 + d2
+     static member TwoArgs d1 d2 = d1 + d2
+     static member TwoPatternArgs [d1] [d2] = d1 + d2
+     static member ThreeArgs d1 d2 d3 = d1 + d2 + d3
+     static member ThreePatternArgs [d1] [d2] [d3] = d1 + d2 + d3
+     member p.InstanceTwoArgs d1 d2 = p.x + d1 + d2
+     member p.InstanceTwoPatternArgs [d1] [d2] = p.x +  d1 + d2
+     member p.InstanceThreeArgs d1 d2 d3 = p.x +  d1 + d2 + d3
+     member p.InstanceThreePatternArgs [d1] [d2] [d3] = p.x + d1 + d2 + d3
+   end
+
+  type Point_with_no_inherits_clause =
+    class
+     new x_init = { x_init = x_init; x = x_init } 
+     val x_init : int
+     val mutable x : int
+     member p.X = p.x
+     member p.Offset = p.x - p.x_init
+     member p.Move d1 d2 = p.x <- p.x + d1 + d2
+    end
+
+  
+  let p = (new Point_with_no_inherits_clause(3)) 
+  let f = p.Move 4 
+  do test "wdfjcdwkj1" (p.X = 3)
+  do f 4
+  do test "wdfjcdwkj2" (p.X = 11)
+  do f 1
+  do test "wdfjcdwkj3" (p.X = 16)
+  do test "wdfjcdwkj4" (Point.TwoArgs 1 2 = 3)
+  do test "wdfjcdwkj5" (Point.TwoPatternArgs [1] [2] = 3)
+  do test "wdfjcdwkj6" (Point.ThreeArgs 1 2 3 = 6)
+  do test "wdfjcdwkj7" (Point.ThreePatternArgs [1] [2] [3] = 6)
+  let p2 = (new Point(16)) 
+  do test "wdfjcdwkj4" (p2.InstanceTwoArgs 1 2 = 16 + 3)
+  do test "wdfjcdwkj5" (p2.InstanceTwoPatternArgs [1] [2] = 16 + 3)
+  do test "wdfjcdwkj6" (p2.InstanceThreeArgs 1 2 3 = 16 + 6)
+  do test "wdfjcdwkj7" (p2.InstanceThreePatternArgs [1] [2] [3] = 16 + 6)
+
+end
+
+
+//---------------------------------------------------------------------
+// Test we can implement a debug view
+
+
+open System.Diagnostics
+
+
+type 
+  [<DebuggerTypeProxy(typeof<MyIntListDebugView>) >]
+   MyIntList = MyNil | MyCons of int * MyIntList
+
+and MyIntListDebugView =
+   class 
+     val v: MyIntList
+     new(x) = { v = x }     
+     [<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)>] 
+     member x.Items = 
+        let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) 
+        let len = length x.v 0 
+        let items = Array.zeroCreate len 
+        let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b 
+        go 0 x.v;
+        items
+   end
+
+
+//---------------------------------------------------------------------
+// Pattern matching on objects
+
+module PatternMatchTests = begin
+    type P = 
+      class 
+        val x1: int; 
+        val x2: string; 
+        new(a,b) = {x1=a; x2=b } 
+      end
+    let p = new P(3,"34")
+end
+
+
+//---------------------------------------------------------------------
+// 'then' on construction
+
+module ThenDoTest = begin
+    let res = ref 2
+    type P = 
+      class 
+        val x1: int; val x2: string; 
+        new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 
+      end
+
+    do ignore(new P(3,"5"))
+    do test "ewqonce2" (!res = 3)
+
+end
+
+//---------------------------------------------------------------------
+// 'then' on construction recursive reference
+
+module ThenDoTest2 = begin
+    let res = ref 2
+    type P = 
+      class 
+        val x1: int; val x2: string; 
+        new(a,b) as x = 
+           { x1= !res; 
+             x2=(test "ewqonce3" (!res = 2); b) } 
+           then 
+              test "ewqonce4" (!res = 2);
+              res := !res + 1; 
+              test "ewqonce5" (!res = 3);
+              test "ewqonce6" (x.x1 = 2) 
+      end
+
+    do ignore(new P(3,"5"))
+    do test "ewqonce7" (!res = 3)
+
+end
+
+module GenericInterfaceTest = begin
+
+    type Foo<'a> =
+      interface 
+          abstract fun1 : 'a -> 'a
+          abstract fun2 : int -> int
+      end
+
+
+    type Bar<'b> =
+      class 
+          val store : 'b
+          interface Foo<'b> with
+            member self.fun1(x) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+
+    type Bar2<'b> =
+      class 
+          val store : 'b
+          interface Foo<'b> with
+            member self.fun1(x:'b) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+    type Bar3<'b> =
+      class 
+          val store : int
+          interface Foo<'b> with
+            member self.fun1(x) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+end
+
+
+//---------------------------------------------------------------------
+//
+  
+
+
+module Inventory = begin
+
+    type item = A | B
+    type image = A | B
+
+    type ItemDetails = 
+      { ItemIndex: item;
+        InventoryImage: image;
+        Name : string }
+
+    type IInventory = interface
+     abstract Contains : item -> bool
+     abstract Remove : item -> unit
+     abstract GetDetails : item -> ItemDetails  
+     abstract Add : ItemDetails -> unit  
+     abstract GetTuple : unit -> (item * image * string) list 
+     end
+
+    module List = 
+        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+        let rec assoc x l = 
+            match l with 
+            | [] -> indexNotFound()
+            | ((h,r)::t) -> if x = h then r else assoc x t
+        let rec remove_assoc x l = 
+            match l with 
+            | [] -> []
+            | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t
+
+
+
+    type Inventory = class
+      val inv : ItemDetails list ref
+      new() = { inv = ref [] }
+      interface IInventory with
+       member this.Contains i = try (List.assoc i (List.map (fun itd -> (itd.ItemIndex, true)) !this.inv)) with :? System.Collections.Generic.KeyNotFoundException -> false
+       member this.Remove i = this.inv := List.map snd (List.remove_assoc i (List.map (fun itd -> (itd.ItemIndex, itd)) !this.inv))
+       member this.GetDetails i = List.assoc i (List.map (fun itd -> (itd.ItemIndex, itd)) !this.inv)
+       member this.Add itd = if ((this :> IInventory).Contains (itd.ItemIndex) = false) then this.inv := itd :: !this.inv
+       member this.GetTuple() =
+          List.map (fun itd -> (itd.ItemIndex,itd.InventoryImage,itd.Name)) !this.inv
+      end
+    end
+
+end
+
+//---------------------------------------------------------------------
+// Another interface test
+
+module SamplerTest = begin
+
+    type Sampler<'a,'b> = 
+      interface
+        abstract Sample : 'a -> unit 
+        abstract GetStatistic : unit -> 'b
+      end
+      
+(*
+    let NewAverage(toFloat) = 
+      let count = ref 0
+      let total = ref 0.0 
+      { new Sampler<_,float>
+          member self.Sample(x) = incr count; total := !total + toFloat x
+          member self.GetStatistic() = !total / float(!count) }
+
+*)
+    let NewAverage(toFloat) = 
+      let count = ref 0
+      let total = ref 0.0 
+      { new Sampler<_,float> with
+          member __.Sample(x) = incr count; total := !total + toFloat x
+          member __.GetStatistic() = !total / float(!count) }
+
+    type Average<'a> = 
+      class
+        val mutable total : float
+        val mutable count : int
+        val toFloat : 'a -> float
+        new(toFloat) = {total = 0.0; count =0; toFloat = toFloat }
+        interface Sampler< 'a,float > with
+          member this.Sample(x) = this.count <- this.count + 1; this.total <- this.total + this.toFloat x
+          member this.GetStatistic() = this.total / float(this.count)
+        end
+      end
+
+end
+
+
+//---------------------------------------------------------------------
+// This simple case of forward-reference revealed a bug
+
+type callconv = AA
+  with 
+        member x.IsInstance         = x.ThisConv 
+        member x.ThisConv           = 1
+  end 
+
+// Likewise
+
+module OverloadZeroOneTestSoohyoung = begin
+
+    type Point =
+      class
+        val mutable mx: int
+        
+        new () = { mx = 0 }
+        new (ix) = { mx = ix }
+      end
+
+end
+
+//---------------------------------------------------------------------
+// Bad error message case 
+
+
+module Ralf = begin 
+ 
+  type Matrix = M  | N
+
+  [<AbstractClass>]
+  type Distribution = 
+      class 
+        new () = { }
+
+        abstract member NumberOfDimensions : unit -> int
+        abstract member Sample: int -> System.Random -> Matrix
+        abstract member Density: Matrix -> float
+        abstract member CloneConstant: unit -> Distribution
+        abstract member Clone: unit -> Distribution
+        abstract member AbsoluteDifference: Distribution -> float
+
+      end
+
+  type Gaussian1D =
+      class 
+            inherit Distribution
+            val PrecisionMean : float
+            val Precision : float
+            new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 }
+            override x.NumberOfDimensions() = 1
+            override x.Density point = 1.0 
+            override x.AbsoluteDifference distribution = 0.0
+            override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution
+            override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution
+            override x.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions)
+      end
+
+end
+
+//---------------------------------------------------------------------
+// A random bunch of overloaded operator tests
+
+module MultipleOverloadedOperatorTests = begin
+
+    let f1 (x:DateTime) (y:TimeSpan) : DateTime = x - y
+    let g1 (x:DateTime) (y:DateTime) : TimeSpan = x - y
+    // Return type is also sufficient:
+    let f2 (x:DateTime) y : DateTime = x - y
+    let g2 (x:DateTime) y : TimeSpan = x - y
+    // Just argument types are also sufficient:
+    let f3 (x:DateTime) (y:TimeSpan)  = x - y
+    let g3 (x:DateTime) (y:DateTime)  = x - y
+end
+
+
+//---------------------------------------------------------------------
+// A random bunch of overloaded operator tests
+
+module OverloadedOperatorTests = begin
+
+
+    let x = []
+    do printf "len = %d\n" x.Length
+    let c = ("abc").[2]
+
+    let arr = [| 1 |]
+    do printf "len = %d\n" x.Length
+    let elem = arr.[0]
+    let _ = arr.[0] <- 3
+
+    let SCAL = new System.Collections.ArrayList()
+    let _ = SCAL.Add(3)
+    let _ = SCAL.[0]
+    let _ = SCAL.[0] <- box 4
+
+    let SCGL = new System.Collections.Generic.List<int>()
+    let _ = SCGL.Add(3)
+    let _ = SCGL.[0]
+    let _ = SCGL.[0] <- 3
+
+    let f (x: 'a) = 
+      let SCGL = new System.Collections.Generic.List<'a>() 
+      let _ = SCGL.Add(x) 
+      let _ = SCGL.[0] 
+      let _ = SCGL.[0] <- x 
+      ()
+
+    // check we have generalized 
+    do f 1
+    do f "3"
+
+    let SCGD = new System.Collections.Generic.Dictionary<string,float>()
+    let _ = SCGD.Add("hello",3.0)
+    let _ = SCGD.["hello"]
+
+    let g (k: 'a) (v:'b)= 
+      let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() 
+      let _ = SCGD.Add(k,v)
+      let _ = SCGD.[k]
+      let _ = SCGD.[k] <- v
+      ()
+
+
+
+    // check we have generalized 
+    do g 1 "3"
+    do g "3" 1
+    do g "3" "1"
+    do g 1 1
+
+    let h (v:'b)= 
+      let arr = [| v;v;v |] 
+      let elem = arr.[0] 
+      let _ = arr.[0] <- v 
+      ()
+
+
+    // check we have generalized 
+    do h 1
+    do h "3"
+
+end
+
+module PropertyOverrideTests = begin
+
+    [<AbstractClass>]
+    type A = class
+      abstract S1 :  float with set
+      abstract S2 : string-> float with set
+      abstract S3 : string * string -> float with set
+      abstract G1 :  float with get
+      abstract G2 : string-> float with get
+      abstract G3 : string * string -> float with get
+    end
+     
+    type IA = interface
+      abstract S1 :  float with set
+      abstract S2 : string-> float with set
+      abstract S3 : string * string -> float with set
+      abstract G1 :  float with get
+      abstract G2 : string-> float with get
+      abstract G3 : string * string -> float with get
+    end
+     
+
+
+    type CTest = 
+      class
+        inherit A
+        override x.S1 with  set v = () 
+        override x.S2 with  set s v = () 
+        override x.S3 with  set (s1,s2) v = () 
+        override x.G1 with  get () = 1.0
+        override x.G2 with  get (s:string) = 2.0
+        override x.G3 with  get (s1,s2) = 3.0
+        interface IA with 
+          override x.S1 with  set v = () 
+          override x.S2 with  set s v = () 
+          override x.S3 with  set (s1,s2) v = () 
+          override x.G1 with  get () = 1.0
+          override x.G2 with  get (s:string) = 2.0
+          override x.G3 with  get (s1,s2) = 3.0
+        end
+
+      end
+
+end
+
+module FieldsInClassesDontContributeToRecordFieldInference = begin
+
+  type container = class
+      val capacity : float
+      new(cap) = { capacity = cap } 
+  end
+
+  type cargo = class
+      val capacity : float  // (Error does not appear when the name is changed to capacity1)
+      new(cap) = { capacity = cap }
+  end
+
+  let total_capacity cl = List.fold(fun sum (z:container) -> z.capacity + sum) 0.0 cl
+
+  let cap = total_capacity [ new container(100.0); new container(50.0)]
+
+end
+
+module LucianRecords1 = begin
+  type MyRecord1 = {a:int; x:int}
+  type MyRecord2 = {a:int; y:string}
+  let f (m:MyRecord1) : MyRecord1 = {m with a=3} 
+  let g (m:MyRecord2) : MyRecord2 = {m with a=3} 
+  let h (m:MyRecord1) = m.a
+
+  type Tab = {a:string; b:string}
+  type Tac = {a:string; c:string}
+  type Test = Cab of Tab | Cac of Tac
+  let a = Cab( {a="hello"; b="world";} )
+
+end
+
+module DefaultConstructorConstraints = begin
+
+  let f1 () : 'a when 'a : (new : unit -> 'a) = new 'a()
+  let x1 = (f1() : obj)
+  let x2 = (f1() : int)
+  let x3 = (f1() : DateTime)
+  let x4 = (f1() : System.Windows.Forms.Form)
+  let f2 () = f1()
+  let y1 = (f2() : obj)
+  let y2 = (f2() : int)
+  let y3 = (f2() : DateTime)
+  let y4 = (f2() : System.Windows.Forms.Form)
+  
+end
+
+module AccessBugOnFSharpList = begin
+
+    open System.Web
+    open System.Web.Hosting
+    open System.Data.SqlClient
+
+    type TopicPathProvider = 
+                     class
+                                     inherit VirtualPathProvider 
+                                     
+                                     new() = { inherit VirtualPathProvider(); }                          
+                                                      
+                                     member x.TopicExists topic =
+                                                      let cmd = new SqlCommand()
+                                                      cmd.CommandText <- "SELECT COUNT(*) FROM Topic WHERE Topic.Name = @name";
+                                                      (cmd.Parameters.Add("@name", System.Data.SqlDbType.NVarChar, 255)).Value <- topic;
+                                                      unbox(cmd.ExecuteScalar()) > 0
+                                     
+                                     override x.FileExists((virtualPath: string)) =
+                                                      let relPath = VirtualPathUtility.ToAppRelative(virtualPath)
+                                                      if relPath.StartsWith("~/topic") then
+                                                                       x.TopicExists (relPath.Substring(7))
+                                                      else
+                                                                       x.Previous.FileExists(virtualPath)
+                                                                       
+                                     override x.DirectoryExists((virtualDir: string)) =
+                                                      let relPath = VirtualPathUtility.ToAppRelative(virtualDir)
+                                                      relPath.StartsWith("~/topic") || x.DirectoryExists(virtualDir)
+                     end
+
+    let AppInitialize()  = 
+                     let provider = new TopicPathProvider()
+                     HostingEnvironment.RegisterVirtualPathProvider(provider)
+
+end
+
+
+
+module TestConstrainedItemProperty = begin
+    type Foo = 
+        interface 
+          abstract Item : int -> string with get
+        end
+
+    let f1 (x : #Foo) = x.[1]
+
+    let f2 (x : #Foo) = x.[1]
+end
+
+
+module ExplicitSyntacCtor = begin
+
+    type C =
+       class
+           val xx : int
+           new(x,y) = 
+               if y then 
+                  { xx = x}
+               else
+                  { xx = x+x}
+           new(x) = 
+               let six = 3 + 3
+               { xx = x}
+           static member Create() = 
+               let six = 3 + 3
+               new C(3+3)
+           new() = 
+               let six = 3 + 3
+               new C(3+3)
+           new(a,b,c) = new C(a+b+c)
+           new(a,b,c,d) = 
+               new C(a+b+c+d)
+               then
+                 printf "hello"
+       end
+
+
+
+    type C1(x) =
+       class
+           let xx = x + x
+           let f x = x + x
+           let mutable state = x + x + xx
+
+           do printf "hello\n"
+           
+           static member Create() = 
+               let six = 3 + 3
+               new C(3+3)
+
+           new(x,y) = new C1(x+y)
+                      
+           member self.Increment = state <- state + 1
+           member self.Once= xx 
+           member self.Twice = xx + xx
+       end
+
+    let createRemoteAppDomain<'T> (d: AppDomain) = 
+        unbox<'T>(d.CreateInstanceAndUnwrap(typeof<'T>.Assembly.FullName,typeof<'T>.FullName))
+
+
+    // This is the simple version
+    let rec maxList x =
+      match x with 
+      | [] -> failwith "no elements"
+      | [h] -> h
+      | h::t -> max h (maxList t)
+
+    // This is how you use an accumulating parameter
+
+    let rec maxListAcc acc x =
+      match x with 
+      | [] -> acc
+      | [h] -> max acc h
+      | h::t -> maxListAcc (max acc h) t
+
+    let maxList2 x =
+      match x with 
+      | [] -> failwith "no elements"
+      | h::t -> maxListAcc h t
+
+    type ICool =
+        interface
+            abstract tst : unit->bool 
+        end    
+        
+    [<AbstractClass>]
+    type Cool() = 
+        class
+            abstract tst : unit -> bool
+            interface ICool with
+                member this.tst () = true
+            end  
+        end
+        
+    type beCool() =
+        class 
+            inherit Cool()
+            override this.tst() = false
+            interface ICool with
+                member this.tst () = (this : beCool).tst()
+            end  
+        end
+
+end
+
+module Ex11 = 
+    type MutableVector2D(dx:float,dy:float) =
+        let mutable currDX = dx
+        let mutable currDY = dy
+
+        member this.DX with get() = currDX and set(v) = currDX <- v
+        member this.DY with get() = currDY and set(v) = currDY <- v
+
+        member v.Length 
+             with get () = sqrt(currDX*currDX+currDY*currDY)
+             and  set len = 
+                 let theta = v.Angle
+                 currDX <- cos(theta)*len;
+                 currDY <- sin(theta)*len
+
+        member c.Angle 
+             with get () = atan2 currDY currDX
+             and  set theta = 
+                 let len = c.Length
+                 currDX <- cos(theta)*len;
+                 currDY <- sin(theta)*len
+
+    let v1 = MutableVector2D(3.0,4.0)
+    v1.Length
+    v1.Angle
+    v1.Angle <- System.Math.PI / 6.0 // = 30 degrees
+    v1.Length
+    v1.DX, v1.DY
+
+    v1.DY / v1.Length
+
+    type Vector2D(dx: float, dy: float) =
+        let length = sqrt(dx * dx + dy * dy)
+        member v.DX = dx
+        member v.DY = dy
+        member v.Length = length
+        member v.Scale(k)    = Vector2D(k*dx,   k*dy)
+        member v.ShiftX(dx') = Vector2D(dx=dx+dx', dy=dy)
+        member v.ShiftY(dy') = Vector2D(dx=dx,     dy=dy+dy')
+        static member Zero = Vector2D(dx=0.0, dy=0.0)
+        static member OneX = Vector2D(dx=1.0, dy=0.0)
+        static member OneY = Vector2D(dx=0.0, dy=1.0)
+
+    type SparseVector  (items: seq<int * float>)= 
+        let elems = new System.Collections.Generic.SortedDictionary<_,_>() 
+        do items |> Seq.iter (fun (k,v) -> elems.Add(k,v))
+        member t.Item 
+            with get i = 
+                if elems.ContainsKey(i) then elems.[i]
+                else 0.0
+
+    type UnitVector2D(dx,dy) = 
+          let tolerance = 0.000001
+          let len = sqrt(dx * dx + dy * dy)
+          do if abs(len - 1.0) >= tolerance then failwith "not a unit vector";
+          member v.DX = dx
+          member v.DY = dy
+
+module Ex11b = 
+    type Vector2D (dx:float,dy:float) =
+        member x.DX = dx
+        member x.DY = dy
+        static member (+) ((v1:Vector2D),(v2:Vector2D)) = 
+            Vector2D(v1.DX + v2.DX, v1.DY + v2.DY)
+        static member (-) ((v1:Vector2D),(v2:Vector2D)) =
+            Vector2D(v1.DX - v2.DX, v1.DY - v2.DY)
+
+    let v1 = Vector2D(3.0,4.0)
+    v1
+    v1 + v1
+    v1 - v1
+
+
+module Ex11c = 
+    type Vector2D (dx:float,dy:float) =
+        member x.DX = dx
+        member x.DY = dy
+        static member Create(? dx: float, ?dy:float) = 
+            let dx = match dx with None -> 0.0 | Some v -> v
+            let dy = match dy with None -> 0.0 | Some v -> v
+            Vector2D(dx,dy)
+
+module T1 = 
+    type Vector2D(dx: float, dy: float) =
+        let len = sqrt(dx * dx + dy * dy)
+        member v.DX = dx
+        member v.DY = dy
+        member v.Length = len
+
+    Vector2D(1.0,1.0) = Vector2D(1.0,1.0)
+
+module Ex5 = 
+    open System.Drawing
+    type Label(?text,?font) =
+        let text = match text with None -> "" | Some v -> v
+        let font = match font with None -> new Font(FontFamily.GenericSansSerif,12.0f) | Some v -> v
+        member x.Text = text
+        member x.Font = font
+
+    Label(text="Hello World")
+    Label(font=new Font(FontFamily.GenericMonospace,36.0f),
+          text="Hello World")
+
+module Ex6 = 
+    type IShape =
+        abstract Contains : Point -> bool
+        abstract BoundingBox : Rectangle
+
+    and Vector = 
+        { DX:float; DY:float }
+        member v.Length = sqrt(v.DX*v.DX+v.DY*v.DY)
+        static member (+) (v1:Vector,v2:Vector) = { DX=v1.DX+v2.DX; DY=v1.DY+v2.DY }
+        static member (-) (v1:Vector,v2:Vector) = { DX=v1.DX-v2.DX; DY=v1.DY-v2.DY }
+          
+    and Point = 
+        { X:float; Y:float }
+
+        static member (-) (p1:Point,p2:Point) = { DX=p1.X-p2.X; DY=p1.Y-p2.Y }
+
+        static member (-) (p:Point,v:Vector) = { X=p.X-v.DX; Y=p.Y-v.DY }
+          
+        static member (+) (p:Point,v:Vector) = { X=p.X+v.DX; Y=p.Y+v.DY }
+          
+    and Rectangle = 
+        {X1:float; Y1:float; X2:float; Y2:float}
+        static member Create(p1:Point,p2:Point) =
+            {X1=p1.X; Y1=p1.Y; X2=p2.X; Y2=p2.Y }
+
+
+    let circle(center:Point,radius:float) = 
+        { new IShape with
+              member x.Contains(p:Point) = (p - center).Length < radius
+              member x.BoundingBox =
+                  let diag = {DX=radius;DY=radius}
+                  Rectangle.Create(center-diag,center+diag) }
+    
+
+    let square(center:Point,side:float) = 
+        { new IShape with
+              member x.Contains(p:Point) = 
+                  let v = (p - center) 
+                  abs(v.DX) < side/2.0 && abs(v.DY) < side/2.0
+              member x.BoundingBox =
+                  let diag = {DX=side/2.0;DY=side/2.0}
+                  Rectangle.Create(center-diag,center+diag) }
+
+    type MovingSquare() = 
+        let mutable center = {X=0.0;Y=0.0}
+        let mutable side = 1.0
+        member sq.Center with get() = center and set(v) = center <- v
+        member sq.SideLength with get() = side and set(v) = side <- v
+        interface IShape with
+              member x.Contains(p:Point) = 
+                  let v = (p - center) 
+                  abs(v.DX) < side/2.0 && abs(v.DY) < side/2.0
+              member x.BoundingBox =
+                  let diag = {DX=side/2.0;DY=side/2.0}
+                  Rectangle.Create(center-diag,center+diag) 
+    
+module Ex7 = 
+    open System.Drawing
+    type IShape =
+        abstract Contains : Point -> bool
+        abstract BoundingBox : Rectangle
+
+    let circle(center:Point,radius:int) = 
+        { new IShape with
+              member x.Contains(p:Point) = 
+                  let dx = float32 (p.X - center.X)
+                  let dy = float32 (p.Y - center.Y)
+                  sqrt(dx*dx+dy*dy) < float32 radius
+              member x.BoundingBox =
+                  Rectangle(center.X-radius,center.Y-radius,2*radius,2*radius) }
+    
+
+    let bigCircle = circle(Point(0,0), 100)
+
+    bigCircle.BoundingBox    
+    bigCircle.Contains(Point(70,70))
+    bigCircle.Contains(Point(71,71))
+        
+    let square(center:Point,side:int) = 
+        { new IShape with
+              member x.Contains(p:Point) = 
+                  let dx = p.X - center.X
+                  let dy = p.Y - center.Y
+                  abs(dx) < side/2 && abs(dy) < side/2
+              member x.BoundingBox =
+                  Rectangle(center.X-side,center.Y-side,side*2,side*2) }
+
+    type MovingSquare() = 
+        let mutable center = Point(x=0,y=0)
+        let mutable side = 10
+        member sq.Center with get() = center and set(v) = center <- v
+        member sq.SideLength with get() = side and set(v) = side <- v
+        interface IShape with
+              member x.Contains(p:Point) = 
+                  let dx = p.X - center.X
+                  let dy = p.Y - center.Y
+                  abs(dx) < side/2 && abs(dy) < side/2
+              member x.BoundingBox =
+                  Rectangle(center.X-side,center.Y-side,side*2,side*2) 
+
+
+module MoreOptionalArgTests = 
+    open System
+    open System.Text
+    open System.Collections.Generic
+
+
+    let defaultArg x y = match x with None -> y | Some v -> v
+
+    type T() = 
+        static member OneNormalTwoOptional (arg1, ?arg2, ?arg3) = 
+            let arg2 = defaultArg arg2 3
+            let arg3 = defaultArg arg3 10
+            arg1 + arg2 + arg3
+
+        static member TwoOptional (?arg1, ?arg2) = 
+            let arg1 = defaultArg arg1 3
+            let arg2 = defaultArg arg2 10
+            arg1 + arg2 
+
+
+    test "optional arg test" (16 = T.OneNormalTwoOptional(3))
+    test "optional arg test" (15 = T.OneNormalTwoOptional(3,2))
+    test "optional arg test" (16 = T.OneNormalTwoOptional(arg1=3))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(arg1=3,arg2=1))
+    test "optional arg test" (13 = T.OneNormalTwoOptional(arg2=3,arg1=0))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(arg2=3,arg1=0,arg3=11))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(0,3,11))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(0,3,arg3=11))
+
+    test "optional arg test" (16 = T.OneNormalTwoOptional(arg1=3))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(arg1=3,?arg2=Some(1)))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(arg2=3,arg1=0,arg3=11))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(?arg2=Some(3),arg1=0,arg3=11))
+    test "optional arg test" (14 = T.OneNormalTwoOptional(0,3,?arg3=Some(11)))
+
+
+    test "optional arg test" (13 = T.TwoOptional())
+    test "optional arg test" (12 = T.TwoOptional(2))
+    test "optional arg test" (11 = T.TwoOptional(arg1=1))
+    test "optional arg test" (13 = T.TwoOptional(arg1=3))
+    test "optional arg test" (14 = T.TwoOptional(arg1=3,arg2=11))
+    test "optional arg test" (14 = T.TwoOptional(3,11))
+    test "optional arg test" (14 = T.TwoOptional(3,arg2=11))
+    do printfn "Done MoreOptionalArgTests"
+
+
+module MoreRandomTests = 
+    do printfn "MoreRandomTests"
+
+    let memoize f = 
+        let cache = ref Map.empty
+        fun x -> 
+            match (!cache).TryFind(x) with
+            | Some res -> res
+            | None -> 
+                 let res = f x
+                 cache := (!cache).Add(x,res)
+                 res
+
+
+
+    // Save computed results by using an internal dictionary.
+    // Note that memoize is inferred to have type
+    //   ('a -> 'b) -> ('a -> 'b)
+    let memoize2 f = 
+        let cache = System.Collections.Generic.Dictionary<_, _>()
+        fun x -> 
+            let ok,res = cache.TryGetValue(x)
+            if ok then res 
+            else let res = f x
+                 cache.[x] <- res
+                 res
+
+
+module MemberTakingOptionalArgumentUsedAsFirstClassFunctionValue = 
+    type C() = 
+        static member M(?a:int) = a
+
+    let pf = (C.M, C.M)
+
+    fst pf ()
+    snd pf ()
+
+module StillMoreRandomTests = 
+    do printfn "StillMoreRandomTests"
+
+    type Var = string
+
+    type ArithExpr = 
+      | Sum of ArithExpr * ArithExpr
+      | Mul of ArithExpr * ArithExpr
+      | Neg of ArithExpr
+      | Var of Var
+      | Let of Var * ArithExpr * ArithExpr
+
+
+    type Circuit = 
+      | And of Circuit * Circuit
+      | Not of Circuit
+      | True
+      | Var of Var
+      | Exists of Var * Circuit
+
+    let False = Not(True)
+    let Forall(v,p) = Not(Exists(v,Not(p)))
+    let Or (p1,p2) = Not(And(Not(p1),Not(p2)))
+
+    // nice infix notation, also deerived equality and implication
+    let (&&&) p1 p2 = And(p1,p2)
+    let (|||) p1 p2 = Or(p1,p2)
+    let (===) p1 p2 = (p1 &&& p2) ||| (Not(p1) &&& Not(p2))
+    let (==>) p1 p2 = (Not(p1) ||| p2) 
+    let Cond p1 p2 p3 = (p1 ==> p2) &&& (Not(p1) ==> p3)
+
+
+    type Env = Map<Var,bool>
+
+    let rec eval (env:Env) p = 
+        match p with
+        | And(p1,p2) -> eval env p1 && eval env p2
+        | Not(p1) -> not (eval env p1)
+        | Var(v) ->  env.[v]
+        | True ->  true
+        | Exists(v,p) ->  
+            // Evaluate p with the variable 'true'
+            eval (env.Add(v,true))  p ||
+            // Evaluate p with the variable 'false'
+            eval (env.Add(v,false)) p
+
+
+    eval Map.empty True
+
+    let varCount = ref 0 
+    let freshVariable() = incr varCount; (!varCount).ToString()
+
+    let hide1 g = 
+        let stateVar = freshVariable()
+        let state = Var(stateVar)
+        Exists(stateVar, g(state))
+
+    //let circuit inp out = hide1 (fun state -> state === (state &&& inp) &&& out === state)
+    //let circuit2 inp out = hide1 (fun inner -> circuit inp inner &&& circuit inner out)
+
+    /// Helper to generate a variable and generate a circuit that
+    /// uses the variable.
+    let forall1 g = 
+        let v1 = freshVariable()
+        Forall(v1,g(Var(v1)))
+
+    /// Same for three variables
+    let forall3 g = forall1 (fun v1 -> forall1 (fun v2 -> forall1 (fun v3 -> g v1 v2 v3)))
+
+    // This is the circuit: it chooses the output based on the input
+    // The circuit looks at input 0, and chooses the ouput to be input 1 or input 2
+    let circuit (inp : Circuit[]) out = 
+        Cond inp.[0] (out === inp.[1]) (out === inp.[2])
+
+    /// This is a specification of one property of the circuit. It says 
+    /// that if input 1 is the same as input 2 then the result is
+    /// this input, regardless of the values of the inputs 
+    let check1 = forall3 (fun inp0 inp1 out -> circuit [| inp0;inp1;inp1 |] out ==> (out === inp1))
+
+    eval Map.empty check1 // 'true' - the property holds
+
+    eval Map.empty (Cond True False False) = false
+    eval Map.empty (Cond True False True) = false
+    eval Map.empty (Cond True True False) = true
+    eval Map.empty (Cond False True False) = false
+    eval Map.empty (Cond False False True) = true
+    eval Map.empty (False === True) = false
+    eval Map.empty (False === False) = true
+    eval Map.empty (True === True) = true
+    eval Map.empty (True === False) = false
+    eval Map.empty (Forall("a",Var("a") === Var("a"))) = true
+    eval Map.empty (Forall("a",Var("a") ==> Var("a"))) = true
+    eval Map.empty (Forall("a",Not(Var("a") === Var("a")))) = false
+    eval Map.empty (Forall("a",Forall("b",Var("a") === Var("b")))) = true
+
+module MemoizeSample = 
+    do printfn "MemoizeSample"
+
+    type Function<'a,'b> = interface
+        abstract Item : 'a -> 'b with get
+        abstract Clear : unit -> unit
+    end
+    
+    let memoize f = 
+        let lookasideTable = new System.Collections.Generic.Dictionary<_,_>()
+        { new Function<_,_> with 
+              member t.Item
+                 with get(n) = 
+                     if lookasideTable.ContainsKey(n) then lookasideTable.[n]
+                     else let res = f n
+                          lookasideTable.Add(n,res)
+                          res 
+              member t.Clear() = 
+                  lookasideTable.Clear() }
+                  
+
+    let rec fibFast = memoize (fun n -> if n <= 2 then 1 else fibFast.[n-1] + fibFast.[n-2])
+
+    fibFast.[3]
+    fibFast.[30]
+    fibFast.Clear()
+    
+(*
+module NameLookupServiceExample = 
+    do printfn "NameLookupServiceExample"
+    type NameLookupService = 
+        abstract Contains : string -> bool
+        abstract ClosestPrefixMatch : string -> string 
+
+    let simpleNameLookup (words: string list) = 
+        let wordTable = Set.ofSeq(words)
+        let score (w1:string) (w2:string) = 
+            let lim = (min w1.Length w2.Length) 
+            let rec loop i acc =  
+                if i >= lim then acc 
+                else loop (i+1) (Char.code w1.[i] - Char.code w2.[i] + acc)
+            loop 0 0
+            
+        { new NameLookupService with
+            member t.Contains(w) = wordTable.Contains(w)
+            member t.ClosestPrefixMatch(w) = 
+                if wordTable.Contains(w) then w
+                else
+                    printfn "w = %s" w
+                    let above = 
+                        match wordTable.GetNextElement(w) with
+                        | Some w2 when w2.StartsWith(w) -> Some w2
+                        | _ -> None
+                    let below = 
+                        match wordTable.GetPreviousElement(w) with
+                        | Some w2 when w2.StartsWith(w) -> Some w2
+                        | _ -> None
+                    printfn "above = %A, below = %A" above below
+                    match above, below with
+                    | Some w1,Some w2 -> if score w w1 > score w w2 then w2 else w1
+                    | Some res,None 
+                    | None,Some res -> res
+                    | None,None -> failwith "no match!" }
+
+
+    let capitalLookup = simpleNameLookup ["London";"Paris";"Warsaw";"Tokyo"]
+
+    capitalLookup.Contains "Paris"
+    capitalLookup.ClosestPrefixMatch "Wars"
+
+*)
+
+
+module ConstraintsInMembers = begin
+
+    type IDuplex = 
+      interface 
+      end
+
+    type IServer = 
+      interface 
+      end
+      
+    let bind (a:#IServer) = "2"
+
+    let Bind1(v:#IDuplex) : string = bind v 
+
+    type C() = 
+        member x.Bind1(v:#IDuplex) : string = bind v 
+        member x.Bind2(v:#IDuplex) : string = bind v 
+end
+
+module DelegateByrefCreation = begin
+    type D = delegate of int byref -> int
+    type D2 = delegate of int byref * int byref -> int
+
+    let createImmediateDelegate = new D(fun b -> b)
+    let createImmediateDelegate2 = new D2(fun b1 b2 -> b1  + b2)
+end
+
+module InterfaceCastingTests = begin
+
+    type IBar = 
+        interface
+        end
+
+    type IFoo = 
+        interface
+        end
+
+    type C() = 
+        class
+        end
+
+    type D() = 
+        class
+           interface IFoo 
+        end
+        
+    type Struct = 
+        struct
+           val x : int
+        end
+        
+    type R = 
+        { c : int }
+        
+    type U = 
+        A | B
+        
+        
+    let checkPatternTestInterfaceToInterface(l:IBar list) =
+        match l with
+        | [:? IFoo] -> None
+        | _ -> None
+        
+    let checkPatternTestInterfaceToUnsealedClassImplicit(l:IBar list) =
+        match l with
+        | [:? C] -> None
+        | _ -> None
+        
+    let checkPatternTestInterfaceToUnsealedClassExplicit(l:IBar list) =
+        match l with
+        | [:? D] -> None
+        | _ -> None
+
+
+        
+    let checkTypeTestInterfaceToInterface(l:IBar ) =
+        (l :? IFoo)
+        
+    let checkTypeTestInterfaceToUnsealedClassImplicit(l:IBar) =
+        (l :? C)
+        
+    let checkTypeTestInterfaceToUnsealedClassExplicit(l:IBar) =
+        (l :? D)
+
+    let checkCoercionInterfaceToInterface(l:IBar ) =
+        (l :?> IFoo)
+        
+    let checkCoercionInterfaceToUnsealedClassImplicit(l:IBar) =
+        (l :?> C)
+        
+    let checkCoercionInterfaceToUnsealedClassExplicit(l:IBar) =
+        (l :?> D)
+
+    let checkDowncastInterfaceToInterface(l:IBar ) =
+        (downcast l : IFoo)
+        
+    let checkDowncastInterfaceToUnsealedClassImplicit(l:IBar) =
+        (downcast l : C)
+        
+    let checkDowncastInterfaceToUnsealedClassExplicit(l:IBar) =
+        (downcast l : D)
+
+end
+
+
+module MiscGenericOverrideTest = 
+   do printfn "MiscGenericOverrideTest"
+   type 'a Class2 = 
+      class
+        inherit obj 
+        new () = { inherit obj(); }
+        override this.ToString() = base.ToString() 
+      end
+
+module GlobalTickTock = 
+   //let x = 1
+   do printfn "GlobalTickTock"
+   type TickTock = Tick | Tock
+   type time = float
+   let private x = ref Tick
+   
+  // public module M =
+//      let x = 1
+      
+   //let (private ticked,public TickEvent) = Event.create<TickTock>()
+   //let internal oneTick() = 
+   //    (x := match !x with Tick -> Tock | Tock -> Tick); 
+    //   ticked(!x)
+
+
+module RecursiveInheritanceExampleFromTomas = 
+    type ISome = 
+      interface
+        abstract InterfaceMethod : int -> int
+      end
+    and Test = 
+      class
+        interface ISome with
+          member this.InterfaceMethod  (a) =
+            a + 5
+        end
+      end
+
+
+
+module DefaultImplementationsOfAbstractProperties = 
+    type A() = class
+      abstract Prop : int with set
+      abstract Prop : int with get
+      default x.Prop 
+        with get()  = printf "A::Prop.get"; 6
+        and  set(v) = printf "A::Prop.set(%d)" v
+    end    
+
+module StructDefinition = 
+    type ('h,'t) BUN =
+        struct
+            val head : 'h
+            val tail : 't
+            new(h,t) = {head = h; tail = t}
+        end
+     
+    let heap = Array.init 100 (fun i -> BUN(i,i))
+     
+    let _ = heap.[3]
+
+
+module StructKeywordAsConstraintTest = 
+
+    type Struct1<'a when 'a : struct> =
+        struct
+            val x : int
+        end
+
+    type Struct2<'a when 'a : not struct> =
+        struct
+            val x : int
+        end
+     
+    type Class1<'a when 'a : struct> =
+        class
+            val x : int
+        end
+     
+    type Class2<'a when 'a : not struct> =
+        class
+            val x : int
+        end
+        
+    type Class1b<'a when 'a : struct>(x:int) =
+        member self.X = x
+     
+    type Class2b<'a when 'a : not struct>(x:int) =
+        member self.X = x
+     
+     
+module StaticInitializerTest1 =
+
+    type C<'a>() = 
+        static let mutable v = 2 + 2
+        static do v <- 3
+        
+        member x.P = v
+        static member P2 = v+v
+
+    test "lwnohivw0" ((new C<int>()).P = 3)
+    test "lwnohivw1" ((new C<int>()).P = 3)
+    test "lwnohivw2" ((new C<string>()).P = 3)
+    test "lwnohivw3" ((C<int>.P2) = 6)
+    test "lwnohivw4" ((C<string>.P2) = 6)
+
+module StaticInitializerTest2 =
+
+    type C() = 
+        static let mutable v = 2 + 2
+        static do v <- 3
+        
+        member x.P = v
+        static member P2 = v+v
+
+    check "lwnohivq01" (new C()).P 3
+    check "lwnohivq12" (new C()).P 3
+    check "lwnohivq33" C.P2 6
+    check "lwnohivq44" C.P2 6
+        
+
+module StaticInitializerTest3 =
+
+    let mutable x = 2
+    do x <- 3
+    
+    type C() = 
+        static let mutable v = x + 1
+        static do v <- 3
+        
+        member x.P = v
+        static member P2 = v+x
+
+    check "lwnohivq05" (new C()).P 3
+    check "lwnohivq16" (new C()).P 3
+    check "lwnohivq37" C.P2 6
+    check "lwnohivq48" C.P2 6
+        
+
+module OkStructTest3 = begin
+    type OkStruct1 = 
+        struct
+            val x : list<OkStruct1>
+        end    
+end
+
+module FSharp_1_0_bug_1748_Problem_Calling_A_Base_Member_A = begin
+
+    type C<'a>(value) =
+        member x.BaseM() = printf "out %d" value
+
+    type D<'b>(value:int) =
+        inherit C<'b>(value) 
+
+        member x.M() = base.BaseM()
+
+end
+
+module FSharp_1_0_bug_1748_Problem_Calling_A_Base_Member_B = begin
+
+    type Exp<'c when 'c :> Exp<'c>> = abstract Print : unit -> unit
+
+    type PrintLit<'c when 'c :> Exp<'c>>(value) =
+        member x.Value = value
+        member x.BasePrint() = printf "out %d" x.Value
+        interface Exp<'c> with
+            member x.Print() = x.BasePrint()
+
+    type PrintAdd<'c when 'c :> Exp<'c>>(left:'c, right:'c) =
+        member x.Left = left
+        member x.Right = right
+        member x.BasePrint() = x.Left.Print(); printf "+"; x.Right.Print()
+        interface Exp<'c> with
+            member x.Print() = x.BasePrint()
+
+    type EvalExp<'c when 'c :> EvalExp<'c>> =
+        inherit Exp<'c>
+        abstract Eval : unit -> int
+
+    type EvalLit<'c when 'c :> EvalExp<'c>>(value:int) =
+        inherit PrintLit<'c>(value) 
+        member x.BaseEval() = x.Value
+        interface EvalExp<'c> with
+            //the base is not strictly necessary here, but used for clarity
+            member x.Print() = base.BasePrint()
+            member x.Eval() = x.BaseEval()
+
+    type EvalAdd<'c when 'c :> EvalExp<'c>>(left:'c, right:'c) =
+        inherit PrintAdd<'c>(left, right) 
+        member x.BaseEval() = x.Left.Eval() + x.Right.Eval()
+        interface EvalExp<'c> with
+            member x.Print() = base.BasePrint()
+            member x.Eval() = x.BaseEval()
+
+    type EvalExpFix = inherit EvalExp<EvalExpFix>
+
+    type EvalLitFix(value) =
+        inherit EvalLit<EvalExpFix>(value) 
+        interface EvalExpFix with
+            member x.Print() = base.BasePrint()
+            member x.Eval() = base.BaseEval()
+
+    type EvalAddFix(left:EvalExpFix, right:EvalExpFix) =
+        inherit EvalAdd<EvalExpFix>(left, right) 
+        interface EvalExpFix with
+            member x.Print() = base.BasePrint()
+            member x.Eval() = base.BaseEval()
+
+    let e1 = new EvalLitFix(2)
+    let e2 = new EvalLitFix(3)
+    let e3 = new EvalAddFix(e1, e2) :> EvalExpFix
+    do  e3.Print()
+        System.Console.Write(" = " + e3.Eval().ToString())
+end
+
+
+open System.Collections.Generic
+
+module Test1 = begin
+    type C() = class end
+
+    type ITest = interface
+                       abstract member Read : #C -> unit
+                     end
+
+    type Impl() = 
+        interface ITest  with
+            override this.Read (orgList : #C) = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest  with
+            override this.Read (orgList : #C) = printfn "done"
+        }
+end
+
+module Test2 = begin
+
+    type C<'a>() = class end
+
+    type ITest<'d> = interface
+                       abstract member Read : #C<'a> -> unit
+                     end
+
+    type Impl() = 
+        interface ITest <int> with
+            override this.Read (orgList : #C<'b>) = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest <int> with
+            override this.Read (orgList : #C<'b>) = printfn "done"
+        }
+
+end
+
+
+module Test3 = begin
+
+    type C<'a>() = class end
+
+    type ITest<'d> = interface
+                       abstract member Read<'b when 'b :> C<'d> > : 'd  -> unit 
+                     end
+
+    type Impl() = 
+        interface ITest <int> with
+            override this.Read<'c when 'c :> C<int> >  _ = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest <int> with
+            override this.Read<'c when 'c :> C<int> >  _ = printfn "done"
+        }
+
+end
+module Test4 = begin
+
+    type C<'a>() = class end
+
+    type ITest<'d> = interface
+                       abstract member Read<'b > : 'b  -> unit 
+                     end
+
+    type Impl() = 
+        interface ITest <int> with
+            override this.Read _ = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest <int> with
+            override this.Read _ = printfn "done"
+        }
+
+end
+
+module Test5 = begin
+
+    type ITest = interface
+                       abstract member Read<'b > : int  -> unit 
+                 end
+
+    type Impl() = 
+        interface ITest with
+            override this.Read _ = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest with
+            override this.Read _ = printfn "done"
+        }
+
+end
+
+module Test6 = begin
+
+
+    type ITest<'d> = interface
+                       abstract member Read : int -> unit
+                     end
+
+    type Impl<'e>() = 
+        interface ITest <'e> with
+            override this.Read (orgList : int) = printfn "done"
+        end
+
+    let impl<'e>() = 
+        { new ITest <'e> with
+            override this.Read (orgList : int) = printfn "done"
+        }
+
+end
+
+
+module Test7 = begin
+
+    type ITest<'d> = interface
+                       abstract member Read : 'd -> unit
+                     end
+
+    type Impl<'e>() = 
+        interface ITest <'e> with
+            override this.Read (orgList : 'e) = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest <'e> with
+            override this.Read (orgList : 'e) = printfn "done"
+        }
+
+end
+
+
+
+module Test8 = begin
+
+    type C<'a>() = class end
+
+    type ITest<'q> = interface
+                       abstract member Read : #C<'q> -> unit
+                     end
+
+    type Impl<'f>() = 
+        interface ITest <'f> with
+            override this.Read (orgList : #C<'f>) = printfn "done"
+        end
+
+    let impl() = 
+        { new ITest <'f> with
+            override this.Read (orgList : #C<'f>) = printfn "done"
+        }
+
+end
+
+
+// FSB 1112, Bug in definition of generic interface
+
+module Test9 = begin
+    open System.Collections.Generic
+
+    type ITest<'T> = interface
+                       abstract member Read : #IList<'T> -> unit
+                     end
+
+    type Impl<'t>() = 
+        interface ITest<'t>  with
+            override this.Read (orgList : #IList<'t>) = printfn "done"
+
+
+    let impl = {new ITest<'t> with
+                     override this.Read orgList = printfn "done"};
+                 
+end
+
+
+module InterfaceEndTokenTests_bugs_FSharp_1_0_1148_and_1431 = 
+    type IFoo = interface
+        abstract Meth3 : unit -> unit
+    end
+
+    type IBar = interface
+        abstract Meth3 : unit -> unit
+    end
+
+
+    type Foo() = class
+        interface IFoo with
+            member this.Meth3 () = ()
+    end
+
+    type Foo1x() = class
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+    end
+
+    type Foo1b() = 
+        class
+            interface IFoo with
+                member this.Meth3 () = ()
+        end
+
+    type Foo1c() = 
+        class
+            interface IFoo with
+                member this.Meth3 () = ()
+          end
+
+    type Foo1d() = 
+        class
+            interface IFoo with
+                member this.Meth3 () = ()
+                
+         // note the 'end' token doesn't have to align with 'class'
+           end
+
+    type Foo1e() = 
+        class
+            interface IFoo with
+                member this.Meth3 () = ()
+                
+         // note the 'end' token doesn't have to align with 'class'
+      end
+
+    type Foo2() = class
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+    end
+
+
+    type Foo3() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+
+    type Foo4() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+            
+
+    type Foo5() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+            
+    type Foo6() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        interface IBar with
+            member this.Meth3 () = ()
+            
+            
+    type Foo7() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        interface IBar with
+            member this.Meth3 () = ()
+        end
+        
+    type Foo7b() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+        interface IBar with
+            member this.Meth3 () = ()
+        end
+            
+    type Foo8() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+        end
+        interface IBar with
+            member this.Meth3 () = ()
+
+    type Foo9() = 
+        interface IFoo with
+            member this.Meth3 () = ()
+          end
+        interface IBar with
+            member this.Meth3 () = ()
+
+    type Foo10() = 
+        interface IFoo with
+                   member this.Meth3 () = ()
+              end
+          // Spec issue: interfaces and members can progressively indent if 'end' tokens included
+          interface IBar with
+                 member this.Meth3 () = ()
+       
+
+
+type node =
+ interface
+   abstract wombat :string
+ end
+type nodeB =
+ //member it.dummy = "dummy"
+ interface node with
+   member it.wombat = "B.wombat"
+
+
+module Check_Static_Let_Bindings_In_Structs = 
+    let r = ref 0 
+    
+    [<Struct>]
+    type S(x:int) = 
+        static let mutable v = 3
+        static do printfn "Initialize S"
+        static do v <- v + 1
+        //do printfn "hello"
+        //do incr r
+        member y.P = x
+        static member V = v
+        
+    do test "vr09jrweokm" (S.V = 3 || S.V = 4)
+    //do test "vr09jrweokm" (!r = 0)
+    let s3 = S(3)
+    let s4 = S(4)
+    do test "vr09jrweokm" (S.V = 4)
+    //do test "vr09jrweokm" (!r = 2)
+
+module UnitArgs = 
+    let f () = 
+       printfn "hello from f"
+       printfn "hello from f"
+       printfn "hello from f"
+       printfn "hello from f"
+       printfn "hello from f"
+       printfn "hello from f"
+       1+2
+
+    let f2 (c:unit) = 
+        printfn "hello  from f2";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        1+2
+
+    let f3 = fun () -> 
+        printfn "hello  from f3";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        1+2
+
+    let f4 = function () -> 
+                        printfn "hello  from f4";
+                        printfn "hello";
+                        printfn "hello";
+                        printfn "hello";
+                        printfn "hello";
+                        printfn "hello";
+                        printfn "hello";
+                        1+2
+
+    let f5 = (fun () -> 
+        printfn "hello  from f5";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        printfn "hello";
+        1+2)
+
+
+    type C(x:int) = 
+        static member M() = 
+           printfn "hello from C.M"
+           printfn "hello from C.M"
+           printfn "hello from C.M"
+           printfn "hello from C.M"
+           printfn "hello from C.M"
+           printfn "hello from C.M"
+           1+2
+
+        member x.M2() = 
+           printfn "hello from C.M2"
+           printfn "hello from C.M2"
+           printfn "hello from C.M2"
+           printfn "hello from C.M2"
+           printfn "hello from C.M2"
+           printfn "hello from C.M2"
+           1+2
+        member x.M3 = fun () ->
+           printfn "hello from C.M3"
+           printfn "hello from C.M3"
+           printfn "hello from C.M3"
+           printfn "hello from C.M3"
+           printfn "hello from C.M3"
+           printfn "hello from C.M3"
+           1+2
+        member x.M4 () ()  = 
+           printfn "hello from C.M4"
+           printfn "hello from C.M4"
+           printfn "hello from C.M4"
+           printfn "hello from C.M4"
+           printfn "hello from C.M4"
+           printfn "hello from C.M4"
+           1+2
+    f()
+    List.map f [();();()]
+    f2()
+    List.map f2 [();();()]
+    f2()
+    List.map f3 [();();()]
+    f3()
+    List.map f4 [();();()]
+    f4()
+    List.map f5 [();();()]
+    f5()
+    List.map C.M [();();()]
+    C.M()
+    let c = C(3)
+    c.M2()
+    List.map c.M2 [();();()]
+    c.M3()
+    List.map c.M3 [();();()]
+    c.M4() () 
+    List.map (c.M4 ()) [();();()]
+    
+//---------------------------------------------------------------------
+// Finish up
+
+
+
+
+module SingleArgumentFunctions =
+    type C() = 
+        let f0 () = 1
+        let f1 (x:int) = x
+        let f2 (x:int) = f1 x + f0()
+        let rec f3 (x:int) = 2
+        let f4 (x:int) = f3 x + f0()
+        let v = f4 5
+        let f5 (x:int) = f4 v + 6
+        let rec f6 (x:int) = if x = 0 then 6 else f6 (x-1)
+        let v2 = f6 5
+        let v3 = List.map f0 [(); ()]
+        let v4 = List.map f1 [1;2]
+        let v5 = List.map f3 [1;2]
+        member x.Result =     
+            List.sum v3 + List.sum v4 + List.sum v5  + v2 + v
+
+    let c = C()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09j" (c.Result = 18)
+
+module MultiArgumentFunctions =
+    type C() = 
+        let f1 (x1:int) x2 = x1 + x2
+        let v5 = f1 2 3
+        member x.Result =     
+            f1 3 4 + v5
+
+    let c = C()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09h" (c.Result = 12)
+
+
+
+module TupledMultiArgumentFunctions =
+    type C() = 
+        let f1 (x1:int,x2:int) (x3:int,x4:int) = x1 + x2 + x3 + x4
+        let v5 = f1 (2,3) (4,5)
+        member x.Result =     
+            f1 (6,7) (8,9) + v5
+
+    let c = C()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09g" (c.Result = 44)
+
+module FunctionInGenericClass =
+    type C<'a>() = 
+        let f1 (x1:int) = x1 + 3
+        let v5 = f1 3
+        member x.Result =     
+            f1 6  + v5
+
+    let c = C<int>()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09f" (c.Result = 15)
+
+module GenericFunctions =
+    type C() = 
+        let f1 x1 = x1
+        let f2 (x : 'a) : 'a when 'a :> System.IComparable = x
+        let v5 = f1 3
+        let v6 = f1 "hello"
+        let v7 = f2 1
+        let v8 = f2 "hello"
+        member x.Result =     
+            f1 6  + v5 + v6.Length
+
+    let c = C()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09d" (c.Result = 14)
+
+module GenericFunctionInGenericClass =
+    type C<'a>() = 
+        let f1 x1 = x1 
+        let rec f2 n x1 = if n = 0 then x1  else f2 (n-1) x1
+        let rec f3 n (x1:int) = if n = 0 then x1  else f2 (n-1) x1
+        let v5 = f1 3 + sizeof<'a>
+        let v6 = f1 "hello"
+        let v7 = f2 8 3 + sizeof<'a>
+        let v8 = f2 10 "hello"
+        let v9 = f3 8 3 + sizeof<'a>
+        member x.Result =     
+            f1 6  + v5 + v6.Length + v7 + v8.Length + f2 8 6 + f3 8 6
+        member x.Functions =     
+            (f1 : int -> int), (f1 : string -> string),
+            (f2 : int -> int -> int), (f2 : int -> string -> string),
+            // Non generic function in generic class used as a first class value
+            (f3 : int -> int -> int)
+
+    let c = C<int>()
+    printfn "c.Result = %d" c.Result
+    let c2 = C<System.DateTime>()
+    printfn "c2.Result = %d" c2.Result
+    test "vrewiorvw09s" (c.Result = 42)
+    test "vrewiorvw09a" (c2.Result = 50)
+
+module TailCallLoop =
+    type C<'a>() = 
+        let rec f x = if x = 0 then 1 else f (x  - 1)
+        let v5 = f 10000000
+        member x.Result =     
+            f 10000000 + v5
+
+    let c = C<int>()
+    printfn "c.Result = %d" c.Result
+    let c2 = C<System.DateTime>()
+    printfn "c2.Result = %d" c2.Result
+    test "vrewiorvw09o" (c.Result = 2)
+    test "vrewiorvw09i" (c2.Result = 2)
+
+module FunctionsAsLambdas =
+    type C() = 
+        let f0 = fun () -> 1
+        let f1 = fun (x:int) -> x
+        let f2 = fun (x:int) -> f1 x + f0()
+        let rec f3 = fun (x:int) -> 2
+        let f4 = fun (x:int) -> f3 x + f0()
+        let v = f4 5
+        let f5 = fun (x:int) -> f4 v + 6
+        let rec f6 = fun (x:int) -> if x = 0 then 6 else f6 (x-1)
+        let v2 = f6 5
+        let v3 = List.map f0 [(); ()]
+        let v4 = List.map f1 [1;2]
+        let v5 = List.map f3 [1;2]
+        let f6 = fun (x1:int) x2 -> x1 + x2
+        let v6 = f6 2 3
+        let f7 = fun (x1:int,x2:int) (x3:int,x4:int) -> x1 + x2 + x3 + x4
+        let v7 = f7 (2,3) (4,5)
+        let f8 = fun (x1:int,x2:int) () -> x1 + x2 
+        let v8 = f8 (2,3) ()
+        let f9 = fun () -> fun (x1:int,x2:int) -> x1 + x2 
+        let v9 = f9 () (2,3) 
+        let f10 = fun  x1 -> x1
+        let v10a = f10 3
+        let v10b = f10 "hello"
+        member x.Result =     
+            List.sum v3 + List.sum v4 + List.sum v5 + v2 + v + v6 + v7 + v8 + v9 + v10a + v10b.Length
+
+    let c = C()
+    printfn "c.Result = %d" c.Result
+    test "vrewiorvw09u" (c.Result = 55)
+
+
+
+module Pathological1 =
+    type C<'a>() = 
+        let mutable f1  = fun x1 -> x1 
+        let v5 = f1 3 + sizeof<'a>
+        member x.Result =     
+            f1 6  + v5 
+
+    let c = C<int>()
+    printfn "c.Result = %d" c.Result
+    let c2 = C<System.DateTime>()
+    printfn "c2.Result = %d" c2.Result
+    test "vrewiorvw09y" (c.Result = 13)
+    test "vrewiorvw09t" (c2.Result = 17)
+    
+
+
+module StaticSingleArgumentFunctions =
+    type C() = 
+        static let f0 () = 1
+        static let f1 (x:int) = x
+        static let f2 (x:int) = f1 x + f0()
+        static let rec f3 (x:int) = 2
+        static let f4 (x:int) = f3 x + f0()
+        static let v = f4 5
+        static let f5 (x:int) = f4 v + 6
+        static let rec f6 (x:int) = if x = 0 then 6 else f6 (x-1)
+        static let v2 = f6 5
+        static let v3 = List.map f0 [(); ()]
+        static let v4 = List.map f1 [1;2]
+        static let v5 = List.map f3 [1;2]
+        static member Result =     
+            List.sum v3 + List.sum v4 + List.sum v5  + v2 + v
+
+    printfn "c.Result = %d" C.Result
+    test "vrewiorvw09r" (C.Result = 18)
+
+module StaticMultiArgumentFunctions =
+    type C() = 
+        static let f1 (x1:int) x2 = x1 + x2
+        static let v5 = f1 2 3
+        static member Result =     
+            f1 3 4 + v5
+
+    printfn "c.Result = %d" C.Result
+    test "vrewiorvw09e" (C.Result = 12)
+
+module StaticTupledMultiArgumentFunctions =
+    type C() = 
+        static let f1 (x1:int,x2:int) (x3:int,x4:int) = x1 + x2 + x3 + x4
+        static let v5 = f1 (2,3) (4,5)
+        static member Result =     
+            f1 (6,7) (8,9) + v5
+
+    printfn "c.Result = %d" C.Result
+    test "vrewiorvw09w" (C.Result = 44)
+
+module StaticFunctionInGenericClass =
+    type C<'a>() = 
+        static let f1 (x1:int) = x1 + 3 + sizeof<'a>
+        static let v5 = f1 3
+        static member Result =     
+            f1 6  + v5
+
+    printfn "C<int>.Result = %d" (C<int>.Result)
+    printfn "C<System.DateTime>.Result = %d" (C<System.DateTime>.Result)
+    test "vrewiorvw09q" (C<int>.Result = 23)
+    test "vrewiorvw099" (C<System.DateTime>.Result = 31)
+
+module StaticGenericFunctions =
+    type C() = 
+        static let f1 x1 = x1
+        static let f2 (x : 'a) : 'a when 'a :> System.IComparable = x
+        static let v5 = f1 3
+        static let v6 = f1 "hello"
+        static let v7 = f2 1
+        static let v8 = f2 "hello"
+        static member Result =     
+            f1 6  + v5 + v6.Length
+
+    printfn "c.Result = %d" C.Result
+    test "vrewiorvw098" (C.Result = 14)
+
+module StaticGenericFunctionInGenericClass =
+    type C<'a>() = 
+        static let f1 x1 = x1 
+        static let rec f2 n x1 = if n = 0 then x1  else f2 (n-1) x1
+        static let rec f3 n (x1:int) = if n = 0 then x1  else f2 (n-1) x1
+        static let v5 = f1 3 + sizeof<'a>
+        static let v6 = f1 "hello"
+        static let v7 = f2 8 3 + sizeof<'a>
+        static let v8 = f2 10 "hello"
+        static let v9 = f3 8 3 + sizeof<'a>
+        static member Result =     
+            f1 6  + v5 + v6.Length + v7 + v8.Length + f2 8 6 + f3 8 6
+        static member Functions =     
+            (f1 : int -> int), (f1 : string -> string),
+            (f2 : int -> int -> int), (f2 : int -> string -> string),
+            // Non generic function in generic class used as a first class value
+            (f3 : int -> int -> int)
+
+    printfn "C<int>.Result = %d" (C<int>.Result)
+    printfn "C<System.DateTime>.Result = %d" (C<System.DateTime>.Result)
+    test "vrewiorvw097" (C<int>.Result = 42)
+    test "vrewiorvw096" (C<System.DateTime>.Result = 50)
+
+module StaticTailCallLoop =
+    type C<'a>() = 
+        static let rec f x = if x = 0 then sizeof<'a> else f (x  - 1)
+        static let v5 = f 10000000
+        static member Result =     
+            f 10000000 + v5
+
+    printfn "C<int>.Result = %d" (C<int>.Result)
+    printfn "C<System.DateTime>.Result = %d" (C<System.DateTime>.Result)
+    test "vrewiorvw095" (C<int>.Result = 8)
+    test "vrewiorvw094" (C<System.DateTime>.Result = 16)
+
+module StaticFunctionsAsLambdas =
+    type C() = 
+        static let f0 = fun () -> 1
+        static let f1 = fun (x:int) -> x
+        static let f2 = fun (x:int) -> f1 x + f0()
+        static let rec f3 = fun (x:int) -> 2
+        static let f4 = fun (x:int) -> f3 x + f0()
+        static let v = f4 5
+        static let f5 = fun (x:int) -> f4 v + 6
+        static let rec f6 = fun (x:int) -> if x = 0 then 6 else f6 (x-1)
+        static let v2 = f6 5
+        static let v3 = List.map f0 [(); ()]
+        static let v4 = List.map f1 [1;2]
+        static let v5 = List.map f3 [1;2]
+        static let f6 = fun (x1:int) x2 -> x1 + x2
+        static let v6 = f6 2 3
+        static let f7 = fun (x1:int,x2:int) (x3:int,x4:int) -> x1 + x2 + x3 + x4
+        static let v7 = f7 (2,3) (4,5)
+        static let f8 = fun (x1:int,x2:int) () -> x1 + x2 
+        static let v8 = f8 (2,3) ()
+        static let f9 = fun () -> fun (x1:int,x2:int) -> x1 + x2 
+        static let v9 = f9 () (2,3) 
+        static let f10 = fun  x1 -> x1
+        static let v10a = f10 3
+        static let v10b = f10 "hello"
+        static member Result =     
+            List.sum v3 + List.sum v4 + List.sum v5 + v2 + v + v6 + v7 + v8 + v9 + v10a + v10b.Length
+
+    printfn "c.Result = %d" C.Result
+    test "vrewiorvw093" (C.Result = 55)
+
+
+
+module StaticPathological1 =
+    type C<'a>() = 
+        static let mutable f1  = fun x1 -> x1 
+        static let v5 = f1 3 + sizeof<'a>
+        static member Result =     
+            f1 6  + v5 
+
+    printfn "C<int>.Result = %d" (C<int>.Result)
+    printfn "C<System.DateTime>.Result = %d" (C<System.DateTime>.Result)
+    test "vrewiorvw092" (C<int>.Result = 13)
+    test "vrewiorvw091" (C<System.DateTime>.Result = 17)
+
+module ImplicitOperatorTests =
+    type Foo(x : int) = 
+        member this.Val = x
+        
+        static member (-->) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val)
+        static member (-->) ((src : Foo), (target : int)) = new Foo(src.Val + target)
+
+        static member (!!) (src : Foo) = new Foo(-src.Val)
+            
+        static member (+) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val)
+        static member (+) ((src : Foo), (target : int)) = new Foo(src.Val + target)
+        
+    let x = Foo(3) --> 4  
+    let y = Foo(3) --> Foo(5)  
+    let z = (-->) (Foo(3)) (Foo(5))
+    let f1 : Foo -> Foo = (-->) (Foo(3)) 
+    let _  = f1  (Foo(5)) 
+    let f2 : int -> Foo = (-->) (Foo(3)) 
+    let _  = f2  3
+    let x2 = Foo(3) + 4  
+    let y2 = Foo(3) + Foo(4)  
+    let z2 = !!Foo(3) 
+
+module SlicingTests =
+    let s1 = "abcdef"
+
+    check "ce0cew9j1" s1.[2..] "cdef"
+    check "ce0cew9j2" s1.[2..2] "c"
+    check "ce0cew9j3" s1.[5..5] "f"
+    check "ce0cew9j4" s1.[0..0] "a"
+    check "ce0cew9j5" s1.[2..1] ""
+    check "ce0cew9j6" s1.[0.. -1] ""
+    check "ce0cew9j7" s1.[2..3] "cd"
+    check "ce0cew9j8" s1.[2..4] "cde"
+    check "ce0cew9j9" s1.[2..5] "cdef"
+
+
+    let a1 = [| for c in "abcdef" -> c |]
+
+    check "ce0cew9jq" a1.[2..] [| for c in "cdef" -> c |]
+
+    a1.[3..] <- [| for c in "DEF" -> c |]
+
+    check "ce0cew9jw" a1.[2..] [| for c in "cDEF" -> c |]
+
+    let m1 = Array2D.init 6 7 (fun i j -> i + 2*j)
+
+    check "ce0cew9je" m1 (Array2D.init 6 7 (fun i j -> i + 2*j))
+    for i = 1 to 5 do 
+        for j = 1 to 6 do 
+            check "ce0cew9jr" m1.[1..i,1..j] (Array2D.init i j (fun i j -> (i+1) + 2*(j+1)))
+
+
+    m1.[1..3,1..4] <- Array2D.zeroCreate 3 4
+
+    for i = 1 to 5 do 
+        for j = 1 to 6 do 
+            check "ce0cew9js" m1.[1..i,1..j] (Array2D.init i j (fun i j -> if (i+1) >= 1 && (i+1) <= 3 && (j+1) >= 1 && (j+1) <= 4 then 0 else (i+1) + 2*(j+1)))
+
+
+
+    type System.Int32 with 
+        member x.GetSlice(idx1,idx2) = 
+            let idx1 = defaultArg idx1 0
+            let idx2 = defaultArg idx2 17
+            x % (17 * idx1 + idx2)
+        member x.GetSlice(idx1,idx2,idx3,idx4) = 
+            let idx1 = defaultArg idx1 0
+            let idx2 = defaultArg idx2 17
+            let idx3 = defaultArg idx3 17
+            let idx4 = defaultArg idx4 17
+            x % (17 * idx1 + idx2 + idx3 + idx4)
+
+    (3).[3..4]
+    (3).[3..]
+    (3).[..4]
+
+    (3).[3..4,4..5]
+    (3).[3..,6..7]
+    (3).[..4,8..9]
+    (3).[..4,*]
+    (3).[*,*]
+
+module Bug_FSharp_1_0_3246 =
+    type r1 =  
+        { x : int }
+        static member Empty = { x = 3 } 
+       
+    and r2 = 
+        { x : int }
+        static member Empty = { x = 3 }
+
+    let r1 : r1 = r1.Empty
+    let r2 : r2 = r2.Empty
+
+module First_class_use_of_non_overloaded_method_should_detuple_1 =
+
+    let count = ref 0
+    type A() = 
+        let f (x,y) = incr count; printfn "hello"; incr count
+        member this.M0 () = f (1,2)
+        member this.M1 (x:int) = f (x,x)
+        member this.M2 (x:int,y:float) = f (x,y)
+
+        static member SM0 () = incr count; printfn "hello"; incr count
+        static member SM1 (x:int) = incr count; printfn "hello"; incr count
+        static member SM2 (x:int,y:float) = incr count; printfn "hello"; incr count
+
+
+    [| (1,3.0) |] |> Array.iter (fun (x,y) -> A.SM2 (x,y))
+    [| (1,3.0) |] |> Array.iter (fun d -> A.SM2 d)
+    [| (1,3.0) |] |> Array.iter A.SM2 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> A.SM1 d)
+    [| 1;2;3 |] |> Array.iter A.SM1 
+
+    [| ();();() |] |> Array.iter (fun d -> A.SM0())
+    [| ();();() |] |> Array.iter A.SM0 
+
+    let a = A()
+    [| (1,3.0) |] |> Array.iter (fun (x,y) -> a.M2 (x,y))
+    [| (1,3.0) |] |> Array.iter (fun d -> a.M2 d)
+    [| (1,3.0) |] |> Array.iter a.M2 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> a.M1 d)
+    [| 1;2;3 |] |> Array.iter a.M1 
+
+    [| ();();() |] |> Array.iter (fun d -> a.M0())
+    [| ();();() |] |> Array.iter a.M0 
+
+module First_class_use_of_non_overloaded_method_should_detuple_2 =
+
+    let count = ref 0
+    type A<'a>() = 
+        let f (x,y) = incr count; printfn "hello"; incr count
+        member this.M0 () = f (1,2)
+        member this.M1 (x:'a) = f (x,x)
+        member this.M2 (x:'a,y:'a) = f (x,y)
+
+        static member SM0 () = incr count; printfn "hello"; incr count
+        static member SM1 (x:'a) = incr count; printfn "hello"; incr count
+        static member SM2 (x:'a,y:'a) = incr count; printfn "hello"; incr count
+
+
+    [| (1,3) |] |> Array.iter (fun (x,y) -> A.SM2 (x,y))
+    [| (1,3) |] |> Array.iter (fun d -> A.SM2 d)
+    [| (1,3) |] |> Array.iter A.SM2 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> A.SM1 d)
+    [| 1;2;3 |] |> Array.iter A.SM1 
+
+    [| ();();() |] |> Array.iter (fun d -> A.SM1 d)
+    [| ();();() |] |> Array.iter A.SM1 
+
+    [| ();();() |] |> Array.iter (fun d -> A<int>.SM0())
+    [| ();();() |] |> Array.iter A<int>.SM0 
+
+    let a = A<int>()
+    [| (1,3) |] |> Array.iter (fun (x,y) -> a.M2 (x,y))
+    [| (1,3) |] |> Array.iter (fun d -> a.M2 d)
+    [| (1,3) |] |> Array.iter a.M2 
+
+    let au = A<unit>()
+    [| ();();() |] |> Array.iter (fun d -> au.M1 d)
+    [| ();();() |] |> Array.iter au.M1 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> a.M1 d)
+    [| 1;2;3 |] |> Array.iter a.M1 
+
+    [| ();();() |] |> Array.iter (fun d -> a.M0())
+    [| ();();() |] |> Array.iter a.M0 
+
+
+module First_class_use_of_non_overloaded_method_should_detuple_3 =
+
+    let count = ref 0
+    type A() = 
+        let f (x,y) = ()
+        member this.M0 () = f (1,2)
+        member this.M1 (x:'a) = f (x,x)
+        member this.M2 (x:'a,y:'a) = f (x,y)
+
+        static member SM0 () = ()
+        static member SM1 (x:'a) = ()
+        static member SM2 (x:'a,y:'a) = ()
+
+
+    [| (1,3) |] |> Array.iter (fun (x,y) -> A.SM2 (x,y))
+    [| (1,3) |] |> Array.iter (fun d -> A.SM2 d)
+    [| (1,3) |] |> Array.iter A.SM2 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> A.SM1 d)
+    [| 1;2;3 |] |> Array.iter A.SM1 
+
+    [| ();();() |] |> Array.iter (fun d -> A.SM1 d)
+    [| ();();() |] |> Array.iter A.SM1 
+
+    [| ();();() |] |> Array.iter (fun d -> A.SM0())
+    [| ();();() |] |> Array.iter A.SM0 
+
+    let a = A()
+    [| (1,3) |] |> Array.iter (fun (x,y) -> a.M2 (x,y))
+    [| (1,3) |] |> Array.iter (fun d -> a.M2 d)
+    [| (1,3) |] |> Array.iter a.M2 
+
+    [| ();();() |] |> Array.iter (fun d -> a.M1 d)
+    [| ();();() |] |> Array.iter a.M1 
+
+    [| 1;2;3 |] |> Array.iter (fun d -> a.M1 d)
+    [| 1;2;3 |] |> Array.iter a.M1 
+
+    [| ();();() |] |> Array.iter (fun d -> a.M0())
+    [| ();();() |] |> Array.iter a.M0 
+
+module Bug_1438 = 
+
+    type Tuples =
+        static member Sel1 t = match t with | (a,_) -> a
+
+        static member Sel2 t = match t with | (_,b) -> b
+
+    let unzip (xs : seq<'a * 'b>) : seq<'a> * seq<'b> =
+        ( xs |> Seq.map (fun x -> Tuples.Sel1 x),
+          xs |> Seq.map (fun x -> Tuples.Sel2 x) )
+
+    let unzip2 (xs : seq<'a * 'b>) : seq<'a> * seq<'b> =
+        ( xs |> Seq.map Tuples.Sel1,
+          xs |> Seq.map Tuples.Sel2 )
+
+module InheritingFromPartiallyImplementedTypes = 
+    module PositiveTests = 
+
+
+
+        module Test2 = 
+            type ITest =
+                abstract member Meth1: string -> string
+
+            type ITestSub =
+                inherit ITest
+                abstract member Meth2: int -> int
+
+            type OkComplete () =
+                interface ITest with
+                    override this.Meth1 x = x + "1"
+                interface ITestSub with
+                    override this.Meth2 x = x + 1
+
+            module Throwaway =
+                let foo = OkComplete()
+
+
+        module Test4 = 
+            [<AbstractClass>]
+            type wire<'a>() =
+                abstract Send   : 'a -> unit
+
+            let createWire() =
+              {new wire<'a>() with 
+                  member obj.Send(x:'a)   = ()
+              }
+
+            type CreateWire<'a>() =
+              inherit wire<'a>() 
+              override obj.Send(x)   = ()
+
+
+        module Test5 = 
+            type ITest =
+                abstract member Meth1: int -> int
+
+            type ITestSub =
+                inherit ITest
+                abstract member Meth1: int -> int
+
+            [<AbstractClass>]
+            type Partial() =
+                abstract Meth1 : int -> int
+                interface ITest with
+                    override this.Meth1 x = this.Meth1 x
+                interface ITestSub with
+                    override this.Meth1 x = this.Meth1 x
+
+            type OkComplete () =
+                inherit Partial()
+                override this.Meth1 x = x
+
+            module Throwaway =
+                let foo = OkComplete()
+
+    module MorePositiveTests =
+
+
+          type IEnumerator<'T> = 
+              abstract Current : 'T
+          
+          [<AbstractClass>]
+          type MapEnumerator<'T> (x:'T) =
+              interface IEnumerator<'T> with
+                  member this.Current = x
+              
+          type MapE<'U>() =
+              inherit MapEnumerator<'U>(failwith "")
+
+
+    module MorePositiveTEsts2 = 
+        open System.Reflection
+
+        type IDelegateEvent<'del when 'del :> System.Delegate > =
+            abstract AddHandler: handler:'del -> unit
+
+        type IEvent<'del,'args when 'del :> System.Delegate > =
+            inherit IDelegateEvent<'del>
+
+        let f<'Delegate,'Args when 'Delegate :> System.Delegate >() = 
+                { new IEvent<'Delegate,'Args> with 
+                    member x.AddHandler(d) = () }
+
+
+    module MorePositiveTEsts3 = 
+
+        type IEvent<'del,'a> = 
+            abstract Add : ('a -> unit) -> unit
+            
+        [<AbstractClass>]
+        type wire<'a>() =
+            abstract Send   : 'a -> unit
+            abstract Listen : ('a -> unit) -> unit
+            interface IEvent<Handler<'a>,'a> with
+                member x.Add(handler) = x.Listen(handler)
+
+        let createWire() =
+            let listeners = ref [] in
+            {new wire<'a>() with   // Expect an error here - Add2 no implemented
+              member obj.Send(x)   = List.iter (fun f -> f x) !listeners   
+              member obj.Listen(f) = listeners := f :: !listeners
+            }
+
+module MoreConstraintTEsts = 
+    type C1<'T when 'T :> System.Array>() =
+        member x.P = 1
+
+    type C2<'T when 'T :> System.Delegate>() =
+        member x.P = 1
+
+    type C3<'T when 'T :> System.Enum>() =
+        member x.P = 1
+
+
+    type C4<'T when 'T :> System.ValueType>() =
+        member x.P = 1
+
+    type C5<'T when 'T :> System.IComparable and 'T :> System.IComparable>() =
+        member x.P = 1
+
+
+    type C6<'T when 'T :> System.Array and 'T :> System.Array>() =
+        member x.P = 1
+
+    type C7<'T when 'T :> System.Array and 'T :> System.IComparable>() =
+        member x.P = 1
+// Can't constraint to multiple class types anymore
+// It is ok to constrain to multiple interfaces though.
+    type C8<'T when 'T :> System.Array and 'T :> System.IComparable and 'T :> System.ICloneable>() =
+        member x.P = 1
+
+    let f x = new C8<_>()
+
+module FinalizerTEst = 
+    type S<'a>(x:'a) =   class [<DefaultValue(false)>] val mutable x : 'a override x.Finalize() = printfn "hello" end
+
+    let x = S(3) |> box
+
+module CheckBoxingSemantics = 
+    module StructTest1 = 
+
+        type IX = abstract ToStringMember : unit -> string
+
+
+        [<Struct>]
+        type Counter = 
+          interface IX with 
+            member x.ToStringMember() = x.value <- x.value + 1; x.value.ToString()
+           
+          [<DefaultValue>]
+          val mutable value : int 
+
+        let mutable x = new Counter();
+
+        let f (x:'a when 'a :> IX) = 
+            [ x.ToStringMember(); x.ToStringMember(); x.ToStringMember() ]
+
+        check "vklnvwer0" (f x) ["1"; "1"; "1"]
+
+    module StructTest2 = 
+
+
+        [<Struct>]
+        type Counter = 
+          [<DefaultValue>]
+          val mutable value : int 
+          member x.ToStringMember() = x.value <- x.value + 1; x.value.ToString()
+
+        let mutable x = new Counter();
+
+        check "vklnvwer0" [ x.ToStringMember(); x.ToStringMember(); x.ToStringMember() ] ["1"; "2"; "3"]
+
+    module StructTest3 = 
+
+        [<Struct>]
+        type Counter = 
+          [<DefaultValue>]
+          val mutable value : int 
+          member x.ToStringMember() = x.value <- x.value + 1; x.value.ToString()
+
+        let mutable x = Array.init 3 (fun i -> new Counter());
+        check "vklnvwer0" [ x.[0].ToStringMember(); x.[0].ToStringMember(); x.[0].ToStringMember() ] ["1"; "2"; "3"]
+
+    module StructTest4 = 
+
+        [<Struct>]
+        type Counter = 
+          [<DefaultValue>]
+          static val mutable private value : int 
+          member x.ToStringMember() = Counter.value <- Counter.value + 1; Counter.value.ToString()
+
+        let mutable x = Array.init 3 (fun i -> new Counter());
+        check "vklnvwer0" [ x.[0].ToStringMember(); x.[0].ToStringMember(); x.[0].ToStringMember() ] ["1"; "2"; "3"]
+
+
+
+
+module InterfaceExtendsSystemIComparable_Bug4919 = 
+      open System.Collections
+      open System.Collections.Generic
+
+      exception EmptyQueue
+
+      type Queue<'a> =
+        inherit IEnumerable<'a>
+        inherit IEnumerable
+        inherit System.IEquatable<Queue<'a>>
+        inherit System.IComparable
+        abstract IsEmpty : bool
+        abstract PushBack : 'a -> Queue<'a>
+        abstract PopFront : unit -> 'a * Queue<'a>
+
+      let private queueEnumerator (q: Queue<_>) =
+        let decap (q: Queue<_>) = if q.IsEmpty then None else Some(q.PopFront())
+        (Seq.unfold decap q).GetEnumerator()
+
+      module BatchedQueue =
+        let rec private mk(f, r) =
+          let mk = function
+            | [], r -> mk(List.rev r, [])
+            | q -> mk q
+          { new Queue<'a> with
+              override q.IsEmpty =
+                match f with
+                | [] -> true
+                | _ -> false
+
+              override q.PushBack x =
+                mk(f, x::r)
+
+              override q.PopFront() =
+                match f with
+                | x::f -> x, mk(f, r)
+                | [] -> raise EmptyQueue
+
+              override q.GetEnumerator() =
+                ((q: Queue<'a>).GetEnumerator() :> IEnumerator)
+
+              override q.GetEnumerator() : IEnumerator<'a> =
+                queueEnumerator q
+
+              override q1.Equals(q2: Queue<'a>) =
+                List.ofSeq q1 = List.ofSeq q2
+
+              override q1.CompareTo(q2: obj) =
+                let q2 = unbox<Queue<'a>> q2
+                Seq.compareWith compare q1 q2
+         }
+
+        let empty<'a when 'a : equality and 'a : comparison> = mk<'a>([], [])
+
+        let add (q: Queue<_>) x = q.PushBack x
+
+        let take (q: Queue<_>) = q.PopFront()
+
+      let time f x =
+        let t = System.Diagnostics.Stopwatch.StartNew()
+        try f x finally
+        printf "Took %dms\n" t.ElapsedMilliseconds
+
+      let () =
+        time (Seq.length << Seq.fold BatchedQueue.add BatchedQueue.empty) (seq {1 .. 100})
+        |> printf "Queue length %d\n"
+
+module AllowExtensionsWithinARecursiveGroup = begin
+    type System.Object with 
+       member x.Name = "a"
+
+    and System.String with 
+       member x.Freddy = "b"
+
+    and C with  
+       member x.FreddyAndName = let a,b = x.NameAndFreddy in b,a
+       
+    and C(s:string) = 
+       member x.NameAndFreddy = s.Name, s.Freddy
+
+end
+
+
+
+module PreferOverloadsUsingSystemFunc = begin
+
+    type Foo() = 
+        static member Method(x:System.Action) = 1
+        static member Method(x:System.Func<'T>) = 2
+
+    Foo.Method(fun _ -> ()) // expect return result 2
+end
+
+
+module AllowNullLiteralTest = begin
+
+    [<AllowNullLiteral>]
+    type I = 
+        interface
+          abstract P : int
+        end
+
+    let i = (null : I)
+
+    let i2 = ((box null) :?>  I)
+
+
+    [<AllowNullLiteral>]
+    type C() = 
+        member x.P = 1
+
+    let c = (null : C)
+
+    let c2 = ((box null) :?>  C)
+
+
+    [<AllowNullLiteral>]
+    type D() = 
+        inherit C()
+        interface I with 
+            member x.P = 2
+        member x.P = 1
+
+    let d = (null : D)
+
+    let d2 = ((box null) :?>  D)
+
+end
+
+module UnionConstructorsAsFirstClassValues = begin
+    type A =
+        | A of int * int
+        
+    let x = (1, 1)
+    let y = (A) x // OK
+    let z = A x // expect this to be ok
+end
+
+
+module ExtensionMemberTests = 
+    module Set1 = 
+        type System.DateTime with 
+           static member Prop1 = (1,1)
+
+        type System.DateTime with 
+           static member Meth1(s:string) = (1,2)
+
+        type System.DateTime with 
+           static member Meth2(s:string) = (1,2)
+
+        type System.DateTime with 
+           member x.InstanceProp1 = (1,1)
+
+        type System.DateTime with 
+           member x.InstanceMeth1(s:string) = (1,2)
+
+        type System.DateTime with 
+           member x.InstanceMeth2(s:string) = (1,2)
+
+
+    module Set2 = 
+        type System.DateTime with 
+           static member Prop1 = (2,2)
+
+        type System.DateTime with 
+           static member Meth1(s:string) = (2,1)
+
+        type System.DateTime with 
+           static member Meth2(s:obj) = (2,1)
+
+        type System.DateTime with 
+           member x.InstanceProp1 = (2,2)
+
+        type System.DateTime with 
+           member x.InstanceMeth1(s:string) = (2,1)
+
+        type System.DateTime with 
+           member x.InstanceMeth2(s:obj) = (2,1)
+    
+    // overloaded indexed extension properties
+    module Set3A =
+        type A() = 
+            member m.Item with get(a: string) = "Item(string)"
+            member m.Item with set(a: string) (value:string) = failwith "Setting Item(string) string"
+            member m.Item with set(a: bool) (value:string) = failwith "Setting Item(bool) string"
+                
+            member m.Prop with get(a: string, b:string) = "Prop(string, string)"
+            member m.Prop with set(a: string, b: string) (value:string) = failwith "Setting Prop(string, string) string"
+            member m.Prop with set(a: string, b: bool) (value:string) = failwith "Setting Prop(string, bool) string"
+            
+            member m.Plain with get() = "Intrinsic plain"
+            member m.Plain with set(a:string) = failwith "Setting intrinsic plain"
+            
+            member m.NonIndexed with get() = "Intrinsic nonindexed"
+            
+            member m.Indexed with get(a: string) = "Intrinsic indexed"
+
+
+    module Set3B =
+        type Set3A.A with
+            member m.Item with get(a: bool) = "Item(bool)"
+            member m.Item with set(a: bool) (value: bool) = failwith "Setting Item(bool) bool"
+            member m.Item with set(a: string) (value: bool) = failwith "Setting Item(string) bool"
+                
+            member m.Prop with get(a: string, b:bool) = "Prop(string, bool)"
+            member m.Prop with set(a: string, b:bool) (value: bool) = failwith "Setting Prop(string, bool) bool"
+            member m.Prop with set(a: string, b:string) (value: bool) = failwith "Setting Prop(string, string) bool"
+            
+            member m.Plain with get() = "Extension plain"
+            member m.Plain with set(a:string) = failwith "Setting extension plain"
+            
+            member m.NonIndexed with get(a: bool) = "Extension nonindexed"
+            
+            member m.Indexed with get() = "Extension indexed"
+            
+            member m.ExtensionOnly with get(a: bool) = "ExtensionOnly(bool)"
+            
+        type System.Net.WebHeaderCollection with
+            member m.Item with get(a : bool) = "ExtensionGet"
+
+    module Tests1 = 
+        open Set1
+        open Set2
+        check "fewnr-0vrwep0" System.DateTime.Prop1 (2,2)
+        check "fewnr-0vrwep1" (System.DateTime.Meth1("a")) (2,1)
+        check "fewnr-0vrwep2" (System.DateTime.Meth2("a")) (1,2) // Set1 always preferred due to more precise type
+
+        check "fewnr-0vrwep0" System.DateTime.Now.InstanceProp1 (2,2)
+        check "fewnr-0vrwep1" (System.DateTime.Now.InstanceMeth1("a")) (2,1)
+        check "fewnr-0vrwep2" (System.DateTime.Now.InstanceMeth2("a")) (1,2) // Set1 always preferred due to more precise type
+
+    module Tests2 = 
+        open Set2
+        open Set1
+        check "fewnr-0vrwep3" System.DateTime.Now.InstanceProp1 (1,1)
+        check "fewnr-0vrwep4" (System.DateTime.Now.InstanceMeth1("a")) (1,2)
+        check "fewnr-0vrwep5" (System.DateTime.Now.InstanceMeth2("a")) (1,2) // Set1 always preferred due to more precise type
+
+    module Tests3 = 
+        open Set3A
+        open Set3B
+        
+        let checkSet testName (f : unit -> unit) expected =
+            let result = 
+                let mutable res = ""
+                try f() with | e -> res <- e.Message
+                res
+                
+            check testName result expected
+        
+        let foo = A()
+        
+        // getters
+        check "ExtensionProps 0" (foo.[""]) "Item(string)"
+        check "ExtensionProps 1" (foo.[true]) "Item(bool)"
+
+        check "ExtensionProps 2" (foo.Prop("", "")) "Prop(string, string)"
+        check "ExtensionProps 3" (foo.Prop("", true)) "Prop(string, bool)"
+        
+        // in case of exact duplicate, per spec intrinsic should be preferred
+        check "ExtensionProps 4" (foo.Plain) "Intrinsic plain"
+        
+        check "ExtensionProps 5" (foo.NonIndexed) "Intrinsic nonindexed"
+        // not expected to work:  check "ExtensionProps 6" (foo.NonIndexed(true)) "Extension nonindexed"
+        
+        check "ExtensionProps 7" (foo.Indexed("")) "Intrinsic indexed"
+        // not expected to work:  check "ExtensionProps 8" (foo.Indexed) "Extension indexed"
+        
+        check "ExtensionProps 9" (System.Net.WebHeaderCollection().[true]) "ExtensionGet"
+        
+        // setters
+        checkSet "ExtensionProps 10" (fun () -> foo.[""] <- "") "Setting Item(string) string"
+        checkSet "ExtensionProps 11" (fun () -> foo.[true] <- "") "Setting Item(bool) string"
+        checkSet "ExtensionProps 13" (fun () -> foo.[true] <- true) "Setting Item(bool) bool"
+        checkSet "ExtensionProps 14" (fun () -> foo.[""] <- true) "Setting Item(string) bool"
+        
+        checkSet "ExtensionProps 16" (fun () -> foo.Prop("", "") <- "") "Setting Prop(string, string) string"
+        checkSet "ExtensionProps 17" (fun () -> foo.Prop("", true) <- "") "Setting Prop(string, bool) string"
+        checkSet "ExtensionProps 19" (fun () -> foo.Prop("", true) <- true) "Setting Prop(string, bool) bool"
+        checkSet "ExtensionProps 20" (fun () -> foo.Prop("", "") <- true) "Setting Prop(string, string) bool"
+        
+        checkSet "ExtensionProps 22" (fun () -> foo.Plain <- "") "Setting intrinsic plain"
+
+module AccessThisAsPartOfSUperClassConstruction1 = 
+    open System
+    type Z(x : obj) = class end
+
+    type X() as Y =
+      class
+       inherit Z(Y.x)
+       do
+         ()
+       [<DefaultValue>]
+       val mutable x : int
+      end
+
+
+module AccessThisAsPartOfSUperClassConstruction2 = 
+
+    module Test1 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X() as Y =
+         class
+          inherit Z(Y.x)
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+         end
+
+
+
+    module Test2 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X() as Y =
+         class
+          inherit Z(Y.x)
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = Y
+         end
+
+    module Test3 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X() as Y =
+         class
+          inherit Z(Y.x)
+          let getThis () = Y
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = getThis()
+         end
+
+    module Test4 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X() as Y =
+         class
+          inherit Z(Y.x)
+          let ths = Y
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = ths
+         end
+
+
+
+
+    module GenericTest1 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X<'T>() as Y =
+         class
+          inherit Z(Y.x)
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+         end
+
+
+
+    module GenericTest2 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X<'T>() as Y =
+         class
+          inherit Z(Y.x)
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = Y
+         end
+
+    module GenericTest3 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X<'T>() as Y =
+         class
+          inherit Z(Y.x)
+          let getThis () = Y
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = getThis()
+         end
+
+    module GenericTest4 = 
+       open System
+       type Z(x : obj) = class end
+
+       type X<'T>() as Y =
+         class
+          inherit Z(Y.x)
+          let ths = Y
+          do
+            ()
+          [<DefaultValue>]
+          val mutable x : int
+
+          member self.ThisPtr = ths
+         end
+
+
+module AccessThisAsPartOfSUperClassConstruction3 = 
+
+    type B(obj:obj) = 
+        member x.P = 1
+
+    type C1() as a = 
+        inherit B((fun () -> a)) // captures 'this' as part of call to super class constructor
+        member x.P = 1
+        
+    type C2() as a = 
+        inherit B((fun () -> a)) // captures 'this' as part of call to super class constructor
+        member x.P = a // and captures it in a method
+
+
+module EqualityComparisonPositiveTests = 
+
+
+    module StructDefaultConstructorCantBeUsed =
+
+        [<Struct>]
+        type U1(v:int) = 
+            member x.P = v
+
+        let v1 = U1()  // can be used - expect no error
+
+
+    module BasicExample1 =
+        let f1 (x : list<int>) = (x = x) // expect ok
+        let f2 (x : option<int>) = (x = x) // expect ok
+        let f3 (x : Choice<int,int>) = (x = x) // expect ok
+        let f4 (x : Choice<int,int,int>) = (x = x) // expect ok
+        let f5 (x : Choice<int,int,int,int>) = (x = x) // expect ok
+        let f6 (x : Choice<int,int,int,int,int>) = (x = x) // expect ok
+        let f7 (x : Choice<int,int,int,int,int,int>) = (x = x) // expect ok
+        let f8 (x : Choice<int,int,int,int,int,int,int>) = (x = x) // expect ok
+        let f9 (x : ref<int>) = (x = x) // expect ok
+        let fq (x : Set<int>) = (x = x) // expect ok
+        let fw (x : Map<int,int>) = (x = x) // expect ok
+        
+        let fe (x : list<System.Type>) = (x = x) // expect ok
+        let fr (x : option<System.Type>) = (x = x) // expect ok
+        let ft (x : Choice<System.Type,int>) = (x = x) // expect ok
+        let fy (x : Choice<System.Type,int,int>) = (x = x) // expect ok
+        let fu (x : Choice<System.Type,int,int,int>) = (x = x) // expect ok
+        let fi (x : Choice<System.Type,int,int,int,int>) = (x = x) // expect ok
+        let fo (x : Choice<System.Type,int,int,int,int,int>) = (x = x) // expect ok
+        let fp (x : Choice<System.Type,int,int,int,int,int,int>) = (x = x) // expect ok
+        let fa (x : ref<System.Type>) = (x = x) // expect ok
+
+
+        let fn (x : Set<list<int>>) = () // expect ok
+        let fm (x : Set<option<int>>) = () // expect ok
+        let fQ (x : Set<ref<int>>) = () // expect ok
+        let fW (x : Set<Set<int>>) = () // expect ok
+        let fE (x : Set<Map<int,int>>) = () // expect ok
+        let fO (x : Set<int * int>) = () // expect ok
+        let fP (x : Set<int * int * int>) = () // expect ok
+        let fA (x : Set<int * int * int * int>) = () // expect ok
+        let fS (x : Set<int * int * int * int * int>) = () // expect ok
+        let fD (x : Set<int * int * int * int * int * int>) = () // expect ok
+        let fF (x : Set<int * int * int * int * int * int * int>) = () // expect ok
+        let fG (x : Set<int * int * int * int * int * int * int * int>) = () // expect ok
+        let fH (x : Set<int * int * int * int * int * int * int * int * int >) = () // expect ok
+        let fJ (x : Set<int * int * int * int * int * int * int * int * int * int>) = () // expect ok
+        let fK (x : Set<int * int * int * int * int * int * int * int * int * int * int>) = () // expect ok
+
+        type R<'T> = R of 'T * R<'T>
+        let r1 (x : Set<R<int>>) = () // expect ok
+        let r3 (x : R<int>) = (x = x) // expect ok
+        let r4 (x : R<System.Type>) = (x = x) // expect ok
+
+        //type R2<'T> = | R2 : 'T * R2<'T> -> R2<'T>
+        //let q1 (x : Set<R2<int>>) = () // expect ok
+        //let q3 (x : R2<int>) = (x = x) // expect ok
+        //let q4 (x : R2<System.Type>) = (x = x) // expect ok
+        
+    module Example1 =
+        type X<'T> = X of 'T
+
+        let f0 (x : Set<X<int>>) = ()  // expect ok
+        let f1 (x : Set<X<'T>>) = ()  // expect ok
+        let f3 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example1_Record =
+        type X<'T> = { r : 'T }
+
+        let f0 (x : Set<X<int>>) = ()  // expect ok
+        let f1 (x : Set<X<'T>>) = ()  // expect ok
+        let f3 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example1_Struct =
+        type X<'T> = struct val r : 'T  end
+
+        let f0 (x : Set<X<int>>) = ()  // expect ok
+        let f1 (x : Set<X<'T>>) = ()  // expect ok
+        let f3 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example1_StructImplicit =
+        [<Struct; StructuralComparison; StructuralEquality>]
+        type X<[<EqualityConditionalOn;ComparisonConditionalOn>] 'T>(r:'T) = struct member x.R = r  end
+
+        let f0 (x : Set<X<int>>) = ()  // expect ok
+        let f1 (x : Set<X<'T>>) = ()  // expect ok
+        let f3 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example1_StructImplicit2 =
+        [<Struct>]
+        type X<[<EqualityConditionalOn;ComparisonConditionalOn>] 'T>(r:'T) = struct member x.R = r  end
+
+        let f0 (x : Set<X<int>>) = ()  // expect ok
+        let f1 (x : Set<X<'T>>) = ()  // expect ok
+        let f3 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example2 = 
+        type X<'T> = X of list<'T>
+
+        let f0 (x : Set<X<int>>) = ()   // expect ok
+        let f1 (x : Set<X<'T>>) = ()   // expect ok
+
+        let f4 (x : X<list<int>>) = (x = x) // expect ok
+        let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+
+    module Example3 = 
+        type X<'T> = X of Y<'T>
+        and Y<'T> = Y of 'T
+
+        let f0 (x : Set<X<int>>) = ()   // expect ok
+        let f1 (x : Set<X<'T>>) = ()   // expect ok
+
+        let f4 (x : X<list<int>>) = (x = x) // expect ok
+        let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+    module Example4 = 
+        type X<'T> = X of Y<'T>
+        and Y<'T> = Y of 'T * X<'T>
+
+        let f0 (x : Set<X<int>>) = ()   // expect ok
+        let f1 (x : Set<X<'T>>) = ()   // expect ok
+
+        let f4 (x : X<list<int>>) = (x = x) // expect ok
+        let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+
+        let g0 (x : Set<Y<int>>) = ()   // expect ok
+        let g1 (x : Set<Y<'T>>) = ()   // expect ok
+
+        let g4 (x : Y<list<int>>) = (x = x) // expect ok
+        let g6 (x : Y<list<System.Type>>) = (x = x) // expect ok
+
+    module Example5 = 
+        type X<'T> = X of Y<'T>
+        and Y<'T> = Y of int
+
+        let f0 (x : Set<X<int>>) = ()   // expect ok
+        let f1 (x : Set<X<'T>>) = ()   // expect ok
+        let f2 (x : Set<X<System.Type>>) = () // expect ok
+        let f3 (x : Set<X<list<System.Type>>>) = () // expect ok
+
+        let f4 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<int -> int>) = (x = x) // expect ok
+        let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+        let f7 (x : X<list<int -> int>>) = (x = x) // expect ok
+
+        let g0 (x : Set<Y<int>>) = ()   // expect ok
+        let g1 (x : Set<Y<'T>>) = ()   // expect ok
+        let g2 (x : Set<Y<System.Type>>) = () // expect ok
+        let g3 (x : Set<Y<list<System.Type>>>) = () // expect ok
+
+        let g4 (x : Y<list<int>>) = (x = x) // expect ok
+        let g5 (x : Y<int -> int>) = (x = x) // expect ok
+        let g6 (x : Y<list<System.Type>>) = (x = x) // expect ok
+        let g7 (x : Y<list<int -> int>>) = (x = x) // expect ok
+
+    module Example6 = 
+        type X<'T> = X of Y<int,'T>
+        and Y<'T,'U> = Y of 'T * X<'T>
+
+        let f0 (x : Set<X<int>>) = ()   // expect ok
+        let f1 (x : Set<X<'T>>) = ()   // expect ok
+        let f2 (x : Set<X<System.Type>>) = () // expect ok
+        let f3 (x : Set<X<list<System.Type>>>) = () // expect ok
+
+        let f4 (x : X<list<int>>) = (x = x) // expect ok
+        let f5 (x : X<int -> int>) = (x = x) // expect ok
+        let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+        let f7 (x : X<list<int -> int>>) = (x = x) // expect ok
+
+        let g0 (x : Set<Y<int,int>>) = ()   // expect ok
+        let g1 (x : Set<Y<'T,'T>>) = ()   // expect ok
+
+        let g4 (x : Y<list<int>,int>) = (x = x) // expect ok
+        let g6 (x : Y<list<System.Type>, int>) = (x = x) // expect ok
+
+
+        let g8 (x : Y<int,list<int>>) = (x = x) // expect ok
+        let g9 (x : Y<int,(int -> int)>) = (x = x) // expect ok
+        let g10 (x : Y<int,list<System.Type>>) = (x = x) // expect ok
+        let g11 (x : Y<int,list<(int -> int)>>) = (x = x) // expect ok
+
+    module Example7 = 
+        // a type inferred to be without equality or comparison
+        type X = X of (int -> int)
+        // a type transitively inferred to be without equality or comparison
+        type  Y = Y of X
+
+
+    module Example8 = 
+        // a type inferred to be without comparison
+        type X = X of System.Type
+        // a type transitively inferred to be without comparison
+        type  Y = Y of X
+
+        let f2 (x : X) = (x = x) // expect ok
+        let f3 (x : Y) = (x = x) // expect ok
+
+
+module RuntimeCheckForSelfCallThroughProperty1 =  begin
+    [<AbstractClass>]
+    type Base(callIt:bool) as self = 
+       do if callIt then printfn "P = %d" self.P // expect an exception here
+       abstract P: int
+
+    type C(callIt:bool) = 
+       inherit Base(callIt)
+       let x = 1
+       override __.P = x
+
+    check "cewlkcnc332a" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "cewlkcnc332b" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+module RuntimeCheckForSelfCallThroughSetterProperty1 =  begin
+    [<AbstractClass>]
+    type Base(callIt:bool) as self = 
+       do if callIt then self.P <- 1  // expect an exception here
+       abstract P: int with set
+
+    type C(callIt:bool) = 
+       inherit Base(callIt)
+       let x = 1
+       override __.P with set v = ()
+
+    check "cewlkcnc332c" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "cewlkcnc332d" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+module RuntimeCheckForSelfCallThroughInterfaceSetterProperty1 =  begin
+    
+    type I = 
+       abstract P: int with set
+        
+    type Base(callIt:bool) as self = 
+       do if callIt then (box self :?> I).P <- 1  // expect an exception here
+
+    type C(callIt:bool) = 
+       inherit Base(callIt)
+       let x = 1
+       interface I with 
+           member __.P with set v = ()
+
+    check "cewlkcnc332y" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "cewlkcnc332t" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+
+module RuntimeCheckForSelfCallThroughProperty1ExplicitClass =  begin
+    [<AbstractClass>]
+    type Base = 
+       new (callIt: bool) as self = 
+           { } 
+           then 
+               if callIt then printfn "P = %d" self.P // expect an exception here
+
+       abstract P: int
+
+    type C = 
+       inherit Base
+       val x : int
+       new (callIt: bool) as self = { inherit Base(callIt); x = 1 }  
+       override __.P = x
+
+    check "explicit-cewlkcnc332a" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "explicit-cewlkcnc332b" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+module RuntimeCheckForSelfCallThroughSetterProperty1ExplicitClass =  begin
+    [<AbstractClass>]
+    type Base = 
+       new (callIt: bool) as self = 
+           { } 
+           then 
+               if callIt then self.P <- 1 // expect an exception here
+       abstract P: int with set
+
+    type C = 
+       inherit Base
+       val x : int
+       new (callIt: bool) as self = { inherit Base(callIt); x = 1 }  
+       override __.P with set v = ()
+
+    check "explicit-cewlkcnc332c" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "explicit-cewlkcnc332d" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+module RuntimeCheckForSelfCallThroughInterfaceSetterProperty1ExplicitClass =  begin
+    
+    type I = 
+       abstract P: int with set
+        
+    type Base = 
+       new (callIt: bool) as self = 
+           { } 
+           then 
+               if callIt then (box self :?> I).P <- 1 // expect an exception here
+
+
+    type C = 
+       inherit Base
+       val x : int
+       new (callIt: bool) as self = { inherit Base(callIt); x = 1 }  
+       interface I with 
+           member __.P with set v = ()
+
+    check "explicit-cewlkcnc332y" (try C(true) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "fail"
+    check "explicit-cewlkcnc332t" (try C(false) |> ignore; "ok" with :? System.InvalidOperationException -> "fail") "ok"
+end
+
+module PartiallyReimplementInheritedInterfaces = begin
+    //---------------------------------------------------
+    // Basic test 1
+
+    module BasicTest1 = 
+        type public I1 = 
+            abstract V1 : string 
+            
+        type public I2 = 
+            inherit I1 
+            abstract V2 : string 
+            
+        type public C1() = 
+            interface I1 with 
+                member this.V1 = "C1" 
+                
+        type public C2() = 
+            inherit C1() 
+            interface I2 with 
+                member this.V2 = "C2"         
+
+        type public C3() = 
+            inherit C1() 
+            interface I2 with 
+                member this.V1 = "C1b"         
+                member this.V2 = "C2b"         
+
+        check "8kvnvwe0-we1"  (C2() :> I2).V2 "C2"
+        check "8kvnvwe0-we2"  (C2() :> I1).V1 "C1"
+        check "8kvnvwe0-we3"  (C3() :> I1).V1 "C1b"
+
+    //---------------------------------------------------
+    // Basic test 3 - IEnumerable --> IEnumerable<int>
+
+
+    module InheritIEnumerableTest1 = 
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection() = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box 1
+                member __.MoveNext() = true
+                
+        type DerivedCollection() = 
+            inherit BaseCollection()
+            interface System.Collections.Generic.IEnumerator<int> with 
+                member __.Reset() = ()
+                member __.Current = 2
+                member __.Current = box 2
+                member __.Dispose() = ()
+                member __.MoveNext() = false
+
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection()
+            interface System.Collections.Generic.IEnumerator<int> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection()
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+
+
+        check "8kvnvwe0-we4"  (new DerivedCollection() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-we5"  ((new DerivedCollection() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-we6"  (new DerivedCollection() :> IEnumerator).Current (box 2)
+        check "8kvnvwe0-we7"  ((new DerivedCollection() :> IEnumerator).MoveNext()) false
+        check "8kvnvwe0-we8"  (new ReDerivedCollection1() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-we9"  ((new ReDerivedCollection1() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-weq"  (new ReDerivedCollection2() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wew"  ((new ReDerivedCollection2() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wee"  (new ReDerivedCollection3() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wer"  ((new ReDerivedCollection3() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wet"  (new BaseCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-wey"  ((new BaseCollection() :> IEnumerator).MoveNext()) true
+
+    module InheritIEnumerableTest2 = 
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection() = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box 1
+                member __.MoveNext() = true
+                
+        type DerivedCollection() = 
+            inherit BaseCollection()
+            interface System.Collections.Generic.IEnumerator<int> with 
+                // Emit one or more members to inherit implementations of some of the interfaces
+                //member __.Reset() = ()
+                member __.Current = 2
+                member __.Current = box 2
+                member __.Dispose() = ()
+                member __.MoveNext() = false
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection()
+            interface System.Collections.Generic.IEnumerator<int> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection()
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+
+        check "8kvnvwe0-weu"  (new DerivedCollection() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wei"  ((new DerivedCollection() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-weo"  (new DerivedCollection() :> IEnumerator).Current (box 2)
+        check "8kvnvwe0-wep"  ((new DerivedCollection() :> IEnumerator).MoveNext()) false
+        check "8kvnvwe0-wea"  (new ReDerivedCollection1() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wes"  ((new ReDerivedCollection1() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wed"  (new ReDerivedCollection2() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wef"  ((new ReDerivedCollection2() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-weg"  (new ReDerivedCollection3() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weh"  ((new ReDerivedCollection3() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wej"  (new BaseCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-wek"  ((new BaseCollection() :> IEnumerator).MoveNext()) true
+
+    module InheritIEnumerableTest3 = 
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection() = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box 1
+                member __.MoveNext() = true
+                
+        type DerivedCollection() = 
+            inherit BaseCollection()
+            interface System.Collections.Generic.IEnumerator<int> with 
+                // Emit one or more members to inherit implementations of some of the interfaces
+                //member __.Reset() = ()
+                member __.Current = 2
+                //member __.Current = box 1
+                member __.Dispose() = ()
+                member __.MoveNext() = false
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection()
+            interface System.Collections.Generic.IEnumerator<int> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection()
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+
+        check "8kvnvwe0-wel"  (new DerivedCollection() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wez"  ((new DerivedCollection() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wex"  (new DerivedCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-wec"  ((new DerivedCollection() :> IEnumerator).MoveNext()) false
+        check "8kvnvwe0-wev"  (new ReDerivedCollection1() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-web"  ((new ReDerivedCollection1() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-wen"  (new ReDerivedCollection2() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-wem"  ((new ReDerivedCollection2() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-weQ"  (new ReDerivedCollection3() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weW"  ((new ReDerivedCollection3() :> IEnumerator<int>).MoveNext()) false
+        check "8kvnvwe0-weE"  (new BaseCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-weR"  ((new BaseCollection() :> IEnumerator).MoveNext()) true
+
+    module InheritIEnumerableTest4 = 
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection() = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box 1
+                member __.MoveNext() = true
+                
+        type DerivedCollection() = 
+            inherit BaseCollection()
+            interface System.Collections.Generic.IEnumerator<int> with 
+                // Emit one or more members to inherit implementations of some of the interfaces
+                //member __.Reset() = ()
+                member __.Current = 2
+                //member __.Current = box 1
+                member __.Dispose() = ()
+                //member __.MoveNext() = true
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection()
+            interface System.Collections.Generic.IEnumerator<int> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection()
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4() = 
+            inherit DerivedCollection()
+            interface System.IDisposable
+
+
+        check "8kvnvwe0-weT"  (new DerivedCollection() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weY"  ((new DerivedCollection() :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weU"  (new DerivedCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-weI"  ((new DerivedCollection() :> IEnumerator).MoveNext()) true
+        check "8kvnvwe0-weO"  (new ReDerivedCollection1() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weP"  ((new ReDerivedCollection1() :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weA"  (new ReDerivedCollection2() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weS"  ((new ReDerivedCollection2() :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weD"  (new ReDerivedCollection3() :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weF"  ((new ReDerivedCollection3() :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weG"  (new BaseCollection() :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-weH"  ((new BaseCollection() :> IEnumerator).MoveNext()) true
+
+    // Add some generics
+    module InheritIEnumerableTest5 = 
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection<'T>(x:'T) = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box x
+                member __.MoveNext() = true
+                
+        type DerivedCollection<'U>(x:'U) = 
+            inherit BaseCollection<'U>(x)
+            interface System.Collections.Generic.IEnumerator<'U> with 
+                // Emit one or more members to inherit implementations of some of the interfaces
+                //member __.Reset() = ()
+                member __.Current = x
+                //member __.Current = box 1
+                member __.Dispose() = ()
+                //member __.MoveNext() = true
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection<int>(3)
+            interface System.Collections.Generic.IEnumerator<int> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection<string>("4")
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection<uint32>(3u)
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4<'T>(x:'T) = 
+            inherit DerivedCollection<'T>(x)
+            interface System.IDisposable
+
+
+        check "8kvnvwe0-weJ"  (new DerivedCollection<int>(2) :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weK"  ((new DerivedCollection<int>(2) :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weL"  (new DerivedCollection<int>(1) :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-weZ"  ((new DerivedCollection<int>(1) :> IEnumerator).MoveNext()) true
+        check "8kvnvwe0-weX"  (new ReDerivedCollection1() :> IEnumerator<int>).Current 3
+        check "8kvnvwe0-weC"  ((new ReDerivedCollection1() :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weV"  (new ReDerivedCollection2() :> IEnumerator<string>).Current "4"
+        check "8kvnvwe0-weB"  ((new ReDerivedCollection2() :> IEnumerator<string>).MoveNext()) true
+        check "8kvnvwe0-weN"  (new ReDerivedCollection3() :> IEnumerator<uint32>).Current 3u
+        check "8kvnvwe0-weM"  ((new ReDerivedCollection3() :> IEnumerator<uint32>).MoveNext()) true
+        check "8kvnvwe1-weq"  (new BaseCollection<int>(1) :> IEnumerator).Current (box 1)
+        check "8kvnvwe1-wWw"  ((new BaseCollection<int>(1) :> IEnumerator).MoveNext()) true
+
+    // Add some units of measure
+    module InheritIEnumerableTest6 = 
+        [<Measure>] type kg
+        
+        open System.Collections
+        open System.Collections.Generic
+        type BaseCollection<'T>(x:'T) = 
+            override __.GetHashCode() = 0
+            override __.Equals(yobj) = true
+            interface System.Collections.IEnumerator with 
+                member __.Reset() = ()
+                member __.Current = box x
+                member __.MoveNext() = true
+                
+        type DerivedCollection<'U>(x:'U) = 
+            inherit BaseCollection<'U>(x)
+            interface System.Collections.Generic.IEnumerator<'U> with 
+                // Emit one or more members to inherit implementations of some of the interfaces
+                //member __.Reset() = ()
+                member __.Current = x
+                //member __.Current = box 1
+                member __.Dispose() = ()
+                //member __.MoveNext() = true
+
+        type ReDerivedCollection1() = 
+            inherit DerivedCollection<int<kg>>(3<kg>)
+            interface System.Collections.Generic.IEnumerator<int<kg>> 
+
+        type ReDerivedCollection2() = 
+            inherit DerivedCollection<float<kg>>(4.0<kg>)
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection3() = 
+            inherit DerivedCollection<int64<kg>>(3L<kg>)
+            interface System.IDisposable
+            interface System.Collections.IEnumerator
+
+        type ReDerivedCollection4<'T>(x:'T) = 
+            inherit DerivedCollection<'T>(x)
+            interface System.IDisposable
+
+        type ReDerivedCollection5<'T>(x:'T) = 
+            inherit ReDerivedCollection3()
+            interface System.IDisposable
+            interface System.Collections.Generic.IEnumerator<int64<kg>> 
+
+
+        check "8kvnvwe0-weJ"  (new DerivedCollection<int>(2) :> IEnumerator<int>).Current 2
+        check "8kvnvwe0-weK"  ((new DerivedCollection<int>(2) :> IEnumerator<int>).MoveNext()) true
+        check "8kvnvwe0-weL"  (new DerivedCollection<int>(1) :> IEnumerator).Current (box 1)
+        check "8kvnvwe0-weZ"  ((new DerivedCollection<int>(1) :> IEnumerator).MoveNext()) true
+        check "8kvnvwe0-weX"  (new ReDerivedCollection1() :> IEnumerator<int<kg>>).Current 3<kg>
+        check "8kvnvwe0-weC"  ((new ReDerivedCollection1() :> IEnumerator<int<kg>>).MoveNext()) true
+        check "8kvnvwe0-weV"  (new ReDerivedCollection2() :> IEnumerator<float<kg>>).Current 4.0<kg>
+        check "8kvnvwe0-weB"  ((new ReDerivedCollection2() :> IEnumerator<float<kg>>).MoveNext()) true
+        check "8kvnvwe0-weN"  (new ReDerivedCollection3() :> IEnumerator<int64<kg>>).Current 3L<kg>
+        check "8kvnvwe0-weM"  ((new ReDerivedCollection3() :> IEnumerator<int64<kg>>).MoveNext()) true
+        check "8kvnvwe1-weq"  (new BaseCollection<int>(1) :> IEnumerator).Current (box 1)
+        check "8kvnvwe1-wWw"  ((new BaseCollection<int>(1) :> IEnumerator).MoveNext()) true
+
+end
+
+module ClassWithInheritAndImmediateReferenceToThisInLet = 
+    type B() = 
+        member __.P = 1
+
+    let id x = x
+
+    type C() as x = 
+        inherit B()
+        let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members
+        member __.ThisPointer1 = x
+        member __.ThisPointer2 = y
+
+
+    let checkA() = 
+        let c = C()
+        check "cwknecw021" c.ThisPointer1 c.ThisPointer2
+   
+module ClassWithNoInheritAndImmediateReferenceToThisInLet = 
+    type C() as x = 
+        let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members
+        member __.ThisPointer1 = x
+        member __.ThisPointer2 = y
+
+
+    let checkB() = 
+        let c = C()
+        check "cwknecw021b" c.ThisPointer1 c.ThisPointer2
+
+
+module CheckResolutionOrderForMembers1 = 
+    type System.String with 
+        static member M1 () = 1
+        static member M1 (?s : string) = 2
+    let a = System.String.M1()
+    check "vew98vrknj1" a 1
+    
+module CheckResolutionOrderForMembers2 = 
+    type System.String with 
+        static member M1 (?s : string) = 2
+        static member M1 () = 1
+
+    let b = System.String.M1()
+    
+    check "vew98vrknj2" b 1
+
+module CheckResolutionOrderForMembers3 = 
+    type C = 
+        static member M1 () = 1
+        static member M1 (?s : string) = 2
+
+    let a1 = C.M1()
+    let a2 = C.M1("2")
+    check "vew98vrknj3" a1 1
+    check "vew98vrknj3" a2 2
+
+
+module CheckUsesOfNonOverloadMembersAssertReturnTypeBeforeCheckingArgs = 
+
+    type C() = 
+        static member M(x:int)  = 0
+        static member M(x:string) = 1
+
+        member __.N(x:int)  = 0
+        member __.N(x:string) = 1
+
+    let test (x:int) = 1
+    type D() = 
+        static member Test (x:int) = 1
+
+
+    // In this case, the overload C.M resolves, because the return type of 
+    // loopX is known, from the return type of test.
+
+    let rec loopX() = test (C.M(loopX()))  
+
+    // In this case, the overload C.M resolves, because the return type of 
+    // loopY is known, from the return type of test.
+
+    let rec loopY() = D.Test (C.M(loopY()))  
+
+    // Instance member versions of the same
+    let c = C()
+    let rec loopX1() = test (c.N(loopX1()))  
+    let rec loopY1() = D.Test (c.N(loopY1()))  
+
+
+// Believe it or not, this caused the type checker to loop (bug 5803)
+module BasicTypeCHeckingLoop = 
+
+
+    type Vector() =
+        static member (+)(v1:Vector,v2) = 0
+
+    let foo (v1:Vector) v2 : int = v1 + v2
+
+module CheckGeneralizationOfMembersInRecursiveGroupsWhichIncludeImplicitConstructors = 
+
+    open System.Collections
+    open System.Collections.Generic
+
+    type IA<'T> = interface abstract M2 : int -> int end
+
+    type X<'T>() =
+        let mutable redirectTo : X<'T> = Unchecked.defaultof<_>
+
+        member x.M1() = if true then redirectTo else x
+        member x.M2() = if true then redirectTo else x
+        interface IA<int> with
+            member x.M2 y = y
+
+
+    [<Struct>]
+    type S<'T>(redirectTo : list<S<'T>>) =
+
+        member x.M() = if true then redirectTo.[0] else x
+
+
+    module Issue3Minimal = 
+        type MyDiscrUnion<'t> =
+            | MyCase of MyConstructedClass<'t>  
+
+            member this.M() =
+                match this with
+                | MyCase r -> r.Record
+        and MyConstructedClass<'t>( record : MyDiscrUnion<'t> ) = 
+           member x.Record = record
+
+    module Issue4 = 
+        type MyDiscrUnion<'t> =
+            | MyCase       of MyConstructedClass<'t>  
+            member x.Value (t : 't) =
+                match x with
+                | MyCase       r -> r.Apply t
+        and MyConstructedClass<'t>( foo : 't ) = 
+            member x.Apply ( t: 't ) = t
+
+    type ClassA<'t>(b: ClassB<'t>, c:'t) =
+        member x.A() = b.A() 
+    and ClassB<'t>( a : ClassA<'t> ) = 
+       member x.A()  = a
+
+module CheckGeneralizationOfMembersInRecursiveGroupsWhichIncludeImplicitConstructorsPart2 = 
+
+    // This test raised a code generation assert
+    module DontGeneralizeTypeVariablesBoundByInnerPositions_1 = 
+        type C() =  
+            let someFuncValue = C.Meth2() // someFuncValue initially has variable type. This type is not generalized.
+            static member Meth2() = C.Meth2() 
+        and C2() =
+            static member Meth1() = C.Meth2()
+
+    // This test raised a code generation assert
+    module DontGeneralizeTypeVariablesBoundByInnerPositions_2 = 
+        type C<'T>() =  
+            let someFuncValue = C<'T>.Meth2() // someFuncValue initially has variable type. This type is not generalized.
+            static member Meth2() = C<'T>.Meth2() 
+        and C2<'T>() =
+            static member Meth1() = C<'T>.Meth2()
+
+    // This test is a trimmed down version of a regression triggered by this fix
+    module M0 = 
+        type C<'T>(orig : 'T) =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C<'T> 
+            let MyFind(x : C<'T>) = x.parent 
+            member this.Find() = MyFind(this) 
+
+    // This test is a trimmed down version of a regression triggered by this fix
+    module M1 = 
+        type C<'T>(orig : 'T) as this =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C<'T> 
+            let MyFind(x : C<'T>) = x.parent 
+            member this.Find() = MyFind(this) 
+
+    // This test is an adapted version of the above trim-down
+    module M2 = 
+        type C<'T>(orig : 'T) as this =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C2<'T> 
+            let MyFind(x : C<'T>) = (x.parent , x.parent.parent)
+            member this.Find() = MyFind(this) 
+        and C2<'T>(orig : 'T) as this =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C<'T> 
+            let MyFind(x : C2<'T>) = (x.parent , x.parent.parent)
+            member this.Find() = MyFind(this) 
+
+    // This test is an adapted version of the above trim-down
+    module M3 = 
+        type C<'T>(orig : 'T) =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C2<'T> 
+            let MyFind(x : C<'T>) = (x.parent , x.parent.parent)
+            member this.Find() = MyFind(this) 
+        and C2<'T>(orig : 'T) =  
+            [<DefaultValue(false)>] 
+            val mutable parent : C<'T> 
+            let MyFind(x : C2<'T>) = (x.parent , x.parent.parent)
+            member this.Find() = MyFind(this) 
+
+    // These are variations on tests where a cycle of methods and "let" bindings across one or more test is an adapted version of the above trim-down
+    module RoundInCircles = 
+        type C<'T>() as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+
+    // Mutual recursion between two generic classes
+    module RoundInCircles2 = 
+        type C<'T>() as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+        and C2<'T>(x:C<'T>) as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(x))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(x) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(x))
+
+
+    // Mutual recursion between generic class and generic record type
+    module RoundInCircles3 = 
+        type C<'T>() as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+        and C2<'T> =
+            { x:C<'T> } 
+            member this.Meth1() = 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.x)
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.x))
+
+    // Mutual recursion between generic class and generic union type
+    module RoundInCircles4 = 
+        type C<'T>() as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+        and C2<'T> =
+            | Parition2 of C<'T> 
+            member this.Value =  match this with Parition2 x -> x
+            member this.Meth1() = 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.Value)
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.Value))
+
+    // Mutual recursion between generic class and generic union type, slight variation passing 'this' explicitly
+    module RoundInCircles5 = 
+        type C<'T>() =  
+            let someFuncValue = (); (fun (this:C<'T>)  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1 this = 
+                 someFuncValue this |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2 this = 
+                 someFunc2 this |> ignore;
+                 someFunc1 this
+            member this.Meth1() = someFunc2 this
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+        and C2<'T> =
+            | Parition2 of C<'T> 
+            member this.Value =  match this with Parition2 x -> x
+            member this.Meth1() = 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.Value)
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this.Value))
+
+    // Mutual recursion between generic class and generic struct
+    module RoundInCircles6 = 
+        type C<'T>() as this =  
+            let someFuncValue = (); (fun ()  -> 
+                 this.Prop1() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+            let someFunc1() = 
+                 someFuncValue() |> ignore
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this) 
+            let rec someFunc2() = 
+                 someFunc2() |> ignore;
+                 someFunc1() 
+            member this.Meth1() = someFunc2()
+            static member Meth2(this:C<'T>) = this.Meth1()
+            member this.Prop1 = (); (fun ()  -> 
+                 this.Meth1() |> ignore
+                 C<'T>.Meth2(this))
+        and C2<'T>(x:C<'T>) =  
+            struct
+                member this.Value = x
+                member this.Meth1() = x.Meth1()
+                static member Meth2(this:C<'T>) = this.Meth1()
+                member this.Prop1 = let v = this in (); (fun ()  -> 
+                     v.Meth1() |> ignore
+                     C<'T>.Meth2(v.Value))
+            end
+
+module CheckGeneralizationOfMembersInRecursiveGroupsWhichIncludeImplicitConstructorsAndStaticMembers = 
+
+    open System.Collections
+    open System.Collections.Generic
+
+    type IA<'T> = interface abstract M2 : int -> int end
+
+    type X<'T>() =
+        let mutable redirectTo : X<'T> = Unchecked.defaultof<_>
+        static let instance = X<'T>()
+        static member Instance = instance
+        member x.M1() = if true then redirectTo else x
+        member x.M2() = if true then redirectTo else x
+        interface IA<int> with
+            member x.M2 y = y
+
+
+    [<Struct>]
+    type S<'T>(redirectTo : list<S<'T>>) =
+        static let instance = S<'T>(List.empty<S<'T>>)
+        static member Instance = instance
+        member x.M() = if true then redirectTo.[0] else x
+
+
+    // This test raised a code generation assert
+    module DontGeneralizeTypeVariablesBoundByInnerPositions_2 = 
+        type C<'T>() =  
+            static let someStaticFuncValue = C<'T>.Meth2()
+            let someFuncValue = C<'T>.Meth2() // someFuncValue initially has variable type. This type is not generalized.
+            static member SomeStaticFuncValue = someStaticFuncValue            
+            static member Meth2() = C<'T>.Meth2() 
+        and C2<'T>() =
+            static member Meth1() = C<'T>.Meth2()
+
+    module Misc = 
+    
+        type Foo<'a>() =
+          static let theInstance = new Foo<'a>()
+          static member Instance = theInstance
+          
+        type Bar<'a,'b>() =
+          static let theInstance = new Bar<'a,'b>()
+          static member Instance = theInstance
+          
+        // Equi-recursive type defs
+        type Rec1<'a>() = 
+          static let rec2Instance = new Rec2<'a>()
+          static let rec1Instance = new Rec1<'a>()  
+          static member Rec2Instance = rec2Instance
+          static member Rec1Instance = rec1Instance
+        
+        and Rec2<'a>() =
+          static let rec1Instance = new Rec1<'a>()
+          static let rec2Instance = new Rec2<'a>()
+          static member Rec1Instance = rec1Instance
+          static member Rec2Instance = rec2Instance   
+          
+        // recursive type defs - multi tyargs
+        type Rec1AB<'a,'b>() = 
+          static let rec2Instance = new Rec2B<'a>()
+          static let rec1Instance = new Rec1AB<'a,'b>()  
+          static member Rec2Instance = rec2Instance
+          static member Rec1Instance = rec1Instance
+        
+        and Rec2B<'a>() =
+          static let rec2Instance = new Rec2B<'a>()
+          static member Rec2Instance = rec2Instance     
+          
+        // functions
+        type FooFunc<'a>() =
+            static let fact() = new FooFunc<'a>()
+            static member factory() = fact()
+        
+        // test methods    
+        type FooFunc2<'a>() =
+            static let fact = new FooFunc2<'a>()
+            static member factory() = fact
+                        
+        type BarFunc<'a,'b>() =
+          static let fact() = new BarFunc<'a,'b>()
+          static member factory() = fact()
+          
+        // Equi-recursive type defs
+        type Rec1Func<'a>() = 
+          static let rec2Instance() = new Rec2Func<'a>()
+          static let rec1Instance() = new Rec1Func<'a>()  
+          static member Rec2Instance() = rec2Instance()
+          static member Rec1Instance() = rec1Instance()        
+        and Rec2Func<'a>() =
+          static let rec1Instance() = new Rec1Func<'a>()
+          static let rec2Instance() = new Rec2Func<'a>()
+          static member Rec1Instance() = rec1Instance()
+          static member Rec2Instance() = rec2Instance()
+          
+        // recursive type defs - multi tyargs
+        type Rec1ABFunc<'a,'b>() = 
+          static let rec2Instance() = new Rec2BFunc<'a>()
+          static let rec1Instance() = new Rec1ABFunc<'a,'b>()  
+          static member Rec2Instance() = rec2Instance()
+          static member Rec1Instance() = rec1Instance()        
+        and Rec2BFunc<'a>() =
+          static let rec2Instance() = new Rec2BFunc<'a>()
+          static member Rec2Instance() = rec2Instance()
+
+module Devdiv2_Bug_41009 = 
+    type Rope<'T> = 
+        { x : int }
+        member x.Empty  : Rope<_> = failwith "" // the type variable for "_" is ungeneralized because this is a property
+        member x.Create(lhs:Rope<'T>) : Rope<'T> =
+            x.Empty  // here the type variable for "_" gets instantiated to 'T, but this gets generalized. This must not be considered an escaping variable
+
+
+module Devdiv2_Bug_10649 = 
+
+    // This should compile, because it compiles with F# 2.0. A has been generalized too early, 
+    // but all recursive uses of the member end up consistent with the final inferred type
+    module InstanceMembersEarlyGeneralizationPotentiallyInvalidButUltimatelyConsistent = 
+        type C<'T>() = 
+            let mutable x = Unchecked.defaultof<_> // this inference variable ultimately becomes 'obj'
+            member this.A() = x
+            member this.B1(c:C<string>) = c.A() 
+            member this.B2(c:C<int>) = c.A() 
+
+    // This should compile, because it compiles with F# 2.0. A has been generalized too early, 
+    // but all recursive uses of the member end up consistent with the final inferred type
+    module StaticMembersEarlyGeneralizationPotentiallyInvalidButUltimatelyConsistent = 
+        type C<'T>() = 
+            static let mutable x = Unchecked.defaultof<_> // this inference variable ultimately becomes 'obj'
+            static member A() = x
+            static member B1() = C<string>.A()
+            static member B2() = C<int>.A()
+
+    // This should compile, because it early generalization is valid for A
+    module InstanceMembersEarlyGeneralizationValid = 
+        type C<'T>() = 
+            member this.A() = 1
+            member this.B1(c:C<string>) = c.A() 
+            member this.B2(c:C<int>) = c.A() 
+
+    // This should compile, because it early generalization is valid for A
+    module StaticMembersEarlyGeneralizationValid = 
+        type C<'T>() = 
+            static member A() = 1
+            static member B1() = C<string>.A()
+            static member B2() = C<int>.A()
+
+
+module Devdiv2_Bug_5385 =
+    let memoize (f: 'a -> 'b) = 
+        let t = new System.Collections.Generic.Dictionary<'a, 'b>()
+        fun n ->
+            if t.ContainsKey(n) then 
+                t.[n]
+            else
+                let res = f n
+                t.[n] <- res
+                res
+
+    // In this variation, 
+    //     -- 'f' is generic even though it is in the same mutually recursive group as the computed function 'g', because although 'f' calls 'g', its type doesn't involve any type from 'g'
+    //     -- 'g' is not generic since 'g' is computed
+    let test3e () =
+        let count = ref 0
+        let rec f (x: 'T) =  
+                incr count; 
+                if !count > 4 then 
+                    1 
+                else 
+                    g "1" |> ignore; // note, use of non-generic 'g' within a generic, generalized memoized function
+                    2
+
+        and g : string -> int = memoize f // note, computed function value using generic �f� at an instance
+        g "1"                                        
+
+    let res = test3e()
+
+    check "fe09ekn" res 2
+
+    printfn "test passed ok without NullReferenceException"
+
+module Devdiv2_5385_repro2 = 
+
+    open System
+    type Dispatch<'t, 'a> = 't -> ('t -> Lazy<'a>) -> 'a 
+
+    let internal driver (mkString : 't -> string) (dispatch : Dispatch<'t, 'a>) (t : 't) : 'a = 
+            let rec driver2 (seen : Map<string,Lazy<'a>>) (t : 't) : Lazy<'a> = 
+                let tKey = mkString t 
+                let find = seen.TryFind tKey 
+                match find with 
+                    | Some x -> x 
+                    | None -> 
+                        let rec seen2 = seen.Add(tKey,res) 
+                            and res = lazy dispatch t (driver2 seen2) 
+                        res 
+            (driver2 (Map.empty) t).Value 
+
+
+
+    let res : int = driver (fun t -> t.ToString()) (fun t f -> if t > 50 then (f (t/2)).Value else t) 100 
+
+    check "kjnecwwe9" res 50
+
+    printfn "test passed ok without NullReferenceException"
+
+
+let _ = 
+  if not failures.IsEmpty then (eprintfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs
new file mode 100644
index 0000000..4fbd8f4
--- /dev/null
+++ b/tests/fsharp/core/members/basics/test.fs
@@ -0,0 +1,3366 @@
+// #Conformance #SignatureFiles #Classes #ObjectConstructors #ObjectOrientedTypes #Fields #MemberDefinitions #MethodsAndProperties #Unions #InterfacesAndImplementations #Events #Overloading #Recursion #Regression 
+module Global
+
+
+#nowarn "62"
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+let check s b1 b2 = if b1 = b2  then eprintfn "%s: OK, b1 = %A, b2 = %A" s b1 b2 else (eprintfn "FAIL %s: b1 = %A, b2 = %A" s b1 b2; report_failure())
+
+//--------------------------------------------------------------
+// Test defining a record using object-expression syntax
+
+type RecordType = { a: int; mutable b: int }
+
+let rval = { new RecordType with a = 1 and b = 2 }
+
+do test "fweoew091" (rval.a = 1)
+do test "fweoew092" (rval.b = 2)
+do rval.b <- 3
+do test "fweoew093" (rval.b = 3)
+
+type RecordType2<'a,'b> = { a: 'a; mutable b: 'b }
+
+let rval2 = { new RecordType2<int,int> with a = 1 and b = 2 }
+
+do test "fweoew091" (rval2.a = 1)
+do test "fweoew092" (rval2.b = 2)
+do rval2.b <- 3
+do test "fweoew093" (rval2.b = 3)
+
+let f(x) = 
+  { new RecordType2<'a,int> with a = x and b = 2 }
+
+do test "fweoew091" ((f(1)).a = 1)
+do test "fweoew092" ((f(1)).b = 2)
+do (f(1)).b <- 3
+do test "fweoew093" ((f(1)).b = 2)
+
+
+open System
+open System.Collections
+open System.Windows.Forms
+
+//-----------------------------------------
+// Some simple object-expression tests
+
+let x0 = { new System.Object() with member __.GetHashCode() = 3 }
+let x1 = { new System.Windows.Forms.Form() with member __.GetHashCode() = 3 }
+
+//-----------------------------------------
+// Test defining an F# class
+
+
+type ClassType1 =
+  class
+     inherit System.Object 
+     val someField : string
+
+     interface IEnumerable 
+
+     abstract VirtualMethod1: string -> int
+     abstract VirtualMethod2: string * string -> int
+     abstract VirtualMethod1PostHoc: string -> int
+     abstract VirtualMethod2PostHoc: string * string -> int
+     default x.VirtualMethod1(s) = 3
+     default x.VirtualMethod2(s1,s2) = 3
+
+     new(s: string) = { inherit System.Object(); someField = "abc" }
+  end
+
+type ClassType1
+  with 
+     default x.VirtualMethod1PostHoc(s) = 3
+     default x.VirtualMethod2PostHoc(s1,s2) = 3
+     new(s1,s2) = { inherit System.Object(); someField = "constructor2" + s1 + s2 }
+  end
+
+type ClassType1
+  with 
+     interface IEnumerable with 
+        member x.GetEnumerator() = failwith "no implementation"
+     end
+
+  end
+
+let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 }
+let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 }
+let x4 = { new ClassType1("a") with 
+               member __.VirtualMethod1(s) = 5 
+               member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length }
+
+
+
+do test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+
+do test "e09wckj2ddwdw" (try ignore(((x2 :> obj) :?> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+do test "e09wckj2defwe" (x2.VirtualMethod1("abc") = 3)
+do test "e09wckd2jfew3" (x3.VirtualMethod1("abc") = 4)
+do test "e09wckf3q2j" (x4.VirtualMethod1("abc") = 5)
+do test "e09wckj321" (x4.VirtualMethod2("abc","d") = 4)
+
+
+//-----------------------------------------
+// Test inheriting from an F# type
+
+
+type ClassType2 =
+  class
+     inherit ClassType1 
+     val someField2 : string
+
+     override x.VirtualMethod1(s) = 2001
+     override x.VirtualMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2
+
+     new(s) = { inherit ClassType1(s); someField2 = s }
+  end
+
+
+let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 }
+let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 }
+let x42 = { new ClassType2("abcd")  with
+              member __.VirtualMethod1(s) = 5004 
+              member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length }
+
+do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true)
+do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true)
+
+do test "e09wckjd3" (x22.VirtualMethod1("abc") = 2001)
+do test "e09wckjd3" (x32.VirtualMethod1("abc") = 4002)
+do test "e09wckjfew" (x42.VirtualMethod1("abc") = 5004)
+do test "e09wckjd3" (x22.VirtualMethod2("abcd","dqw") = 8)
+do test "e09wckjd3" (x32.VirtualMethod2("abcd","dqw") = 10)
+
+
+
+//-----------------------------------------
+// Test defining an F# class
+
+
+module AbstractClassTest = begin
+
+    [<AbstractClass>]
+    type ClassType1 =
+      class
+         inherit System.Object 
+         val someField : string
+
+         interface IEnumerable 
+
+         abstract AbstractMethod1: string -> int
+         abstract AbstractMethod2: string * string -> int
+
+         new(s: string) = { inherit System.Object(); someField = "abc" }
+      end
+
+    type ClassType1
+      with 
+         interface IEnumerable with 
+            member x.GetEnumerator() = failwith "no implementation"
+         end
+
+      end
+
+    //let shouldGiveError1 = { new ClassType1("a") with GetHashCode() = 3 }
+    //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 }
+    //let shouldGiveError3a = new ClassType1("a")
+    let x4 = { new ClassType1("a") with 
+                  member __.AbstractMethod1(s) = 5 
+                  member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length }
+
+
+    do test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+
+    do test "e09wckj2ddwdw" (try ignore(((x2 :> obj) :?> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true)
+    do test "e09wckf3q2j" (x4.AbstractMethod1("abc") = 5)
+    do test "e09wckj321" (x4.AbstractMethod2("abc","d") = 4)
+
+
+    type ClassType2 =
+      class
+         inherit ClassType1 
+         val someField2 : string
+
+         override x.AbstractMethod1(s) = 2001
+         override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2
+
+         new(s) = { inherit ClassType1(s); someField2 = s }
+      end
+
+
+    let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 }
+    let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 }
+    let x42 = { new ClassType2("abcd")  with
+                  member __.AbstractMethod1(s) = 5004 
+                  member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length }
+
+    do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true)
+    do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true)
+
+    do test "e09wckjd3" (x22.AbstractMethod1("abc") = 2001)
+    do test "e09wckjd3" (x32.AbstractMethod1("abc") = 4002)
+    do test "e09wckjfew" (x42.AbstractMethod1("abc") = 5004)
+    do test "e09wckjd3" (x22.AbstractMethod2("abcd","dqw") = 8)
+    do test "e09wckjd3" (x32.AbstractMethod2("abcd","dqw") = 10)
+
+    type ClassType3 =
+      class
+         inherit ClassType2
+         val someField3 : string
+
+         override x.AbstractMethod1(s) = 2001
+         override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 + x.someField3.Length
+
+         new(s) = { inherit ClassType2(s); someField3 = s }
+      end
+
+
+
+end
+
+//-----------------------------------------
+//-----------------------------------------
+
+
+
+
+// Various rejected syntaxes for constructors:
+//   new(s: string) = { base=new Form(); x = "abc" }
+//   new ClassType1(s: string) : base() = { x = "abc" }
+//   new(s: string) = { inherit Form(); x = "abc" }
+//   member ClassType1(s: string) = new { inherit Form(); x = "abc" }
+//   member ClassType1(s: string) = { inherit Form(); x = "abc" }
+//   initializer(s: string) = { inherit Form(); x = "abc" }
+//   new ClassType1(s: string) = { inherit Form(); x = "abc" }
+
+//     new(s: string) = { inherit Form(); x = "abc" }
+
+//     new((s: string), (s2:string)) = { inherit Form(); x = s }
+
+
+//     abstract AbstractProperty: string
+//     abstract AbstractMutableProperty: string with get,set
+
+
+//     new(s: string) = { new ClassType1 with base=new Object() and x = "abc" }
+//     new(s: string) = { new ClassType1 with base=new Form() and x = "abc" }
+//     new(s: string) = ((new System.Object()) :?> ClassType1)
+ 
+
+//-----------------------------------------
+// Thorough testing of members for records.
+
+module RecordTypeTest = begin
+
+    type AbstractType = 
+      { instanceField: string;
+        mutable mutableInstanceField: string;
+        instanceArray: string array;
+        instanceArray2: string array array;
+        mutableInstanceArray: string array;
+        mutableInstanceArray2: string array array; 
+        recursiveInstance: AbstractType;
+        }
+
+    let staticField = "staticField"
+    let mutableStaticField = ref "mutableStaticFieldInitialValue"
+    let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |]
+    let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |]
+
+    let NewAbstractValue(s) = 
+      let rec self =
+        { instanceField=s;
+          mutableInstanceField=s;
+          instanceArray=[| s;s |];
+          instanceArray2=[| [| s;s |];[| s;s |] |];
+          mutableInstanceArray =[| s;s |];
+          mutableInstanceArray2 =[| [| s;s |];[| s;s |] |]; 
+          recursiveInstance=self;
+        } in 
+      self
+
+    type AbstractType 
+     with 
+      // properties
+      override x.ToString() = x.instanceField
+      member x.InstanceProperty = x.instanceField^".InstanceProperty"
+      member x.RecursiveInstance = x.recursiveInstance
+      member x.RecursiveInstanceMethod() = x.recursiveInstance
+      member x.MutableInstanceProperty
+        with get() = x.mutableInstanceField
+        and set(v:string) = x.mutableInstanceField <- v
+        
+      member x.InstanceIndexerCount = Array.length x.instanceArray
+
+      member x.InstanceIndexer
+         with get(idx) = x.instanceArray.[idx]
+      member x.InstanceIndexer2
+         with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2]
+      member x.InstanceIndexer2Count1 = 2
+      member x.InstanceIndexer2Count2 = 2
+
+      member x.MutableInstanceIndexerCount = Array.length x.mutableInstanceArray
+
+      member x.MutableInstanceIndexer
+         with get (idx1) = x.mutableInstanceArray.[idx1]
+         and  set (idx1) (v:string) = x.mutableInstanceArray.[idx1] <- v
+
+      member x.MutableInstanceIndexer2
+         with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2]
+         and  set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v
+      member x.MutableInstanceIndexer2Count1 = 2
+      member x.MutableInstanceIndexer2Count2 = 2
+
+      static member StaticProperty = staticField
+      static member MutableStaticProperty
+        with get() = !mutableStaticField
+        and  set(v:string) = mutableStaticField := v
+        
+      static member StaticIndexer
+         with get(idx) = staticArray.[idx]
+         
+      static member StaticIndexerCount = Array.length staticArray
+
+      static member MutableStaticIndexer
+         with get(idx:int) = mutableStaticArray.[idx]
+         and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member MutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.InstanceMethod(s1:string) = Printf.sprintf "%s.InstanceMethod(%s)" x.instanceField s1
+      static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+      // private versions of the above
+      member x.PrivateInstanceProperty = x.instanceField^".InstanceProperty"
+      member x.PrivateMutableInstanceProperty
+        with get() = x.mutableInstanceField
+        and  set(v:string) = x.mutableInstanceField <- v
+        
+      member x.PrivateInstanceIndexerCount = Array.length x.instanceArray
+
+      member x.PrivateInstanceIndexer
+         with get(idx) = x.instanceArray.[idx]
+      member x.PrivateInstanceIndexer2
+         with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2]
+      member x.PrivateInstanceIndexer2Count1 = 2
+      member x.PrivateInstanceIndexer2Count2 = 2
+
+      member x.PrivateMutableInstanceIndexerCount = Array.length x.mutableInstanceArray
+
+      member x.PrivateMutableInstanceIndexer
+         with get (idx1) = x.mutableInstanceArray.[idx1]
+         and  set (idx1) (v:string) = x.mutableInstanceArray.[idx1] <- v
+
+      member x.PrivateMutableInstanceIndexer2
+         with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2]
+         and  set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v
+      member x.PrivateMutableInstanceIndexer2Count1 = 2
+      member x.PrivateMutableInstanceIndexer2Count2 = 2
+
+      static member PrivateStaticProperty = staticField
+      static member PrivateMutableStaticProperty
+        with get() = !mutableStaticField
+        and  set(v:string) = mutableStaticField := v
+        
+      static member PrivateStaticIndexer
+         with get(idx) = staticArray.[idx]
+         
+      static member PrivateStaticIndexerCount = Array.length staticArray
+
+      static member PrivateMutableStaticIndexer
+         with get(idx:int) = mutableStaticArray.[idx]
+         and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "%s.InstanceMethod(%s)" x.instanceField s1
+      static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+
+     end
+
+
+
+    // Test accesses of static properties, methods
+    do System.Console.WriteLine("AbstractType.StaticProperty = {0}", AbstractType.StaticProperty)
+    do AbstractType.MutableStaticProperty <- "MutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.StaticIndexer(0) = {0}", AbstractType.StaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.StaticMethod(abc,def) = {0}", AbstractType.StaticMethod("abc","def") )
+    do System.Console.WriteLine("AbstractType.PrivateStaticProperty = {0}", AbstractType.PrivateStaticProperty )
+    do AbstractType.PrivateMutableStaticProperty <- "PrivateMutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.PrivateStaticIndexer(0) = {0}", AbstractType.PrivateStaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.PrivateStaticMethod(abc,def) = {0}", AbstractType.PrivateStaticMethod("abc","def") )
+
+    // Torture this poor object
+    let xval = NewAbstractValue("abc")
+
+    // Test dynamic rediscovery of type
+    do test "e09wckdw" (not ((xval :> obj) :? IEnumerable))
+    do test "e09wckdwddw" (not ((xval :> obj) :? string))
+    do test "e09dwdw" (not ((xval :> obj) :? list<int>))
+    do test "e09dwwd2" ((xval :> obj) :? AbstractType)
+
+    // Test access of instance properties, methods through variables
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do xval.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do xval.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do xval.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do xval.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do xval.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc..PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path field lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.recursiveInstance.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.recursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.recursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.recursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.recursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do xval.recursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.recursiveInstance.MutableInstanceIndexer(0) )
+    do xval.recursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.recursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.recursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.recursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.recursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.recursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.recursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.recursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.recursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.recursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+    do xval.recursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.recursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.recursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.recursiveInstance.PrivateMutableInstanceProperty )
+
+
+    // repeat all the above through a long-path property lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", xval.RecursiveInstance.instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path method lookup
+    do System.Console.WriteLine("abc.instanceField = {0}", (xval.RecursiveInstanceMethod()).instanceField)
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", (xval.RecursiveInstanceMethod()).InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+
+end
+
+//-----------------------------------------
+// Thorough testing of members for records.
+
+module UnionTypeTest = begin
+
+    type AbstractType =  A of AbstractType | B of string
+
+    let staticField = "staticField"
+    let mutableStaticField = ref "mutableStaticFieldInitialValue"
+    let staticArray = [| "staticArrayElement1"; "staticArrayElement2" |]
+    let mutableStaticArray = [| "mutableStaticArrayElement1InitialValue"; "mutableStaticArrayElement2InitialValue" |]
+
+    let NewAbstractValue(s) = B(s)
+
+    type AbstractType 
+     with 
+      // properties
+      override x.ToString() = match x with A _ -> "A" | B(s) -> "B"
+      member x.InstanceProperty = "instanceProperty"
+      member x.RecursiveInstance = match x with A y -> y | B s -> x
+      member x.RecursiveInstanceMethod() =  x.RecursiveInstance
+      member x.MutableInstanceProperty
+        with get() = x.InstanceProperty
+        and  set(v:string) = Printf.printf "called MutableInstanceProperty.set\n"
+        
+      member x.InstanceIndexerCount = 1
+
+      member x.InstanceIndexer
+         with get(idx) = "a"
+      member x.InstanceIndexer2
+         with get(idx1,idx2) = "a"
+      member x.InstanceIndexer2Count1 = 2
+      member x.InstanceIndexer2Count2 = 2
+
+      member x.MutableInstanceIndexerCount = 1
+
+      member x.MutableInstanceIndexer
+         with get (idx1) = "a"
+         and  set (idx1) (v:string) =  Printf.printf "called MutableInstanceIndexer.set\n"
+
+      member x.MutableInstanceIndexer2
+         with get (idx1,idx2) = "a"
+         and  set (idx1,idx2) (v:string) =  Printf.printf "called MutableInstanceIndexer2.set\n"
+      member x.MutableInstanceIndexer2Count1 = 2
+      member x.MutableInstanceIndexer2Count2 = 2
+
+      static member StaticProperty = staticField
+      static member MutableStaticProperty
+        with get() = !mutableStaticField
+        and  set(v:string) = mutableStaticField := v
+        
+      static member StaticIndexer
+         with get(idx) = staticArray.[idx]
+         
+      static member StaticIndexerCount = Array.length staticArray
+
+      static member MutableStaticIndexer
+         with get(idx:int) = mutableStaticArray.[idx]
+         and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member MutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1
+      static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+      // private versions of the above
+      member x.PrivateInstanceProperty = "InstanceProperty"
+      member x.PrivateMutableInstanceProperty
+        with get() = "a"
+        and  set(v:string) = Printf.printf "called mutator\n"
+        
+      member x.PrivateInstanceIndexerCount = 1
+
+      member x.PrivateInstanceIndexer
+         with get(idx) = "b"
+      member x.PrivateInstanceIndexer2
+         with get(idx1,idx2) = "c"
+      member x.PrivateInstanceIndexer2Count1 = 1
+      member x.PrivateInstanceIndexer2Count2 = 1
+
+      member x.PrivateMutableInstanceIndexerCount = 3
+
+      member x.PrivateMutableInstanceIndexer
+         with get (idx1) = "a"
+         and  set (idx1) (v:string) = Printf.printf "called mutator\n"
+
+      member x.PrivateMutableInstanceIndexer2
+         with get (idx1,idx2) = "a"
+         and  set (idx1,idx2) (v:string) = Printf.printf "called mutator\n"
+      member x.PrivateMutableInstanceIndexer2Count1 = 2
+      member x.PrivateMutableInstanceIndexer2Count2 = 2
+
+      static member PrivateStaticProperty = staticField
+      static member PrivateMutableStaticProperty
+        with get() = !mutableStaticField
+        and  set(v:string) = mutableStaticField := v
+        
+      static member PrivateStaticIndexer
+         with get(idx) = staticArray.[idx]
+         
+      static member PrivateStaticIndexerCount = Array.length staticArray
+
+      static member PrivateMutableStaticIndexer
+         with get(idx:int) = mutableStaticArray.[idx]
+         and  set(idx:int) (v:string) = mutableStaticArray.[idx] <- v
+
+      static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray
+
+      // methods
+      member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)"  s1
+      static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2
+
+    end
+
+
+
+    // Test accesses of static properties, methods
+    do System.Console.WriteLine("AbstractType.StaticProperty = {0}", AbstractType.StaticProperty)
+    do AbstractType.MutableStaticProperty <- "MutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.StaticIndexer(0) = {0}", AbstractType.StaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.StaticMethod(abc,def) = {0}", AbstractType.StaticMethod("abc","def") )
+    do System.Console.WriteLine("AbstractType.PrivateStaticProperty = {0}", AbstractType.PrivateStaticProperty )
+    do AbstractType.PrivateMutableStaticProperty <- "PrivateMutableStaticProperty (mutated!)"
+    do System.Console.WriteLine("AbstractType.PrivateStaticIndexer(0) = {0}", AbstractType.PrivateStaticIndexer(0) )
+    do System.Console.WriteLine("AbstractType.PrivateStaticMethod(abc,def) = {0}", AbstractType.PrivateStaticMethod("abc","def") )
+
+    // Torture this poor object
+    let xval = NewAbstractValue("abc")
+
+    // Test dynamic rediscovery of type
+    do test "e09wckdw" (not ((xval :> obj) :? IEnumerable))
+    do test "e09wckdwddw" (not ((xval :> obj) :? string))
+    do test "e09dwdw" (not ((xval :> obj) :? list<int>))
+    do test "e09dwwd2" ((xval :> obj) :? AbstractType)
+
+    // Test access of instance properties, methods through variables
+
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do xval.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do xval.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do xval.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do xval.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do xval.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc..PrivateMutableInstanceProperty = {0}", xval.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path field lookup
+
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+
+    // repeat all the above through a long-path property lookup
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", xval.RecursiveInstance.InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", xval.RecursiveInstance.InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", xval.RecursiveInstance.InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do xval.RecursiveInstance.MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", xval.RecursiveInstance.MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", xval.RecursiveInstance.MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", xval.RecursiveInstance.MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", xval.RecursiveInstance.PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", xval.RecursiveInstance.PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", xval.RecursiveInstance.PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do xval.RecursiveInstance.PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", xval.RecursiveInstance.PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", xval.RecursiveInstance.PrivateMutableInstanceProperty )
+
+    // repeat all the above through a long-path method lookup
+    do System.Console.WriteLine("abc.InstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).InstanceMethod("def") )
+    do System.Console.WriteLine("abc.InstanceProperty = {0}", (xval.RecursiveInstanceMethod()).InstanceProperty )
+    do System.Console.WriteLine("abc.InstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer(0) )
+    do System.Console.WriteLine("abc.InstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).InstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.MutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.MutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).MutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceMethod(def) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceMethod("def") )
+    do System.Console.WriteLine("abc.PrivateInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer(0) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateInstanceIndexer2(0,1) = {0}", (xval.RecursiveInstanceMethod()).PrivateInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty <- "MutableInstanceProperty (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) <- "MutableInstanceIndexer(0) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer(0) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) <- "MutableInstanceIndexer2(0,1) (mutated!)"
+    do System.Console.WriteLine("abc.PrivateMutableInstanceIndexer2 = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceIndexer2(0,1) )
+    do System.Console.WriteLine("abc.PrivateMutableInstanceProperty = {0}", (xval.RecursiveInstanceMethod()).PrivateMutableInstanceProperty )
+
+end
+
+
+//---------------------------------------------------------------------
+// Test that we can change the default structural comparison semantics
+
+
+module OverrideIComparableOnClassTest = begin
+
+  type MyStringClass = 
+    class 
+      val cache: int 
+      val v: string 
+      interface IComparable with 
+         member x.CompareTo(y:obj) = compare x.v (y :?> MyStringClass).v 
+      end 
+      override x.GetHashCode() = hash(x.v) 
+      override x.Equals(y:obj) = (compare x.v (y :?> MyStringClass).v) = 0
+      member x.Length = x.cache
+      new(s:string) = { inherit Object(); cache=s.Length; v=s }
+    end
+
+  let s1 = new MyStringClass("abc")
+  let s2 = new MyStringClass("def")
+  let s3 = new MyStringClass("abc")
+  let s4 = new MyStringClass("abcd")
+  do test "cepoiwelk" (s1.Length = 3)
+  do test "cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringClass) (s2:MyStringClass) = 
+    test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "cepoiwelk6a" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIStructuralComparableOnClassTest = begin
+
+  type MyStringClass = 
+    class 
+      val cache: int 
+      val v: string 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringClass).v 
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) 
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringClass).v) = 0
+      end 
+      member x.Length = x.cache
+      new(s:string) = { inherit Object(); cache=s.Length; v=s }
+    end
+
+  let s1 = new MyStringClass("abc")
+  let s2 = new MyStringClass("def")
+  let s3 = new MyStringClass("abc")
+  let s4 = new MyStringClass("abcd")
+  do test "cepoiwelk" (s1.Length = 3)
+  do test "cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringClass) (s2:MyStringClass) = 
+    test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "cepoiwelk6a" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIComparableOnStructTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringStruct = 
+    struct
+      val cache: int 
+      val v: string 
+      interface IComparable with 
+         member x.CompareTo(y:obj) = compare x.v (y :?> MyStringStruct).v 
+      end 
+      override x.GetHashCode() = hash(x.v) 
+      override x.Equals(y:obj) = (compare x.v (y :?> MyStringStruct).v) = 0
+      member x.Length = x.cache
+      new(s:string) = { cache=s.Length; v=s }
+    end
+
+  let s1 = new MyStringStruct("abc")
+  let s2 = new MyStringStruct("def")
+  let s3 = new MyStringStruct("abc")
+  let s4 = new MyStringStruct("abcd")
+  do test "cepoiwelk" (s1.Length = 3)
+  do test "cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringStruct) (s2:MyStringStruct) = 
+    test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "cepoiwelk6a" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIStructuralComparableOnStructTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringStruct = 
+    struct
+      val cache: int 
+      val v: string 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringStruct).v 
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) 
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringStruct).v) = 0
+      end 
+      member x.Length = x.cache
+      new(s:string) = { cache=s.Length; v=s }
+    end
+
+  let s1 = new MyStringStruct("abc")
+  let s2 = new MyStringStruct("def")
+  let s3 = new MyStringStruct("abc")
+  let s4 = new MyStringStruct("abcd")
+  do test "cepoiwelk" (s1.Length = 3)
+  do test "cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringStruct) (s2:MyStringStruct) = 
+    test "cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "cepoiwelk6a" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIComparableOnRecordTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringRecord = { cache: int; v: string  }
+    with 
+      interface IComparable with 
+         member x.CompareTo(y:obj) = compare x.v (y :?> MyStringRecord).v 
+      end 
+      override x.GetHashCode() = hash(x.v) 
+      override x.Equals(y:obj) = (compare x.v (y :?> MyStringRecord).v) = 0
+      member x.Length = x.cache
+      static member Create(s:string) = { cache=s.Length; v=s }
+    end
+
+
+  let s1 = MyStringRecord.Create("abc")
+  let s2 = MyStringRecord.Create("def")
+  let s3 = MyStringRecord.Create("abc")
+  let s4 = MyStringRecord.Create("abcd")
+  do test "recd-cepoiwelk" (s1.Length = 3)
+  do test "recd-cepoiwelk" (s2.Length = 3)
+  let testc s1 s2 = 
+    test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "recd-cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "recd-cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "recd-cepoiwelk6b" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "recd-cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIStructuralComparableOnRecordTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringRecord = { cache: int; v: string  }
+    with 
+      interface IStructuralComparable with 
+         member x.CompareTo(y:obj,comp:System.Collections.IComparer) = compare x.v (y :?> MyStringRecord).v 
+      end 
+      interface IStructuralEquatable with 
+         member x.GetHashCode(comp:System.Collections.IEqualityComparer) = hash(x.v) 
+         member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) = (compare x.v (y :?> MyStringRecord).v) = 0
+      end 
+      member x.Length = x.cache
+      static member Create(s:string) = { cache=s.Length; v=s }
+    end
+
+
+  let s1 = MyStringRecord.Create("abc")
+  let s2 = MyStringRecord.Create("def")
+  let s3 = MyStringRecord.Create("abc")
+  let s4 = MyStringRecord.Create("abcd")
+  do test "recd-cepoiwelk" (s1.Length = 3)
+  do test "recd-cepoiwelk" (s2.Length = 3)
+  let testc s1 s2 = 
+    test "recd-cepoiwelk1" ((s1 = s2) = (s1.v = s2.v));
+    test "recd-cepoiwelk2" ((s1 < s2) = (s1.v < s2.v));
+    test "recd-cepoiwelk3" ((s1 > s2) = (s1.v > s2.v));
+    test "recd-cepoiwelk4" ((s1 <= s2) = (s1.v <= s2.v));
+    test "recd-cepoiwelk5" ((s1 >= s2) = (s1.v >= s2.v));
+    test "recd-cepoiwelk6b" ((s1 <> s2) = (s1.v <> s2.v));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.v = %d\n" (hash(s1.v));
+    test "recd-cepoiwelk7" (hash(s1) = hash(s1.v));
+    test "recd-cepoiwelk8" (hash(s2) = hash(s2.v)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIComparableOnUnionTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringUnion = A of int * string | B of int * string
+    with 
+      member x.Value = match x with A(_,s) | B(_,s) -> s 
+      override x.GetHashCode() =
+            hash(x.Value)
+      override x.Equals(y:obj) =
+            x.Value = (y :?> MyStringUnion).Value
+      interface IComparable with
+        member x.CompareTo(y:obj) = 
+            compare x.Value (y :?> MyStringUnion).Value
+      end      
+      member x.Length = match x with A(n,_) | B(n,_) -> n
+      static member Create(s:string) = A(s.Length,s)
+    end
+
+
+  let s1 = MyStringUnion.Create("abc")
+  let s2 = MyStringUnion.Create("def")
+  let s3 = MyStringUnion.Create("abc")
+  let s4 = MyStringUnion.Create("abcd")
+  do test "union-cepoiwelk" (s1.Length = 3)
+  do test "union-cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringUnion) (s2:MyStringUnion) = 
+    test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value));
+    test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value));
+    test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value));
+    test "union-cepoiwelk4" ((s1 <= s2) = (s1.Value <= s2.Value));
+    check "union-cepoiwelk5" (s1 >= s2) (s1.Value >= s2.Value);
+    check "union-cepoiwelk5b" (compare s1 s2) (compare s1.Value s2.Value);
+    test "union-cepoiwelk6c" ((s1 <> s2) = (s1.Value <> s2.Value));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.Value = %d\n" (hash(s1.Value));
+    test "union-cepoiwelk7" (hash(s1) = hash(s1.Value));
+    test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+module OverrideIStructuralComparableOnUnionTest = begin
+
+  [<CustomEquality; CustomComparison>]
+  type MyStringUnion = A of int * string | B of int * string
+    with 
+      member x.Value = match x with A(_,s) | B(_,s) -> s 
+      interface IStructuralEquatable with
+        member x.GetHashCode(comp:System.Collections.IEqualityComparer) =
+            hash(x.Value)
+        member x.Equals(y:obj,comp:System.Collections.IEqualityComparer) =
+            x.Value = (y :?> MyStringUnion).Value
+      end      
+      interface IStructuralComparable with
+        member x.CompareTo(y:obj,comp:System.Collections.IComparer) = 
+            compare x.Value (y :?> MyStringUnion).Value
+      end      
+      member x.Length = match x with A(n,_) | B(n,_) -> n
+      static member Create(s:string) = A(s.Length,s)
+    end
+
+
+  let s1 = MyStringUnion.Create("abc")
+  let s2 = MyStringUnion.Create("def")
+  let s3 = MyStringUnion.Create("abc")
+  let s4 = MyStringUnion.Create("abcd")
+  do test "union-cepoiwelk" (s1.Length = 3)
+  do test "union-cepoiwelk" (s2.Length = 3)
+  let testc (s1:MyStringUnion) (s2:MyStringUnion) = 
+    test "union-cepoiwelk1" ((s1 = s2) = (s1.Value = s2.Value));
+    //test "union-cepoiwelk2" ((s1 < s2) = (s1.Value < s2.Value));
+    //test "union-cepoiwelk3" ((s1 > s2) = (s1.Value > s2.Value));
+    //test "union-cepoiwelk4" ((s1 <= s2) = (s1.Value <= s2.Value));
+    //check "union-cepoiwelk5" (s1 >= s2) (s1.Value >= s2.Value);
+    //check "union-cepoiwelk5b" (compare s1 s2) (compare s1.Value s2.Value);
+    test "union-cepoiwelk6c" ((s1 <> s2) = (s1.Value <> s2.Value));
+    Printf.printf "hash s1 = %d\n" (hash(s1));
+    Printf.printf "hash s1.Value = %d\n" (hash(s1.Value));
+    test "union-cepoiwelk7" (hash(s1) = hash(s1.Value));
+    test "union-cepoiwelk8" (hash(s2) = hash(s2.Value)) 
+
+  do testc s1 s2
+  do testc s1 s3
+  do testc s2 s3
+  do testc s2 s1 
+  do testc s3 s1 
+  do testc s3 s2 
+  do testc s4 s2 
+end
+
+//---------------------------------------------------------------------
+// Test we can define an attribute
+
+
+type DontPressThisButtonAttribute = 
+  class 
+    inherit System.Attribute
+    val v: string 
+    member x.Message = x.v
+    new(s:string) = { inherit System.Attribute(); v=s }
+  end
+
+// BUG:
+type [<DontPressThisButton("Please don't press this again")>] button = Buttpon
+let  [<DontPressThisButton("Please don't press this again")>] button () = 1
+
+//---------------------------------------------------------------------
+// Test we can use base calls
+
+open System.Windows.Forms
+
+type MyCanvas2 = 
+  class 
+    inherit Form 
+    override x.OnPaint(args) =  Printf.printf "OnPaint\n"; base.OnPaint(args)
+
+    new() = { inherit Form(); }
+  end
+
+let form2 = new MyCanvas2()
+// do form.Paint.Add(...)
+// do form.add_Paint(...)
+//do form.Activate()
+//do Application.Run(form)
+
+
+//---------------------------------------------------------------------
+// Test we can inherit from the Event<'a> type to define our listeners
+
+let (|>) x f = f x
+
+
+(*
+type MyEventListeners<'a>  =
+  class
+    inherit Event<'a> 
+
+    val mutable listeners2: (Handler<'a>) list 
+
+    member l.Fire(x : 'a) = 
+      let arg = new SimpleEventArgs<_>(x) in 
+      l.listeners2 |> List.iter (fun d -> ignore(d.Invoke((null:obj),arg))) 
+
+    new() = 
+      { inherit Event<'a>(); 
+        listeners2 = [] }
+
+  end
+
+*)
+
+(*
+type MyCanvas2 = 
+  class 
+    inherit Form
+    member x.Redraw : Event<PaintEventArgs>
+    new: unit -> MyCanvas2
+  end
+*)
+
+(*
+type MyCanvas2 = 
+  class 
+    inherit Form
+    val redrawListeners: MyEventListeners<PaintEventArgs>
+    member x.Redraw = x.redrawListeners
+    override x.OnPaint(args) = x.redrawListeners.Fire(args)
+
+    new() = { inherit Form(); redrawListeners= new MyEventListeners<PaintEventArgs>() }
+  end
+*)
+
+(*
+class MyCanvas2() =
+  let l = MyEventListeners<PaintEventArgs>() in 
+  object
+    inherit Form()
+    member x.Redraw = l
+    override x.OnPaint(args) = l.Fire(args)
+  end
+
+class MyCanvas2 =
+  let l = MyEventListeners<PaintEventArgs>() in 
+  object
+    inherit Form
+    member x.Redraw = l
+    override x.OnPaint(args) = l.Fire(args)
+  end
+*)
+
+(*
+let form = new MyCanvas2()
+// do form.Paint.Add(...)
+// do form.add_Paint(...)
+do form.Redraw.AddHandler(new Handler(fun _ args -> Printf.printf "OnRedraw\n"))
+do form.Redraw.Add(fun args -> Printf.printf "OnRedraw\n")
+
+
+do form.Activate()
+do Application.Run(form)
+*)
+
+//do x.add_Redraw
+
+//---------------------------------------------------------------------
+// Test we can define an exception
+
+type MyException =
+  class 
+    inherit System.Exception
+    val v: string 
+    override x.Message = x.v
+    new(s:string) = { inherit System.Exception(); v=s }
+  end
+
+let _ = try raise(new MyException("help!")) with :? MyException as me -> Printf.printf "message = %s\n" me.Message
+
+//---------------------------------------------------------------------
+// Test we can define and subscribe to an interface
+
+(*
+type IMyInterface =
+  interface
+    abstract MyMethod: string -> int
+  end
+*)
+
+// type IMyStructuralConstraint = < MyMethod: string -> int >
+// 'a :> < MyMethod: string -> int >
+// 'a :> IMyStructuralConstraint
+// 'a : IMyStructuralConstraint
+
+
+//---------------------------------------------------------------------
+// Test we can define and subscribe to a generic interface
+
+    
+//---------------------------------------------------------------------
+// Test we can define a struct
+
+
+(*
+type MyStruct =
+  struct
+    val x: int
+    val y: int
+  end
+*)
+
+
+//---------------------------------------------------------------------
+// Test we can define a generic struct
+
+//---------------------------------------------------------------------
+// Test we can define a class with no fields
+
+type NoFieldClass = 
+  class 
+    new() = { inherit System.Object() }
+  end
+
+//---------------------------------------------------------------------
+// Test we can implement more than one interface on a class
+
+module MultiInterfaceTest = begin
+  type PrivateInterfaceA1 = interface abstract M1 : unit -> unit end
+  type PrivateInterfaceA2 = interface abstract M2 : unit -> unit end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1 with 
+        member x.M1() = ()
+      end
+      interface PrivateInterfaceA2 with 
+        member x.M2() = ()
+      end
+   end
+end
+
+module MultiInterfaceTestNameConflict = begin
+  type PrivateInterfaceA1 = interface abstract M : unit -> unit end
+  type PrivateInterfaceA2 = interface abstract M : unit -> unit end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1 with 
+        member x.M() = ()
+      end
+      interface PrivateInterfaceA2 with 
+        member x.M() = ()
+      end
+   end
+end
+
+
+module GenericMultiInterfaceTestNameConflict = begin
+  type PrivateInterfaceA1<'a> = interface abstract M : 'a -> 'a end
+  type PrivateInterfaceA2<'a> = interface abstract M : 'a -> 'a end
+
+  type C1 = 
+    class 
+      interface PrivateInterfaceA1<string> with 
+        member x.M(y) = y
+      end
+      interface PrivateInterfaceA2<int> with 
+        member x.M(y) = y
+      end
+   end
+end
+
+
+module DeepInterfaceInheritance = begin
+  type InterfaceA1 = interface abstract M1 : int -> int end
+  type InterfaceA2 = interface inherit InterfaceA1 abstract M2 : int -> int end
+  type InterfaceA3 = interface inherit InterfaceA1  inherit InterfaceA2 abstract M3 : int -> int end
+
+  type C1 = 
+    class 
+      interface InterfaceA2 with 
+        member x.M1(y) = y 
+        member x.M2(y) = y + y 
+      end
+      new() = { inherit Object(); }
+   end
+  type C2 = 
+    class 
+      interface InterfaceA3 with 
+        member x.M1(y) = y
+        member x.M2(y) = y + y
+        member x.M3(y) = y + y + y
+      end
+      new() = { inherit Object(); }
+   end
+  type C3 = 
+    class 
+      interface InterfaceA2 with 
+        member x.M1(y) = y
+        member x.M2(y) = y + y
+      end
+      interface InterfaceA3 with 
+        member x.M3(y) = y + y + y
+      end
+      new() = { inherit Object(); }
+   end
+
+  do test "fewopvrej1" (((new C1()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej2" (((new C1()) :> InterfaceA2).M2(4) = 8)
+   
+  do test "fewopvrej3" (((new C2()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej4" (((new C2()) :> InterfaceA2).M2(4) = 8)
+  do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(4) = 12)
+  do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(4) = 4)
+  do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2(4) = 8)
+   
+  do test "fewopvrej8" (((new C3()) :> InterfaceA1).M1(4) = 4)
+  do test "fewopvrej9" (((new C3()) :> InterfaceA2).M2(4) = 8)
+  do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(4) = 12)
+  do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(4) = 4)
+  do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2(4) = 8)
+   
+end
+
+module DeepGenericInterfaceInheritance = begin
+  type InterfaceA1<'a> = interface abstract M1 : 'a -> 'a end
+  type InterfaceA2<'b> = interface inherit InterfaceA1<'b list> abstract M2 : 'b * 'b list -> 'b list end
+  type InterfaceA3 = interface inherit InterfaceA2<string>  abstract M3 : string list -> string list end
+
+  type C1 = 
+    class 
+      interface InterfaceA2<int> with 
+        member obj.M1(y) = 1::y 
+        member obj.M2(x,y) = x::y
+      end
+      new() = { inherit Object(); }
+   end
+  type C2 = 
+    class 
+      interface InterfaceA3 with 
+        member obj.M1(y) = "a" :: y
+        member obj.M2(x,y) = x :: y
+        member obj.M3(y) = "a" :: "b" :: "c" :: y
+      end
+      new() = { inherit Object(); }
+   end
+  type C3 = 
+    class 
+      interface InterfaceA2<string> with 
+        member obj.M1(y) = "a" :: y
+        member obj.M2(x,y) = x :: y
+      end
+      interface InterfaceA3 with 
+        member obj.M3(y) = "a" :: "b" :: "c" :: y
+      end
+      new() = { inherit Object(); }
+   end
+
+  do test "fewopvrej1" (((new C1()) :> InterfaceA1<int list>).M1([1]) = [1;1])
+  do test "fewopvrej2" (((new C1()) :> InterfaceA2<int>).M2(3,[1]) = [3;1])
+   
+  do test "fewopvrej3" (((new C2()) :> InterfaceA1<string list>).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej4" (((new C2()) :> InterfaceA2<string>).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej4" (((new C2()) :> InterfaceA2<string>).M2("a",["hi"]) = ["a";"hi"])
+  do test "fewopvrej5" (((new C2()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"])
+  do test "fewopvrej6" (((new C2()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej7" (((new C2()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"])
+   
+  do test "fewopvrej8" (((new C3()) :> InterfaceA1<string list>).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej8" (((new C3()) :> InterfaceA2<string>).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej9" (((new C3()) :> InterfaceA2<string>).M2("a",["hi"]) = ["a";"hi"])
+  do test "fewopvrej10" (((new C3()) :> InterfaceA3).M3(["hi"]) = ["a";"b";"c";"hi"])
+  do test "fewopvrej11" (((new C3()) :> InterfaceA3).M1(["hi"]) = ["a";"hi"])
+  do test "fewopvrej12" (((new C3()) :> InterfaceA3).M2("a",["hi"]) = ["a";"hi"])
+   
+end
+
+
+module PointTest =  struct
+
+
+  type Point =
+   class
+     new(x_init) = { inherit System.Object(); x_init = x_init; x = x_init } 
+     val x_init : int
+     val mutable x : int
+     member p.X = p.x
+     member p.Offset = p.x - p.x_init
+     member p.Move d1 d2 = p.x <- p.x + d1 + d2
+     static member TwoArgs d1 d2 = d1 + d2
+     static member TwoPatternArgs [d1] [d2] = d1 + d2
+     static member ThreeArgs d1 d2 d3 = d1 + d2 + d3
+     static member ThreePatternArgs [d1] [d2] [d3] = d1 + d2 + d3
+      member p.InstanceTwoArgs d1 d2 = p.x + d1 + d2
+      member p.InstanceTwoPatternArgs [d1] [d2] = p.x +  d1 + d2
+      member p.InstanceThreeArgs d1 d2 d3 = p.x +  d1 + d2 + d3
+      member p.InstanceThreePatternArgs [d1] [d2] [d3] = p.x + d1 + d2 + d3
+   end
+
+  type Point_with_no_inherits_clause =
+   class
+     new x_init = { x_init = x_init; x = x_init } 
+     val x_init : int
+     val mutable x : int
+     member p.X = p.x
+     member p.Offset = p.x - p.x_init
+     member p.Move d1 d2 = p.x <- p.x + d1 + d2
+   end
+
+  do 
+    let p = (new Point_with_no_inherits_clause(3)) in 
+    let f = p.Move 4 in 
+    test "wdfjcdwkj1" (p.X = 3);
+    f 4;
+    test "wdfjcdwkj2" (p.X = 11);
+    f 1;
+    test "wdfjcdwkj3" (p.X = 16);
+    test "wdfjcdwkj4" (Point.TwoArgs 1 2 = 3);
+    test "wdfjcdwkj5" (Point.TwoPatternArgs [1] [2] = 3);
+    test "wdfjcdwkj6" (Point.ThreeArgs 1 2 3 = 6);
+    test "wdfjcdwkj7" (Point.ThreePatternArgs [1] [2] [3] = 6);
+    let p2 = (new Point(16)) in 
+    test "wdfjcdwkj4" (p2.InstanceTwoArgs 1 2 = 16 + 3);
+    test "wdfjcdwkj5" (p2.InstanceTwoPatternArgs [1] [2] = 16 + 3);
+    test "wdfjcdwkj6" (p2.InstanceThreeArgs 1 2 3 = 16 + 6);
+    test "wdfjcdwkj7" (p2.InstanceThreePatternArgs [1] [2] [3] = 16 + 6)
+
+end
+
+
+//---------------------------------------------------------------------
+// Test we can implement a debug view
+
+open System.Diagnostics
+
+
+type 
+  [<DebuggerTypeProxy(typeof<MyIntListDebugView>) >]
+   MyIntList = MyNil | MyCons of int * MyIntList
+
+and MyIntListDebugView =
+   class 
+     val v: MyIntList
+     new(x) = { v = x }     
+     [<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)>] 
+     member x.Items = 
+        let rec length x acc = match x with MyNil -> acc | MyCons(a,b) -> length b (acc+1) in 
+        let len = length x.v 0 in 
+        let items = Array.zeroCreate len in 
+        let rec go n l = match l with MyNil -> () | MyCons(a,b) -> items.[n] <- a; go (n+1) b in 
+        go 0 x.v;
+        items
+   end
+
+
+//---------------------------------------------------------------------
+// Pattern matching on objects
+
+module PatternMatchTests = begin
+    type P = class val x1: int; val x2: string; new(a,b) = {x1=a; x2=b } end
+    let p = new P(3,"34")
+end
+
+
+//---------------------------------------------------------------------
+// 'then' on construction
+
+module ThenDoTest = begin
+    let res = ref 2
+    type P = 
+      class 
+        val x1: int; val x2: string; 
+        new(a,b) = {x1=a; x2=(test "ewqonce1" (!res = 2); b) } then res := !res + 1 
+      end
+
+    do ignore(new P(3,"5"))
+    do test "ewqonce2" (!res = 3)
+
+end
+
+//---------------------------------------------------------------------
+// 'then' on construction recursive reference
+
+module ThenDoTest2 = begin
+    let res = ref 2
+    type P = 
+      class 
+        val x1: int; val x2: string; 
+        new(a,b) as x = 
+           { x1= !res; 
+             x2=(test "ewqonce3" (!res = 2); b) } 
+           then 
+              test "ewqonce4" (!res = 2);
+              res := !res + 1; 
+              test "ewqonce5" (!res = 3);
+              test "ewqonce6" (x.x1 = 2) 
+      end
+
+    do ignore(new P(3,"5"))
+    do test "ewqonce7" (!res = 3)
+
+end
+
+module GenericInterfaceTest = begin
+
+    type Foo<'a> =
+      interface 
+          abstract fun1 : 'a -> 'a
+          abstract fun2 : int -> int
+      end
+
+
+    type Bar<'b> =
+      class 
+          val store : 'b
+          interface Foo<'b> with
+            member self.fun1(x) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+
+    type Bar2<'b> =
+      class 
+          val store : 'b
+          interface Foo<'b> with
+            member self.fun1(x:'b) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+    type Bar3<'b> =
+      class 
+          val store : int
+          interface Foo<'b> with
+            member self.fun1(x) = x
+            member self.fun2(x) = 1
+          end
+          new(x) = { store = x }
+      end
+
+end
+
+
+//---------------------------------------------------------------------
+//
+  
+
+
+module Inventory = begin
+
+    type item = A | B
+    type image = A | B
+
+    type ItemDetails = 
+      { ItemIndex: item;
+        InventoryImage: image;
+        Name : string }
+
+    type IInventory = interface
+     abstract Contains : item -> bool
+     abstract Remove : item -> unit
+     abstract GetDetails : item -> ItemDetails  
+     abstract Add : ItemDetails -> unit  
+     abstract GetTuple : unit -> (item * image * string) list 
+     end
+
+
+    module List = 
+        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+        let rec assoc x l = 
+            match l with 
+            | [] -> indexNotFound()
+            | ((h,r)::t) -> if x = h then r else assoc x t
+        let rec remove_assoc x l = 
+            match l with 
+            | [] -> []
+            | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t
+
+
+    type Inventory = class
+      val inv : ItemDetails list ref
+      new() = { inv = ref [] }
+      interface IInventory with
+       member this.Contains i = try (List.assoc i (List.map (fun itd -> (itd.ItemIndex, true)) !this.inv)) with Not_found -> false
+       member this.Remove i = this.inv := List.map snd (List.remove_assoc i (List.map (fun itd -> (itd.ItemIndex, itd)) !this.inv))
+       member this.GetDetails i = List.assoc i (List.map (fun itd -> (itd.ItemIndex, itd)) !this.inv)
+       member this.Add itd = if ((this :> IInventory).Contains (itd.ItemIndex) = false) then this.inv := itd :: !this.inv
+       member this.GetTuple() = List.map (fun itd -> (itd.ItemIndex,itd.InventoryImage,itd.Name)) !this.inv
+      end
+    end
+
+end
+
+//---------------------------------------------------------------------
+// Another interface test
+
+module SamplerTest = begin
+
+    type Sampler<'a,'b> = 
+      interface
+        abstract Sample : 'a -> unit 
+        abstract GetStatistic : unit -> 'b
+      end
+      
+    let NewAverage(toFloat) = 
+      let count = ref 0 in
+      let total = ref 0.0 in 
+      { new Sampler<_,float> with
+          member __.Sample(x) = incr count; total := !total + toFloat x
+          member __.GetStatistic() = !total / float(!count) }
+
+
+    type Average<'a> = 
+      class
+        val mutable total : float
+        val mutable count : int
+        val toFloat : 'a -> float
+        new(toFloat) = {total = 0.0; count =0; toFloat = toFloat }
+        interface Sampler< 'a,float > with
+          member this.Sample(x) = this.count <- this.count + 1; this.total <- this.total + this.toFloat x
+          member this.GetStatistic() = this.total / float(this.count)
+        end
+      end
+
+end
+
+
+//---------------------------------------------------------------------
+// This simple case of forward-reference revealed a bug
+
+type callconv = AA
+  with 
+        member x.IsInstance         = x.ThisConv 
+        member x.ThisConv           = 1
+  end 
+
+// Likewise
+
+module OverloadZeroOneTestSoohyoung = begin
+
+    type Point =
+        class
+            val mutable mx: int
+            
+            new () = { mx = 0 }
+            new (ix) = { mx = ix }
+        end
+
+end
+
+//---------------------------------------------------------------------
+// Bad error message case 
+
+
+module Ralf = begin 
+
+  type Matrix = M  | N
+
+  [<AbstractClass>]
+  type Distribution = 
+      class 
+        new () = { }
+
+        abstract member NumberOfDimensions : unit -> int
+        abstract member Sample: int -> System.Random -> Matrix
+        abstract member Density: Matrix -> float
+        abstract member CloneConstant: unit -> Distribution
+        abstract member Clone: unit -> Distribution
+        abstract member AbsoluteDifference: Distribution -> float
+
+      end
+
+  type Gaussian1D =
+      class 
+            inherit Distribution
+            val PrecisionMean : float
+            val Precision : float
+            new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 }
+            override x.NumberOfDimensions() = 1
+            override x.Density point = 1.0 
+            override x.AbsoluteDifference distribution = 0.0
+            override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution
+            override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution
+            override x.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions)
+      end
+
+end
+
+
+//---------------------------------------------------------------------
+// A random bunch of overloaded operator tests
+
+module MultipleOverloadedOperatorTests = begin
+
+    let f1 (x:DateTime) (y:TimeSpan) : DateTime = x - y
+    let g1 (x:DateTime) (y:DateTime) : TimeSpan = x - y
+    // Return type is also sufficient:
+    let f2 (x:DateTime) y : DateTime = x - y
+    let g2 (x:DateTime) y : TimeSpan = x - y
+    // Just argument types are also sufficient:
+    let f3 (x:DateTime) (y:TimeSpan)  = x - y
+    let g3 (x:DateTime) (y:DateTime)  = x - y
+
+end
+
+
+//---------------------------------------------------------------------
+// A random bunch of overloaded operator tests
+
+module OverloadedOperatorTests = begin
+
+
+    let x = []
+    do printf "len = %d\n" x.Length
+    let c = ("abc").[2]
+
+    let arr = [| 1 |]
+    do printf "len = %d\n" x.Length
+    let elem = arr.[0]
+    let _ = arr.[0] <- 3
+
+    let SCAL = new System.Collections.ArrayList()
+    let _ = SCAL.Add(3)
+    let _ = SCAL.[0]
+    let _ = SCAL.[0] <- box 4
+
+    let SCGL = new System.Collections.Generic.List<int>()
+    let _ = SCGL.Add(3)
+    let _ = SCGL.[0]
+    let _ = SCGL.[0] <- 3
+
+    let f (x: 'a) = 
+      let SCGL = new System.Collections.Generic.List<'a>() in 
+      let _ = SCGL.Add(x) in 
+      let _ = SCGL.[0] in 
+      let _ = SCGL.[0] <- x in 
+      ()
+
+    // check we have generalized 
+    do f 1
+    do f "3"
+
+    let SCGD = new System.Collections.Generic.Dictionary<string,float>()
+    let _ = SCGD.Add("hello",3.0)
+    let _ = SCGD.["hello"]
+
+    let g (k: 'a) (v:'b)= 
+      let SCGD = new System.Collections.Generic.Dictionary<'a,'b>() in 
+      let _ = SCGD.Add(k,v) in
+      let _ = SCGD.[k] in
+      let _ = SCGD.[k] <- v in
+      ()
+
+
+
+    // check we have generalized 
+    do g 1 "3"
+    do g "3" 1
+    do g "3" "1"
+    do g 1 1
+
+    let h (v:'b)= 
+      let arr = [| v;v;v |] in 
+      let elem = arr.[0] in 
+      let _ = arr.[0] <- v in 
+      ()
+
+
+    // check we have generalized 
+    do h 1
+    do h "3"
+
+
+end
+
+module PropertyOverrideTests = begin
+
+    [<AbstractClass>]
+    type A = class
+      abstract S1 :  float with set
+      abstract S2 : string-> float with set
+      abstract S3 : string * string -> float with set
+      abstract G1 :  float with get
+      abstract G2 : string-> float with get
+      abstract G3 : string * string -> float with get
+    end
+     
+    type IA = interface
+      abstract S1 :  float with set
+      abstract S2 : string-> float with set
+      abstract S3 : string * string -> float with set
+      abstract G1 :  float with get
+      abstract G2 : string-> float with get
+      abstract G3 : string * string -> float with get
+    end
+     
+
+
+    type CTest = 
+      class
+        inherit A
+        override x.S1 with  set v = () 
+        override x.S2 with  set s v = () 
+        override x.S3 with  set (s1,s2) v = () 
+        override x.G1 with  get () = 1.0
+        override x.G2 with  get (s:string) = 2.0
+        override x.G3 with  get (s1,s2) = 3.0
+        interface IA with 
+          override x.S1 with  set v = () 
+          override x.S2 with  set s v = () 
+          override x.S3 with  set (s1,s2) v = () 
+          override x.G1 with  get () = 1.0
+          override x.G2 with  get (s:string) = 2.0
+          override x.G3 with  get (s1,s2) = 3.0
+        end
+
+      end
+
+end
+
+module FieldsInClassesDontContributeToRecordFieldInference = begin
+
+  type container = class
+      val capacity : float
+      new(cap) = { capacity = cap } 
+  end
+
+  type cargo = class
+      val capacity : float  // (Error does not appear when the name is changed to capacity1)
+      new(cap) = { capacity = cap }
+  end
+
+  let total_capacity cl = List.fold(fun sum (z:container) -> z.capacity + sum) 0.0 cl
+
+  let cap = total_capacity [ new container(100.0); new container(50.0)]
+
+end
+
+module LucianRecords1 = begin
+  type MyRecord1 = {a:int; x:int}
+  type MyRecord2 = {a:int; y:string}
+  let f (m:MyRecord1) : MyRecord1 = {m with a=3} 
+  let g (m:MyRecord2) : MyRecord2 = {m with a=3} 
+  let h (m:MyRecord1) = m.a
+
+  type Tab = {a:string; b:string}
+  type Tac = {a:string; c:string}
+  type Test = Cab of Tab | Cac of Tac
+  let a = Cab( {a="hello"; b="world";} )
+
+end
+
+module DefaultConstructorConstraints = begin
+
+  let f1 () : 'a when 'a : (new : unit -> 'a) = new 'a()
+  let x1 = (f1() : obj)
+  let x2 = (f1() : int)
+  let x3 = (f1() : DateTime)
+  let x4 = (f1() : System.Windows.Forms.Form)
+  let f2 () = f1()
+  let y1 = (f2() : obj)
+  let y2 = (f2() : int)
+  let y3 = (f2() : DateTime)
+  let y4 = (f2() : System.Windows.Forms.Form)
+  
+end
+
+module AccessBugOnFSharpList = begin
+
+    open System.Web
+    open System.Web.Hosting
+    open System.Data.SqlClient
+
+    type TopicPathProvider = 
+                     class
+                                     inherit VirtualPathProvider 
+                                     
+                                     new() = { inherit VirtualPathProvider(); }                          
+                                                      
+                                     member x.TopicExists topic =
+                                                      let cmd = new SqlCommand() in
+                                                      cmd.CommandText <- "SELECT COUNT(*) FROM Topic WHERE Topic.Name = @name";
+                                                      (cmd.Parameters.Add("@name", System.Data.SqlDbType.NVarChar, 255)).Value <- topic;
+                                                      unbox(cmd.ExecuteScalar()) > 0
+                                     
+                                     override x.FileExists((virtualPath: string)) =
+                                                      let relPath = VirtualPathUtility.ToAppRelative(virtualPath) in
+                                                      if relPath.StartsWith("~/topic") then
+                                                                       x.TopicExists (relPath.Substring(7))
+                                                      else
+                                                                       x.Previous.FileExists(virtualPath)
+                                                                       
+                                     override x.DirectoryExists((virtualDir: string)) =
+                                                      let relPath = VirtualPathUtility.ToAppRelative(virtualDir) in
+                                                      relPath.StartsWith("~/topic") || x.DirectoryExists(virtualDir)
+                     end
+
+    let AppInitialize()  = 
+                     let provider = new TopicPathProvider() in
+                     HostingEnvironment.RegisterVirtualPathProvider(provider)
+
+end
+
+
+module TupledTests = begin
+
+
+    type C1<'a> = class static member Foo(x:'a) = x end
+
+    let _ = C1.Foo((1,2))
+
+    
+  
+    
+end
+
+
+
+(* Bug 692 *)
+type action = delegate of unit -> unit
+
+(* Bug 694 *)
+type x = delegate of unit -> int
+let ff = new x(fun () -> 1)
+let fails = ff.Invoke()
+
+
+
+module RecursiveClassCefinitions = begin
+
+  type t1 = 
+     class
+       val t2: t2
+       member t1.M1(t2:t2) = t2.M2()
+       member t1.M2() = t1.M1(t1.t2)
+       member t1.M3(t2:t2) = t2.M3()
+       member t1.P1 = t1.t2.P2
+       member t1.P2 = t1.P1
+       member t1.P3 = t1.t2.P3 + 1
+       new() = { t2 = new t2() } 
+     end 
+  and t2 = 
+     class
+       val t1: t1
+       member t2.M1() = t2.t1.M2()
+       member t2.M2() = t2.M1()
+       member t2.M3() = t2.t1.M3(t2)
+       member t2.P1 : int = t2.P2
+       member t2.P2 = t2.t1.P1
+       member t2.P3 = t2.P3
+       new() = { t1 = new t1() } 
+     end 
+
+  //let t2 = new t2()  
+  //let b =  (t2.P1 = 3)
+end
+
+module RecursiveAugmentationDefinitions = begin
+
+  type t1 = { t2: t2 }
+     with
+       member t1.M1(t2:t2) = t2.M2()
+       member t1.M2() = t1.M1(t1.t2)
+       member t1.M3(t2:t2) = t2.M3()
+       member t1.P1 = t1.t2.P2
+       member t1.P2 = t1.P1
+       member t1.P3 = t1.t2.P3 + 1
+     end 
+  and t2 = { t1:t1 }
+     with
+       member t2.M1() = t2.t1.M2()
+       member t2.M2() = t2.M1()
+       member t2.M3() = t2.t1.M3(t2)
+       member t2.P1 : int = t2.P2
+       member t2.P2 = t2.t1.P1
+       member t2.P3 = t2.P3
+     end 
+
+  //let t2 = new t2()  
+  //let b =  (t2.P1 = 3)
+end
+
+module RecursiveAbstractClassDefinitions = begin
+
+  type t1 = 
+     class
+       val t2: t2
+       abstract M1 : t2 -> t1
+       abstract M2 : unit -> t1
+       abstract M3 : t2 -> t1
+       abstract P1 : int
+       abstract P2 : int
+       abstract P3 : int
+       default t1.M1(t2:t2) = t2.M2()
+       default t1.M2() = t1.M1(t1.t2)
+       default t1.M3(t2:t2) = 
+           // Note we can use object expressions within the recursive
+           // definition of the type itself.  This requries real care - the
+           // exact set of abstract members that still need implementing
+           // must have been determined correctly before any expressions are
+           // analyzed.
+           { new t1() with 
+                 member x.P1 = 4 
+             end }
+       default t1.P1 = t1.t2.P2
+       default t1.P2 = t1.P1
+       default t1.P3 = t1.t2.P3 + 1
+       new() = { t2 = new t2() }
+     end 
+  and t2 = 
+     class
+       val t1: t1
+       abstract M1 : unit -> t1
+       abstract M2 : unit -> t1
+       abstract M3 : unit -> t1
+       abstract P1 : int
+       abstract P2 : int
+       abstract P3 : int
+       default t2.M1() = t2.t1.M2()
+       default t2.M2() = t2.M1()
+       default t2.M3() = t2.t1.M3(t2)
+       default t2.P1 : int = t2.P2
+       default t2.P2 = t2.t1.P1
+       default t2.P3 = t2.P3
+       new() = { t1 = new t1() }
+     end 
+end
+
+module RecursiveAbstractClassDefinitions2 = begin
+
+  (* same test as above but in different order and some missing implementations *)
+  [<AbstractClass>]
+  type t1 = 
+     class
+       val t2: t2
+       default t1.M1(t2:t2) = t2.M2()
+       default x.M3(t2:t2) = { new t1() with 
+                                   member x.P1 = 4 
+                                   member x.M2() = t1.MakeT1() }
+       static member MakeT1() = { new t1() with 
+                                   member x.P1 = 4 
+                                   member x.M2() = t1.MakeT1() }
+       default t1.P2 = t1.P1
+       default t1.P3 = t1.t2.P3 + 1
+       new() = { t2 = new t2() }
+       abstract M1 : t2 -> t1
+       abstract M2 : unit -> t1
+       abstract M3 : t2 -> t1
+       abstract P1 : int
+       abstract P2 : int
+       abstract P3 : int
+     end 
+  and t2 = 
+     class
+       val t1: t1
+       default t2.M1() = t2.t1.M2()
+       default t2.M2() = t2.M1()
+       default t2.M3() = t2.t1.M3(t2)
+       default t2.P1 : int = t2.P2
+       default t2.P2 = t2.t1.P1
+       default t2.P3 = t2.P3
+       abstract M1 : unit -> t1
+       abstract M2 : unit -> t1
+       abstract M3 : unit -> t1
+       abstract P1 : int
+       abstract P2 : int
+       abstract P3 : int
+       new() = { t1 = t1.MakeT1() }
+     end 
+
+  //let t2 = new t2()  
+  //let b =  (t2.P1 = 3)
+end
+
+module WeckerTestCase1 = begin
+    type A = class
+          val   v1 : B
+          new(b) = { v1 = b }
+          member x.m1() = x.v1.v2 + x.v1.m2()
+    end
+
+    and B = class
+          val   v2 : int
+          new() = { v2 = 3}
+          member x.m2() = x.v2
+    end
+end
+
+#if GENERICS
+module StaticMemberBugs = begin
+    type x = class
+      static member empty : byte[] = Array.zeroCreate 0;
+    end
+
+    let ba = x.empty
+    type xx = class static member x = 2 end
+    let v = xx.x
+
+end
+#endif
+
+
+module TestConstrainedItemProperty = begin
+    type Foo = 
+        interface 
+          abstract Item : int -> string with get
+        end
+
+    let f1 (x : #Foo) = x.[1]
+
+    let f2 (x : #Foo) = x.[1]
+end
+
+
+module TestGettingMethodsViaMultipleInheritance = begin
+    type H = interface abstract P : int abstract M : int -> int end
+    type I = interface inherit H end
+    type J = interface inherit H end
+    type K = interface inherit I inherit J end
+
+    let f1 (x : K) = x.GetType()
+    let f2 (x : K) = x.M(3)
+    let f3 (x : K) = x.P
+end
+
+
+module DefaultStructCtor = begin
+
+    let i1 = new System.Nullable<int>()
+    let i2 = new System.Nullable<bool>()
+    do test "cwehoiewc" (i1.HasValue=false)
+    do test "cwehoiewc" (i2.HasValue=false)
+    type S = 
+        struct 
+            new(v:int) = { v=v } 
+            val v : int  
+        end
+    let i3 = new S()
+    let i3b = new S(3)
+    let i4 = new System.Nullable<S>()
+
+end
+
+module MiscNullableTests = begin
+ open System
+ let (>=?!) (x : Nullable<'a>) (y: 'a) = 
+    x.HasValue && x.Value >= y
+
+ let (>?!) (x : Nullable<'a>) (y: 'a) = 
+    x.HasValue && x.Value > y
+
+ let (<=?!) (x : Nullable<'a>) (y: 'a) = 
+    not x.HasValue || x.Value <= y
+
+ let (<?!) (x : Nullable<'a>) (y: 'a) = 
+    not x.HasValue || x.Value < y
+
+ let (=?!) (x : Nullable<'a>) (y: 'a) = 
+    x.HasValue && x.Value = y
+
+ let (<>?!) (x : Nullable<'a>) (y: 'a) = 
+    not x.HasValue || x.Value <> y
+
+ /// This overloaded operator divides Nullable values by non-Nullable values
+ /// using the overloaded operator "/".  Inlined to allow use over any type,
+ /// as this resolves the overloading on "/".
+ let inline (/?!) (x : Nullable<'a>) (y: 'a) = 
+     if x.HasValue then new Nullable<'a>(x.Value / y)
+     else x 
+
+ /// This overloaded operator adds Nullable values by non-Nullable values
+ /// using the overloaded operator "+".  Inlined to allow use over any type,
+ /// as this resolves the overloading on "+".
+ let inline (+?!) (x : Nullable<'a>) (y: 'a) = 
+     if x.HasValue then new Nullable<'a>(x.Value + y)
+     else x
+
+ /// This overloaded operator adds Nullable values by non-Nullable values
+ /// using the overloaded operator "-".  Inlined to allow use over any type,
+ /// as this resolves the overloading on "-".
+ let inline (-?!) (x : Nullable<'a>) (y: 'a) = 
+     if x.HasValue then new Nullable<'a>(x.Value - y)
+     else x
+
+ /// This overloaded operator adds Nullable values by non-Nullable values
+ /// using the overloaded operator "*".  Inlined to allow use over any type,
+ /// as this resolves the overloading on "*".
+ let inline ( *?!) (x : Nullable<'a>) (y: 'a) = 
+     if x.HasValue then new Nullable<'a>(x.Value * y)
+     else x
+
+ /// This overloaded operator adds Nullable values by non-Nullable values
+ /// using the overloaded operator "%".  Inlined to allow use over any type,
+ /// as this resolves the overloading on "%".
+ let inline ( %?!) (x : Nullable<'a>) (y: 'a) = 
+     if x.HasValue then new Nullable<'a>(x.Value % y)
+     else x
+
+end
+
+module BaseCallWorkaround = begin
+    type C1 = class
+        new() = {}
+        abstract Blah : unit -> unit
+        default this.Blah () = this.Blah_C1_Impl()
+        member this.Blah_C1_Impl () = ignore <| printf "From C1\n"
+    end
+
+    type C2 = class
+        inherit C1 
+        new() = {inherit C1()}
+        override this.Blah() =
+            ignore <| printf "From C2\n";
+            this.Blah_C1_Impl()
+    end
+
+    do (new C2()).Blah()
+
+end
+
+module BaseCallTest = begin
+    let res = ref 0 
+    type C1 = class
+        new() = {}
+        abstract Blah : unit -> unit
+        default this.Blah () =
+            ignore <| printf "From C1\n";
+            res := !res + 2
+    end
+
+    type C2 = class
+        inherit C1 
+        new() = {inherit C1()}
+        override this.Blah() =
+            ignore <| printf "From C2\n";
+            res := !res + 1;
+            base.Blah()
+    end
+
+
+    do test "ewckjd0" (!res = 0)
+    do (new C2()).Blah()
+    do test "ewckjd0" (!res = 3)
+
+end
+
+module BaseCallTest2 = begin
+    let res = ref 0 
+    type C1 = class
+        new() = {}
+        abstract Blah : unit -> unit
+        default this.Blah () =
+            ignore <| printf "From C1b\n";
+            ignore <| printf "From C1b\n";
+            ignore <| printf "From C1b\n";
+            ignore <| printf "From C1b\n";
+            ignore <| printf "From C1b\n";
+            ignore <| printf "From C1b\n";
+            res := !res + 3
+    end
+
+    type C2 = class
+        inherit C1 
+        new() = {inherit C1()}
+        override this.Blah() =
+            ignore <| printf "From C2b\n";
+            ignore <| printf "From C2b\n";
+            ignore <| printf "From C2b\n";
+            ignore <| printf "From C2b\n";
+            ignore <| printf "From C2b\n";
+            res := !res + 2;
+            base.Blah()
+    end
+
+
+    type C3 = class
+        inherit C2 
+        new() = {inherit C2()}
+        override this.Blah() =
+            ignore <| printf "From C3c\n";
+            ignore <| printf "From C3c\n";
+            ignore <| printf "From C3c\n";
+            res := !res + 1;
+            base.Blah()
+    end
+
+
+    do test "ewckjd0a" (!res = 0)
+    do (new C3()).Blah()
+    do test "ewckjd0b" (!res = 6)
+
+end
+
+
+open System
+open System.Windows.Forms
+type Bug856 = 
+  class 
+    inherit CheckBox
+    new() = { inherit CheckBox(); }
+    member x.PerformClick() = x.OnClick(new EventArgs())  // peverify failed
+  end 
+do let form = new Form() in
+   let checkBox = new Bug856(Text="Test") in
+   form.Controls.Add(checkBox);
+   checkBox.PerformClick()  (* got inlined - peverify failed *)
+
+
+module SelfInitCalls = begin
+
+    open System.IO
+    type File2 = class
+      val path: string 
+      val innerFile: FileInfo
+      // note this calls another constructor.
+      new() = new File2("default.txt")
+      new(path) = 
+          { path = path ;
+            innerFile = new FileInfo(path) }
+    end
+
+end
+
+module SelfInitCalls2 = begin
+
+    open System.IO
+    type File2(path) = class
+      let path = path
+      let innerFile = new FileInfo(path)
+      // note this calls another constructor.
+      new() = new File2("default.txt")
+    end
+
+end
+
+module SettingPropertiesInConstruction = begin
+    open System.Windows.Forms
+    let f = { new Form(Text="hello") with member __.OnPaint(args) = () }
+    do test "ce32wygu" (f.Text = "hello")
+    type C = class
+      val mutable p : int
+      member x.P with set v = x.p <- v
+      val mutable q : int
+      member x.Q with set v = x.q <- v
+      abstract Foo : int -> int
+      default o.Foo(x) = x
+      new() = { p = 0; q = 1 }
+    end
+
+    let check s p = printf "Test %s: %s\n" s (if p then "pass" else "fail")
+
+    let c0 = new C()
+    do test "ce32wygu" (c0.p = 0)
+    do test "ce32wygu" (c0.q = 1)
+
+    let c1 = new C(P = 3)
+    do test "ce32wygu" (c1.p = 3)
+
+    let c2 = { new C(P = 4) with member __.Foo(x) = x + x }
+    do test "ce32wygu" (c2.p = 4)
+
+    let c3 = { new C(Q = 5) with member __.Foo(x) = x + x }
+    do test "ce32wygu" (c3.q = 5)
+
+    let c4 = { new C(P = 3, Q = 5) with member __.Foo(x) = x + x }
+    do test "ce32wygu" (c4.p = 3)
+    do test "ce32wygu" (c4.q = 5)
+
+    let c5 = { new C(Q = 5, P = 3) with member __.Foo(x) = x + x }
+    do test "ce32wygu" (c5.p = 3)
+    do test "ce32wygu" (c5.q = 5)
+end
+
+// Finish up
+
+
+type SmoothForm = class 
+  inherit Form
+  new() as x = 
+    { inherit Form(); } 
+    then 
+       x.SetStyle(ControlStyles.AllPaintingInWmPaint ||| ControlStyles.Opaque, true);
+end
+
+module ENumTests = begin
+    type Int64Enum =
+      | One = 1L
+      | Two = 2L
+      | Three = 3L
+
+    type UInt64Enum =
+      | One = 1UL
+      | Two = 2UL
+      | Three = 3UL
+
+    type Int32Enum =
+      | One = 1
+      | Two = 2
+      | Three = 3
+    type UInt32Enum =
+      | One = 1u
+      | Two = 2u
+      | Three = 3u
+    type UInt16Enum =
+      | One = 1us
+      | Two = 2us
+      | Three = 3us
+    type Int16Enum =
+      | One = 1s
+      | Two = 2s
+      | Three = 3s
+    type Int8Enum =
+      | One = 1y
+      | Two = 2y
+      | Three = 3y
+    type UInt8Enum =
+      | One = 1uy
+      | Two = 2uy
+      | Three = 3uy
+
+    type CharEnum =
+        | Option1 = '1'
+        | Option2 = '2'
+
+(*
+    type FloatEnum =
+        | Option1 = 1.0
+        | Option2 = 2.0
+
+    type Float32Enum =
+        | Option1 = 1.0f
+        | Option2 = 2.0f
+*)
+end
+
+module AccessingProtectedMembersFromOtherObjects = begin
+    type DS() = class
+      inherit System.Data.DataSet()
+      member t.Foo () =
+        let a = new DS() in
+        a.GetSchemaSerializable() |> ignore;
+        t.GetSchemaSerializable() |> ignore;
+        ()
+        
+
+    end
+end
+
+module TestPropertySetWithSyntaxThatLooksLikeANamedArgument = begin
+    open System.Windows.Forms
+
+    let el = new CheckBox()
+    let el2 = el
+    do el.Checked <- (el = el2) // this is not a named argument!!!
+end
+
+module SomeMoreCtorCases = begin
+    type C =
+       class
+           val xx : int
+           new(x,y) = 
+               if y then 
+                  { xx = x}
+               else
+                  { xx = x+x}
+           new(x) = 
+               let six = 3 + 3 in
+               { xx = x}
+           static member Create() = 
+               let six = 3 + 3 in
+               new C(3+3)
+           new() = 
+               let six = 3 + 3 in
+               new C(3+3)
+           new(a,b,c) = new C(a+b+c)
+           new(a,b,c,d) = 
+               new C(a+b+c+d)
+               then
+                 printf "hello"
+       end
+       
+end
+
+module StillMoreCtorCases = begin
+    type C<'a>(x:int) = class
+        new() = C<'a>(3)
+    end
+    type C2<'a>() = class
+        new(x:int) = C2<'a>()
+    end
+end
+
+module StephenTolksdorfBug1112 = begin
+
+    open System.Collections.Generic
+
+    type ITest<'T> = interface
+         abstract Read1: #IList<'T> -> unit
+         abstract Read2: #IList<'U> -> unit
+         abstract Read3: #IList<('U * 'T)> -> unit
+         abstract Read4: IList<('U * 'T)> -> unit
+    end
+
+    
+
+    
+    /// other manifestation of the same bug
+    type ITest2 = interface
+       abstract Foo<'t> : 't -> 't
+    end
+
+
+    type Test() = class
+      interface ITest2 with
+        member x.Foo<'t>(v:'t) : 't = v
+       end
+    end
+
+
+    /// yet another manifestation of the same bug
+    type IMonad<'a> =
+        interface
+            abstract unit : 'a -> IMonad<'a>
+            abstract bind : #IMonad<'a> -> ('a -> #IMonad<'b>) -> IMonad<'b>
+            abstract ret : unit -> 'a
+        end
+
+end
+
+module Bug1281Test = begin
+
+    [<Struct>]
+    type node =
+        struct
+        
+           val mutable key: int
+           new (keyIn) = {key=keyIn}
+           member n.Item with get(i:int)   = if i=0 then 1 else
+                                             failwith "node has 2 items only"
+        end
+    let nd = new node (10)
+    let _ = nd.[0]
+end
+
+module Bug960Test1 = begin
+
+    [<AbstractClass>]
+    type B<'a, 'b> = class
+      new () = { }
+      
+      abstract A : 'a with get,set
+      abstract M : unit -> 'a 
+
+    end
+
+    type C = class
+      inherit B<int, int>
+
+      override x.A
+        with get() = 3
+        and set(v : int) = (invalidArg "arg" "C.A.set" : unit) 
+
+      override x.M() = 3
+    end
+end
+
+
+module Bug960Test2 = begin
+
+    [<AbstractClass>]
+    type B<'a, 'b> = class
+      val mutable a : 'a
+      val mutable b : 'b
+
+      new(a, b) = {a=a; b=b}
+
+      member x.C() = x.A
+
+      abstract A : 'a with get,set
+
+      member x.B
+        with get() = x.b
+        and set(v) = x.b <- v
+    end
+
+    type C = class
+      inherit B<int, int>
+
+      new() = { inherit B<int,int>(3,4) }
+      
+      override x.A
+        with get() = 3
+        and set(v : int) = (invalidArg "arg" "C.A.set" : unit) end
+end
+
+
+module RandomAdditionalNameResolutionTests = begin
+
+    module M = begin
+        type Foo() = 
+          class
+            member x.Name = "a"
+          end
+        type Foo<'a>() = 
+          class
+            member x.Name = "a"
+          end
+        type Goo<'a>() = 
+          class
+            member x.Name = "a"
+          end
+        type Goo() = 
+          class
+            member x.Name = "a"
+          end
+    end
+    
+    let f2 = new M.Foo()
+    let f3 = new M.Foo< >()
+    let f4 = new M.Foo<int>()
+
+    let g2 = new M.Goo()
+    let g3 = new M.Goo< >()
+    let g4 = new M.Goo<int>()
+
+    open M
+
+    let f5 = new Foo()
+    let f6 = new Foo< >()
+    let f7 = new Foo<int>()
+
+    let g5 = new Foo()
+    let g6 = new Foo< >()
+    let g7 = new Foo<int>()
+
+end
+
+module NonGenericStruct_FSharp1_0_bug_1337_FSharp1_0_bug_1339  = begin
+    type S =
+        struct
+           val mutable x : int
+           val mutable y : int
+           member obj.X with set(v) = obj.x <- v
+           member obj.Y with set(v) = obj.y <- v
+        end
+
+    let x1 : S = S()
+    let x2 : S = S(X=1, Y=2)
+
+    do test "veoijw09we1" (x1.x  = 0)
+    do test "veoijw09we2" (x1.y  = 0)
+
+    do test "veoijw09we3" (x2.x  = 1)
+    do test "veoijw09we4" (x2.y  = 2)
+end
+
+module GenericClass_FSharp1_0_bug_1337_FSharp1_0_bug_1339 = begin
+    type S<'a,'b> =
+        class
+           val mutable x : 'a
+           val mutable y : 'b
+           member obj.X with set(v) = obj.x <- v
+           member obj.Y with set(v) = obj.y <- v
+           new(a,b) = { x=a; y=b }
+        end
+
+    let x1 = S<int,string>(1,"1")
+    let x2 = S<int,string>(a=1,b="1")
+    let x3 = S<int,string>(1,"1",X=1, Y="2")
+
+    do test "veoijw09we1" (x1.x  = 1)
+    do test "veoijw09we2" (x1.y  = "1")
+
+    do test "veoijw09we3" (x2.x  = 1)
+    do test "veoijw09we4" (x2.y  = "1")
+
+    do test "veoijw09we3" (x3.x  = 1)
+    do test "veoijw09we4" (x3.y  = "2")
+end
+
+module GenericStruct_FSharp1_0_bug_1337_FSharp1_0_bug_1339 = begin
+    type S<'a,'b> =
+        struct
+           val mutable x : 'a
+           val mutable y : 'b
+           member obj.X with set(v) = obj.x <- v
+           member obj.Y with set(v) = obj.y <- v
+        end
+
+    let x1 = S<int,string>()
+    let x2 = S<int,string>(X=1, Y="2")
+
+    do test "veoijw09we1" (x1.x  = 0)
+    do test "veoijw09we2" (x1.y  = null)
+
+    do test "veoijw09we3" (x2.x  = 1)
+    do test "veoijw09we4" (x2.y  = "2")
+
+end
+
+
+module LeakyAbbreviation_bug1542_FSharp_1_0 = begin
+
+    type MM<'a,'b>() = 
+        class
+            static member Create() = 1
+        end
+        
+    type Graph<'a> = MM<'a,'a>
+    let g = Graph<string>.Create()
+
+end
+
+module CheckoptionalArgumentAttributeDeclaresOptionalArgument = begin
+
+    type C() =  
+        class
+            static member M([<OptionalArgument>] x : int option) = x
+        end
+        
+    let v = C.M(x=3)
+    
+end
+
+module PropertySetter_FSharp1_0_bug_1422 = begin
+
+    type Variable() =
+        class
+            member x.Name with set(v:string) = ()
+        end
+
+    type Variable<'a>() =
+        class 
+            inherit Variable()
+            static member Random(y:Variable<'b>) = new Variable<'a>()
+        end
+
+    let x : Variable<int> = new Variable<int>()
+    let _ = Variable.Random (x, Name = "m_")
+
+        
+end
+
+
+module StructKeywordAsConstraintTest = begin
+
+    type Struct0 =
+        struct
+            val x : int
+        end
+
+    type Struct1<'a when 'a : struct> =
+        struct
+            val x : int
+        end
+
+    type Struct2<'a when 'a : not struct> =
+        struct
+            val x : int
+        end
+     
+    type Class1<'a when 'a : struct> =
+        class
+            val x : int
+        end
+     
+    type Class2<'a when 'a : not struct> =
+        class
+            val x : int
+        end
+
+    let inline f<'a when 'a : null> () : 'a =  null
+    let v1 = f<string> () 
+    let v2 = f<obj> () 
+     
+end
+
+module MutateStructFieldOnPropertySet = begin
+
+    type C() = class 
+       [<DefaultValue>]
+       val mutable F : int
+    end
+
+    let c = C(F=3)
+
+    do test "cnoe0wec" (c.F = 3)
+
+end
+
+
+module Bug618 = begin
+    type c<'a> when 'a :> c<'a> () = class end
+    type d() = class inherit c<d>() end
+    let x = new c<d>()
+    
+end
+
+(* 
+module Bug618b = begin
+    type c<'a> when 'a :> c<'a>() = class end
+    type d() = class inherit c<d>() end
+    let x = new c<d>()
+    
+end
+*)
+
+(* Bug: 1284: Enum type definitions do not support negative literals *)
+module Bug1284 = begin
+  (* Negative literal with no space *)
+  type EnumInt8       = | A1 = -10y
+  type EnumInt16      = | A1 = -10s
+  type EnumInt32      = | A1 = -10
+  type EnumInt64      = | A1 = -10L
+(*type EnumNativeInt  = | A1 = -10n -- enum on this type are not support, -ve or +ve *)
+  //type EnumDouble     = | A1 = -1.2
+  //type EnumSingle     = | A1 = -1.2f
+end
+
+
+module ContraintTest = begin
+    open System.Numerics
+    let check s p = printf "Test %s: %s\n" s (if p then "pass" else "fail")
+    do check "d3oc001" (LanguagePrimitives.GenericZero<BigInteger> = 0I)
+    do check "d3oc003a" (LanguagePrimitives.GenericZero<int> = 0)
+    do check "d3oc003b" (LanguagePrimitives.GenericZero<unativeint> = 0un)
+    do check "d3oc003c" (LanguagePrimitives.GenericZero<uint64> = 0UL)
+    do check "d3oc003d" (LanguagePrimitives.GenericZero<uint32> = 0u)
+    do check "d3oc003e" (LanguagePrimitives.GenericZero<uint16> = 0us)
+    do check "d3oc003f" (LanguagePrimitives.GenericZero<byte> = 0uy)
+    do check "d3oc003g" (LanguagePrimitives.GenericZero<nativeint> = 0n)
+    do check "d3oc003h" (LanguagePrimitives.GenericZero<int64> = 0L)
+    do check "d3oc003i" (LanguagePrimitives.GenericZero<int32> = 0)
+    do check "d3oc003j" (LanguagePrimitives.GenericZero<int16> = 0s)
+    do check "d3oc003k" (LanguagePrimitives.GenericZero<sbyte> = 0y)
+    do check "d3oc003l" (LanguagePrimitives.GenericZero<decimal> = 0M)
+
+    do check "d3oc001q" (LanguagePrimitives.GenericOne<BigInteger> = 1I)
+    do check "d3oc113e" (LanguagePrimitives.GenericOne<int> = 1)
+    do check "d3oc113r" (LanguagePrimitives.GenericOne<unativeint> = 1un)
+    do check "d3oc113t" (LanguagePrimitives.GenericOne<uint64> = 1UL)
+    do check "d3oc113y" (LanguagePrimitives.GenericOne<uint32> = 1u)
+    do check "d3oc113u" (LanguagePrimitives.GenericOne<uint16> = 1us)
+    do check "d3oc113i" (LanguagePrimitives.GenericOne<byte> = 1uy)
+    do check "d3oc113o" (LanguagePrimitives.GenericOne<nativeint> = 1n)
+    do check "d3oc113a" (LanguagePrimitives.GenericOne<int64> = 1L)
+    do check "d3oc113s" (LanguagePrimitives.GenericOne<int32> = 1)
+    do check "d3oc113d" (LanguagePrimitives.GenericOne<int16> = 1s)
+    do check "d3oc113f" (LanguagePrimitives.GenericOne<sbyte> = 1y)
+    do check "d3oc113g" (LanguagePrimitives.GenericOne<decimal> = 1M)
+end
+
+module MiscGenericMethodInference = begin
+
+    type Printer() =
+        class
+            let tw = new IO.StringWriter()
+            member x.TextWriter = tw
+            member x.Print fmt = Printf.fprintfn tw fmt
+        end
+     
+    let test2 () =
+        let pr = Printer() in
+        pr.Print "test %s" "test";
+        pr.Print  "test";
+        pr.TextWriter.ToString()
+
+end
+
+module CondensationTest = begin
+
+    open System
+    open System.Reflection
+     
+    [<AttributeUsage(AttributeTargets.Property, AllowMultiple = false)>]
+    type public APropAttribute() =
+        class
+            inherit Attribute() 
+        end
+    [<AttributeUsage(AttributeTargets.Method, AllowMultiple = false)>]
+    type public AMethodAttribute() =
+        class
+            inherit Attribute() 
+        end
+     
+    type AType() =
+        class
+        
+            [<AProp>]   
+            member this.Prop   = "Hello"
+            [<AMethod>] 
+            member this.Meth() = "Boo"
+        end
+    let getAttribute<'t> (memb: MemberInfo) =
+        let attrib = memb.GetCustomAttributes(typeof<'t>, false) in
+        // Only allow a single instance of the attribute on the member for now
+        match attrib with
+        | [| theAttrib |] -> Some(memb, (theAttrib :?> 't))
+        | _ -> None
+     
+    let hasAttribute<'t> (memb: MemberInfo) =
+        match getAttribute<'t> memb with
+        | Some(_) -> true
+        | None -> false
+     
+    let t = AType()
+    let p = t.GetType().GetProperties() |> Array.filter (hasAttribute<APropAttribute>)
+    let m = t.GetType().GetMethods() |> Array.filter (hasAttribute<AMethodAttribute>)
+     
+
+end
+
+module OptionalArgumentWithSubTyping =  begin
+    type Base() =
+       class
+       end
+    type Child() = 
+       class 
+         inherit Base()
+       end
+
+    type Test(?bse: Base) =
+       class
+         let value = match bse with Some b -> b | _ -> new Base()
+         member t.Value = value
+       end
+
+    let t1 = new Test(bse=Base()) // should not trigger exception
+    let t2 = new Test(?bse=Some(Base())) // should not trigger exception
+    let t3 = new Test(bse=Child()) // should not trigger exception
+end
+
+
+
+
+
+module ParamArgs =  begin
+    let _ = System.Console.WriteLine("")
+    let _ = System.Console.WriteLine("{0}",1)
+    let _ = System.Console.WriteLine("{0},{1}",1,2)
+    let _ = System.Console.WriteLine("{0},{1},{2}",1,2,3)
+    let _ = System.Console.WriteLine("{0},{1},{2},{3}",1,2,3,4)
+    let _ = System.Console.WriteLine("{0},{1},{2},{3},{4}",1,2,3,4,5)
+
+    let _ = System.Console.WriteLine("")
+    let _ = System.Console.WriteLine("{0}",box 1)
+    let _ = System.Console.WriteLine("{0},{1}",box 1,box 2)
+    let _ = System.Console.WriteLine("{0},{1},{2}",box 1,box 2,box 3)
+    let _ = System.Console.WriteLine("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)
+    let _ = System.Console.WriteLine("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)
+
+    let () = check "vskncvew1" (System.String.Format("")) ""
+    let () = check "vskncvew2" (System.String.Format("{0}",1)) "1"
+    let () = check "vskncvew3" (System.String.Format("{0},{1}",1,2)) "1,2"
+    let () = check "vskncvew4" (System.String.Format("{0},{1},{2}",1,2,3)) "1,2,3"
+    let () = check "vskncvew5" (System.String.Format("{0},{1},{2},{3}",1,2,3,4)) "1,2,3,4"
+    let () = check "vskncvew6" (System.String.Format("{0},{1},{2},{3},{4}",1,2,3,4,5)) "1,2,3,4,5"
+
+    let () = check "vskncvew7" (System.String.Format("")) ""
+    let () = check "vskncvew8" (System.String.Format("{0}",box 1)) "1"
+    let () = check "vskncvew9" (System.String.Format("{0},{1}",box 1,box 2)) "1,2"
+    let () = check "vskncvewq" (System.String.Format("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3"
+    let () = check "vskncveww" (System.String.Format("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4"
+    let () = check "vskncvewe" (System.String.Format("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5"
+    
+    type C() = class
+        static member M( fmt:string, [<System.ParamArray>] args : obj[]) = System.String.Format(fmt,args)
+    end
+
+
+    let () = check "vskncvewr" (C.M("")) ""
+    let () = check "vskncvewt" (C.M("{0}",1)) "1"
+    let () = check "vskncvewy" (C.M("{0},{1}",1,2)) "1,2"
+    let () = check "vskncvewu" (C.M("{0},{1},{2}",1,2,3)) "1,2,3"
+    let () = check "vskncvewi" (C.M("{0},{1},{2},{3}",1,2,3,4)) "1,2,3,4"
+    let () = check "vskncvewo" (C.M("{0},{1},{2},{3},{4}",1,2,3,4,5)) "1,2,3,4,5"
+
+    let () = check "vskncvewp" (C.M("")) ""
+    let () = check "vskncvewa" (C.M("{0}",box 1)) "1"
+    let () = check "vskncvews" (C.M("{0},{1}",box 1,box 2)) "1,2"
+    let () = check "vskncvewd" (C.M("{0},{1},{2}",box 1,box 2,box 3)) "1,2,3"
+    let () = check "vskncvewf" (C.M("{0},{1},{2},{3}",box 1,box 2,box 3,box 4)) "1,2,3,4"
+    let () = check "vskncvewg" (C.M("{0},{1},{2},{3},{4}",box 1,box 2,box 3,box 4,box 5)) "1,2,3,4,5"
+        
+    type C2() = class
+        static member M( fmt:string, [<System.ParamArray>] args : int[]) = System.String.Format(fmt,Array.map box args)
+        static member M2( fmt:string, [<System.ParamArray>] args : System.ValueType[]) = System.String.Format(fmt,Array.map box args)
+        static member M3( fmt:string, [<System.ParamArray>] args : string[]) = System.String.Format(fmt,Array.map box args)
+    end
+
+
+    let () = check "vskncvewh" (C2.M("")) ""
+    let () = check "vskncvewj" (C2.M("{0}",1)) "1"
+    let () = check "vskncvewk" (C2.M("{0},{1}",1,2)) "1,2"
+    let () = check "vskncvewl" (C2.M("{0},{1},{2}",1,2,3)) "1,2,3"
+    let () = check "vskncvewz" (C2.M("{0},{1},{2},{3}",1,2,3,4)) "1,2,3,4"
+    let () = check "vskncvewx" (C2.M("{0},{1},{2},{3},{4}",1,2,3,4,5)) "1,2,3,4,5"
+
+    let () = check "vskncvewc" (C2.M("")) ""
+
+    let () = check "vskncvewv" (C2.M2("")) ""
+    let () = check "vskncvewb" (C2.M2("{0}",1)) "1"
+    let () = check "vskncvewn" (C2.M2("{0},{1}",1,2)) "1,2"
+    let () = check "vskncvewm" (C2.M2("{0},{1},{2}",1,2,3)) "1,2,3"
+    let () = check "vskncvewQ" (C2.M2("{0},{1},{2},{3}",1,2,3,4)) "1,2,3,4"
+    let () = check "vskncvewW" (C2.M2("{0},{1},{2},{3},{4}",1,2,3,4,5)) "1,2,3,4,5"
+
+    let () = check "vskncvewE" (C2.M2("")) ""
+
+    let () = check "vskncvewR" (C2.M("")) ""
+
+    let () = check "vskncvewT" (C2.M3("")) ""
+    let () = check "vskncvewY" (C2.M3("{0}","1")) "1"
+    let () = check "vskncvewU" (C2.M3("{0},{1}","1","2")) "1,2"
+        
+end
+
+module MiscTest = begin
+
+    let f () () = 1
+end
+
+
+module NewConstraintUtilizedInTypeEstablishment_FSharp_1_0_4850 = begin
+    type I<'self> when 'self :  (new : unit -> 'self) = interface
+      abstract foo : int
+    end
+
+    type C = class
+      val private f : int
+      new() = {f= 0}
+      interface I<C> with
+        member x.foo = x.f + 1
+      end
+    end
+
+
+    type D() = class
+      let f = 0
+      interface I<D> with
+        member x.foo = f + 1
+      end
+    end
+
+end
+
+module TestTupleOverloadRules_Bug5985 = begin
+
+    type C() = 
+        class
+            member device.CheckCooperativeLevel() = true
+            member device.CheckCooperativeLevel([<System.Runtime.InteropServices.OutAttribute>] x:byref<int>) = true
+        end
+
+    let c = C()
+
+    let z = c.CheckCooperativeLevel()
+    let _ : bool =  z  
+    let a,b = c.CheckCooperativeLevel()
+end
+
+module AutoProps = begin
+
+    type C(ppppp:int) =
+        /// Test doc StaticProperty
+        static let ssss = 11
+        member val Property = printfn "Property..."; ppppp 
+        member val PropertyExplicitGet = printfn "PropertyExplicitGet..."; ppppp with get
+
+        static member val StaticProperty = printfn "StaticProperty..."; 3 + ssss
+        static member val StaticPropertyExplicitGet = printfn "StaticPropertyExplicitGet..."; 3 + ssss with get
+
+        /// Test doc SettableProperty
+        member val SettableProperty = printfn "SettableProperty..."; ppppp with get, set 
+        
+        /// Test doc MutableStaticProperty
+        static member val SettableStaticProperty = printfn "SettableStaticProperty..."; 4 + 5  with get, set 
+
+        // --- these have type definitions
+
+        /// Test doc PropertyWithType
+        member val PropertyWithType : int = ppppp  
+        /// Test doc StaticPropertyWithType
+        static member val StaticPropertyWithType : int = 6
+
+        /// Test doc SettablePropertyWithType
+        member val SettablePropertyWithType : int = ppppp with get,set
+        /// Test doc SettableStaticPropertyWithType
+        static member val SettableStaticPropertyWithType : int = 7 + 8 with get,set
+
+        // --- use them 
+
+        member this.PUse = printfn "PUse..."; this.Property + 9
+        member this.PEGUse = printfn "PUse..."; this.PropertyExplicitGet + 9
+        member this.QUse = printfn "QUse..."; this.SettableProperty + 10
+        member this.QSet() = printfn "QUse..."; this.SettableProperty <- 11
+        static member SPUse = printfn "SPUse..."; C.StaticProperty + 12
+        static member SPEGUse = printfn "SPUse..."; C.StaticPropertyExplicitGet + 12
+        static member SQUse = printfn "SQUse..."; C.SettableStaticProperty + 13
+        static member SQSet() = printfn "SQUse..."; C.SettableStaticProperty <- 14
+
+        member this.TPUse = printfn "PUse..."; this.PropertyWithType + 15
+        member this.TQUse = printfn "QUse..."; this.SettablePropertyWithType + 16
+        member this.TQSet() = printfn "QUse..."; this.SettablePropertyWithType <- 17
+        static member TSPUse = printfn "SPUse..."; C.StaticPropertyWithType + 18
+        static member TSQUse = printfn "SQUse..."; C.SettableStaticPropertyWithType + 19
+        static member TSQSet() = printfn "SQUse..."; C.SettableStaticPropertyWithType <- 20
+
+    let c = C(3)
+
+    check "xcelekncew900" c.Property 3
+    check "xcelekncew901" c.PropertyExplicitGet 3
+    check "xcelekncew902" c.SettableProperty 3
+    c.QSet()
+    check "xcelekncew903" c.SettableProperty 11
+    c.SettableProperty <- 3
+    check "xcelekncew902" c.SettableProperty 3
+
+    check "xcelekncew904" C.StaticProperty 14
+    check "xcelekncew904b" C.StaticPropertyExplicitGet 14
+    check "xcelekncew905" C.SettableStaticProperty 9
+    C.SQSet()
+    check "xcelekncew905" C.SettableStaticProperty 14
+    C.SettableStaticProperty <- 9
+
+
+
+    check "celekncew901" c.PUse 12
+    check "celekncew902" c.QUse 13
+    c.QSet()
+    check "celekncew903" c.QUse 21
+
+    check "celekncew904" C.SPUse 26
+    check "celekncew905" C.SQUse 22
+    C.SQSet()
+    check "celekncew906" C.SQUse 27
+
+end
+
+module AutoProps_2 = begin
+
+    // basic
+    type C0(x:int) =
+        member val Property = x with get, set
+
+    let c0 = C0(10)
+    check "autoprops_200" c0.Property 10
+    c0.Property <- 5
+    check "autoprops_201" c0.Property 5
+
+    // override - property
+    [<AbstractClass>]
+    type C1() =
+        abstract Property : int
+
+    type D1() =
+        inherit C1()
+        override val Property = 10
+
+    let c1 = D1()
+    check "autoprops_210" c1.Property 10
+
+    // override - getter 
+    [<AbstractClass>]
+    type C2() =
+        abstract Property : int with get
+
+    type D2() =
+        inherit C2()
+        override val Property = 12
+
+    let c2 = D2()
+    check "autoprops_220" c2.Property 12
+
+    type D21() =
+        inherit C2()
+        override val Property = 8 with get
+
+    let c21 = D21()
+    check "autoprops_221" c21.Property 8
+
+    // override - setter 
+    [<AbstractClass>]
+    type C3() =
+        abstract Property : int with get, set
+
+    type D3() =
+        inherit C3()
+        override val Property = 12+9 with get, set
+
+    let c3 = D3()
+    check "autoprops_230" c3.Property 21
+    c3.Property <- 5
+    check "autoprops_231" c3.Property 5
+
+    // default
+    type C4() =
+        abstract Property : int with get, set
+        default val Property = 3 with get, set
+
+    let c4 = C4()
+    check "autoprops_240" c4.Property 3
+    c4.Property <- 19
+    check "autoprops_241" c4.Property 19
+
+    type D4() =
+        inherit C4()
+        override val Property = 4 with get, set
+
+    let c41 = D4()
+    check "autoprops_242" c41.Property 4
+    c41.Property <- 13
+    check "autoprops_243" c41.Property 13
+
+    // interface
+    type I5 =
+        abstract Property : int
+
+    type C5() =
+        interface I5 with
+            member val Property = 43
+
+    let c5 = C5() :> I5
+    check "autoprops_250" c5.Property 43
+
+    type I51 =
+        abstract Property : int
+
+    type C51() =
+        interface I51 with
+            override val Property = 31
+
+    let c51 = C51() :> I51
+    check "autoprops_251" c51.Property 31
+
+    // interface - setter
+    type I6 =
+        abstract Property : int with get, set
+
+    type C6(x:int) =
+        interface I6 with
+            member val Property = x with get, set
+
+    let c6 = C6(17)
+    check "autoprops_260" (c6 :> I6).Property 17
+
+    let c61 = C6(23) :> I6
+    check "autoprops_261" c61.Property 23
+    c61.Property <- c61.Property + 21
+    check "autoprops_262" c61.Property 44      
+end
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/basics/test.fsi b/tests/fsharp/core/members/basics/test.fsi
new file mode 100644
index 0000000..028858f
--- /dev/null
+++ b/tests/fsharp/core/members/basics/test.fsi
@@ -0,0 +1,131 @@
+module Global
+
+type ClassType1 =
+  class
+     inherit System.Object
+     val someField : string
+
+     abstract VirtualMethod1: string -> int
+     abstract VirtualMethod2: string * string -> int
+     default VirtualMethod1: string -> int
+     default VirtualMethod2: string * string -> int
+     override VirtualMethod1PostHoc : s:string -> int
+     abstract VirtualMethod1PostHoc: string -> int
+     abstract VirtualMethod2PostHoc: string * string -> int
+     override VirtualMethod2PostHoc : s1:string * s2:string -> int
+
+     new : string -> ClassType1
+
+  end
+
+type ClassType2 =
+  class
+    inherit ClassType1
+    val someField2 : string
+
+    override VirtualMethod1: string -> int
+    override VirtualMethod2: string * string -> int
+
+    new : string -> ClassType2
+  end
+
+
+module RecordTypeTest: begin
+
+    [<Sealed>]
+    type AbstractType =
+       begin // properties
+          member InstanceProperty : string
+          member MutableInstanceProperty : string
+             with get,set
+
+          member InstanceIndexer : int -> string
+             with get
+          member InstanceIndexerCount: int
+
+          member InstanceIndexer2 : int * int -> string
+             with get
+          member InstanceIndexer2Count1: int
+          member InstanceIndexer2Count2: int
+
+          member MutableInstanceIndexer : int -> string
+             with get,set 
+          member MutableInstanceIndexerCount: int
+
+          member MutableInstanceIndexer2 : int * int  -> string
+             with get,set 
+          member MutableInstanceIndexer2Count1: int
+          member MutableInstanceIndexer2Count2: int
+
+          static member StaticProperty : string
+          
+          static member MutableStaticProperty : string
+             with get,set
+             
+          static member StaticIndexer : int -> string
+             with get
+          static member StaticIndexerCount : int
+             
+          static member MutableStaticIndexer: int -> string
+             with get,set 
+          static member MutableStaticIndexerCount : int
+
+          // methods
+          member InstanceMethod : string -> string
+          
+          static member StaticMethod : string * string -> string
+
+       end
+
+end
+
+module UnionTypeTest: begin
+
+    [<Sealed>]
+    type AbstractType = 
+      begin
+          // properties
+          member InstanceProperty : string
+          member MutableInstanceProperty : string
+             with get,set
+
+          member InstanceIndexer : int -> string
+             with get
+          member InstanceIndexerCount: int
+
+          member InstanceIndexer2 : int * int -> string
+             with get
+          member InstanceIndexer2Count1: int
+          member InstanceIndexer2Count2: int
+
+          member MutableInstanceIndexer : int -> string
+             with get,set 
+          member MutableInstanceIndexerCount: int
+
+          member MutableInstanceIndexer2 : int * int  -> string
+             with get,set 
+          member MutableInstanceIndexer2Count1: int
+          member MutableInstanceIndexer2Count2: int
+
+          static member StaticProperty : string
+          
+          
+          static member MutableStaticProperty : string
+             with get,set
+             
+          static member StaticIndexer : int -> string
+             with get
+          static member StaticIndexerCount : int
+             
+          static member MutableStaticIndexer: int -> string
+             with get,set 
+          static member MutableStaticIndexerCount : int
+
+          // methods
+          member InstanceMethod : string -> string
+          
+          static member StaticMethod : string * string -> string
+
+    end
+
+end
diff --git a/tests/fsharp/core/members/console/console2.fs b/tests/fsharp/core/members/console/console2.fs
new file mode 100644
index 0000000..f59af56
--- /dev/null
+++ b/tests/fsharp/core/members/console/console2.fs
@@ -0,0 +1,72 @@
+#indent "off"
+
+module ConsoleApp
+
+type ControlEvent = CTRL_C | CTRL_BREAK | CTRL_CLOSE |CTRL_LOGOFF | CTRL_SHUTDOWN 
+  with 
+     member x.ToInt = 
+       match x with 
+       | CTRL_C -> 0
+       | CTRL_BREAK -> 1
+       | CTRL_CLOSE -> 2
+       | CTRL_LOGOFF -> 3
+       | CTRL_SHUTDOWN -> 4
+     static member OfInt(n) =
+       match n with
+       | 0 -> CTRL_C 
+       | 1 -> CTRL_BREAK 
+       | 2 -> CTRL_CLOSE 
+       | 3 -> CTRL_LOGOFF 
+       | 4 -> CTRL_SHUTDOWN 
+       |  _ -> invalid_arg "ControlEvent.ToInt"
+  end
+
+
+open System
+open System.Runtime.InteropServices
+
+type ControlEventHandler = delegate of ControlEvent -> unit
+
+[<DllImport("kernel32.dll")>]
+let SetConsoleCtrlHandler((callback:ControlEventHandler),(add: bool)) : unit = ()
+
+/// Class to catch console control events (ie CTRL-C) in C#.
+/// Calls SetConsoleCtrlHandler() in Win32 API
+type ConsoleCtrl() = 
+  begin
+    /// Handler to be called when a console event occurs.
+    val listeners = new EventListeners<_>()
+    member x.ControlEvent = x.listeners.Event
+
+    // Save the callback to a private var so the GC doesn't collect it.
+    val mutable eventHandler = Some(new Action<int>(fun i -> x.listeners.Fire(ControlEvent.OfInt(i))))
+
+    do SetConsoleCtrlHandler(eventHandler,true)
+
+    /// Remove the event handler
+    member x.Dispose(disposing)  = 
+       match x.eventHandler with 
+       | Some h -> 
+          SetConsoleCtrlHandler(h, false);
+          x.eventHandler <- None
+       | None -> ()
+
+    interface IDisposable with 
+      member x.Dispose() = x.Dispose(true)
+    end
+    override x.Finalize() = x.Dispose(false)
+ end
+
+
+let main() = 
+  let cc = new ConsoleCtrl() in 
+  cc.ControlEvent.Add(fun ce -> Console.WriteLine("Event: {0}", ce));
+  Console.WriteLine("Enter 'E' to exit");
+  while (true) do
+    let s = Console.ReadLine() in 
+    if (s == "E") then
+      exit 1;
+  done
+
+
+do main()
diff --git a/tests/fsharp/core/members/console/test.fsx b/tests/fsharp/core/members/console/test.fsx
new file mode 100644
index 0000000..fc6f43f
--- /dev/null
+++ b/tests/fsharp/core/members/console/test.fsx
@@ -0,0 +1,76 @@
+// #Conformance #Interop #Events #MemberDefinitions 
+
+type ControlEvent = CTRL_C | CTRL_BREAK | CTRL_CLOSE |CTRL_LOGOFF | CTRL_SHUTDOWN 
+  with 
+     member x.ToInt = 
+       match x with 
+       | CTRL_C -> 0
+       | CTRL_BREAK -> 1
+       | CTRL_CLOSE -> 2
+       | CTRL_LOGOFF -> 3
+       | CTRL_SHUTDOWN -> 4
+     static member OfInt(n) =
+       match n with
+       | 0 -> CTRL_C 
+       | 1 -> CTRL_BREAK 
+       | 2 -> CTRL_CLOSE 
+       | 3 -> CTRL_LOGOFF 
+       | 4 -> CTRL_SHUTDOWN 
+       |  _ -> invalid_arg "ControlEvent.ToInt"
+  end
+
+
+open System
+open System.Runtime.InteropServices
+open Idioms
+
+type ControlEventHandler = delegate of int -> int
+
+[<DllImport("kernel32.dll")>]
+let SetConsoleCtrlHandler((callback:ControlEventHandler),(add: bool)) : unit = ()
+
+/// Class to catch console control events (ie CTRL-C) in C#.
+/// Calls SetConsoleCtrlHandler() in Win32 API
+type ConsoleCtrl = class
+
+    /// Handler to be called when a console event occurs.
+    val listeners : Idioms.EventListeners<ControlEvent>
+    member x.ControlEvent = x.listeners.Event
+
+    // Save the callback to a private var so the GC doesn't collect it.
+    val mutable eventHandler : ControlEventHandler option
+
+    /// Create a new instance.
+    new() as x = 
+      let eh = new ControlEventHandler(fun i -> x.listeners.Fire(ControlEvent.OfInt(i)); 1) in 
+      SetConsoleCtrlHandler(eh,true);
+      { listeners = new EventListeners<_>();
+        eventHandler = Some eh }
+
+    /// Remove the event handler
+    member x.Dispose(disposing)  = 
+       match x.eventHandler with 
+       | Some h -> 
+          SetConsoleCtrlHandler(h, false);
+          x.eventHandler <- None
+       | None -> ()
+
+    interface IDisposable with 
+      member x.Dispose() = x.Dispose(true)
+    end
+    override x.Finalize() = x.Dispose(true)
+end
+
+
+let main() = 
+  let cc = new ConsoleCtrl() in 
+  cc.ControlEvent.Add(fun ce -> Console.WriteLine("Event: {0}", ce));
+  Console.WriteLine("Enter 'E' to exit");
+  while (true) do
+    let s = Console.ReadLine() in 
+    if (s == "E") then
+      exit 1;
+  done
+
+
+do main()
diff --git a/tests/fsharp/core/members/ctree/build.bat b/tests/fsharp/core/members/ctree/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/members/ctree/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/members/ctree/run.bat b/tests/fsharp/core/members/ctree/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/core/members/ctree/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/members/ctree/test.fsx b/tests/fsharp/core/members/ctree/test.fsx
new file mode 100644
index 0000000..8b802cd
--- /dev/null
+++ b/tests/fsharp/core/members/ctree/test.fsx
@@ -0,0 +1,52 @@
+// #Conformance #MemberDefinitions 
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+module CTree1 = begin
+
+type 'a ctree = 
+  class 
+    val isLeaf: bool
+    val leafVal: 'a option
+    val children: 'a ctree list
+
+    new(x : 'a) = { isLeaf = true; leafVal = Some(x); children = [] }
+    
+    new((dummy : bool) , (l : 'a ctree list)) = { isLeaf = false; leafVal = None; children = l }
+
+    static member MkNode(l : 'a ctree list) = new ctree<_>(true, l)
+
+  end
+ 
+
+end
+
+module CTree2 = begin
+
+
+
+type 'a ctree = 
+  class 
+    val isLeaf: bool
+    val leafVal: 'a option
+    val children: 'a ctree list
+
+    new(x : 'a) = { isLeaf = true; leafVal = Some(x); children = [] }
+    
+    new((dummy : bool) , (l : 'a ctree list)) = { isLeaf = false; leafVal = None; children = l }
+
+    static member MkNode(l : 'a ctree list) = new ctree<_>(true, l)
+
+  end
+ 
+end
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/factors/build.bat b/tests/fsharp/core/members/factors/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/members/factors/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/members/factors/dont.use.generated.signature b/tests/fsharp/core/members/factors/dont.use.generated.signature
new file mode 100644
index 0000000..fd3906a
--- /dev/null
+++ b/tests/fsharp/core/members/factors/dont.use.generated.signature
@@ -0,0 +1 @@
+"no printing of typar declared constraints" 
diff --git a/tests/fsharp/core/members/factors/run.bat b/tests/fsharp/core/members/factors/run.bat
new file mode 100644
index 0000000..37699c3
--- /dev/null
+++ b/tests/fsharp/core/members/factors/run.bat
@@ -0,0 +1,14 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\..\config.bat
+
+call %~d0%~p0..\..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
diff --git a/tests/fsharp/core/members/factors/test.fsx b/tests/fsharp/core/members/factors/test.fsx
new file mode 100644
index 0000000..6934652
--- /dev/null
+++ b/tests/fsharp/core/members/factors/test.fsx
@@ -0,0 +1,266 @@
+// #Regression #Conformance #MemberDefinitions #ObjectOrientedTypes #Classes 
+//---------------------------------------------------------------
+// lists.fs		F# source file of generic data types
+//
+// 2006 written by Ralf Herbrich
+// Microsoft Research Ltd.
+//---------------------------------------------------------------
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+open System.Collections.Generic
+
+type Matrix = M of int
+  with 
+   member x.NoRows = 0 
+   member x.NoColumns = 0 
+   member x.Item with get((i:int),(j:int)) = 0.0
+  end
+  
+module Types = begin
+  /// Shorthand notation for .NET 2.0 Lists
+  type ResizeArray<'a> = List<'a>
+end
+
+open Types
+module ResizeArray = begin
+  /// Maps a ResizeArray to another ResizeArray by application of the function f to every element.
+  let map f (r:ResizeArray<_>) : ResizeArray<_> = r.ConvertAll (fun x -> f x)
+
+  /// Iterates the function f for every element of the ResizeArray.
+  let iter f (r:ResizeArray<_>) = r.ForEach (fun x -> f x)
+
+  /// Creates a ResizeArray from a List.
+  let of_list l :ResizeArray<_> = new ResizeArray<_>(List.toArray l)
+end
+
+//---------------------------------------------------------------
+// distribution.fs		F# source file of the abstract distribution class
+//
+// 2006 written by Ralf Herbrich
+// Microsoft Research Ltd.
+//---------------------------------------------------------------
+
+
+//***************************************************
+// Abstract distribution base class 
+//***************************************************
+
+/// An abstract class for probability distributions in the exponential family.
+type IDistribution = 
+  interface 
+        /// Gets a sample from the distribution.
+        abstract member Sample : int -> System.Random -> Matrix
+        /// Computes the probability density value at a particular point.
+        abstract member Density : Matrix -> float
+        /// Computes the absolute change between two distributions.
+        abstract member AbsoluteDifference : IDistribution -> float
+  end
+  
+//***************************************************
+// Abstract distribution operation class 
+//***************************************************
+
+/// The list of distribution operations (at the moment, this is just the constant distribution).
+type DistributionOps<'Distribution> =
+  interface
+    /// The constant function distribution.
+    abstract One : 'Distribution
+  end
+
+//---------------------------------------------------------------
+// distributions.fs		F# source file of the distributions library
+//
+// 2006 written by Ralf Herbrich
+// Microsoft Research Ltd.
+//---------------------------------------------------------------
+
+   
+//***************************************************
+// 1D Gaussian
+//***************************************************
+
+/// The 1D Gaussian class for probability distribtion.
+type Gaussian1D =
+  class 
+    /// The precision mean of the Gaussian
+    val tau : float
+    /// The precision of the Gaussian
+    val pi : float
+    
+    /// The standard constructor.
+    new () = 
+      { tau = 0.0; pi = 0.0; }
+    /// The parameterised constructor.
+    new (precisionMean, precision) = 
+      { tau = precisionMean; pi = precision; }
+    
+    /// Precision of the Gaussian.
+    member x.Precision with get() = x.pi
+    /// Precision times mean of the Gaussian.
+    member x.PrecisionMean with get() = x.tau
+    /// Mean of the Gaussian (Mu).
+    member x.Mean with get () = x.tau / x.pi
+    /// Variance of the Gaussian (Sigma^2).
+    member x.Variance with get () = 1.0 / x.pi
+
+    member x.Density (point:Matrix) = 
+        if (point.NoRows > 1 || point.NoColumns > 1) then
+          failwith "This is a 1D distribution which cannot have a density of multidimensional points."
+        else
+          let diff = point.Item(1,1) - x.Mean in 
+          sqrt (x.Precision / (2.0 * System.Math.PI)) * exp (-diff * x.Precision * diff / 2.0)
+          
+      /// Absolute difference between two Gaussians 
+    member x.AbsoluteDifference (y: Gaussian1D) = 
+      max (abs (x.PrecisionMean - y.PrecisionMean)) (abs (x.Precision - y.Precision)) 
+        
+      /// Samples a 1D Gaussian
+    member x.Sample (numberOfSamples:int) random = M 1
+    
+    interface IDistribution with 
+      override x.Density point =  x.Density (point)
+      override x.AbsoluteDifference distribution = 
+          match distribution with
+          | :? Gaussian1D as gaussian1D -> x.AbsoluteDifference (gaussian1D)
+          | _ -> failwith "Wrong distribution"
+
+      override x.Sample numberOfSamples random = x.Sample numberOfSamples random
+    end
+    
+    /// String representation of a 1D Gaussian
+    override x.ToString() = "[" + x.Mean.ToString () + "," + (sqrt (x.Variance)).ToString () + "]"
+  end
+
+//***************************************************
+// The distribution operations of a 1D Gaussian
+//***************************************************
+
+let GaussianDistributionOps = { new DistributionOps<Gaussian1D>  with
+                                    member __.One = new Gaussian1D (0.0 , 0.0) }
+
+
+
+//---------------------------------------------------------------
+// factorgraph.fs	F# source file of the factor graph library
+//
+// 2006 written by Ralf Herbrich
+// Microsoft Research Ltd.
+//---------------------------------------------------------------
+
+open System.Collections.Generic
+
+//***************************************************
+// The variable node interface
+//***************************************************
+
+/// A single variable node in a factor graph. This is the non-mutable interface.
+type IVariableNode =
+  interface
+    /// The marginal distribution of the variable.
+    abstract Distribution : IDistribution
+  end
+
+//***************************************************
+// The specific variable node class
+//***************************************************
+
+/// A single variable in a factor graph.
+type VariableNode<'Distribution> when 'Distribution :> IDistribution =
+  class
+    interface IVariableNode with
+      /// Just return the distribution
+      member x.Distribution = x.distribution :> IDistribution
+    end
+    
+    /// The marginal distribution of the variable.
+    val mutable distribution : 'Distribution
+    
+    /// Sets up a new variable node
+    new (dOps : DistributionOps<_>) = { distribution = dOps.One; }
+  end
+
+//***************************************************
+// The factor node interface
+//***************************************************
+
+/// The computation nodes (i.e. factor nodes) of a factor graph.
+type IFactorNode =
+  interface
+    /// The list of all variables that this factor "talks" to.
+    abstract VariableNodes : IEnumerable< IVariableNode >
+    /// The list of messages from the factor to all its variables.
+    abstract Messages : IEnumerable< IDistribution >
+    /// Abstract update (computation) mechansim
+    abstract UpdateMessage : int -> float 
+  end
+
+(*
+/// A factor graph node.
+type FactorGraphNode = 
+  {
+    /// The internal ID of a factor graphs node.
+    ID		: int;
+    /// The X coordinate of the factor graph node.
+    X		: float;
+    /// The Y coordinate of the factor graph node.
+    Y		: float;
+    /// The name of the node.
+    Name	: string;
+  }*)
+
+//---------------------------------------------------------------
+// factornodes.fs	F# source file of several factor nodes
+//
+// 2006 written by Ralf Herbrich
+// Microsoft Research Ltd.
+//---------------------------------------------------------------
+
+open System
+
+(*
+let Gaussian1DPriorFactorNode ((var: VariableNode<Gaussian1D>), mean, variance) =
+  //let message = ref  GaussianDistributionOps.One in 
+  { new IFactorNode 
+  with UpdateMessage i =
+      if i > 0 then 
+        raise (new ArgumentOutOfRangeException ("iVariableIndex", "This factor only points to one variable."));
+      let oldMarginal = var.distribution in
+      let newMarginal = new Gaussian1D (mean / variance + oldMarginal.PrecisionMean, 1.0 / variance + oldMarginal.Precision) in
+      var.distribution <- newMarginal;
+      oldMarginal.AbsoluteDifference (newMarginal)
+  and get_Messages() = Seq.ofList [ ] //(!message :> IDistribution) ]
+  and get_VariableNodes() = Seq.ofList [ (var :> IVariableNode) ] }
+*)
+
+let OneVariableNode((var: VariableNode<_>),f) =
+ // let message = ref  (new Gaussian1D(0.0,0.0) ) in 
+  { new IFactorNode  with
+      member __.UpdateMessage i =
+          if i > 0 then 
+            raise (new ArgumentOutOfRangeException ("iVariableIndex", "This factor only points to one variable."));
+          let oldMarginal = var.distribution in
+          let newMarginal = f oldMarginal in
+          var.distribution <- newMarginal;
+          (oldMarginal :> IDistribution).AbsoluteDifference (newMarginal)
+      member __.Messages = Seq.ofList [ (* (!message :> IDistribution) *) ]
+      member __.VariableNodes = Seq.ofList [ (var :> IVariableNode) ] }
+
+let Gaussian1DPriorFactorNode((var: VariableNode<Gaussian1D>), mean, variance) =
+  let update (oldMarginal : Gaussian1D) = new Gaussian1D (mean / variance + oldMarginal.PrecisionMean, 1.0 / variance + oldMarginal.Precision) in
+  OneVariableNode(var, update)
+  
+
+//---------------------------------------------------------------------
+// Finish up
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/incremental/build.bat b/tests/fsharp/core/members/incremental/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/members/incremental/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/members/incremental/dont.use.generated.signature b/tests/fsharp/core/members/incremental/dont.use.generated.signature
new file mode 100644
index 0000000..c1301f0
--- /dev/null
+++ b/tests/fsharp/core/members/incremental/dont.use.generated.signature
@@ -0,0 +1 @@
+foo  
diff --git a/tests/fsharp/core/members/incremental/run.bat b/tests/fsharp/core/members/incremental/run.bat
new file mode 100644
index 0000000..dda8961
--- /dev/null
+++ b/tests/fsharp/core/members/incremental/run.bat
@@ -0,0 +1,13 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\..\config.bat
+
+call %~d0%~p0..\..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
diff --git a/tests/fsharp/core/members/incremental/test-hw.fsx b/tests/fsharp/core/members/incremental/test-hw.fsx
new file mode 100644
index 0000000..483faa6
--- /dev/null
+++ b/tests/fsharp/core/members/incremental/test-hw.fsx
@@ -0,0 +1,723 @@
+// #Conformance #MemberDefinitions #Mutable #ObjectOrientedTypes #Classes #InterfacesAndImplementations #Recursion 
+#light
+
+
+//! Setup
+
+let failures = ref false
+let report_failure () = stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+//! Address of incremental  local mutable
+  
+module AddresOfIncrementalClassLocalMutable = 
+
+    open System.Drawing
+    open System.Windows.Forms
+    let rr = new Rectangle()               // <-------- value type
+    type LocalMutableTestA() = 
+      let mutable mvarA  = rr
+      member x.MethodA() = mvarA.X         // <-------- require address of it for arg to getter
+    
+
+
+
+//! Address of mutable record field (related to above)
+
+module AddresOfMutableRecordField = 
+    open System.Drawing
+    open System.Windows.Forms
+
+    type RectR = { mutable field : Rectangle }
+    let f (x:RectR) = x.field.X <- 10
+    let boxR = {field = new Rectangle() }
+    do  assert(boxR.field.X=0)  
+    do  f boxR
+    do  assert(boxR.field.X=10)
+
+
+
+//! Minor test
+
+module MinorTest = 
+    type A<'a>(x) = 
+        
+            let (y:'a) = x
+            member this.X = y
+        
+
+    let x1 = new A<string>("abc")    
+    let x2 = new A<int>(3)
+    let x3 = new A<int64>(3L)
+
+
+
+//! Misc
+
+module Misc = 
+    type 'a Area9aa(x) =
+    
+        let a = (x : 'a)
+        let f (y:'a) = y
+    
+
+    type AList(a) = 
+      let x1 = a + 1
+      let y2 = x1 + 1
+      let y3 = 3
+      member pairs_this.Pair() = x1,y2
+    
+    let a = new AList 12
+    do  assert( a.Pair() = (13,14) )
+
+
+
+//! Wire prevously
+    
+(* accepted *)
+module WireOld = 
+    [<AbstractClass>]
+    type 'a wire =
+    
+      abstract Send   : 'a -> unit
+      abstract Listen : ('a -> unit) -> unit
+      new () = {}
+      member self.Event = self :> 'a IEvent
+      interface IEvent<'a> with
+          member x.Subscribe(handler) = failwith "nyi"
+          member x.AddHandler(handler) = failwith "nyi"
+          member x.RemoveHandler(handler) = failwith "nyi"
+      
+    
+    let createWire() =
+      let listeners = ref [] in
+      {new wire<'a>() with
+         member __.Send(x)   = List.iter (fun f -> f x) !listeners
+         member __.Listen(f) = listeners := f :: !listeners
+      }
+
+
+
+//! Wire variations
+
+module WireVariations = 
+    (* Accepted *)    
+    type wire2(z) =
+      
+         let z = z
+         member this.Send(x) = 1 + z + x
+      
+
+    (* Accepted *)
+    type 'a wire3(z) =
+      
+         let listeners = (z:'a)
+         member this.Send(x:'a) = x
+      
+
+    (* Accepted *)    
+    type wire4<'a>(z) =
+      
+         let listeners = let z:'a = z in ref ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = List.iter (fun f -> f x) !listeners
+         member this.Listen(f:'a -> unit) = listeners := f :: !listeners
+      
+
+    (* Accepted *)    
+    type 'a wire5(z) =
+      
+         let listeners = ref ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = let z:'a = z in List.iter (fun f -> f x) !listeners
+         member this.Listen(f:'a -> unit) = listeners := f :: !listeners
+      
+
+    (* Accepted now - fixed tinst missing error *)
+    type 'a wire6(z) =
+      
+         let mutable listeners = ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = let z:'a = z in List.iter (fun f -> f x) listeners
+         member this.Listen(f:'a -> unit) = listeners <- f :: listeners
+    
+
+    (* OK, now this types are asserted equal *)
+    type 'a wire7(z) =
+      
+         let listeners  = 12
+         let z : 'a = z
+         member this.SendA(x:int) = this,listeners
+         member this.SendB(x:int) = this,listeners       
+      
+
+    (* Soundness concern: should uses of let-fields force a member "this" to be ('a wire) typed? *)
+    type 'a wire8(z) =
+      
+         let z : 'a = z  
+         let listeners  = 12
+         member this.SendA(x:int) = x,z,(this: 'a wire8)
+         member this.SendB(x:int) = x,z,(this: 'a wire8)
+      
+
+    (* Accepted *)    
+    type 'a wire9(z) =
+      
+         let mutable listeners  = ([] : int list)
+         let z : 'a = z
+         member this.Send(x:int) =
+           let ls : int list = 1 :: 2 :: listeners in
+           List.map (fun x -> x+1) ls
+    
+
+    (* Accepted *)    
+    type 'a wire10(z) =
+      
+         let mutable listeners  = ([] : int list)
+         let z : 'a = z
+         member this.Send(x:int) =
+           let ls : int list = listeners @ [1] in  (* it seems listeners may have the wrong type... *)
+           List.map (fun f -> f) ls
+    
+
+    (* Accepted *)    
+    type 'a wire11(z) =
+      
+         let listeners  = let z:int = z in ([] : int list)
+         member this.Send(x:'b) = (* List.iter (fun f -> ()) listeners *)
+             let xx : 'b wire11 = this in      
+             Some (x,List.head listeners)
+    
+
+    (* Accepted *)    
+    type 'a wire12(z) =
+      
+         let listeners  = let z:'a = z in ([] : int list)
+         member this.Send(x:'b) = (* List.iter (fun f -> ()) listeners *)
+             Some (this,x,List.head listeners)
+    
+
+    (* OK, after avoid the value restriction *)    
+    type wire13(z) =
+      
+         member this.Send(x:'b) = (ignore (z:int)); Some (this,x)
+    
+
+    (* Accepted *)
+    type 'a wire14(z) =
+      
+         let mutable listeners  = let z:int = z in ([] : int list)
+         member this.Send(x:'a) = (* List.iter (fun f -> ()) listeners *)
+             listeners
+    
+
+
+
+//! Area variations
+  
+module AreaVariations = 
+    (* Accepted *)
+    open System.Drawing
+    open System.Windows.Forms
+    open WireOld
+    
+    type Area1(x) =
+    
+        inherit Panel()
+        let x = x * 2
+    
+
+    type Area2(x) =
+    
+        inherit Panel()
+        let x = x * 2      
+        let mutable Bitmap = new Bitmap(100,100)
+        let mutable GC     = Graphics.FromImage(Bitmap)
+        let fff (x:Area2) = x.Resize ()      
+        member this.Resize  () = Bitmap <- new Bitmap(10,20)
+    
+
+    type Area3(x) =
+    
+        let basePanel = let x = x:unit in new Panel()
+        let mutable Bitmap = new Bitmap(100,100)
+        let mutable GC     = Graphics.FromImage(Bitmap)
+        let fff (x:Area3) = x.Resize ()      
+        member this.Resize  () = Bitmap <- new Bitmap(10,20)
+    
+
+    type Area4 =
+      
+        inherit Panel 
+        member this.X() = base.Dock
+    
+
+    type Area5(x) =
+    
+        inherit Panel() 
+        let x = 1 + x
+          (**)
+        let mutable Bitmap = new Bitmap(100,100)
+        let mutable GC     = Graphics.FromImage(Bitmap)   (* GC for bitmap *)
+        let resizedWire    = createWire() : (int*int) wire
+        let mutable Count  = 0
+          (**)
+        do base.BackColor <- Color.Black
+        do base.Dock      <- DockStyle.Fill
+        do base.Cursor    <- Cursors.Cross
+    //  do base.Resize.Add(fun arg  -> area.resize ())                    (* use before defn risk *)
+    //  do base.Paint .Add(fun args -> area.redrawDrawArea args.Graphics) (* use before defn risk *)
+          (**)
+        member this.ResizedE = resizedWire.Event
+          (**)
+        member this.Resize () =
+          let ww,hh = base.Width,base.Height in
+          if ww>0 && hh>0 then (
+                Bitmap <- new Bitmap(ww,hh);
+                GC     <- Graphics.FromImage(Bitmap);
+                resizedWire.Send((ww,hh))
+          )
+          (**)
+    //  TODO: need to be able to call this.PriorMethod without this.qualification
+    //  do base.Resize.Add(fun arg  -> Resize ())                         (* no risk *)  
+          (**)
+        member this.RedrawDrawArea (gc:Graphics) = gc.DrawImage(Bitmap,new Point(0,0))
+    //  member this.Refresh() = using (base.CreateGraphics()) (fun gc ->      RedrawDrawArea gc)   
+        member this.Refresh2() = using (base.CreateGraphics()) (fun gc -> this.RedrawDrawArea gc)        
+        (**)
+    //  do base.Paint.Add(fun args -> RedrawDrawArea args.Graphics)       (* no risk *)
+    //  do base.Paint.Add(fun args -> <impliedThisVariable>.RedrawDrawArea args.Graphics)       (* no risk *)
+    
+
+    type Area5b(x) as self =
+    
+        inherit Panel() 
+        let x = 1 + x
+          (**)
+        let mutable Bitmap = new Bitmap(100,100)
+        let mutable GC     = Graphics.FromImage(Bitmap)   (* GC for bitmap *)
+        let resizedWire    = createWire() : (int*int) wire
+        let mutable Count  = 0
+          (**)
+        do self.BackColor <- Color.Black
+        do self.Dock      <- DockStyle.Fill
+        do self.Cursor    <- Cursors.Cross
+    //  do self.Resize.Add(fun arg  -> area.resize ())                    (* use before defn risk *)
+    //  do self.Paint .Add(fun args -> area.redrawDrawArea args.Graphics) (* use before defn risk *)
+          (**)
+        member this.ResizedE = resizedWire.Event
+          (**)
+        member this.Resize () =
+          let ww,hh = self.Width,self.Height in
+          if ww>0 && hh>0 then (
+                Bitmap <- new Bitmap(ww,hh);
+                GC     <- Graphics.FromImage(Bitmap);
+                resizedWire.Send((ww,hh))
+          )
+          (**)
+    //  TODO: need to be able to call this.PriorMethod without this.qualification
+    //  do self.Resize.Add(fun arg  -> Resize ())                         (* no risk *)  
+          (**)
+        member this.RedrawDrawArea (gc:Graphics) = gc.DrawImage(Bitmap,new Point(0,0))
+    //  member this.Refresh() = using (self.CreateGraphics()) (fun gc ->      RedrawDrawArea gc)   
+        member this.Refresh2() = using (self.CreateGraphics()) (fun gc -> this.RedrawDrawArea gc)        
+        (**)
+    //  do self.Paint.Add(fun args -> RedrawDrawArea args.Graphics)       (* no risk *)
+    //  do self.Paint.Add(fun args -> <impliedThisVariable>.RedrawDrawArea args.Graphics)       (* no risk *)
+    
+
+    type Area6(x) =
+    
+        inherit Panel() 
+        let x = 1 + x
+        do base.BackColor <- Color.Black      
+    
+
+    type Area7(x) =
+    
+        inherit Panel() 
+        let a,b = x : int * int
+        do base.BackColor <- Color.Black      
+    
+
+    open System.Drawing
+    open System.Windows.Forms
+    type 'a Area8(x) =
+    
+        inherit Panel() 
+        let a,b = (x : int * int)
+        do base.BackColor <- Color.Black
+        let f (y:'a) = y
+        let xx = a
+    
+
+    type 'a Area9(x) =
+    
+        let a = (x : 'a)
+    //    let f (y:'a) = y
+    
+
+    type 'a Area10 =
+    
+      val f : 'a -> 'a
+      new (x:int) = { f = fun x -> x}  
+    
+
+
+
+//! Person
+  
+(* Scala person example *)
+module ScalaPersonExample = 
+    type Person1(firstLastSpouse) =
+      
+        let firstName,lastName,spouse = firstLastSpouse
+        member x.FirstName = firstName : string
+        member x.LastName  = lastName  : string
+        member x.Spouse    = spouse    : Person1 option
+        member x.Introduction() =
+          "Hi, my name is " ^ firstName ^ " " ^ lastName ^
+          (match spouse with
+           | None        -> "."
+           | Some spouse -> " and this is my spouse, " ^ spouse.FirstName ^ " " ^ spouse.LastName ^ ".")
+        // TODO: the implicit ctor is not in scope for defining alt constructors.
+        // new (f,l) = new Person1(f,l,None)
+    
+    let pA = new Person1(("bob" ,"smith",None))
+    let pB = new Person1(("jill","smith",Some pA))
+
+
+
+
+//! Forms
+  
+module Forms1 = 
+    open System.Drawing
+    open System.Windows.Forms
+    type DrawPanel(w) as c =
+    
+      inherit Panel() 
+      do  base.Width  <- w
+      do  base.Height <- w
+      do  base.BackColor <- Color.Black
+      let mutable BM = new Bitmap(w,w)
+      let GC' = Graphics.FromImage(BM)
+      let refresh() = using (c.CreateGraphics()) (fun gc -> gc.DrawImage(BM,new Point(0,0)))
+      do  c.Paint.Add(fun _ -> refresh())
+      (*external*)
+      member this.Redraw() = refresh()
+      member this.GC = GC'
+    
+
+
+module Forms2 = 
+
+    open System.Drawing
+    open System.Windows.Forms
+    type DrawPanel2 (w,h) as c =
+    
+      inherit Panel() 
+      do  base.Width  <- w
+      do  base.Height <- h
+      do  base.BackColor <- Color.DarkBlue
+      let mutable BM = new Bitmap(w,w)
+      let refresh() = using (c.CreateGraphics()) (fun gc -> gc.DrawImage(BM,new Point(0,0)))
+      let GC' = Graphics.FromImage(BM)
+      let uuu = ()
+      let u2 = uuu,uuu
+      (*external*)
+      do  c.Paint.Add(fun _ -> refresh())
+      member this.Redraw() = refresh()
+      member this.GC = GC'
+    
+
+    let form = new Form(Visible=true,AutoScroll=true)
+    let dp = new DrawPanel2(800,400)
+    do  form.Controls.Add(dp)
+    do  dp.GC.DrawLine(Pens.White,10,20,30,40)
+    do  dp.Redraw()
+
+
+module Regression1 = 
+    (* Regression test: local vals of unit type are not given field storage (even if mutable) *)
+    type UnitTestA2 (x,y) =
+    
+      do  printf "TestA %d\n" (x*y)
+      let u = ()
+      let mutable mu = ()
+      let mutable kept = false
+      member this.Unlikely() = mu <- (kept <- true; (* ensure effect is not optimised away *)
+                                      printf "Boo\n"
+                                     )
+      member this.Kept with get() = kept
+    
+    let x = new UnitTestA2(1,2)
+    do  x.Unlikely()
+    do  assert(x.Kept = true)
+
+
+
+//! typar scoping
+
+module TyparScopeChecks = 
+    (* typar scoping checks 1 *)
+    type ('a,'b) classB1(aa,bb) =
+    
+      let a = aa : 'a
+      let b = bb : 'b
+      let f (aaa:'a) (bbb:'b) = aaa,bbb
+    
+
+    (* typar scoping checks *)
+    type ('a,'b) classB2(aa:'a,bb:'b) =
+    
+      let a = aa
+      let b = bb
+      let f (aaa:'a) (bbb:'b) = aaa,bbb
+    
+
+
+
+
+module LocalLetRecTests = 
+    //! local let rec test
+        
+    (* let rec tests *)
+    type LetRecClassA1 (a,b) =
+    
+      let a,b = a,b
+      let x = a*3 + b*2
+      let rec fact n = if n=1 then 1 else n * fact (n-1)
+      member this.Fa() = fact a
+      member this.Fb() = fact b
+    
+    let lrCA1 = new LetRecClassA1(3,4)
+    let xa = lrCA1.Fa()
+    let xb = lrCA1.Fb()
+
+    (* let rec tests *)
+    type LetRecClassA2 () =
+    
+      let rec odd  n = printf "odd  %d?\n" n; if n=0 then false else not(even (n-1))
+      and even n = printf "even %d?\n" n; if n=0 then true  else not(odd (n-1))
+      member this.Even(x) = even x
+      member this.Odd(x)  = odd x
+    
+    let lrCA2 = new LetRecClassA2()
+    let ex2 = lrCA2.Even(2)
+    let ex3 = lrCA2.Odd(3)
+    let ox2 = lrCA2.Odd(2)
+    let ox3 = lrCA2.Even(3)
+
+
+    //! local let rec test
+        
+    type nats = HD of int * (unit -> nats)
+    let rec ns = HD (2,(fun () -> HD (3,(fun () -> ns))))
+    let rec take n (HD (x,xf)) = if n=0 then [] else x :: take (n-1) (xf())
+      
+    type LetRecClassA3 () =
+    
+      let rec ns = HD (2,(fun () -> HD (3,(fun () -> ns))))
+      let rec xs = 1::2::3::xs  (* WHY IS THIS ACCEPT HERE, BUT NOT AT THE TOP LEVEL??? *)
+      member this.NS = ns
+      member this.XS = xs
+    
+    let lrCA3 = new LetRecClassA3()
+    let ns123 = lrCA3.NS
+    let xs123 = lrCA3.XS
+
+    type LetRecClassA4 () =
+    
+      let rec xs = 1::2::3::xs  (* WHY IS THIS ACCEPT HERE, BUT NOT AT THE TOP LEVEL??? *)
+      member this.XS = xs
+    
+    let lrCA4    = new LetRecClassA4()
+    let error123 = lrCA4.XS
+
+
+
+//! override test
+  
+module OverrideTest1 = 
+    [<AbstractClass>]
+    type AbstractClass =
+    
+        new() = {}
+        abstract MA : int -> int
+        abstract MB : int -> int
+    
+
+    type OverrideClassA1 () =
+      
+        inherit AbstractClass()
+        override this.MA(x) = x+1
+        override this.MB(x) = x+2
+    
+
+
+module OverrideTest2 = 
+
+    //! abstract test
+      
+    [<AbstractClass>]
+    type ImplicitAbstractClass() =
+    
+        abstract MA : int -> int
+        abstract MB : int -> int
+    
+
+    type OverrideClassA2 () =
+      
+        inherit ImplicitAbstractClass()
+        override this.MA(x) = x+1
+        override this.MB(x) = x+2
+    
+    let oca2 = new OverrideClassA2()
+    do  assert(oca2.MA(1)=2)
+    do  assert(oca2.MB(1)=3)
+
+
+
+module ConstructionTests = 
+    //! CC tests
+    type CC (x) =
+      
+        let mutable z = x+1
+        let f = fun () -> z
+        member a.F() = f()
+        member a.Set x = z <- x
+      
+
+    let cc = new CC(1)
+    cc.F()
+    cc.Set(20)
+    cc.F()
+
+
+    //! interface
+    type CCCCCCCC() = 
+      interface System.IDisposable with      
+          member x.Dispose() = ()
+      
+    
+
+
+
+module StaticMemberScopeTest = 
+    //! static expr test
+    type StaticTestA1(argA,argB) = 
+      let         locval = 1 + argA
+      let mutable locmut = 2 + argB
+      static member M = 12 (* can not use: locval + locmut + argA  *)
+    
+
+
+module ConstructorArgTests = 
+
+    //! ctor args stored in fields
+    type CtorArgClassA1(argA,argB) = 
+      member x.M = argA + argB*2
+     
+
+
+module SelfReferenceTests = 
+    type SelfReferences(a,b) as self = 
+      let f()   = self.M  
+      let ab    = a*b+2
+      let x =
+        let ok =
+          try
+            let x = self.M in
+            printf "Error: self reference got through - should catch these\n";
+            false (* not ok here *)
+          with _ ->
+            printf "Self reference during construction threw exception, as required\n";
+            true (* ok, got exn *)
+        in
+        assert(ok);
+        ok
+      member self.M = (ab : int)
+      member self.P = f()
+     
+    let sr = new SelfReferences(1,2)
+
+
+//! Bug: 878 - type unsoundness - implicit constructor members generalising "free-imperative" typars from let-bindings
+(* must be -ve test
+type C() = 
+   let t = ref (Map.empty<string,_>)
+   let f x = (!t).Add("3",x)
+   member x.M() = !t
+
+*)  
+
+
+module MixedRecursiveTypeDefinitions = 
+
+    type ClassType<'a>(x:'a) =         
+        member self.X = x
+        
+    and RecordType =
+        { field1 : int;
+          field2 : ClassType<int> }
+        member self.GetField() = self.field2
+        
+    and UnionType =
+        | Case1 of string * AbbrevType1
+        | Case2 of string * AbbrevType2
+
+    and AbbrevType1 = ClassType<int>
+
+    and AbbrevType2 = ClassType<string>
+
+    and AnotherClassType<'a>(x:'a) = 
+        member self.X = x
+        interface InterfaceType<'a> with 
+            member self.X = x
+        
+    and InterfaceType<'a> = 
+        abstract X : 'a
+        
+    
+
+module ExceptionsWithAugmentations = 
+    exception E of string * string
+            with 
+               override x.Message = "A"
+            end
+
+
+    let x = E("3","3")
+
+    1+1
+    
+    test "ckwh98u" ((try raise x with e -> e.Message) = "A")
+
+    exception E2Exception of string * string
+            with 
+               override x.Message = "A"
+               member x.Member2 = "E"
+            end
+
+
+    let x2 = E2Exception("3","3")
+
+    1+1
+    
+    test "ckwh98v" ((try raise x2 with :? E2Exception as e -> e.Member2) = "E")
+
+
+//! Test cases:
+(*  
+  [ ] - self-references - allowed and trapped
+  [ ] - direct calls to most derrived base override
+  [ ] - calls on "super" object - via self and super vars
+*)
+
+//! Finish
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/incremental/test.fsx b/tests/fsharp/core/members/incremental/test.fsx
new file mode 100644
index 0000000..6d6a261
--- /dev/null
+++ b/tests/fsharp/core/members/incremental/test.fsx
@@ -0,0 +1,728 @@
+// #Conformance #MemberDefinitions #Mutable #ObjectOrientedTypes #Classes #InterfacesAndImplementations #Recursion 
+(* (c) Microsoft Corporation. All rights reserved *)
+// CONTENTS-INDEX-REGEXP = FROM>^//! +<TO
+//----------------------------------------------------------------------------
+//CONTENTS-START-LINE: HERE=3 SEP=2
+// 30.    Setup
+// 38.    Address of incremental class local mutable
+// 49.    Address of mutable record field (related to above)
+// 59.    Minor test
+// 72.    Misc
+// 90.    Wire prevously
+// 114.   Wire variations
+// 224.   Area variations
+// 335.   Person
+// 393.   Forms
+// 456.   typar scoping
+// 475.   local let rec test
+// 506.   local let rec test
+// 532.   override test
+// 549.   abstract test
+// 568.   CC tests
+// 583.   interface
+// 591.   static expr test
+// 599.   ctor args stored in fields
+// 605.   Test cases:
+// 621.   Finish
+//CONTENTS-END-LINE:
+//--------------------------------------------------------------------------
+
+
+//! Setup
+
+let failures = ref false
+let report_failure () = stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+//! Address of incremental class local mutable
+  
+module AddresOfIncrementalClassLocalMutable = begin
+
+    open System.Drawing
+    open System.Windows.Forms
+    let rr = new Rectangle()               // <-------- value type
+    type LocalMutableTestA() = class
+      let mutable mvarA  = rr
+      member x.MethodA() = mvarA.X         // <-------- require address of it for arg to getter
+    end
+
+end
+
+//! Address of mutable record field (related to above)
+
+module AddresOfMutableRecordField = begin
+    open System.Drawing
+    open System.Windows.Forms
+
+    type RectR = { mutable field : Rectangle }
+    let f (x:RectR) = x.field.X <- 10
+    let boxR = {field = new Rectangle() }
+    do  assert(boxR.field.X=0)  
+    do  f boxR
+    do  assert(boxR.field.X=10)
+
+end
+
+//! Minor test
+
+module MinorTest = begin
+    type A<'a>(x) = 
+        class
+            let (y:'a) = x
+            member this.X = y
+        end
+
+    let x1 = new A<string>("abc")    
+    let x2 = new A<int>(3)
+    let x3 = new A<int64>(3L)
+end
+
+
+//! Misc
+
+module Misc = begin
+    type 'a Area9aa(x) =
+        class
+            let a = (x : 'a)
+            let f (y:'a) = y
+        end
+
+    type AList(a) = class
+      let x1 = a + 1
+      let y2 = x1 + 1
+      let y3 = 3
+      member pairs_this.Pair() = x1,y2
+    end
+    let a = new AList 12
+    do  assert( a.Pair() = (13,14) )
+end
+
+
+//! Wire prevously
+    
+(* accepted *)
+module WireOld = begin
+    [<AbstractClass>]
+    type 'a wire =
+        class
+          abstract Send   : 'a -> unit
+          abstract Listen : ('a -> unit) -> unit
+          new () = {}
+          member self.Event = self :> 'a IEvent
+          interface IEvent<'a> with
+              member x.Subscribe(handler) = failwith "nyi"
+              member x.AddHandler(handler) = failwith "nyi"
+              member x.RemoveHandler(handler) = failwith "nyi"
+          end
+        end
+    let createWire() =
+      let listeners = ref [] in
+      {new wire<'a>() with 
+          member __.Send(x)   = List.iter (fun f -> f x) !listeners
+          member __.Listen(f) = listeners := f :: !listeners
+      }
+
+end
+
+//! Wire variations
+
+module WireVariations = begin
+    (* Accepted *)    
+    type wire2(z) =
+      class
+         let z = z
+         member this.Send(x) = 1 + z + x
+      end
+
+    (* Accepted *)
+    type 'a wire3(z) =
+      class
+         let listeners = (z:'a)
+         member this.Send(x:'a) = x
+      end
+
+    (* Accepted *)    
+    type wire4<'a>(z) =
+      class
+         let listeners = let z:'a = z in ref ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = List.iter (fun f -> f x) !listeners
+         member this.Listen(f:'a -> unit) = listeners := f :: !listeners
+      end
+
+    (* Accepted *)    
+    type 'a wire5(z) =
+      class
+         let listeners = ref ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = let z:'a = z in List.iter (fun f -> f x) !listeners
+         member this.Listen(f:'a -> unit) = listeners := f :: !listeners
+      end
+
+    (* Accepted now - fixed tinst missing error *)
+    type 'a wire6(z) =
+      class
+         let mutable listeners = ([] : ('a -> unit) list)
+         member this.Send(x:'a)           = let z:'a = z in List.iter (fun f -> f x) listeners
+         member this.Listen(f:'a -> unit) = listeners <- f :: listeners
+    end
+
+    (* OK, now this types are asserted equal *)
+    type 'a wire7(z) =
+      class
+         let listeners  = 12
+         let z : 'a = z
+         member this.SendA(x:int) = this,listeners
+         member this.SendB(x:int) = this,listeners       
+      end
+
+    (* Soundness concern: should uses of let-fields force a member "this" to be ('a wire) typed? *)
+    type 'a wire8(z) =
+      class
+         let z : 'a = z  
+         let listeners  = 12
+         member this.SendA(x:int) = x,z,(this: 'a wire8)
+         member this.SendB(x:int) = x,z,(this: 'a wire8)
+      end
+
+    (* Accepted *)    
+    type 'a wire9(z) =
+      class
+         let mutable listeners  = ([] : int list)
+         let z : 'a = z
+         member this.Send(x:int) =
+           let ls : int list = 1 :: 2 :: listeners in
+           List.map (fun x -> x+1) ls
+    end
+
+    (* Accepted *)    
+    type 'a wire10(z) =
+      class
+         let mutable listeners  = ([] : int list)
+         let z : 'a = z
+         member this.Send(x:int) =
+           let ls : int list = listeners @ [1] in  (* it seems listeners may have the wrong type... *)
+           List.map (fun f -> f) ls
+    end
+
+    (* Accepted *)    
+    type 'a wire11(z) =
+      class
+         let listeners  = let z:int = z in ([] : int list)
+         member this.Send(x:'b) = (* List.iter (fun f -> ()) listeners *)
+             let xx : _ wire11 = this in      
+             Some (x,List.head listeners)
+    end
+
+    (* Accepted *)    
+    type 'a wire12(z) =
+      class
+         let listeners  = let z:'a = z in ([] : int list)
+         member this.Send(x:'b) = (* List.iter (fun f -> ()) listeners *)
+             Some (this,x,List.head listeners)
+    end
+
+    (* OK, after avoid the value restriction *)    
+    type wire13(z) =
+      class
+         member this.Send(x:'b) = (ignore (z:int)); Some (this,x)
+    end
+
+    (* Accepted *)
+    type 'a wire14(z) =
+      class
+         let mutable listeners  = let z:int = z in ([] : int list)
+         member this.Send(x:'a) = (* List.iter (fun f -> ()) listeners *)
+             listeners
+    end
+end
+
+
+//! Area variations
+  
+module AreaVariations = begin
+    (* Accepted *)
+    open System.Drawing
+    open System.Windows.Forms
+    open WireOld
+    
+    type Area1(x) =
+        class
+            inherit Panel()
+            let x = x * 2
+        end
+
+    type Area2(x) =
+        class
+            inherit Panel()
+            let x = x * 2      
+            let mutable Bitmap = new Bitmap(100,100)
+            let mutable GC     = Graphics.FromImage(Bitmap)
+            let fff (x:Area2) = x.Resize ()      
+            member this.Resize  () = Bitmap <- new Bitmap(10,20)
+        end
+
+    type Area3(x) =
+        class
+            let basePanel = let x = x:unit in new Panel()
+            let mutable Bitmap = new Bitmap(100,100)
+            let mutable GC     = Graphics.FromImage(Bitmap)
+            let fff (x:Area3) = x.Resize ()      
+            member this.Resize  () = Bitmap <- new Bitmap(10,20)
+        end
+
+    type Area4 =
+      class
+        inherit Panel 
+        member this.X() = base.Dock
+    end
+
+    type Area5(x) =
+        class
+            inherit Panel() 
+            let x = 1 + x
+              (**)
+            let mutable Bitmap = new Bitmap(100,100)
+            let mutable GC     = Graphics.FromImage(Bitmap)   (* GC for bitmap *)
+            let resizedWire    = createWire() : (int*int) wire
+            let mutable Count  = 0
+              (**)
+            do base.BackColor <- Color.Black
+            do base.Dock      <- DockStyle.Fill
+            do base.Cursor    <- Cursors.Cross
+        //  do base.Resize.Add(fun arg  -> area.resize ())                    (* use before defn risk *)
+        //  do base.Paint .Add(fun args -> area.redrawDrawArea args.Graphics) (* use before defn risk *)
+              (**)
+            member this.ResizedE = resizedWire.Event
+              (**)
+            member this.Resize () =
+              let ww,hh = base.Width,base.Height in
+              if ww>0 && hh>0 then (
+                    Bitmap <- new Bitmap(ww,hh);
+                    GC     <- Graphics.FromImage(Bitmap);
+                    resizedWire.Send((ww,hh))
+              )
+              (**)
+        //  TODO: need to be able to call this.PriorMethod without this.qualification
+        //  do base.Resize.Add(fun arg  -> Resize ())                         (* no risk *)  
+              (**)
+            member this.RedrawDrawArea (gc:Graphics) = gc.DrawImage(Bitmap,new Point(0,0))
+        //  member this.Refresh() = using (base.CreateGraphics()) (fun gc ->      RedrawDrawArea gc)   
+            member this.Refresh2() = using (base.CreateGraphics()) (fun gc -> this.RedrawDrawArea gc)        
+            (**)
+        //  do base.Paint.Add(fun args -> RedrawDrawArea args.Graphics)       (* no risk *)
+        //  do base.Paint.Add(fun args -> <impliedThisVariable>.RedrawDrawArea args.Graphics)       (* no risk *)
+        end
+
+    type Area5b(x) as self =
+        class
+            inherit Panel() 
+            let x = 1 + x
+              (**)
+            let mutable Bitmap = new Bitmap(100,100)
+            let mutable GC     = Graphics.FromImage(Bitmap)   (* GC for bitmap *)
+            let resizedWire    = createWire() : (int*int) wire
+            let mutable Count  = 0
+              (**)
+            do self.BackColor <- Color.Black
+            do self.Dock      <- DockStyle.Fill
+            do self.Cursor    <- Cursors.Cross
+        //  do self.Resize.Add(fun arg  -> area.resize ())                    (* use before defn risk *)
+        //  do self.Paint .Add(fun args -> area.redrawDrawArea args.Graphics) (* use before defn risk *)
+              (**)
+            member this.ResizedE = resizedWire.Event
+              (**)
+            member this.Resize () =
+              let ww,hh = self.Width,self.Height in
+              if ww>0 && hh>0 then (
+                    Bitmap <- new Bitmap(ww,hh);
+                    GC     <- Graphics.FromImage(Bitmap);
+                    resizedWire.Send((ww,hh))
+              )
+              (**)
+        //  TODO: need to be able to call this.PriorMethod without this.qualification
+        //  do self.Resize.Add(fun arg  -> Resize ())                         (* no risk *)  
+              (**)
+            member this.RedrawDrawArea (gc:Graphics) = gc.DrawImage(Bitmap,new Point(0,0))
+        //  member this.Refresh() = using (self.CreateGraphics()) (fun gc ->      RedrawDrawArea gc)   
+            member this.Refresh2() = using (self.CreateGraphics()) (fun gc -> this.RedrawDrawArea gc)        
+            (**)
+        //  do self.Paint.Add(fun args -> RedrawDrawArea args.Graphics)       (* no risk *)
+        //  do self.Paint.Add(fun args -> <impliedThisVariable>.RedrawDrawArea args.Graphics)       (* no risk *)
+        end
+
+    type Area6(x) =
+        class
+            inherit Panel() 
+            let x = 1 + x
+            do base.BackColor <- Color.Black      
+        end
+
+    type Area7(x) =
+        class
+            inherit Panel() 
+            let a,b = x : int * int
+            do base.BackColor <- Color.Black      
+        end
+
+    open System.Drawing
+    open System.Windows.Forms
+    type 'a Area8(x) =
+        class
+            inherit Panel() 
+            let a,b = (x : int * int)
+            do base.BackColor <- Color.Black
+            let f (y:'a) = y
+            let xx = a
+        end
+
+    type 'a Area9(x) =
+        class
+            let a = (x : 'a)
+        //    let f (y:'a) = y
+        end
+
+    type 'a Area10 =
+        class
+          val f : 'a -> 'a
+          new (x:int) = { f = fun x -> x}  
+        end
+end
+
+
+//! Person
+  
+(* Scala person example *)
+module ScalaPersonExample = begin
+    type Person1(firstLastSpouse) =
+      class
+        let firstName,lastName,spouse = firstLastSpouse
+        member x.FirstName = firstName : string
+        member x.LastName  = lastName  : string
+        member x.Spouse    = spouse    : Person1 option
+        member x.Introduction() =
+          "Hi, my name is " + firstName + " " + lastName +
+          (match spouse with
+           | None        -> "."
+           | Some spouse -> " and this is my spouse, " + spouse.FirstName + " " + spouse.LastName + ".")
+        // TODO: the implicit ctor is not in scope for defining alt constructors.
+        // new (f,l) = new Person1(f,l,None)
+    end
+    let pA = new Person1(("bob" ,"smith",None))
+    let pB = new Person1(("jill","smith",Some pA))
+end
+
+
+
+//! Forms
+  
+module Forms1 = begin
+    open System.Drawing
+    open System.Windows.Forms
+    type DrawPanel(w) as x =
+        class
+          inherit Panel() 
+          do  base.Width  <- w
+          do  base.Height <- w
+          do  base.BackColor <- Color.Black
+          let mutable BM = new Bitmap(w,w)
+          let refresh() = using (x.CreateGraphics()) (fun gc -> gc.DrawImage(BM,new Point(0,0)))
+          let GC' = Graphics.FromImage(BM)
+          do  x.Paint.Add(fun _ -> refresh())
+          (*external*)
+          member this.Redraw() = refresh()
+          member this.GC = GC'
+        end
+end
+
+module Forms2 = begin
+
+    open System.Drawing
+    open System.Windows.Forms
+    type DrawPanel2 (w,h) as x =
+        class
+          inherit Panel() 
+          do  base.Width  <- w
+          do  base.Height <- h
+          do  base.BackColor <- Color.DarkBlue
+          let mutable BM = new Bitmap(w,w)
+          let refresh() = using (x.CreateGraphics()) (fun gc -> gc.DrawImage(BM,new Point(0,0)))
+          let GC' = Graphics.FromImage(BM)
+          let uuu = ()
+          let u2 = uuu,uuu
+          do  x.Paint.Add(fun _ -> refresh())
+          (*external*)
+          member this.Redraw() = refresh()
+          member this.GC = GC'
+        end
+
+    let form = new Form(Visible=true,AutoScroll=true)
+    let dp = new DrawPanel2(800,400)
+    do  form.Controls.Add(dp)
+    do  dp.GC.DrawLine(Pens.White,10,20,30,40)
+    do  dp.Redraw()
+end
+
+module Regression1 = begin
+    (* Regression test: local vals of unit type are not given field storage (even if mutable) *)
+    type UnitTestA2 (x,y) =
+        class
+          do  printf "TestA %d\n" (x*y)
+          let u = ()
+          let mutable mu = ()
+          let mutable kept = false
+          member this.Unlikely() = mu <- (kept <- true; (* ensure effect is not optimised away *)
+                                          printf "Boo\n"
+                                         )
+          member this.Kept with get() = kept
+        end
+    let x = new UnitTestA2(1,2)
+    do  x.Unlikely()
+    do  assert(x.Kept = true)
+
+end
+
+//! typar scoping
+
+module TyparScopeChecks = begin
+    (* typar scoping checks 1 *)
+    type ('a,'b) classB1(aa,bb) =
+        class
+          let a = aa : 'a
+          let b = bb : 'b
+          let f (aaa:'a) (bbb:'b) = aaa,bbb
+        end
+
+    (* typar scoping checks *)
+    type ('a,'b) classB2(aa:'a,bb:'b) =
+        class
+          let a = aa
+          let b = bb
+          let f (aaa:'a) (bbb:'b) = aaa,bbb
+        end
+
+end
+
+
+module LocalLetRecTests = begin
+    //! local let rec test
+        
+    (* let rec tests *)
+    type LetRecClassA1 (a,b) =
+        class
+          let a,b = a,b
+          let x = a*3 + b*2
+          let rec fact n = if n=1 then 1 else n * fact (n-1)
+          member this.Fa() = fact a
+          member this.Fb() = fact b
+        end
+    let lrCA1 = new LetRecClassA1(3,4)
+    let xa = lrCA1.Fa()
+    let xb = lrCA1.Fb()
+
+    (* let rec tests *)
+    type LetRecClassA2 () =
+        class
+          let rec odd  n = printf "odd  %d?\n" n; if n=0 then false else not(even (n-1))
+          and even n = printf "even %d?\n" n; if n=0 then true  else not(odd (n-1))
+          member this.Even(x) = even x
+          member this.Odd(x)  = odd x
+        end
+    let lrCA2 = new LetRecClassA2()
+    let ex2 = lrCA2.Even(2)
+    let ex3 = lrCA2.Odd(3)
+    let ox2 = lrCA2.Odd(2)
+    let ox3 = lrCA2.Even(3)
+
+
+    //! local let rec test
+        
+    type nats = HD of int * (unit -> nats)
+    let rec ns = HD (2,(fun () -> HD (3,(fun () -> ns))))
+    let rec take n (HD (x,xf)) = if n=0 then [] else x :: take (n-1) (xf())
+      
+    type LetRecClassA3 () =
+        class
+          let rec ns = HD (2,(fun () -> HD (3,(fun () -> ns))))
+          let rec xs = 1::2::3::xs  (* WHY IS THIS ACCEPT HERE, BUT NOT AT THE TOP LEVEL??? *)
+          member this.NS = ns
+          member this.XS = xs
+        end
+    let lrCA3 = new LetRecClassA3()
+    let ns123 = lrCA3.NS
+    let xs123 = lrCA3.XS
+
+    type LetRecClassA4 () =
+        class
+          let rec xs = 1::2::3::xs  (* WHY IS THIS ACCEPT HERE, BUT NOT AT THE TOP LEVEL??? *)
+          member this.XS = xs
+        end
+    let lrCA4    = new LetRecClassA4()
+    let error123 = lrCA4.XS
+end
+
+
+//! override test
+  
+module OverrideTest1 = begin
+    [<AbstractClass>]
+    type AbstractClass =
+        class
+            new() = {}
+            abstract MA : int -> int
+            abstract MB : int -> int
+        end
+
+    type OverrideClassA1 () =
+      class
+        inherit AbstractClass()
+        override this.MA(x) = x+1
+        override this.MB(x) = x+2
+    end
+end
+
+module OverrideTest2 = begin
+
+    //! abstract test
+      
+    [<AbstractClass>]
+    type ImplicitAbstractClass() =
+        class
+            abstract MA : int -> int
+            abstract MB : int -> int
+        end
+
+    type OverrideClassA2 () =
+      class
+        inherit ImplicitAbstractClass()
+        override this.MA(x) = x+1
+        override this.MB(x) = x+2
+    end
+    let oca2 = new OverrideClassA2()
+    do  assert(oca2.MA(1)=2)
+    do  assert(oca2.MB(1)=3)
+
+end
+
+module ConstructionTests = begin
+    //! CC tests
+    type CC (x) =
+      class
+        let mutable z = x+1
+        let f = fun () -> z
+        member a.F() = f()
+        member a.Set x = z <- x
+      end
+
+    let cc = new CC(1)
+    cc.F()
+    cc.Set(20)
+    cc.F()
+
+
+    //! interface
+    type CCCCCCCC() = class
+      interface System.IDisposable with      
+          member x.Dispose() = ()
+      end
+    end
+
+end
+
+module StaticMemberScopeTest = begin
+    //! static expr test
+    type StaticTestA1(argA,argB) = class
+      let         locval = 1 + argA
+      let mutable locmut = 2 + argB
+      static member M = 12 (* can not use: locval + locmut + argA  *)
+    end
+end
+
+module ConstructorArgTests = begin
+
+    //! ctor args stored in fields
+    type CtorArgClassA1(argA,argB) = class
+      member x.M = argA + argB*2
+     end
+end
+
+module SelfReferenceTests = begin
+    type SelfReferences(a,b) as self = class
+      let f()   = self.M  
+      let ab    = a*b+2
+      let x =
+        let ok =
+          try
+            let x = self.M in
+            printf "Error: self reference got through - should catch these\n";
+            false (* not ok here *)
+          with :? System.InvalidOperationException ->
+            printf "Self reference during construction threw exception, as required\n";
+            true (* ok, got exn *)
+        in
+        assert(ok);
+        ok
+      member self.M = (ab : int)
+      member self.P = f()
+     end
+    let sr = new SelfReferences(1,2)
+end
+
+//! Bug: 878 - type unsoundness - implicit constructor members generalising "free-imperative" typars from let-bindings
+(* must be -ve test
+type C() = class
+   let t = ref (Map.empty<string,_>)
+   let f x = (!t).Add("3",x)
+   member x.M() = !t
+end
+*)  
+
+
+module MixedRecursiveTypeDefinitions = begin
+
+    type ClassType<'a>(x:'a) = 
+        class
+            member self.X = x
+        end
+    and RecordType =
+        { field1 : int;
+          field2 : ClassType<int> }
+        with 
+            member self.GetField() = self.field2
+        end
+    and UnionType =
+        | Case1 of string * AbbrevType1
+        | Case2 of string * AbbrevType2
+    and AbbrevType1 = ClassType<int>
+    and AbbrevType2 = ClassType<string>
+    and AnotherClassType<'a>(x:'a) = 
+        class
+//            member self.X = x
+            interface InterfaceType<'a> with 
+                member self.X = x
+            end
+               
+        end
+    and InterfaceType<'a> = 
+        interface
+            abstract X : 'a
+        end
+    
+
+end
+
+
+//! Test cases:
+(*  
+  [ ] - self-references - allowed and trapped
+  [ ] - direct calls to most derrived base override
+  [ ] - calls on "super" object - via self and super vars
+*)
+
+//! Finish
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/ops/build.bat b/tests/fsharp/core/members/ops/build.bat
new file mode 100644
index 0000000..4821ee2
--- /dev/null
+++ b/tests/fsharp/core/members/ops/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/members/ops/run.bat b/tests/fsharp/core/members/ops/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/core/members/ops/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/members/ops/test.fsx b/tests/fsharp/core/members/ops/test.fsx
new file mode 100644
index 0000000..2400bc5
--- /dev/null
+++ b/tests/fsharp/core/members/ops/test.fsx
@@ -0,0 +1,577 @@
+// #Conformance #MemberDefinitions #Overloading #ComputationExpressions 
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+//let inline (>>) (x:$a) (y:$b) = (($a.(>>) <> <'a,'b,'c> : $t1<'a,'b> * $t2<'b,'c> -> $t2<'a,'c>) (x,y))
+//let inline (+) (x:$t1) (y:$t2) = (($a.(+) <...> <> : $t1<...> * $t2 -> $t1<...>) (x,y))
+//let inline (>>) (x:^a) (y:^b) : ^b = (^a.(>>) (x,y) )
+//let inline (<<) (x:^a) (y:^b) : ^a = (^a.(<<) (x,y) )
+
+module FuncTest = begin
+
+    type func =
+      class
+        val numCalls: int ref
+        val impl: int -> int option
+        member x.Invoke(y) = incr x.numCalls; x.impl(y)
+        new(f) = {  numCalls = ref 0; impl=f }
+        static member (>>>>) ((f: func), (g: func))  = 
+          new func(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+        static member (<<<<) ((f: func), (g: func))  = 
+          new func(fun x -> match g.Invoke(x) with None -> None | Some b -> f.Invoke(b))
+      end
+
+    let konst a = new func(fun x -> Some a)
+
+    let morph f = new func(fun x -> Some (f x))
+
+    #if UNNAMED_OPS
+    let something = (morph (fun x -> x * x)) >>>> (morph (fun x -> x + x))
+    let something2 = (morph (fun x -> x * x)) <<<< (morph (fun x -> x + x))
+
+    do test "cn39233" (something.Invoke(3) = Some 18)
+    do test "cn39233b" (something2.Invoke(3) = Some 36)
+    #endif
+
+end
+
+
+module OverloadSamples = begin
+
+    open System
+
+    //-----------------------------------------------------------------------
+    // Examples 1-5: Simple overloading 
+
+    let f1 x = x + 1.0  // add on floats
+    let f2 x = x + 1.0f  // add on 32-bit floats
+    let f3 x = x + 2     // add on integers
+    let f4 (x:DateTime) = x + new TimeSpan(300L)     // add on dates
+    let f5 (x:TimeSpan) = x + new TimeSpan(1000L)     // add on time spans
+
+    //-----------------------------------------------------------------------
+    // Example 6: overloading on types you've defined yourself.  Normally
+    // we would use the standard F# pattern of defining a type 
+    // (i.e. it's data representation), then defining
+    // a module that carries the operations associated with the type, then 
+    // using an augmentation to assocaite the operations with the type.  However
+    // here we've just added the augmentation straight away.
+
+    type IntVector = V of int array
+      with 
+        static member (+) (V x, V y) = 
+          if x.Length <> y.Length then invalidArg "arg" "IntVectorOps.add";
+          V(Array.init x.Length (fun i -> x.[i] + y.[i]))
+      end
+
+    // Now use the overloading:
+
+    let res6 = V [| 1;2;3 |] + V [| 3;2;1 |]
+
+    // val res6 = V [|4; 4; 4|]
+
+
+    //==============================================================================
+    // Example 7: Generic Vectors (incorrect approach)
+    //
+    // F# overloading does not propagate as far as you may wish.  In particular,
+    // overloading on generic types will often produce unsatisfying results  (extending
+    // overloading in this direction is being considered).
+    //
+    // For example, you can't create a generic vector type and have the overloading
+    // on the element type just magically propagate to the new type.
+
+    type 'a BadGenericVector = 
+      { arr: 'a array }
+      with
+         // This function is not as general as you might wish, despite the use of 
+         // the overloaded "+" operator.  Each instance of an overloaded operator
+         // must relate to one and only one type across the entire scope of
+         // type inference.  So this gives rise to an "add" function that will be
+         // used to add one as-yet-to-be-determined type of element.
+         //
+         // So this function gives rise to the error
+         //   test.ml(_,_): error: FS0001: The declared type parameter 'a cannot be used in
+         //   conjunction with this overloaded operator since the overloading cannot be 
+         //   resolved at compile time
+
+         // static member (+) ((x : 'a BadGenericVector),(y :'a BadGenericVector)) = 
+         //    if x.arr.Length <> y.arr.Length then invalidArg "Matrix.(+)";
+         //    {arr=Array.init x.arr.Length (fun i -> x.arr.[i] + y.arr.[i])}
+      end
+
+    //let BGV arr = {arr=arr}
+    // This means you cannot use these
+    //let f7a (x:BadGenericVector<int>) = x + BGV [| 1;2;3 |]
+    //let f7b (x:BadGenericVector<float>) = x + BGV [| 1.0 |]
+
+    //==============================================================================
+    // Example 7: Generic Vectors (correct approach)
+    //
+    // The solution is to have your generic types carry a dictionary of operations.
+    // Overloads on the generic type can then be correctly defined.  This is a lot
+    // like writing the translation of Haskell type classes by hand, with the advantage
+    // that you get complete control over the instantiations and where the 
+    // dictionaries are created and passed, but with the disadvantage that
+    // it is a little more verbose.
+
+    // Here is the dictionary of operations:
+
+    type 'a NumberOps = 
+      { zero: 'a;
+        one: 'a;
+        add : 'a -> 'a -> 'a;
+        mul : 'a -> 'a -> 'a;
+        neg : 'a -> 'a; }
+
+    // Here are two instantiations of this dictionary of operations:
+
+    let intOps = 
+      { zero = 0;
+        one = 1;
+        add = (+);
+        mul = ( * );
+        neg = (~-); }
+        
+    let floatOps = 
+      { zero = 0.0;
+        one = 1.0;
+        add = (+);
+        mul = ( * );
+        neg = (~-); }
+        
+    // Now the GenericVector type itself, its operations and the augmentation
+    // giving the operator overload:
+
+    type 'a GenericVector = 
+      { ops: 'a NumberOps;
+        arr: 'a array }
+
+    let add x y = 
+      if x.arr.Length <> y.arr.Length then invalidArg "arg" "Matrix.(+)";
+      {ops=x.ops; arr=Array.init x.arr.Length (fun i -> x.ops.add x.arr.[i] y.arr.[i]) }
+
+    let create ops arr = 
+      {ops=ops; arr=arr }
+
+    type 'a GenericVector 
+      with
+        // Nb. For an operator assocaited with a generic type 
+        // the the type parameters involved in the operator's definition must be the same 
+        // as the type parameters of the enclosing class.
+        static member (+) ((x : 'a GenericVector),(y : 'a GenericVector)) = add x y
+      end
+
+    let IGV arr = create intOps arr 
+    let FGV arr = create floatOps arr 
+
+    // Now the GenericVector type itself, its operations and the augmentation
+    // giving the operator overload:
+
+    let f8 (x:GenericVector<int>) = x + IGV [| 1;2;3 |]
+    let f9 (x:GenericVector<float>) = x + FGV [| 1.0 |]
+    let twice (x:GenericVector<'a>) (y:GenericVector<'a>) = x + y
+
+    let f10 (x:GenericVector<float>) = twice x
+    let f11 (x:GenericVector<int>) = twice x
+
+
+end
+
+
+module StateMonadTest = begin
+
+ type 'a IO = 
+    { impl: unit -> 'a }
+    with 
+      member f.Invoke() = f.impl()
+      static member Result(r) = { impl = (fun () -> r) }
+      member f.Bind(g) : 'b IO = g(f.impl())
+      static member BindOp((f : 'a IO), (g : 'a -> 'b IO)) = f.Bind(g)
+    end
+
+ let (>>=) (f: 'a IO) g  = f.Bind(g)
+ let result x  = {impl = (fun () -> x) }
+ let mcons (p: 'a IO) (q : 'a list IO) = p >>= (fun x -> q >>= (fun y -> result (x::y)))
+ let sequence (l: 'a IO list) : 'a list IO = 
+      List.foldBack mcons  l (result [])
+
+
+//These run into problems because we don't support higher-kinded polymorphism.
+// For example we really wish to write:
+//
+//let inline result (x:'a) : ^f<'a> = (^f<'a>).Result(x)
+//let inline (>>=) (x:^f<'a>) (y:'a -> ^f<'b>) = (^f<'a>).BindOp<'b> (x,y)
+
+
+//This is ok:
+//let inline result (x:^a) : ^b = ^b.Result(x)
+//This is not enough:
+//let inline (>>>=) (x:^f) (y:'a -> ^g) = (^f.BindOp(x,y))
+
+end
+
+
+module StreamMonadTest = begin
+
+    type 'a NumberOps = 
+      { zero: 'a;
+        one: 'a;
+        add : 'a -> 'a -> 'a;
+        mul : 'a -> 'a -> 'a;
+        neg : 'a -> 'a; }
+
+    let intOps = 
+      { zero = 0;
+        one = 1;
+        add = (+);
+        mul = ( * );
+        neg = (~-); }
+        
+    let floatOps = 
+      { zero = 0.0;
+        one = 1.0;
+        add = (+);
+        mul = ( * );
+        neg = (~-); }
+        
+
+
+end
+
+
+module AnotherFuncTest = begin
+
+    type func =
+      class
+        val numCalls: int ref
+        val impl: int -> int option
+        member x.Invoke(y) = incr x.numCalls; x.impl(y)
+        new(f) = {  numCalls = ref 0; impl=f }
+        static member (++) ((f: func), (g: func))  = 
+          new func(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+      end
+     
+
+end
+
+
+(*
+module GenericFunc = begin
+
+type ('a,'b) func =
+  class
+    val numCalls: int ref
+    val impl: 'a -> 'b option
+    member x.Invoke(y) = incr x.numCalls; x.impl(y)
+    new(f) = { inherit obj(); numCalls = ref 0; impl=f }
+    static member FF (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+      new func<'a,'c>(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+  end
+
+
+end
+
+module GenericFunc2 = begin
+
+type func<'a,'b> =
+  class
+    val numCalls: int ref
+    val impl: 'a -> 'b option
+
+    new(f) = { inherit obj(); numCalls = ref 0; impl=f }
+
+    static member FF (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+      new func<'a,'c>(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+
+    member x.Invoke(y : 'a) : 'b option = incr x.numCalls; x.impl(y)
+  end
+
+
+end
+
+module AnotherGenericFunc = begin
+
+type func<'a,'b> =
+  class
+    abstract Invoke : 'a -> 'b option
+    static member FF (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+      {new func<'a,'c>() with Invoke(x) = match f.Invoke(x) with None -> None | Some b -> g.Invoke(b)}
+    // FEATURE REQUEST: inherit should never be needed for base classes that have a default constructor and no other
+    // constructors
+    new() = { }
+  end
+
+let konst a = {new func<_,_>() with Invoke(x) = Some a}
+
+let morph f = {new func<_,_>() with Invoke(x) = Some (f x)}
+
+let something = func.FF (morph (fun x -> x * x)) (morph (fun x -> x + x))
+
+end
+
+
+module UsingPolymorphicRecursion1 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let invoke<'a,'b,..> (f:func<'a,'b>) x = f.impl x 
+
+let rec invoke2<'a,..> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke f x with None -> None | Some b -> invoke g b)}
+
+
+end
+
+module UsingPolymorphicRecursion2 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let invoke<'a,'b> (f:func<'a,'b>) x = f.impl x 
+
+let rec invoke2<'a,..> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke f x with None -> None | Some b -> invoke g b)}
+
+
+end
+
+
+module UsingPolymorphicRecursion3 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let invoke<'a,..> (f:func<'a,'b>) x = f.impl x 
+
+let rec invoke2<'a,..> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke f x with None -> None | Some b -> invoke g b)}
+
+
+end
+
+module UsingPolymorphicRecursion4 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let invoke< .. > (f:func<'a,'b>) x = f.impl x 
+
+let rec invoke2<'a,..> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke f x with None -> None | Some b -> invoke g b)}
+
+
+end
+
+module UsingPolymorphicRecursion5 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let rec invoke2<'a,'b,..> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke2 f x with None -> None | Some b -> invoke2 g b)}
+
+
+end
+
+module UsingPolymorphicRecursion6 = begin
+
+type func<'a,'b> = { impl : 'a -> 'b option }
+
+let rec invoke2<'a,'b> (f:func<'a,'b>) x = f.impl x 
+and compose (f: func<'a,'b>)  (g: func<'b,'c>)  = 
+     {impl=(fun x -> match invoke2 f x with None -> None | Some b -> invoke2 g b)}
+
+
+end
+*)
+
+
+
+
+open Microsoft.FSharp.Math
+
+module BasicOverloadTests = begin
+
+    let f4 x = 1 + x
+
+    // This gets type int -> int
+    let f5 x = 1 - x
+
+    // This gets type DateTime -> DateTime -> TimeSpan, through non-conservative resolution.
+    let f6 x1 (x2:System.DateTime) = x1 - x2
+
+    // This gets type TimeSpan -> TimeSpan -> TimeSpan, through non-conservative resolution.
+    let f7 x1 (x2:System.TimeSpan) = x1 - x2
+
+    // This gets type TimeSpan -> TimeSpan -> TimeSpan, through non-conservative resolution.
+    let f8 x1 (x2:System.TimeSpan) = x2 - x1
+
+    // This gets type TimeSpan -> TimeSpan -> TimeSpan, through non-conservative resolution.
+    let f9 (x1:System.TimeSpan) x2 = x1 - x2
+
+
+    // This gets type TimeSpan -> TimeSpan -> TimeSpan
+    let f10 x1 (x2:System.TimeSpan) = x1 + x2
+
+    // Note this gets a different type to f10 as more possible overloads become available through further
+    // type annotations
+    let f11 (x1:System.DateTime) (x2:System.TimeSpan) = x1 + x2
+
+
+    let f17 (x1: float) x2 = x1 * x2
+    let f18 (x1: int) x2 = x1 * x2
+    let f19 x1 (x2:int) = x1 * x2
+    let f20 x1 (x2:float) = x1 * x2
+    let f21 x1 (x2:string) = x1 + x2
+    let f22 (x1:string) x2 = x1 + x2
+
+
+
+    // This one is tricky because the type of "s" is unknown, and could in theory resolve to a
+    // nominal type which has an extra interesting "op_Addition(string,C)" overload.
+    // However, non-conservative resolution is applied prior to method overload resolution in 
+    // expressions. This means the overload constraint is resolved OK to op_Addition(string,string).
+    let f26 s = stdout.Write("-"+s)
+
+    let f27 x = x + x
+
+    let f28 x = 
+        let g x = x + x in
+        g x
+
+    let f29 x = 
+        let g x = x + 1.0 in
+        g x
+        
+    let f30 x = 
+        let g x = x + "a" in
+        g x + "3"
+end
+
+    
+module SubtypingAndOperatorOverloads = begin
+    type C() =
+        class
+            static member (+) (x:C,y:C) = new C()
+        end
+        
+    type D() =
+        class
+            inherit C()
+            static member (+) (x:D,y:D) = new D()
+        end   
+
+    let f201 (x1: C) (x2: C) = D.op_Addition(x1,x2)
+    let f202 (x1: D) (x2: C) = D.op_Addition(x1,x2)
+    let f203 (x1: D) (x2: D) = D.op_Addition(x1,x2)
+    let f204 (x1: C) (x2: D) = D.op_Addition(x1,x2)
+    let f205 (x1: C) (x2: _) = D.op_Addition(x1,x2)
+    let f206 (x1: _) (x2: C) = D.op_Addition(x1,x2)
+    
+    let f301 (x1: C) (x2: C) = x1 + x2
+
+    let f302 (x1: D) (x2: C) = x1 + x2
+
+    let f303 (x1: D) (x2: D) = x1 + x2
+
+    let f304 (x1: C) (x2: D) = x1 + x2
+
+    let f305 (x1: C) (x2: _) = x1 + x2
+
+    let f306 (x1: _) (x2: C) = x1 + x2
+
+    // TODO: investigate
+    let f307 (x1: D) (x2: _) = x1 + x2
+    // TODO: investigate
+    let f308 (x1: _) (x2: D) = x1 + x2
+end
+    
+module OperatorOverloadsWithFloat = begin
+    type C() =
+        class
+            static member (+) (x:C,y:float) = new C()
+
+            static member (+) (x:float,y:C) = new C()
+
+            static member (+) (x:C,y:C) = new C()
+        end
+        
+
+    let f201 (x1: C) (x2: C)         = C.op_Addition(x1,x2)
+    let f202 (x1: float) (x2: C)     = C.op_Addition(x1,x2)
+    let f204 (x1: C) (x2: float)     = C.op_Addition(x1,x2)
+#if NEGATIVE
+    let f205 (x1: C) (x2: _)         = C.op_Addition(x1,x2)
+    let f206 (x1: _) (x2: C)         = C.op_Addition(x1,x2)
+#endif
+    let f207 (x1: float) (x2: _)     = C.op_Addition(x1,x2)
+    let f208 (x1: _) (x2: float)     = C.op_Addition(x1,x2)
+    
+    let f301 (x1: C) (x2: C)         = x1 + x2
+    let f302 (x1: float) (x2: C)     = x1 + x2
+    let f304 (x1: C) (x2: float)     = x1 + x2
+    
+    // TODO: investigate
+    let f305 (x1: C) (x2: _)         = x1 + x2
+    // TODO: investigate
+    let f306 (x1: _) (x2: C)         = x1 + x2
+
+end
+    
+
+//let f3 (a:matrix) (b:string) = a * b
+
+module MiscOperatorOverloadTests = begin
+
+    let rec findBounding2Power b tp = if b<=tp then tp else findBounding2Power b (tp*2) 
+    let leastBounding2Power b =
+        findBounding2Power b 1
+
+    let inline sumfR f (a:int,b:int) =
+        let mutable res = 0.0 in
+        for i = a to b do
+            res <- res + f i
+        done;
+        res
+
+end
+
+
+module EnumerationOperatorTests = begin
+    let x1 : System.DateTimeKind =  enum 3
+    let x2 : System.DateTimeKind =  enum<_> 3
+    let x3 =  enum<System.DateTimeKind> 3
+    let x4 =  int32 (enum<System.DateTimeKind> 3)
+    let inline f5 x = x |> int32 |> enum
+
+end
+
+module TraitCallsAndConstructors = 
+    open System
+    let inline clone (v : ^a) = (^a : (new : string * Exception -> ^a) ("", v))
+    let _ : InvalidOperationException = clone (InvalidOperationException())
+    type Base(x : float) =
+        member this.x = x
+     
+    let inline (~-) (v:^a) = (^a:(new : float -> ^a)(-(v:>Base).x))
+     
+    type Inherited(x : float) =
+        inherit Base(x)
+     
+    let aBase = Base(5.0)
+    let aInherited = Inherited(5.0)
+     
+     
+    let _ : Inherited = -aInherited
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/members/stephen.ml b/tests/fsharp/core/members/stephen.ml
new file mode 100644
index 0000000..b564818
--- /dev/null
+++ b/tests/fsharp/core/members/stephen.ml
@@ -0,0 +1,257 @@
+
+(* Sample F# Source File  *)
+
+open System
+
+
+type 'a tree = 
+  | Leaf of 'a
+  | Node of 'a tree list
+    
+// BUG: 'a must be specified, but we don't check for it
+//  type tree
+
+let rec add t1 t2 = 
+  match t1,t2 with 
+  | Leaf a,Leaf b -> Node [Leaf a; Leaf b] 
+  | Node n1, Node n2 -> Node (List.map2 add n1 n2)
+  | _ -> failwith "add"
+
+(*
+type 't IComparable = 
+    interface
+      abstract CompareTo: 't -> int
+    end
+
+type class Comparison<'t> = 
+    when 't :> interface IComparable<'t>
+
+type class RightAddition<'a,'b> =
+    when 'a :> static member (+) : ('a,'b) -> 'a
+    
+type class Num<'a,'b> =
+    when 'a :> static member (+) : ('a,'b) -> 'a
+    and  'a :> static member ( * ) : ('a,'b) -> 'a
+    and  'a :> static member Zero : 'a
+    and  'a :> static member One : 'a
+
+type class ToString<'a> =
+    when 'a :> member ToString: unit -> string
+
+type class assert RightAddition<DateTime,TimeSpan>
+
+interface IComparable<Self> = 
+    T : member CompareTo: T -> T -> int
+end
+
+interface INum<Self,Other> = 
+    Self :> member Add : Other -> Self
+    Self :> member Multiply : Self -> Self
+    Self :> static member Zero : Self
+end
+*)
+
+type 'a tree
+  with
+    //static member (+) x y = add x y
+    static member op_Addition(x,y) = add x y
+    //static member op_Concatenation(x,y) = add x y
+    static member (++) x y = add x y
+    
+    // member x.Add(y) = x + y
+  end
+
+(*
+type 't IComparable = 
+    interface
+      abstract CompareTo: 't -> int
+    end
+
+*)
+
+
+type class Comparison<'t> = 
+    when 't :> interface IComparable<'t>
+
+type class RightAddition<'a,'b> =
+    when 'a :> static member (+) : ('a,'b) -> 'a
+    
+
+(*
+type class Displayable<'a> =
+    when val toString : 'a -> string
+    
+    
+instance Displayable<System.Int32> with toString(i) = string_of_int i
+instance Displayable<List<'a> > with toString(i) = string_of_int i
+instance Displayable<List<int> > with toString(i) = string_of_int i
+instance Displayable<'a> => GUIable<'a> with toString(i) = string_of_int i
+
+type class Displayable<'a,'b> =
+    when 'b :> static member toString : 'a -> string
+
+type ShowList<'a,'b> = class static member toString(x: List<'a>  )  when Displayable<'a,'b>  = fold ('b.) .... x end
+type ShowIntList = class static member toString(x: List<int> ) = fold .... x end
+
+
+assert Displayable<List<'a>,ShowList<'a>>
+assert Displayable<List<int>,ShowIntList>
+
+let dup(x:'a when Displayable<'a,'b>) = 'b.toString(x)
+
+do dup at ShowIntList [3]
+
+assert Displayable<List<int>,ShowIntList>
+
+
+
+type class Displayable<'a> =
+    when member ToString : unit -> string
+
+type List<'a> with static member x.ToString() = ... end
+type List<int> with member x.ToString() = ... end
+type List<int> with member x.ToString() = ... end
+
+*)
+
+val show : Displayable<'a> => 'a -> string
+let show (x:'a) = toString(a)
+    
+do show(3)
+    
+type class Num<'a,'b> =
+    when RightAddition<'a,'b>
+    and  'a :> static member ( * ) : ('a,'b) -> 'a
+    and  'a :> static member Zero : 'a
+    and  'a :> static member One : 'a
+
+type class ToString<'a> =
+    when 'a :> member ToString: unit -> string
+
+type class assert RightAddition<DateTime,TimeSpan>
+
+
+
+//instance Num<tree<'a> > with
+//  (+) x y = add x y 
+//end
+
+
+//BUG: empty object initializaers not being permitted:
+(*
+//BUG: comments aren't being colored in red!!!!
+module EmptyClassTest = begin
+  type C =
+    class
+      new() = { }
+    end
+end
+*)
+
+
+(*
+// BUG:
+type ('a,'b) func =
+  class
+    //static member (+) x y = add x y
+    abstract Invoke : 'a -> 'b option
+    //static member op_Concatenation(x,y) = add x y
+    static member FF (f: ('a,'b) func)  (g: ('b,'c) func)  = 
+      {new func<'a,'c>() with Invoke(x) = match f.Invoke(x) with None -> None | Some b -> g.Invoke(b)}
+    // BUG: "inherit obj()" should never be needed
+    // BUG: inherit should never be needed for base classes that have a default constructor and no other
+    // constructors
+    new() = { inherit obj() }
+  end
+
+let konst a = {new func<_,_>() with Invoke(x) = Some a}
+
+let morph f = {new func<_,_>() with Invoke(x) = Some (f x)}
+
+let something = func.FF (morph (fun x -> x * x)) (morph (fun x -> x + x))
+*)
+
+
+(* SAME BUG: 
+type ('a,'b) func =
+  class
+    //static member (+) x y = add x y
+    val numCalls: int ref
+    val impl: 'a -> 'b option
+    member x.Invoke(y) = incr x.numCalls; x.impl(y)
+    //static member op_Concatenation(x,y) = add x y
+    // BUG:
+    // new(f) = { inherit obj(); impl=f }
+    new(f) = { inherit obj(); numCalls = ref 0; impl=f }
+    static member FF (f: ('a,'b) func)  (g: ('b,'c) func)  = 
+      new func<'a,'c>(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+  end
+*)
+
+module FuncTest4  = begin
+
+// QUERY: can "inline" be inferred, perhaps with an optional warning
+// QUERY: make it clear that "inline" is only for semantic use
+// QUERY: can we give a warning if "inline" doesn't allow more type variables to be generalized
+
+let inline (++) (x : $a) (y:$b) = $a.op_Concatenation(x,y)
+
+// QUERY: List and generalized comprehensions
+
+type func =
+  class
+    //static member (+) x y = add x y
+    val numCalls: int ref
+    val impl: int -> int option
+    member x.Invoke(y) = incr x.numCalls; x.impl(y)
+    //static member op_Concatenation(x,y) = add x y
+    // BUG:
+    // new(f) = { inherit obj(); impl=f }
+    new(f) = {  numCalls = ref 0; impl=f }
+    static member op_Concatenation ((f: func), (g: func))  = 
+      new func(fun x -> match f.Invoke(x) with None -> None | Some b -> g.Invoke(b))
+  end
+
+let konst a = new func(fun x -> Some a)
+
+let morph f = new func(fun x -> Some (f x))
+
+let something = (morph (fun x -> x * x)) ++ (morph (fun x -> x + x))
+
+end
+
+//let (>>) f g x = g(f(x))
+
+
+//let inline (++) (x : $a) (y:$b) = 
+//  $a.op_Concatenation(x,y)
+
+
+  
+// BUG: Use of operator overloading on polymorphic types is leading to all type variables
+// in those types being marked as compile-time polymorphism
+// let f (x: 'a tree) = x + x
+
+let f (x: int tree) = x + x
+
+let f2 (x: int tree) = x ++ x
+
+type 'a tree
+  with
+    member x.Size = 
+      //match x with Leaf x -> 1 | Node l -> List.fold (fun acc (x:'a tree) -> x.Size + acc) 0 l
+      let rec size acc x = match x with Leaf x -> 1+acc | Node l -> List.fold size acc l in
+      size 0 x 
+    member x.Map(f) = 
+      let rec map f = function Leaf x -> Leaf (f x) | Node l -> Node (List.map (map f) l) in
+      map f x
+  end
+  
+
+let t1 = Node [Leaf 1;Leaf 2;Leaf 3]
+
+let t1size = t1.Size
+let t2 = t1.Map(fun i -> string_of_int i)
+
+
+
diff --git a/tests/fsharp/core/members/tdirs b/tests/fsharp/core/members/tdirs
new file mode 100644
index 0000000..33e0e4a
--- /dev/null
+++ b/tests/fsharp/core/members/tdirs
@@ -0,0 +1,6 @@
+ops
+basics
+ctree
+factors
+incremental
+
diff --git a/tests/fsharp/core/mscorlib/2.0/mscorlib.dll b/tests/fsharp/core/mscorlib/2.0/mscorlib.dll
new file mode 100644
index 0000000..c13c9cd
Binary files /dev/null and b/tests/fsharp/core/mscorlib/2.0/mscorlib.dll differ
diff --git a/tests/fsharp/core/mscorlib/3.5/mscorlib.dll b/tests/fsharp/core/mscorlib/3.5/mscorlib.dll
new file mode 100644
index 0000000..7f1cf5e
Binary files /dev/null and b/tests/fsharp/core/mscorlib/3.5/mscorlib.dll differ
diff --git a/tests/fsharp/core/mscorlib/4.0/mscorlib.dll b/tests/fsharp/core/mscorlib/4.0/mscorlib.dll
new file mode 100644
index 0000000..4038177
Binary files /dev/null and b/tests/fsharp/core/mscorlib/4.0/mscorlib.dll differ
diff --git a/tests/fsharp/core/mscorlib/Silverlight2.0.30523.8/mscorlib.dll b/tests/fsharp/core/mscorlib/Silverlight2.0.30523.8/mscorlib.dll
new file mode 100644
index 0000000..0676b56
Binary files /dev/null and b/tests/fsharp/core/mscorlib/Silverlight2.0.30523.8/mscorlib.dll differ
diff --git a/tests/fsharp/core/mscorlib/build.bat b/tests/fsharp/core/mscorlib/build.bat
new file mode 100644
index 0000000..79f4bf0
--- /dev/null
+++ b/tests/fsharp/core/mscorlib/build.bat
@@ -0,0 +1,62 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+REM **************************
+IF NOT EXIST "%FSCOREDLL20PATH%" goto :Skip20
+  "%FSC%" -o:test-2.0.exe -r:"%FSCOREDLL20PATH%" -r:2.0\mscorlib.dll --noframework --define:FX_AT_LEAST_2_0 test.fsx
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-2.0.exe
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" -o:test-2.0b.exe -r:"%FSCOREDLL20PATH%" -r:2.0\mScorlib.DlL --noframework --define:FX_AT_LEAST_2_0 test.fsx
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-2.0b.exe
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" -o:test-3.5.exe -r:"%FSCOREDLL20PATH%" -r:3.5\mscorlib.dll --noframework --define:FX_AT_LEAST_2_0 --define:FX_AT_LEAST_3_5 test.fsx
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-3.5.exe
+  @if ERRORLEVEL 1 goto Error
+
+:Skip20
+
+IF NOT EXIST "%FSHARP_HOME%\Retail\Silverlight\2.0\bin\FSharp.Core.dll" goto :SkipSL
+ "%FSC%" -o:test-Silverlight-2.0.exe --noframework -r:Silverlight2.0.30523.8\mscorlib.dll -r:%FSHARP_HOME%\Retail\Silverlight\2.0\bin\FSharp.Core.dll --define:SILVERLIGHT_AT_LEAST_2_0 test.fsx
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-Silverlight-2.0.exe
+  @if ERRORLEVEL 1 goto Error
+
+:SkipSL
+
+
+:Ok
+echo Built fsharp %~n0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/mscorlib/test.fsx b/tests/fsharp/core/mscorlib/test.fsx
new file mode 100644
index 0000000..1a429df
--- /dev/null
+++ b/tests/fsharp/core/mscorlib/test.fsx
@@ -0,0 +1,17 @@
+// #Conformance #Multitargeting 
+
+
+#if FX_AT_LEAST_2_0
+let something_in_2_0 : System.Collections.Generic.List<int> = Unchecked.defaultof<_>
+#endif
+
+#if FX_AT_LEAST_3_5
+let something_in_3_5_not_in_2_0 : System.GCCollectionMode = Unchecked.defaultof<_>
+#endif
+
+
+#if SILVERLIGHT_AT_LEAST_2_0
+let something_in_silverlight_2_0 = typeof<System.Collections.Generic.List<int>>
+#else
+let something_not_in_silverlight_2_0 = typeof<System.Diagnostics.DebuggerTypeProxyAttribute>
+#endif
diff --git a/tests/fsharp/core/namespaces/build.bat b/tests/fsharp/core/namespaces/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/namespaces/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/namespaces/dont.pipe.to.stdin b/tests/fsharp/core/namespaces/dont.pipe.to.stdin
new file mode 100644
index 0000000..2c74d24
--- /dev/null
+++ b/tests/fsharp/core/namespaces/dont.pipe.to.stdin
@@ -0,0 +1,4 @@
+
+
+
+This test contains a leading 'namespace' declaration, and these can't be piped into FSI.EXE
\ No newline at end of file
diff --git a/tests/fsharp/core/namespaces/dont.run.as.script b/tests/fsharp/core/namespaces/dont.run.as.script
new file mode 100644
index 0000000..8e5686f
--- /dev/null
+++ b/tests/fsharp/core/namespaces/dont.run.as.script
@@ -0,0 +1 @@
+not supported
\ No newline at end of file
diff --git a/tests/fsharp/core/namespaces/dont.use.empty.signature b/tests/fsharp/core/namespaces/dont.use.empty.signature
new file mode 100644
index 0000000..f2aa86d
--- /dev/null
+++ b/tests/fsharp/core/namespaces/dont.use.empty.signature
@@ -0,0 +1 @@
+hello 
diff --git a/tests/fsharp/core/namespaces/dont.use.generated.signature b/tests/fsharp/core/namespaces/dont.use.generated.signature
new file mode 100644
index 0000000..f2aa86d
--- /dev/null
+++ b/tests/fsharp/core/namespaces/dont.use.generated.signature
@@ -0,0 +1 @@
+hello 
diff --git a/tests/fsharp/core/namespaces/dont.use.wrapper.namespace b/tests/fsharp/core/namespaces/dont.use.wrapper.namespace
new file mode 100644
index 0000000..f2aa86d
--- /dev/null
+++ b/tests/fsharp/core/namespaces/dont.use.wrapper.namespace
@@ -0,0 +1 @@
+hello 
diff --git a/tests/fsharp/core/namespaces/run.bat b/tests/fsharp/core/namespaces/run.bat
new file mode 100644
index 0000000..5a4b595
--- /dev/null
+++ b/tests/fsharp/core/namespaces/run.bat
@@ -0,0 +1,9 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/namespaces/test.fs b/tests/fsharp/core/namespaces/test.fs
new file mode 100644
index 0000000..aeb0080
--- /dev/null
+++ b/tests/fsharp/core/namespaces/test.fs
@@ -0,0 +1,79 @@
+// #Conformance #Namespaces #SignatureFiles 
+
+
+namespace Hello.Goodbye
+
+type A = A | B | C
+
+module Utils = begin
+  let failures = ref false
+  let report_failure () = 
+    stderr.WriteLine " NO"; failures := true
+  let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+end
+
+module X  = begin
+  let x = 1 
+
+end
+
+
+
+namespace Hello.Beatles
+
+type Song = HeyJude | Yesterday
+
+module X  = begin
+  let x = 2 
+end
+
+
+namespace UseMe
+
+open Hello.Goodbye
+
+module Tests  = begin
+  do Hello.Goodbye.Utils.test "test292jwe" (Hello.Goodbye.X.x + 1 = Hello.Beatles.X.x)
+  do Hello.Goodbye.Utils.test "test292jwe" (Hello.Beatles.HeyJude <> Hello.Beatles.Yesterday)
+
+end
+
+module MoreTests = begin
+    open global.Microsoft.FSharp.Core
+
+    let arr1 = global.Microsoft.FSharp.Collections.Array.map (global.Microsoft.FSharp.Core.Operators.(+) 1) [| 1;2;3;4 |]
+
+    let ``global`` = 1
+
+    // THis should still resolve
+    let arr2 = global.Microsoft.FSharp.Collections.Array.map (global.Microsoft.FSharp.Core.Operators.(+) 1) [| 1;2;3;4 |]
+
+    let test3 : global.Microsoft.FSharp.Core.int  = 3
+
+    let test4 : global.Microsoft.FSharp.Collections.list<int>  = [3]
+
+    let test5 x = 
+        match x with 
+        | global.Microsoft.FSharp.Core.None -> 1
+        | global.Microsoft.FSharp.Core.Some _ -> 1
+end
+
+
+namespace global
+
+type A = A | B | C
+
+module X  = begin
+  let x = 1 
+
+end
+
+
+module Utils  = begin
+
+  let _ = 
+    if !Hello.Goodbye.Utils.failures then (stdout.WriteLine "Test Failed"; exit 1) 
+    else (stdout.WriteLine "Test Passed"; 
+          System.IO.File.WriteAllText("test.ok","ok"); 
+          exit 0)
+end
diff --git a/tests/fsharp/core/namespaces/test.fsi b/tests/fsharp/core/namespaces/test.fsi
new file mode 100644
index 0000000..12388fc
--- /dev/null
+++ b/tests/fsharp/core/namespaces/test.fsi
@@ -0,0 +1,26 @@
+// #Conformance #Namespaces #Modules
+
+namespace Hello.Goodbye
+
+type A = A | B | C
+
+module Utils = begin
+  val failures : bool ref
+  val report_failure : unit -> unit
+  val test : string -> bool -> unit
+end
+
+module X = begin
+  val x : int
+end
+
+
+namespace Hello.Beatles
+
+type Song = HeyJude | Yesterday
+
+module X = begin
+  val x : int
+end
+
+
diff --git a/tests/fsharp/core/nested/build.bat b/tests/fsharp/core/nested/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/nested/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/nested/run.bat b/tests/fsharp/core/nested/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/nested/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/nested/test.fsx b/tests/fsharp/core/nested/test.fsx
new file mode 100644
index 0000000..2b02daf
--- /dev/null
+++ b/tests/fsharp/core/nested/test.fsx
@@ -0,0 +1,70 @@
+// #Conformance 
+#if Portable
+module Core_nested
+#endif
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+let f () = 3
+
+let wher = ref []
+let spot x = wher := !wher @ [x]; stderr.WriteLine(x:string)
+do spot "Initialized before X1 OK"
+
+module X1 = begin 
+  type x = X | Y
+  let y = 3
+
+  do spot "Initialized X1 OK";
+
+end
+
+
+module X2 = begin 
+  type x = X | Y
+  let x = 3
+  let y () = X
+  let z = x + (match y() with X -> 4 | Y -> 5)
+  do spot "Initialized X2 OK";
+end
+
+
+module X3 = begin 
+  let y = X2.X
+  do spot "Initialized X3 OK";
+end
+
+
+do spot "Initialized after X3 OK"
+
+let _ = X2.z + X2.x + X1.y 
+
+do test "uyf78" (!wher = [ "Initialized before X1 OK";
+                           "Initialized X1 OK";
+                           "Initialized X2 OK";
+                           "Initialized X3 OK";
+                           "Initialized after X3 OK" ])
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/ConsoleApplication1/Program.cs b/tests/fsharp/core/netcore/ConsoleApplication1/Program.cs
new file mode 100644
index 0000000..e2e869f
--- /dev/null
+++ b/tests/fsharp/core/netcore/ConsoleApplication1/Program.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace PortableTestEntry
+{
+    // driver program for F# portable tests
+    // a number of existing test code files are conditionally refactored into a module such that tests run in the static constructor
+    // thus, we just need to access the "aa" property to trigger test code to be run
+    class Program
+    {
+        static int returnCode = 0;
+
+        static int Main(string[] args)
+        {
+            SetHooks();
+
+            Run("Core_access", () => { var x = Core_access.aa; });
+            Run("Core_apporder", () => { var x = Core_apporder.aa; });
+            Run("Core_array", () => { var x = Core_array.aa; });
+            Run("Core_attributes", () => { var x = Core_attributes.aa; });
+            Run("Core_comprehensions", () => { var x = Core_comprehensions.aa; });
+            Run("Core_control", () => { var x = Core_control.aa; });
+            Run("Core_controlChamenos", () => { var x = Core_controlChamenos.aa; });
+            Run("Core_controlMailBox", () => { var x = Core_controlMailBox.aa; });
+            Run("Core_controlStackOverflow", () => { var x = Core_controlStackOverflow.aa; });
+            Run("Core_csext", () => { var x = Core_csext.aa; });
+            Run("Core_innerpoly", () => { var x = Core_innerpoly.aa; });
+            Run("Core_int32", () => { var x = Core_int32.aa; });
+            Run("Core_lazy", () => { var x = Core_lazy.aa; });
+            Run("Core_letrec", () => { var x = Core_letrec.aa; });
+            Run("Core_libtest", () => { var x = Core_libtest.aa; });
+            Run("Core_lift", () => { var x = Core_lift.aa; });
+            Run("Core_longnames", () => { var x = Core_longnames.aa; });
+            Run("Core_map", () => { var x = Core_map.aa; });
+            Run("Core_measures", () => { var x = Core_measures.aa; });
+            Run("Core_genericMeasures", () => { var x = Core_genericMeasures.aa; });
+            Run("Core_nested", () => { var x = Core_nested.aa; });
+            Run("Core_patterns", () => { var x = Core_patterns.aa; });
+            Run("Core_printf", () => { var x = Core_printf.aa; });
+            Run("Core_queriesCustomQueryOps", () => { var x = Core_queriesCustomQueryOps.aa; });
+            Run("Core_queriesLeafExpressionConvert", () => { var x = Core_queriesLeafExpressionConvert.aa; });
+            Run("Core_queriesNullableOperators", () => { var x = Core_queriesNullableOperators.aa; });
+            Run("Core_queriesOverIEnumerable", () => { var x = Core_queriesOverIEnumerable.aa; });
+            Run("Core_queriesOverIQueryable", () => { var x = Core_queriesOverIQueryable.aa; });
+            Run("Core_quotes", () => { var x = Core_quotes.aa; });
+            Run("Core_seq", () => { var x = Core_seq.aa; });
+            Run("Core_subtype", () => { var x = Core_subtype.aa; });
+            Run("Core_syntax", () => { var x = Core_syntax.aa; });
+            Run("Core_tlr", () => { var x = Core_tlr.aa; });
+            Run("Core_unicode", () => { var x = Core_unicode.aa; });
+
+            return returnCode;
+        }
+
+        // portable libraries don't have access to a number of APIs, so set hooks to work around this
+        static void SetHooks()
+        {
+            // System.Console
+            InitialHook.setWrite((msg) => Console.Write(msg));
+
+            // System.Environment
+            InitialHook.setGetEnvironmentVariable((varName) => Environment.GetEnvironmentVariable(varName));
+            InitialHook.setMajorVersion(() => Environment.Version.Major);
+            InitialHook.setMinorVersion(() => Environment.Version.Minor);
+
+            // System.IO.Directory
+            InitialHook.setGetFiles((dir, pattern) => Directory.GetFiles(dir, pattern));
+            InitialHook.setGetDirectories((dir) => Directory.GetDirectories(dir));
+            InitialHook.setDirectoryExists((dir) => Directory.Exists(dir));
+
+            // System.IO.File
+            InitialHook.setWriteAllText((path, contents) => File.WriteAllText(path, contents));
+            InitialHook.setWriteAllLines((path, contents) => File.WriteAllLines(path, contents));
+            InitialHook.setAppendAllText((path, contents) => File.AppendAllText(path, contents));
+            InitialHook.setReadAllLines((path) => File.ReadAllLines(path));
+
+            // System.IO.FileStream
+            InitialHook.setGetFileStream((path) => new FileStream(path, FileMode.OpenOrCreate));
+
+            // System.IO.Path
+            InitialHook.setGetCurrentDirectory(() => Environment.CurrentDirectory);
+            InitialHook.setGetDirectoryName((path) => Path.GetDirectoryName(path));
+            InitialHook.setGetFileName((path) => Path.GetFileName(path));
+
+            // System.Threading.Thread
+            InitialHook.setSleep((timeout) => Thread.Sleep(timeout));           
+        }
+
+        // execute and handle errors for individual test areas
+        static void Run(string testArea, Action action)
+        {
+            Console.WriteLine("Running area {0}", testArea);
+
+            try
+            {                
+                action();
+            }
+            catch (Exception e)
+            {
+                returnCode = -1;
+                Console.WriteLine("\tFailure!");
+                Console.WriteLine(e.ToString());
+            }
+
+            Console.WriteLine();
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/ConsoleApplication1/Properties/AssemblyInfo.cs b/tests/fsharp/core/netcore/ConsoleApplication1/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f13a9ee
--- /dev/null
+++ b/tests/fsharp/core/netcore/ConsoleApplication1/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ConsoleApplication2")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft Corp.")]
+[assembly: AssemblyProduct("ConsoleApplication2")]
+[assembly: AssemblyCopyright("Copyright © Microsoft Corp. 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c29897d3-6d96-4e85-805a-458613340159")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/tests/fsharp/core/netcore/ConsoleApplication1/portabletestentry.csproj b/tests/fsharp/core/netcore/ConsoleApplication1/portabletestentry.csproj
new file mode 100644
index 0000000..d0374fb
--- /dev/null
+++ b/tests/fsharp/core/netcore/ConsoleApplication1/portabletestentry.csproj
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{3A01C5C1-D725-40AC-B335-F4A54A93925C}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PortableTestEntry</RootNamespace>
+    <AssemblyName>PortableTestEntry</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>SAK</SccProjectName>
+    <SccLocalPath>SAK</SccLocalPath>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccProvider>SAK</SccProvider>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETCore\3.3.1.0\FSharp.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\NetCoreLibrary1\NetCoreTestingLibrary.fsproj">
+      <Project>{9fe96e07-1234-9876-bd3f-9c7f0f98b9b1}</Project>
+      <Name>NetCoreTestingLibrary</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/build.bat b/tests/fsharp/core/netcore/build.bat
new file mode 100644
index 0000000..ec3d824
--- /dev/null
+++ b/tests/fsharp/core/netcore/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+msbuild netcore.sln /p:Configuration=Debug
+
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/netcore/netcore.sln b/tests/fsharp/core/netcore/netcore.sln
new file mode 100644
index 0000000..9f376fe
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcore.sln
@@ -0,0 +1,46 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 12
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "NetCoreTestingLibrary", "NetCoreLibrary1\NetCoreTestingLibrary.fsproj", "{9FE96E07-1234-9876-BD3F-9C7F0F98B9B1}"
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "NetCoreAutomationHelperLibrary", "NetCoreAutomationHelperLibrary\NetCoreAutomationHelperLibrary.fsproj", "{3E51D6E3-1234-9876-ABCD-70BE750F8104}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "portabletestentry", "ConsoleApplication1\portabletestentry.csproj", "{3A01C5C1-D725-40AC-B335-F4A54A93925C}"
+EndProject
+Global
+	GlobalSection(TeamFoundationVersionControl) = preSolution
+		SccNumberOfProjects = 4
+		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+		SccLocalPath0 = .
+		SccProjectUniqueName1 = NetCoreLibrary1\\NetCoreTestingLibrary.fsproj
+		SccLocalPath1 = NetCoreLibrary1		
+		SccProjectFilePathRelativizedFromConnection1 = ..\\NetCoreLibrary1\\
+		SccProjectUniqueName2 = ConsoleApplication1\\portabletestentry.csproj
+		SccProjectName2 = ConsoleApplication1
+		SccLocalPath2 = ConsoleApplication1
+		SccProjectUniqueName3 = NetCoreAutomationHelperLibrary\\NetCoreAutomationHelperLibrary.fsproj
+		SccProjectName3 = NetCoreAutomationHelperLibrary
+		SccLocalPath3 = NetCoreAutomationHelperLibrary
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{9FE96E07-1234-9876-BD3F-9C7F0F98B9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9FE96E07-1234-9876-BD3F-9C7F0F98B9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9FE96E07-1234-9876-BD3F-9C7F0F98B9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9FE96E07-1234-9876-BD3F-9C7F0F98B9B1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3E51D6E3-1234-9876-ABCD-70BE750F8104}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3E51D6E3-1234-9876-ABCD-70BE750F8104}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3E51D6E3-1234-9876-ABCD-70BE750F8104}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3E51D6E3-1234-9876-ABCD-70BE750F8104}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Extensions.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Extensions.fs
new file mode 100644
index 0000000..ca32194
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Extensions.fs
@@ -0,0 +1,120 @@
+// extension members put in place to fill in gaps in the portable profile, so that test code does not need to be updated
+// extensions either call out to hooks, or if the member is very simple, just implement the functionality locally
+[<AutoOpen>]
+module PortableExtensions
+open System
+open System.Collections.Generic
+open System.Reflection
+open System.Linq
+
+#if NetCore
+
+open System.Threading
+open System.Threading.Tasks
+
+type Assembly with
+
+    member this.GetCustomAttributes (attributeType : Type, ``inherit`` : bool) =
+        CustomAttributeExtensions.GetCustomAttributes(this, attributeType).ToArray()
+
+type ConstructorInfo with
+    member this.GetCustomAttributes(attributeType : Type, ``inherit`` : bool) =
+        CustomAttributeExtensions.GetCustomAttributes(this, attributeType, ``inherit``).ToArray()
+
+type PropertyInfo with
+    member this.GetGetMethod(visibility : bool) =
+        this.GetMethod
+
+    member this.GetSetMethod(visibility : bool) =
+        this.SetMethod
+
+type MethodInfo with
+    member this.GetCustomAttributes(attributeType : Type, ``inherit`` : bool) =
+        CustomAttributeExtensions.GetCustomAttributes(this, attributeType, ``inherit``).ToArray()
+
+type PropertyInfo with
+
+    member this.GetCustomAttributes(``inherit`` : bool) =
+        CustomAttributeExtensions.GetCustomAttributes(this, ``inherit``).ToArray()
+
+type System.Type with
+
+    member this.Assembly : Assembly =
+        this.GetTypeInfo().Assembly
+    
+    // does not consider base types, could need a fuller implementation if this causes tests to fail
+    member this.GetConstructors() : ConstructorInfo[] =
+        this.GetTypeInfo().DeclaredConstructors.ToArray()
+
+    // does not consider base types, could need a fuller implementation if this causes tests to fail
+    member this.GetConstructor(types : Type[]) =
+        this.GetTypeInfo().DeclaredConstructors.Where( fun ci -> ci.GetParameters().Select<ParameterInfo, Type>( fun pi -> pi.ParameterType ).SequenceEqual(types) ).FirstOrDefault()
+
+    member this.GetCustomAttributes (attributeType : Type, ``inherit`` : bool) =
+        CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo() :> MemberInfo, attributeType, ``inherit``).ToArray()
+
+    // does not consider base types, could need a fuller implementation if this causes tests to fail
+    member this.GetField(name : string) =
+        this.GetTypeInfo().GetDeclaredField(name)
+
+    // does consider base types
+    member this.GetMethods() =
+        let rec getMeths (tyInfo : TypeInfo) includeStatic = 
+            [|
+                yield! tyInfo.DeclaredMethods |> Seq.where (fun mi -> mi.IsPublic && (includeStatic || not mi.IsStatic))
+
+                match tyInfo.BaseType with
+                | null -> ()
+                | b -> yield! getMeths (b.GetTypeInfo()) false
+            |]
+
+        getMeths (this.GetTypeInfo()) true
+
+    // does consider base types
+    member this.GetMethod(name : string) =
+        this.GetMethods()
+        |> Seq.where (fun mi -> mi.Name = name)
+        |> Seq.exactlyOne
+
+    // does not consider base types, could need a fuller implementation if this causes tests to fail
+    member this.GetProperty(name : string) : PropertyInfo =
+        this.GetTypeInfo().GetDeclaredProperty(name)
+
+    member this.IsValueType : bool =
+        this.GetTypeInfo().IsValueType
+
+    member this.IsGenericType : bool =
+        this.GetTypeInfo().IsGenericType
+        
+    member this.GetGenericArguments() : Type [] =
+        this.GetTypeInfo().GenericTypeArguments
+
+    member this.GetGenericParameterConstraints() : Type [] =
+        this.GetTypeInfo().GetGenericParameterConstraints()
+
+#else
+type System.Threading.Thread with 
+    static member Sleep(millisecondsTimeout) =
+        Hooks.sleep.Invoke(millisecondsTimeout)
+#endif
+
+type System.Threading.WaitHandle with
+    member this.WaitOne(millisecondsTimeout : int, exitContext : bool) =
+        this.WaitOne(millisecondsTimeout)
+
+type System.Array with
+    static member FindIndex<'a>( arr : 'a array, pred) =
+        Array.findIndex pred arr
+
+type System.IO.MemoryStream with
+    member this.Close() = ()
+
+type System.IO.Stream with
+    member this.Write(str : string) =
+        let bytes = System.Text.Encoding.UTF8.GetBytes(str)
+        this.Write(bytes, 0, bytes.Length)
+
+    member this.Close() = ()
+
+type System.IO.StreamReader with
+    member this.Close() = ()
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Hooks.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Hooks.fs
new file mode 100644
index 0000000..9d68b84
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/Hooks.fs
@@ -0,0 +1,34 @@
+// portable test code will use these replacements for APIs which don't exist on the portable profile
+module Hooks
+
+let private notImpl() = failwith "This callback has not been hooked by a test driver"
+
+// System.Console
+let mutable write = System.Action<string>( fun _ -> notImpl() )
+
+// System.Environment
+let mutable getEnvironmentVariable = System.Func<string, string>( fun _ -> notImpl())
+let mutable majorVersion = System.Func<int>( fun () -> notImpl() )
+let mutable minorVersion = System.Func<int>( fun () -> notImpl() )
+
+// System.IO.Directory
+let mutable getFiles = System.Func<string, string, string[]>( fun _ _ -> notImpl() )
+let mutable getDirectories = System.Func<string, string[]>( fun _ -> notImpl() )
+let mutable directoryExists = System.Func<string, bool>( fun _ -> notImpl() )
+
+// System.IO.File
+let mutable writeAllText = System.Action<string, string>( fun _ _ -> notImpl() )
+let mutable writeAllLines = System.Action<string, string[]>( fun _ _ -> notImpl() )
+let mutable appendAllText = System.Action<string, string>( fun _ _ -> notImpl() )
+let mutable readAllLines = System.Func<string, string[]>( fun _ -> notImpl() )
+
+// System.IO.FileStream
+let mutable getFileStream = System.Func<string, System.IO.Stream> ( fun _ -> notImpl() )
+
+// System.IO.Path
+let mutable getCurrentDirectory = System.Func<string>( fun () -> notImpl() )
+let mutable getDirectoryName = System.Func<string, string>( fun _ -> notImpl() )
+let mutable getFileName = System.Func<string, string>( fun _ -> notImpl() )
+
+// System.Threading.Thread
+let mutable sleep = System.Action<int>( fun _ -> notImpl() )
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.Diagnostics.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.Diagnostics.fs
new file mode 100644
index 0000000..10ed5b5
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.Diagnostics.fs
@@ -0,0 +1,24 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System.Diagnostics
+
+open System
+
+type Stopwatch() = 
+    let mutable startTime = DateTime.Now
+
+    member this.Start() = 
+        startTime <- DateTime.Now
+
+    static member StartNew() = 
+        let timer = Stopwatch()
+        timer.Start()
+        timer
+
+    member this.Reset() =
+        startTime <- DateTime.Now
+
+    member this.ElapsedMilliseconds with get() = int64 (DateTime.Now - startTime).TotalMilliseconds
+
+    member this.Elapsed with get() = DateTime.Now - startTime
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.IO.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.IO.fs
new file mode 100644
index 0000000..6c3dff9
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.IO.fs
@@ -0,0 +1,51 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System.IO
+
+type File() =
+    static member ReadAllLines (path) =
+        Hooks.readAllLines.Invoke(path)
+
+    static member ReadAllText (path) =
+        System.String.Join("\r\n",  Hooks.readAllLines.Invoke(path))
+
+    static member WriteAllText (path, content) = 
+        Hooks.writeAllText.Invoke(path, content)
+
+    static member WriteAllLines (path, content) = 
+        Hooks.writeAllLines.Invoke(path, content)
+
+    static member AppendAllText(path, content) = 
+        Hooks.appendAllText.Invoke(path, content)
+
+    static member CreateText(path) =
+        Hooks.getFileStream.Invoke(path)
+
+    static member OpenText(path) =
+        new System.IO.StreamReader(Hooks.getFileStream.Invoke(path))
+
+type FileShare = 
+    | None = 0
+    | Read = 1
+    | Write = 2
+    | ReadWrite = 3
+    | Delete  = 4
+    | Inheritable = 16
+
+type Directory() =
+    static member Exists (dir) =
+        Hooks.directoryExists.Invoke(dir)
+
+    static member GetFiles (dir) =
+        Hooks.getFiles.Invoke(dir, "*")
+
+    static member GetFiles (dir, pattern) =
+        Hooks.getFiles.Invoke(dir, pattern)
+
+    static member GetDirectories (dir) =
+        Hooks.getDirectories.Invoke(dir)
+
+type Path() =
+    static member GetDirectoryName(path) = Hooks.getDirectoryName.Invoke(path)
+    static member GetFileName(path) = Hooks.getFileName.Invoke(path)
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.fs
new file mode 100644
index 0000000..3c11236
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/System.fs
@@ -0,0 +1,28 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System
+
+type Console() = 
+    static member Write s = stdout.Write s
+    static member WriteLine () = stdout.WriteLine ""
+    static member WriteLine (f : obj, [<ParamArray>] args) = 
+        match f with
+        | null -> ()
+        | _ -> stdout.WriteLine (System.String.Format(f.ToString(), args))
+
+type Version = 
+  {
+    Major : int
+    Minor : int
+  }
+
+type Environment() =
+    static let mutable exitCode  = 0
+    static member CurrentDirectory = Hooks.getCurrentDirectory.Invoke()
+    static member ExitCode
+        with get() = exitCode
+        and set(v) = exitCode <- v
+    static member GetCommandLineArgs() = ["aa"; "bb"]
+    static member GetEnvironmentVariable varName = Hooks.getEnvironmentVariable.Invoke(varName)
+    static member Version = { Major = Hooks.majorVersion.Invoke();  Minor = Hooks.minorVersion.Invoke() }
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/netcoreautomationhelperlibrary.fsproj b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/netcoreautomationhelperlibrary.fsproj
new file mode 100644
index 0000000..762fa19
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/netcoreautomationhelperlibrary.fsproj
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>3E51D6E3-1234-9876-ABCD-70BE750F8104</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>NetCoreAutomationHelperLibrary</RootNamespace>
+    <AssemblyName>NetCoreAutomationHelperLibrary</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
+    <TargetProfile>netcore</TargetProfile>
+    <Name>NetCoreAutomationHelperLibrary</Name>
+    <SccProjectName>SAK</SccProjectName>
+    <SccProvider>SAK</SccProvider>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccLocalPath>SAK</SccLocalPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <Tailcalls>false</Tailcalls>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE;NetCore</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Debug\PortableAutomationHelperLibrary.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <Tailcalls>true</Tailcalls>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Release\PortableAutomationHelperLibrary.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.Portable.FSharp.Targets" />
+  <ItemGroup>
+    <Compile Include="Hooks.fs" />
+    <Compile Include="Extensions.fs" />
+    <Compile Include="standardconsole.fs" />
+    <Compile Include="System.fs" />
+    <Compile Include="System.Diagnostics.fs" />
+    <Compile Include="System.IO.fs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core">
+      <Name>FSharp.Core</Name>
+      <AssemblyName>FSharp.Core.dll</AssemblyName>
+      <HintPath>$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETCore\3.3.1.0\FSharp.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/standardconsole.fs b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/standardconsole.fs
new file mode 100644
index 0000000..ca888bd
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcoreautomationhelperlibrary/standardconsole.fs
@@ -0,0 +1,65 @@
+// fake desktop module for printf, printfn, and exit function
+
+[<AutoOpen>]
+module DesktopModule
+
+[<AutoOpen>]
+module stderr = 
+    open System.Collections.Generic
+
+    let Write(str) = Hooks.write.Invoke(str)
+    let WriteLine(str) = Write (sprintf "%s\r\n" str)
+    
+    let Flush _ = ()
+
+// console printing functions don't exist in portable, so we fake them here
+[<AutoOpen>]
+module stdout = 
+
+    let Write(str) = Hooks.write.Invoke(str)
+    let WriteLine(str) = Write (sprintf "%s\r\n" str)
+     
+    open System
+    type FSV = Microsoft.FSharp.Reflection.FSharpValue
+    type FST = Microsoft.FSharp.Reflection.FSharpType
+
+    let notImpl<'T> : 'T = raise (NotImplementedException())
+
+    let printfn (fmt : Printf.TextWriterFormat<'T>) : 'T = 
+        let rec chain (ty : System.Type) : obj = 
+            if FST.IsFunction ty then
+                let argTy, retTy = FST.GetFunctionElements ty
+                FSV.MakeFunction(ty, (fun x -> 
+                                        WriteLine (sprintf "    [%A]" x)
+                                        chain retTy))
+            else
+                if ty.IsValueType then Activator.CreateInstance(ty) else null
+
+        WriteLine (fmt.Value)
+        chain typeof<'T> :?> 'T
+
+    let eprintf (fmt : Printf.TextWriterFormat<'T>) : 'T = 
+        let rec chain (ty : System.Type) : obj = 
+            if FST.IsFunction ty then
+                let argTy, retTy = FST.GetFunctionElements ty
+                FSV.MakeFunction(ty, (fun _ -> chain retTy))
+            else
+                if ty.IsValueType then Activator.CreateInstance(ty) else null
+
+        chain typeof<'T> :?> 'T
+
+    let printf fmt = printfn fmt
+
+    let Flush _ = ()
+
+// many tests complete with an "exit" statement, which doesn't exist in portable
+// workaround is to redefine "exit" as a global function that either does nothing (exit 0) or throws an exception (exit n, n <> 0)
+[<AutoOpen>]
+module control = 
+    exception Exit of int
+    let exit n = 
+        if n = 0 then ()
+        else raise (Exit(n))
+
+module Printf = 
+    let printf a b = stdout.Write(sprintf a b)
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcorelibrary1/InitialHook.fs b/tests/fsharp/core/netcore/netcorelibrary1/InitialHook.fs
new file mode 100644
index 0000000..b898785
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcorelibrary1/InitialHook.fs
@@ -0,0 +1,32 @@
+// driver program can provide hooks with full implementations
+module InitialHook
+
+// System.Console
+let setWrite (f : System.Action<string>) = Hooks.write <- f
+
+// System.Environment
+let setGetEnvironmentVariable (f : System.Func<string, string>) = Hooks.getEnvironmentVariable <- f
+let setMajorVersion (f : System.Func<int>) = Hooks.majorVersion <- f
+let setMinorVersion (f : System.Func<int>) = Hooks.minorVersion <- f
+
+// System.IO.Directory
+let setGetFiles (f : System.Func<string, string, string[]>) = Hooks.getFiles <- f
+let setGetDirectories (f : System.Func<string, string[]>) = Hooks.getDirectories <- f
+let setDirectoryExists(f : System.Func<string, bool>) = Hooks.directoryExists <- f
+
+// System.IO.File
+let setWriteAllText (f : System.Action<string, string>) = Hooks.writeAllText <- f
+let setWriteAllLines (f : System.Action<string, string[]>) = Hooks.writeAllLines <- f
+let setAppendAllText (f : System.Action<string, string>) = Hooks.appendAllText <- f
+let setReadAllLines(f: System.Func<string, string[]>) = Hooks.readAllLines <- f
+
+// System.IO.FileStream
+let setGetFileStream(f : System.Func<string, System.IO.Stream>) = Hooks.getFileStream <- f
+
+// System.IO.Path
+let setGetCurrentDirectory (f : System.Func<string>) = Hooks.getCurrentDirectory <- f
+let setGetDirectoryName (f : System.Func<string, string>) = Hooks.getDirectoryName <- f
+let setGetFileName (f : System.Func<string, string>) = Hooks.getFileName <- f
+
+// System.Threading.Thread
+let setSleep(f : System.Action<int>) = Hooks.sleep <- f
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/netcorelibrary1/netcoretestinglibrary.fsproj b/tests/fsharp/core/netcore/netcorelibrary1/netcoretestinglibrary.fsproj
new file mode 100644
index 0000000..65d53e2
--- /dev/null
+++ b/tests/fsharp/core/netcore/netcorelibrary1/netcoretestinglibrary.fsproj
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>9FE96E07-1234-9876-BD3F-9C7F0F98B9B1</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>NetCoreLibrary1</RootNamespace>
+    <AssemblyName>NetCoreTestingLibrary</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
+    <TargetProfile>netcore</TargetProfile>
+    <Name>NetCoreTestingLibrary</Name>
+    <SccProjectName>SAK</SccProjectName>
+    <SccProvider>SAK</SccProvider>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccLocalPath>SAK</SccLocalPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <Tailcalls>false</Tailcalls>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;Portable;NetCore;COMPILED</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Debug\NetCoreLibrary1.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <Tailcalls>true</Tailcalls>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE;Portable;NetCore</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Release\NetCoreLibrary1.XML</DocumentationFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core">
+      <Name>FSharp.Core</Name>
+      <AssemblyName>FSharp.Core.dll</AssemblyName>
+      <HintPath>$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETCore\3.3.1.0\FSharp.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="InitialHook.fs" />
+    <Compile Include="..\..\access\test.fsx">
+      <Link>access-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\apporder\test.fsx">
+      <Link>apporder-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\array\test.fsx">
+      <Link>array-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\attributes\test.fsx">
+      <Link>attributes-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\comprehensions\test.fsx">
+      <Link>comprehensions-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\control\test.fsx">
+      <Link>control-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\controlChamenos\test.fsx">
+      <Link>controlChamenos-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\controlMailbox\test.fsx">
+      <Link>controlMailbox-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\controlStackOverflow\test.fsx">
+      <Link>controlStackOverflow-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\csext\test.fsx">
+      <Link>csext-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\innerpoly\test.fsx">
+      <Link>innerpoly-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\int32\test.fsx">
+      <Link>int32-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\lazy\test.fsx">
+      <Link>lazy-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\letrec\test.fsx">
+      <Link>letrec-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\libtest\test.fsx">
+      <Link>libtest-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\lift\test.fsx">
+      <Link>lift-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\longnames\test.fsx">
+      <Link>longnames-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\map\test.fsx">
+      <Link>map-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\measures\test.fsx">
+      <Link>measures-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\genericmeasures\test.fsx">
+      <Link>genericmeasures-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\nested\test.fsx">
+      <Link>nested-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\patterns\test.fsx">
+      <Link>patterns-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\printf\test.fsx">
+      <Link>printf-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\queriesCustomQueryOps\test.fsx">
+      <Link>queriesCustomQueryOps-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\queriesLeafExpressionConvert\test.fsx">
+      <Link>queriesLeafExpressionConvert-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\queriesNullableOperators\test.fsx">
+      <Link>queriesNullableOperators-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\queriesOverIEnumerable\test.fsx">
+      <Link>queriesOverIEnumerable-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\queriesOverIQueryable\test.fsx">
+      <Link>queriesOverIQueryable-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\quotes\test.fsx">
+      <Link>quotes-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\seq\test.fsx">
+      <Link>seq-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\subtype\test.fsx">
+      <Link>subtype-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\syntax\test.fsx">
+      <Link>syntax-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\tlr\test.fsx">
+      <Link>tlr-test.fsx</Link>
+    </Compile>
+    <Compile Include="..\..\unicode\test.fsx">
+      <Link>unicode-test.fsx</Link>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\NetCoreAutomationHelperLibrary\NetCoreAutomationHelperLibrary.fsproj">
+      <Name>NetCoreAutomationHelperLibrary</Name>
+      <Project>{3E51D6E3-1234-9876-ABCD-70BE750F8104}</Project>
+      <Private>True</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <PropertyGroup>
+    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.Portable.FSharp.Targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/netcore/run.bat b/tests/fsharp/core/netcore/run.bat
new file mode 100644
index 0000000..971ebdc
--- /dev/null
+++ b/tests/fsharp/core/netcore/run.bat
@@ -0,0 +1,19 @@
+ at if "%_echo%"=="" echo off
+
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+set CONTROL_FAILURES_LOG=%~dp0\control_failures.log
+
+.\ConsoleApplication1\bin\Debug\PortableTestEntry.exe
+endlocal
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
diff --git a/tests/fsharp/core/parsing/build.bat b/tests/fsharp/core/parsing/build.bat
new file mode 100644
index 0000000..32662eb
--- /dev/null
+++ b/tests/fsharp/core/parsing/build.bat
@@ -0,0 +1,43 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+REM This is a single-empty-line test file. 
+
+  "%FSC%" %fsc_flags% -a -o:crlf.dll -g crlf.ml
+  @if ERRORLEVEL 1 goto Error
+
+REM Another simple test
+
+  "%FSC%" %fsc_flags% -o:toplet.exe -g toplet.ml
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" toplet.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/parsing/crlf.ml b/tests/fsharp/core/parsing/crlf.ml
new file mode 100644
index 0000000..ea3ffa7
--- /dev/null
+++ b/tests/fsharp/core/parsing/crlf.ml
@@ -0,0 +1,2 @@
+// #Conformance 
+
diff --git a/tests/fsharp/core/parsing/toplet.ml b/tests/fsharp/core/parsing/toplet.ml
new file mode 100644
index 0000000..03fc7a1
--- /dev/null
+++ b/tests/fsharp/core/parsing/toplet.ml
@@ -0,0 +1,15 @@
+// #Conformance 
+let rec loopF n x = function 0 -> x | i -> loopF n (x+1) (i-1) in
+let rec loopE n x = function 0 -> x | i -> loopE n (loopF n x n) (i-1) in
+let rec loopD n x = function 0 -> x | i -> loopD n (loopE n x n) (i-1) in
+let rec loopC n x = function 0 -> x | i -> loopC n (loopD n x n) (i-1) in
+let rec loopB n x = function 0 -> x | i -> loopB n (loopC n x n) (i-1) in
+let rec loopA n x = function 0 -> x | i -> loopA n (loopB n x n) (i-1) in  
+let n =
+  try 
+    System.Int32.Parse(System.Environment.GetCommandLineArgs().[1])
+  with 
+    _ -> 1
+  in
+Printf.printf "%d\n" (loopA n 0 n)
+
diff --git a/tests/fsharp/core/patterns/build.bat b/tests/fsharp/core/patterns/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/patterns/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/patterns/run.bat b/tests/fsharp/core/patterns/run.bat
new file mode 100644
index 0000000..7b0b526
--- /dev/null
+++ b/tests/fsharp/core/patterns/run.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/patterns/test.fsx b/tests/fsharp/core/patterns/test.fsx
new file mode 100644
index 0000000..5237064
--- /dev/null
+++ b/tests/fsharp/core/patterns/test.fsx
@@ -0,0 +1,1101 @@
+// #Conformance #PatternMatching #Regression #Lists #ActivePatterns 
+(* Pattern match tests.
+ * Initially just some tests related to top-level let-pattern bug.
+ * Later regression tests that patterns do project out the bits expected?
+ *)
+#if Portable
+module Core_patterns
+#endif
+
+#light
+
+let failures = ref false
+let report_failure s  = 
+  stderr.WriteLine ("NO: test "+s+" failed"); failures := true
+let test s b = if b then () else report_failure(s) 
+let check s x1 x2 = 
+    if (x1 = x2) then 
+        stderr.WriteLine ("test "+s+": ok")
+    else 
+        report_failure(s)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(* What kinds of top-leval let patterns are possible? *)
+
+type r2 = {f1:int;f2:int}
+type ('a,'b) either = This of 'a | That of 'b
+exception XInt  of int
+exception XBool of bool
+
+(* Those with no variables *)
+let () = ()
+let (1) = (1)
+let (1,2,3) = (1,2,3)  
+let  1,2,3  = (1,2,3)
+let [] = []
+let [1] = [1]
+let [1;2] = [1;2]
+let (None) = None
+let (Some 1) = Some 1
+let {f1=f1;f2=f2} = {f1=1;f2=2}
+let (XInt 1) = XInt 1  
+let (XBool true) = XBool true
+
+(* Those with some variables *)
+let () = ()
+let (v1) = (1)
+let (v2,v3) = (2,3)  
+let v4,v5,v6 = (4,5,6)
+let v7 = []
+let [v8] = [8]
+let [v9;v10] = [9;10]
+let (Some v11) = Some 11
+let {f1=v12;f2=v13} = {f1=12;f2=13}
+let (XInt v14) = XInt 14
+let (XBool vTrue) = XBool true
+let w1,[w2,Some (w3,XInt w4,XBool w5)] = 1,[2,Some (3,XInt 4,XBool true)]
+
+(* Those with alternatives *)
+let this_10 = This 10
+let that_20 = That 20
+let (This eiA | That eiA) = this_10
+let (This eiB | That eiB) = that_20
+
+(* polymorphic bound vars *)
+let this_f1 = This (fun x -> x)
+let that_f2 = That (fun x -> x)
+let (This fA | That fA) = this_f1
+let (This fB | That fB) = that_f2
+
+(* If there are several polymorphic values matched,
+   they get put into a tuple which has first class polymorphic field types...
+   Users can not (directly!) create such tuples in source... need to check they are ok.
+*)
+let (Some xxxx),polyF1,polyF2,n =
+  Some 1,
+  (  (* ? forall alpha. *) fun (x:'alpha) -> x  ),
+  (  (* ? forall beta.  *) fun (x:'beta) -> x   ),
+  4
+
+(* Relics *)
+let aaa = []
+let bb = match aaa with x::xs -> x | [] -> 0
+let [p,q,r,(sA,sB)] = [1,2,3,(4,5)]
+let [1],a,b,c = List.map (fun x -> x) [1],11,12,13
+let y = 3
+let x = try raise (Failure("a")) with e -> 12
+let [x2] = [1]
+let [1] = [1]
+
+(* BUG: 438
+ * null tests are split out,
+ * but subsequent patterns need passing through the pattern simplifier,
+ * specifically here to replace string patterns by equality test calls.
+ *)
+let bug438repro (tok:string) =
+  match tok with
+      null -> 11      
+    | ""   -> 22
+    | "aa" -> 33
+    | str  -> 99
+
+module ComplexNumbers_Example = begin
+    // dummy type definition
+    type complex = 
+        { RealPart: float; ImaginaryPart: float }
+        member x.Magnitude = 1.0
+        member x.Phase = 1.0
+    module Complex = 
+        let mkRect (a,b) = { RealPart = a; ImaginaryPart = b }
+        // dummy definition
+        let mkPolar (a,b) = { RealPart = a; ImaginaryPart = b }
+    
+        
+    open Microsoft.FSharp.Math
+//    let Rect (x,y) = Complex.mkRect(x,y)
+  //  let Polar (r,th) = Complex.mkPolar(r,th)
+    
+    let (|Rect|) (x:complex) = (x.RealPart, x.ImaginaryPart)
+    let (|Polar|) (x:complex) = (x.Magnitude , x.Phase)
+
+    let mulViaRect c1 c2 = 
+        match c1,c2 with 
+        | Rect(ar,ai), Rect(br,bi) -> Complex.mkRect(ar*br - ai*bi, ai*br + bi*ar)
+
+    let mulViaPolar c1 c2 = 
+        match c1,c2 with 
+        | Polar(r1,th1),Polar(r2,th2) -> Complex.mkPolar(r1*r2, th1+th2)
+
+    let mul1 (Rect(ar,ai)) (Rect(br,bi)) = Complex.mkRect(ar*br - ai*bi, ai*br + bi*ar)
+    let mul2 (Polar(r1,th1)) (Polar(r2,th2)) = Complex.mkPolar(r1*r2, th1+th2)
+end
+
+module NaturalNumbers_Example = begin
+
+    let Succ n = n+1
+    
+    let (|Zero|Succ|) n = if n = 0 then Zero else Succ(n-1)
+
+
+    let rec fib n = 
+        match n with
+        | Succ (Succ m) -> fib m + fib (m+1)
+        | Succ Zero -> 1
+        | Zero -> 0
+
+    let (|Even|Odd|) n = if n%2 = 0 then Even(n/2) else Odd(n-1)
+
+    let rec power x n =
+        match n with
+        | Even m -> let p = power x m in p * p
+        | Odd m -> x * power x m
+
+end
+
+// Queues 
+
+module FunctionalQueue_Example = begin
+    let (|Reversed|) l = List.rev l
+    let (|NonEmpty|Empty|) q =
+        match q with
+        | (h::t),r               ->  NonEmpty(h,(t,r))
+        | []    ,Reversed (h::t) ->  NonEmpty(h,(t,[]))
+        | _                      -> Empty()
+
+    let enqueue x (f,r) = (f,x::r)
+
+    let dequeue2 q = 
+        match q with
+        | NonEmpty(x,NonEmpty(y,xs)) -> x,y,xs
+        | NonEmpty(x,Empty) ->  failwith "singleton queue"
+        | Empty -> failwith "empty queue"
+
+    let q = ref ([1], [2;3;4])
+    do System.Console.WriteLine("q = {0}", sprintf "%A" !q)
+    do let x,y,rest = dequeue2 !q in System.Console.WriteLine("dequeue q = {0}", sprintf "%A" x); q := rest
+    do let x,y,rest = dequeue2 !q in System.Console.WriteLine("dequeue q = {0}", sprintf "%A" x); q := rest
+    do let x = enqueue 5 !q in System.Console.WriteLine("enqueue q = {0}", sprintf "%A" x); q := x
+end
+
+// CLR types 
+
+module System_Type_Example2 = begin
+
+    open System
+    
+    let (|Named|Array|ByRef|Ptr|Param|) (typ : System.Type) =
+        if typ.IsGenericType        then Named(typ.GetGenericTypeDefinition(), typ.GetGenericArguments())
+        elif not typ.HasElementType then Named(typ, [| |])
+        elif typ.IsArray            then Array(typ.GetElementType(), typ.GetArrayRank())
+        elif typ.IsByRef            then ByRef(typ.GetElementType())
+        elif typ.IsPointer          then Ptr(typ.GetElementType())
+        elif typ.IsGenericParameter then Param(typ.GenericParameterPosition, typ.GetGenericParameterConstraints())
+        else failwith "unexpected System.Type"
+
+    //val widget : Type -> [ `Named of ... | `Array of ... | `ByRef of ... ]
+    //val (|Named|Array|ByRef|Ptr|Param|) : Type -> Choices5< Type , .. , .. >
+
+    let rec toString typ =
+        match typ with
+        | Named (con, args) -> "(" + con.Name + " " + String.Join(";",Array.map toString args) + ")"
+        | Array (arg, rank) -> "(Array"  + rank.ToString() + " " + toString arg + ")"
+        | ByRef arg         -> "(ByRef " + toString arg + ")"
+        | Ptr arg           -> "(Ptr "   + toString arg + ")"
+        | Param(pos,cxs)    -> "(Param " + sprintf "%A" (pos,cxs) + ")"
+
+    do System.Console.WriteLine(typeof<(int list option ref)>)
+end
+
+// Join lists 
+
+module JoinList_ExampleA = begin
+    type ilist = 
+        | Empty 
+        | Single of int 
+        | Join of ilist * ilist
+
+    let rec (|Cons|Nil|) inp =
+        match inp with  
+        | Single x                -> Cons(x, Empty)
+        | Join (Cons (x,xs), ys)  -> Cons(x, Join (xs, ys))
+        | Join (Nil, Cons (y,ys)) -> Cons(y, Join (ys, Empty))
+        | _                       -> Nil()
+
+    let head js = 
+        match js with 
+        | Cons (x,_) -> x
+        | _ -> failwith "empty list"
+
+    do System.Console.WriteLine("JoinList_ExampleA1")
+    do System.Console.WriteLine("1 = {0}", head (Single 1))
+    do System.Console.WriteLine("JoinList_ExampleA2")
+    do System.Console.WriteLine("true = {0}", head (Join (Single 1,Empty)))
+    do System.Console.WriteLine("JoinList_ExampleA3")
+    do System.Console.WriteLine("true = {0}", head (Join (Empty, Single 1)))
+end
+
+// Join lists 
+
+module JoinList_Example = begin
+    type ilist = 
+        | Empty 
+        | Single of int 
+        | Join of ilist * ilist
+    
+    let rec (|Cons|Nil|) = function 
+        | Single x                   -> Cons(x, Empty)
+        | Join (Cons (x,xs), ys)     -> Cons(x, Join (xs, ys))
+        | Join (Nil (), Cons (y,ys)) -> Cons(y, Join (ys, Empty))
+        | _                          -> Nil()
+
+    let head js = 
+        match js with 
+        | Cons (x,_) -> x
+        | _ -> failwith "empty list"
+
+    let rec map f xs =
+        match xs with
+        | Cons (y,ys) -> Join (Single (f y), map f ys)
+        | Nil () -> Empty
+
+    let rec to_list xs =
+        match xs with
+        | Cons (y,ys) -> y :: to_list ys
+        | Nil () -> []
+
+    let is = Join (Join (Single 0, Join (Single 1, Join (Empty, Empty))), Join (Empty, Join (Join (Single 2, Single 3), Single 4)))
+    do System.Console.WriteLine("true = {0}", head (Join (Empty, Single 1)))
+    do System.Console.WriteLine("true = {0}", head (Join (Join (Empty, Empty), Single 2)))
+end
+
+module PolyJoinList_Example = begin
+    type 'a jlist = Empty | Single of 'a | Join of 'a jlist * 'a jlist
+
+    let rec (|JCons|JNil|) = function 
+        | Single x                     -> JCons(x, Empty)
+        | Join (JCons (x,xs), ys)      -> JCons(x, Join (xs, ys))
+        | Join (JNil (), JCons (y,ys)) -> JCons(y, Join (ys, Empty))
+        | Empty 
+        | Join (JNil (), JNil ()) -> JNil()
+
+    let jhead js = 
+        match js with 
+        | JCons (x,_) -> x
+        | JNil        -> failwith "empty list"
+
+    let rec jmap f xs =
+        match xs with
+        | JCons (y,ys) -> Join (Single (f y), jmap f ys)
+        | JNil () -> Empty
+
+    let rec jlist_to_list xs =
+        match xs with
+        | JCons (y,ys) -> y :: jlist_to_list ys
+        | JNil () -> []
+
+    let js = Join (Join (Single 0, Join (Single 1, Join (Empty, Empty))), Join (Empty, Join (Join (Single 2, Single 3), Single 4)))
+    do System.Console.WriteLine("js = {0}", sprintf "%A" (jlist_to_list js))
+    do System.Console.WriteLine("jmap (+1) js = {0}", sprintf "%A" (jlist_to_list (jmap (fun x -> x+1) js)))
+    do System.Console.WriteLine("true = {0}", jhead (Join (Empty, Single true)))
+    do System.Console.WriteLine("true = {0}", jhead (Join (Join (Empty, Empty), Single true)))
+end
+
+module UnZip_Example = begin
+    // Zip 
+    let rec (|Unzipped|) = function 
+        | ((x,y) :: Unzipped (xs, ys)) -> (x :: xs, y :: ys)
+        | []                           -> ([], [])
+
+    let unzip (Unzipped (xs, ys)) = xs, ys
+
+    let zs = [(1,1);(2,4);(3,9);(4,16)]
+
+    do System.Console.WriteLine("zs = {0}", sprintf "%A" zs)
+    do System.Console.WriteLine("unzip zs = {0}", sprintf "%A" (unzip zs))
+end
+
+
+// Lazy lists 
+
+module LazyList_Example = begin
+    open System
+    open System.Collections.Generic
+
+    #nowarn "21" // recursive initialization
+    #nowarn "40" // recursive initialization
+
+    exception UndefinedException
+
+    [<NoEquality; NoComparison>]
+    type LazyList<'T> =
+        { mutable status : LazyCellStatus< 'T > }
+        
+        member x.Value = 
+            match x.status with 
+            | LazyCellStatus.Value v -> v
+            | _ -> 
+                lock x (fun () -> 
+                    match x.status with 
+                    | LazyCellStatus.Delayed f -> 
+                        x.status <- Exception UndefinedException; 
+                        try 
+                            let res = f () 
+                            x.status <- LazyCellStatus.Value res; 
+                            res 
+                        with e -> 
+                            x.status <- LazyCellStatus.Exception(e); 
+                            reraise()
+                    | LazyCellStatus.Value v -> v
+                    | LazyCellStatus.Exception e -> raise e)
+        
+        member s.GetEnumeratorImpl() = 
+            let getCell (x : LazyList<'T>) = x.Value
+            let toSeq s = Seq.unfold (fun ll -> match getCell ll with CellEmpty -> None | CellCons(a,b) -> Some(a,b)) s 
+            (toSeq s).GetEnumerator()
+                
+        interface IEnumerable<'T> with
+            member s.GetEnumerator() = s.GetEnumeratorImpl()
+
+        interface System.Collections.IEnumerable with
+            override s.GetEnumerator() = (s.GetEnumeratorImpl() :> System.Collections.IEnumerator)
+
+
+    and 
+        [<NoEquality; NoComparison>]
+        LazyCellStatus<'T> =
+        | Delayed of (unit -> LazyListCell<'T> )
+        | Value of LazyListCell<'T> 
+        | Exception of System.Exception
+
+
+    and 
+        [<NoEquality; NoComparison>]
+        LazyListCell<'T> = 
+        | CellCons of 'T * LazyList<'T> 
+        | CellEmpty
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module LazyList = 
+
+        let lzy f = { status = Delayed f }
+        let force (x: LazyList<'T>) = x.Value
+
+        let notlazy v = { status = Value v }
+        
+        type EmptyValue<'T>() = 
+            static let value : LazyList<'T> = notlazy CellEmpty
+            static member Value : LazyList<'T> = value
+            
+        [<NoEquality; NoComparison>]
+        type LazyItem<'T> = ItemCons of 'T * LazyList<'T> | ItemEmpty
+        type 'T item = 'T LazyItem
+        let get (x : LazyList<'T>) = match force x with CellCons (a,b) -> Some(a,b) | CellEmpty -> None
+        let getCell (x : LazyList<'T>) = force x 
+        let empty<'T> : LazyList<'T> = EmptyValue<'T>.Value
+        let consc x l = CellCons(x,l)
+        let cons x l = lzy(fun () -> (consc x l))
+        let consDelayed x l = lzy(fun () -> (consc x (lzy(fun () ->  (force (l()))))))
+        let consf x l = consDelayed x l
+
+        let rec unfold f z = 
+          lzy(fun () -> 
+              match f z with
+              | None       -> CellEmpty
+              | Some (x,z) -> CellCons (x,unfold f z))
+
+        let rec append l1  l2 = lzy(fun () ->  (appendc l1 l2))
+        and appendc l1 l2 =
+          match getCell l1 with
+          | CellEmpty -> force l2
+          | CellCons(a,b) -> consc a (append b l2)
+
+        let delayed f = lzy(fun () ->  (getCell (f())))
+        let repeat x = 
+          let rec s = cons x (delayed (fun () -> s)) in s
+
+        let rec map f s = 
+          lzy(fun () ->  
+            match getCell s with
+            | CellEmpty -> CellEmpty
+            | CellCons(a,b) -> consc (f a) (map f b))
+
+        let rec map2 f s1 s2 =  
+          lzy(fun () -> 
+            match getCell s1, getCell s2  with
+            | CellCons(a1,b1),CellCons(a2,b2) -> consc (f a1 a2) (map2 f b1 b2)
+            | _ -> CellEmpty)
+
+        let rec zip s1 s2 = 
+          lzy(fun () -> 
+            match getCell s1, getCell s2  with
+            | CellCons(a1,b1),CellCons(a2,b2) -> consc (a1,a2) (zip b1 b2)
+            | _ -> CellEmpty)
+        let combine s1 s2 = zip s1 s2
+
+        let rec concat s1 = 
+          lzy(fun () -> 
+            match getCell s1 with
+            | CellCons(a,b) -> appendc a (concat b)
+            | CellEmpty -> CellEmpty)
+          
+        let rec filter p s1= lzy(fun () ->  filterc p s1)
+        and filterc p s1 =
+            match getCell s1 with
+            | CellCons(a,b) -> if p a then consc a (filter p b) else filterc p b
+            | CellEmpty -> CellEmpty
+          
+        let rec tryFind p s1 =
+            match getCell s1 with
+            | CellCons(a,b) -> if p a then Some a else tryFind p b
+            | CellEmpty -> None
+
+        let first p s1 = tryFind p s1
+
+        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+        let find p s1 =
+            match tryFind p s1 with
+            | Some a -> a
+            | None   -> indexNotFound()
+
+        let rec scan f acc s1 = 
+          lzy(fun () -> 
+            match getCell s1 with
+            | CellCons(a,b) -> let acc' = f acc a in consc acc' (scan f acc' b)
+            | CellEmpty -> CellEmpty)
+
+        let folds f acc s1 = scan f acc s1 // deprecated
+
+        let head s = 
+          match getCell s with
+          | CellCons(a,_) -> a
+          | CellEmpty -> invalidArg "s" "the list is empty"
+
+        let tail s = 
+          match getCell s with
+          | CellCons(_,b) -> b
+          | CellEmpty -> invalidArg "s" "the list is empty"
+
+        let hd s = head s
+        let tl s = tail s
+
+        let isEmpty s =
+          match getCell s with
+          | CellCons _ -> false
+          | CellEmpty -> true
+
+        let nonempty s = not (isEmpty s)
+
+        let rec take n s = 
+          lzy(fun () -> 
+            if n < 0 then invalidArg "n" "the number must not be negative"
+            elif n = 0 then CellEmpty 
+            else
+              match getCell s with
+              | CellCons(a,s) -> consc a (take (n-1) s)
+              | CellEmpty -> invalidArg "n" "not enough items in the list" )
+
+        let rec skipc n s =
+          if n = 0 then force s 
+          else  
+            match getCell s with
+            | CellCons(_,s) -> skipc (n-1) s
+            | CellEmpty -> invalidArg "n" "not enough items in the list"
+
+        let rec skip n s = 
+          lzy(fun () -> 
+            if n < 0 then invalidArg "n" "the value must not be negative"
+            else skipc n s)
+
+        let drop n s = skip n s
+
+        let rec ofList l = 
+          lzy(fun () -> 
+            match l with [] -> CellEmpty | h :: t -> consc h (ofList t))
+          
+        let toList s = 
+          let rec loop s acc = 
+              match getCell s with
+              | CellEmpty -> List.rev acc
+              | CellCons(h,t) -> loop t (h::acc)
+          loop s []
+          
+        let rec iter f s = 
+          match getCell s with
+          | CellEmpty -> ()
+          | CellCons(h,t) -> f h; iter f t
+          
+        let rec copyFrom i a = 
+          lzy(fun () -> 
+            if i >= Array.length a then CellEmpty 
+            else consc a.[i] (copyFrom (i+1) a))
+          
+        let rec copyTo (arr: _[]) s i = 
+          match getCell s with
+          | CellEmpty -> ()
+          | CellCons(a,b) -> arr.[i] <- a; copyTo arr b (i+1)
+
+        let ofArray a = copyFrom 0 a
+        let toArray s = Array.ofList (toList s)
+          
+        let rec lengthAux n s = 
+          match getCell s with
+          | CellEmpty -> n
+          | CellCons(_,b) -> lengthAux (n+1) b
+
+        let length s = lengthAux 0 s
+
+        let toSeq (s: LazyList<'T>) = (s :> IEnumerable<_>)
+
+        // Note: this doesn't dispose of the IEnumerator if the iteration is not run to the end
+        let rec ofFreshIEnumerator (e : IEnumerator<_>) = 
+          lzy(fun () -> 
+            if e.MoveNext() then 
+              consc e.Current (ofFreshIEnumerator e)
+            else 
+               e.Dispose()
+               CellEmpty)
+          
+        let ofSeq (c : IEnumerable<_>) =
+          ofFreshIEnumerator (c.GetEnumerator()) 
+          
+        let (|Cons|Nil|) l = match getCell l with CellCons(a,b) -> Cons(a,b) | CellEmpty -> Nil
+
+
+    let matchTwo(ll) = 
+        match ll with 
+        | LazyList.Cons(h1,LazyList.Cons(h2,t)) -> printf "%O,%O\n" h1 h2
+        | LazyList.Cons(h1,t) -> printf "%O\n" h1
+        | LazyList.Nil() -> printf "empty!\n" 
+
+    open LazyList
+    
+    let rec pairReduce xs =
+      match xs with
+        | Cons (x, Cons (y,ys)) -> LazyList.consf (x+y) (fun () -> pairReduce ys)
+        | Cons (x, Nil ())      -> LazyList.cons x LazyList.empty
+        | Nil ()                -> LazyList.empty 
+
+    let rec inf = LazyList.consf 0 (fun () -> LazyList.map (fun x -> x + 1) inf)
+
+    let ll = LazyList.ofList [1;2;3;4]
+    do System.Console.WriteLine(sprintf "%A" (LazyList.toList (LazyList.take 10 (pairReduce inf))))
+end
+
+(*
+module RawQuotation_Examples1 = begin
+
+    open Microsoft.FSharp.Quotations.Raw
+
+    let (|Add|_|) = <@@| (_:int32) + (_:int32) |@@>
+    let (|Mul|_|) = <@@| (_:int32) * (_:int32) |@@>
+        
+    let rec trans x =
+        match x with 
+        | Add(x,y) -> trans x + trans y
+        | Mul(x,y) -> trans x * trans y
+        | Int32(x) -> x
+        | _ -> failwith "unrecognized"
+        
+    printf "res1 = %d\n" (trans <@@ 1+3+2 @@>)
+end
+*)
+
+
+module PartialPattern_Examples = begin
+
+     // Partial patterns are signfied by |_| and return 'option'.
+     // They are most useful when dealing with repeatedly recurring queries
+     // on very "heterogeneous" data sets, i.e. data sets able to represent 
+     // a large range of possible entities, but where you're often interested in
+     // focusing on a subset of the entities involved. Strings, term structures and XML
+     // are common examples.
+     let (|MulThree|_|) inp = 
+        if inp % 3 = 0 then Some(inp/3) else None
+     let (|MulSeven|_|) inp = 
+        if inp % 7 = 0 then Some(inp/7) else None
+        
+     // Here is an example of their use.
+     let example1 inp = 
+         match 21 with 
+         | MulThree(residue) -> printf "residue = %d!\n" residue
+         | MulSeven(residue) -> printf "residue = %d!\n" residue
+         | _ -> printf "no match!\n"
+
+     example1 777
+     example1 9
+     example1 10
+     example1 21
+
+end
+     
+
+module ParameterizedPartialPattern_Examples = begin
+     let (|Equal|_|) x y = 
+        printf "x = %d!\n" x
+        if x = y then Some() else None
+        
+     let example1 = 
+         match 3 with 
+         | Equal 4 () -> printf "3 = 4!\n"
+         | Equal 3 () -> printf "3 = 3!\n"
+         | _ -> printf "3 = ?!\n"
+
+     let (|Lookup|_|) x map = Map.tryFind x map
+        
+     let example2 = 
+         match Map.ofList [ "2", "Two" ; "3", "Three" ] with 
+         | Lookup "4" v -> printf "4 should not be present!\n"
+         | Lookup "3" v -> printf "map(3) = %s\n" v
+         | Lookup "2" v -> printf "this should not be reached\n"
+         | _ -> printf "3 = ?!\n"
+end
+     
+
+module Combinator_Examples = begin
+
+    type ('a,'b) query = 'a -> 'b option 
+    let mapQ1 f (|P|_|) = function (P x) -> Some (f x) | _ -> None
+    let app1 (|P|) (P x) = x
+    let app2 (|P|_|) (P x) = x
+    let mapQ2 f (|P|) (P x) = f x
+
+    // Sets 
+
+    // Given a partial pattern P find the first element in the list that satisfies P
+    // This is obviously overkill but it's showing what's possible.
+    let Find (|P|_|) =
+        let rec (|E|_|) ys =
+            match ys with 
+            | (P x :: _  ) -> Some(x)
+            | (_   :: E x) -> Some(x)
+            | _ -> None
+        (|E|_|)    
+
+end
+
+#if Portable
+#else
+module XmlPattern_Examples = begin
+
+
+  open System.Xml
+  open System.Collections
+  open System.Collections.Generic
+
+  let Select (|P|_|) (x: #XmlNode) = [ for P y as n in x.ChildNodes -> y ]
+
+  let Select2 (|A|B|) (x: #XmlNode) = [ for (A y | B y) as n in x.ChildNodes -> y ]
+
+  let (|Elem|_|) name (inp: #XmlNode) = 
+      if inp.Name = name then Some(inp) 
+      else None
+
+  let (|Attr|_|) attr (inp: #XmlNode) = 
+      match inp.Attributes.GetNamedItem(attr) with
+      | null -> None
+      | node -> Some(node.Value)
+
+  let (|Num|_|) attr inp = 
+      match inp with 
+      | Attr attr v -> Some (float v) 
+      | _           -> None
+
+  type scene = 
+      | Sphere of float * float * float * float
+      | Intersect of scene list 
+  
+  let (|Vector|_|) = function (Num "x" x & Num "y" y & Num "z" z) -> Some(x,y,z) | _ -> None
+  
+  let rec (|ShapeElem|_|) inp = 
+      match inp with 
+      | Elem "Sphere" (Num "r" r  & Num "x" x & Num "y" y & Num "z" z) -> Some (Sphere (r,x,y,z)) 
+      | Elem "Intersect" (ShapeElems(objs)) -> Some (Intersect objs) 
+      | _ -> None
+
+  and (|ShapeElems|) inp = Select (|ShapeElem|_|) inp 
+
+  let parse inp = 
+      match (inp :> XmlNode) with 
+      | Elem "Scene" (ShapeElems elems) -> elems
+      | _                               -> failwith "not a scene graph"
+
+  let inp = "<Scene>
+                <Intersect>
+                  <Sphere r='2' x='1' y='0' z='0'/>
+                  <Intersect>
+                    <Sphere r='2' x='4' y='0' z='0'/>
+                    <Sphere r='2' x='-3' y='0' z='0'/>
+                  </Intersect>
+                  <Sphere r='2' x='-2' y='1' z='0'/>
+                </Intersect>
+             </Scene>"
+  let doc = new XmlDocument()
+  doc.LoadXml(inp)
+  //stdout.WriteLine doc.DocumentElement.Name
+  printf "results = %A\n" (parse doc.DocumentElement)
+
+
+end
+#endif
+module RegExp = 
+    open System.IO
+    
+    let rec allFiles dir =
+        [ for x in Directory.GetFiles(dir) do yield x
+          for x in Directory.GetDirectories(dir) do yield! allFiles x ]
+
+    open System.Text.RegularExpressions
+    let (|IsMatch|_|) (pat:string) (inp:string) = if System.Text.RegularExpressions.Regex.IsMatch(inp,"^" + pat + "$") then Some(inp) else None
+    let (|Match|_|) (pat:string) (inp:string) = 
+        let m = Regex.Match(inp, "^" + pat + "$") in
+        if m.Success then Some (List.tail [ for g in m.Groups -> g.Value ]) else None
+
+    let (|Match1|_|) (pat:string) (inp:string) = 
+        match (|Match|_|) pat inp with 
+        | Some [h] -> Some h
+        | Some [] -> failwith "Match1 succeeded, but no groups found. Use '(.*)' to capture groups"
+        | Some _ -> failwith "Match1 succeeded, but more than one group found. Use '(.*)' to capture groups"
+        | None -> None
+
+    let (|IsSubMatch|_|) (pat:string) (inp:string) = if Regex.IsMatch(inp,pat) then Some(inp) else None
+    let (|SubMatch|_|) (pat:string) (inp:string) = 
+        let m = Regex.Match(inp, pat) in
+        if m.Success then Some (List.tail [ for g in m.Groups -> g.Value ]) else None
+
+    let check s b1 b2 = if b1 <> b2 then report_failure s
+    check "fwhin3op1" ((|IsMatch|_|) ".*.ml" "abc.ml") (Some "abc.ml")
+    check "fwhin3op2"((|Match|_|) ".*.ml" "abc.ml") (Some [])
+    check "fwhin3op3" ((|Match|_|) ".*.ml" "abc.mlll") None
+    check "fwhin3op4" ((|Match|_|) "(.*).ml" "abc.ml") (Some ["abc"])
+    check "fwhin3op5" ((|Match|_|) "([abc]*).ml" "abc.ml") (Some ["abc"])
+    check "fwhin3op6" ((|Match|_|) "([a-c]*).ml" "abc.ml") (Some ["abc"])
+    check "fwhin3op7" ((|Match|_|) "([a-bc]*).ml" "abc.ml") (Some ["abc"])
+    check "fwhin3op9" ((|Match|_|) "^.*.ml$" "abc.ml") (Some [])
+
+    let testFun() = 
+        File.WriteAllLines("test.fs", seq { for (IsMatch "(.*).fs" f) in allFiles System.Environment.CurrentDirectory do yield! "-------------------------------" :: "\n" :: "\n" :: ("// FILE: "+f) :: "" :: "module "+(f |> Path.GetDirectoryName |> Path.GetFileName |> (fun s -> s.ToUpper()))+ " =" :: [ for line in Array.toList (File.ReadAllLines(f)) -> "    "+line ] } |> Seq.toArray)
+
+module RandomWalk = 
+    let ran = new System.Random()
+    let dice p = ran.NextDouble() <= p
+
+    //! Random walk
+    let randomWalk upP (nSteps,x) = if nSteps = 0 then None else
+                                    if dice upP then Some (x+1,(nSteps-1,x+1))
+                                                else Some (x-1,(nSteps-1,x-1))
+    let n = 100
+
+    let xs     = [| for i in 0 .. n -> i |]
+
+    let walk initial upP = [| let state = ref initial 
+                              for i in 0 .. n do
+                                 if dice upP then incr state else decr state; 
+                                 yield float !state |]
+
+    let walkA1 = walk 10 0.54 
+    let walkB1 = walk 14 0.46 
+
+module RandomTEst = 
+    type ICool =    
+        abstract p : unit -> unit 
+        
+    type IEvenCooler =
+        inherit ICool
+    
+#if Portable
+#else
+module RandomCodeFragment = 
+    open System
+
+    let createRemote<'T> (d: AppDomain) = 
+        unbox<'T>(d.CreateInstanceAndUnwrap((typeof<'T>).Assembly.FullName,(typeof<'T>).FullName))
+
+    //let o = createRemote<Inspector>(AppDomain.CurrentDomain)
+
+
+    open System
+    open System.Reflection
+    open System.Threading
+
+    type Remoter<'a>(f) =
+      class
+        inherit MarshalByRefObject()
+        member x.Call : 'a = f()
+      end
+
+    let remoteCall (d:AppDomain) (f:unit->'a) =
+      let t = (typeof<Remoter<'a>>)
+      let r = d.CreateInstanceAndUnwrap(t.Assembly.FullName, t.FullName, true, BindingFlags.CreateInstance, null, [| box f |], null, null, null)
+              |> unbox<Remoter<'a>>
+      r.Call
+
+    let inspect (d:AppDomain) =
+      let callingDomain = AppDomain.CurrentDomain.FriendlyName 
+      remoteCall d 
+        (fun() -> 
+          printf "inspector called from: %s\nexecuted in: %s\non thread: %d\n\n\n"
+            callingDomain 
+            AppDomain.CurrentDomain.FriendlyName
+            System.Threading.Thread.CurrentThread.ManagedThreadId)
+            
+ #endif
+      
+module ActivePatternsFromTheHub = 
+    type callData = 
+      { time : System.DateTime;
+        duration : int;
+        countryCode : string;
+        areaCode : string;
+        number : string }
+
+    // Note: you ask for calling plans to be extensible. I've done this by using strings: in many ways
+    // active patterns allow you to use more heterogeneous data (such as strings) and still use
+    // functional programming (or at least pattern matching).
+    //
+    // The intention of the example appears to be that additional calling plans are given semantics
+    // by new rules that resolve how they interact in a fairly adhoc way with the call data.
+    // It's hard to see how you would permit "arbitrary" extensions in a modular way for
+    // this example, since the devil is always in the resolution of potential conflicts and
+    // ambiguities with other rules. If I've misunderstood the kind of extensibility you require
+    // then please let me know. In any case it's a great example of adhoc matching.
+    type userData = 
+      { callingPlan : string }
+
+    // Define patterns that extract features out of the above data structures. Once
+    // these are defined we never access the internal data structures. 
+    //
+    //   Note for language geeks: we'll probably also add some kind of syntax for 
+    //   automatically getting active patterns that extract properties, which would make
+    //   these redundant.
+
+    let (|CallTime|)   cd = cd.time
+    let (|CountryCode|) cd = cd.countryCode
+    let (|AreaCode|)    cd = cd.areaCode
+    let (|CallingPlan|) ud = ud.callingPlan
+
+    // Define some patterns that detect particular features relevant to the rules.
+    let predicate b = if b then Some() else None
+
+    let (|NightTime|_|) (time:System.DateTime) = 
+        let hourOfDay = time.TimeOfDay.Hours in 
+        predicate (hourOfDay < 5 or hourOfDay > 19)
+
+    let (|International|_|) cc = 
+        predicate (cc <> "")
+
+    let perMinuteRate (cd,ud) = 
+        match cd,ud with
+        //Rule1: 1-800 numbers are free
+        | AreaCode("800"), _ -> 0
+        //Rule2: customers on 'Unlimited' plans don't pay per-minute charges
+        | _,CallingPlan("Unlimited") -> 0
+        //Rule3: International calls cost 20c/daytime and 10c/nighttime
+        | CountryCode(International) & CallTime(NightTime), _ -> 10 
+        | CountryCode(International), _ -> 20
+        //Rule 4: anything else costs 1 dollar per minute
+        | _ -> 100  
+
+module AndrewKennedyFunkyActivePatternsBugRelatedToArityInference = 
+    let (|Fun|) (x:int->int) =  x
+
+    let (Fun(f)) = (fun x -> x)
+
+module AndrewKennedyRatherEmarrassingSimpleBug1133 = 
+
+    type a = A | B
+    let f = fun A -> 1
+    let g = fun [] -> 1
+    check "vweioh3v209" (f A) 1
+    check "vweioh3v209" (try f B with MatchFailureException _ -> 2) 2
+    check "vweioh3v209" (g []) 1
+    check "vweioh3v209" (try g [1] with MatchFailureException _ -> 2) 2
+    check "vweioh3v209" (try g ["1"] with MatchFailureException _ -> 3) 3
+
+module NameResolutionBug1134 = 
+    module M1 = 
+       type a = A | B
+       let (|A2|) (x:a) = "a"
+
+    module M2 = 
+       let A = 1
+       let A2 = 1
+
+
+    open M1
+    open M2
+    let f x = match x with | A -> 4 | B -> 5 // the 'A' should resolve to the pattern identifier
+    let g x = match x with | A2 _ -> 4 | B -> 5 // the 'A' should resolve to the pattern identifier
+
+module CheckNameResoutionRules = 
+
+    module M1a = 
+        type t = C of int
+        
+    module M2a = 
+        open M1a
+        let (C x1) = C(3) 
+        let (C x2) = C(3)
+        let f1 = fun (C _) -> C
+        let f2 = fun (C _) -> C
+        let f3 = function C _ -> C
+        let f4 = C
+        let v = C 3
+        let C = 1
+        
+
+    module M1b = 
+        type t = C 
+
+    module M2b = 
+        open M1b
+        let (C) = C
+        let f1 = fun (C _) -> C
+        let f2 = fun (C _) -> C
+        let f3 = function C _ -> C
+        let f4 = C
+        let C x1 = x1
+
+    module M3a1 = 
+        type t = C 
+
+    module M3a2 = 
+        let C = 3
+
+    module M3b = 
+        open M3a1
+        open M3a2
+        let (C) = M3a1.C
+        let f1 = fun (C _) -> C
+        let f2 = fun (C _) -> C
+        let f3 = function C _ -> C
+        let f4 = C
+        let C x1 = x1  // ok to define a function because "M3a1.C" is zero arity
+    module Adhoc1 = 
+        let Exit(args) = printfn "exit!"  // Exit is an OCaml-compatible exception in the F# library. This is a common case where people try to redefine it.
+    module Adhoc2 = 
+        let Exit() = printfn "exit!"  // Exit is an OCaml-compatible exception in the F# library. This is a common case where people try to redefine it.
+        
+(*
+module BigIntAndBigNumPatternMatching = begin
+
+    let test (m) =
+        match m with
+        | 0I -> "zero"
+        | 1I -> "one"
+        | _ -> "more"
+
+    do check "v4j-042p91" (test 0I) "zero"
+    do check "v4j-042p92" (test 1I) "one"
+    do check "v4j-042p93" (test 2I) "more"
+
+
+    let test2 (m) =
+        match m with
+        | 0N -> "zero"
+        | 1N -> "one"
+        | _ -> "more"
+
+    do check "v4j-042p94" (test2 0N) "zero"
+    do check "v4j-042p95" (test2 1N) "one"
+    do check "v4j-042p96" (test2 2N) "more"
+end
+*)
+
+module ActivePatternsWithIndeterminateReturnType = 
+
+    let (|Cast|_|) (x:obj) : 'T option = match x with | :? 'T as t ->  Some t | _ -> None
+    let (|CastIron|) (x:obj) : 'T = match x with | :? 'T as t ->  t | _ -> failwith "CastIron"
+
+    let test inp = 
+        match inp with 
+        | Cast (x:int) -> 1
+        | Cast "1" -> 2
+        | Cast (x:string) -> 3
+        | _ -> 4
+
+    check "ckwenwe0" (test (box 1)) 1
+    check "ckwenwe0" (test (box "1")) 2
+    check "ckwenwe0" (test (box "2")) 3
+    check "ckwenwe0" (test (box 1.0)) 4
+
+    let test2 inp = 
+        match inp with 
+        | CastIron (x:int) -> 1
+
+    check "ckwenwe0" (test2 (box 1)) 1
+    check "ckwenwe0" ((try test2 (box "1") |> ignore; 1 with Failure _ -> 2)) 2
+    check "ckwenwe0" ((try test2 (box 1.0) |> ignore; 1 with Failure _ -> 2)) 2
+
+module TypecheckingBug_FSharp_1_0_6389 = 
+    type Nullary<'T> = | Nullary 
+
+    (* Separate bug: Nullary<int>.Nullary *)
+
+    let f1 Nullary = ()
+    let f2 Nullary Nullary = ()
+    let f3 Nullary = Nullary
+    let f4 Nullary Nullary = Nullary
+
+    let f5<'T,'U> (Nullary: Nullary<'T>) = (Nullary: Nullary<'U>)
+    let f6<'T,'U,'V> (Nullary: Nullary<'T>) (Nullary: Nullary<'U>)= (Nullary: Nullary<'V>)
+
+    // check f3 is properly generic with type f3 : Nullary<'T> -> Nullary<'U>
+    let v3 : Nullary<string> = f3 (Nullary : Nullary<int>) 
+    let v4 : Nullary<string> = f4 (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+    let v5 : Nullary<string> = f5<int,string> (Nullary : Nullary<int>) 
+    let v6 : Nullary<string> = f6<int,decimal,string> (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+
+    type C() = 
+        static member M1 Nullary = ()
+        static member M2 Nullary Nullary = ()
+        static member M3 Nullary = Nullary
+        static member M4 Nullary Nullary = Nullary
+
+        static member M5<'T,'U> (Nullary: Nullary<'T>) = (Nullary: Nullary<'U>)
+        static member M6<'T,'U,'V> (Nullary: Nullary<'T>) (Nullary: Nullary<'U>) = (Nullary: Nullary<'V>)
+
+        // check f3 is properly generic with type M3 : Nullary<'T> -> Nullary<'U>
+        static member P3 : Nullary<string> = C.M3 (Nullary : Nullary<int>) 
+        static member P4 : Nullary<string> = C.M4 (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+        static member P5 : Nullary<string> = C.M5<int,string> (Nullary : Nullary<int>) 
+        static member P6 : Nullary<string> = C.M6<int,decimal,string> (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+
+
+    type C2() = 
+        member c.M1 Nullary = ()
+        member c.M2 Nullary Nullary = ()
+        member c.M3 Nullary = Nullary
+        member c.M4 Nullary Nullary = Nullary
+
+        member c.M5<'T,'U> (Nullary: Nullary<'T>) = (Nullary: Nullary<'U>)
+        member c.M6<'T,'U,'V> (Nullary: Nullary<'T>) (Nullary: Nullary<'U>) = (Nullary: Nullary<'V>)
+
+        // check f3 is properly generic with type M3 : Nullary<'T> -> Nullary<'U>
+        member c.P3 : Nullary<string> = c.M3 (Nullary : Nullary<int>) 
+        member c.P4 : Nullary<string> = c.M4 (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+        member c.P5 : Nullary<string> = c.M5<int,string> (Nullary : Nullary<int>) 
+        member c.P6 : Nullary<string> = c.M6<int,decimal,string> (Nullary : Nullary<int>) (Nullary : Nullary<decimal>) 
+
+
+(* check for failure else sign off "ok" *)
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
diff --git a/tests/fsharp/core/pinvoke/build.bat b/tests/fsharp/core/pinvoke/build.bat
new file mode 100644
index 0000000..8b92ffe
--- /dev/null
+++ b/tests/fsharp/core/pinvoke/build.bat
@@ -0,0 +1,37 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+"%FSC%" %fsc_flags% -o:test%ILX_CONFIG%.exe -g test.fsx
+ at if ERRORLEVEL 1 goto Error
+
+REM The IL is unverifiable code
+"%PEVERIFY%" /MD test%ILX_CONFIG%.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/pinvoke/test.fsx b/tests/fsharp/core/pinvoke/test.fsx
new file mode 100644
index 0000000..3d63185
--- /dev/null
+++ b/tests/fsharp/core/pinvoke/test.fsx
@@ -0,0 +1,247 @@
+// #Conformance #Interop #PInvoke #Structs 
+#light
+
+#nowarn "9"
+open System
+open System.Runtime.InteropServices
+open System.Windows.Forms
+open System.Drawing
+
+
+[<DllImport("cards.dll")>]
+let cdtInit((width: IntPtr), (height: IntPtr)) : unit = ()
+
+let pinned (obj: obj) f = 
+  let gch = GCHandle.Alloc(obj,GCHandleType.Pinned) in 
+  try f(gch.AddrOfPinnedObject())
+  finally
+    gch.Free()
+
+//The following types from the System namespace are blittable types: 
+//
+//System.Byte 
+//System.SByte 
+//System.Int16 
+//System.UInt16 
+//System.Int32 
+//System.UInt32 
+//System.Int64 
+//System.IntPtr 
+//System.UIntPtr 
+//The following complex types are also blittable types: 
+//One-dimensional arrays of blittable types, such as an array of integers. 
+//Formatted value types that contain only blittable types (and classes if they are marshaled as formatted types). 
+
+//
+// assert ((typeof<'a>) == (typeof<int>)  or
+//         (typeof<'a>) == (typeof<int64>)  or
+// etc.           
+
+type PinBox<'a> = { v : obj }
+  with 
+    static member Create(x) = { v  = box(x) }
+    member x.Value = (unbox x.v : 'a)
+    member x.Pin(f) = pinned(x.v) f
+  end
+
+let card_init () =
+  let width = PinBox<_>.Create(300) in
+  let height = PinBox<_>.Create(400) in
+  width.Pin (fun widthAddress -> 
+    height.Pin (fun heightAddress -> 
+      cdtInit (widthAddress, heightAddress)));
+  Printf.printf "width = %d\n" width.Value;
+  Printf.printf "height = %d\n" height.Value;
+  ()
+
+do card_init()
+
+let asciiz (pBytes: nativeptr<sbyte>) = new System.String(pBytes)
+ 
+#nowarn "0044";;
+#nowarn "0051";;
+
+open System
+open System.Runtime.InteropServices
+open Microsoft.FSharp.NativeInterop
+
+type voidptr = System.IntPtr
+
+//int (*derivs)(double, double [], double [], void *), 
+type DerivsFunction = delegate of double * double nativeptr * double nativeptr * voidptr -> int
+
+//int (*outputFn)(double, double*, void*) );
+type OutputFunction = delegate of double * double nativeptr * voidptr -> int
+
+[<DllImport("PopDyn.dll")>]
+// Wrap the C function with the following signature:
+//
+extern int SolveODE2(double *ystart, int nvar, double x1, double x2, double eps, double h1,
+                     double hmin, double hmax, int *nok, int *nbad, double dx, void *info, 
+                     DerivsFunction derivs, 
+                     OutputFunction outputFn);
+module Array = 
+    let inline pinObjUnscoped (obj: obj) =  GCHandle.Alloc(obj,GCHandleType.Pinned) 
+
+    let inline pinObj (obj: obj) f = 
+        let gch = pinObjUnscoped obj 
+        try f gch
+        finally
+            gch.Free()
+    
+    [<NoDynamicInvocation>]
+    let inline pin (arr: 'T []) (f : nativeptr<'T> -> 'U) = 
+        pinObj (box arr) (fun _ -> f (&&arr.[0]))
+    
+
+type NativeArray<'T when 'T : unmanaged>(ptr : nativeptr<'T>, len: int) =
+    member x.Ptr = ptr
+    [<NoDynamicInvocation>]
+    member inline x.Item 
+       with get n = NativePtr.get x.Ptr n
+       and  set n v = NativePtr.set x.Ptr n v
+    member x.Length = len
+// Provide a nicer wrapper for use from F# code.  This takes an F# array as input,
+// and when the callbacks happen wraps up the returned native arrays in the 
+// F# NativeArray thin wrapper which lets you use nice syntax arr.[n] for getting and
+// setting values of these arrays.
+let solveODE ystart (x1,x2,eps,h1,hmin,hmax) (nok,nbad) dx derivs outputFn = 
+    Array.pin ystart (fun ystartAddr -> 
+        let nvar = Array.length ystart in
+        let mutable nok = nok in 
+        let mutable nbad = nbad in 
+        let info = 0n in 
+        let derivsF  = new DerivsFunction(fun  x arr1 arr2 _ -> derivs x (new NativeArray<_>(arr1,nvar)) (new NativeArray<_>(arr2,nvar))) in 
+        let outputFnF = new OutputFunction(fun x pY _ -> outputFn x) in 
+        SolveODE2(ystartAddr,nvar,x1,x2,eps,h1,hmin,hmax,&&nok,&&nbad,dx,info,derivsF,outputFnF))
+
+let example1() = 
+  solveODE 
+     // initial values
+     [| 1.0; 2.0 |] 
+     // settings
+     (1.0,2.0,0.0001,1.0,1.0,1.0) 
+     // nok,nbad
+     (10,20) 
+     // dx
+     0.05 
+     // Compute the derivatives.  Note outp and inp are both NativeArrays, passed to us from C.
+     // So there is no bounds checking on these assignments - be careful!  
+     // If it turns out that these arrays are of static known size then we can do better here. 
+     (fun x inp outp -> 
+         outp.[0] <- inp.[0] + 0.05; 1) 
+     // output
+     (fun v -> printf "v = %G\n" v; 5)
+
+
+
+module GetSystemTimeTest = begin
+    open System
+    open System.Runtime.InteropServices
+
+    [<StructLayout(LayoutKind.Explicit, Size=16, CharSet=CharSet.Ansi)>]
+    type MySystemTime = class
+       new() = { wYear=0us; wMonth=0us; wDayOfWeek=0us; wDay=0us; wHour=0us; wMinute=0us;wSecond=0us;wMilliseconds=0us }
+       [<FieldOffset(0)>] val wYear : uint16; 
+       [<FieldOffset(2)>] val wMonth : uint16;
+       [<FieldOffset(4)>] val wDayOfWeek : uint16; 
+       [<FieldOffset(6)>] val wDay : uint16 ; 
+       [<FieldOffset(8)>] val wHour : uint16 ; 
+       [<FieldOffset(10)>] val wMinute : uint16 ; 
+       [<FieldOffset(12)>] val wSecond : uint16 ; 
+       [<FieldOffset(14)>] val wMilliseconds : uint16 ; 
+    end
+
+    [<DllImport("kernel32.dll")>]
+    extern void GetSystemTime([<MarshalAs(UnmanagedType.LPStruct)>] MySystemTime ct);
+
+    do 
+          let sysTime = new MySystemTime()
+          GetSystemTime(sysTime);
+          printf "The System time is %d/%d/%d %d:%d:%d\n" 
+                            (int32 sysTime.wDay)
+                            (int32 sysTime.wMonth )
+                            (int32 sysTime.wYear )
+                            (int32 sysTime.wHour )
+                            (int32 sysTime.wMinute )
+                            (int32 sysTime.wSecond)
+
+end
+
+module MemoryStatusTest = begin
+    open System
+    open System.Runtime.InteropServices
+
+    [<StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)>]
+    type MEMORYSTATUSEX = class
+        val mutable dwLength : uint32
+        val dwMemoryLoad : uint32
+        val ullTotalPhys : uint64
+        val ullAvailPhys : uint64
+        val ullTotalPageFile : uint64
+        val ullAvailPageFile : uint64
+        val ullTotalVirtual : uint64
+        val ullAvailVirtual : uint64
+        val ullAvailExtendedVirtual : uint64
+        new() = {dwLength = Convert.ToUInt32(Marshal.SizeOf(typeof<MEMORYSTATUSEX>));
+                 dwMemoryLoad = 0ul;
+                 ullTotalPhys = 0UL;
+                 ullAvailPhys = 0UL;
+                 ullTotalPageFile = 0UL;
+                 ullAvailPageFile = 0UL;
+                 ullTotalVirtual = 0UL;
+                 ullAvailVirtual = 0UL;
+                 ullAvailExtendedVirtual  = 0UL}
+    end
+
+    [<DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
+    extern [<MarshalAs(UnmanagedType.Bool)>] bool 
+          GlobalMemoryStatusEx( [<In; Out>] MEMORYSTATUSEX lpBuffer);
+
+    let main() =
+        let mex = new MEMORYSTATUSEX()
+        GlobalMemoryStatusEx(mex) |> ignore
+        printf "%A\n" mex
+
+    main()
+end
+
+
+module MemoryStatusTest2 = begin
+    open System
+    open System.Runtime.InteropServices
+
+    [<StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)>]
+    type MEMORYSTATUSEX = struct
+        val mutable dwLength : uint32
+        val dwMemoryLoad : uint32
+        val ullTotalPhys : uint64
+        val ullAvailPhys : uint64
+        val ullTotalPageFile : uint64
+        val ullAvailPageFile : uint64
+        val ullTotalVirtual : uint64
+        val ullAvailVirtual : uint64
+        val ullAvailExtendedVirtual : uint64
+        new(dummy:int) = {dwLength = Convert.ToUInt32(Marshal.SizeOf(typeof<MEMORYSTATUSEX>));
+                 dwMemoryLoad = 0ul;
+                 ullTotalPhys = 0UL;
+                 ullAvailPhys = 0UL;
+                 ullTotalPageFile = 0UL;
+                 ullAvailPageFile = 0UL;
+                 ullTotalVirtual = 0UL;
+                 ullAvailVirtual = 0UL;
+                 ullAvailExtendedVirtual  = 0UL}
+    end
+
+    [<DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)>]
+    extern [<MarshalAs(UnmanagedType.Bool)>] bool 
+          GlobalMemoryStatusEx( [<In; Out>] MEMORYSTATUSEX *lpBuffer);
+
+    let main() =
+        let mutable mex = new MEMORYSTATUSEX(0)
+        GlobalMemoryStatusEx(&& mex) |> ignore
+        printf "%A\n" mex
+
+    main()
+end
+
diff --git a/tests/fsharp/core/portable/ConsoleApplication1/Program.cs b/tests/fsharp/core/portable/ConsoleApplication1/Program.cs
new file mode 100644
index 0000000..e2e869f
--- /dev/null
+++ b/tests/fsharp/core/portable/ConsoleApplication1/Program.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace PortableTestEntry
+{
+    // driver program for F# portable tests
+    // a number of existing test code files are conditionally refactored into a module such that tests run in the static constructor
+    // thus, we just need to access the "aa" property to trigger test code to be run
+    class Program
+    {
+        static int returnCode = 0;
+
+        static int Main(string[] args)
+        {
+            SetHooks();
+
+            Run("Core_access", () => { var x = Core_access.aa; });
+            Run("Core_apporder", () => { var x = Core_apporder.aa; });
+            Run("Core_array", () => { var x = Core_array.aa; });
+            Run("Core_attributes", () => { var x = Core_attributes.aa; });
+            Run("Core_comprehensions", () => { var x = Core_comprehensions.aa; });
+            Run("Core_control", () => { var x = Core_control.aa; });
+            Run("Core_controlChamenos", () => { var x = Core_controlChamenos.aa; });
+            Run("Core_controlMailBox", () => { var x = Core_controlMailBox.aa; });
+            Run("Core_controlStackOverflow", () => { var x = Core_controlStackOverflow.aa; });
+            Run("Core_csext", () => { var x = Core_csext.aa; });
+            Run("Core_innerpoly", () => { var x = Core_innerpoly.aa; });
+            Run("Core_int32", () => { var x = Core_int32.aa; });
+            Run("Core_lazy", () => { var x = Core_lazy.aa; });
+            Run("Core_letrec", () => { var x = Core_letrec.aa; });
+            Run("Core_libtest", () => { var x = Core_libtest.aa; });
+            Run("Core_lift", () => { var x = Core_lift.aa; });
+            Run("Core_longnames", () => { var x = Core_longnames.aa; });
+            Run("Core_map", () => { var x = Core_map.aa; });
+            Run("Core_measures", () => { var x = Core_measures.aa; });
+            Run("Core_genericMeasures", () => { var x = Core_genericMeasures.aa; });
+            Run("Core_nested", () => { var x = Core_nested.aa; });
+            Run("Core_patterns", () => { var x = Core_patterns.aa; });
+            Run("Core_printf", () => { var x = Core_printf.aa; });
+            Run("Core_queriesCustomQueryOps", () => { var x = Core_queriesCustomQueryOps.aa; });
+            Run("Core_queriesLeafExpressionConvert", () => { var x = Core_queriesLeafExpressionConvert.aa; });
+            Run("Core_queriesNullableOperators", () => { var x = Core_queriesNullableOperators.aa; });
+            Run("Core_queriesOverIEnumerable", () => { var x = Core_queriesOverIEnumerable.aa; });
+            Run("Core_queriesOverIQueryable", () => { var x = Core_queriesOverIQueryable.aa; });
+            Run("Core_quotes", () => { var x = Core_quotes.aa; });
+            Run("Core_seq", () => { var x = Core_seq.aa; });
+            Run("Core_subtype", () => { var x = Core_subtype.aa; });
+            Run("Core_syntax", () => { var x = Core_syntax.aa; });
+            Run("Core_tlr", () => { var x = Core_tlr.aa; });
+            Run("Core_unicode", () => { var x = Core_unicode.aa; });
+
+            return returnCode;
+        }
+
+        // portable libraries don't have access to a number of APIs, so set hooks to work around this
+        static void SetHooks()
+        {
+            // System.Console
+            InitialHook.setWrite((msg) => Console.Write(msg));
+
+            // System.Environment
+            InitialHook.setGetEnvironmentVariable((varName) => Environment.GetEnvironmentVariable(varName));
+            InitialHook.setMajorVersion(() => Environment.Version.Major);
+            InitialHook.setMinorVersion(() => Environment.Version.Minor);
+
+            // System.IO.Directory
+            InitialHook.setGetFiles((dir, pattern) => Directory.GetFiles(dir, pattern));
+            InitialHook.setGetDirectories((dir) => Directory.GetDirectories(dir));
+            InitialHook.setDirectoryExists((dir) => Directory.Exists(dir));
+
+            // System.IO.File
+            InitialHook.setWriteAllText((path, contents) => File.WriteAllText(path, contents));
+            InitialHook.setWriteAllLines((path, contents) => File.WriteAllLines(path, contents));
+            InitialHook.setAppendAllText((path, contents) => File.AppendAllText(path, contents));
+            InitialHook.setReadAllLines((path) => File.ReadAllLines(path));
+
+            // System.IO.FileStream
+            InitialHook.setGetFileStream((path) => new FileStream(path, FileMode.OpenOrCreate));
+
+            // System.IO.Path
+            InitialHook.setGetCurrentDirectory(() => Environment.CurrentDirectory);
+            InitialHook.setGetDirectoryName((path) => Path.GetDirectoryName(path));
+            InitialHook.setGetFileName((path) => Path.GetFileName(path));
+
+            // System.Threading.Thread
+            InitialHook.setSleep((timeout) => Thread.Sleep(timeout));           
+        }
+
+        // execute and handle errors for individual test areas
+        static void Run(string testArea, Action action)
+        {
+            Console.WriteLine("Running area {0}", testArea);
+
+            try
+            {                
+                action();
+            }
+            catch (Exception e)
+            {
+                returnCode = -1;
+                Console.WriteLine("\tFailure!");
+                Console.WriteLine(e.ToString());
+            }
+
+            Console.WriteLine();
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/ConsoleApplication1/Properties/AssemblyInfo.cs b/tests/fsharp/core/portable/ConsoleApplication1/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f13a9ee
--- /dev/null
+++ b/tests/fsharp/core/portable/ConsoleApplication1/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ConsoleApplication2")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft Corp.")]
+[assembly: AssemblyProduct("ConsoleApplication2")]
+[assembly: AssemblyCopyright("Copyright © Microsoft Corp. 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("c29897d3-6d96-4e85-805a-458613340159")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj b/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj
new file mode 100644
index 0000000..496e68c
--- /dev/null
+++ b/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{3A01C5C1-D725-40AC-B335-F4A54A93925C}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>PortableTestEntry</RootNamespace>
+    <AssemblyName>PortableTestEntry</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>SAK</SccProjectName>
+    <SccLocalPath>SAK</SccLocalPath>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccProvider>SAK</SccProvider>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core, Version=2.3.5.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETPortable\2.3.5.1\FSharp.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\PortableLibrary1\PortableTestingLibrary.fsproj">
+      <Project>{9fe96e07-cc17-4701-bd3f-9c7f0f98b9b1}</Project>
+      <Name>PortableTestingLibrary</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj.vspscc b/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/tests/fsharp/core/portable/ConsoleApplication1/portabletestentry.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/tests/fsharp/core/portable/build.bat b/tests/fsharp/core/portable/build.bat
new file mode 100644
index 0000000..6c48865
--- /dev/null
+++ b/tests/fsharp/core/portable/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+msbuild portablelibrary1.sln /p:Configuration=Debug
+
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/Extensions.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/Extensions.fs
new file mode 100644
index 0000000..3c7bc48
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/Extensions.fs
@@ -0,0 +1,30 @@
+// extension members put in place to fill in gaps in the portable profile, so that test code does not need to be updated
+// extensions either call out to hooks, or if the member is very simple, just implement the functionality locally
+
+[<AutoOpen>]
+module PortableExtensions
+
+type System.Threading.Thread with 
+    static member Sleep(millisecondsTimeout) =
+        Hooks.sleep.Invoke(millisecondsTimeout)
+
+type System.Threading.WaitHandle with
+    member this.WaitOne(millisecondsTimeout : int, exitContext : bool) =
+        this.WaitOne(millisecondsTimeout)
+
+type System.Array with
+    static member FindIndex<'a>( arr : 'a array, pred) =
+        Array.findIndex pred arr
+
+type System.IO.MemoryStream with
+    member this.Close() = ()
+
+type System.IO.Stream with
+    member this.Write(str : string) =
+        let bytes = System.Text.Encoding.UTF8.GetBytes(str)
+        this.Write(bytes, 0, bytes.Length)
+
+    member this.Close() = ()
+
+type System.IO.StreamReader with
+    member this.Close() = ()
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/Hooks.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/Hooks.fs
new file mode 100644
index 0000000..9d68b84
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/Hooks.fs
@@ -0,0 +1,34 @@
+// portable test code will use these replacements for APIs which don't exist on the portable profile
+module Hooks
+
+let private notImpl() = failwith "This callback has not been hooked by a test driver"
+
+// System.Console
+let mutable write = System.Action<string>( fun _ -> notImpl() )
+
+// System.Environment
+let mutable getEnvironmentVariable = System.Func<string, string>( fun _ -> notImpl())
+let mutable majorVersion = System.Func<int>( fun () -> notImpl() )
+let mutable minorVersion = System.Func<int>( fun () -> notImpl() )
+
+// System.IO.Directory
+let mutable getFiles = System.Func<string, string, string[]>( fun _ _ -> notImpl() )
+let mutable getDirectories = System.Func<string, string[]>( fun _ -> notImpl() )
+let mutable directoryExists = System.Func<string, bool>( fun _ -> notImpl() )
+
+// System.IO.File
+let mutable writeAllText = System.Action<string, string>( fun _ _ -> notImpl() )
+let mutable writeAllLines = System.Action<string, string[]>( fun _ _ -> notImpl() )
+let mutable appendAllText = System.Action<string, string>( fun _ _ -> notImpl() )
+let mutable readAllLines = System.Func<string, string[]>( fun _ -> notImpl() )
+
+// System.IO.FileStream
+let mutable getFileStream = System.Func<string, System.IO.Stream> ( fun _ -> notImpl() )
+
+// System.IO.Path
+let mutable getCurrentDirectory = System.Func<string>( fun () -> notImpl() )
+let mutable getDirectoryName = System.Func<string, string>( fun _ -> notImpl() )
+let mutable getFileName = System.Func<string, string>( fun _ -> notImpl() )
+
+// System.Threading.Thread
+let mutable sleep = System.Action<int>( fun _ -> notImpl() )
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/PortableAutomationHelperLibrary.fsproj.vspscc b/tests/fsharp/core/portable/portableautomationhelperlibrary/PortableAutomationHelperLibrary.fsproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/PortableAutomationHelperLibrary.fsproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/System.Diagnostics.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.Diagnostics.fs
new file mode 100644
index 0000000..10ed5b5
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.Diagnostics.fs
@@ -0,0 +1,24 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System.Diagnostics
+
+open System
+
+type Stopwatch() = 
+    let mutable startTime = DateTime.Now
+
+    member this.Start() = 
+        startTime <- DateTime.Now
+
+    static member StartNew() = 
+        let timer = Stopwatch()
+        timer.Start()
+        timer
+
+    member this.Reset() =
+        startTime <- DateTime.Now
+
+    member this.ElapsedMilliseconds with get() = int64 (DateTime.Now - startTime).TotalMilliseconds
+
+    member this.Elapsed with get() = DateTime.Now - startTime
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/System.IO.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.IO.fs
new file mode 100644
index 0000000..6c3dff9
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.IO.fs
@@ -0,0 +1,51 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System.IO
+
+type File() =
+    static member ReadAllLines (path) =
+        Hooks.readAllLines.Invoke(path)
+
+    static member ReadAllText (path) =
+        System.String.Join("\r\n",  Hooks.readAllLines.Invoke(path))
+
+    static member WriteAllText (path, content) = 
+        Hooks.writeAllText.Invoke(path, content)
+
+    static member WriteAllLines (path, content) = 
+        Hooks.writeAllLines.Invoke(path, content)
+
+    static member AppendAllText(path, content) = 
+        Hooks.appendAllText.Invoke(path, content)
+
+    static member CreateText(path) =
+        Hooks.getFileStream.Invoke(path)
+
+    static member OpenText(path) =
+        new System.IO.StreamReader(Hooks.getFileStream.Invoke(path))
+
+type FileShare = 
+    | None = 0
+    | Read = 1
+    | Write = 2
+    | ReadWrite = 3
+    | Delete  = 4
+    | Inheritable = 16
+
+type Directory() =
+    static member Exists (dir) =
+        Hooks.directoryExists.Invoke(dir)
+
+    static member GetFiles (dir) =
+        Hooks.getFiles.Invoke(dir, "*")
+
+    static member GetFiles (dir, pattern) =
+        Hooks.getFiles.Invoke(dir, pattern)
+
+    static member GetDirectories (dir) =
+        Hooks.getDirectories.Invoke(dir)
+
+type Path() =
+    static member GetDirectoryName(path) = Hooks.getDirectoryName.Invoke(path)
+    static member GetFileName(path) = Hooks.getFileName.Invoke(path)
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/System.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.fs
new file mode 100644
index 0000000..3c11236
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/System.fs
@@ -0,0 +1,28 @@
+// replacements for classes which are entirely removed from the portable profile
+// either calls out to hooks, or implements functionality locally for simple cases
+
+namespace System
+
+type Console() = 
+    static member Write s = stdout.Write s
+    static member WriteLine () = stdout.WriteLine ""
+    static member WriteLine (f : obj, [<ParamArray>] args) = 
+        match f with
+        | null -> ()
+        | _ -> stdout.WriteLine (System.String.Format(f.ToString(), args))
+
+type Version = 
+  {
+    Major : int
+    Minor : int
+  }
+
+type Environment() =
+    static let mutable exitCode  = 0
+    static member CurrentDirectory = Hooks.getCurrentDirectory.Invoke()
+    static member ExitCode
+        with get() = exitCode
+        and set(v) = exitCode <- v
+    static member GetCommandLineArgs() = ["aa"; "bb"]
+    static member GetEnvironmentVariable varName = Hooks.getEnvironmentVariable.Invoke(varName)
+    static member Version = { Major = Hooks.majorVersion.Invoke();  Minor = Hooks.minorVersion.Invoke() }
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/portableautomationhelperlibrary.fsproj b/tests/fsharp/core/portable/portableautomationhelperlibrary/portableautomationhelperlibrary.fsproj
new file mode 100644
index 0000000..c10a2ec
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/portableautomationhelperlibrary.fsproj
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>3e51d6e3-f41c-4173-8811-70be750f8104</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>PortableAutomationHelperLibrary</RootNamespace>
+    <AssemblyName>PortableAutomationHelperLibrary</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile47</TargetFrameworkProfile>
+    <Name>PortableAutomationHelperLibrary</Name>
+    <SccProjectName>SAK</SccProjectName>
+    <SccProvider>SAK</SccProvider>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccLocalPath>SAK</SccLocalPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <Tailcalls>false</Tailcalls>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Debug\PortableAutomationHelperLibrary.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <Tailcalls>true</Tailcalls>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Release\PortableAutomationHelperLibrary.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup>
+    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.Portable.FSharp.Targets" />
+  <ItemGroup>
+    <Compile Include="Hooks.fs" />
+    <Compile Include="Extensions.fs" />
+    <Compile Include="StandardConsole.fs" />
+    <Compile Include="System.fs" />
+    <Compile Include="System.IO.fs" />
+    <Compile Include="System.Diagnostics.fs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core">
+      <Name>FSharp.Core</Name>
+      <AssemblyName>FSharp.Core.dll</AssemblyName>
+      <HintPath>$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETPortable\2.3.5.1\FSharp.Core.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portableautomationhelperlibrary/standardconsole.fs b/tests/fsharp/core/portable/portableautomationhelperlibrary/standardconsole.fs
new file mode 100644
index 0000000..ca888bd
--- /dev/null
+++ b/tests/fsharp/core/portable/portableautomationhelperlibrary/standardconsole.fs
@@ -0,0 +1,65 @@
+// fake desktop module for printf, printfn, and exit function
+
+[<AutoOpen>]
+module DesktopModule
+
+[<AutoOpen>]
+module stderr = 
+    open System.Collections.Generic
+
+    let Write(str) = Hooks.write.Invoke(str)
+    let WriteLine(str) = Write (sprintf "%s\r\n" str)
+    
+    let Flush _ = ()
+
+// console printing functions don't exist in portable, so we fake them here
+[<AutoOpen>]
+module stdout = 
+
+    let Write(str) = Hooks.write.Invoke(str)
+    let WriteLine(str) = Write (sprintf "%s\r\n" str)
+     
+    open System
+    type FSV = Microsoft.FSharp.Reflection.FSharpValue
+    type FST = Microsoft.FSharp.Reflection.FSharpType
+
+    let notImpl<'T> : 'T = raise (NotImplementedException())
+
+    let printfn (fmt : Printf.TextWriterFormat<'T>) : 'T = 
+        let rec chain (ty : System.Type) : obj = 
+            if FST.IsFunction ty then
+                let argTy, retTy = FST.GetFunctionElements ty
+                FSV.MakeFunction(ty, (fun x -> 
+                                        WriteLine (sprintf "    [%A]" x)
+                                        chain retTy))
+            else
+                if ty.IsValueType then Activator.CreateInstance(ty) else null
+
+        WriteLine (fmt.Value)
+        chain typeof<'T> :?> 'T
+
+    let eprintf (fmt : Printf.TextWriterFormat<'T>) : 'T = 
+        let rec chain (ty : System.Type) : obj = 
+            if FST.IsFunction ty then
+                let argTy, retTy = FST.GetFunctionElements ty
+                FSV.MakeFunction(ty, (fun _ -> chain retTy))
+            else
+                if ty.IsValueType then Activator.CreateInstance(ty) else null
+
+        chain typeof<'T> :?> 'T
+
+    let printf fmt = printfn fmt
+
+    let Flush _ = ()
+
+// many tests complete with an "exit" statement, which doesn't exist in portable
+// workaround is to redefine "exit" as a global function that either does nothing (exit 0) or throws an exception (exit n, n <> 0)
+[<AutoOpen>]
+module control = 
+    exception Exit of int
+    let exit n = 
+        if n = 0 then ()
+        else raise (Exit(n))
+
+module Printf = 
+    let printf a b = stdout.Write(sprintf a b)
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portablelibrary1.sln b/tests/fsharp/core/portable/portablelibrary1.sln
new file mode 100644
index 0000000..6c39f01
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1.sln
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PortableTestingLibrary", "PortableLibrary1\PortableTestingLibrary.fsproj", "{9FE96E07-CC17-4701-BD3F-9C7F0F98B9B1}"
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PortableAutomationHelperLibrary", "PortableAutomationHelperLibrary\PortableAutomationHelperLibrary.fsproj", "{3E51D6E3-F41C-4173-8811-70BE750F8104}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "portabletestentry", "ConsoleApplication1\portabletestentry.csproj", "{3A01C5C1-D725-40AC-B335-F4A54A93925C}"
+EndProject
+Global
+	GlobalSection(TeamFoundationVersionControl) = preSolution
+		SccNumberOfProjects = 4
+		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+		SccLocalPath0 = .
+		SccProjectUniqueName1 = PortableAutomationHelperLibrary\\PortableAutomationHelperLibrary.fsproj
+		SccProjectName1 = PortableAutomationHelperLibrary
+		SccLocalPath1 = PortableAutomationHelperLibrary		
+		SccProjectFilePathRelativizedFromConnection1 = ..\\PortableAutomationHelperLibrary\\
+		SccProjectUniqueName2 = PortableLibrary1\\PortableTestingLibrary.fsproj
+		SccProjectName2 = PortableLibrary1
+		SccLocalPath2 = PortableLibrary1		
+		SccProjectFilePathRelativizedFromConnection2 = ..\\PortableLibrary1\\
+		SccProjectUniqueName3 = ConsoleApplication1\\portabletestentry.csproj
+		SccProjectName3 = ConsoleApplication1
+		SccLocalPath3 = ConsoleApplication1
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{9FE96E07-CC17-4701-BD3F-9C7F0F98B9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9FE96E07-CC17-4701-BD3F-9C7F0F98B9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9FE96E07-CC17-4701-BD3F-9C7F0F98B9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9FE96E07-CC17-4701-BD3F-9C7F0F98B9B1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3E51D6E3-F41C-4173-8811-70BE750F8104}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3E51D6E3-F41C-4173-8811-70BE750F8104}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3E51D6E3-F41C-4173-8811-70BE750F8104}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3E51D6E3-F41C-4173-8811-70BE750F8104}.Release|Any CPU.Build.0 = Release|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{3A01C5C1-D725-40AC-B335-F4A54A93925C}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/tests/fsharp/core/portable/portablelibrary1/InitialHook.fs b/tests/fsharp/core/portable/portablelibrary1/InitialHook.fs
new file mode 100644
index 0000000..b898785
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1/InitialHook.fs
@@ -0,0 +1,32 @@
+// driver program can provide hooks with full implementations
+module InitialHook
+
+// System.Console
+let setWrite (f : System.Action<string>) = Hooks.write <- f
+
+// System.Environment
+let setGetEnvironmentVariable (f : System.Func<string, string>) = Hooks.getEnvironmentVariable <- f
+let setMajorVersion (f : System.Func<int>) = Hooks.majorVersion <- f
+let setMinorVersion (f : System.Func<int>) = Hooks.minorVersion <- f
+
+// System.IO.Directory
+let setGetFiles (f : System.Func<string, string, string[]>) = Hooks.getFiles <- f
+let setGetDirectories (f : System.Func<string, string[]>) = Hooks.getDirectories <- f
+let setDirectoryExists(f : System.Func<string, bool>) = Hooks.directoryExists <- f
+
+// System.IO.File
+let setWriteAllText (f : System.Action<string, string>) = Hooks.writeAllText <- f
+let setWriteAllLines (f : System.Action<string, string[]>) = Hooks.writeAllLines <- f
+let setAppendAllText (f : System.Action<string, string>) = Hooks.appendAllText <- f
+let setReadAllLines(f: System.Func<string, string[]>) = Hooks.readAllLines <- f
+
+// System.IO.FileStream
+let setGetFileStream(f : System.Func<string, System.IO.Stream>) = Hooks.getFileStream <- f
+
+// System.IO.Path
+let setGetCurrentDirectory (f : System.Func<string>) = Hooks.getCurrentDirectory <- f
+let setGetDirectoryName (f : System.Func<string, string>) = Hooks.getDirectoryName <- f
+let setGetFileName (f : System.Func<string, string>) = Hooks.getFileName <- f
+
+// System.Threading.Thread
+let setSleep(f : System.Action<int>) = Hooks.sleep <- f
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portablelibrary1/PortableTestingLibrary.fsproj.vspscc b/tests/fsharp/core/portable/portablelibrary1/PortableTestingLibrary.fsproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1/PortableTestingLibrary.fsproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/tests/fsharp/core/portable/portablelibrary1/portabletestinglibrary.fsproj b/tests/fsharp/core/portable/portablelibrary1/portabletestinglibrary.fsproj
new file mode 100644
index 0000000..bc37d0a
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1/portabletestinglibrary.fsproj
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>9fe96e07-cc17-4701-bd3f-9c7f0f98b9b1</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>PortableLibrary1</RootNamespace>
+    <AssemblyName>PortableTestingLibrary</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile47</TargetFrameworkProfile>
+    <Name>PortableTestingLibrary</Name>
+    <SccProjectName>SAK</SccProjectName>
+    <SccProvider>SAK</SccProvider>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccLocalPath>SAK</SccLocalPath>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <Tailcalls>false</Tailcalls>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>TRACE;DEBUG;Portable</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Debug\PortableLibrary1.XML</DocumentationFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <Tailcalls>true</Tailcalls>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE;Portable</DefineConstants>
+    <WarningLevel>3</WarningLevel>
+    <DocumentationFile>bin\Release\PortableLibrary1.XML</DocumentationFile>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="FSharp.Core">
+      <Name>FSharp.Core</Name>
+      <AssemblyName>FSharp.Core.dll</AssemblyName>
+      <HintPath>$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETPortable\2.3.5.1\FSharp.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="InitialHook.fs" />
+    <Compile Include="..\..\access\test.fsx"><Link>access-test.fsx</Link></Compile>    
+    <Compile Include="..\..\apporder\test.fsx"><Link>apporder-test.fsx</Link></Compile>
+    <Compile Include="..\..\array\test.fsx"><Link>array-test.fsx</Link></Compile> 
+    <Compile Include="..\..\attributes\test.fsx"><Link>attributes-test.fsx</Link></Compile>
+    <Compile Include="..\..\comprehensions\test.fsx"><Link>comprehensions-test.fsx</Link></Compile>
+    <Compile Include="..\..\control\test.fsx"><Link>control-test.fsx</Link></Compile>
+    <Compile Include="..\..\controlChamenos\test.fsx"><Link>controlChamenos-test.fsx</Link></Compile>
+    <Compile Include="..\..\controlMailbox\test.fsx"><Link>controlMailbox-test.fsx</Link></Compile>
+    <Compile Include="..\..\controlStackOverflow\test.fsx"><Link>controlStackOverflow-test.fsx</Link></Compile>
+    <Compile Include="..\..\csext\test.fsx"><Link>csext-test.fsx</Link></Compile>
+    <Compile Include="..\..\innerpoly\test.fsx"><Link>innerpoly-test.fsx</Link></Compile>
+    <Compile Include="..\..\int32\test.fsx"><Link>int32-test.fsx</Link></Compile>
+    <Compile Include="..\..\lazy\test.fsx"><Link>lazy-test.fsx</Link></Compile>
+    <Compile Include="..\..\letrec\test.fsx"><Link>letrec-test.fsx</Link></Compile>
+    <Compile Include="..\..\libtest\test.fsx"><Link>libtest-test.fsx</Link></Compile>
+    <Compile Include="..\..\lift\test.fsx"><Link>lift-test.fsx</Link></Compile>
+    <Compile Include="..\..\longnames\test.fsx"><Link>longnames-test.fsx</Link></Compile>
+    <Compile Include="..\..\map\test.fsx"><Link>map-test.fsx</Link></Compile>
+    <Compile Include="..\..\measures\test.fsx"><Link>measures-test.fsx</Link></Compile>
+    <Compile Include="..\..\genericmeasures\test.fsx"><Link>genericmeasures-test.fsx</Link></Compile>
+    <Compile Include="..\..\nested\test.fsx"><Link>nested-test.fsx</Link></Compile>
+    <Compile Include="..\..\patterns\test.fsx"><Link>patterns-test.fsx</Link></Compile>
+    <Compile Include="..\..\printf\test.fsx"><Link>printf-test.fsx</Link></Compile>
+    <Compile Include="..\..\queriesCustomQueryOps\test.fsx"><Link>queriesCustomQueryOps-test.fsx</Link></Compile>
+    <Compile Include="..\..\queriesLeafExpressionConvert\test.fsx"><Link>queriesLeafExpressionConvert-test.fsx</Link></Compile>
+    <Compile Include="..\..\queriesNullableOperators\test.fsx"><Link>queriesNullableOperators-test.fsx</Link></Compile>
+    <Compile Include="..\..\queriesOverIEnumerable\test.fsx"><Link>queriesOverIEnumerable-test.fsx</Link></Compile>
+    <Compile Include="..\..\queriesOverIQueryable\test.fsx"><Link>queriesOverIQueryable-test.fsx</Link></Compile>
+    <Compile Include="..\..\quotes\test.fsx"><Link>quotes-test.fsx</Link></Compile>
+    <Compile Include="..\..\seq\test.fsx"><Link>seq-test.fsx</Link></Compile>
+    <Compile Include="..\..\subtype\test.fsx"><Link>subtype-test.fsx</Link></Compile>
+    <Compile Include="..\..\syntax\test.fsx"><Link>syntax-test.fsx</Link></Compile>
+    <Compile Include="..\..\tlr\test.fsx"><Link>tlr-test.fsx</Link></Compile>
+    <Compile Include="..\..\unicode\test.fsx"><Link>unicode-test.fsx</Link></Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\PortableAutomationHelperLibrary\PortableAutomationHelperLibrary.fsproj">
+      <Name>PortableAutomationHelperLibrary</Name>
+      <Project>{3e51d6e3-f41c-4173-8811-70be750f8104}</Project>
+      <Private>True</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <PropertyGroup>
+    <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
+  </PropertyGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.Portable.FSharp.Targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/core/portable/portablelibrary1/script.fsx b/tests/fsharp/core/portable/portablelibrary1/script.fsx
new file mode 100644
index 0000000..b47e38a
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1/script.fsx
@@ -0,0 +1,6 @@
+// Learn more about F# at http://fsharp.net. See the 'F# Tutorial' project
+// for more guidance on F# programming.
+
+#load "PortableLibrary1.fs"
+open PortableLibrary1
+
diff --git a/tests/fsharp/core/portable/portablelibrary1/test.fsx b/tests/fsharp/core/portable/portablelibrary1/test.fsx
new file mode 100644
index 0000000..3a115eb
--- /dev/null
+++ b/tests/fsharp/core/portable/portablelibrary1/test.fsx
@@ -0,0 +1,1307 @@
+#if Portable
+module Core_Array
+#endif
+
+// #Conformance #Arrays #Stress #Structs #Mutable #ControlFlow #LetBindings 
+#light
+let mutable failures = []
+let report_failure (s) = 
+  stderr.WriteLine " NO"; failures <- s :: failures
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+let check s b1 b2 = test s (b1 = b2)
+
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+  
+(* TEST SUITE FOR Array *)
+
+let test_make_get_set_length () = 
+  let arr = Array.create 3 0 in 
+  test "fewoih" (Array.get arr 0 = 0);
+  test "vvrew0" (Array.get arr 2 = 0);
+  ignore (Array.set arr 0 4);
+  test "vsdiuvs" (Array.get arr 0 = 4);
+  test "vropivrwe" (Array.length arr = 3)
+
+let test_const () = 
+  let arr =  [| 4;3;2 |]  in 
+  test "sdvjk2" (Array.get arr 0 = 4);
+  test "cedkj" (Array.get arr 2 = 2);
+  ignore (Array.set arr 0 4);
+  test "ds9023" (Array.get arr 0 = 4);
+  test "sdio2" (Array.length arr = 3)
+
+let test_const_empty () = 
+  let arr =  [| |]  in 
+  test "sdio2" (Array.length arr = 0)
+
+let test_map () = 
+  let arr = Array.map (fun x -> x + 1) ( [| 4;3;2 |]) in 
+  test "test2927: sdvjk2" (Array.get arr 0 = 5);
+  test "test2927: cedkj" (Array.get arr 2 = 3)
+
+let test_iter () = 
+  Array.iter (fun x -> test "fuo" (x <= 4)) ( [| 4;3;2 |])
+
+let test_iteri () = 
+  let arr =  [| 4;3;2 |] in 
+  Array.iteri (fun i x -> test "fuo" (arr.[i] = x)) arr
+
+let test_mapi () = 
+  let arr = [| 4;3;2 |] in 
+  let arr2 = Array.mapi (fun i x -> test "dwqfuo" (arr.[i] = x); i + x) arr in 
+  test "test2927: sdvjk2" (Array.get arr2 0 = 4);
+  test "test2927: cedkj" (Array.get arr2 2 = 4)
+
+let test_isEmpty () =
+  test "isEmpty a" (Array.isEmpty [||])
+  test "isEmpty b" (Array.isEmpty <| Array.create 0 42)
+  test "isEmpty c" <| not (Array.isEmpty <| [| 1 |])
+  test "isEmpty d" (Array.isEmpty <| Array.empty)
+
+let test_create () =
+  let arr = Array.create 10 10
+  for i in 0 .. 9 do
+      test "test_create" (arr.[i] = 10)
+
+let test_concat () =
+    let make n = [| for i in n .. n + 9 -> i |]
+    let arr = [| for i in 0..+10..50 -> make i|]
+    test "concat a" (Array.concat arr = [|0..59|])
+
+    let arr2 = [| for i in 0..50 -> [||] |]
+    test "concat b" (Array.concat arr2 = [| |])
+
+    let arr3 = [| [||]; [||]; [|1; 2|]; [||] |]
+    test "concat c" (Array.concat arr3 = [|1; 2|])
+
+let test_sub () =
+    test "sub a" (Array.sub [|0..100|] 10 20 = [|10..29|])
+    test "sub b" (Array.sub [|0..100|] 0 101 = [|0..100|])
+    test "sub c" (Array.sub [|0..100|] 0 1 = [|0|])
+    test "sub d" (Array.sub [|0..100|] 0 0 = [||])
+
+let test_fold2 () =
+    test "fold2 a"
+        (Array.fold2 (fun i j k -> i+j+k) 100 [|1;2;3|] [|1;2;3|] = 112)
+
+    test "fold2_b"
+        (Array.fold2 (fun i j k -> i-j-k) 100 [|1;2;3|] [|1;2;3|] = 100-12)
+
+let test_foldBack2 () =
+    test "foldBack2 a"
+        (Array.foldBack2 (fun i j k -> i+j+k) [|1;2;3|] [|1;2;3|] 100 = 112)
+
+    test "foldBack2_b"
+        (Array.foldBack2 (fun i j k -> k-i-j) [|1;2;3|] [|1;2;3|] 100 = 100-12)
+
+let test_scan () =
+    test "scan"
+        (Array.scan (+) 0 [|1..5|] = [|0; 1; 3; 6; 10; 15|])
+
+    test "scanBack"
+        (Array.scanBack (+) [|1..5|] 0 = [|15; 14; 12; 9; 5; 0|])
+
+let test_iter2 () =
+    let c = ref -1
+    Array.iter2 (fun x y -> incr c; test "iter2" (!c = x && !c = y)) [|0..100|] [|0..100|]
+    test "iter2" (!c = 100)
+
+let test_iteri2 () =
+    let c = ref 0
+    Array.iteri2 (fun i j k -> c := !c+i+j+k) [|1;2;3|] [|10;20;30|]
+    test "iteri2" (!c = 6+60+3)
+
+let test_map2 () =
+    test "map2"
+        (Array.map2 (+) [|0..100|] [|0..100|] = [|0..+2..200|])
+
+let test_mapi2 () =
+    test "mapi2 a"
+        (Array.mapi2 (fun i j k -> i+j+k) [|1..10|] [|1..10|] = [|2..+3..29|])
+
+    test "mapi2_b"
+        (try Array.mapi2 (fun i j k -> i+j+k) [||] [|1..10|] |> ignore; false
+         with _ -> true)
+
+let test_exists () =
+    test "exists a"
+        ([|1..100|] |> Array.exists ((=) 50))
+
+    test "exists b" <| not
+        ([|1..100|] |> Array.exists ((=) 150))
+
+let test_forall () =
+    test "forall a"
+        ([|1..100|] |> Array.forall (fun x -> x < 150))
+
+    test "forall b" <| not
+        ([|1..100|] |> Array.forall (fun x -> x < 80))
+
+let test_exists2 () =
+    test "exists2 a" <| Array.exists2 (=)
+        [|1; 2; 3; 4; 5; 6|]
+        [|2; 3; 4; 5; 6; 6|]
+
+    test "exists2 b" <| not (Array.exists2 (=)
+        [|1; 2; 3; 4; 5; 6|]
+        [|2; 3; 4; 5; 6; 7|])
+
+let test_forall2 () =
+    test "forall2 a"
+        (Array.forall2 (=) [|1..10|] [|1..10|])
+
+    test "forall2_b" <| not
+        (Array.forall2 (=) [|1;2;3;4;5|] [|1;2;3;0;5|])
+
+let test_filter () =
+    test "filter a"
+        (Array.filter (fun x -> x % 2 = 0) [|0..100|] = [|0..+2..100|])
+
+    test "filter b"
+        (Array.filter (fun x -> false) [|0..100|] = [||])
+
+    test "filter c"
+        (Array.filter (fun x -> true) [|0..100|] = [|0..100|])
+
+
+let test_partition () =
+    let p1, p2 = Array.partition (fun x -> x % 2 = 0) [|0..100|]
+    test "partition"
+        (p1 = [|0..+2..100|] && p2 = [|1..+2..100|])
+
+let test_choose () =
+    test "choose"
+        (Array.choose (fun x -> if x % 2 = 0 then Some (x/2) else None) [|0..100|] = [|0..50|])
+
+let test_find () =
+    test "find a"
+        ([|1..100|] |> Array.find (fun x -> x > 50) = 51)
+
+    test "find b"
+        (try [|1..100|] |> Array.find (fun x -> x > 180) |> ignore; false
+         with _ -> true)
+
+module Array = 
+    let findIndexi f (array : array<_>) = 
+        let len = array.Length 
+        let rec go n = 
+            if n >= len then 
+                failwith "fail"
+            elif f n array.[n] then 
+                n 
+            else 
+                go (n+1)
+        go 0
+
+    let tryFindIndexi f (array : array<_>) = 
+        let len = array.Length 
+        let rec go n = if n >= len then None elif f n array.[n] then Some n else go (n+1)
+        go 0 
+
+let test_findIndex () =
+    test "findIndex a"
+        (Array.findIndex (fun i -> i >= 4) [|0..10|] = 4)
+
+    test "findIndex b"
+        (try Array.findIndex (fun i -> i >= 20) [|0..10|] |> ignore; false
+         with _ -> true)
+   
+    test "findIndexi a"
+        (Array.findIndexi (=) [|1; 2; 3; 3; 2; 1|] = 3)
+
+    test "findIndexi b"
+        (try Array.findIndexi (=) [|1..10|] |> ignore; false
+         with _ -> true)
+
+let test_tryfind () =
+    test "tryFind"
+        ([|1..100|] |> Array.tryFind (fun x -> x > 50) = Some 51)
+
+    test "tryFind b"
+        ([|1..100|] |> Array.tryFind (fun x -> x > 180) = None)
+
+    test "tryfind_index a"
+        (Array.tryFindIndex (fun x -> x = 4) [|0..10|] = Some 4)
+
+    test "tryfind_index b"
+        (Array.tryFindIndex (fun x -> x = 42) [|0..10|] = None)
+
+    test "tryFindIndexi a"
+        (Array.tryFindIndexi (=) [|1;2;3;4;4;3;2;1|] = Some 4)
+
+    test "tryFindIndexi b"
+        (Array.tryFindIndexi (=) [|1..10|] = None)
+
+let test_first () =
+    test "first a"
+        ([|1..100|] |> Array.tryPick (fun x -> if x > 50 then Some (x*x) else None) = Some (51*51))
+
+    test "first b"
+        ([|1..100|] |> Array.tryPick (fun x -> None) = None)
+        
+    test "first c"
+        ([||] |> Array.tryPick (fun _ -> Some 42) = None)
+
+let test_sort () =
+
+    test "sort a" (Array.sort [||] = [||])
+    test "sort b" (Array.sort [|1|] = [|1|])
+    test "sort c" (Array.sort [|1;2|] = [|1;2|])
+    test "sort d" (Array.sort [|2;1|] = [|1;2|])
+    test "sort e" (Array.sort [|1..1000|] = [|1..1000|])
+    test "sort f" (Array.sort [|1000..-1..1|] = [|1..1000|])
+
+let test_sort_by () =
+
+    test "Array.sortBy a" (Array.sortBy int [||] = [||])
+    test "Array.sortBy b" (Array.sortBy int [|1|] = [|1|])
+    test "Array.sortBy c" (Array.sortBy int [|1;2|] = [|1;2|])
+    test "Array.sortBy d" (Array.sortBy int [|2;1|] = [|1;2|])
+    test "Array.sortBy e" (Array.sortBy int [|1..1000|] = [|1..1000|])
+    test "Array.sortBy f" (Array.sortBy int [|1000..-1..1|] = [|1..1000|])
+
+    let testGen s f = 
+        test ("Array.sortBy a "+s) (Array.sortBy f [||] = [||])
+        test ("Array.sortBy b "+s) (Array.sortBy f [|1|] = [|1|])
+        test ("Array.sortBy c "+s) (Array.sortBy f [|1;2|] = [|1;2|])
+        test ("Array.sortBy d "+s) (Array.sortBy f [|2;1|] = [|1;2|])
+        test ("Array.sortBy e "+s) (Array.sortBy f [|1..1000|] = [|1..1000|])
+        test ("Array.sortBy f "+s) (Array.sortBy f [|1000..-1..1|] = [|1..1000|])
+
+    // All these projects from integers preserve the expected key ordering for the tests in 'testGen()'
+    testGen "int" int
+    testGen "uint32" uint32
+    testGen "int16" int16
+    testGen "uint16" uint16
+    testGen "int64" int64
+    testGen "uint64" uint64
+    testGen "nativeint" nativeint
+    testGen "unativeint" unativeint
+    testGen "float" float
+    testGen "float32" float32
+    testGen "decimal" decimal
+
+    test "Array.sortBy g" (Array.sortBy int [|"4";"2";"3";"1";"5"|] = [|"1";"2";"3";"4";"5"|])
+    test "Array.sortBy h" (Array.sortBy abs [|1;-2;5;-4;0;-6;3|] = [|0;1;-2;3;-4;5;-6|])
+    test "Array.sortBy i" (Array.sortBy String.length [|"a";"abcd";"ab";"";"abc"|] = [|"";"a";"ab";"abc";"abcd"|])
+
+
+let test_list_stableSortBy() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sortBy snd [ for i in lo .. hi -> (i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield (i, i % 17) ])
+
+test_list_stableSortBy()         
+
+
+[<CustomEquality;CustomComparison>]
+type Key = 
+    | Key of int * int
+    interface System.IComparable with 
+        member x.CompareTo(yobj:obj) =
+            match yobj with 
+            | :? Key as y -> 
+                let (Key(y1,y2)) = y in
+                let (Key(x1,x2)) = x in
+                compare x2 y2
+            | _ -> failwith "failure"
+
+    override x.Equals(yobj) = 
+        match yobj with 
+        | :? Key as y -> 
+            let (Key(y1,y2)) = y in
+            let (Key(x1,x2)) = x in
+            x2 = y2
+        | _ -> false
+
+    override x.GetHashCode() = 
+        let (Key(x1,x2)) = x in
+        hash x2 
+
+let test_list_stableSort() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sort [ for i in lo .. hi -> Key(i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield Key(i, i % 17) ])
+
+test_list_stableSort()         
+
+let test_list_stableSortByNonIntegerKey() = 
+    for lo in 0 .. 100 do 
+      for hi in lo .. 100 do
+         test (sprintf "vre9u0rejkn, lo = %d, hi = %d" lo hi) (List.sortBy (fun (Key(a,b)) -> Key(0,b)) [ for i in lo .. hi -> Key(i, i % 17) ] = [ for key in 0 .. 16 do for i in lo .. hi do if i % 17 = key then yield Key(i, i % 17) ])
+
+test_list_stableSortByNonIntegerKey()         
+
+
+let test_zip () =
+    test "zip"
+        (Array.zip [|1..10|] [|1..10|] = [|for i in 1..10 -> i, i|])
+
+    let unzip1, unzip2 = Array.unzip <| [|for i in 1..10 -> i, i+1|]
+    test "unzip" (unzip1 = [|1..10|] && unzip2 = [|2..11|])
+
+let test_zip3 () =
+    test "zip3"
+        (Array.zip3 [|1..10|] [|1..10|] [|1..10|] = [|for i in 1..10 -> i, i, i|])
+
+    let unzip1, unzip2, unzip3 = Array.unzip3 <| [|for i in 1..10 -> i, i+1, i+2|]
+    test "unzip3" (unzip1 = [|1..10|] && unzip2 = [|2..11|] && unzip3 = [|3..12|])
+
+
+let test_rev () =
+    test "rev a"
+        (Array.rev [|0..100|] = [|100..-1 ..0|])
+
+    test "rev b"
+        (Array.rev [|1|] = [|1|])
+
+    test "rev c"
+        (Array.rev [||] = [||])
+
+    test "rev d"
+        (Array.rev [|1; 2|] = [|2; 1|])
+
+let test_sum () =
+    test "sum a" (Array.sum [||] = 0)
+    test "sum b" (Array.sum [|42|] = 42)
+    test "sum c" (Array.sum [|42;-21|] = 21)
+    test "sum d" (Array.sum [|1..1000|] = (1000*1001) / 2)
+    test "sum e" (Array.sum [|1.;2.;3.|] = 6.)
+    test "sum f" (Array.sum [|1.;2.;infinity;3.|] = infinity)
+
+let test_sum_by () =
+    test "sum_by a" (Array.sumBy int [||] = 0)
+    test "sum_by b" (Array.sumBy int [|42|] = 42)
+    test "sum_by c" (Array.sumBy int [|42;-21|] = 21)
+    test "sum_by d" (Array.sumBy int [|1..1000|] = (1000*1001) / 2)
+    test "sum_by e" (Array.sumBy float [|1.;2.;3.|] = 6.)
+    test "sum_by f" (Array.sumBy float [|1.;2.;infinity;3.|] = infinity)
+    test "sum_by g" (Array.sumBy abs [|1; -2; 3; -4|] = 10)
+    test "sum_by h" (Array.sumBy String.length [|"abcd";"efg";"hi";"j";""|] = 10)
+
+let test_average () =
+    test "average a1" (try Array.average ([||]: float array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a2" (try Array.average ([||]: float32 array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a3" (try Array.average ([||]: decimal array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average a4" (Array.average [|0.|] = 0.)
+    test "average b" (Array.average [|4.|] = 4.)
+    test "average c" (Array.average [|4.;6.|] = 5.)
+
+    test "average_by a1" (try Array.averageBy id ([||]: float array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a2" (try Array.averageBy id ([||]: float32 array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a3" (try Array.averageBy id ([||]: decimal array) |> ignore; false with :? System.ArgumentException -> true)
+    test "average_by a4" (Array.averageBy float [|0..1000|] = 500.)
+    test "average_by b" (Array.averageBy (String.length >> float) [|"ab";"cdef"|] = 3.)
+
+let test_min () =
+    test "min a" (Array.min [|42|] = 42)
+    test "min b" (Array.min [|42;21|] = 21)
+    test "min c" (Array.min [|'a';'b'|] = 'a')
+
+    test "max a" (Array.max [|42|] = 42)
+    test "max b" (Array.max [|42;21|] = 42)
+    test "max c" (Array.max [|'a';'b'|] = 'b')
+
+let test_min_by () =
+    test "min_by a" (Array.minBy int [|42|] = 42)
+    test "min_by b" (Array.minBy abs [|-42;-21|] = -21)
+    test "min_by c" (Array.minBy int [|'a';'b'|] = 'a')
+
+    test "max_by a" (Array.maxBy int [|42|] = 42)
+    test "max_by b" (Array.maxBy abs [|-42;-21|] = -42)
+    test "max_by c" (Array.maxBy int [|'a';'b'|] = 'b')
+
+let test_seq () =
+    test "to_seq" (Array.ofSeq [1..100] = [|1..100|])
+    test "to_seq" ([|1..100|] |> Array.toSeq |> Array.ofSeq = [|1..100|])
+
+
+let test_zero_create () = 
+  let arr = Array.zeroCreate 3 in 
+  ignore (Array.set arr 0 4);
+  ignore (Array.set arr 1 3);
+  ignore (Array.set arr 2 2);
+  test "fewoih" (Array.get arr 0 = 4);
+  test "vvrew0" (Array.get arr 1 = 3);
+  test "vvrew0" (Array.get arr 2 = 2)
+
+let test_zero_create_2 () = 
+  let arr = Array.zeroCreate 0 in 
+  test "sdio2" (Array.length arr = 0)
+
+let test_init () = 
+  let arr = Array.init 4 (fun x -> x + 1) in 
+  test "test2927: sdvjk2" (Array.get arr 0 = 1);
+  test "test2927: cedkj" (Array.get arr 2 = 3)
+
+let test_init_empty () = 
+  let arr = Array.init 0 (fun x -> x + 1) in 
+  test "test2927: sdvjk2" (Array.length arr = 0)
+
+let test_append () = 
+  let arr = Array.append ( [| "4";"3" |]) ( [| "2" |]) in
+  test "test2928: sdvjk2" (Array.get arr 0 = "4");
+  test "test2928: cedkj" (Array.get arr 2 = "2");
+  test "test2928: cedkj" (Array.length arr = 3)
+
+let test_append_empty () = 
+  let arr = Array.append ( [| |]) ( [| |]) in
+  test "test2928: cedkj" (Array.length arr = 0)
+
+let test_fill () = 
+  let arr =  [| "4";"3";"2" |] in
+  Array.fill arr 1 2 "1";
+  test "test2929: sdvjk2" (Array.get arr 0 = "4");
+  test "test2929: cedkj" (Array.get arr 2 = "1")
+
+let test_copy () = 
+  let arr =  [| "4";"3";"2" |] in
+  let arr2 =  Array.copy arr  in
+  test "test2929: sdvjk2" (Array.get arr2 0 = "4");
+  test "test2929: cedkj" (Array.get arr2 2 = "2");
+  test "feio" (not (LanguagePrimitives.PhysicalEquality arr arr2))
+
+let test_blit () = 
+  let arr =  [| "4";"3";"2";"0" |] in
+  let arr2 =  [| "4";"3";"-1"; "-1" |] in
+  Array.blit arr 1 arr2 2 2;
+  test "test2930: sdvjk2" (Array.get arr2 0 = "4");
+  test "test2930: cedkj" (Array.get arr2 1 = "3");
+  test "test2930: ceddwkj" (Array.get arr2 2 = "3");
+  test "test2930: ceqwddkj" (Array.get arr2 3 = "2")
+
+let test_of_list () = 
+  let arr = Array.ofList [ "4";"3";"2";"0" ] in
+  test "test2931: sdvjk2" (Array.get arr 0 = "4");
+  test "test2931: cedkj" (Array.get arr 1 = "3");
+  test "test2931: ceddwkj" (Array.get arr 2 = "2");
+  test "test2931: ceqwddkj" (Array.get arr 3 = "0")
+
+let test_to_list () = 
+  test "test2932" (Array.toList ( [| "4";"3";"2";"0" |]) =  [ "4";"3";"2";"0" ])
+
+let test_to_list_of_list () = 
+  test "test2933" (Array.toList (Array.ofList [ "4";"3";"2";"0" ]) = [ "4";"3";"2";"0" ])
+
+let test_fold_left () = 
+  let arr = Array.ofList [ 4;3;2;1 ] in
+  test "test2931: sdvjk2few" (Array.fold (fun x y -> x/y) (5*4*3*2*1) arr = 5)
+
+let test_fold_right () = 
+  let arr = Array.ofList [ 4;3;2;1 ] in
+  test "test2931: sdvjk2ew" (Array.foldBack (fun y x -> x/y) arr (6*4*3*2*1) = 6)
+
+let test_reduce_left () = 
+  test "test2931: array.reduce" (Array.reduce (fun x y -> x/y) [|5*4*3*2; 4;3;2;1|] = 5)
+
+let test_reduce_right () = 
+  let arr = Array.ofList [ 4;3;2;1;5 ] in
+  test "test2931: array.reduceBack" (Array.reduceBack (fun y x -> x/y) [|4;3;2;1; 5*4*3*2|] = 5)
+
+
+let _ = test_make_get_set_length ()
+let _ = test_const ()
+let _ = test_const_empty ()
+let _ = test_map ()
+let _ = test_mapi ()
+let _ = test_iter ()
+let _ = test_iteri ()
+let _ = test_mapi ()
+let _ = test_isEmpty ()
+let _ = test_create ()
+let _ = test_concat ()
+let _ = test_sub ()
+let _ = test_fold2 ()
+let _ = test_foldBack2 ()
+let _ = test_scan ()
+let _ = test_iter2 ()
+let _ = test_iteri2 ()
+let _ = test_iter ()
+let _ = test_map2 ()
+let _ = test_mapi2 ()
+let _ = test_exists ()
+let _ = test_forall ()
+let _ = test_iter ()
+let _ = test_exists2 ()
+let _ = test_forall2 ()
+let _ = test_filter ()
+let _ = test_partition ()
+let _ = test_choose ()
+let _ = test_find ()
+let _ = test_findIndex ()
+let _ = test_tryfind ()
+let _ = test_first ()
+let _ = test_sort ()
+let _ = test_sort_by ()
+let _ = test_zip ()
+let _ = test_zip3 ()
+let _ = test_rev ()
+let _ = test_sum ()
+let _ = test_sum_by ()
+let _ = test_average ()
+let _ = test_min ()
+let _ = test_min_by ()
+let _ = test_seq ()
+let _ = test_zero_create ()
+let _ = test_zero_create_2 ()
+let _ = test_append ()
+let _ = test_append_empty ()
+let _ = test_init ()
+let _ = test_init_empty ()
+let _ = test_fill ()
+let _ = test_blit ()
+let _ = test_of_list ()
+let _ = test_to_list ()
+let _ = test_to_list_of_list ()
+let _ = test_copy ()
+let _ = test_iter ()
+let _ = test_iteri ()
+let _ = test_fold_left ()
+let _ = test_fold_right ()
+let _ = test_reduce_left ()
+let _ = test_reduce_right ()
+
+module Array2Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array2D.create 3 4 0 in 
+    test "fewoih1" (Array2D.get arr 0 0 = 0);
+    test "fewoih2" (Array2D.get arr 0 1 = 0);
+    test "vvrew03" (Array2D.get arr 2 2 = 0);
+    test "vvrew04" (Array2D.get arr 2 3 = 0);
+    ignore (Array2D.set arr 0 2 4);
+    test "vsdiuvs5" (Array2D.get arr 0 2 = 4);
+    arr.[0,2] <- 2;
+    test "vsdiuvs6" (arr.[0,2] = 2);
+    test "vropivrwe7" (Array2D.length1 arr = 3);
+    test "vropivrwe8" (Array2D.length2 arr = 4)
+
+    let a = Array2D.init 10 10 (fun i j -> i,j)
+    let b = Array2D.init 2 2 (fun i j -> i+1,j+1)
+    //test "a2_sub"
+    //    (Array2D.sub a 1 1 2 2 = b)
+
+    Array2D.blit b 0 0 a 0 0 2 2
+    //test "a2_blit"
+    //      (Array2D.sub a 0 0 2 2 = b)
+
+  let _ = test_make_get_set_length ()
+
+end
+
+module Array3Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array3D.create 3 4 5 0 in 
+    test "fewoih1" (Array3D.get arr 0 0 0 = 0);
+    test "fewoih2" (Array3D.get arr 0 1 0 = 0);
+    test "vvrew03" (Array3D.get arr 2 2 2 = 0);
+    test "vvrew04" (Array3D.get arr 2 3 4 = 0);
+    ignore (Array3D.set arr 0 2 3 4);
+    test "vsdiuvs5" (Array3D.get arr 0 2 3 = 4);
+    arr.[0,2,3] <- 2;
+    test "vsdiuvs6" (arr.[0,2,3] = 2);
+    arr.[0,2,3] <- 3;
+    test "vsdiuvs" (arr.[0,2,3] = 3);
+    test "vropivrwe7" (Array3D.length1 arr = 3);
+    test "vropivrwe8" (Array3D.length2 arr = 4);
+    test "vropivrwe9" (Array3D.length3 arr = 5)
+
+  let _ = test_make_get_set_length ()
+
+end
+
+module Array4Tests = begin
+
+  let test_make_get_set_length () = 
+    let arr = Array4D.create 3 4 5 6 0 in 
+    arr.[0,2,3,4] <- 2;
+    test "vsdiuvsq" (arr.[0,2,3,4] = 2);
+    arr.[0,2,3,4] <- 3;
+    test "vsdiuvsw" (arr.[0,2,3,4] = 3);
+    test "vsdiuvsw" (Array4D.get arr 0 2 3 4 = 3);
+    Array4D.set arr 0 2 3 4 5;
+    test "vsdiuvsw" (Array4D.get arr 0 2 3 4 = 5);
+    test "vropivrwee" (Array4D.length1 arr = 3);
+    test "vropivrwer" (Array4D.length2 arr = 4);
+    test "vropivrwet" (Array4D.length3 arr = 5)
+    test "vropivrwey" (Array4D.length4 arr = 6)
+
+  let test_init () = 
+    let arr = Array4D.init 3 4 5 6 (fun i j k m -> i+j+k+m) in 
+    test "vsdiuvs1" (arr.[0,2,3,4] = 9);
+    test "vsdiuvs2" (arr.[0,2,3,3] = 8);
+    test "vsdiuvs3" (arr.[0,0,0,0] = 0);
+    arr.[0,2,3,4] <- 2;
+    test "vsdiuvs4" (arr.[0,2,3,4] = 2);
+    arr.[0,2,3,4] <- 3;
+    test "vsdiuvs5" (arr.[0,2,3,4] = 3);
+    test "vropivrwe1" (Array4D.length1 arr = 3);
+    test "vropivrwe2" (Array4D.length2 arr = 4);
+    test "vropivrwe3" (Array4D.length3 arr = 5)
+    test "vropivrwe4" (Array4D.length4 arr = 6)
+
+  let _ = test_make_get_set_length ()
+  let _ = test_init ()
+
+end
+
+// nb. PERF TESTING ONLY WITH v2.0 (GENERICS)
+#if PERF
+let test_map_perf () = 
+  let arr1 = [| 4;3;2 |] in 
+  let res = ref (Array.map (fun x -> x + 1) arr1) in
+  for i = 1 to 20000000 do 
+    res := Array.map (fun x -> x + 1) arr1
+  done;
+  test "test2927: sdvjk2" (Array.get !res 0 = 5)
+
+let _ = test_map_perf()
+#endif
+
+module SeqCacheAllTest = 
+    let s2 = 
+       let count = ref 0 
+       let s = Seq.cache (seq { for i in 0 .. 10 -> (incr count; i) }) :> seq<_>
+       let test0 = (!count = 0)
+       let e1 = s.GetEnumerator()
+       let test1 = (!count = 0)
+       printf "test1 = %b\n" test1;
+       for i = 1 to 1 do (e1.MoveNext() |> ignore; e1.Current |> ignore)
+       let test2 = (!count = 1)
+       printf "test2 = %b\n" test2;
+       let e2 = s.GetEnumerator()
+       for i = 1 to 5 do (e2.MoveNext() |> ignore; e2.Current |> ignore)
+       let test3 = (!count = 5)
+       printf "test3 = %b\n" test3;
+       let e3 = s.GetEnumerator()
+       for i = 1 to 5 do (e3.MoveNext() |> ignore; e3.Current |> ignore)
+       let test4 = (!count = 5)
+       printf "test4 = %b\n" test4;
+       let e4 = s.GetEnumerator()
+       for i = 1 to 3 do (e4.MoveNext() |> ignore; e4.Current |> ignore)
+       let test5 = (!count = 5)
+       printf "test5 = %b\n" test5;
+
+       let test6 = [ for x in s -> x ] = [ 0 .. 10 ]
+       printf "test6 = %b\n" test6;
+       for x in s do ()
+       let test7 = (!count = 11)
+       let test8 = [ for x in s -> x ] = [ 0 .. 10 ]
+       let test9 = !count = 11
+       test "test0" test0
+       test "test1" test1
+       test "test2" test2
+       test "test3" test3
+       test "test4" test4
+       test "test5" test5
+       test "test6" test6
+       test "test7" test7
+       test "test8" test8
+       test "test9" test9
+
+module StringSlicingTest = 
+    let s1 = "abcdef"
+    test "slice1923" (s1.[*] = s1)
+    test "slice1923" (s1.[0..] = s1)
+    test "slice1924" (s1.[1..] = "bcdef")
+    test "slice1925" (s1.[2..] = "cdef")
+    test "slice1926" (s1.[5..] = "f")
+    test "slice1927" (s1.[6..] = "")
+    test "slice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "slice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "slice1917" (s1.[..0] = "a")
+    test "slice1911" (s1.[..1] = "ab")
+    test "slice1912" (s1.[..2] = "abc")
+    test "slice1913" (s1.[..3] = "abcd")
+    test "slice1914" (s1.[..4] = "abcde")
+    test "slice1915" (s1.[..5] = "abcdef")
+    test "slice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "slice1817" (s1.[1..0] = "")
+    test "slice1811" (s1.[1..1] = "b")
+    test "slice1812" (s1.[1..2] = "bc")
+    test "slice1813" (s1.[1..3] = "bcd")
+    test "slice1814" (s1.[1..4] = "bcde")
+    test "slice1815" (s1.[1 ..5] = "bcdef")
+    test "slice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+module ArraySlicingTestBytes = 
+
+    let s1 = "abcdef"B
+    test "aslice1923" (s1.[0..] = s1)
+    test "aslice1924" (s1.[1..] = "bcdef"B)
+    test "aslice1925" (s1.[2..] = "cdef"B)
+    test "aslice1926" (s1.[5..] = "f"B)
+    test "aslice1927" (s1.[6..] = ""B)
+    test "aslice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "aslice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "aslice1917" (s1.[..0] = "a"B)
+    test "aslice1911" (s1.[..1] = "ab"B)
+    test "aslice1912" (s1.[..2] = "abc"B)
+    test "aslice1913" (s1.[..3] = "abcd"B)
+    test "aslice1914" (s1.[..4] = "abcde"B)
+    test "aslice1915" (s1.[..5] = "abcdef"B)
+    test "aslice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "aslice1817" (s1.[1..0] = ""B)
+    test "aslice1811" (s1.[1..1] = "b"B)
+    test "aslice1812" (s1.[1..2] = "bc"B)
+    test "aslice1813" (s1.[1..3] = "bcd"B)
+    test "aslice1814" (s1.[1..4] = "bcde"B)
+    test "aslice1815" (s1.[1 ..5] = "bcdef"B)
+    test "aslice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+module ArraySlicingTestInts = 
+
+    let s1 = [| 1;2;3;4;5;6 |]
+    test "aslice1923" (s1.[0..] = s1)
+    test "aslice1924" (s1.[1..] = [| 2;3;4;5;6 |])
+    test "aslice1925" (s1.[2..] = [| 3;4;5;6 |])
+    test "aslice1926" (s1.[5..] = [| 6 |])
+    test "aslice1927" (s1.[6..] = [| |])
+    test "aslice1928" (try s1.[7..] |> ignore; false with _ -> true)
+    test "aslice1929" (try s1.[-1 ..] |> ignore; false with _ -> true)
+    test "aslice1917" (s1.[..0] = [| 1 |])
+    test "aslice1911" (s1.[..1] = [| 1;2|])
+    test "aslice1912" (s1.[..2] = [| 1;2;3 |])
+    test "aslice1913" (s1.[..3] = [| 1;2;3;4|])
+    test "aslice1914" (s1.[..4] = [| 1;2;3;4;5 |])
+    test "aslice1915" (s1.[..5] = [| 1;2;3;4;5;6 |])
+    test "aslice1918" (try s1.[..6] |> ignore; false with _ -> true)
+    test "aslice1817" (s1.[1..0] = [|  |])
+    test "aslice1811" (s1.[1..1] = [| 2 |])
+    test "aslice1812" (s1.[1..2] = [| 2;3 |])
+    test "aslice1813" (s1.[1..3] = [| 2;3;4|])
+    test "aslice1814" (s1.[1..4] = [| 2;3;4;5|])
+    test "aslice1815" (s1.[1 ..5] = [| 2;3;4;5;6|])
+    test "aslice1818" (try s1.[1..6] |> ignore; false with _ -> true)
+
+
+module Array2DSlicingTests = 
+
+    let array2d (arrs: 'a array array) = Array2D.init arrs.Length arrs.[0].Length  (fun i j -> arrs.[i].[j])
+    
+    let m1 = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                        [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |]
+    test "a2slice1923" (m1.[*,*] = m1)
+    test "a2slice1924" (m1.[0..,*] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |])
+    test "a2slice1925" (m1.[1..,*] = array2d [| //[| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  |])
+    test "a2slice1926" (m1.[..0,*] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                              //[| 10.0;20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1927" (m1.[*,0..] = array2d [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 10.0;20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1928" (m1.[*,1..] = array2d [| [| 2.0;3.0;4.0;5.0;6.0 |];
+                                                [| 20.0;30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice1929" (m1.[*,2..] = array2d [| [| 3.0;4.0;5.0;6.0 |];
+                                                [| 30.0;40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice192a" (m1.[*,3..] = array2d [| [| 4.0;5.0;6.0 |];
+                                                [| 40.0;50.0;60.0 |]  
+                                            |])
+    test "a2slice192b" (m1.[*,4..] = array2d [| [| 5.0;6.0 |];
+                                                [| 50.0;60.0 |]  
+                                            |])
+    test "a2slice192c" (m1.[*,5..] = array2d [| [| 6.0 |];
+                                                [| 60.0 |]  
+                                            |])
+
+module Array3DSlicingTests = 
+
+    let array3d (arrs: 'a array array array ) = Array3D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length  (fun i j k -> arrs.[i].[j].[k])
+    
+    let m1 = array3d [| 
+                        [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                           [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                        [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                           [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+    test "a3slice1923" (m1.[*,*,*] = m1)
+    test "a3slice1924" (m1.[0..,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |])
+    test "a3slice1925" (m1.[0..0,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |] |])
+    test "a3slice1926" (m1.[1..1,*,*] = 
+                          array3d [| 
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+
+    test "a3slice1927" (m1.[*,1..1,*] = 
+                          array3d [| 
+                                    [| [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1928" (m1.[..1,*,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1929" (m1.[*,0..0,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];  |] |] )
+    test "a3slice1930" (m1.[*,0..1,*] = 
+                          array3d [| 
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+    test "a3slice1931" (m1.[*,*,0..0] = 
+                          array3d [| 
+                                    [| [| 1.0|];
+                                       [| 11.0|]  |]
+                                    [| [| 10.0|];
+                                       [| 100.0 |]  |] |] )
+    test "a3slice1932" (m1.[*,*,0..5] = 
+                          array3d [|   
+                                    [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                       [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                    [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                       [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |] )
+
+
+module Array4DSlicingTests = 
+
+    let array4d (arrs: 'a array array array array) = Array4D.init arrs.Length arrs.[0].Length arrs.[0].[0].Length  arrs.[0].[0].[0].Length  (fun i j k m -> arrs.[i].[j].[k].[m])
+    
+    let m1 = array4d 
+               [|
+                 [| 
+                        [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                           [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                        [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                           [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+                 [| 
+                        [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                           [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                        [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                           [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] |]
+                |]
+    test "a4slice1923" (m1.[*,*,*,*] = m1)
+    test "a4slice1924" (m1.[0..,*,*,*] =  m1)
+    test "a4slice1925" (m1.[0..0,*,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |] |]
+                              |])
+    test "a4slice1926" (m1.[1..1,*,*,*] = 
+                          array4d 
+                             [|
+                                [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] |]
+                              |])
+
+    test "a4slice1927" (m1.[*,0..0,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0;61.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0;619.0 |]  |]
+                               |]
+                              |])
+    test "a4slice1928" (m1.[..1,*,*,*] =  m1)
+    test "a4slice1929" (m1.[*,1..,*,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0;600.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0;6009.0 |]  |] 
+                               |]
+                              |])
+    test "a4slice1930" (m1.[*,0..1,*,*] =  m1)
+    test "a4slice1931" (m1.[*,*,0..0,*] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0;6.0 |];  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0;60.0 |];  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0;69.0 |];  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0;609.0 |];  |] |]
+                              |])
+    test "a4slice1932" (m1.[*,*,*,0..5] = m1)
+
+    test "a4slice1931" (m1.[*,*,*,0..4] = 
+                          array4d 
+                             [|
+                               [| 
+                                      [| [| 1.0;2.0;3.0;4.0;5.0 |];
+                                         [| 11.0;21.0;31.0;41.0;51.0 |]  |]
+                                      [| [| 10.0;20.0;30.0;40.0;50.0 |];
+                                         [| 100.0;200.0;300.0;400.0;500.0 |]  |]
+                               |];
+                               [| 
+                                      [| [| 19.0;29.0;39.0;49.0;59.0 |];
+                                         [| 119.0;219.0;319.0;419.0;519.0 |]  |]
+                                      [| [| 109.0;209.0;309.0;409.0;509.0 |];
+                                         [| 1009.0;2009.0;3009.0;4009.0;5009.0 |]  |] 
+                               |]
+                              |])
+
+module ArrayStructMutation = 
+    module Array1D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array.create 10 Unchecked.defaultof<T>
+            a.[0].i <- 27
+            check "wekvw0301" 27 a.[0].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array.create 10 Unchecked.defaultof<T>
+            a.[0].Set 27
+            a.[2].Set 27
+            check "wekvw0302" 27 a.[0].i
+            check "wekvw0303" 27 a.[2].i
+            
+    module Array2D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array2D.create 10 10 Unchecked.defaultof<T>
+            a.[0,0].i <- 27
+            check "wekvw0304" 27 a.[0,0].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array2D.create 10 10 Unchecked.defaultof<T>
+            a.[0,0].Set 27
+            a.[0,2].Set 27
+            check "wekvw0305" 27 a.[0,0].i
+            check "wekvw0306" 27 a.[0,2].i
+            
+
+    module Array3D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array3D.create 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0].i <- 27
+            a.[0,2,3].i <- 27
+            check "wekvw0307" 27 a.[0,0,0].i
+            check "wekvw0308" 27 a.[0,2,3].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array3D.create 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0].Set 27
+            a.[0,2,3].Set 27
+            check "wekvw0309" 27 a.[0,0,0].i
+            check "wekvw030q" 27 a.[0,2,3].i
+            
+    module Array4D = 
+        module Test1 = 
+            [<Struct>]
+            type T =
+               val mutable i : int
+            let a = Array4D.create 10 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0,0].i <- 27
+            a.[0,2,3,4].i <- 27
+            check "wekvw030w" 27 a.[0,0,0,0].i
+            check "wekvw030e" 27 a.[0,2,3,4].i
+
+
+        module Test2 = 
+
+            [<Struct>]
+            type T =
+               val mutable public i  : int
+               member public this.Set i = this.i <- i
+            let a  = Array4D.create 10 10 10 10 Unchecked.defaultof<T>
+            a.[0,0,0,0].Set 27
+            a.[0,2,3,4].Set 27
+            check "wekvw030r" 27 a.[0,0,0,0].i 
+            check "wekvw030t" 27 a.[0,2,3,4].i
+
+module LoopTests = 
+    let loop3 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  N do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev90-%A" (a,N)) x  (if N < a then 0 else N - a + 1) 
+
+
+    do loop3 0 10
+    do loop3 0 0
+    do loop3 0 -1
+    do loop3 10  9
+
+    let loop4 a N = 
+       let mutable x = 0 in
+       for i in OperatorIntrinsics.RangeInt32 a 1 N do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev91-%A" (a,N)) x (if N < a then 0 else N - a + 1) 
+
+    do loop4 0 10
+    do loop4 0 0
+    do loop4 0 -1
+    do loop4 10  9
+
+    let loop5 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  2 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev92-%A" (a,N))  x ((if N < a then 0 else N - a + 2) / 2)
+
+    do loop5 0 10
+    do loop5 0 0
+    do loop5 0 -1
+    do loop5 10  9
+
+
+    let loop6 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  200 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev93-%A" (a,N)) x ((if N < a then 0 else N - a + 200) / 200)
+
+    do loop6 0 10
+    do loop6 0 0
+    do loop6 0 -1
+    do loop6 10  9
+
+
+    let loop7 a step N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  step .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev95-%A" (a,step,N)) x (if step < 0 then (if a < N then 0 else (a - N + abs step) / abs step) else (if N < a then 0 else N - a + step) / step)
+
+    do loop7 0 1 10
+    do loop7 0 -1 0
+    do loop7 0 2 -1
+    do loop7 10  -2 9
+
+    let loop8 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  -1 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "clkrerev96-%A" (a,N))  x (abs (if a < N then 0 else (a - N + 1) / 1))
+
+    do loop8 0 10
+    do loop8 0 0
+    do loop8 0 -1
+    do loop8 10 9
+
+// Some more adhoc testing - the use of 'min' gives rise to a let binding in optimized code
+module MoreLoopTestsWithLetBindings = 
+    let loop3 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev90-%A" (a,N)) x  (if N < a then 0 else N - a + 1) 
+
+
+    do loop3 0 10
+    do loop3 0 0
+    do loop3 0 -1
+    do loop3 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop3 start finish
+
+    let loop4 a N = 
+       let mutable x = 0 in
+       for i in OperatorIntrinsics.RangeInt32 a 1 N do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev91-%A" (a,N)) x (if N < a then 0 else N - a + 1) 
+
+    do loop4 0 10
+    do loop4 0 0
+    do loop4 0 -1
+    do loop4 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop4 start finish
+
+    let loop5 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  2 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev92-%A" (a,N))  x ((if N < a then 0 else N - a + 2) / 2)
+
+    do loop5 0 10
+    do loop5 0 0
+    do loop5 0 -1
+    do loop5 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop5 start finish
+
+
+    let loop6 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  200 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev93-%A" (a,N)) x ((if N < a then 0 else N - a + 200) / 200)
+
+    do loop6 0 10
+    do loop6 0 0
+    do loop6 0 -1
+    do loop6 10  9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop6 start finish
+
+
+    let loop7 a step N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  step .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev95-%A" (a,step,N)) x (if step < 0 then (if a < N then 0 else (a - N + abs step) / abs step) else (if N < a then 0 else N - a + step) / step)
+
+    do loop7 0 1 10
+    do loop7 0 -1 0
+    do loop7 0 2 -1
+    do loop7 10  -2 9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do for step in [-2; -1; 1; 2] do loop7 start step finish
+
+    let loop8 a N = 
+       let mutable x = 0 in
+       // In this loop, the types of 'a' and 'N' are not known prior to the loop
+       for i in (min a a) ..  -1 .. (min N N) do
+          x <- x + 1
+       done;
+       check (sprintf "ffclkrerev96-%A" (a,N))  x (abs (if a < N then 0 else (a - N + 1) / 1))
+
+    do loop8 0 10
+    do loop8 0 0
+    do loop8 0 -1
+    do loop8 10 9
+    do for start in -3 .. 3 do for finish in -3 .. 3 do loop8 start finish
+
+module bug872632 =
+    type MarkerStyle = 
+        | None      = 0
+        | Square    = 1
+        | Circle    = 2
+        | Diamond    = 3
+        | Triangle    = 4
+        | Triangle1   = 10
+        | Cross    = 5
+        | Star4    = 6
+        | Star5    = 7
+        | Star6    = 8
+        | Star10    = 9
+
+     
+
+    module Foo =    
+        let x = [| 
+                    MarkerStyle.Circle
+                    MarkerStyle.Cross
+                    MarkerStyle.Star6
+                    MarkerStyle.Diamond
+                    MarkerStyle.Square        
+                    MarkerStyle.Star10
+                    MarkerStyle.Triangle
+                    MarkerStyle.Triangle1
+                |] 
+
+    do check "bug872632" Foo.x.Length 8
+    
+module bug6447 =
+
+#if Portable
+#else
+    let a = System.Array.CreateInstance(typeof<int>, [|1|], [|1|])
+    let a1 = System.Array.CreateInstance(typeof<int>, [|1|], [|3|])
+    let a2 = System.Array.CreateInstance(typeof<int>, [|3|], [|1|])
+    do check "bug6447_bound1" a a
+    do check "bug6447_bound3" a1 a1   
+    do check "bug6447_bound1_3" a2 a2
+    do check "bug6447_a_lt_a" (Unchecked.compare a a) 0
+    do check "bug6447_a_eq_a1" (Unchecked.equals a a1) false
+    do check "bug6447_a_lt_a1" (Unchecked.compare a a1) -1
+    do check "bug6447_a_lt_a1" (Unchecked.compare a1 a) 1
+    do check "bug6447_a_eq_a2" (Unchecked.equals a a2) false
+    do check "bug6447_a_lt_a2" (Unchecked.compare a a2) -1
+    do check "bug6447_a_lt_a2" (Unchecked.compare a2 a) 1
+    do check "bug6447_a1_eq_a2" (Unchecked.equals a1 a2) false
+    do check "bug6447_a1_gt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a1_lt_a2" (Unchecked.compare a1 a2) -1
+    do check "bug6447_a1_lt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a2_eq_a1" (Unchecked.equals a2 a1) false
+    do check "bug6447_a2_gt_a2" (Unchecked.compare a2 a1) 1
+    do check "bug6447_a2_lt_a1" (Unchecked.compare a1 a2) -1
+    do check "bug6447_hash_a" (hash a) 631
+    do check "bug6447_hash_a1" (hash a1) 1893
+    do check "bug6447_hash_a2" (hash a2) 10727    
+#endif
+    
+#if Portable
+let aa =
+#else    
+let _ = 
+#endif
+
+  if not failures.IsEmpty then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
diff --git a/tests/fsharp/core/portable/run.bat b/tests/fsharp/core/portable/run.bat
new file mode 100644
index 0000000..971ebdc
--- /dev/null
+++ b/tests/fsharp/core/portable/run.bat
@@ -0,0 +1,19 @@
+ at if "%_echo%"=="" echo off
+
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+set CONTROL_FAILURES_LOG=%~dp0\control_failures.log
+
+.\ConsoleApplication1\bin\Debug\PortableTestEntry.exe
+endlocal
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
diff --git a/tests/fsharp/core/printf/build.bat b/tests/fsharp/core/printf/build.bat
new file mode 100644
index 0000000..208ce5d
--- /dev/null
+++ b/tests/fsharp/core/printf/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set PERMUTATIONS=FSC_BASIC
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/printf/run.bat b/tests/fsharp/core/printf/run.bat
new file mode 100644
index 0000000..60c181e
--- /dev/null
+++ b/tests/fsharp/core/printf/run.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+set PERMUTATIONS=FSC_BASIC
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/printf/test.fsx b/tests/fsharp/core/printf/test.fsx
new file mode 100644
index 0000000..6763e22
--- /dev/null
+++ b/tests/fsharp/core/printf/test.fsx
@@ -0,0 +1,9154 @@
+// #Conformance #Printing 
+
+#if Portable
+module Core_printf
+#endif
+#light
+
+open Printf
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+// change this to true to run every test case
+// leave as false to randomly execute a subset of cases (this is a very expensive test area)
+let runEveryTest = false
+if runEveryTest then stdout.WriteLine "Running every test. Set \"runEveryTest\" to false to reduce runtime"
+else stdout.WriteLine "Running a random subset of tests.  Set \"runEveryTest\" to true to run all tests"
+
+let rnd = System.Random()
+
+let test t (s1:Lazy<string>) s2 = 
+  if runEveryTest || (rnd.Next() % 10) = 0 then
+      let s1 = s1.Force()
+      if s1 <> s2 then 
+        (stderr.WriteLine ("test "+t+": expected \n\t'"+s2+"' but produced \n\t'"+s1+"'");
+         failures := true)
+      else
+        stdout.WriteLine ("test "+t+": correctly produced '"+s1+"'")   
+
+let verify actual expected = test expected actual expected
+
+let adjust1 obj n1 = unbox ((unbox obj) n1)
+
+let _ = test "percent00" (lazy(sprintf "%%")) "%"
+let _ = test "percent01" (lazy(sprintf " %%%% ")) " %% "
+let _ = test "percent02" (lazy(sprintf "%.2f%.2%" 2.)) "2.00%"
+let _ = test "percent03" (lazy(sprintf "   %2%%%%+-%")) "   %%%"
+let _ = test "percent04" (lazy(sprintf "%.*%" 2)) "%"
+let _ = test "percent05" (lazy(sprintf "%*% %*d" 20 10 5)) "%          5"
+let _ = test "percent06" (lazy(sprintf "%*% %*d" 20 8 5)) "%        5"
+let _ = test "percent07" (lazy(sprintf "%-+.*%%*d%*.*%" 55 0 8 77 88)) "%8%"
+let _ = test "percent08" (lazy(sprintf "%%d")) "%d"
+let _ = test "percent09" (lazy(sprintf "% *% %d" 10 6)) "% 6"
+
+let _ = test "cewoui2a" (lazy(sprintf "%o" 0)) "0"
+let _ = test "cewoui2b" (lazy(sprintf "%o" 0)) "0"
+let _ = test "cewoui2c" (lazy(sprintf "%o" 5)) "5"
+let _ = test "cewoui2q" (lazy(sprintf "%o" 8)) "10"
+let _ = test "cewoui2w" (lazy(sprintf "%o" 15)) "17"
+let _ = test "cewoui2e" (lazy(sprintf "%o" System.Int32.MinValue)) "20000000000"
+let _ = test "cewoui2r" (lazy(sprintf "%o" 0xffffffff)) "37777777777"
+let _ = test "cewoui2t" (lazy(sprintf "%o" (System.Int32.MinValue+1))) "20000000001"
+let _ = test "cewoui2y" (lazy(sprintf "%o" System.Int32.MaxValue)) "17777777777"
+
+let _ = test "cewoui2u" (lazy(sprintf "%o" (-1))) "37777777777"
+
+let f = sprintf "%o"
+
+let _ = test "cewoui2a" (lazy(f 0)) "0"
+let _ = test "cewoui2s" (lazy(f 0)) "0"
+let _ = test "cewoui2d" (lazy(f 5)) "5"
+let _ = test "cewoui2f" (lazy(f 8)) "10"
+let _ = test "cewoui2g" (lazy(f 15)) "17"
+let _ = test "cewoui2h" (lazy(f System.Int32.MinValue)) "20000000000"
+let _ = test "cewoui2j" (lazy(f 0xffffffff)) "37777777777"
+let _ = test "cewoui2lk" (lazy(f (System.Int32.MinValue+1))) "20000000001"
+let _ = test "cewoui2l" (lazy(f System.Int32.MaxValue)) "17777777777"
+
+let _ = test "cewoui212" (lazy(f (-1))) "37777777777"
+
+// Test nothing comes out until all arguments have been applied
+let _ = test "csd3oui2!" (lazy(let buf = new System.Text.StringBuilder() in ignore (bprintf buf "%x%x" 0); buf.ToString())) ""
+let _ = test "csd3oui2!" (lazy(let buf = new System.Text.StringBuilder() in ignore (bprintf buf "%x%x" 0 1); buf.ToString())) "01"
+let _ = test "csd3oui2!" (lazy(let buf = new System.Text.StringBuilder() in ignore (bprintf buf "%s"); buf.ToString())) ""
+let _ = test "csd3oui2!" (lazy(let buf = new System.Text.StringBuilder() in ignore (bprintf buf "%s" "abc"); buf.ToString())) "abc"
+
+let _ = test "cewoui2!" (lazy(sprintf "%x" 0)) "0"
+let _ = test "cewoui26" (lazy(sprintf "%x" 5)) "5"
+let _ = test "cewoui2f" (lazy(sprintf "%x" 8)) "8"
+let _ = test "cewoui29" (lazy(sprintf "%x" 15)) "f"
+let _ = test "cewoui2Z" (lazy(sprintf "%x" System.Int32.MinValue)) "80000000"
+let _ = test "cewoui2X" (lazy(sprintf "%x" 0xffffffff)) "ffffffff"
+let _ = test "cewoui2A" (lazy(sprintf "%x" (System.Int32.MinValue+1))) "80000001"
+let _ = test "cewoui2Q" (lazy(sprintf "%x" System.Int32.MaxValue)) "7fffffff"
+
+let fx = sprintf "%x"
+let _ = test "cewoui2W" (lazy(fx 0)) "0"
+let _ = test "cewoui2E" (lazy(fx 5)) "5"
+let _ = test "cewoui2R" (lazy(fx 8)) "8"
+let _ = test "cewoui2T" (lazy(fx 15)) "f"
+let _ = test "cewoui2Y" (lazy(fx System.Int32.MinValue)) "80000000"
+let _ = test "cewoui2U" (lazy(fx 0xffffffff)) "ffffffff"
+let _ = test "cewoui2I" (lazy(fx (System.Int32.MinValue+1))) "80000001"
+let _ = test "cewoui2O" (lazy(fx System.Int32.MaxValue)) "7fffffff"
+
+let _ = test "cewoui2Z" (lazy(sprintf "%X" 0)) "0"
+let _ = test "cewoui2X" (lazy(sprintf "%X" 5)) "5"
+let _ = test "cewoui2C" (lazy(sprintf "%X" 8)) "8"
+let _ = test "cewoui2V" (lazy(sprintf "%X" 15)) "F"
+let _ = test "cewoui2v" (lazy(sprintf "%X" System.Int32.MinValue)) "80000000"
+let _ = test "cewoui2B" (lazy(sprintf "%X" 0xffffffff)) "FFFFFFFF"
+let _ = test "cewoui2N" (lazy(sprintf "%X" (System.Int32.MinValue+1))) "80000001"
+let _ = test "cewoui2M" (lazy(sprintf "%X" System.Int32.MaxValue)) "7FFFFFFF"
+
+let _ = test "cewou44a" (lazy(sprintf "%u" 0)) "0"
+let _ = test "cewou44b" (lazy(sprintf "%u" 5)) "5"
+let _ = test "cewou44c" (lazy(sprintf "%u" 8)) "8"
+let _ = test "cewou44d" (lazy(sprintf "%u" 15)) "15"
+let _ = test "cewou44e" (lazy(sprintf "%u" System.Int32.MinValue)) "2147483648"
+let _ = test "cewou44f" (lazy(sprintf "%u" 0xffffffff)) "4294967295"
+let _ = test "cewou44g" (lazy(sprintf "%u" (System.Int32.MinValue+1))) "2147483649"
+let _ = test "cewou44h" (lazy(sprintf "%u" System.Int32.MaxValue)) "2147483647"
+
+let _ = test "cewou45a" (lazy(sprintf "%d" 0ul)) "0"
+let _ = test "cewou45b" (lazy(sprintf "%d" 5ul)) "5"
+let _ = test "cewou45c" (lazy(sprintf "%d" 8ul)) "8"
+let _ = test "cewou45d" (lazy(sprintf "%d" 15ul)) "15"
+let _ = test "cewou45e" (lazy(sprintf "%d" 2147483648ul)) "2147483648"
+let _ = test "cewou45f" (lazy(sprintf "%d" 4294967295ul)) "4294967295"
+let _ = test "cewou45g" (lazy(sprintf "%d" 2147483649ul)) "2147483649"
+let _ = test "cewou45h" (lazy(sprintf "%d" 2147483647ul)) "2147483647"
+
+let _ = test "cewou46a" (lazy(sprintf "%d" 0ul)) "0"
+let _ = test "cewou46b" (lazy(sprintf "%d" 5ul)) "5"
+let _ = test "cewou46c" (lazy(sprintf "%d" 8ul)) "8"
+let _ = test "cewou46d" (lazy(sprintf "%d" 15ul)) "15"
+let _ = test "cewou46e" (lazy(sprintf "%d" 2147483648ul)) "2147483648"
+let _ = test "cewou46f" (lazy(sprintf "%d" 4294967295ul)) "4294967295"
+let _ = test "cewou46g" (lazy(sprintf "%d" 2147483649ul)) "2147483649"
+let _ = test "cewou46h" (lazy(sprintf "%d" 2147483647ul)) "2147483647"
+
+let _ = test "ceew903" (lazy(sprintf "%u" System.Int64.MaxValue)) "9223372036854775807"
+let _ = test "ceew903" (lazy(sprintf "%u" System.Int64.MinValue)) "9223372036854775808"
+let _ = test "ceew903" (lazy(sprintf "%d" System.Int64.MaxValue)) "9223372036854775807"
+let _ = test "ceew903" (lazy(sprintf "%d" System.Int64.MinValue)) "-9223372036854775808"
+
+let _ = test "ceew903" (lazy(sprintf "%u" System.Int64.MaxValue)) "9223372036854775807"
+let _ = test "ceew903" (lazy(sprintf "%u" System.Int64.MinValue)) "9223372036854775808"
+let _ = test "ceew903" (lazy(sprintf "%d" System.Int64.MaxValue)) "9223372036854775807"
+let _ = test "ceew903" (lazy(sprintf "%d" System.Int64.MinValue)) "-9223372036854775808"
+
+let _ = test "cewou47a" (lazy(sprintf "%d" 0n)) "0"
+let _ = test "cewou47b" (lazy(sprintf "%d" 5n)) "5"
+let _ = test "cewou47c" (lazy(sprintf "%d" 8n)) "8"
+let _ = test "cewou47d" (lazy(sprintf "%d" 15n)) "15"
+let _ = test "cewou47e" (lazy(sprintf "%u" 2147483648n)) "2147483648"
+let _ = test "cewou47f" (lazy(sprintf "%u" 4294967295n)) "4294967295"
+let _ = test "cewou47g" (lazy(sprintf "%u" 2147483649n)) "2147483649"
+let _ = test "cewou47h" (lazy(sprintf "%u" 2147483647n)) "2147483647"
+
+let _ = test "cewou47a" (lazy(sprintf "%d" 0n)) "0"
+let _ = test "cewou47b" (lazy(sprintf "%d" 5n)) "5"
+let _ = test "cewou47c" (lazy(sprintf "%d" 8n)) "8"
+let _ = test "cewou47d" (lazy(sprintf "%d" 15n)) "15"
+let _ = test "cewou47e" (lazy(sprintf "%u" 2147483648n)) "2147483648"
+let _ = test "cewou47f" (lazy(sprintf "%u" 4294967295n)) "4294967295"
+let _ = test "cewou47g" (lazy(sprintf "%u" 2147483649n)) "2147483649"
+let _ = test "cewou47h" (lazy(sprintf "%u" 2147483647n)) "2147483647"
+
+let _ = test "cewou48a" (lazy(sprintf "%d" 0un)) "0"
+let _ = test "cewou48b" (lazy(sprintf "%d" 5un)) "5"
+let _ = test "cewou48c" (lazy(sprintf "%d" 8un)) "8"
+let _ = test "cewou48d" (lazy(sprintf "%d" 15un)) "15"
+let _ = test "cewou48e" (lazy(sprintf "%u" 2147483648un)) "2147483648"
+let _ = test "cewou48f" (lazy(sprintf "%u" 4294967295un)) "4294967295"
+let _ = test "cewou48g" (lazy(sprintf "%u" 2147483649un)) "2147483649"
+let _ = test "cewou48h" (lazy(sprintf "%u" 2147483647un)) "2147483647"
+
+let _ = test "cewou59a" (lazy(sprintf "%d" 0un)) "0"
+let _ = test "cewou59b" (lazy(sprintf "%d" 5un)) "5"
+let _ = test "cewou59c" (lazy(sprintf "%d" 8un)) "8"
+let _ = test "cewou59d" (lazy(sprintf "%d" 15un)) "15"
+let _ = test "cewou59e" (lazy(sprintf "%u" 2147483648un)) "2147483648"
+let _ = test "cewou59f" (lazy(sprintf "%u" 4294967295un)) "4294967295"
+let _ = test "cewou59g" (lazy(sprintf "%u" 2147483649un)) "2147483649"
+let _ = test "cewou59h" (lazy(sprintf "%u" 2147483647un)) "2147483647"
+
+let _ = test "cewou49a" (lazy(sprintf "%d" 0)) "0"
+let _ = test "cewou49b" (lazy(sprintf "%d" 5)) "5"
+let _ = test "cewou49c" (lazy(sprintf "%+d" 5)) "+5"
+let _ = test "cewou49d" (lazy(sprintf "% d" 5)) " 5"
+let _ = test "cewou49e" (lazy(sprintf "%+4d" 5)) "  +5"
+let _ = test "cewou49f" (lazy(sprintf "%-+4d" 5)) "+5  "
+let _ = test "cewou49g" (lazy(sprintf "%-4d" 5)) "5   "
+let _ = test "cewou49h" (lazy(sprintf "%- 4d" 5)) " 5  "
+let _ = test "cewou49i" (lazy(sprintf "%- d" 5)) " 5"
+let _ = test "cewou49j" (lazy(sprintf "% d" 5)) " 5"
+let _ = test "weioj31" (lazy(sprintf "%*d" 3 5)) "  5"
+let _ = test "weioj31" (lazy(sprintf "%3d" 5)) "  5"
+let _ = test "weioj32" (lazy(sprintf "%1d" 5)) "5"
+let _ = test "weioj32" (lazy(sprintf "%*d" 1 5)) "5"
+let _ = test "weioj33" (lazy(sprintf "%2d" 500)) "500"
+let _ = test "weioj33" (lazy(sprintf "%*d" 2 500)) "500"
+let _ = test "weioj34" (lazy(sprintf "%3d" 500)) "500"
+let _ = test "weioj34" (lazy(sprintf "%*d" 3 500)) "500"
+let _ = test "weioj35" (lazy(sprintf "%d" 501)) "501"
+let _ = test "weioj36" (lazy(sprintf "%2d" (-4))) "-4"
+let _ = test "weioj36" (lazy(sprintf "%*d" 2 (-4))) "-4"
+let _ = test "weioj37" (lazy(sprintf "%1d" (-4))) "-4"
+let _ = test "weioj37" (lazy(sprintf "%*d" 1 (-4))) "-4"
+let _ = test "weioj38" (lazy(sprintf "%d" (-401))) "-401"
+let _ = test "weioj39" (lazy(sprintf "%d" 2147483647)) "2147483647"
+let _ = test "weioj3a" (lazy(sprintf "%d" (-2147483647))) "-2147483647"
+let _ = test "weioj3s" (lazy(sprintf "%d" (-2147483648))) "-2147483648"
+
+
+let _ = test "weioj3d" (lazy(sprintf "print test %O with suffix" 1)) "print test 1 with suffix"
+let _ = test "weioj3f" (lazy(sprintf "print test %O %O with suffix" 1 "xyz")) "print test 1 xyz with suffix"
+let _ = test "weioj3g" (lazy(sprintf "print test %M with suffix" (System.Convert.ToDecimal(3)))) "print test 3 with suffix"
+let _ = test "weioj3h" (lazy(sprintf "print test %M with suffix" (System.Convert.ToDecimal(3.02)))) "print test 3.02 with suffix"
+
+let _ = test "weioj3j" (lazy(sprintf "%O" 3I)) "3"
+
+
+let _ = test "weiodasj3" (lazy(sprintf "%f" 0.0)) "0.000000"
+let _ = test "weiogwej3" (lazy(sprintf "%10f" 0.0)) "  0.000000"
+let _ = test "weiogwej3" (lazy(sprintf "%*f" 10 0.0)) "  0.000000"
+let _ = test "weiobtj3" (lazy(sprintf "%7f" 0.0)) "0.000000"
+let _ = test "weiobtj3" (lazy(sprintf "%*f" 7 0.0)) "0.000000"
+let _ = test "weiorwej3" (lazy(sprintf "%7.1f" 0.0)) "    0.0"
+let _ = test "weiorwej3" (lazy(sprintf "%*.1f" 7 0.0)) "    0.0"
+let _ = test "weiorwej3" (lazy(sprintf "%7.*f" 1 0.0)) "    0.0"
+let _ = test "weiorwej3" (lazy(sprintf "%*.*f" 7 1 0.0)) "    0.0"
+let _ = test "weivewoj3" (lazy(sprintf "%7.2f" 0.0)) "   0.00"
+let _ = test "weivewoj3" (lazy(sprintf "%*.2f" 7 0.0)) "   0.00"
+let _ = test "weivewoj3" (lazy(sprintf "%*.*f" 7 2 0.0)) "   0.00"
+let _ = test "weivewoj3" (lazy(sprintf "%7.*f" 2 0.0)) "   0.00"
+let _ = test "weiqfoj3" (lazy(sprintf "%7.0f" 0.0)) "      0"
+let _ = test "weiqfoj3" (lazy(sprintf "%*.0f" 7 0.0)) "      0"
+let _ = test "weiqfoj3" (lazy(sprintf "%7.*f" 0 0.0)) "      0"
+let _ = test "weiqfoj3" (lazy(sprintf "%*.*f" 7 0 0.0)) "      0"
+let _ = test "weieroj3" (lazy(sprintf "%10.2e" 1.0)) " 1.00e+000"
+let _ = test "weieroj3" (lazy(sprintf "%*.2e" 10 1.0)) " 1.00e+000"
+let _ = test "weio34j3" (lazy(sprintf "%10.2E" 1.0)) " 1.00E+000"
+let _ = test "weio34j3" (lazy(sprintf "%10.*E" 2 1.0)) " 1.00E+000"
+let _ = test "weiberoj3" (lazy(sprintf "%10.3E" 1.0)) "1.000E+000"
+let _ = test "weiberoj3" (lazy(sprintf "%10.*E" 3 1.0)) "1.000E+000"
+let _ = test "weiqfwoj3" (lazy(sprintf "%10g" 1.0)) "         1"
+let _ = test "weiqfwoj3" (lazy(sprintf "%*g" 10 1.0)) "         1"
+let _ = test "weiof33j3" (lazy(sprintf "%10g" 1.01)) "      1.01"
+let _ = test "weiof33j3" (lazy(sprintf "%*g" 10 1.01)) "      1.01"
+let _ = test "wei54goj3" (lazy(sprintf "%-10g" 1.01)) "1.01      "
+let _ = test "wei54goj3" (lazy(sprintf "%-*g" 10 1.01)) "1.01      "
+let _ = test "weioqf3j3" (lazy(sprintf "%g" 1.01)) "1.01"
+(* NEG: let _ = test "weioqf3j3" (lazy(sprintf "%g" 1)) "1.01" *)
+
+
+let _ = test "wekodasj3" (lazy(sprintf "%f" 0.0f)) "0.000000"
+let _ = test "wekogwej3" (lazy(sprintf "%10f" 0.0f)) "  0.000000"
+let _ = test "wekobtj3" (lazy(sprintf "%7f" 0.0f)) "0.000000"
+let _ = test "wekorwej3" (lazy(sprintf "%7.1f" 0.0f)) "    0.0"
+let _ = test "wekvewoj3" (lazy(sprintf "%7.2f" 0.0f)) "   0.00"
+let _ = test "wekqfoj3" (lazy(sprintf "%7.0f" 0.0f)) "      0"
+let _ = test "wekeroj3" (lazy(sprintf "%10.2e" 1.0f)) " 1.00e+000"
+let _ = test "weko34j3" (lazy(sprintf "%10.2E" 1.0f)) " 1.00E+000"
+let _ = test "wekberoj3" (lazy(sprintf "%10.3E" 1.0f)) "1.000E+000"
+let _ = test "wekqfwoj3" (lazy(sprintf "%10g" 1.0f)) "         1"
+let _ = test "wekof33j3" (lazy(sprintf "%10g" 1.01f)) "      1.01"
+let _ = test "wek54goj3" (lazy(sprintf "%-10g" 1.01f)) "1.01      "
+let _ = test "wekoqf3j3" (lazy(sprintf "%g" 1.01f)) "1.01"
+
+
+let _ = test "weioj3Q" (lazy(sprintf "%a" (fun () -> string) 10)) "10"
+let _ = test "weioj3W" (lazy(sprintf "%a%a" (fun () s -> s+s) "a" (fun () s -> s+s) "b")) "aabb"
+(* NEG: let _ = test "weioj3" (lazy(sprintf "%a" (fun () -> string_of_int) "a")) "10" *)
+
+let _ = test "weioj3ff" (lazy(try failwithf "%a%a" (fun () s -> s+s) "a" (fun () s -> s+s) "b" with Failure s -> s)) "aabb"
+let _ = test "weioj3ffdd" (lazy(string (try if true then failwithf "%s" "abc" else 1 with Failure "abc" -> 2))) "2"
+let _ = test "weioj3ffd2" (lazy(try if true then failwithf "%s" "abc" else "d"with Failure "abc" -> "e")) "e"
+
+let _ = test "weioj3" (lazy(sprintf "%t" (fun () -> "10"))) "10"
+  
+let bug600 = sprintf "%d"
+let _ = test "bug600a1" (lazy(bug600 2)) "2" 
+let _ = test "bug600b1" (lazy(bug600 2)) "2" (* not 22! *)
+
+let bug600b = sprintf "%s"
+let _ = test "bug600a2" (lazy(bug600b "2")) "2" 
+let _ = test "bug600b2" (lazy(bug600b "2")) "2" (* not 22! *)
+
+let bug600c = sprintf "%x"
+let _ = test "bug600a3" (lazy(bug600c 2)) "2" 
+let _ = test "bug600b3" (lazy(bug600c 2)) "2" (* not 22! *)
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFy)) ("ff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFs)) ("ffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFF)) ("ffffffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFFFFFFFFFFL)) ("ffffffffffffffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFFn)) ("ffffffff")
+
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFuy)) ("ff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFus)) ("ffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFFu)) ("ffffffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFFFFFFFFFFUL)) ("ffffffffffffffff")
+let _ = test "ckwoih" (lazy(sprintf "%x" 0xFFFFFFFFun)) ("ffffffff")
+
+// Check one with a suffix
+module CheckDisplayAttributes1 =
+    [<StructuredFormatDisplay("{StructuredDisplay}N")>]
+    type Foo() = 
+       member x.StructuredDisplay = 3
+
+    test "cenwoiwe1" (lazy(sprintf "%A" (Foo()))) "3N"
+
+// Check one with a prefix
+module CheckDisplayAttributes2 =
+
+    [<StructuredFormatDisplay("N{StructuredDisplay}")>]
+    type Foo() = 
+       member x.StructuredDisplay = 3
+
+    test "cenwoiwe2" (lazy(sprintf "%A" (Foo()))) "N3"
+    
+// Check one with a prefix returning a string
+module CheckDisplayAttributes3 =
+
+    [<StructuredFormatDisplay("N{StructuredDisplay}")>]
+    type Foo() = 
+       member x.StructuredDisplay = "3"
+
+    test "cenwoiwe3" (lazy(sprintf "%A" (Foo()))) "N3"
+
+// Check one returning a string
+module CheckDisplayAttributes4 =
+
+    [<StructuredFormatDisplay("{StructuredDisplay}")>]
+    type Foo() = 
+       member x.StructuredDisplay = "3"
+
+    test "cenwoiwe4" (lazy(sprintf "%A" (Foo()))) "3"
+    
+// Check one with an internal property
+module CheckDisplayAttributes5 =
+
+    [<StructuredFormatDisplay("{StructuredDisplay}")>]
+    type Foo() = 
+       member internal x.StructuredDisplay = "3"
+
+    test "cenwoiwe5" (lazy(sprintf "%A" (Foo()))) "3"
+    
+// Check one with spaces
+module CheckDisplayAttributes6 =
+
+    [<StructuredFormatDisplay("  {StructuredDisplay}  ")>]
+    type Foo() = 
+       member internal x.StructuredDisplay = "3"
+
+    test "cenwoiwe6" (lazy(sprintf "%A" (Foo()))) "  3  "
+    
+// Check an ill-formed StructuredFormatDisplay string is not shown
+module CheckDisplayAttributes7 =
+
+    [<StructuredFormatDisplay("{StructuredDisplay")>]
+    type Foo() = 
+       member internal x.StructuredDisplay = "3"
+       override x.ToString() = "2"
+
+    test "cenwoiwe7" (lazy(sprintf "%A" (Foo()))) "2"
+    
+// Check one returning a list
+module CheckDisplayAttributes8 =
+
+    [<StructuredFormatDisplay("{StructuredDisplay}")>]
+    type Foo() = 
+       member internal x.StructuredDisplay = [1;2]
+       override x.ToString() = "2"
+
+    test "cenwoiwe8" (lazy(sprintf "%A" (Foo()))) "[1; 2]"
+let func0()=
+    test "test1" (lazy(sprintf "%b" true)) "true"
+    test "test2" (lazy(sprintf "%5b" true)) " true"
+    test "test3" (lazy(sprintf "%1b" true)) "true"
+    test "test4" (lazy(sprintf "%*b" 7 true)) "   true"
+    test "test5" (lazy(sprintf "%-b" true)) "true"
+    test "test6" (lazy(sprintf "%-5b" true)) "true "
+    test "test7" (lazy(sprintf "%-1b" true)) "true"
+    test "test8" (lazy(sprintf "%-*b" 7 true)) "true   "
+    test "test9" (lazy(sprintf "%b" false)) "false"
+    test "test10" (lazy(sprintf "%5b" false)) "false"
+    test "test11" (lazy(sprintf "%1b" false)) "false"
+    test "test12" (lazy(sprintf "%*b" 7 false)) "  false"
+    test "test13" (lazy(sprintf "%-b" false)) "false"
+    test "test14" (lazy(sprintf "%-5b" false)) "false"
+    test "test15" (lazy(sprintf "%-1b" false)) "false"
+    test "test16" (lazy(sprintf "%-*b" 7 false)) "false  "
+    test "test17" (lazy(sprintf "%c" 'a')) "a"
+    test "test18" (lazy(sprintf "%5c" 'a')) "    a"
+    test "test19" (lazy(sprintf "%1c" 'a')) "a"
+    test "test20" (lazy(sprintf "%*c" 7 'a')) "      a"
+    test "test21" (lazy(sprintf "%-c" 'a')) "a"
+    test "test22" (lazy(sprintf "%-5c" 'a')) "a    "
+    test "test23" (lazy(sprintf "%-1c" 'a')) "a"
+    test "test24" (lazy(sprintf "%-*c" 7 'a')) "a      "
+    test "test25" (lazy(sprintf "%c" 'X')) "X"
+    test "test26" (lazy(sprintf "%5c" 'X')) "    X"
+    test "test27" (lazy(sprintf "%1c" 'X')) "X"
+    test "test28" (lazy(sprintf "%*c" 7 'X')) "      X"
+    test "test29" (lazy(sprintf "%-c" 'X')) "X"
+    test "test30" (lazy(sprintf "%-5c" 'X')) "X    "
+    test "test31" (lazy(sprintf "%-1c" 'X')) "X"
+    test "test32" (lazy(sprintf "%-*c" 7 'X')) "X      "
+    test "test33" (lazy(sprintf "%c" '\n')) "\n"
+    test "test34" (lazy(sprintf "%5c" '\n')) "    \n"
+    test "test35" (lazy(sprintf "%1c" '\n')) "\n"
+    test "test36" (lazy(sprintf "%*c" 7 '\n')) "      \n"
+    test "test37" (lazy(sprintf "%-c" '\n')) "\n"
+    test "test38" (lazy(sprintf "%-5c" '\n')) "\n    "
+    test "test39" (lazy(sprintf "%-1c" '\n')) "\n"
+    test "test40" (lazy(sprintf "%-*c" 7 '\n')) "\n      "
+    test "test41" (lazy(sprintf "%s" "test")) "test"
+    test "test42" (lazy(sprintf "%5s" "test")) " test"
+    test "test43" (lazy(sprintf "%1s" "test")) "test"
+    test "test44" (lazy(sprintf "%*s" 7 "test")) "   test"
+    test "test45" (lazy(sprintf "%-s" "test")) "test"
+    test "test46" (lazy(sprintf "%-5s" "test")) "test "
+    test "test47" (lazy(sprintf "%-1s" "test")) "test"
+    test "test48" (lazy(sprintf "%-*s" 7 "test")) "test   "
+    test "test49" (lazy(sprintf "%s" "value")) "value"
+    test "test50" (lazy(sprintf "%5s" "value")) "value"
+    test "test51" (lazy(sprintf "%1s" "value")) "value"
+    test "test52" (lazy(sprintf "%*s" 7 "value")) "  value"
+    test "test53" (lazy(sprintf "%-s" "value")) "value"
+    test "test54" (lazy(sprintf "%-5s" "value")) "value"
+    test "test55" (lazy(sprintf "%-1s" "value")) "value"
+    test "test56" (lazy(sprintf "%-*s" 7 "value")) "value  "
+    test "test57" (lazy(sprintf "%d" 14)) "14"
+    test "test58" (lazy(sprintf "%5d" 14)) "   14"
+    test "test59" (lazy(sprintf "%1d" 14)) "14"
+    test "test60" (lazy(sprintf "%*d" 7 14)) "     14"
+    test "test61" (lazy(sprintf "%-d" 14)) "14"
+    test "test62" (lazy(sprintf "%-5d" 14)) "14   "
+    test "test63" (lazy(sprintf "%-1d" 14)) "14"
+    test "test64" (lazy(sprintf "%-*d" 7 14)) "14     "
+    test "test65" (lazy(sprintf "%0d" 14)) "14"
+    test "test66" (lazy(sprintf "%05d" 14)) "00014"
+    test "test67" (lazy(sprintf "%01d" 14)) "14"
+    test "test68" (lazy(sprintf "%0*d" 7 14)) "0000014"
+    test "test69" (lazy(sprintf "%-0d" 14)) "14"
+    test "test70" (lazy(sprintf "%-05d" 14)) "14   "
+    test "test71" (lazy(sprintf "%-01d" 14)) "14"
+    test "test72" (lazy(sprintf "%-0*d" 7 14)) "14     "
+    test "test73" (lazy(sprintf "%+d" 14)) "+14"
+    test "test74" (lazy(sprintf "%+5d" 14)) "  +14"
+    test "test75" (lazy(sprintf "%+1d" 14)) "+14"
+    test "test76" (lazy(sprintf "%+*d" 7 14)) "    +14"
+    test "test77" (lazy(sprintf "%-+d" 14)) "+14"
+    test "test78" (lazy(sprintf "%-+5d" 14)) "+14  "
+    test "test79" (lazy(sprintf "%-+1d" 14)) "+14"
+    test "test80" (lazy(sprintf "%-+*d" 7 14)) "+14    "
+    test "test81" (lazy(sprintf "%+0d" 14)) "+14"
+    test "test82" (lazy(sprintf "%+05d" 14)) "+0014"
+    test "test83" (lazy(sprintf "%+01d" 14)) "+14"
+    test "test84" (lazy(sprintf "%+0*d" 7 14)) "+000014"
+    test "test85" (lazy(sprintf "%-+0d" 14)) "+14"
+    test "test86" (lazy(sprintf "%-+05d" 14)) "+14  "
+    test "test87" (lazy(sprintf "%-+01d" 14)) "+14"
+    test "test88" (lazy(sprintf "%-+0*d" 7 14)) "+14    "
+    test "test89" (lazy(sprintf "% d" 14)) " 14"
+    test "test90" (lazy(sprintf "% 5d" 14)) "   14"
+    test "test91" (lazy(sprintf "% 1d" 14)) " 14"
+    test "test92" (lazy(sprintf "% *d" 7 14)) "     14"
+    test "test93" (lazy(sprintf "%- d" 14)) " 14"
+    test "test94" (lazy(sprintf "%- 5d" 14)) " 14  "
+    test "test95" (lazy(sprintf "%- 1d" 14)) " 14"
+    test "test96" (lazy(sprintf "%- *d" 7 14)) " 14    "
+    test "test97" (lazy(sprintf "% 0d" 14)) " 14"
+    test "test98" (lazy(sprintf "% 05d" 14)) " 0014"
+    test "test99" (lazy(sprintf "% 01d" 14)) " 14"
+    test "test100" (lazy(sprintf "% 0*d" 7 14)) " 000014"
+    test "test101" (lazy(sprintf "%- 0d" 14)) " 14"
+    test "test102" (lazy(sprintf "%- 05d" 14)) " 14  "
+    test "test103" (lazy(sprintf "%- 01d" 14)) " 14"
+    test "test104" (lazy(sprintf "%- 0*d" 7 14)) " 14    "
+    test "test105" (lazy(sprintf "%d" -10)) "-10"
+    test "test106" (lazy(sprintf "%5d" -10)) "  -10"
+    test "test107" (lazy(sprintf "%1d" -10)) "-10"
+    test "test108" (lazy(sprintf "%*d" 7 -10)) "    -10"
+    test "test109" (lazy(sprintf "%-d" -10)) "-10"
+    test "test110" (lazy(sprintf "%-5d" -10)) "-10  "
+    test "test111" (lazy(sprintf "%-1d" -10)) "-10"
+    test "test112" (lazy(sprintf "%-*d" 7 -10)) "-10    "
+    test "test113" (lazy(sprintf "%0d" -10)) "-10"
+    test "test114" (lazy(sprintf "%05d" -10)) "-0010"
+    test "test115" (lazy(sprintf "%01d" -10)) "-10"
+    test "test116" (lazy(sprintf "%0*d" 7 -10)) "-000010"
+    test "test117" (lazy(sprintf "%-0d" -10)) "-10"
+    test "test118" (lazy(sprintf "%-05d" -10)) "-10  "
+    test "test119" (lazy(sprintf "%-01d" -10)) "-10"
+    test "test120" (lazy(sprintf "%-0*d" 7 -10)) "-10    "
+    test "test121" (lazy(sprintf "%+d" -10)) "-10"
+    test "test122" (lazy(sprintf "%+5d" -10)) "  -10"
+    test "test123" (lazy(sprintf "%+1d" -10)) "-10"
+    test "test124" (lazy(sprintf "%+*d" 7 -10)) "    -10"
+    test "test125" (lazy(sprintf "%-+d" -10)) "-10"
+    test "test126" (lazy(sprintf "%-+5d" -10)) "-10  "
+    test "test127" (lazy(sprintf "%-+1d" -10)) "-10"
+    test "test128" (lazy(sprintf "%-+*d" 7 -10)) "-10    "
+    test "test129" (lazy(sprintf "%+0d" -10)) "-10"
+    test "test130" (lazy(sprintf "%+05d" -10)) "-0010"
+    test "test131" (lazy(sprintf "%+01d" -10)) "-10"
+    test "test132" (lazy(sprintf "%+0*d" 7 -10)) "-000010"
+    test "test133" (lazy(sprintf "%-+0d" -10)) "-10"
+    test "test134" (lazy(sprintf "%-+05d" -10)) "-10  "
+    test "test135" (lazy(sprintf "%-+01d" -10)) "-10"
+    test "test136" (lazy(sprintf "%-+0*d" 7 -10)) "-10    "
+    test "test137" (lazy(sprintf "% d" -10)) "-10"
+    test "test138" (lazy(sprintf "% 5d" -10)) "  -10"
+    test "test139" (lazy(sprintf "% 1d" -10)) "-10"
+    test "test140" (lazy(sprintf "% *d" 7 -10)) "    -10"
+    test "test141" (lazy(sprintf "%- d" -10)) "-10"
+    test "test142" (lazy(sprintf "%- 5d" -10)) "-10  "
+    test "test143" (lazy(sprintf "%- 1d" -10)) "-10"
+    test "test144" (lazy(sprintf "%- *d" 7 -10)) "-10    "
+    test "test145" (lazy(sprintf "% 0d" -10)) "-10"
+    test "test146" (lazy(sprintf "% 05d" -10)) "-0010"
+    test "test147" (lazy(sprintf "% 01d" -10)) "-10"
+    test "test148" (lazy(sprintf "% 0*d" 7 -10)) "-000010"
+    test "test149" (lazy(sprintf "%- 0d" -10)) "-10"
+    test "test150" (lazy(sprintf "%- 05d" -10)) "-10  "
+    test "test151" (lazy(sprintf "%- 01d" -10)) "-10"
+    test "test152" (lazy(sprintf "%- 0*d" 7 -10)) "-10    "
+    test "test153" (lazy(sprintf "%d" 55s)) "55"
+    test "test154" (lazy(sprintf "%5d" 55s)) "   55"
+    test "test155" (lazy(sprintf "%1d" 55s)) "55"
+    test "test156" (lazy(sprintf "%*d" 7 55s)) "     55"
+    test "test157" (lazy(sprintf "%-d" 55s)) "55"
+    test "test158" (lazy(sprintf "%-5d" 55s)) "55   "
+    test "test159" (lazy(sprintf "%-1d" 55s)) "55"
+    test "test160" (lazy(sprintf "%-*d" 7 55s)) "55     "
+    test "test161" (lazy(sprintf "%0d" 55s)) "55"
+    test "test162" (lazy(sprintf "%05d" 55s)) "00055"
+    test "test163" (lazy(sprintf "%01d" 55s)) "55"
+    test "test164" (lazy(sprintf "%0*d" 7 55s)) "0000055"
+    test "test165" (lazy(sprintf "%-0d" 55s)) "55"
+    test "test166" (lazy(sprintf "%-05d" 55s)) "55   "
+    test "test167" (lazy(sprintf "%-01d" 55s)) "55"
+    test "test168" (lazy(sprintf "%-0*d" 7 55s)) "55     "
+    test "test169" (lazy(sprintf "%+d" 55s)) "+55"
+    test "test170" (lazy(sprintf "%+5d" 55s)) "  +55"
+    test "test171" (lazy(sprintf "%+1d" 55s)) "+55"
+    test "test172" (lazy(sprintf "%+*d" 7 55s)) "    +55"
+    test "test173" (lazy(sprintf "%-+d" 55s)) "+55"
+    test "test174" (lazy(sprintf "%-+5d" 55s)) "+55  "
+    test "test175" (lazy(sprintf "%-+1d" 55s)) "+55"
+    test "test176" (lazy(sprintf "%-+*d" 7 55s)) "+55    "
+    test "test177" (lazy(sprintf "%+0d" 55s)) "+55"
+    test "test178" (lazy(sprintf "%+05d" 55s)) "+0055"
+    test "test179" (lazy(sprintf "%+01d" 55s)) "+55"
+    test "test180" (lazy(sprintf "%+0*d" 7 55s)) "+000055"
+    test "test181" (lazy(sprintf "%-+0d" 55s)) "+55"
+    test "test182" (lazy(sprintf "%-+05d" 55s)) "+55  "
+    test "test183" (lazy(sprintf "%-+01d" 55s)) "+55"
+    test "test184" (lazy(sprintf "%-+0*d" 7 55s)) "+55    "
+    test "test185" (lazy(sprintf "% d" 55s)) " 55"
+    test "test186" (lazy(sprintf "% 5d" 55s)) "   55"
+    test "test187" (lazy(sprintf "% 1d" 55s)) " 55"
+    test "test188" (lazy(sprintf "% *d" 7 55s)) "     55"
+    test "test189" (lazy(sprintf "%- d" 55s)) " 55"
+    test "test190" (lazy(sprintf "%- 5d" 55s)) " 55  "
+    test "test191" (lazy(sprintf "%- 1d" 55s)) " 55"
+    test "test192" (lazy(sprintf "%- *d" 7 55s)) " 55    "
+    test "test193" (lazy(sprintf "% 0d" 55s)) " 55"
+    test "test194" (lazy(sprintf "% 05d" 55s)) " 0055"
+    test "test195" (lazy(sprintf "% 01d" 55s)) " 55"
+    test "test196" (lazy(sprintf "% 0*d" 7 55s)) " 000055"
+    test "test197" (lazy(sprintf "%- 0d" 55s)) " 55"
+    test "test198" (lazy(sprintf "%- 05d" 55s)) " 55  "
+    test "test199" (lazy(sprintf "%- 01d" 55s)) " 55"
+    test "test200" (lazy(sprintf "%- 0*d" 7 55s)) " 55    "
+    test "test201" (lazy(sprintf "%d" -88s)) "-88"
+    test "test202" (lazy(sprintf "%5d" -88s)) "  -88"
+    test "test203" (lazy(sprintf "%1d" -88s)) "-88"
+    test "test204" (lazy(sprintf "%*d" 7 -88s)) "    -88"
+    test "test205" (lazy(sprintf "%-d" -88s)) "-88"
+    test "test206" (lazy(sprintf "%-5d" -88s)) "-88  "
+    test "test207" (lazy(sprintf "%-1d" -88s)) "-88"
+    test "test208" (lazy(sprintf "%-*d" 7 -88s)) "-88    "
+    test "test209" (lazy(sprintf "%0d" -88s)) "-88"
+    test "test210" (lazy(sprintf "%05d" -88s)) "-0088"
+    test "test211" (lazy(sprintf "%01d" -88s)) "-88"
+    test "test212" (lazy(sprintf "%0*d" 7 -88s)) "-000088"
+    test "test213" (lazy(sprintf "%-0d" -88s)) "-88"
+    test "test214" (lazy(sprintf "%-05d" -88s)) "-88  "
+    test "test215" (lazy(sprintf "%-01d" -88s)) "-88"
+    test "test216" (lazy(sprintf "%-0*d" 7 -88s)) "-88    "
+    test "test217" (lazy(sprintf "%+d" -88s)) "-88"
+    test "test218" (lazy(sprintf "%+5d" -88s)) "  -88"
+    test "test219" (lazy(sprintf "%+1d" -88s)) "-88"
+    test "test220" (lazy(sprintf "%+*d" 7 -88s)) "    -88"
+    test "test221" (lazy(sprintf "%-+d" -88s)) "-88"
+    test "test222" (lazy(sprintf "%-+5d" -88s)) "-88  "
+    test "test223" (lazy(sprintf "%-+1d" -88s)) "-88"
+    test "test224" (lazy(sprintf "%-+*d" 7 -88s)) "-88    "
+    test "test225" (lazy(sprintf "%+0d" -88s)) "-88"
+    test "test226" (lazy(sprintf "%+05d" -88s)) "-0088"
+    test "test227" (lazy(sprintf "%+01d" -88s)) "-88"
+    test "test228" (lazy(sprintf "%+0*d" 7 -88s)) "-000088"
+    test "test229" (lazy(sprintf "%-+0d" -88s)) "-88"
+    test "test230" (lazy(sprintf "%-+05d" -88s)) "-88  "
+    test "test231" (lazy(sprintf "%-+01d" -88s)) "-88"
+    test "test232" (lazy(sprintf "%-+0*d" 7 -88s)) "-88    "
+    test "test233" (lazy(sprintf "% d" -88s)) "-88"
+    test "test234" (lazy(sprintf "% 5d" -88s)) "  -88"
+    test "test235" (lazy(sprintf "% 1d" -88s)) "-88"
+    test "test236" (lazy(sprintf "% *d" 7 -88s)) "    -88"
+    test "test237" (lazy(sprintf "%- d" -88s)) "-88"
+    test "test238" (lazy(sprintf "%- 5d" -88s)) "-88  "
+    test "test239" (lazy(sprintf "%- 1d" -88s)) "-88"
+    test "test240" (lazy(sprintf "%- *d" 7 -88s)) "-88    "
+    test "test241" (lazy(sprintf "% 0d" -88s)) "-88"
+    test "test242" (lazy(sprintf "% 05d" -88s)) "-0088"
+    test "test243" (lazy(sprintf "% 01d" -88s)) "-88"
+    test "test244" (lazy(sprintf "% 0*d" 7 -88s)) "-000088"
+    test "test245" (lazy(sprintf "%- 0d" -88s)) "-88"
+    test "test246" (lazy(sprintf "%- 05d" -88s)) "-88  "
+    test "test247" (lazy(sprintf "%- 01d" -88s)) "-88"
+    test "test248" (lazy(sprintf "%- 0*d" 7 -88s)) "-88    "
+    test "test249" (lazy(sprintf "%d" 104us)) "104"
+    test "test250" (lazy(sprintf "%5d" 104us)) "  104"
+    test "test251" (lazy(sprintf "%1d" 104us)) "104"
+    test "test252" (lazy(sprintf "%*d" 7 104us)) "    104"
+    test "test253" (lazy(sprintf "%-d" 104us)) "104"
+    test "test254" (lazy(sprintf "%-5d" 104us)) "104  "
+    test "test255" (lazy(sprintf "%-1d" 104us)) "104"
+    test "test256" (lazy(sprintf "%-*d" 7 104us)) "104    "
+    test "test257" (lazy(sprintf "%0d" 104us)) "104"
+    test "test258" (lazy(sprintf "%05d" 104us)) "00104"
+    test "test259" (lazy(sprintf "%01d" 104us)) "104"
+    test "test260" (lazy(sprintf "%0*d" 7 104us)) "0000104"
+    test "test261" (lazy(sprintf "%-0d" 104us)) "104"
+    test "test262" (lazy(sprintf "%-05d" 104us)) "104  "
+    test "test263" (lazy(sprintf "%-01d" 104us)) "104"
+    test "test264" (lazy(sprintf "%-0*d" 7 104us)) "104    "
+    test "test265" (lazy(sprintf "%+d" 104us)) "+104"
+    test "test266" (lazy(sprintf "%+5d" 104us)) " +104"
+    test "test267" (lazy(sprintf "%+1d" 104us)) "+104"
+    test "test268" (lazy(sprintf "%+*d" 7 104us)) "   +104"
+    test "test269" (lazy(sprintf "%-+d" 104us)) "+104"
+    test "test270" (lazy(sprintf "%-+5d" 104us)) "+104 "
+    test "test271" (lazy(sprintf "%-+1d" 104us)) "+104"
+    test "test272" (lazy(sprintf "%-+*d" 7 104us)) "+104   "
+    test "test273" (lazy(sprintf "%+0d" 104us)) "+104"
+    test "test274" (lazy(sprintf "%+05d" 104us)) "+0104"
+    test "test275" (lazy(sprintf "%+01d" 104us)) "+104"
+    test "test276" (lazy(sprintf "%+0*d" 7 104us)) "+000104"
+    test "test277" (lazy(sprintf "%-+0d" 104us)) "+104"
+    test "test278" (lazy(sprintf "%-+05d" 104us)) "+104 "
+    test "test279" (lazy(sprintf "%-+01d" 104us)) "+104"
+    test "test280" (lazy(sprintf "%-+0*d" 7 104us)) "+104   "
+    test "test281" (lazy(sprintf "% d" 104us)) " 104"
+    test "test282" (lazy(sprintf "% 5d" 104us)) "  104"
+    test "test283" (lazy(sprintf "% 1d" 104us)) " 104"
+    test "test284" (lazy(sprintf "% *d" 7 104us)) "    104"
+    test "test285" (lazy(sprintf "%- d" 104us)) " 104"
+    test "test286" (lazy(sprintf "%- 5d" 104us)) " 104 "
+    test "test287" (lazy(sprintf "%- 1d" 104us)) " 104"
+    test "test288" (lazy(sprintf "%- *d" 7 104us)) " 104   "
+    test "test289" (lazy(sprintf "% 0d" 104us)) " 104"
+    test "test290" (lazy(sprintf "% 05d" 104us)) " 0104"
+    test "test291" (lazy(sprintf "% 01d" 104us)) " 104"
+    test "test292" (lazy(sprintf "% 0*d" 7 104us)) " 000104"
+    test "test293" (lazy(sprintf "%- 0d" 104us)) " 104"
+    test "test294" (lazy(sprintf "%- 05d" 104us)) " 104 "
+    test "test295" (lazy(sprintf "%- 01d" 104us)) " 104"
+    test "test296" (lazy(sprintf "%- 0*d" 7 104us)) " 104   "
+    test "test297" (lazy(sprintf "%d" 12y)) "12"
+    test "test298" (lazy(sprintf "%5d" 12y)) "   12"
+    test "test299" (lazy(sprintf "%1d" 12y)) "12"
+    test "test300" (lazy(sprintf "%*d" 7 12y)) "     12"
+    test "test301" (lazy(sprintf "%-d" 12y)) "12"
+    test "test302" (lazy(sprintf "%-5d" 12y)) "12   "
+    test "test303" (lazy(sprintf "%-1d" 12y)) "12"
+    test "test304" (lazy(sprintf "%-*d" 7 12y)) "12     "
+    test "test305" (lazy(sprintf "%0d" 12y)) "12"
+    test "test306" (lazy(sprintf "%05d" 12y)) "00012"
+    test "test307" (lazy(sprintf "%01d" 12y)) "12"
+    test "test308" (lazy(sprintf "%0*d" 7 12y)) "0000012"
+    test "test309" (lazy(sprintf "%-0d" 12y)) "12"
+    test "test310" (lazy(sprintf "%-05d" 12y)) "12   "
+    test "test311" (lazy(sprintf "%-01d" 12y)) "12"
+    test "test312" (lazy(sprintf "%-0*d" 7 12y)) "12     "
+    test "test313" (lazy(sprintf "%+d" 12y)) "+12"
+    test "test314" (lazy(sprintf "%+5d" 12y)) "  +12"
+    test "test315" (lazy(sprintf "%+1d" 12y)) "+12"
+    test "test316" (lazy(sprintf "%+*d" 7 12y)) "    +12"
+    test "test317" (lazy(sprintf "%-+d" 12y)) "+12"
+    test "test318" (lazy(sprintf "%-+5d" 12y)) "+12  "
+    test "test319" (lazy(sprintf "%-+1d" 12y)) "+12"
+    test "test320" (lazy(sprintf "%-+*d" 7 12y)) "+12    "
+    test "test321" (lazy(sprintf "%+0d" 12y)) "+12"
+    test "test322" (lazy(sprintf "%+05d" 12y)) "+0012"
+    test "test323" (lazy(sprintf "%+01d" 12y)) "+12"
+    test "test324" (lazy(sprintf "%+0*d" 7 12y)) "+000012"
+    test "test325" (lazy(sprintf "%-+0d" 12y)) "+12"
+    test "test326" (lazy(sprintf "%-+05d" 12y)) "+12  "
+    test "test327" (lazy(sprintf "%-+01d" 12y)) "+12"
+    test "test328" (lazy(sprintf "%-+0*d" 7 12y)) "+12    "
+    test "test329" (lazy(sprintf "% d" 12y)) " 12"
+    test "test330" (lazy(sprintf "% 5d" 12y)) "   12"
+    test "test331" (lazy(sprintf "% 1d" 12y)) " 12"
+    test "test332" (lazy(sprintf "% *d" 7 12y)) "     12"
+    test "test333" (lazy(sprintf "%- d" 12y)) " 12"
+    test "test334" (lazy(sprintf "%- 5d" 12y)) " 12  "
+    test "test335" (lazy(sprintf "%- 1d" 12y)) " 12"
+    test "test336" (lazy(sprintf "%- *d" 7 12y)) " 12    "
+    test "test337" (lazy(sprintf "% 0d" 12y)) " 12"
+    test "test338" (lazy(sprintf "% 05d" 12y)) " 0012"
+    test "test339" (lazy(sprintf "% 01d" 12y)) " 12"
+    test "test340" (lazy(sprintf "% 0*d" 7 12y)) " 000012"
+    test "test341" (lazy(sprintf "%- 0d" 12y)) " 12"
+    test "test342" (lazy(sprintf "%- 05d" 12y)) " 12  "
+    test "test343" (lazy(sprintf "%- 01d" 12y)) " 12"
+    test "test344" (lazy(sprintf "%- 0*d" 7 12y)) " 12    "
+    test "test345" (lazy(sprintf "%d" -94y)) "-94"
+    test "test346" (lazy(sprintf "%5d" -94y)) "  -94"
+    test "test347" (lazy(sprintf "%1d" -94y)) "-94"
+    test "test348" (lazy(sprintf "%*d" 7 -94y)) "    -94"
+    test "test349" (lazy(sprintf "%-d" -94y)) "-94"
+    test "test350" (lazy(sprintf "%-5d" -94y)) "-94  "
+    test "test351" (lazy(sprintf "%-1d" -94y)) "-94"
+    test "test352" (lazy(sprintf "%-*d" 7 -94y)) "-94    "
+    test "test353" (lazy(sprintf "%0d" -94y)) "-94"
+    test "test354" (lazy(sprintf "%05d" -94y)) "-0094"
+    test "test355" (lazy(sprintf "%01d" -94y)) "-94"
+    test "test356" (lazy(sprintf "%0*d" 7 -94y)) "-000094"
+    test "test357" (lazy(sprintf "%-0d" -94y)) "-94"
+    test "test358" (lazy(sprintf "%-05d" -94y)) "-94  "
+    test "test359" (lazy(sprintf "%-01d" -94y)) "-94"
+    test "test360" (lazy(sprintf "%-0*d" 7 -94y)) "-94    "
+    test "test361" (lazy(sprintf "%+d" -94y)) "-94"
+    test "test362" (lazy(sprintf "%+5d" -94y)) "  -94"
+    test "test363" (lazy(sprintf "%+1d" -94y)) "-94"
+    test "test364" (lazy(sprintf "%+*d" 7 -94y)) "    -94"
+    test "test365" (lazy(sprintf "%-+d" -94y)) "-94"
+    test "test366" (lazy(sprintf "%-+5d" -94y)) "-94  "
+    test "test367" (lazy(sprintf "%-+1d" -94y)) "-94"
+    test "test368" (lazy(sprintf "%-+*d" 7 -94y)) "-94    "
+    test "test369" (lazy(sprintf "%+0d" -94y)) "-94"
+    test "test370" (lazy(sprintf "%+05d" -94y)) "-0094"
+    test "test371" (lazy(sprintf "%+01d" -94y)) "-94"
+    test "test372" (lazy(sprintf "%+0*d" 7 -94y)) "-000094"
+    test "test373" (lazy(sprintf "%-+0d" -94y)) "-94"
+    test "test374" (lazy(sprintf "%-+05d" -94y)) "-94  "
+    test "test375" (lazy(sprintf "%-+01d" -94y)) "-94"
+    test "test376" (lazy(sprintf "%-+0*d" 7 -94y)) "-94    "
+    test "test377" (lazy(sprintf "% d" -94y)) "-94"
+    test "test378" (lazy(sprintf "% 5d" -94y)) "  -94"
+    test "test379" (lazy(sprintf "% 1d" -94y)) "-94"
+    test "test380" (lazy(sprintf "% *d" 7 -94y)) "    -94"
+    test "test381" (lazy(sprintf "%- d" -94y)) "-94"
+    test "test382" (lazy(sprintf "%- 5d" -94y)) "-94  "
+    test "test383" (lazy(sprintf "%- 1d" -94y)) "-94"
+    test "test384" (lazy(sprintf "%- *d" 7 -94y)) "-94    "
+    test "test385" (lazy(sprintf "% 0d" -94y)) "-94"
+    test "test386" (lazy(sprintf "% 05d" -94y)) "-0094"
+    test "test387" (lazy(sprintf "% 01d" -94y)) "-94"
+    test "test388" (lazy(sprintf "% 0*d" 7 -94y)) "-000094"
+    test "test389" (lazy(sprintf "%- 0d" -94y)) "-94"
+    test "test390" (lazy(sprintf "%- 05d" -94y)) "-94  "
+    test "test391" (lazy(sprintf "%- 01d" -94y)) "-94"
+    test "test392" (lazy(sprintf "%- 0*d" 7 -94y)) "-94    "
+    test "test393" (lazy(sprintf "%d" 88uy)) "88"
+    test "test394" (lazy(sprintf "%5d" 88uy)) "   88"
+    test "test395" (lazy(sprintf "%1d" 88uy)) "88"
+    test "test396" (lazy(sprintf "%*d" 7 88uy)) "     88"
+    test "test397" (lazy(sprintf "%-d" 88uy)) "88"
+    test "test398" (lazy(sprintf "%-5d" 88uy)) "88   "
+    test "test399" (lazy(sprintf "%-1d" 88uy)) "88"
+    test "test400" (lazy(sprintf "%-*d" 7 88uy)) "88     "
+    test "test401" (lazy(sprintf "%0d" 88uy)) "88"
+    test "test402" (lazy(sprintf "%05d" 88uy)) "00088"
+    test "test403" (lazy(sprintf "%01d" 88uy)) "88"
+    test "test404" (lazy(sprintf "%0*d" 7 88uy)) "0000088"
+    test "test405" (lazy(sprintf "%-0d" 88uy)) "88"
+    test "test406" (lazy(sprintf "%-05d" 88uy)) "88   "
+    test "test407" (lazy(sprintf "%-01d" 88uy)) "88"
+    test "test408" (lazy(sprintf "%-0*d" 7 88uy)) "88     "
+    test "test409" (lazy(sprintf "%+d" 88uy)) "+88"
+    test "test410" (lazy(sprintf "%+5d" 88uy)) "  +88"
+    test "test411" (lazy(sprintf "%+1d" 88uy)) "+88"
+    test "test412" (lazy(sprintf "%+*d" 7 88uy)) "    +88"
+    test "test413" (lazy(sprintf "%-+d" 88uy)) "+88"
+    test "test414" (lazy(sprintf "%-+5d" 88uy)) "+88  "
+    test "test415" (lazy(sprintf "%-+1d" 88uy)) "+88"
+    test "test416" (lazy(sprintf "%-+*d" 7 88uy)) "+88    "
+    test "test417" (lazy(sprintf "%+0d" 88uy)) "+88"
+    test "test418" (lazy(sprintf "%+05d" 88uy)) "+0088"
+    test "test419" (lazy(sprintf "%+01d" 88uy)) "+88"
+    test "test420" (lazy(sprintf "%+0*d" 7 88uy)) "+000088"
+    test "test421" (lazy(sprintf "%-+0d" 88uy)) "+88"
+    test "test422" (lazy(sprintf "%-+05d" 88uy)) "+88  "
+    test "test423" (lazy(sprintf "%-+01d" 88uy)) "+88"
+    test "test424" (lazy(sprintf "%-+0*d" 7 88uy)) "+88    "
+    test "test425" (lazy(sprintf "% d" 88uy)) " 88"
+    test "test426" (lazy(sprintf "% 5d" 88uy)) "   88"
+    test "test427" (lazy(sprintf "% 1d" 88uy)) " 88"
+    test "test428" (lazy(sprintf "% *d" 7 88uy)) "     88"
+    test "test429" (lazy(sprintf "%- d" 88uy)) " 88"
+    test "test430" (lazy(sprintf "%- 5d" 88uy)) " 88  "
+    test "test431" (lazy(sprintf "%- 1d" 88uy)) " 88"
+    test "test432" (lazy(sprintf "%- *d" 7 88uy)) " 88    "
+    test "test433" (lazy(sprintf "% 0d" 88uy)) " 88"
+    test "test434" (lazy(sprintf "% 05d" 88uy)) " 0088"
+    test "test435" (lazy(sprintf "% 01d" 88uy)) " 88"
+    test "test436" (lazy(sprintf "% 0*d" 7 88uy)) " 000088"
+    test "test437" (lazy(sprintf "%- 0d" 88uy)) " 88"
+    test "test438" (lazy(sprintf "%- 05d" 88uy)) " 88  "
+    test "test439" (lazy(sprintf "%- 01d" 88uy)) " 88"
+    test "test440" (lazy(sprintf "%- 0*d" 7 88uy)) " 88    "
+    test "test441" (lazy(sprintf "%d" 999L)) "999"
+    test "test442" (lazy(sprintf "%5d" 999L)) "  999"
+    test "test443" (lazy(sprintf "%1d" 999L)) "999"
+    test "test444" (lazy(sprintf "%*d" 7 999L)) "    999"
+    test "test445" (lazy(sprintf "%-d" 999L)) "999"
+    test "test446" (lazy(sprintf "%-5d" 999L)) "999  "
+    test "test447" (lazy(sprintf "%-1d" 999L)) "999"
+    test "test448" (lazy(sprintf "%-*d" 7 999L)) "999    "
+    test "test449" (lazy(sprintf "%0d" 999L)) "999"
+    test "test450" (lazy(sprintf "%05d" 999L)) "00999"
+    test "test451" (lazy(sprintf "%01d" 999L)) "999"
+    test "test452" (lazy(sprintf "%0*d" 7 999L)) "0000999"
+    test "test453" (lazy(sprintf "%-0d" 999L)) "999"
+    test "test454" (lazy(sprintf "%-05d" 999L)) "999  "
+    test "test455" (lazy(sprintf "%-01d" 999L)) "999"
+    test "test456" (lazy(sprintf "%-0*d" 7 999L)) "999    "
+    test "test457" (lazy(sprintf "%+d" 999L)) "+999"
+    test "test458" (lazy(sprintf "%+5d" 999L)) " +999"
+    test "test459" (lazy(sprintf "%+1d" 999L)) "+999"
+    test "test460" (lazy(sprintf "%+*d" 7 999L)) "   +999"
+    test "test461" (lazy(sprintf "%-+d" 999L)) "+999"
+    test "test462" (lazy(sprintf "%-+5d" 999L)) "+999 "
+    test "test463" (lazy(sprintf "%-+1d" 999L)) "+999"
+    test "test464" (lazy(sprintf "%-+*d" 7 999L)) "+999   "
+    test "test465" (lazy(sprintf "%+0d" 999L)) "+999"
+    test "test466" (lazy(sprintf "%+05d" 999L)) "+0999"
+    test "test467" (lazy(sprintf "%+01d" 999L)) "+999"
+    test "test468" (lazy(sprintf "%+0*d" 7 999L)) "+000999"
+    test "test469" (lazy(sprintf "%-+0d" 999L)) "+999"
+    test "test470" (lazy(sprintf "%-+05d" 999L)) "+999 "
+    test "test471" (lazy(sprintf "%-+01d" 999L)) "+999"
+    test "test472" (lazy(sprintf "%-+0*d" 7 999L)) "+999   "
+    test "test473" (lazy(sprintf "% d" 999L)) " 999"
+    test "test474" (lazy(sprintf "% 5d" 999L)) "  999"
+    test "test475" (lazy(sprintf "% 1d" 999L)) " 999"
+    test "test476" (lazy(sprintf "% *d" 7 999L)) "    999"
+    test "test477" (lazy(sprintf "%- d" 999L)) " 999"
+    test "test478" (lazy(sprintf "%- 5d" 999L)) " 999 "
+    test "test479" (lazy(sprintf "%- 1d" 999L)) " 999"
+    test "test480" (lazy(sprintf "%- *d" 7 999L)) " 999   "
+    test "test481" (lazy(sprintf "% 0d" 999L)) " 999"
+    test "test482" (lazy(sprintf "% 05d" 999L)) " 0999"
+    test "test483" (lazy(sprintf "% 01d" 999L)) " 999"
+    test "test484" (lazy(sprintf "% 0*d" 7 999L)) " 000999"
+    test "test485" (lazy(sprintf "%- 0d" 999L)) " 999"
+    test "test486" (lazy(sprintf "%- 05d" 999L)) " 999 "
+    test "test487" (lazy(sprintf "%- 01d" 999L)) " 999"
+    test "test488" (lazy(sprintf "%- 0*d" 7 999L)) " 999   "
+    test "test489" (lazy(sprintf "%d" -321L)) "-321"
+    test "test490" (lazy(sprintf "%5d" -321L)) " -321"
+    test "test491" (lazy(sprintf "%1d" -321L)) "-321"
+    test "test492" (lazy(sprintf "%*d" 7 -321L)) "   -321"
+    test "test493" (lazy(sprintf "%-d" -321L)) "-321"
+    test "test494" (lazy(sprintf "%-5d" -321L)) "-321 "
+    test "test495" (lazy(sprintf "%-1d" -321L)) "-321"
+    test "test496" (lazy(sprintf "%-*d" 7 -321L)) "-321   "
+    test "test497" (lazy(sprintf "%0d" -321L)) "-321"
+    test "test498" (lazy(sprintf "%05d" -321L)) "-0321"
+    test "test499" (lazy(sprintf "%01d" -321L)) "-321"
+    test "test500" (lazy(sprintf "%0*d" 7 -321L)) "-000321"
+    test "test501" (lazy(sprintf "%-0d" -321L)) "-321"
+    test "test502" (lazy(sprintf "%-05d" -321L)) "-321 "
+    test "test503" (lazy(sprintf "%-01d" -321L)) "-321"
+    test "test504" (lazy(sprintf "%-0*d" 7 -321L)) "-321   "
+    test "test505" (lazy(sprintf "%+d" -321L)) "-321"
+    test "test506" (lazy(sprintf "%+5d" -321L)) " -321"
+    test "test507" (lazy(sprintf "%+1d" -321L)) "-321"
+    test "test508" (lazy(sprintf "%+*d" 7 -321L)) "   -321"
+    test "test509" (lazy(sprintf "%-+d" -321L)) "-321"
+    test "test510" (lazy(sprintf "%-+5d" -321L)) "-321 "
+    test "test511" (lazy(sprintf "%-+1d" -321L)) "-321"
+    test "test512" (lazy(sprintf "%-+*d" 7 -321L)) "-321   "
+    test "test513" (lazy(sprintf "%+0d" -321L)) "-321"
+    test "test514" (lazy(sprintf "%+05d" -321L)) "-0321"
+    test "test515" (lazy(sprintf "%+01d" -321L)) "-321"
+    test "test516" (lazy(sprintf "%+0*d" 7 -321L)) "-000321"
+    test "test517" (lazy(sprintf "%-+0d" -321L)) "-321"
+    test "test518" (lazy(sprintf "%-+05d" -321L)) "-321 "
+    test "test519" (lazy(sprintf "%-+01d" -321L)) "-321"
+    test "test520" (lazy(sprintf "%-+0*d" 7 -321L)) "-321   "
+    test "test521" (lazy(sprintf "% d" -321L)) "-321"
+    test "test522" (lazy(sprintf "% 5d" -321L)) " -321"
+    test "test523" (lazy(sprintf "% 1d" -321L)) "-321"
+    test "test524" (lazy(sprintf "% *d" 7 -321L)) "   -321"
+    test "test525" (lazy(sprintf "%- d" -321L)) "-321"
+    test "test526" (lazy(sprintf "%- 5d" -321L)) "-321 "
+    test "test527" (lazy(sprintf "%- 1d" -321L)) "-321"
+    test "test528" (lazy(sprintf "%- *d" 7 -321L)) "-321   "
+    test "test529" (lazy(sprintf "% 0d" -321L)) "-321"
+    test "test530" (lazy(sprintf "% 05d" -321L)) "-0321"
+    test "test531" (lazy(sprintf "% 01d" -321L)) "-321"
+    test "test532" (lazy(sprintf "% 0*d" 7 -321L)) "-000321"
+    test "test533" (lazy(sprintf "%- 0d" -321L)) "-321"
+    test "test534" (lazy(sprintf "%- 05d" -321L)) "-321 "
+    test "test535" (lazy(sprintf "%- 01d" -321L)) "-321"
+    test "test536" (lazy(sprintf "%- 0*d" 7 -321L)) "-321   "
+    test "test537" (lazy(sprintf "%d" 50000UL)) "50000"
+    test "test538" (lazy(sprintf "%5d" 50000UL)) "50000"
+    test "test539" (lazy(sprintf "%1d" 50000UL)) "50000"
+    test "test540" (lazy(sprintf "%*d" 7 50000UL)) "  50000"
+    test "test541" (lazy(sprintf "%-d" 50000UL)) "50000"
+    test "test542" (lazy(sprintf "%-5d" 50000UL)) "50000"
+    test "test543" (lazy(sprintf "%-1d" 50000UL)) "50000"
+    test "test544" (lazy(sprintf "%-*d" 7 50000UL)) "50000  "
+    test "test545" (lazy(sprintf "%0d" 50000UL)) "50000"
+    test "test546" (lazy(sprintf "%05d" 50000UL)) "50000"
+    test "test547" (lazy(sprintf "%01d" 50000UL)) "50000"
+    test "test548" (lazy(sprintf "%0*d" 7 50000UL)) "0050000"
+    test "test549" (lazy(sprintf "%-0d" 50000UL)) "50000"
+    test "test550" (lazy(sprintf "%-05d" 50000UL)) "50000"
+    test "test551" (lazy(sprintf "%-01d" 50000UL)) "50000"
+    test "test552" (lazy(sprintf "%-0*d" 7 50000UL)) "50000  "
+    test "test553" (lazy(sprintf "%+d" 50000UL)) "+50000"
+    test "test554" (lazy(sprintf "%+5d" 50000UL)) "+50000"
+    test "test555" (lazy(sprintf "%+1d" 50000UL)) "+50000"
+    test "test556" (lazy(sprintf "%+*d" 7 50000UL)) " +50000"
+    test "test557" (lazy(sprintf "%-+d" 50000UL)) "+50000"
+    test "test558" (lazy(sprintf "%-+5d" 50000UL)) "+50000"
+    test "test559" (lazy(sprintf "%-+1d" 50000UL)) "+50000"
+    test "test560" (lazy(sprintf "%-+*d" 7 50000UL)) "+50000 "
+    test "test561" (lazy(sprintf "%+0d" 50000UL)) "+50000"
+    test "test562" (lazy(sprintf "%+05d" 50000UL)) "+50000"
+    test "test563" (lazy(sprintf "%+01d" 50000UL)) "+50000"
+    test "test564" (lazy(sprintf "%+0*d" 7 50000UL)) "+050000"
+    test "test565" (lazy(sprintf "%-+0d" 50000UL)) "+50000"
+    test "test566" (lazy(sprintf "%-+05d" 50000UL)) "+50000"
+    test "test567" (lazy(sprintf "%-+01d" 50000UL)) "+50000"
+    test "test568" (lazy(sprintf "%-+0*d" 7 50000UL)) "+50000 "
+    test "test569" (lazy(sprintf "% d" 50000UL)) " 50000"
+    test "test570" (lazy(sprintf "% 5d" 50000UL)) " 50000"
+    test "test571" (lazy(sprintf "% 1d" 50000UL)) " 50000"
+    test "test572" (lazy(sprintf "% *d" 7 50000UL)) "  50000"
+    test "test573" (lazy(sprintf "%- d" 50000UL)) " 50000"
+    test "test574" (lazy(sprintf "%- 5d" 50000UL)) " 50000"
+    test "test575" (lazy(sprintf "%- 1d" 50000UL)) " 50000"
+    test "test576" (lazy(sprintf "%- *d" 7 50000UL)) " 50000 "
+    test "test577" (lazy(sprintf "% 0d" 50000UL)) " 50000"
+    test "test578" (lazy(sprintf "% 05d" 50000UL)) " 50000"
+    test "test579" (lazy(sprintf "% 01d" 50000UL)) " 50000"
+    test "test580" (lazy(sprintf "% 0*d" 7 50000UL)) " 050000"
+    test "test581" (lazy(sprintf "%- 0d" 50000UL)) " 50000"
+    test "test582" (lazy(sprintf "%- 05d" 50000UL)) " 50000"
+    test "test583" (lazy(sprintf "%- 01d" 50000UL)) " 50000"
+    test "test584" (lazy(sprintf "%- 0*d" 7 50000UL)) " 50000 "
+    test "test585" (lazy(sprintf "%d" System.Int32.MaxValue)) "2147483647"
+    test "test586" (lazy(sprintf "%5d" System.Int32.MaxValue)) "2147483647"
+    test "test587" (lazy(sprintf "%1d" System.Int32.MaxValue)) "2147483647"
+    test "test588" (lazy(sprintf "%*d" 7 System.Int32.MaxValue)) "2147483647"
+    test "test589" (lazy(sprintf "%-d" System.Int32.MaxValue)) "2147483647"
+    test "test590" (lazy(sprintf "%-5d" System.Int32.MaxValue)) "2147483647"
+    test "test591" (lazy(sprintf "%-1d" System.Int32.MaxValue)) "2147483647"
+    test "test592" (lazy(sprintf "%-*d" 7 System.Int32.MaxValue)) "2147483647"
+    test "test593" (lazy(sprintf "%0d" System.Int32.MaxValue)) "2147483647"
+    test "test594" (lazy(sprintf "%05d" System.Int32.MaxValue)) "2147483647"
+    test "test595" (lazy(sprintf "%01d" System.Int32.MaxValue)) "2147483647"
+    test "test596" (lazy(sprintf "%0*d" 7 System.Int32.MaxValue)) "2147483647"
+    test "test597" (lazy(sprintf "%-0d" System.Int32.MaxValue)) "2147483647"
+    test "test598" (lazy(sprintf "%-05d" System.Int32.MaxValue)) "2147483647"
+    test "test599" (lazy(sprintf "%-01d" System.Int32.MaxValue)) "2147483647"
+    test "test600" (lazy(sprintf "%-0*d" 7 System.Int32.MaxValue)) "2147483647"
+    test "test601" (lazy(sprintf "%+d" System.Int32.MaxValue)) "+2147483647"
+    test "test602" (lazy(sprintf "%+5d" System.Int32.MaxValue)) "+2147483647"
+    test "test603" (lazy(sprintf "%+1d" System.Int32.MaxValue)) "+2147483647"
+    test "test604" (lazy(sprintf "%+*d" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test605" (lazy(sprintf "%-+d" System.Int32.MaxValue)) "+2147483647"
+    test "test606" (lazy(sprintf "%-+5d" System.Int32.MaxValue)) "+2147483647"
+    test "test607" (lazy(sprintf "%-+1d" System.Int32.MaxValue)) "+2147483647"
+    test "test608" (lazy(sprintf "%-+*d" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test609" (lazy(sprintf "%+0d" System.Int32.MaxValue)) "+2147483647"
+    test "test610" (lazy(sprintf "%+05d" System.Int32.MaxValue)) "+2147483647"
+    test "test611" (lazy(sprintf "%+01d" System.Int32.MaxValue)) "+2147483647"
+    test "test612" (lazy(sprintf "%+0*d" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test613" (lazy(sprintf "%-+0d" System.Int32.MaxValue)) "+2147483647"
+    test "test614" (lazy(sprintf "%-+05d" System.Int32.MaxValue)) "+2147483647"
+    test "test615" (lazy(sprintf "%-+01d" System.Int32.MaxValue)) "+2147483647"
+    test "test616" (lazy(sprintf "%-+0*d" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test617" (lazy(sprintf "% d" System.Int32.MaxValue)) " 2147483647"
+    test "test618" (lazy(sprintf "% 5d" System.Int32.MaxValue)) " 2147483647"
+    test "test619" (lazy(sprintf "% 1d" System.Int32.MaxValue)) " 2147483647"
+    test "test620" (lazy(sprintf "% *d" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test621" (lazy(sprintf "%- d" System.Int32.MaxValue)) " 2147483647"
+    test "test622" (lazy(sprintf "%- 5d" System.Int32.MaxValue)) " 2147483647"
+    test "test623" (lazy(sprintf "%- 1d" System.Int32.MaxValue)) " 2147483647"
+    test "test624" (lazy(sprintf "%- *d" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test625" (lazy(sprintf "% 0d" System.Int32.MaxValue)) " 2147483647"
+    test "test626" (lazy(sprintf "% 05d" System.Int32.MaxValue)) " 2147483647"
+    test "test627" (lazy(sprintf "% 01d" System.Int32.MaxValue)) " 2147483647"
+    test "test628" (lazy(sprintf "% 0*d" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test629" (lazy(sprintf "%- 0d" System.Int32.MaxValue)) " 2147483647"
+    test "test630" (lazy(sprintf "%- 05d" System.Int32.MaxValue)) " 2147483647"
+    test "test631" (lazy(sprintf "%- 01d" System.Int32.MaxValue)) " 2147483647"
+    test "test632" (lazy(sprintf "%- 0*d" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test633" (lazy(sprintf "%d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test634" (lazy(sprintf "%5d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test635" (lazy(sprintf "%1d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test636" (lazy(sprintf "%*d" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test637" (lazy(sprintf "%-d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test638" (lazy(sprintf "%-5d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test639" (lazy(sprintf "%-1d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test640" (lazy(sprintf "%-*d" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test641" (lazy(sprintf "%0d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test642" (lazy(sprintf "%05d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test643" (lazy(sprintf "%01d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test644" (lazy(sprintf "%0*d" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test645" (lazy(sprintf "%-0d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test646" (lazy(sprintf "%-05d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test647" (lazy(sprintf "%-01d" System.Int64.MaxValue)) "9223372036854775807"
+    test "test648" (lazy(sprintf "%-0*d" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test649" (lazy(sprintf "%+d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test650" (lazy(sprintf "%+5d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test651" (lazy(sprintf "%+1d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test652" (lazy(sprintf "%+*d" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test653" (lazy(sprintf "%-+d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test654" (lazy(sprintf "%-+5d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test655" (lazy(sprintf "%-+1d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test656" (lazy(sprintf "%-+*d" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test657" (lazy(sprintf "%+0d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test658" (lazy(sprintf "%+05d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test659" (lazy(sprintf "%+01d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test660" (lazy(sprintf "%+0*d" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test661" (lazy(sprintf "%-+0d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test662" (lazy(sprintf "%-+05d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test663" (lazy(sprintf "%-+01d" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test664" (lazy(sprintf "%-+0*d" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test665" (lazy(sprintf "% d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test666" (lazy(sprintf "% 5d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test667" (lazy(sprintf "% 1d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test668" (lazy(sprintf "% *d" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test669" (lazy(sprintf "%- d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test670" (lazy(sprintf "%- 5d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test671" (lazy(sprintf "%- 1d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test672" (lazy(sprintf "%- *d" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test673" (lazy(sprintf "% 0d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test674" (lazy(sprintf "% 05d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test675" (lazy(sprintf "% 01d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test676" (lazy(sprintf "% 0*d" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test677" (lazy(sprintf "%- 0d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test678" (lazy(sprintf "%- 05d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test679" (lazy(sprintf "%- 01d" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test680" (lazy(sprintf "%- 0*d" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test681" (lazy(sprintf "%d" System.Int32.MinValue)) "-2147483648"
+    test "test682" (lazy(sprintf "%5d" System.Int32.MinValue)) "-2147483648"
+    test "test683" (lazy(sprintf "%1d" System.Int32.MinValue)) "-2147483648"
+    test "test684" (lazy(sprintf "%*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test685" (lazy(sprintf "%-d" System.Int32.MinValue)) "-2147483648"
+    test "test686" (lazy(sprintf "%-5d" System.Int32.MinValue)) "-2147483648"
+    test "test687" (lazy(sprintf "%-1d" System.Int32.MinValue)) "-2147483648"
+    test "test688" (lazy(sprintf "%-*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test689" (lazy(sprintf "%0d" System.Int32.MinValue)) "-2147483648"
+    test "test690" (lazy(sprintf "%05d" System.Int32.MinValue)) "-2147483648"
+    test "test691" (lazy(sprintf "%01d" System.Int32.MinValue)) "-2147483648"
+    test "test692" (lazy(sprintf "%0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test693" (lazy(sprintf "%-0d" System.Int32.MinValue)) "-2147483648"
+    test "test694" (lazy(sprintf "%-05d" System.Int32.MinValue)) "-2147483648"
+    test "test695" (lazy(sprintf "%-01d" System.Int32.MinValue)) "-2147483648"
+    test "test696" (lazy(sprintf "%-0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test697" (lazy(sprintf "%+d" System.Int32.MinValue)) "-2147483648"
+    test "test698" (lazy(sprintf "%+5d" System.Int32.MinValue)) "-2147483648"
+    test "test699" (lazy(sprintf "%+1d" System.Int32.MinValue)) "-2147483648"
+    test "test700" (lazy(sprintf "%+*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test701" (lazy(sprintf "%-+d" System.Int32.MinValue)) "-2147483648"
+    test "test702" (lazy(sprintf "%-+5d" System.Int32.MinValue)) "-2147483648"
+    test "test703" (lazy(sprintf "%-+1d" System.Int32.MinValue)) "-2147483648"
+    test "test704" (lazy(sprintf "%-+*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test705" (lazy(sprintf "%+0d" System.Int32.MinValue)) "-2147483648"
+    test "test706" (lazy(sprintf "%+05d" System.Int32.MinValue)) "-2147483648"
+    test "test707" (lazy(sprintf "%+01d" System.Int32.MinValue)) "-2147483648"
+    test "test708" (lazy(sprintf "%+0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test709" (lazy(sprintf "%-+0d" System.Int32.MinValue)) "-2147483648"
+    test "test710" (lazy(sprintf "%-+05d" System.Int32.MinValue)) "-2147483648"
+    test "test711" (lazy(sprintf "%-+01d" System.Int32.MinValue)) "-2147483648"
+    test "test712" (lazy(sprintf "%-+0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test713" (lazy(sprintf "% d" System.Int32.MinValue)) "-2147483648"
+    test "test714" (lazy(sprintf "% 5d" System.Int32.MinValue)) "-2147483648"
+    test "test715" (lazy(sprintf "% 1d" System.Int32.MinValue)) "-2147483648"
+    test "test716" (lazy(sprintf "% *d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test717" (lazy(sprintf "%- d" System.Int32.MinValue)) "-2147483648"
+    test "test718" (lazy(sprintf "%- 5d" System.Int32.MinValue)) "-2147483648"
+    test "test719" (lazy(sprintf "%- 1d" System.Int32.MinValue)) "-2147483648"
+    test "test720" (lazy(sprintf "%- *d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test721" (lazy(sprintf "% 0d" System.Int32.MinValue)) "-2147483648"
+    test "test722" (lazy(sprintf "% 05d" System.Int32.MinValue)) "-2147483648"
+    test "test723" (lazy(sprintf "% 01d" System.Int32.MinValue)) "-2147483648"
+    test "test724" (lazy(sprintf "% 0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test725" (lazy(sprintf "%- 0d" System.Int32.MinValue)) "-2147483648"
+    test "test726" (lazy(sprintf "%- 05d" System.Int32.MinValue)) "-2147483648"
+    test "test727" (lazy(sprintf "%- 01d" System.Int32.MinValue)) "-2147483648"
+    test "test728" (lazy(sprintf "%- 0*d" 7 System.Int32.MinValue)) "-2147483648"
+    test "test729" (lazy(sprintf "%d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test730" (lazy(sprintf "%5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test731" (lazy(sprintf "%1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test732" (lazy(sprintf "%*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test733" (lazy(sprintf "%-d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test734" (lazy(sprintf "%-5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test735" (lazy(sprintf "%-1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test736" (lazy(sprintf "%-*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test737" (lazy(sprintf "%0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test738" (lazy(sprintf "%05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test739" (lazy(sprintf "%01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test740" (lazy(sprintf "%0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test741" (lazy(sprintf "%-0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test742" (lazy(sprintf "%-05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test743" (lazy(sprintf "%-01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test744" (lazy(sprintf "%-0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test745" (lazy(sprintf "%+d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test746" (lazy(sprintf "%+5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test747" (lazy(sprintf "%+1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test748" (lazy(sprintf "%+*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test749" (lazy(sprintf "%-+d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test750" (lazy(sprintf "%-+5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test751" (lazy(sprintf "%-+1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test752" (lazy(sprintf "%-+*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test753" (lazy(sprintf "%+0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test754" (lazy(sprintf "%+05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test755" (lazy(sprintf "%+01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test756" (lazy(sprintf "%+0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test757" (lazy(sprintf "%-+0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test758" (lazy(sprintf "%-+05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test759" (lazy(sprintf "%-+01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test760" (lazy(sprintf "%-+0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test761" (lazy(sprintf "% d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test762" (lazy(sprintf "% 5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test763" (lazy(sprintf "% 1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test764" (lazy(sprintf "% *d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test765" (lazy(sprintf "%- d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test766" (lazy(sprintf "%- 5d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test767" (lazy(sprintf "%- 1d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test768" (lazy(sprintf "%- *d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test769" (lazy(sprintf "% 0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test770" (lazy(sprintf "% 05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test771" (lazy(sprintf "% 01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test772" (lazy(sprintf "% 0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test773" (lazy(sprintf "%- 0d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test774" (lazy(sprintf "%- 05d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test775" (lazy(sprintf "%- 01d" System.Int64.MinValue)) "-9223372036854775808"
+    test "test776" (lazy(sprintf "%- 0*d" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test777" (lazy(sprintf "%d" 55n)) "55"
+    test "test778" (lazy(sprintf "%5d" 55n)) "   55"
+    test "test779" (lazy(sprintf "%1d" 55n)) "55"
+    test "test780" (lazy(sprintf "%*d" 7 55n)) "     55"
+    test "test781" (lazy(sprintf "%-d" 55n)) "55"
+    test "test782" (lazy(sprintf "%-5d" 55n)) "55   "
+    test "test783" (lazy(sprintf "%-1d" 55n)) "55"
+    test "test784" (lazy(sprintf "%-*d" 7 55n)) "55     "
+    test "test785" (lazy(sprintf "%0d" 55n)) "55"
+    test "test786" (lazy(sprintf "%05d" 55n)) "00055"
+    test "test787" (lazy(sprintf "%01d" 55n)) "55"
+    test "test788" (lazy(sprintf "%0*d" 7 55n)) "0000055"
+    test "test789" (lazy(sprintf "%-0d" 55n)) "55"
+    test "test790" (lazy(sprintf "%-05d" 55n)) "55   "
+    test "test791" (lazy(sprintf "%-01d" 55n)) "55"
+    test "test792" (lazy(sprintf "%-0*d" 7 55n)) "55     "
+    test "test793" (lazy(sprintf "%+d" 55n)) "+55"
+    test "test794" (lazy(sprintf "%+5d" 55n)) "  +55"
+    test "test795" (lazy(sprintf "%+1d" 55n)) "+55"
+    test "test796" (lazy(sprintf "%+*d" 7 55n)) "    +55"
+    test "test797" (lazy(sprintf "%-+d" 55n)) "+55"
+    test "test798" (lazy(sprintf "%-+5d" 55n)) "+55  "
+    test "test799" (lazy(sprintf "%-+1d" 55n)) "+55"
+    test "test800" (lazy(sprintf "%-+*d" 7 55n)) "+55    "
+    test "test801" (lazy(sprintf "%+0d" 55n)) "+55"
+    test "test802" (lazy(sprintf "%+05d" 55n)) "+0055"
+    test "test803" (lazy(sprintf "%+01d" 55n)) "+55"
+    test "test804" (lazy(sprintf "%+0*d" 7 55n)) "+000055"
+    test "test805" (lazy(sprintf "%-+0d" 55n)) "+55"
+    test "test806" (lazy(sprintf "%-+05d" 55n)) "+55  "
+    test "test807" (lazy(sprintf "%-+01d" 55n)) "+55"
+    test "test808" (lazy(sprintf "%-+0*d" 7 55n)) "+55    "
+    test "test809" (lazy(sprintf "% d" 55n)) " 55"
+    test "test810" (lazy(sprintf "% 5d" 55n)) "   55"
+    test "test811" (lazy(sprintf "% 1d" 55n)) " 55"
+    test "test812" (lazy(sprintf "% *d" 7 55n)) "     55"
+    test "test813" (lazy(sprintf "%- d" 55n)) " 55"
+    test "test814" (lazy(sprintf "%- 5d" 55n)) " 55  "
+    test "test815" (lazy(sprintf "%- 1d" 55n)) " 55"
+    test "test816" (lazy(sprintf "%- *d" 7 55n)) " 55    "
+    test "test817" (lazy(sprintf "% 0d" 55n)) " 55"
+    test "test818" (lazy(sprintf "% 05d" 55n)) " 0055"
+    test "test819" (lazy(sprintf "% 01d" 55n)) " 55"
+    test "test820" (lazy(sprintf "% 0*d" 7 55n)) " 000055"
+    test "test821" (lazy(sprintf "%- 0d" 55n)) " 55"
+    test "test822" (lazy(sprintf "%- 05d" 55n)) " 55  "
+    test "test823" (lazy(sprintf "%- 01d" 55n)) " 55"
+    test "test824" (lazy(sprintf "%- 0*d" 7 55n)) " 55    "
+    test "test825" (lazy(sprintf "%d" 999un)) "999"
+    test "test826" (lazy(sprintf "%5d" 999un)) "  999"
+    test "test827" (lazy(sprintf "%1d" 999un)) "999"
+    test "test828" (lazy(sprintf "%*d" 7 999un)) "    999"
+    test "test829" (lazy(sprintf "%-d" 999un)) "999"
+    test "test830" (lazy(sprintf "%-5d" 999un)) "999  "
+    test "test831" (lazy(sprintf "%-1d" 999un)) "999"
+    test "test832" (lazy(sprintf "%-*d" 7 999un)) "999    "
+    test "test833" (lazy(sprintf "%0d" 999un)) "999"
+    test "test834" (lazy(sprintf "%05d" 999un)) "00999"
+    test "test835" (lazy(sprintf "%01d" 999un)) "999"
+    test "test836" (lazy(sprintf "%0*d" 7 999un)) "0000999"
+    test "test837" (lazy(sprintf "%-0d" 999un)) "999"
+    test "test838" (lazy(sprintf "%-05d" 999un)) "999  "
+    test "test839" (lazy(sprintf "%-01d" 999un)) "999"
+    test "test840" (lazy(sprintf "%-0*d" 7 999un)) "999    "
+    test "test841" (lazy(sprintf "%+d" 999un)) "+999"
+    test "test842" (lazy(sprintf "%+5d" 999un)) " +999"
+    test "test843" (lazy(sprintf "%+1d" 999un)) "+999"
+    test "test844" (lazy(sprintf "%+*d" 7 999un)) "   +999"
+    test "test845" (lazy(sprintf "%-+d" 999un)) "+999"
+    test "test846" (lazy(sprintf "%-+5d" 999un)) "+999 "
+    test "test847" (lazy(sprintf "%-+1d" 999un)) "+999"
+    test "test848" (lazy(sprintf "%-+*d" 7 999un)) "+999   "
+    test "test849" (lazy(sprintf "%+0d" 999un)) "+999"
+    test "test850" (lazy(sprintf "%+05d" 999un)) "+0999"
+    test "test851" (lazy(sprintf "%+01d" 999un)) "+999"
+    test "test852" (lazy(sprintf "%+0*d" 7 999un)) "+000999"
+    test "test853" (lazy(sprintf "%-+0d" 999un)) "+999"
+    test "test854" (lazy(sprintf "%-+05d" 999un)) "+999 "
+    test "test855" (lazy(sprintf "%-+01d" 999un)) "+999"
+    test "test856" (lazy(sprintf "%-+0*d" 7 999un)) "+999   "
+    test "test857" (lazy(sprintf "% d" 999un)) " 999"
+    test "test858" (lazy(sprintf "% 5d" 999un)) "  999"
+    test "test859" (lazy(sprintf "% 1d" 999un)) " 999"
+    test "test860" (lazy(sprintf "% *d" 7 999un)) "    999"
+    test "test861" (lazy(sprintf "%- d" 999un)) " 999"
+    test "test862" (lazy(sprintf "%- 5d" 999un)) " 999 "
+    test "test863" (lazy(sprintf "%- 1d" 999un)) " 999"
+    test "test864" (lazy(sprintf "%- *d" 7 999un)) " 999   "
+    test "test865" (lazy(sprintf "% 0d" 999un)) " 999"
+    test "test866" (lazy(sprintf "% 05d" 999un)) " 0999"
+    test "test867" (lazy(sprintf "% 01d" 999un)) " 999"
+    test "test868" (lazy(sprintf "% 0*d" 7 999un)) " 000999"
+    test "test869" (lazy(sprintf "%- 0d" 999un)) " 999"
+    test "test870" (lazy(sprintf "%- 05d" 999un)) " 999 "
+    test "test871" (lazy(sprintf "%- 01d" 999un)) " 999"
+    test "test872" (lazy(sprintf "%- 0*d" 7 999un)) " 999   "
+    test "test873" (lazy(sprintf "%i" 14)) "14"
+    test "test874" (lazy(sprintf "%5i" 14)) "   14"
+    test "test875" (lazy(sprintf "%1i" 14)) "14"
+    test "test876" (lazy(sprintf "%*i" 7 14)) "     14"
+    test "test877" (lazy(sprintf "%-i" 14)) "14"
+    test "test878" (lazy(sprintf "%-5i" 14)) "14   "
+    test "test879" (lazy(sprintf "%-1i" 14)) "14"
+    test "test880" (lazy(sprintf "%-*i" 7 14)) "14     "
+    test "test881" (lazy(sprintf "%0i" 14)) "14"
+    test "test882" (lazy(sprintf "%05i" 14)) "00014"
+    test "test883" (lazy(sprintf "%01i" 14)) "14"
+    test "test884" (lazy(sprintf "%0*i" 7 14)) "0000014"
+    test "test885" (lazy(sprintf "%-0i" 14)) "14"
+    test "test886" (lazy(sprintf "%-05i" 14)) "14   "
+    test "test887" (lazy(sprintf "%-01i" 14)) "14"
+    test "test888" (lazy(sprintf "%-0*i" 7 14)) "14     "
+    test "test889" (lazy(sprintf "%+i" 14)) "+14"
+    test "test890" (lazy(sprintf "%+5i" 14)) "  +14"
+    test "test891" (lazy(sprintf "%+1i" 14)) "+14"
+    test "test892" (lazy(sprintf "%+*i" 7 14)) "    +14"
+    test "test893" (lazy(sprintf "%-+i" 14)) "+14"
+    test "test894" (lazy(sprintf "%-+5i" 14)) "+14  "
+    test "test895" (lazy(sprintf "%-+1i" 14)) "+14"
+    test "test896" (lazy(sprintf "%-+*i" 7 14)) "+14    "
+    test "test897" (lazy(sprintf "%+0i" 14)) "+14"
+    test "test898" (lazy(sprintf "%+05i" 14)) "+0014"
+    test "test899" (lazy(sprintf "%+01i" 14)) "+14"
+    test "test900" (lazy(sprintf "%+0*i" 7 14)) "+000014"
+    test "test901" (lazy(sprintf "%-+0i" 14)) "+14"
+    test "test902" (lazy(sprintf "%-+05i" 14)) "+14  "
+    test "test903" (lazy(sprintf "%-+01i" 14)) "+14"
+    test "test904" (lazy(sprintf "%-+0*i" 7 14)) "+14    "
+    test "test905" (lazy(sprintf "% i" 14)) " 14"
+    test "test906" (lazy(sprintf "% 5i" 14)) "   14"
+    test "test907" (lazy(sprintf "% 1i" 14)) " 14"
+    test "test908" (lazy(sprintf "% *i" 7 14)) "     14"
+    test "test909" (lazy(sprintf "%- i" 14)) " 14"
+    test "test910" (lazy(sprintf "%- 5i" 14)) " 14  "
+    test "test911" (lazy(sprintf "%- 1i" 14)) " 14"
+    test "test912" (lazy(sprintf "%- *i" 7 14)) " 14    "
+    test "test913" (lazy(sprintf "% 0i" 14)) " 14"
+    test "test914" (lazy(sprintf "% 05i" 14)) " 0014"
+    test "test915" (lazy(sprintf "% 01i" 14)) " 14"
+    test "test916" (lazy(sprintf "% 0*i" 7 14)) " 000014"
+    test "test917" (lazy(sprintf "%- 0i" 14)) " 14"
+    test "test918" (lazy(sprintf "%- 05i" 14)) " 14  "
+    test "test919" (lazy(sprintf "%- 01i" 14)) " 14"
+    test "test920" (lazy(sprintf "%- 0*i" 7 14)) " 14    "
+    test "test921" (lazy(sprintf "%i" -10)) "-10"
+    test "test922" (lazy(sprintf "%5i" -10)) "  -10"
+    test "test923" (lazy(sprintf "%1i" -10)) "-10"
+    test "test924" (lazy(sprintf "%*i" 7 -10)) "    -10"
+    test "test925" (lazy(sprintf "%-i" -10)) "-10"
+    test "test926" (lazy(sprintf "%-5i" -10)) "-10  "
+    test "test927" (lazy(sprintf "%-1i" -10)) "-10"
+    test "test928" (lazy(sprintf "%-*i" 7 -10)) "-10    "
+    test "test929" (lazy(sprintf "%0i" -10)) "-10"
+    test "test930" (lazy(sprintf "%05i" -10)) "-0010"
+    test "test931" (lazy(sprintf "%01i" -10)) "-10"
+    test "test932" (lazy(sprintf "%0*i" 7 -10)) "-000010"
+    test "test933" (lazy(sprintf "%-0i" -10)) "-10"
+    test "test934" (lazy(sprintf "%-05i" -10)) "-10  "
+    test "test935" (lazy(sprintf "%-01i" -10)) "-10"
+    test "test936" (lazy(sprintf "%-0*i" 7 -10)) "-10    "
+    test "test937" (lazy(sprintf "%+i" -10)) "-10"
+    test "test938" (lazy(sprintf "%+5i" -10)) "  -10"
+    test "test939" (lazy(sprintf "%+1i" -10)) "-10"
+    test "test940" (lazy(sprintf "%+*i" 7 -10)) "    -10"
+    test "test941" (lazy(sprintf "%-+i" -10)) "-10"
+    test "test942" (lazy(sprintf "%-+5i" -10)) "-10  "
+    test "test943" (lazy(sprintf "%-+1i" -10)) "-10"
+    test "test944" (lazy(sprintf "%-+*i" 7 -10)) "-10    "
+    test "test945" (lazy(sprintf "%+0i" -10)) "-10"
+    test "test946" (lazy(sprintf "%+05i" -10)) "-0010"
+    test "test947" (lazy(sprintf "%+01i" -10)) "-10"
+    test "test948" (lazy(sprintf "%+0*i" 7 -10)) "-000010"
+    test "test949" (lazy(sprintf "%-+0i" -10)) "-10"
+    test "test950" (lazy(sprintf "%-+05i" -10)) "-10  "
+    test "test951" (lazy(sprintf "%-+01i" -10)) "-10"
+    test "test952" (lazy(sprintf "%-+0*i" 7 -10)) "-10    "
+    test "test953" (lazy(sprintf "% i" -10)) "-10"
+    test "test954" (lazy(sprintf "% 5i" -10)) "  -10"
+    test "test955" (lazy(sprintf "% 1i" -10)) "-10"
+    test "test956" (lazy(sprintf "% *i" 7 -10)) "    -10"
+    test "test957" (lazy(sprintf "%- i" -10)) "-10"
+    test "test958" (lazy(sprintf "%- 5i" -10)) "-10  "
+    test "test959" (lazy(sprintf "%- 1i" -10)) "-10"
+    test "test960" (lazy(sprintf "%- *i" 7 -10)) "-10    "
+    test "test961" (lazy(sprintf "% 0i" -10)) "-10"
+    test "test962" (lazy(sprintf "% 05i" -10)) "-0010"
+    test "test963" (lazy(sprintf "% 01i" -10)) "-10"
+    test "test964" (lazy(sprintf "% 0*i" 7 -10)) "-000010"
+    test "test965" (lazy(sprintf "%- 0i" -10)) "-10"
+    test "test966" (lazy(sprintf "%- 05i" -10)) "-10  "
+    test "test967" (lazy(sprintf "%- 01i" -10)) "-10"
+    test "test968" (lazy(sprintf "%- 0*i" 7 -10)) "-10    "
+    test "test969" (lazy(sprintf "%i" 55s)) "55"
+    test "test970" (lazy(sprintf "%5i" 55s)) "   55"
+    test "test971" (lazy(sprintf "%1i" 55s)) "55"
+    test "test972" (lazy(sprintf "%*i" 7 55s)) "     55"
+    test "test973" (lazy(sprintf "%-i" 55s)) "55"
+    test "test974" (lazy(sprintf "%-5i" 55s)) "55   "
+    test "test975" (lazy(sprintf "%-1i" 55s)) "55"
+    test "test976" (lazy(sprintf "%-*i" 7 55s)) "55     "
+    test "test977" (lazy(sprintf "%0i" 55s)) "55"
+    test "test978" (lazy(sprintf "%05i" 55s)) "00055"
+    test "test979" (lazy(sprintf "%01i" 55s)) "55"
+    test "test980" (lazy(sprintf "%0*i" 7 55s)) "0000055"
+    test "test981" (lazy(sprintf "%-0i" 55s)) "55"
+    test "test982" (lazy(sprintf "%-05i" 55s)) "55   "
+    test "test983" (lazy(sprintf "%-01i" 55s)) "55"
+    test "test984" (lazy(sprintf "%-0*i" 7 55s)) "55     "
+    test "test985" (lazy(sprintf "%+i" 55s)) "+55"
+    test "test986" (lazy(sprintf "%+5i" 55s)) "  +55"
+    test "test987" (lazy(sprintf "%+1i" 55s)) "+55"
+    test "test988" (lazy(sprintf "%+*i" 7 55s)) "    +55"
+    test "test989" (lazy(sprintf "%-+i" 55s)) "+55"
+    test "test990" (lazy(sprintf "%-+5i" 55s)) "+55  "
+    test "test991" (lazy(sprintf "%-+1i" 55s)) "+55"
+    test "test992" (lazy(sprintf "%-+*i" 7 55s)) "+55    "
+    test "test993" (lazy(sprintf "%+0i" 55s)) "+55"
+    test "test994" (lazy(sprintf "%+05i" 55s)) "+0055"
+    test "test995" (lazy(sprintf "%+01i" 55s)) "+55"
+    test "test996" (lazy(sprintf "%+0*i" 7 55s)) "+000055"
+    test "test997" (lazy(sprintf "%-+0i" 55s)) "+55"
+    test "test998" (lazy(sprintf "%-+05i" 55s)) "+55  "
+    test "test999" (lazy(sprintf "%-+01i" 55s)) "+55"
+    test "test1000" (lazy(sprintf "%-+0*i" 7 55s)) "+55    "
+let func1000()=
+    test "test1001" (lazy(sprintf "% i" 55s)) " 55"
+    test "test1002" (lazy(sprintf "% 5i" 55s)) "   55"
+    test "test1003" (lazy(sprintf "% 1i" 55s)) " 55"
+    test "test1004" (lazy(sprintf "% *i" 7 55s)) "     55"
+    test "test1005" (lazy(sprintf "%- i" 55s)) " 55"
+    test "test1006" (lazy(sprintf "%- 5i" 55s)) " 55  "
+    test "test1007" (lazy(sprintf "%- 1i" 55s)) " 55"
+    test "test1008" (lazy(sprintf "%- *i" 7 55s)) " 55    "
+    test "test1009" (lazy(sprintf "% 0i" 55s)) " 55"
+    test "test1010" (lazy(sprintf "% 05i" 55s)) " 0055"
+    test "test1011" (lazy(sprintf "% 01i" 55s)) " 55"
+    test "test1012" (lazy(sprintf "% 0*i" 7 55s)) " 000055"
+    test "test1013" (lazy(sprintf "%- 0i" 55s)) " 55"
+    test "test1014" (lazy(sprintf "%- 05i" 55s)) " 55  "
+    test "test1015" (lazy(sprintf "%- 01i" 55s)) " 55"
+    test "test1016" (lazy(sprintf "%- 0*i" 7 55s)) " 55    "
+    test "test1017" (lazy(sprintf "%i" -88s)) "-88"
+    test "test1018" (lazy(sprintf "%5i" -88s)) "  -88"
+    test "test1019" (lazy(sprintf "%1i" -88s)) "-88"
+    test "test1020" (lazy(sprintf "%*i" 7 -88s)) "    -88"
+    test "test1021" (lazy(sprintf "%-i" -88s)) "-88"
+    test "test1022" (lazy(sprintf "%-5i" -88s)) "-88  "
+    test "test1023" (lazy(sprintf "%-1i" -88s)) "-88"
+    test "test1024" (lazy(sprintf "%-*i" 7 -88s)) "-88    "
+    test "test1025" (lazy(sprintf "%0i" -88s)) "-88"
+    test "test1026" (lazy(sprintf "%05i" -88s)) "-0088"
+    test "test1027" (lazy(sprintf "%01i" -88s)) "-88"
+    test "test1028" (lazy(sprintf "%0*i" 7 -88s)) "-000088"
+    test "test1029" (lazy(sprintf "%-0i" -88s)) "-88"
+    test "test1030" (lazy(sprintf "%-05i" -88s)) "-88  "
+    test "test1031" (lazy(sprintf "%-01i" -88s)) "-88"
+    test "test1032" (lazy(sprintf "%-0*i" 7 -88s)) "-88    "
+    test "test1033" (lazy(sprintf "%+i" -88s)) "-88"
+    test "test1034" (lazy(sprintf "%+5i" -88s)) "  -88"
+    test "test1035" (lazy(sprintf "%+1i" -88s)) "-88"
+    test "test1036" (lazy(sprintf "%+*i" 7 -88s)) "    -88"
+    test "test1037" (lazy(sprintf "%-+i" -88s)) "-88"
+    test "test1038" (lazy(sprintf "%-+5i" -88s)) "-88  "
+    test "test1039" (lazy(sprintf "%-+1i" -88s)) "-88"
+    test "test1040" (lazy(sprintf "%-+*i" 7 -88s)) "-88    "
+    test "test1041" (lazy(sprintf "%+0i" -88s)) "-88"
+    test "test1042" (lazy(sprintf "%+05i" -88s)) "-0088"
+    test "test1043" (lazy(sprintf "%+01i" -88s)) "-88"
+    test "test1044" (lazy(sprintf "%+0*i" 7 -88s)) "-000088"
+    test "test1045" (lazy(sprintf "%-+0i" -88s)) "-88"
+    test "test1046" (lazy(sprintf "%-+05i" -88s)) "-88  "
+    test "test1047" (lazy(sprintf "%-+01i" -88s)) "-88"
+    test "test1048" (lazy(sprintf "%-+0*i" 7 -88s)) "-88    "
+    test "test1049" (lazy(sprintf "% i" -88s)) "-88"
+    test "test1050" (lazy(sprintf "% 5i" -88s)) "  -88"
+    test "test1051" (lazy(sprintf "% 1i" -88s)) "-88"
+    test "test1052" (lazy(sprintf "% *i" 7 -88s)) "    -88"
+    test "test1053" (lazy(sprintf "%- i" -88s)) "-88"
+    test "test1054" (lazy(sprintf "%- 5i" -88s)) "-88  "
+    test "test1055" (lazy(sprintf "%- 1i" -88s)) "-88"
+    test "test1056" (lazy(sprintf "%- *i" 7 -88s)) "-88    "
+    test "test1057" (lazy(sprintf "% 0i" -88s)) "-88"
+    test "test1058" (lazy(sprintf "% 05i" -88s)) "-0088"
+    test "test1059" (lazy(sprintf "% 01i" -88s)) "-88"
+    test "test1060" (lazy(sprintf "% 0*i" 7 -88s)) "-000088"
+    test "test1061" (lazy(sprintf "%- 0i" -88s)) "-88"
+    test "test1062" (lazy(sprintf "%- 05i" -88s)) "-88  "
+    test "test1063" (lazy(sprintf "%- 01i" -88s)) "-88"
+    test "test1064" (lazy(sprintf "%- 0*i" 7 -88s)) "-88    "
+    test "test1065" (lazy(sprintf "%i" 104us)) "104"
+    test "test1066" (lazy(sprintf "%5i" 104us)) "  104"
+    test "test1067" (lazy(sprintf "%1i" 104us)) "104"
+    test "test1068" (lazy(sprintf "%*i" 7 104us)) "    104"
+    test "test1069" (lazy(sprintf "%-i" 104us)) "104"
+    test "test1070" (lazy(sprintf "%-5i" 104us)) "104  "
+    test "test1071" (lazy(sprintf "%-1i" 104us)) "104"
+    test "test1072" (lazy(sprintf "%-*i" 7 104us)) "104    "
+    test "test1073" (lazy(sprintf "%0i" 104us)) "104"
+    test "test1074" (lazy(sprintf "%05i" 104us)) "00104"
+    test "test1075" (lazy(sprintf "%01i" 104us)) "104"
+    test "test1076" (lazy(sprintf "%0*i" 7 104us)) "0000104"
+    test "test1077" (lazy(sprintf "%-0i" 104us)) "104"
+    test "test1078" (lazy(sprintf "%-05i" 104us)) "104  "
+    test "test1079" (lazy(sprintf "%-01i" 104us)) "104"
+    test "test1080" (lazy(sprintf "%-0*i" 7 104us)) "104    "
+    test "test1081" (lazy(sprintf "%+i" 104us)) "+104"
+    test "test1082" (lazy(sprintf "%+5i" 104us)) " +104"
+    test "test1083" (lazy(sprintf "%+1i" 104us)) "+104"
+    test "test1084" (lazy(sprintf "%+*i" 7 104us)) "   +104"
+    test "test1085" (lazy(sprintf "%-+i" 104us)) "+104"
+    test "test1086" (lazy(sprintf "%-+5i" 104us)) "+104 "
+    test "test1087" (lazy(sprintf "%-+1i" 104us)) "+104"
+    test "test1088" (lazy(sprintf "%-+*i" 7 104us)) "+104   "
+    test "test1089" (lazy(sprintf "%+0i" 104us)) "+104"
+    test "test1090" (lazy(sprintf "%+05i" 104us)) "+0104"
+    test "test1091" (lazy(sprintf "%+01i" 104us)) "+104"
+    test "test1092" (lazy(sprintf "%+0*i" 7 104us)) "+000104"
+    test "test1093" (lazy(sprintf "%-+0i" 104us)) "+104"
+    test "test1094" (lazy(sprintf "%-+05i" 104us)) "+104 "
+    test "test1095" (lazy(sprintf "%-+01i" 104us)) "+104"
+    test "test1096" (lazy(sprintf "%-+0*i" 7 104us)) "+104   "
+    test "test1097" (lazy(sprintf "% i" 104us)) " 104"
+    test "test1098" (lazy(sprintf "% 5i" 104us)) "  104"
+    test "test1099" (lazy(sprintf "% 1i" 104us)) " 104"
+    test "test1100" (lazy(sprintf "% *i" 7 104us)) "    104"
+    test "test1101" (lazy(sprintf "%- i" 104us)) " 104"
+    test "test1102" (lazy(sprintf "%- 5i" 104us)) " 104 "
+    test "test1103" (lazy(sprintf "%- 1i" 104us)) " 104"
+    test "test1104" (lazy(sprintf "%- *i" 7 104us)) " 104   "
+    test "test1105" (lazy(sprintf "% 0i" 104us)) " 104"
+    test "test1106" (lazy(sprintf "% 05i" 104us)) " 0104"
+    test "test1107" (lazy(sprintf "% 01i" 104us)) " 104"
+    test "test1108" (lazy(sprintf "% 0*i" 7 104us)) " 000104"
+    test "test1109" (lazy(sprintf "%- 0i" 104us)) " 104"
+    test "test1110" (lazy(sprintf "%- 05i" 104us)) " 104 "
+    test "test1111" (lazy(sprintf "%- 01i" 104us)) " 104"
+    test "test1112" (lazy(sprintf "%- 0*i" 7 104us)) " 104   "
+    test "test1113" (lazy(sprintf "%i" 12y)) "12"
+    test "test1114" (lazy(sprintf "%5i" 12y)) "   12"
+    test "test1115" (lazy(sprintf "%1i" 12y)) "12"
+    test "test1116" (lazy(sprintf "%*i" 7 12y)) "     12"
+    test "test1117" (lazy(sprintf "%-i" 12y)) "12"
+    test "test1118" (lazy(sprintf "%-5i" 12y)) "12   "
+    test "test1119" (lazy(sprintf "%-1i" 12y)) "12"
+    test "test1120" (lazy(sprintf "%-*i" 7 12y)) "12     "
+    test "test1121" (lazy(sprintf "%0i" 12y)) "12"
+    test "test1122" (lazy(sprintf "%05i" 12y)) "00012"
+    test "test1123" (lazy(sprintf "%01i" 12y)) "12"
+    test "test1124" (lazy(sprintf "%0*i" 7 12y)) "0000012"
+    test "test1125" (lazy(sprintf "%-0i" 12y)) "12"
+    test "test1126" (lazy(sprintf "%-05i" 12y)) "12   "
+    test "test1127" (lazy(sprintf "%-01i" 12y)) "12"
+    test "test1128" (lazy(sprintf "%-0*i" 7 12y)) "12     "
+    test "test1129" (lazy(sprintf "%+i" 12y)) "+12"
+    test "test1130" (lazy(sprintf "%+5i" 12y)) "  +12"
+    test "test1131" (lazy(sprintf "%+1i" 12y)) "+12"
+    test "test1132" (lazy(sprintf "%+*i" 7 12y)) "    +12"
+    test "test1133" (lazy(sprintf "%-+i" 12y)) "+12"
+    test "test1134" (lazy(sprintf "%-+5i" 12y)) "+12  "
+    test "test1135" (lazy(sprintf "%-+1i" 12y)) "+12"
+    test "test1136" (lazy(sprintf "%-+*i" 7 12y)) "+12    "
+    test "test1137" (lazy(sprintf "%+0i" 12y)) "+12"
+    test "test1138" (lazy(sprintf "%+05i" 12y)) "+0012"
+    test "test1139" (lazy(sprintf "%+01i" 12y)) "+12"
+    test "test1140" (lazy(sprintf "%+0*i" 7 12y)) "+000012"
+    test "test1141" (lazy(sprintf "%-+0i" 12y)) "+12"
+    test "test1142" (lazy(sprintf "%-+05i" 12y)) "+12  "
+    test "test1143" (lazy(sprintf "%-+01i" 12y)) "+12"
+    test "test1144" (lazy(sprintf "%-+0*i" 7 12y)) "+12    "
+    test "test1145" (lazy(sprintf "% i" 12y)) " 12"
+    test "test1146" (lazy(sprintf "% 5i" 12y)) "   12"
+    test "test1147" (lazy(sprintf "% 1i" 12y)) " 12"
+    test "test1148" (lazy(sprintf "% *i" 7 12y)) "     12"
+    test "test1149" (lazy(sprintf "%- i" 12y)) " 12"
+    test "test1150" (lazy(sprintf "%- 5i" 12y)) " 12  "
+    test "test1151" (lazy(sprintf "%- 1i" 12y)) " 12"
+    test "test1152" (lazy(sprintf "%- *i" 7 12y)) " 12    "
+    test "test1153" (lazy(sprintf "% 0i" 12y)) " 12"
+    test "test1154" (lazy(sprintf "% 05i" 12y)) " 0012"
+    test "test1155" (lazy(sprintf "% 01i" 12y)) " 12"
+    test "test1156" (lazy(sprintf "% 0*i" 7 12y)) " 000012"
+    test "test1157" (lazy(sprintf "%- 0i" 12y)) " 12"
+    test "test1158" (lazy(sprintf "%- 05i" 12y)) " 12  "
+    test "test1159" (lazy(sprintf "%- 01i" 12y)) " 12"
+    test "test1160" (lazy(sprintf "%- 0*i" 7 12y)) " 12    "
+    test "test1161" (lazy(sprintf "%i" -94y)) "-94"
+    test "test1162" (lazy(sprintf "%5i" -94y)) "  -94"
+    test "test1163" (lazy(sprintf "%1i" -94y)) "-94"
+    test "test1164" (lazy(sprintf "%*i" 7 -94y)) "    -94"
+    test "test1165" (lazy(sprintf "%-i" -94y)) "-94"
+    test "test1166" (lazy(sprintf "%-5i" -94y)) "-94  "
+    test "test1167" (lazy(sprintf "%-1i" -94y)) "-94"
+    test "test1168" (lazy(sprintf "%-*i" 7 -94y)) "-94    "
+    test "test1169" (lazy(sprintf "%0i" -94y)) "-94"
+    test "test1170" (lazy(sprintf "%05i" -94y)) "-0094"
+    test "test1171" (lazy(sprintf "%01i" -94y)) "-94"
+    test "test1172" (lazy(sprintf "%0*i" 7 -94y)) "-000094"
+    test "test1173" (lazy(sprintf "%-0i" -94y)) "-94"
+    test "test1174" (lazy(sprintf "%-05i" -94y)) "-94  "
+    test "test1175" (lazy(sprintf "%-01i" -94y)) "-94"
+    test "test1176" (lazy(sprintf "%-0*i" 7 -94y)) "-94    "
+    test "test1177" (lazy(sprintf "%+i" -94y)) "-94"
+    test "test1178" (lazy(sprintf "%+5i" -94y)) "  -94"
+    test "test1179" (lazy(sprintf "%+1i" -94y)) "-94"
+    test "test1180" (lazy(sprintf "%+*i" 7 -94y)) "    -94"
+    test "test1181" (lazy(sprintf "%-+i" -94y)) "-94"
+    test "test1182" (lazy(sprintf "%-+5i" -94y)) "-94  "
+    test "test1183" (lazy(sprintf "%-+1i" -94y)) "-94"
+    test "test1184" (lazy(sprintf "%-+*i" 7 -94y)) "-94    "
+    test "test1185" (lazy(sprintf "%+0i" -94y)) "-94"
+    test "test1186" (lazy(sprintf "%+05i" -94y)) "-0094"
+    test "test1187" (lazy(sprintf "%+01i" -94y)) "-94"
+    test "test1188" (lazy(sprintf "%+0*i" 7 -94y)) "-000094"
+    test "test1189" (lazy(sprintf "%-+0i" -94y)) "-94"
+    test "test1190" (lazy(sprintf "%-+05i" -94y)) "-94  "
+    test "test1191" (lazy(sprintf "%-+01i" -94y)) "-94"
+    test "test1192" (lazy(sprintf "%-+0*i" 7 -94y)) "-94    "
+    test "test1193" (lazy(sprintf "% i" -94y)) "-94"
+    test "test1194" (lazy(sprintf "% 5i" -94y)) "  -94"
+    test "test1195" (lazy(sprintf "% 1i" -94y)) "-94"
+    test "test1196" (lazy(sprintf "% *i" 7 -94y)) "    -94"
+    test "test1197" (lazy(sprintf "%- i" -94y)) "-94"
+    test "test1198" (lazy(sprintf "%- 5i" -94y)) "-94  "
+    test "test1199" (lazy(sprintf "%- 1i" -94y)) "-94"
+    test "test1200" (lazy(sprintf "%- *i" 7 -94y)) "-94    "
+    test "test1201" (lazy(sprintf "% 0i" -94y)) "-94"
+    test "test1202" (lazy(sprintf "% 05i" -94y)) "-0094"
+    test "test1203" (lazy(sprintf "% 01i" -94y)) "-94"
+    test "test1204" (lazy(sprintf "% 0*i" 7 -94y)) "-000094"
+    test "test1205" (lazy(sprintf "%- 0i" -94y)) "-94"
+    test "test1206" (lazy(sprintf "%- 05i" -94y)) "-94  "
+    test "test1207" (lazy(sprintf "%- 01i" -94y)) "-94"
+    test "test1208" (lazy(sprintf "%- 0*i" 7 -94y)) "-94    "
+    test "test1209" (lazy(sprintf "%i" 88uy)) "88"
+    test "test1210" (lazy(sprintf "%5i" 88uy)) "   88"
+    test "test1211" (lazy(sprintf "%1i" 88uy)) "88"
+    test "test1212" (lazy(sprintf "%*i" 7 88uy)) "     88"
+    test "test1213" (lazy(sprintf "%-i" 88uy)) "88"
+    test "test1214" (lazy(sprintf "%-5i" 88uy)) "88   "
+    test "test1215" (lazy(sprintf "%-1i" 88uy)) "88"
+    test "test1216" (lazy(sprintf "%-*i" 7 88uy)) "88     "
+    test "test1217" (lazy(sprintf "%0i" 88uy)) "88"
+    test "test1218" (lazy(sprintf "%05i" 88uy)) "00088"
+    test "test1219" (lazy(sprintf "%01i" 88uy)) "88"
+    test "test1220" (lazy(sprintf "%0*i" 7 88uy)) "0000088"
+    test "test1221" (lazy(sprintf "%-0i" 88uy)) "88"
+    test "test1222" (lazy(sprintf "%-05i" 88uy)) "88   "
+    test "test1223" (lazy(sprintf "%-01i" 88uy)) "88"
+    test "test1224" (lazy(sprintf "%-0*i" 7 88uy)) "88     "
+    test "test1225" (lazy(sprintf "%+i" 88uy)) "+88"
+    test "test1226" (lazy(sprintf "%+5i" 88uy)) "  +88"
+    test "test1227" (lazy(sprintf "%+1i" 88uy)) "+88"
+    test "test1228" (lazy(sprintf "%+*i" 7 88uy)) "    +88"
+    test "test1229" (lazy(sprintf "%-+i" 88uy)) "+88"
+    test "test1230" (lazy(sprintf "%-+5i" 88uy)) "+88  "
+    test "test1231" (lazy(sprintf "%-+1i" 88uy)) "+88"
+    test "test1232" (lazy(sprintf "%-+*i" 7 88uy)) "+88    "
+    test "test1233" (lazy(sprintf "%+0i" 88uy)) "+88"
+    test "test1234" (lazy(sprintf "%+05i" 88uy)) "+0088"
+    test "test1235" (lazy(sprintf "%+01i" 88uy)) "+88"
+    test "test1236" (lazy(sprintf "%+0*i" 7 88uy)) "+000088"
+    test "test1237" (lazy(sprintf "%-+0i" 88uy)) "+88"
+    test "test1238" (lazy(sprintf "%-+05i" 88uy)) "+88  "
+    test "test1239" (lazy(sprintf "%-+01i" 88uy)) "+88"
+    test "test1240" (lazy(sprintf "%-+0*i" 7 88uy)) "+88    "
+    test "test1241" (lazy(sprintf "% i" 88uy)) " 88"
+    test "test1242" (lazy(sprintf "% 5i" 88uy)) "   88"
+    test "test1243" (lazy(sprintf "% 1i" 88uy)) " 88"
+    test "test1244" (lazy(sprintf "% *i" 7 88uy)) "     88"
+    test "test1245" (lazy(sprintf "%- i" 88uy)) " 88"
+    test "test1246" (lazy(sprintf "%- 5i" 88uy)) " 88  "
+    test "test1247" (lazy(sprintf "%- 1i" 88uy)) " 88"
+    test "test1248" (lazy(sprintf "%- *i" 7 88uy)) " 88    "
+    test "test1249" (lazy(sprintf "% 0i" 88uy)) " 88"
+    test "test1250" (lazy(sprintf "% 05i" 88uy)) " 0088"
+    test "test1251" (lazy(sprintf "% 01i" 88uy)) " 88"
+    test "test1252" (lazy(sprintf "% 0*i" 7 88uy)) " 000088"
+    test "test1253" (lazy(sprintf "%- 0i" 88uy)) " 88"
+    test "test1254" (lazy(sprintf "%- 05i" 88uy)) " 88  "
+    test "test1255" (lazy(sprintf "%- 01i" 88uy)) " 88"
+    test "test1256" (lazy(sprintf "%- 0*i" 7 88uy)) " 88    "
+    test "test1257" (lazy(sprintf "%i" 999L)) "999"
+    test "test1258" (lazy(sprintf "%5i" 999L)) "  999"
+    test "test1259" (lazy(sprintf "%1i" 999L)) "999"
+    test "test1260" (lazy(sprintf "%*i" 7 999L)) "    999"
+    test "test1261" (lazy(sprintf "%-i" 999L)) "999"
+    test "test1262" (lazy(sprintf "%-5i" 999L)) "999  "
+    test "test1263" (lazy(sprintf "%-1i" 999L)) "999"
+    test "test1264" (lazy(sprintf "%-*i" 7 999L)) "999    "
+    test "test1265" (lazy(sprintf "%0i" 999L)) "999"
+    test "test1266" (lazy(sprintf "%05i" 999L)) "00999"
+    test "test1267" (lazy(sprintf "%01i" 999L)) "999"
+    test "test1268" (lazy(sprintf "%0*i" 7 999L)) "0000999"
+    test "test1269" (lazy(sprintf "%-0i" 999L)) "999"
+    test "test1270" (lazy(sprintf "%-05i" 999L)) "999  "
+    test "test1271" (lazy(sprintf "%-01i" 999L)) "999"
+    test "test1272" (lazy(sprintf "%-0*i" 7 999L)) "999    "
+    test "test1273" (lazy(sprintf "%+i" 999L)) "+999"
+    test "test1274" (lazy(sprintf "%+5i" 999L)) " +999"
+    test "test1275" (lazy(sprintf "%+1i" 999L)) "+999"
+    test "test1276" (lazy(sprintf "%+*i" 7 999L)) "   +999"
+    test "test1277" (lazy(sprintf "%-+i" 999L)) "+999"
+    test "test1278" (lazy(sprintf "%-+5i" 999L)) "+999 "
+    test "test1279" (lazy(sprintf "%-+1i" 999L)) "+999"
+    test "test1280" (lazy(sprintf "%-+*i" 7 999L)) "+999   "
+    test "test1281" (lazy(sprintf "%+0i" 999L)) "+999"
+    test "test1282" (lazy(sprintf "%+05i" 999L)) "+0999"
+    test "test1283" (lazy(sprintf "%+01i" 999L)) "+999"
+    test "test1284" (lazy(sprintf "%+0*i" 7 999L)) "+000999"
+    test "test1285" (lazy(sprintf "%-+0i" 999L)) "+999"
+    test "test1286" (lazy(sprintf "%-+05i" 999L)) "+999 "
+    test "test1287" (lazy(sprintf "%-+01i" 999L)) "+999"
+    test "test1288" (lazy(sprintf "%-+0*i" 7 999L)) "+999   "
+    test "test1289" (lazy(sprintf "% i" 999L)) " 999"
+    test "test1290" (lazy(sprintf "% 5i" 999L)) "  999"
+    test "test1291" (lazy(sprintf "% 1i" 999L)) " 999"
+    test "test1292" (lazy(sprintf "% *i" 7 999L)) "    999"
+    test "test1293" (lazy(sprintf "%- i" 999L)) " 999"
+    test "test1294" (lazy(sprintf "%- 5i" 999L)) " 999 "
+    test "test1295" (lazy(sprintf "%- 1i" 999L)) " 999"
+    test "test1296" (lazy(sprintf "%- *i" 7 999L)) " 999   "
+    test "test1297" (lazy(sprintf "% 0i" 999L)) " 999"
+    test "test1298" (lazy(sprintf "% 05i" 999L)) " 0999"
+    test "test1299" (lazy(sprintf "% 01i" 999L)) " 999"
+    test "test1300" (lazy(sprintf "% 0*i" 7 999L)) " 000999"
+    test "test1301" (lazy(sprintf "%- 0i" 999L)) " 999"
+    test "test1302" (lazy(sprintf "%- 05i" 999L)) " 999 "
+    test "test1303" (lazy(sprintf "%- 01i" 999L)) " 999"
+    test "test1304" (lazy(sprintf "%- 0*i" 7 999L)) " 999   "
+    test "test1305" (lazy(sprintf "%i" -321L)) "-321"
+    test "test1306" (lazy(sprintf "%5i" -321L)) " -321"
+    test "test1307" (lazy(sprintf "%1i" -321L)) "-321"
+    test "test1308" (lazy(sprintf "%*i" 7 -321L)) "   -321"
+    test "test1309" (lazy(sprintf "%-i" -321L)) "-321"
+    test "test1310" (lazy(sprintf "%-5i" -321L)) "-321 "
+    test "test1311" (lazy(sprintf "%-1i" -321L)) "-321"
+    test "test1312" (lazy(sprintf "%-*i" 7 -321L)) "-321   "
+    test "test1313" (lazy(sprintf "%0i" -321L)) "-321"
+    test "test1314" (lazy(sprintf "%05i" -321L)) "-0321"
+    test "test1315" (lazy(sprintf "%01i" -321L)) "-321"
+    test "test1316" (lazy(sprintf "%0*i" 7 -321L)) "-000321"
+    test "test1317" (lazy(sprintf "%-0i" -321L)) "-321"
+    test "test1318" (lazy(sprintf "%-05i" -321L)) "-321 "
+    test "test1319" (lazy(sprintf "%-01i" -321L)) "-321"
+    test "test1320" (lazy(sprintf "%-0*i" 7 -321L)) "-321   "
+    test "test1321" (lazy(sprintf "%+i" -321L)) "-321"
+    test "test1322" (lazy(sprintf "%+5i" -321L)) " -321"
+    test "test1323" (lazy(sprintf "%+1i" -321L)) "-321"
+    test "test1324" (lazy(sprintf "%+*i" 7 -321L)) "   -321"
+    test "test1325" (lazy(sprintf "%-+i" -321L)) "-321"
+    test "test1326" (lazy(sprintf "%-+5i" -321L)) "-321 "
+    test "test1327" (lazy(sprintf "%-+1i" -321L)) "-321"
+    test "test1328" (lazy(sprintf "%-+*i" 7 -321L)) "-321   "
+    test "test1329" (lazy(sprintf "%+0i" -321L)) "-321"
+    test "test1330" (lazy(sprintf "%+05i" -321L)) "-0321"
+    test "test1331" (lazy(sprintf "%+01i" -321L)) "-321"
+    test "test1332" (lazy(sprintf "%+0*i" 7 -321L)) "-000321"
+    test "test1333" (lazy(sprintf "%-+0i" -321L)) "-321"
+    test "test1334" (lazy(sprintf "%-+05i" -321L)) "-321 "
+    test "test1335" (lazy(sprintf "%-+01i" -321L)) "-321"
+    test "test1336" (lazy(sprintf "%-+0*i" 7 -321L)) "-321   "
+    test "test1337" (lazy(sprintf "% i" -321L)) "-321"
+    test "test1338" (lazy(sprintf "% 5i" -321L)) " -321"
+    test "test1339" (lazy(sprintf "% 1i" -321L)) "-321"
+    test "test1340" (lazy(sprintf "% *i" 7 -321L)) "   -321"
+    test "test1341" (lazy(sprintf "%- i" -321L)) "-321"
+    test "test1342" (lazy(sprintf "%- 5i" -321L)) "-321 "
+    test "test1343" (lazy(sprintf "%- 1i" -321L)) "-321"
+    test "test1344" (lazy(sprintf "%- *i" 7 -321L)) "-321   "
+    test "test1345" (lazy(sprintf "% 0i" -321L)) "-321"
+    test "test1346" (lazy(sprintf "% 05i" -321L)) "-0321"
+    test "test1347" (lazy(sprintf "% 01i" -321L)) "-321"
+    test "test1348" (lazy(sprintf "% 0*i" 7 -321L)) "-000321"
+    test "test1349" (lazy(sprintf "%- 0i" -321L)) "-321"
+    test "test1350" (lazy(sprintf "%- 05i" -321L)) "-321 "
+    test "test1351" (lazy(sprintf "%- 01i" -321L)) "-321"
+    test "test1352" (lazy(sprintf "%- 0*i" 7 -321L)) "-321   "
+    test "test1353" (lazy(sprintf "%i" 50000UL)) "50000"
+    test "test1354" (lazy(sprintf "%5i" 50000UL)) "50000"
+    test "test1355" (lazy(sprintf "%1i" 50000UL)) "50000"
+    test "test1356" (lazy(sprintf "%*i" 7 50000UL)) "  50000"
+    test "test1357" (lazy(sprintf "%-i" 50000UL)) "50000"
+    test "test1358" (lazy(sprintf "%-5i" 50000UL)) "50000"
+    test "test1359" (lazy(sprintf "%-1i" 50000UL)) "50000"
+    test "test1360" (lazy(sprintf "%-*i" 7 50000UL)) "50000  "
+    test "test1361" (lazy(sprintf "%0i" 50000UL)) "50000"
+    test "test1362" (lazy(sprintf "%05i" 50000UL)) "50000"
+    test "test1363" (lazy(sprintf "%01i" 50000UL)) "50000"
+    test "test1364" (lazy(sprintf "%0*i" 7 50000UL)) "0050000"
+    test "test1365" (lazy(sprintf "%-0i" 50000UL)) "50000"
+    test "test1366" (lazy(sprintf "%-05i" 50000UL)) "50000"
+    test "test1367" (lazy(sprintf "%-01i" 50000UL)) "50000"
+    test "test1368" (lazy(sprintf "%-0*i" 7 50000UL)) "50000  "
+    test "test1369" (lazy(sprintf "%+i" 50000UL)) "+50000"
+    test "test1370" (lazy(sprintf "%+5i" 50000UL)) "+50000"
+    test "test1371" (lazy(sprintf "%+1i" 50000UL)) "+50000"
+    test "test1372" (lazy(sprintf "%+*i" 7 50000UL)) " +50000"
+    test "test1373" (lazy(sprintf "%-+i" 50000UL)) "+50000"
+    test "test1374" (lazy(sprintf "%-+5i" 50000UL)) "+50000"
+    test "test1375" (lazy(sprintf "%-+1i" 50000UL)) "+50000"
+    test "test1376" (lazy(sprintf "%-+*i" 7 50000UL)) "+50000 "
+    test "test1377" (lazy(sprintf "%+0i" 50000UL)) "+50000"
+    test "test1378" (lazy(sprintf "%+05i" 50000UL)) "+50000"
+    test "test1379" (lazy(sprintf "%+01i" 50000UL)) "+50000"
+    test "test1380" (lazy(sprintf "%+0*i" 7 50000UL)) "+050000"
+    test "test1381" (lazy(sprintf "%-+0i" 50000UL)) "+50000"
+    test "test1382" (lazy(sprintf "%-+05i" 50000UL)) "+50000"
+    test "test1383" (lazy(sprintf "%-+01i" 50000UL)) "+50000"
+    test "test1384" (lazy(sprintf "%-+0*i" 7 50000UL)) "+50000 "
+    test "test1385" (lazy(sprintf "% i" 50000UL)) " 50000"
+    test "test1386" (lazy(sprintf "% 5i" 50000UL)) " 50000"
+    test "test1387" (lazy(sprintf "% 1i" 50000UL)) " 50000"
+    test "test1388" (lazy(sprintf "% *i" 7 50000UL)) "  50000"
+    test "test1389" (lazy(sprintf "%- i" 50000UL)) " 50000"
+    test "test1390" (lazy(sprintf "%- 5i" 50000UL)) " 50000"
+    test "test1391" (lazy(sprintf "%- 1i" 50000UL)) " 50000"
+    test "test1392" (lazy(sprintf "%- *i" 7 50000UL)) " 50000 "
+    test "test1393" (lazy(sprintf "% 0i" 50000UL)) " 50000"
+    test "test1394" (lazy(sprintf "% 05i" 50000UL)) " 50000"
+    test "test1395" (lazy(sprintf "% 01i" 50000UL)) " 50000"
+    test "test1396" (lazy(sprintf "% 0*i" 7 50000UL)) " 050000"
+    test "test1397" (lazy(sprintf "%- 0i" 50000UL)) " 50000"
+    test "test1398" (lazy(sprintf "%- 05i" 50000UL)) " 50000"
+    test "test1399" (lazy(sprintf "%- 01i" 50000UL)) " 50000"
+    test "test1400" (lazy(sprintf "%- 0*i" 7 50000UL)) " 50000 "
+    test "test1401" (lazy(sprintf "%i" System.Int32.MaxValue)) "2147483647"
+    test "test1402" (lazy(sprintf "%5i" System.Int32.MaxValue)) "2147483647"
+    test "test1403" (lazy(sprintf "%1i" System.Int32.MaxValue)) "2147483647"
+    test "test1404" (lazy(sprintf "%*i" 7 System.Int32.MaxValue)) "2147483647"
+    test "test1405" (lazy(sprintf "%-i" System.Int32.MaxValue)) "2147483647"
+    test "test1406" (lazy(sprintf "%-5i" System.Int32.MaxValue)) "2147483647"
+    test "test1407" (lazy(sprintf "%-1i" System.Int32.MaxValue)) "2147483647"
+    test "test1408" (lazy(sprintf "%-*i" 7 System.Int32.MaxValue)) "2147483647"
+    test "test1409" (lazy(sprintf "%0i" System.Int32.MaxValue)) "2147483647"
+    test "test1410" (lazy(sprintf "%05i" System.Int32.MaxValue)) "2147483647"
+    test "test1411" (lazy(sprintf "%01i" System.Int32.MaxValue)) "2147483647"
+    test "test1412" (lazy(sprintf "%0*i" 7 System.Int32.MaxValue)) "2147483647"
+    test "test1413" (lazy(sprintf "%-0i" System.Int32.MaxValue)) "2147483647"
+    test "test1414" (lazy(sprintf "%-05i" System.Int32.MaxValue)) "2147483647"
+    test "test1415" (lazy(sprintf "%-01i" System.Int32.MaxValue)) "2147483647"
+    test "test1416" (lazy(sprintf "%-0*i" 7 System.Int32.MaxValue)) "2147483647"
+    test "test1417" (lazy(sprintf "%+i" System.Int32.MaxValue)) "+2147483647"
+    test "test1418" (lazy(sprintf "%+5i" System.Int32.MaxValue)) "+2147483647"
+    test "test1419" (lazy(sprintf "%+1i" System.Int32.MaxValue)) "+2147483647"
+    test "test1420" (lazy(sprintf "%+*i" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test1421" (lazy(sprintf "%-+i" System.Int32.MaxValue)) "+2147483647"
+    test "test1422" (lazy(sprintf "%-+5i" System.Int32.MaxValue)) "+2147483647"
+    test "test1423" (lazy(sprintf "%-+1i" System.Int32.MaxValue)) "+2147483647"
+    test "test1424" (lazy(sprintf "%-+*i" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test1425" (lazy(sprintf "%+0i" System.Int32.MaxValue)) "+2147483647"
+    test "test1426" (lazy(sprintf "%+05i" System.Int32.MaxValue)) "+2147483647"
+    test "test1427" (lazy(sprintf "%+01i" System.Int32.MaxValue)) "+2147483647"
+    test "test1428" (lazy(sprintf "%+0*i" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test1429" (lazy(sprintf "%-+0i" System.Int32.MaxValue)) "+2147483647"
+    test "test1430" (lazy(sprintf "%-+05i" System.Int32.MaxValue)) "+2147483647"
+    test "test1431" (lazy(sprintf "%-+01i" System.Int32.MaxValue)) "+2147483647"
+    test "test1432" (lazy(sprintf "%-+0*i" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test1433" (lazy(sprintf "% i" System.Int32.MaxValue)) " 2147483647"
+    test "test1434" (lazy(sprintf "% 5i" System.Int32.MaxValue)) " 2147483647"
+    test "test1435" (lazy(sprintf "% 1i" System.Int32.MaxValue)) " 2147483647"
+    test "test1436" (lazy(sprintf "% *i" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test1437" (lazy(sprintf "%- i" System.Int32.MaxValue)) " 2147483647"
+    test "test1438" (lazy(sprintf "%- 5i" System.Int32.MaxValue)) " 2147483647"
+    test "test1439" (lazy(sprintf "%- 1i" System.Int32.MaxValue)) " 2147483647"
+    test "test1440" (lazy(sprintf "%- *i" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test1441" (lazy(sprintf "% 0i" System.Int32.MaxValue)) " 2147483647"
+    test "test1442" (lazy(sprintf "% 05i" System.Int32.MaxValue)) " 2147483647"
+    test "test1443" (lazy(sprintf "% 01i" System.Int32.MaxValue)) " 2147483647"
+    test "test1444" (lazy(sprintf "% 0*i" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test1445" (lazy(sprintf "%- 0i" System.Int32.MaxValue)) " 2147483647"
+    test "test1446" (lazy(sprintf "%- 05i" System.Int32.MaxValue)) " 2147483647"
+    test "test1447" (lazy(sprintf "%- 01i" System.Int32.MaxValue)) " 2147483647"
+    test "test1448" (lazy(sprintf "%- 0*i" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test1449" (lazy(sprintf "%i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1450" (lazy(sprintf "%5i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1451" (lazy(sprintf "%1i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1452" (lazy(sprintf "%*i" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test1453" (lazy(sprintf "%-i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1454" (lazy(sprintf "%-5i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1455" (lazy(sprintf "%-1i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1456" (lazy(sprintf "%-*i" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test1457" (lazy(sprintf "%0i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1458" (lazy(sprintf "%05i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1459" (lazy(sprintf "%01i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1460" (lazy(sprintf "%0*i" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test1461" (lazy(sprintf "%-0i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1462" (lazy(sprintf "%-05i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1463" (lazy(sprintf "%-01i" System.Int64.MaxValue)) "9223372036854775807"
+    test "test1464" (lazy(sprintf "%-0*i" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test1465" (lazy(sprintf "%+i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1466" (lazy(sprintf "%+5i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1467" (lazy(sprintf "%+1i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1468" (lazy(sprintf "%+*i" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1469" (lazy(sprintf "%-+i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1470" (lazy(sprintf "%-+5i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1471" (lazy(sprintf "%-+1i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1472" (lazy(sprintf "%-+*i" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1473" (lazy(sprintf "%+0i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1474" (lazy(sprintf "%+05i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1475" (lazy(sprintf "%+01i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1476" (lazy(sprintf "%+0*i" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1477" (lazy(sprintf "%-+0i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1478" (lazy(sprintf "%-+05i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1479" (lazy(sprintf "%-+01i" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1480" (lazy(sprintf "%-+0*i" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test1481" (lazy(sprintf "% i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1482" (lazy(sprintf "% 5i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1483" (lazy(sprintf "% 1i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1484" (lazy(sprintf "% *i" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1485" (lazy(sprintf "%- i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1486" (lazy(sprintf "%- 5i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1487" (lazy(sprintf "%- 1i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1488" (lazy(sprintf "%- *i" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1489" (lazy(sprintf "% 0i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1490" (lazy(sprintf "% 05i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1491" (lazy(sprintf "% 01i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1492" (lazy(sprintf "% 0*i" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1493" (lazy(sprintf "%- 0i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1494" (lazy(sprintf "%- 05i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1495" (lazy(sprintf "%- 01i" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1496" (lazy(sprintf "%- 0*i" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test1497" (lazy(sprintf "%i" System.Int32.MinValue)) "-2147483648"
+    test "test1498" (lazy(sprintf "%5i" System.Int32.MinValue)) "-2147483648"
+    test "test1499" (lazy(sprintf "%1i" System.Int32.MinValue)) "-2147483648"
+    test "test1500" (lazy(sprintf "%*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1501" (lazy(sprintf "%-i" System.Int32.MinValue)) "-2147483648"
+    test "test1502" (lazy(sprintf "%-5i" System.Int32.MinValue)) "-2147483648"
+    test "test1503" (lazy(sprintf "%-1i" System.Int32.MinValue)) "-2147483648"
+    test "test1504" (lazy(sprintf "%-*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1505" (lazy(sprintf "%0i" System.Int32.MinValue)) "-2147483648"
+    test "test1506" (lazy(sprintf "%05i" System.Int32.MinValue)) "-2147483648"
+    test "test1507" (lazy(sprintf "%01i" System.Int32.MinValue)) "-2147483648"
+    test "test1508" (lazy(sprintf "%0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1509" (lazy(sprintf "%-0i" System.Int32.MinValue)) "-2147483648"
+    test "test1510" (lazy(sprintf "%-05i" System.Int32.MinValue)) "-2147483648"
+    test "test1511" (lazy(sprintf "%-01i" System.Int32.MinValue)) "-2147483648"
+    test "test1512" (lazy(sprintf "%-0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1513" (lazy(sprintf "%+i" System.Int32.MinValue)) "-2147483648"
+    test "test1514" (lazy(sprintf "%+5i" System.Int32.MinValue)) "-2147483648"
+    test "test1515" (lazy(sprintf "%+1i" System.Int32.MinValue)) "-2147483648"
+    test "test1516" (lazy(sprintf "%+*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1517" (lazy(sprintf "%-+i" System.Int32.MinValue)) "-2147483648"
+    test "test1518" (lazy(sprintf "%-+5i" System.Int32.MinValue)) "-2147483648"
+    test "test1519" (lazy(sprintf "%-+1i" System.Int32.MinValue)) "-2147483648"
+    test "test1520" (lazy(sprintf "%-+*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1521" (lazy(sprintf "%+0i" System.Int32.MinValue)) "-2147483648"
+    test "test1522" (lazy(sprintf "%+05i" System.Int32.MinValue)) "-2147483648"
+    test "test1523" (lazy(sprintf "%+01i" System.Int32.MinValue)) "-2147483648"
+    test "test1524" (lazy(sprintf "%+0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1525" (lazy(sprintf "%-+0i" System.Int32.MinValue)) "-2147483648"
+    test "test1526" (lazy(sprintf "%-+05i" System.Int32.MinValue)) "-2147483648"
+    test "test1527" (lazy(sprintf "%-+01i" System.Int32.MinValue)) "-2147483648"
+    test "test1528" (lazy(sprintf "%-+0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1529" (lazy(sprintf "% i" System.Int32.MinValue)) "-2147483648"
+    test "test1530" (lazy(sprintf "% 5i" System.Int32.MinValue)) "-2147483648"
+    test "test1531" (lazy(sprintf "% 1i" System.Int32.MinValue)) "-2147483648"
+    test "test1532" (lazy(sprintf "% *i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1533" (lazy(sprintf "%- i" System.Int32.MinValue)) "-2147483648"
+    test "test1534" (lazy(sprintf "%- 5i" System.Int32.MinValue)) "-2147483648"
+    test "test1535" (lazy(sprintf "%- 1i" System.Int32.MinValue)) "-2147483648"
+    test "test1536" (lazy(sprintf "%- *i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1537" (lazy(sprintf "% 0i" System.Int32.MinValue)) "-2147483648"
+    test "test1538" (lazy(sprintf "% 05i" System.Int32.MinValue)) "-2147483648"
+    test "test1539" (lazy(sprintf "% 01i" System.Int32.MinValue)) "-2147483648"
+    test "test1540" (lazy(sprintf "% 0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1541" (lazy(sprintf "%- 0i" System.Int32.MinValue)) "-2147483648"
+    test "test1542" (lazy(sprintf "%- 05i" System.Int32.MinValue)) "-2147483648"
+    test "test1543" (lazy(sprintf "%- 01i" System.Int32.MinValue)) "-2147483648"
+    test "test1544" (lazy(sprintf "%- 0*i" 7 System.Int32.MinValue)) "-2147483648"
+    test "test1545" (lazy(sprintf "%i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1546" (lazy(sprintf "%5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1547" (lazy(sprintf "%1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1548" (lazy(sprintf "%*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1549" (lazy(sprintf "%-i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1550" (lazy(sprintf "%-5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1551" (lazy(sprintf "%-1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1552" (lazy(sprintf "%-*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1553" (lazy(sprintf "%0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1554" (lazy(sprintf "%05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1555" (lazy(sprintf "%01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1556" (lazy(sprintf "%0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1557" (lazy(sprintf "%-0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1558" (lazy(sprintf "%-05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1559" (lazy(sprintf "%-01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1560" (lazy(sprintf "%-0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1561" (lazy(sprintf "%+i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1562" (lazy(sprintf "%+5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1563" (lazy(sprintf "%+1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1564" (lazy(sprintf "%+*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1565" (lazy(sprintf "%-+i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1566" (lazy(sprintf "%-+5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1567" (lazy(sprintf "%-+1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1568" (lazy(sprintf "%-+*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1569" (lazy(sprintf "%+0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1570" (lazy(sprintf "%+05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1571" (lazy(sprintf "%+01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1572" (lazy(sprintf "%+0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1573" (lazy(sprintf "%-+0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1574" (lazy(sprintf "%-+05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1575" (lazy(sprintf "%-+01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1576" (lazy(sprintf "%-+0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1577" (lazy(sprintf "% i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1578" (lazy(sprintf "% 5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1579" (lazy(sprintf "% 1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1580" (lazy(sprintf "% *i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1581" (lazy(sprintf "%- i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1582" (lazy(sprintf "%- 5i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1583" (lazy(sprintf "%- 1i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1584" (lazy(sprintf "%- *i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1585" (lazy(sprintf "% 0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1586" (lazy(sprintf "% 05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1587" (lazy(sprintf "% 01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1588" (lazy(sprintf "% 0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1589" (lazy(sprintf "%- 0i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1590" (lazy(sprintf "%- 05i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1591" (lazy(sprintf "%- 01i" System.Int64.MinValue)) "-9223372036854775808"
+    test "test1592" (lazy(sprintf "%- 0*i" 7 System.Int64.MinValue)) "-9223372036854775808"
+    test "test1593" (lazy(sprintf "%i" 55n)) "55"
+    test "test1594" (lazy(sprintf "%5i" 55n)) "   55"
+    test "test1595" (lazy(sprintf "%1i" 55n)) "55"
+    test "test1596" (lazy(sprintf "%*i" 7 55n)) "     55"
+    test "test1597" (lazy(sprintf "%-i" 55n)) "55"
+    test "test1598" (lazy(sprintf "%-5i" 55n)) "55   "
+    test "test1599" (lazy(sprintf "%-1i" 55n)) "55"
+    test "test1600" (lazy(sprintf "%-*i" 7 55n)) "55     "
+    test "test1601" (lazy(sprintf "%0i" 55n)) "55"
+    test "test1602" (lazy(sprintf "%05i" 55n)) "00055"
+    test "test1603" (lazy(sprintf "%01i" 55n)) "55"
+    test "test1604" (lazy(sprintf "%0*i" 7 55n)) "0000055"
+    test "test1605" (lazy(sprintf "%-0i" 55n)) "55"
+    test "test1606" (lazy(sprintf "%-05i" 55n)) "55   "
+    test "test1607" (lazy(sprintf "%-01i" 55n)) "55"
+    test "test1608" (lazy(sprintf "%-0*i" 7 55n)) "55     "
+    test "test1609" (lazy(sprintf "%+i" 55n)) "+55"
+    test "test1610" (lazy(sprintf "%+5i" 55n)) "  +55"
+    test "test1611" (lazy(sprintf "%+1i" 55n)) "+55"
+    test "test1612" (lazy(sprintf "%+*i" 7 55n)) "    +55"
+    test "test1613" (lazy(sprintf "%-+i" 55n)) "+55"
+    test "test1614" (lazy(sprintf "%-+5i" 55n)) "+55  "
+    test "test1615" (lazy(sprintf "%-+1i" 55n)) "+55"
+    test "test1616" (lazy(sprintf "%-+*i" 7 55n)) "+55    "
+    test "test1617" (lazy(sprintf "%+0i" 55n)) "+55"
+    test "test1618" (lazy(sprintf "%+05i" 55n)) "+0055"
+    test "test1619" (lazy(sprintf "%+01i" 55n)) "+55"
+    test "test1620" (lazy(sprintf "%+0*i" 7 55n)) "+000055"
+    test "test1621" (lazy(sprintf "%-+0i" 55n)) "+55"
+    test "test1622" (lazy(sprintf "%-+05i" 55n)) "+55  "
+    test "test1623" (lazy(sprintf "%-+01i" 55n)) "+55"
+    test "test1624" (lazy(sprintf "%-+0*i" 7 55n)) "+55    "
+    test "test1625" (lazy(sprintf "% i" 55n)) " 55"
+    test "test1626" (lazy(sprintf "% 5i" 55n)) "   55"
+    test "test1627" (lazy(sprintf "% 1i" 55n)) " 55"
+    test "test1628" (lazy(sprintf "% *i" 7 55n)) "     55"
+    test "test1629" (lazy(sprintf "%- i" 55n)) " 55"
+    test "test1630" (lazy(sprintf "%- 5i" 55n)) " 55  "
+    test "test1631" (lazy(sprintf "%- 1i" 55n)) " 55"
+    test "test1632" (lazy(sprintf "%- *i" 7 55n)) " 55    "
+    test "test1633" (lazy(sprintf "% 0i" 55n)) " 55"
+    test "test1634" (lazy(sprintf "% 05i" 55n)) " 0055"
+    test "test1635" (lazy(sprintf "% 01i" 55n)) " 55"
+    test "test1636" (lazy(sprintf "% 0*i" 7 55n)) " 000055"
+    test "test1637" (lazy(sprintf "%- 0i" 55n)) " 55"
+    test "test1638" (lazy(sprintf "%- 05i" 55n)) " 55  "
+    test "test1639" (lazy(sprintf "%- 01i" 55n)) " 55"
+    test "test1640" (lazy(sprintf "%- 0*i" 7 55n)) " 55    "
+    test "test1641" (lazy(sprintf "%i" 999un)) "999"
+    test "test1642" (lazy(sprintf "%5i" 999un)) "  999"
+    test "test1643" (lazy(sprintf "%1i" 999un)) "999"
+    test "test1644" (lazy(sprintf "%*i" 7 999un)) "    999"
+    test "test1645" (lazy(sprintf "%-i" 999un)) "999"
+    test "test1646" (lazy(sprintf "%-5i" 999un)) "999  "
+    test "test1647" (lazy(sprintf "%-1i" 999un)) "999"
+    test "test1648" (lazy(sprintf "%-*i" 7 999un)) "999    "
+    test "test1649" (lazy(sprintf "%0i" 999un)) "999"
+    test "test1650" (lazy(sprintf "%05i" 999un)) "00999"
+    test "test1651" (lazy(sprintf "%01i" 999un)) "999"
+    test "test1652" (lazy(sprintf "%0*i" 7 999un)) "0000999"
+    test "test1653" (lazy(sprintf "%-0i" 999un)) "999"
+    test "test1654" (lazy(sprintf "%-05i" 999un)) "999  "
+    test "test1655" (lazy(sprintf "%-01i" 999un)) "999"
+    test "test1656" (lazy(sprintf "%-0*i" 7 999un)) "999    "
+    test "test1657" (lazy(sprintf "%+i" 999un)) "+999"
+    test "test1658" (lazy(sprintf "%+5i" 999un)) " +999"
+    test "test1659" (lazy(sprintf "%+1i" 999un)) "+999"
+    test "test1660" (lazy(sprintf "%+*i" 7 999un)) "   +999"
+    test "test1661" (lazy(sprintf "%-+i" 999un)) "+999"
+    test "test1662" (lazy(sprintf "%-+5i" 999un)) "+999 "
+    test "test1663" (lazy(sprintf "%-+1i" 999un)) "+999"
+    test "test1664" (lazy(sprintf "%-+*i" 7 999un)) "+999   "
+    test "test1665" (lazy(sprintf "%+0i" 999un)) "+999"
+    test "test1666" (lazy(sprintf "%+05i" 999un)) "+0999"
+    test "test1667" (lazy(sprintf "%+01i" 999un)) "+999"
+    test "test1668" (lazy(sprintf "%+0*i" 7 999un)) "+000999"
+    test "test1669" (lazy(sprintf "%-+0i" 999un)) "+999"
+    test "test1670" (lazy(sprintf "%-+05i" 999un)) "+999 "
+    test "test1671" (lazy(sprintf "%-+01i" 999un)) "+999"
+    test "test1672" (lazy(sprintf "%-+0*i" 7 999un)) "+999   "
+    test "test1673" (lazy(sprintf "% i" 999un)) " 999"
+    test "test1674" (lazy(sprintf "% 5i" 999un)) "  999"
+    test "test1675" (lazy(sprintf "% 1i" 999un)) " 999"
+    test "test1676" (lazy(sprintf "% *i" 7 999un)) "    999"
+    test "test1677" (lazy(sprintf "%- i" 999un)) " 999"
+    test "test1678" (lazy(sprintf "%- 5i" 999un)) " 999 "
+    test "test1679" (lazy(sprintf "%- 1i" 999un)) " 999"
+    test "test1680" (lazy(sprintf "%- *i" 7 999un)) " 999   "
+    test "test1681" (lazy(sprintf "% 0i" 999un)) " 999"
+    test "test1682" (lazy(sprintf "% 05i" 999un)) " 0999"
+    test "test1683" (lazy(sprintf "% 01i" 999un)) " 999"
+    test "test1684" (lazy(sprintf "% 0*i" 7 999un)) " 000999"
+    test "test1685" (lazy(sprintf "%- 0i" 999un)) " 999"
+    test "test1686" (lazy(sprintf "%- 05i" 999un)) " 999 "
+    test "test1687" (lazy(sprintf "%- 01i" 999un)) " 999"
+    test "test1688" (lazy(sprintf "%- 0*i" 7 999un)) " 999   "
+    test "test1689" (lazy(sprintf "%u" 14)) "14"
+    test "test1690" (lazy(sprintf "%5u" 14)) "   14"
+    test "test1691" (lazy(sprintf "%1u" 14)) "14"
+    test "test1692" (lazy(sprintf "%*u" 7 14)) "     14"
+    test "test1693" (lazy(sprintf "%-u" 14)) "14"
+    test "test1694" (lazy(sprintf "%-5u" 14)) "14   "
+    test "test1695" (lazy(sprintf "%-1u" 14)) "14"
+    test "test1696" (lazy(sprintf "%-*u" 7 14)) "14     "
+    test "test1697" (lazy(sprintf "%0u" 14)) "14"
+    test "test1698" (lazy(sprintf "%05u" 14)) "00014"
+    test "test1699" (lazy(sprintf "%01u" 14)) "14"
+    test "test1700" (lazy(sprintf "%0*u" 7 14)) "0000014"
+    test "test1701" (lazy(sprintf "%-0u" 14)) "14"
+    test "test1702" (lazy(sprintf "%-05u" 14)) "14   "
+    test "test1703" (lazy(sprintf "%-01u" 14)) "14"
+    test "test1704" (lazy(sprintf "%-0*u" 7 14)) "14     "
+    test "test1705" (lazy(sprintf "%+u" 14)) "+14"
+    test "test1706" (lazy(sprintf "%+5u" 14)) "  +14"
+    test "test1707" (lazy(sprintf "%+1u" 14)) "+14"
+    test "test1708" (lazy(sprintf "%+*u" 7 14)) "    +14"
+    test "test1709" (lazy(sprintf "%-+u" 14)) "+14"
+    test "test1710" (lazy(sprintf "%-+5u" 14)) "+14  "
+    test "test1711" (lazy(sprintf "%-+1u" 14)) "+14"
+    test "test1712" (lazy(sprintf "%-+*u" 7 14)) "+14    "
+    test "test1713" (lazy(sprintf "%+0u" 14)) "+14"
+    test "test1714" (lazy(sprintf "%+05u" 14)) "+0014"
+    test "test1715" (lazy(sprintf "%+01u" 14)) "+14"
+    test "test1716" (lazy(sprintf "%+0*u" 7 14)) "+000014"
+    test "test1717" (lazy(sprintf "%-+0u" 14)) "+14"
+    test "test1718" (lazy(sprintf "%-+05u" 14)) "+14  "
+    test "test1719" (lazy(sprintf "%-+01u" 14)) "+14"
+    test "test1720" (lazy(sprintf "%-+0*u" 7 14)) "+14    "
+    test "test1721" (lazy(sprintf "% u" 14)) " 14"
+    test "test1722" (lazy(sprintf "% 5u" 14)) "   14"
+    test "test1723" (lazy(sprintf "% 1u" 14)) " 14"
+    test "test1724" (lazy(sprintf "% *u" 7 14)) "     14"
+    test "test1725" (lazy(sprintf "%- u" 14)) " 14"
+    test "test1726" (lazy(sprintf "%- 5u" 14)) " 14  "
+    test "test1727" (lazy(sprintf "%- 1u" 14)) " 14"
+    test "test1728" (lazy(sprintf "%- *u" 7 14)) " 14    "
+    test "test1729" (lazy(sprintf "% 0u" 14)) " 14"
+    test "test1730" (lazy(sprintf "% 05u" 14)) " 0014"
+    test "test1731" (lazy(sprintf "% 01u" 14)) " 14"
+    test "test1732" (lazy(sprintf "% 0*u" 7 14)) " 000014"
+    test "test1733" (lazy(sprintf "%- 0u" 14)) " 14"
+    test "test1734" (lazy(sprintf "%- 05u" 14)) " 14  "
+    test "test1735" (lazy(sprintf "%- 01u" 14)) " 14"
+    test "test1736" (lazy(sprintf "%- 0*u" 7 14)) " 14    "
+    test "test1737" (lazy(sprintf "%u" -10)) "4294967286"
+    test "test1738" (lazy(sprintf "%5u" -10)) "4294967286"
+    test "test1739" (lazy(sprintf "%1u" -10)) "4294967286"
+    test "test1740" (lazy(sprintf "%*u" 7 -10)) "4294967286"
+    test "test1741" (lazy(sprintf "%-u" -10)) "4294967286"
+    test "test1742" (lazy(sprintf "%-5u" -10)) "4294967286"
+    test "test1743" (lazy(sprintf "%-1u" -10)) "4294967286"
+    test "test1744" (lazy(sprintf "%-*u" 7 -10)) "4294967286"
+    test "test1745" (lazy(sprintf "%0u" -10)) "4294967286"
+    test "test1746" (lazy(sprintf "%05u" -10)) "4294967286"
+    test "test1747" (lazy(sprintf "%01u" -10)) "4294967286"
+    test "test1748" (lazy(sprintf "%0*u" 7 -10)) "4294967286"
+    test "test1749" (lazy(sprintf "%-0u" -10)) "4294967286"
+    test "test1750" (lazy(sprintf "%-05u" -10)) "4294967286"
+    test "test1751" (lazy(sprintf "%-01u" -10)) "4294967286"
+    test "test1752" (lazy(sprintf "%-0*u" 7 -10)) "4294967286"
+    test "test1753" (lazy(sprintf "%+u" -10)) "+4294967286"
+    test "test1754" (lazy(sprintf "%+5u" -10)) "+4294967286"
+    test "test1755" (lazy(sprintf "%+1u" -10)) "+4294967286"
+    test "test1756" (lazy(sprintf "%+*u" 7 -10)) "+4294967286"
+    test "test1757" (lazy(sprintf "%-+u" -10)) "+4294967286"
+    test "test1758" (lazy(sprintf "%-+5u" -10)) "+4294967286"
+    test "test1759" (lazy(sprintf "%-+1u" -10)) "+4294967286"
+    test "test1760" (lazy(sprintf "%-+*u" 7 -10)) "+4294967286"
+    test "test1761" (lazy(sprintf "%+0u" -10)) "+4294967286"
+    test "test1762" (lazy(sprintf "%+05u" -10)) "+4294967286"
+    test "test1763" (lazy(sprintf "%+01u" -10)) "+4294967286"
+    test "test1764" (lazy(sprintf "%+0*u" 7 -10)) "+4294967286"
+    test "test1765" (lazy(sprintf "%-+0u" -10)) "+4294967286"
+    test "test1766" (lazy(sprintf "%-+05u" -10)) "+4294967286"
+    test "test1767" (lazy(sprintf "%-+01u" -10)) "+4294967286"
+    test "test1768" (lazy(sprintf "%-+0*u" 7 -10)) "+4294967286"
+    test "test1769" (lazy(sprintf "% u" -10)) " 4294967286"
+    test "test1770" (lazy(sprintf "% 5u" -10)) " 4294967286"
+    test "test1771" (lazy(sprintf "% 1u" -10)) " 4294967286"
+    test "test1772" (lazy(sprintf "% *u" 7 -10)) " 4294967286"
+    test "test1773" (lazy(sprintf "%- u" -10)) " 4294967286"
+    test "test1774" (lazy(sprintf "%- 5u" -10)) " 4294967286"
+    test "test1775" (lazy(sprintf "%- 1u" -10)) " 4294967286"
+    test "test1776" (lazy(sprintf "%- *u" 7 -10)) " 4294967286"
+    test "test1777" (lazy(sprintf "% 0u" -10)) " 4294967286"
+    test "test1778" (lazy(sprintf "% 05u" -10)) " 4294967286"
+    test "test1779" (lazy(sprintf "% 01u" -10)) " 4294967286"
+    test "test1780" (lazy(sprintf "% 0*u" 7 -10)) " 4294967286"
+    test "test1781" (lazy(sprintf "%- 0u" -10)) " 4294967286"
+    test "test1782" (lazy(sprintf "%- 05u" -10)) " 4294967286"
+    test "test1783" (lazy(sprintf "%- 01u" -10)) " 4294967286"
+    test "test1784" (lazy(sprintf "%- 0*u" 7 -10)) " 4294967286"
+    test "test1785" (lazy(sprintf "%u" 55s)) "55"
+    test "test1786" (lazy(sprintf "%5u" 55s)) "   55"
+    test "test1787" (lazy(sprintf "%1u" 55s)) "55"
+    test "test1788" (lazy(sprintf "%*u" 7 55s)) "     55"
+    test "test1789" (lazy(sprintf "%-u" 55s)) "55"
+    test "test1790" (lazy(sprintf "%-5u" 55s)) "55   "
+    test "test1791" (lazy(sprintf "%-1u" 55s)) "55"
+    test "test1792" (lazy(sprintf "%-*u" 7 55s)) "55     "
+    test "test1793" (lazy(sprintf "%0u" 55s)) "55"
+    test "test1794" (lazy(sprintf "%05u" 55s)) "00055"
+    test "test1795" (lazy(sprintf "%01u" 55s)) "55"
+    test "test1796" (lazy(sprintf "%0*u" 7 55s)) "0000055"
+    test "test1797" (lazy(sprintf "%-0u" 55s)) "55"
+    test "test1798" (lazy(sprintf "%-05u" 55s)) "55   "
+    test "test1799" (lazy(sprintf "%-01u" 55s)) "55"
+    test "test1800" (lazy(sprintf "%-0*u" 7 55s)) "55     "
+    test "test1801" (lazy(sprintf "%+u" 55s)) "+55"
+    test "test1802" (lazy(sprintf "%+5u" 55s)) "  +55"
+    test "test1803" (lazy(sprintf "%+1u" 55s)) "+55"
+    test "test1804" (lazy(sprintf "%+*u" 7 55s)) "    +55"
+    test "test1805" (lazy(sprintf "%-+u" 55s)) "+55"
+    test "test1806" (lazy(sprintf "%-+5u" 55s)) "+55  "
+    test "test1807" (lazy(sprintf "%-+1u" 55s)) "+55"
+    test "test1808" (lazy(sprintf "%-+*u" 7 55s)) "+55    "
+    test "test1809" (lazy(sprintf "%+0u" 55s)) "+55"
+    test "test1810" (lazy(sprintf "%+05u" 55s)) "+0055"
+    test "test1811" (lazy(sprintf "%+01u" 55s)) "+55"
+    test "test1812" (lazy(sprintf "%+0*u" 7 55s)) "+000055"
+    test "test1813" (lazy(sprintf "%-+0u" 55s)) "+55"
+    test "test1814" (lazy(sprintf "%-+05u" 55s)) "+55  "
+    test "test1815" (lazy(sprintf "%-+01u" 55s)) "+55"
+    test "test1816" (lazy(sprintf "%-+0*u" 7 55s)) "+55    "
+    test "test1817" (lazy(sprintf "% u" 55s)) " 55"
+    test "test1818" (lazy(sprintf "% 5u" 55s)) "   55"
+    test "test1819" (lazy(sprintf "% 1u" 55s)) " 55"
+    test "test1820" (lazy(sprintf "% *u" 7 55s)) "     55"
+    test "test1821" (lazy(sprintf "%- u" 55s)) " 55"
+    test "test1822" (lazy(sprintf "%- 5u" 55s)) " 55  "
+    test "test1823" (lazy(sprintf "%- 1u" 55s)) " 55"
+    test "test1824" (lazy(sprintf "%- *u" 7 55s)) " 55    "
+    test "test1825" (lazy(sprintf "% 0u" 55s)) " 55"
+    test "test1826" (lazy(sprintf "% 05u" 55s)) " 0055"
+    test "test1827" (lazy(sprintf "% 01u" 55s)) " 55"
+    test "test1828" (lazy(sprintf "% 0*u" 7 55s)) " 000055"
+    test "test1829" (lazy(sprintf "%- 0u" 55s)) " 55"
+    test "test1830" (lazy(sprintf "%- 05u" 55s)) " 55  "
+    test "test1831" (lazy(sprintf "%- 01u" 55s)) " 55"
+    test "test1832" (lazy(sprintf "%- 0*u" 7 55s)) " 55    "
+    test "test1833" (lazy(sprintf "%u" -88s)) "65448"
+    test "test1834" (lazy(sprintf "%5u" -88s)) "65448"
+    test "test1835" (lazy(sprintf "%1u" -88s)) "65448"
+    test "test1836" (lazy(sprintf "%*u" 7 -88s)) "  65448"
+    test "test1837" (lazy(sprintf "%-u" -88s)) "65448"
+    test "test1838" (lazy(sprintf "%-5u" -88s)) "65448"
+    test "test1839" (lazy(sprintf "%-1u" -88s)) "65448"
+    test "test1840" (lazy(sprintf "%-*u" 7 -88s)) "65448  "
+    test "test1841" (lazy(sprintf "%0u" -88s)) "65448"
+    test "test1842" (lazy(sprintf "%05u" -88s)) "65448"
+    test "test1843" (lazy(sprintf "%01u" -88s)) "65448"
+    test "test1844" (lazy(sprintf "%0*u" 7 -88s)) "0065448"
+    test "test1845" (lazy(sprintf "%-0u" -88s)) "65448"
+    test "test1846" (lazy(sprintf "%-05u" -88s)) "65448"
+    test "test1847" (lazy(sprintf "%-01u" -88s)) "65448"
+    test "test1848" (lazy(sprintf "%-0*u" 7 -88s)) "65448  "
+    test "test1849" (lazy(sprintf "%+u" -88s)) "+65448"
+    test "test1850" (lazy(sprintf "%+5u" -88s)) "+65448"
+    test "test1851" (lazy(sprintf "%+1u" -88s)) "+65448"
+    test "test1852" (lazy(sprintf "%+*u" 7 -88s)) " +65448"
+    test "test1853" (lazy(sprintf "%-+u" -88s)) "+65448"
+    test "test1854" (lazy(sprintf "%-+5u" -88s)) "+65448"
+    test "test1855" (lazy(sprintf "%-+1u" -88s)) "+65448"
+    test "test1856" (lazy(sprintf "%-+*u" 7 -88s)) "+65448 "
+    test "test1857" (lazy(sprintf "%+0u" -88s)) "+65448"
+    test "test1858" (lazy(sprintf "%+05u" -88s)) "+65448"
+    test "test1859" (lazy(sprintf "%+01u" -88s)) "+65448"
+    test "test1860" (lazy(sprintf "%+0*u" 7 -88s)) "+065448"
+    test "test1861" (lazy(sprintf "%-+0u" -88s)) "+65448"
+    test "test1862" (lazy(sprintf "%-+05u" -88s)) "+65448"
+    test "test1863" (lazy(sprintf "%-+01u" -88s)) "+65448"
+    test "test1864" (lazy(sprintf "%-+0*u" 7 -88s)) "+65448 "
+    test "test1865" (lazy(sprintf "% u" -88s)) " 65448"
+    test "test1866" (lazy(sprintf "% 5u" -88s)) " 65448"
+    test "test1867" (lazy(sprintf "% 1u" -88s)) " 65448"
+    test "test1868" (lazy(sprintf "% *u" 7 -88s)) "  65448"
+    test "test1869" (lazy(sprintf "%- u" -88s)) " 65448"
+    test "test1870" (lazy(sprintf "%- 5u" -88s)) " 65448"
+    test "test1871" (lazy(sprintf "%- 1u" -88s)) " 65448"
+    test "test1872" (lazy(sprintf "%- *u" 7 -88s)) " 65448 "
+    test "test1873" (lazy(sprintf "% 0u" -88s)) " 65448"
+    test "test1874" (lazy(sprintf "% 05u" -88s)) " 65448"
+    test "test1875" (lazy(sprintf "% 01u" -88s)) " 65448"
+    test "test1876" (lazy(sprintf "% 0*u" 7 -88s)) " 065448"
+    test "test1877" (lazy(sprintf "%- 0u" -88s)) " 65448"
+    test "test1878" (lazy(sprintf "%- 05u" -88s)) " 65448"
+    test "test1879" (lazy(sprintf "%- 01u" -88s)) " 65448"
+    test "test1880" (lazy(sprintf "%- 0*u" 7 -88s)) " 65448 "
+    test "test1881" (lazy(sprintf "%u" 104us)) "104"
+    test "test1882" (lazy(sprintf "%5u" 104us)) "  104"
+    test "test1883" (lazy(sprintf "%1u" 104us)) "104"
+    test "test1884" (lazy(sprintf "%*u" 7 104us)) "    104"
+    test "test1885" (lazy(sprintf "%-u" 104us)) "104"
+    test "test1886" (lazy(sprintf "%-5u" 104us)) "104  "
+    test "test1887" (lazy(sprintf "%-1u" 104us)) "104"
+    test "test1888" (lazy(sprintf "%-*u" 7 104us)) "104    "
+    test "test1889" (lazy(sprintf "%0u" 104us)) "104"
+    test "test1890" (lazy(sprintf "%05u" 104us)) "00104"
+    test "test1891" (lazy(sprintf "%01u" 104us)) "104"
+    test "test1892" (lazy(sprintf "%0*u" 7 104us)) "0000104"
+    test "test1893" (lazy(sprintf "%-0u" 104us)) "104"
+    test "test1894" (lazy(sprintf "%-05u" 104us)) "104  "
+    test "test1895" (lazy(sprintf "%-01u" 104us)) "104"
+    test "test1896" (lazy(sprintf "%-0*u" 7 104us)) "104    "
+    test "test1897" (lazy(sprintf "%+u" 104us)) "+104"
+    test "test1898" (lazy(sprintf "%+5u" 104us)) " +104"
+    test "test1899" (lazy(sprintf "%+1u" 104us)) "+104"
+    test "test1900" (lazy(sprintf "%+*u" 7 104us)) "   +104"
+    test "test1901" (lazy(sprintf "%-+u" 104us)) "+104"
+    test "test1902" (lazy(sprintf "%-+5u" 104us)) "+104 "
+    test "test1903" (lazy(sprintf "%-+1u" 104us)) "+104"
+    test "test1904" (lazy(sprintf "%-+*u" 7 104us)) "+104   "
+    test "test1905" (lazy(sprintf "%+0u" 104us)) "+104"
+    test "test1906" (lazy(sprintf "%+05u" 104us)) "+0104"
+    test "test1907" (lazy(sprintf "%+01u" 104us)) "+104"
+    test "test1908" (lazy(sprintf "%+0*u" 7 104us)) "+000104"
+    test "test1909" (lazy(sprintf "%-+0u" 104us)) "+104"
+    test "test1910" (lazy(sprintf "%-+05u" 104us)) "+104 "
+    test "test1911" (lazy(sprintf "%-+01u" 104us)) "+104"
+    test "test1912" (lazy(sprintf "%-+0*u" 7 104us)) "+104   "
+    test "test1913" (lazy(sprintf "% u" 104us)) " 104"
+    test "test1914" (lazy(sprintf "% 5u" 104us)) "  104"
+    test "test1915" (lazy(sprintf "% 1u" 104us)) " 104"
+    test "test1916" (lazy(sprintf "% *u" 7 104us)) "    104"
+    test "test1917" (lazy(sprintf "%- u" 104us)) " 104"
+    test "test1918" (lazy(sprintf "%- 5u" 104us)) " 104 "
+    test "test1919" (lazy(sprintf "%- 1u" 104us)) " 104"
+    test "test1920" (lazy(sprintf "%- *u" 7 104us)) " 104   "
+    test "test1921" (lazy(sprintf "% 0u" 104us)) " 104"
+    test "test1922" (lazy(sprintf "% 05u" 104us)) " 0104"
+    test "test1923" (lazy(sprintf "% 01u" 104us)) " 104"
+    test "test1924" (lazy(sprintf "% 0*u" 7 104us)) " 000104"
+    test "test1925" (lazy(sprintf "%- 0u" 104us)) " 104"
+    test "test1926" (lazy(sprintf "%- 05u" 104us)) " 104 "
+    test "test1927" (lazy(sprintf "%- 01u" 104us)) " 104"
+    test "test1928" (lazy(sprintf "%- 0*u" 7 104us)) " 104   "
+    test "test1929" (lazy(sprintf "%u" 12y)) "12"
+    test "test1930" (lazy(sprintf "%5u" 12y)) "   12"
+    test "test1931" (lazy(sprintf "%1u" 12y)) "12"
+    test "test1932" (lazy(sprintf "%*u" 7 12y)) "     12"
+    test "test1933" (lazy(sprintf "%-u" 12y)) "12"
+    test "test1934" (lazy(sprintf "%-5u" 12y)) "12   "
+    test "test1935" (lazy(sprintf "%-1u" 12y)) "12"
+    test "test1936" (lazy(sprintf "%-*u" 7 12y)) "12     "
+    test "test1937" (lazy(sprintf "%0u" 12y)) "12"
+    test "test1938" (lazy(sprintf "%05u" 12y)) "00012"
+    test "test1939" (lazy(sprintf "%01u" 12y)) "12"
+    test "test1940" (lazy(sprintf "%0*u" 7 12y)) "0000012"
+    test "test1941" (lazy(sprintf "%-0u" 12y)) "12"
+    test "test1942" (lazy(sprintf "%-05u" 12y)) "12   "
+    test "test1943" (lazy(sprintf "%-01u" 12y)) "12"
+    test "test1944" (lazy(sprintf "%-0*u" 7 12y)) "12     "
+    test "test1945" (lazy(sprintf "%+u" 12y)) "+12"
+    test "test1946" (lazy(sprintf "%+5u" 12y)) "  +12"
+    test "test1947" (lazy(sprintf "%+1u" 12y)) "+12"
+    test "test1948" (lazy(sprintf "%+*u" 7 12y)) "    +12"
+    test "test1949" (lazy(sprintf "%-+u" 12y)) "+12"
+    test "test1950" (lazy(sprintf "%-+5u" 12y)) "+12  "
+    test "test1951" (lazy(sprintf "%-+1u" 12y)) "+12"
+    test "test1952" (lazy(sprintf "%-+*u" 7 12y)) "+12    "
+    test "test1953" (lazy(sprintf "%+0u" 12y)) "+12"
+    test "test1954" (lazy(sprintf "%+05u" 12y)) "+0012"
+    test "test1955" (lazy(sprintf "%+01u" 12y)) "+12"
+    test "test1956" (lazy(sprintf "%+0*u" 7 12y)) "+000012"
+    test "test1957" (lazy(sprintf "%-+0u" 12y)) "+12"
+    test "test1958" (lazy(sprintf "%-+05u" 12y)) "+12  "
+    test "test1959" (lazy(sprintf "%-+01u" 12y)) "+12"
+    test "test1960" (lazy(sprintf "%-+0*u" 7 12y)) "+12    "
+    test "test1961" (lazy(sprintf "% u" 12y)) " 12"
+    test "test1962" (lazy(sprintf "% 5u" 12y)) "   12"
+    test "test1963" (lazy(sprintf "% 1u" 12y)) " 12"
+    test "test1964" (lazy(sprintf "% *u" 7 12y)) "     12"
+    test "test1965" (lazy(sprintf "%- u" 12y)) " 12"
+    test "test1966" (lazy(sprintf "%- 5u" 12y)) " 12  "
+    test "test1967" (lazy(sprintf "%- 1u" 12y)) " 12"
+    test "test1968" (lazy(sprintf "%- *u" 7 12y)) " 12    "
+    test "test1969" (lazy(sprintf "% 0u" 12y)) " 12"
+    test "test1970" (lazy(sprintf "% 05u" 12y)) " 0012"
+    test "test1971" (lazy(sprintf "% 01u" 12y)) " 12"
+    test "test1972" (lazy(sprintf "% 0*u" 7 12y)) " 000012"
+    test "test1973" (lazy(sprintf "%- 0u" 12y)) " 12"
+    test "test1974" (lazy(sprintf "%- 05u" 12y)) " 12  "
+    test "test1975" (lazy(sprintf "%- 01u" 12y)) " 12"
+    test "test1976" (lazy(sprintf "%- 0*u" 7 12y)) " 12    "
+    test "test1977" (lazy(sprintf "%u" -94y)) "162"
+    test "test1978" (lazy(sprintf "%5u" -94y)) "  162"
+    test "test1979" (lazy(sprintf "%1u" -94y)) "162"
+    test "test1980" (lazy(sprintf "%*u" 7 -94y)) "    162"
+    test "test1981" (lazy(sprintf "%-u" -94y)) "162"
+    test "test1982" (lazy(sprintf "%-5u" -94y)) "162  "
+    test "test1983" (lazy(sprintf "%-1u" -94y)) "162"
+    test "test1984" (lazy(sprintf "%-*u" 7 -94y)) "162    "
+    test "test1985" (lazy(sprintf "%0u" -94y)) "162"
+    test "test1986" (lazy(sprintf "%05u" -94y)) "00162"
+    test "test1987" (lazy(sprintf "%01u" -94y)) "162"
+    test "test1988" (lazy(sprintf "%0*u" 7 -94y)) "0000162"
+    test "test1989" (lazy(sprintf "%-0u" -94y)) "162"
+    test "test1990" (lazy(sprintf "%-05u" -94y)) "162  "
+    test "test1991" (lazy(sprintf "%-01u" -94y)) "162"
+    test "test1992" (lazy(sprintf "%-0*u" 7 -94y)) "162    "
+    test "test1993" (lazy(sprintf "%+u" -94y)) "+162"
+    test "test1994" (lazy(sprintf "%+5u" -94y)) " +162"
+    test "test1995" (lazy(sprintf "%+1u" -94y)) "+162"
+    test "test1996" (lazy(sprintf "%+*u" 7 -94y)) "   +162"
+    test "test1997" (lazy(sprintf "%-+u" -94y)) "+162"
+    test "test1998" (lazy(sprintf "%-+5u" -94y)) "+162 "
+    test "test1999" (lazy(sprintf "%-+1u" -94y)) "+162"
+    test "test2000" (lazy(sprintf "%-+*u" 7 -94y)) "+162   "
+let func2000()=
+    test "test2001" (lazy(sprintf "%+0u" -94y)) "+162"
+    test "test2002" (lazy(sprintf "%+05u" -94y)) "+0162"
+    test "test2003" (lazy(sprintf "%+01u" -94y)) "+162"
+    test "test2004" (lazy(sprintf "%+0*u" 7 -94y)) "+000162"
+    test "test2005" (lazy(sprintf "%-+0u" -94y)) "+162"
+    test "test2006" (lazy(sprintf "%-+05u" -94y)) "+162 "
+    test "test2007" (lazy(sprintf "%-+01u" -94y)) "+162"
+    test "test2008" (lazy(sprintf "%-+0*u" 7 -94y)) "+162   "
+    test "test2009" (lazy(sprintf "% u" -94y)) " 162"
+    test "test2010" (lazy(sprintf "% 5u" -94y)) "  162"
+    test "test2011" (lazy(sprintf "% 1u" -94y)) " 162"
+    test "test2012" (lazy(sprintf "% *u" 7 -94y)) "    162"
+    test "test2013" (lazy(sprintf "%- u" -94y)) " 162"
+    test "test2014" (lazy(sprintf "%- 5u" -94y)) " 162 "
+    test "test2015" (lazy(sprintf "%- 1u" -94y)) " 162"
+    test "test2016" (lazy(sprintf "%- *u" 7 -94y)) " 162   "
+    test "test2017" (lazy(sprintf "% 0u" -94y)) " 162"
+    test "test2018" (lazy(sprintf "% 05u" -94y)) " 0162"
+    test "test2019" (lazy(sprintf "% 01u" -94y)) " 162"
+    test "test2020" (lazy(sprintf "% 0*u" 7 -94y)) " 000162"
+    test "test2021" (lazy(sprintf "%- 0u" -94y)) " 162"
+    test "test2022" (lazy(sprintf "%- 05u" -94y)) " 162 "
+    test "test2023" (lazy(sprintf "%- 01u" -94y)) " 162"
+    test "test2024" (lazy(sprintf "%- 0*u" 7 -94y)) " 162   "
+    test "test2025" (lazy(sprintf "%u" 88uy)) "88"
+    test "test2026" (lazy(sprintf "%5u" 88uy)) "   88"
+    test "test2027" (lazy(sprintf "%1u" 88uy)) "88"
+    test "test2028" (lazy(sprintf "%*u" 7 88uy)) "     88"
+    test "test2029" (lazy(sprintf "%-u" 88uy)) "88"
+    test "test2030" (lazy(sprintf "%-5u" 88uy)) "88   "
+    test "test2031" (lazy(sprintf "%-1u" 88uy)) "88"
+    test "test2032" (lazy(sprintf "%-*u" 7 88uy)) "88     "
+    test "test2033" (lazy(sprintf "%0u" 88uy)) "88"
+    test "test2034" (lazy(sprintf "%05u" 88uy)) "00088"
+    test "test2035" (lazy(sprintf "%01u" 88uy)) "88"
+    test "test2036" (lazy(sprintf "%0*u" 7 88uy)) "0000088"
+    test "test2037" (lazy(sprintf "%-0u" 88uy)) "88"
+    test "test2038" (lazy(sprintf "%-05u" 88uy)) "88   "
+    test "test2039" (lazy(sprintf "%-01u" 88uy)) "88"
+    test "test2040" (lazy(sprintf "%-0*u" 7 88uy)) "88     "
+    test "test2041" (lazy(sprintf "%+u" 88uy)) "+88"
+    test "test2042" (lazy(sprintf "%+5u" 88uy)) "  +88"
+    test "test2043" (lazy(sprintf "%+1u" 88uy)) "+88"
+    test "test2044" (lazy(sprintf "%+*u" 7 88uy)) "    +88"
+    test "test2045" (lazy(sprintf "%-+u" 88uy)) "+88"
+    test "test2046" (lazy(sprintf "%-+5u" 88uy)) "+88  "
+    test "test2047" (lazy(sprintf "%-+1u" 88uy)) "+88"
+    test "test2048" (lazy(sprintf "%-+*u" 7 88uy)) "+88    "
+    test "test2049" (lazy(sprintf "%+0u" 88uy)) "+88"
+    test "test2050" (lazy(sprintf "%+05u" 88uy)) "+0088"
+    test "test2051" (lazy(sprintf "%+01u" 88uy)) "+88"
+    test "test2052" (lazy(sprintf "%+0*u" 7 88uy)) "+000088"
+    test "test2053" (lazy(sprintf "%-+0u" 88uy)) "+88"
+    test "test2054" (lazy(sprintf "%-+05u" 88uy)) "+88  "
+    test "test2055" (lazy(sprintf "%-+01u" 88uy)) "+88"
+    test "test2056" (lazy(sprintf "%-+0*u" 7 88uy)) "+88    "
+    test "test2057" (lazy(sprintf "% u" 88uy)) " 88"
+    test "test2058" (lazy(sprintf "% 5u" 88uy)) "   88"
+    test "test2059" (lazy(sprintf "% 1u" 88uy)) " 88"
+    test "test2060" (lazy(sprintf "% *u" 7 88uy)) "     88"
+    test "test2061" (lazy(sprintf "%- u" 88uy)) " 88"
+    test "test2062" (lazy(sprintf "%- 5u" 88uy)) " 88  "
+    test "test2063" (lazy(sprintf "%- 1u" 88uy)) " 88"
+    test "test2064" (lazy(sprintf "%- *u" 7 88uy)) " 88    "
+    test "test2065" (lazy(sprintf "% 0u" 88uy)) " 88"
+    test "test2066" (lazy(sprintf "% 05u" 88uy)) " 0088"
+    test "test2067" (lazy(sprintf "% 01u" 88uy)) " 88"
+    test "test2068" (lazy(sprintf "% 0*u" 7 88uy)) " 000088"
+    test "test2069" (lazy(sprintf "%- 0u" 88uy)) " 88"
+    test "test2070" (lazy(sprintf "%- 05u" 88uy)) " 88  "
+    test "test2071" (lazy(sprintf "%- 01u" 88uy)) " 88"
+    test "test2072" (lazy(sprintf "%- 0*u" 7 88uy)) " 88    "
+    test "test2073" (lazy(sprintf "%u" 999L)) "999"
+    test "test2074" (lazy(sprintf "%5u" 999L)) "  999"
+    test "test2075" (lazy(sprintf "%1u" 999L)) "999"
+    test "test2076" (lazy(sprintf "%*u" 7 999L)) "    999"
+    test "test2077" (lazy(sprintf "%-u" 999L)) "999"
+    test "test2078" (lazy(sprintf "%-5u" 999L)) "999  "
+    test "test2079" (lazy(sprintf "%-1u" 999L)) "999"
+    test "test2080" (lazy(sprintf "%-*u" 7 999L)) "999    "
+    test "test2081" (lazy(sprintf "%0u" 999L)) "999"
+    test "test2082" (lazy(sprintf "%05u" 999L)) "00999"
+    test "test2083" (lazy(sprintf "%01u" 999L)) "999"
+    test "test2084" (lazy(sprintf "%0*u" 7 999L)) "0000999"
+    test "test2085" (lazy(sprintf "%-0u" 999L)) "999"
+    test "test2086" (lazy(sprintf "%-05u" 999L)) "999  "
+    test "test2087" (lazy(sprintf "%-01u" 999L)) "999"
+    test "test2088" (lazy(sprintf "%-0*u" 7 999L)) "999    "
+    test "test2089" (lazy(sprintf "%+u" 999L)) "+999"
+    test "test2090" (lazy(sprintf "%+5u" 999L)) " +999"
+    test "test2091" (lazy(sprintf "%+1u" 999L)) "+999"
+    test "test2092" (lazy(sprintf "%+*u" 7 999L)) "   +999"
+    test "test2093" (lazy(sprintf "%-+u" 999L)) "+999"
+    test "test2094" (lazy(sprintf "%-+5u" 999L)) "+999 "
+    test "test2095" (lazy(sprintf "%-+1u" 999L)) "+999"
+    test "test2096" (lazy(sprintf "%-+*u" 7 999L)) "+999   "
+    test "test2097" (lazy(sprintf "%+0u" 999L)) "+999"
+    test "test2098" (lazy(sprintf "%+05u" 999L)) "+0999"
+    test "test2099" (lazy(sprintf "%+01u" 999L)) "+999"
+    test "test2100" (lazy(sprintf "%+0*u" 7 999L)) "+000999"
+    test "test2101" (lazy(sprintf "%-+0u" 999L)) "+999"
+    test "test2102" (lazy(sprintf "%-+05u" 999L)) "+999 "
+    test "test2103" (lazy(sprintf "%-+01u" 999L)) "+999"
+    test "test2104" (lazy(sprintf "%-+0*u" 7 999L)) "+999   "
+    test "test2105" (lazy(sprintf "% u" 999L)) " 999"
+    test "test2106" (lazy(sprintf "% 5u" 999L)) "  999"
+    test "test2107" (lazy(sprintf "% 1u" 999L)) " 999"
+    test "test2108" (lazy(sprintf "% *u" 7 999L)) "    999"
+    test "test2109" (lazy(sprintf "%- u" 999L)) " 999"
+    test "test2110" (lazy(sprintf "%- 5u" 999L)) " 999 "
+    test "test2111" (lazy(sprintf "%- 1u" 999L)) " 999"
+    test "test2112" (lazy(sprintf "%- *u" 7 999L)) " 999   "
+    test "test2113" (lazy(sprintf "% 0u" 999L)) " 999"
+    test "test2114" (lazy(sprintf "% 05u" 999L)) " 0999"
+    test "test2115" (lazy(sprintf "% 01u" 999L)) " 999"
+    test "test2116" (lazy(sprintf "% 0*u" 7 999L)) " 000999"
+    test "test2117" (lazy(sprintf "%- 0u" 999L)) " 999"
+    test "test2118" (lazy(sprintf "%- 05u" 999L)) " 999 "
+    test "test2119" (lazy(sprintf "%- 01u" 999L)) " 999"
+    test "test2120" (lazy(sprintf "%- 0*u" 7 999L)) " 999   "
+    test "test2121" (lazy(sprintf "%u" -321L)) "18446744073709551295"
+    test "test2122" (lazy(sprintf "%5u" -321L)) "18446744073709551295"
+    test "test2123" (lazy(sprintf "%1u" -321L)) "18446744073709551295"
+    test "test2124" (lazy(sprintf "%*u" 7 -321L)) "18446744073709551295"
+    test "test2125" (lazy(sprintf "%-u" -321L)) "18446744073709551295"
+    test "test2126" (lazy(sprintf "%-5u" -321L)) "18446744073709551295"
+    test "test2127" (lazy(sprintf "%-1u" -321L)) "18446744073709551295"
+    test "test2128" (lazy(sprintf "%-*u" 7 -321L)) "18446744073709551295"
+    test "test2129" (lazy(sprintf "%0u" -321L)) "18446744073709551295"
+    test "test2130" (lazy(sprintf "%05u" -321L)) "18446744073709551295"
+    test "test2131" (lazy(sprintf "%01u" -321L)) "18446744073709551295"
+    test "test2132" (lazy(sprintf "%0*u" 7 -321L)) "18446744073709551295"
+    test "test2133" (lazy(sprintf "%-0u" -321L)) "18446744073709551295"
+    test "test2134" (lazy(sprintf "%-05u" -321L)) "18446744073709551295"
+    test "test2135" (lazy(sprintf "%-01u" -321L)) "18446744073709551295"
+    test "test2136" (lazy(sprintf "%-0*u" 7 -321L)) "18446744073709551295"
+    test "test2137" (lazy(sprintf "%+u" -321L)) "+18446744073709551295"
+    test "test2138" (lazy(sprintf "%+5u" -321L)) "+18446744073709551295"
+    test "test2139" (lazy(sprintf "%+1u" -321L)) "+18446744073709551295"
+    test "test2140" (lazy(sprintf "%+*u" 7 -321L)) "+18446744073709551295"
+    test "test2141" (lazy(sprintf "%-+u" -321L)) "+18446744073709551295"
+    test "test2142" (lazy(sprintf "%-+5u" -321L)) "+18446744073709551295"
+    test "test2143" (lazy(sprintf "%-+1u" -321L)) "+18446744073709551295"
+    test "test2144" (lazy(sprintf "%-+*u" 7 -321L)) "+18446744073709551295"
+    test "test2145" (lazy(sprintf "%+0u" -321L)) "+18446744073709551295"
+    test "test2146" (lazy(sprintf "%+05u" -321L)) "+18446744073709551295"
+    test "test2147" (lazy(sprintf "%+01u" -321L)) "+18446744073709551295"
+    test "test2148" (lazy(sprintf "%+0*u" 7 -321L)) "+18446744073709551295"
+    test "test2149" (lazy(sprintf "%-+0u" -321L)) "+18446744073709551295"
+    test "test2150" (lazy(sprintf "%-+05u" -321L)) "+18446744073709551295"
+    test "test2151" (lazy(sprintf "%-+01u" -321L)) "+18446744073709551295"
+    test "test2152" (lazy(sprintf "%-+0*u" 7 -321L)) "+18446744073709551295"
+    test "test2153" (lazy(sprintf "% u" -321L)) " 18446744073709551295"
+    test "test2154" (lazy(sprintf "% 5u" -321L)) " 18446744073709551295"
+    test "test2155" (lazy(sprintf "% 1u" -321L)) " 18446744073709551295"
+    test "test2156" (lazy(sprintf "% *u" 7 -321L)) " 18446744073709551295"
+    test "test2157" (lazy(sprintf "%- u" -321L)) " 18446744073709551295"
+    test "test2158" (lazy(sprintf "%- 5u" -321L)) " 18446744073709551295"
+    test "test2159" (lazy(sprintf "%- 1u" -321L)) " 18446744073709551295"
+    test "test2160" (lazy(sprintf "%- *u" 7 -321L)) " 18446744073709551295"
+    test "test2161" (lazy(sprintf "% 0u" -321L)) " 18446744073709551295"
+    test "test2162" (lazy(sprintf "% 05u" -321L)) " 18446744073709551295"
+    test "test2163" (lazy(sprintf "% 01u" -321L)) " 18446744073709551295"
+    test "test2164" (lazy(sprintf "% 0*u" 7 -321L)) " 18446744073709551295"
+    test "test2165" (lazy(sprintf "%- 0u" -321L)) " 18446744073709551295"
+    test "test2166" (lazy(sprintf "%- 05u" -321L)) " 18446744073709551295"
+    test "test2167" (lazy(sprintf "%- 01u" -321L)) " 18446744073709551295"
+    test "test2168" (lazy(sprintf "%- 0*u" 7 -321L)) " 18446744073709551295"
+    test "test2169" (lazy(sprintf "%u" 50000UL)) "50000"
+    test "test2170" (lazy(sprintf "%5u" 50000UL)) "50000"
+    test "test2171" (lazy(sprintf "%1u" 50000UL)) "50000"
+    test "test2172" (lazy(sprintf "%*u" 7 50000UL)) "  50000"
+    test "test2173" (lazy(sprintf "%-u" 50000UL)) "50000"
+    test "test2174" (lazy(sprintf "%-5u" 50000UL)) "50000"
+    test "test2175" (lazy(sprintf "%-1u" 50000UL)) "50000"
+    test "test2176" (lazy(sprintf "%-*u" 7 50000UL)) "50000  "
+    test "test2177" (lazy(sprintf "%0u" 50000UL)) "50000"
+    test "test2178" (lazy(sprintf "%05u" 50000UL)) "50000"
+    test "test2179" (lazy(sprintf "%01u" 50000UL)) "50000"
+    test "test2180" (lazy(sprintf "%0*u" 7 50000UL)) "0050000"
+    test "test2181" (lazy(sprintf "%-0u" 50000UL)) "50000"
+    test "test2182" (lazy(sprintf "%-05u" 50000UL)) "50000"
+    test "test2183" (lazy(sprintf "%-01u" 50000UL)) "50000"
+    test "test2184" (lazy(sprintf "%-0*u" 7 50000UL)) "50000  "
+    test "test2185" (lazy(sprintf "%+u" 50000UL)) "+50000"
+    test "test2186" (lazy(sprintf "%+5u" 50000UL)) "+50000"
+    test "test2187" (lazy(sprintf "%+1u" 50000UL)) "+50000"
+    test "test2188" (lazy(sprintf "%+*u" 7 50000UL)) " +50000"
+    test "test2189" (lazy(sprintf "%-+u" 50000UL)) "+50000"
+    test "test2190" (lazy(sprintf "%-+5u" 50000UL)) "+50000"
+    test "test2191" (lazy(sprintf "%-+1u" 50000UL)) "+50000"
+    test "test2192" (lazy(sprintf "%-+*u" 7 50000UL)) "+50000 "
+    test "test2193" (lazy(sprintf "%+0u" 50000UL)) "+50000"
+    test "test2194" (lazy(sprintf "%+05u" 50000UL)) "+50000"
+    test "test2195" (lazy(sprintf "%+01u" 50000UL)) "+50000"
+    test "test2196" (lazy(sprintf "%+0*u" 7 50000UL)) "+050000"
+    test "test2197" (lazy(sprintf "%-+0u" 50000UL)) "+50000"
+    test "test2198" (lazy(sprintf "%-+05u" 50000UL)) "+50000"
+    test "test2199" (lazy(sprintf "%-+01u" 50000UL)) "+50000"
+    test "test2200" (lazy(sprintf "%-+0*u" 7 50000UL)) "+50000 "
+    test "test2201" (lazy(sprintf "% u" 50000UL)) " 50000"
+    test "test2202" (lazy(sprintf "% 5u" 50000UL)) " 50000"
+    test "test2203" (lazy(sprintf "% 1u" 50000UL)) " 50000"
+    test "test2204" (lazy(sprintf "% *u" 7 50000UL)) "  50000"
+    test "test2205" (lazy(sprintf "%- u" 50000UL)) " 50000"
+    test "test2206" (lazy(sprintf "%- 5u" 50000UL)) " 50000"
+    test "test2207" (lazy(sprintf "%- 1u" 50000UL)) " 50000"
+    test "test2208" (lazy(sprintf "%- *u" 7 50000UL)) " 50000 "
+    test "test2209" (lazy(sprintf "% 0u" 50000UL)) " 50000"
+    test "test2210" (lazy(sprintf "% 05u" 50000UL)) " 50000"
+    test "test2211" (lazy(sprintf "% 01u" 50000UL)) " 50000"
+    test "test2212" (lazy(sprintf "% 0*u" 7 50000UL)) " 050000"
+    test "test2213" (lazy(sprintf "%- 0u" 50000UL)) " 50000"
+    test "test2214" (lazy(sprintf "%- 05u" 50000UL)) " 50000"
+    test "test2215" (lazy(sprintf "%- 01u" 50000UL)) " 50000"
+    test "test2216" (lazy(sprintf "%- 0*u" 7 50000UL)) " 50000 "
+    test "test2217" (lazy(sprintf "%u" System.Int32.MaxValue)) "2147483647"
+    test "test2218" (lazy(sprintf "%5u" System.Int32.MaxValue)) "2147483647"
+    test "test2219" (lazy(sprintf "%1u" System.Int32.MaxValue)) "2147483647"
+    test "test2220" (lazy(sprintf "%*u" 7 System.Int32.MaxValue)) "2147483647"
+    test "test2221" (lazy(sprintf "%-u" System.Int32.MaxValue)) "2147483647"
+    test "test2222" (lazy(sprintf "%-5u" System.Int32.MaxValue)) "2147483647"
+    test "test2223" (lazy(sprintf "%-1u" System.Int32.MaxValue)) "2147483647"
+    test "test2224" (lazy(sprintf "%-*u" 7 System.Int32.MaxValue)) "2147483647"
+    test "test2225" (lazy(sprintf "%0u" System.Int32.MaxValue)) "2147483647"
+    test "test2226" (lazy(sprintf "%05u" System.Int32.MaxValue)) "2147483647"
+    test "test2227" (lazy(sprintf "%01u" System.Int32.MaxValue)) "2147483647"
+    test "test2228" (lazy(sprintf "%0*u" 7 System.Int32.MaxValue)) "2147483647"
+    test "test2229" (lazy(sprintf "%-0u" System.Int32.MaxValue)) "2147483647"
+    test "test2230" (lazy(sprintf "%-05u" System.Int32.MaxValue)) "2147483647"
+    test "test2231" (lazy(sprintf "%-01u" System.Int32.MaxValue)) "2147483647"
+    test "test2232" (lazy(sprintf "%-0*u" 7 System.Int32.MaxValue)) "2147483647"
+    test "test2233" (lazy(sprintf "%+u" System.Int32.MaxValue)) "+2147483647"
+    test "test2234" (lazy(sprintf "%+5u" System.Int32.MaxValue)) "+2147483647"
+    test "test2235" (lazy(sprintf "%+1u" System.Int32.MaxValue)) "+2147483647"
+    test "test2236" (lazy(sprintf "%+*u" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test2237" (lazy(sprintf "%-+u" System.Int32.MaxValue)) "+2147483647"
+    test "test2238" (lazy(sprintf "%-+5u" System.Int32.MaxValue)) "+2147483647"
+    test "test2239" (lazy(sprintf "%-+1u" System.Int32.MaxValue)) "+2147483647"
+    test "test2240" (lazy(sprintf "%-+*u" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test2241" (lazy(sprintf "%+0u" System.Int32.MaxValue)) "+2147483647"
+    test "test2242" (lazy(sprintf "%+05u" System.Int32.MaxValue)) "+2147483647"
+    test "test2243" (lazy(sprintf "%+01u" System.Int32.MaxValue)) "+2147483647"
+    test "test2244" (lazy(sprintf "%+0*u" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test2245" (lazy(sprintf "%-+0u" System.Int32.MaxValue)) "+2147483647"
+    test "test2246" (lazy(sprintf "%-+05u" System.Int32.MaxValue)) "+2147483647"
+    test "test2247" (lazy(sprintf "%-+01u" System.Int32.MaxValue)) "+2147483647"
+    test "test2248" (lazy(sprintf "%-+0*u" 7 System.Int32.MaxValue)) "+2147483647"
+    test "test2249" (lazy(sprintf "% u" System.Int32.MaxValue)) " 2147483647"
+    test "test2250" (lazy(sprintf "% 5u" System.Int32.MaxValue)) " 2147483647"
+    test "test2251" (lazy(sprintf "% 1u" System.Int32.MaxValue)) " 2147483647"
+    test "test2252" (lazy(sprintf "% *u" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test2253" (lazy(sprintf "%- u" System.Int32.MaxValue)) " 2147483647"
+    test "test2254" (lazy(sprintf "%- 5u" System.Int32.MaxValue)) " 2147483647"
+    test "test2255" (lazy(sprintf "%- 1u" System.Int32.MaxValue)) " 2147483647"
+    test "test2256" (lazy(sprintf "%- *u" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test2257" (lazy(sprintf "% 0u" System.Int32.MaxValue)) " 2147483647"
+    test "test2258" (lazy(sprintf "% 05u" System.Int32.MaxValue)) " 2147483647"
+    test "test2259" (lazy(sprintf "% 01u" System.Int32.MaxValue)) " 2147483647"
+    test "test2260" (lazy(sprintf "% 0*u" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test2261" (lazy(sprintf "%- 0u" System.Int32.MaxValue)) " 2147483647"
+    test "test2262" (lazy(sprintf "%- 05u" System.Int32.MaxValue)) " 2147483647"
+    test "test2263" (lazy(sprintf "%- 01u" System.Int32.MaxValue)) " 2147483647"
+    test "test2264" (lazy(sprintf "%- 0*u" 7 System.Int32.MaxValue)) " 2147483647"
+    test "test2265" (lazy(sprintf "%u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2266" (lazy(sprintf "%5u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2267" (lazy(sprintf "%1u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2268" (lazy(sprintf "%*u" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test2269" (lazy(sprintf "%-u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2270" (lazy(sprintf "%-5u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2271" (lazy(sprintf "%-1u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2272" (lazy(sprintf "%-*u" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test2273" (lazy(sprintf "%0u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2274" (lazy(sprintf "%05u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2275" (lazy(sprintf "%01u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2276" (lazy(sprintf "%0*u" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test2277" (lazy(sprintf "%-0u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2278" (lazy(sprintf "%-05u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2279" (lazy(sprintf "%-01u" System.Int64.MaxValue)) "9223372036854775807"
+    test "test2280" (lazy(sprintf "%-0*u" 7 System.Int64.MaxValue)) "9223372036854775807"
+    test "test2281" (lazy(sprintf "%+u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2282" (lazy(sprintf "%+5u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2283" (lazy(sprintf "%+1u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2284" (lazy(sprintf "%+*u" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2285" (lazy(sprintf "%-+u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2286" (lazy(sprintf "%-+5u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2287" (lazy(sprintf "%-+1u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2288" (lazy(sprintf "%-+*u" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2289" (lazy(sprintf "%+0u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2290" (lazy(sprintf "%+05u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2291" (lazy(sprintf "%+01u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2292" (lazy(sprintf "%+0*u" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2293" (lazy(sprintf "%-+0u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2294" (lazy(sprintf "%-+05u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2295" (lazy(sprintf "%-+01u" System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2296" (lazy(sprintf "%-+0*u" 7 System.Int64.MaxValue)) "+9223372036854775807"
+    test "test2297" (lazy(sprintf "% u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2298" (lazy(sprintf "% 5u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2299" (lazy(sprintf "% 1u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2300" (lazy(sprintf "% *u" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2301" (lazy(sprintf "%- u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2302" (lazy(sprintf "%- 5u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2303" (lazy(sprintf "%- 1u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2304" (lazy(sprintf "%- *u" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2305" (lazy(sprintf "% 0u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2306" (lazy(sprintf "% 05u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2307" (lazy(sprintf "% 01u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2308" (lazy(sprintf "% 0*u" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2309" (lazy(sprintf "%- 0u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2310" (lazy(sprintf "%- 05u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2311" (lazy(sprintf "%- 01u" System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2312" (lazy(sprintf "%- 0*u" 7 System.Int64.MaxValue)) " 9223372036854775807"
+    test "test2313" (lazy(sprintf "%u" System.Int32.MinValue)) "2147483648"
+    test "test2314" (lazy(sprintf "%5u" System.Int32.MinValue)) "2147483648"
+    test "test2315" (lazy(sprintf "%1u" System.Int32.MinValue)) "2147483648"
+    test "test2316" (lazy(sprintf "%*u" 7 System.Int32.MinValue)) "2147483648"
+    test "test2317" (lazy(sprintf "%-u" System.Int32.MinValue)) "2147483648"
+    test "test2318" (lazy(sprintf "%-5u" System.Int32.MinValue)) "2147483648"
+    test "test2319" (lazy(sprintf "%-1u" System.Int32.MinValue)) "2147483648"
+    test "test2320" (lazy(sprintf "%-*u" 7 System.Int32.MinValue)) "2147483648"
+    test "test2321" (lazy(sprintf "%0u" System.Int32.MinValue)) "2147483648"
+    test "test2322" (lazy(sprintf "%05u" System.Int32.MinValue)) "2147483648"
+    test "test2323" (lazy(sprintf "%01u" System.Int32.MinValue)) "2147483648"
+    test "test2324" (lazy(sprintf "%0*u" 7 System.Int32.MinValue)) "2147483648"
+    test "test2325" (lazy(sprintf "%-0u" System.Int32.MinValue)) "2147483648"
+    test "test2326" (lazy(sprintf "%-05u" System.Int32.MinValue)) "2147483648"
+    test "test2327" (lazy(sprintf "%-01u" System.Int32.MinValue)) "2147483648"
+    test "test2328" (lazy(sprintf "%-0*u" 7 System.Int32.MinValue)) "2147483648"
+    test "test2329" (lazy(sprintf "%+u" System.Int32.MinValue)) "+2147483648"
+    test "test2330" (lazy(sprintf "%+5u" System.Int32.MinValue)) "+2147483648"
+    test "test2331" (lazy(sprintf "%+1u" System.Int32.MinValue)) "+2147483648"
+    test "test2332" (lazy(sprintf "%+*u" 7 System.Int32.MinValue)) "+2147483648"
+    test "test2333" (lazy(sprintf "%-+u" System.Int32.MinValue)) "+2147483648"
+    test "test2334" (lazy(sprintf "%-+5u" System.Int32.MinValue)) "+2147483648"
+    test "test2335" (lazy(sprintf "%-+1u" System.Int32.MinValue)) "+2147483648"
+    test "test2336" (lazy(sprintf "%-+*u" 7 System.Int32.MinValue)) "+2147483648"
+    test "test2337" (lazy(sprintf "%+0u" System.Int32.MinValue)) "+2147483648"
+    test "test2338" (lazy(sprintf "%+05u" System.Int32.MinValue)) "+2147483648"
+    test "test2339" (lazy(sprintf "%+01u" System.Int32.MinValue)) "+2147483648"
+    test "test2340" (lazy(sprintf "%+0*u" 7 System.Int32.MinValue)) "+2147483648"
+    test "test2341" (lazy(sprintf "%-+0u" System.Int32.MinValue)) "+2147483648"
+    test "test2342" (lazy(sprintf "%-+05u" System.Int32.MinValue)) "+2147483648"
+    test "test2343" (lazy(sprintf "%-+01u" System.Int32.MinValue)) "+2147483648"
+    test "test2344" (lazy(sprintf "%-+0*u" 7 System.Int32.MinValue)) "+2147483648"
+    test "test2345" (lazy(sprintf "% u" System.Int32.MinValue)) " 2147483648"
+    test "test2346" (lazy(sprintf "% 5u" System.Int32.MinValue)) " 2147483648"
+    test "test2347" (lazy(sprintf "% 1u" System.Int32.MinValue)) " 2147483648"
+    test "test2348" (lazy(sprintf "% *u" 7 System.Int32.MinValue)) " 2147483648"
+    test "test2349" (lazy(sprintf "%- u" System.Int32.MinValue)) " 2147483648"
+    test "test2350" (lazy(sprintf "%- 5u" System.Int32.MinValue)) " 2147483648"
+    test "test2351" (lazy(sprintf "%- 1u" System.Int32.MinValue)) " 2147483648"
+    test "test2352" (lazy(sprintf "%- *u" 7 System.Int32.MinValue)) " 2147483648"
+    test "test2353" (lazy(sprintf "% 0u" System.Int32.MinValue)) " 2147483648"
+    test "test2354" (lazy(sprintf "% 05u" System.Int32.MinValue)) " 2147483648"
+    test "test2355" (lazy(sprintf "% 01u" System.Int32.MinValue)) " 2147483648"
+    test "test2356" (lazy(sprintf "% 0*u" 7 System.Int32.MinValue)) " 2147483648"
+    test "test2357" (lazy(sprintf "%- 0u" System.Int32.MinValue)) " 2147483648"
+    test "test2358" (lazy(sprintf "%- 05u" System.Int32.MinValue)) " 2147483648"
+    test "test2359" (lazy(sprintf "%- 01u" System.Int32.MinValue)) " 2147483648"
+    test "test2360" (lazy(sprintf "%- 0*u" 7 System.Int32.MinValue)) " 2147483648"
+    test "test2361" (lazy(sprintf "%u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2362" (lazy(sprintf "%5u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2363" (lazy(sprintf "%1u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2364" (lazy(sprintf "%*u" 7 System.Int64.MinValue)) "9223372036854775808"
+    test "test2365" (lazy(sprintf "%-u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2366" (lazy(sprintf "%-5u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2367" (lazy(sprintf "%-1u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2368" (lazy(sprintf "%-*u" 7 System.Int64.MinValue)) "9223372036854775808"
+    test "test2369" (lazy(sprintf "%0u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2370" (lazy(sprintf "%05u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2371" (lazy(sprintf "%01u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2372" (lazy(sprintf "%0*u" 7 System.Int64.MinValue)) "9223372036854775808"
+    test "test2373" (lazy(sprintf "%-0u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2374" (lazy(sprintf "%-05u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2375" (lazy(sprintf "%-01u" System.Int64.MinValue)) "9223372036854775808"
+    test "test2376" (lazy(sprintf "%-0*u" 7 System.Int64.MinValue)) "9223372036854775808"
+    test "test2377" (lazy(sprintf "%+u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2378" (lazy(sprintf "%+5u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2379" (lazy(sprintf "%+1u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2380" (lazy(sprintf "%+*u" 7 System.Int64.MinValue)) "+9223372036854775808"
+    test "test2381" (lazy(sprintf "%-+u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2382" (lazy(sprintf "%-+5u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2383" (lazy(sprintf "%-+1u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2384" (lazy(sprintf "%-+*u" 7 System.Int64.MinValue)) "+9223372036854775808"
+    test "test2385" (lazy(sprintf "%+0u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2386" (lazy(sprintf "%+05u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2387" (lazy(sprintf "%+01u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2388" (lazy(sprintf "%+0*u" 7 System.Int64.MinValue)) "+9223372036854775808"
+    test "test2389" (lazy(sprintf "%-+0u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2390" (lazy(sprintf "%-+05u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2391" (lazy(sprintf "%-+01u" System.Int64.MinValue)) "+9223372036854775808"
+    test "test2392" (lazy(sprintf "%-+0*u" 7 System.Int64.MinValue)) "+9223372036854775808"
+    test "test2393" (lazy(sprintf "% u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2394" (lazy(sprintf "% 5u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2395" (lazy(sprintf "% 1u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2396" (lazy(sprintf "% *u" 7 System.Int64.MinValue)) " 9223372036854775808"
+    test "test2397" (lazy(sprintf "%- u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2398" (lazy(sprintf "%- 5u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2399" (lazy(sprintf "%- 1u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2400" (lazy(sprintf "%- *u" 7 System.Int64.MinValue)) " 9223372036854775808"
+    test "test2401" (lazy(sprintf "% 0u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2402" (lazy(sprintf "% 05u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2403" (lazy(sprintf "% 01u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2404" (lazy(sprintf "% 0*u" 7 System.Int64.MinValue)) " 9223372036854775808"
+    test "test2405" (lazy(sprintf "%- 0u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2406" (lazy(sprintf "%- 05u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2407" (lazy(sprintf "%- 01u" System.Int64.MinValue)) " 9223372036854775808"
+    test "test2408" (lazy(sprintf "%- 0*u" 7 System.Int64.MinValue)) " 9223372036854775808"
+    test "test2409" (lazy(sprintf "%u" 55n)) "55"
+    test "test2410" (lazy(sprintf "%5u" 55n)) "   55"
+    test "test2411" (lazy(sprintf "%1u" 55n)) "55"
+    test "test2412" (lazy(sprintf "%*u" 7 55n)) "     55"
+    test "test2413" (lazy(sprintf "%-u" 55n)) "55"
+    test "test2414" (lazy(sprintf "%-5u" 55n)) "55   "
+    test "test2415" (lazy(sprintf "%-1u" 55n)) "55"
+    test "test2416" (lazy(sprintf "%-*u" 7 55n)) "55     "
+    test "test2417" (lazy(sprintf "%0u" 55n)) "55"
+    test "test2418" (lazy(sprintf "%05u" 55n)) "00055"
+    test "test2419" (lazy(sprintf "%01u" 55n)) "55"
+    test "test2420" (lazy(sprintf "%0*u" 7 55n)) "0000055"
+    test "test2421" (lazy(sprintf "%-0u" 55n)) "55"
+    test "test2422" (lazy(sprintf "%-05u" 55n)) "55   "
+    test "test2423" (lazy(sprintf "%-01u" 55n)) "55"
+    test "test2424" (lazy(sprintf "%-0*u" 7 55n)) "55     "
+    test "test2425" (lazy(sprintf "%+u" 55n)) "+55"
+    test "test2426" (lazy(sprintf "%+5u" 55n)) "  +55"
+    test "test2427" (lazy(sprintf "%+1u" 55n)) "+55"
+    test "test2428" (lazy(sprintf "%+*u" 7 55n)) "    +55"
+    test "test2429" (lazy(sprintf "%-+u" 55n)) "+55"
+    test "test2430" (lazy(sprintf "%-+5u" 55n)) "+55  "
+    test "test2431" (lazy(sprintf "%-+1u" 55n)) "+55"
+    test "test2432" (lazy(sprintf "%-+*u" 7 55n)) "+55    "
+    test "test2433" (lazy(sprintf "%+0u" 55n)) "+55"
+    test "test2434" (lazy(sprintf "%+05u" 55n)) "+0055"
+    test "test2435" (lazy(sprintf "%+01u" 55n)) "+55"
+    test "test2436" (lazy(sprintf "%+0*u" 7 55n)) "+000055"
+    test "test2437" (lazy(sprintf "%-+0u" 55n)) "+55"
+    test "test2438" (lazy(sprintf "%-+05u" 55n)) "+55  "
+    test "test2439" (lazy(sprintf "%-+01u" 55n)) "+55"
+    test "test2440" (lazy(sprintf "%-+0*u" 7 55n)) "+55    "
+    test "test2441" (lazy(sprintf "% u" 55n)) " 55"
+    test "test2442" (lazy(sprintf "% 5u" 55n)) "   55"
+    test "test2443" (lazy(sprintf "% 1u" 55n)) " 55"
+    test "test2444" (lazy(sprintf "% *u" 7 55n)) "     55"
+    test "test2445" (lazy(sprintf "%- u" 55n)) " 55"
+    test "test2446" (lazy(sprintf "%- 5u" 55n)) " 55  "
+    test "test2447" (lazy(sprintf "%- 1u" 55n)) " 55"
+    test "test2448" (lazy(sprintf "%- *u" 7 55n)) " 55    "
+    test "test2449" (lazy(sprintf "% 0u" 55n)) " 55"
+    test "test2450" (lazy(sprintf "% 05u" 55n)) " 0055"
+    test "test2451" (lazy(sprintf "% 01u" 55n)) " 55"
+    test "test2452" (lazy(sprintf "% 0*u" 7 55n)) " 000055"
+    test "test2453" (lazy(sprintf "%- 0u" 55n)) " 55"
+    test "test2454" (lazy(sprintf "%- 05u" 55n)) " 55  "
+    test "test2455" (lazy(sprintf "%- 01u" 55n)) " 55"
+    test "test2456" (lazy(sprintf "%- 0*u" 7 55n)) " 55    "
+    test "test2457" (lazy(sprintf "%u" 999un)) "999"
+    test "test2458" (lazy(sprintf "%5u" 999un)) "  999"
+    test "test2459" (lazy(sprintf "%1u" 999un)) "999"
+    test "test2460" (lazy(sprintf "%*u" 7 999un)) "    999"
+    test "test2461" (lazy(sprintf "%-u" 999un)) "999"
+    test "test2462" (lazy(sprintf "%-5u" 999un)) "999  "
+    test "test2463" (lazy(sprintf "%-1u" 999un)) "999"
+    test "test2464" (lazy(sprintf "%-*u" 7 999un)) "999    "
+    test "test2465" (lazy(sprintf "%0u" 999un)) "999"
+    test "test2466" (lazy(sprintf "%05u" 999un)) "00999"
+    test "test2467" (lazy(sprintf "%01u" 999un)) "999"
+    test "test2468" (lazy(sprintf "%0*u" 7 999un)) "0000999"
+    test "test2469" (lazy(sprintf "%-0u" 999un)) "999"
+    test "test2470" (lazy(sprintf "%-05u" 999un)) "999  "
+    test "test2471" (lazy(sprintf "%-01u" 999un)) "999"
+    test "test2472" (lazy(sprintf "%-0*u" 7 999un)) "999    "
+    test "test2473" (lazy(sprintf "%+u" 999un)) "+999"
+    test "test2474" (lazy(sprintf "%+5u" 999un)) " +999"
+    test "test2475" (lazy(sprintf "%+1u" 999un)) "+999"
+    test "test2476" (lazy(sprintf "%+*u" 7 999un)) "   +999"
+    test "test2477" (lazy(sprintf "%-+u" 999un)) "+999"
+    test "test2478" (lazy(sprintf "%-+5u" 999un)) "+999 "
+    test "test2479" (lazy(sprintf "%-+1u" 999un)) "+999"
+    test "test2480" (lazy(sprintf "%-+*u" 7 999un)) "+999   "
+    test "test2481" (lazy(sprintf "%+0u" 999un)) "+999"
+    test "test2482" (lazy(sprintf "%+05u" 999un)) "+0999"
+    test "test2483" (lazy(sprintf "%+01u" 999un)) "+999"
+    test "test2484" (lazy(sprintf "%+0*u" 7 999un)) "+000999"
+    test "test2485" (lazy(sprintf "%-+0u" 999un)) "+999"
+    test "test2486" (lazy(sprintf "%-+05u" 999un)) "+999 "
+    test "test2487" (lazy(sprintf "%-+01u" 999un)) "+999"
+    test "test2488" (lazy(sprintf "%-+0*u" 7 999un)) "+999   "
+    test "test2489" (lazy(sprintf "% u" 999un)) " 999"
+    test "test2490" (lazy(sprintf "% 5u" 999un)) "  999"
+    test "test2491" (lazy(sprintf "% 1u" 999un)) " 999"
+    test "test2492" (lazy(sprintf "% *u" 7 999un)) "    999"
+    test "test2493" (lazy(sprintf "%- u" 999un)) " 999"
+    test "test2494" (lazy(sprintf "%- 5u" 999un)) " 999 "
+    test "test2495" (lazy(sprintf "%- 1u" 999un)) " 999"
+    test "test2496" (lazy(sprintf "%- *u" 7 999un)) " 999   "
+    test "test2497" (lazy(sprintf "% 0u" 999un)) " 999"
+    test "test2498" (lazy(sprintf "% 05u" 999un)) " 0999"
+    test "test2499" (lazy(sprintf "% 01u" 999un)) " 999"
+    test "test2500" (lazy(sprintf "% 0*u" 7 999un)) " 000999"
+    test "test2501" (lazy(sprintf "%- 0u" 999un)) " 999"
+    test "test2502" (lazy(sprintf "%- 05u" 999un)) " 999 "
+    test "test2503" (lazy(sprintf "%- 01u" 999un)) " 999"
+    test "test2504" (lazy(sprintf "%- 0*u" 7 999un)) " 999   "
+    test "test2505" (lazy(sprintf "%x" 14)) "e"
+    test "test2506" (lazy(sprintf "%5x" 14)) "    e"
+    test "test2507" (lazy(sprintf "%1x" 14)) "e"
+    test "test2508" (lazy(sprintf "%*x" 7 14)) "      e"
+    test "test2509" (lazy(sprintf "%-x" 14)) "e"
+    test "test2510" (lazy(sprintf "%-5x" 14)) "e    "
+    test "test2511" (lazy(sprintf "%-1x" 14)) "e"
+    test "test2512" (lazy(sprintf "%-*x" 7 14)) "e      "
+    test "test2513" (lazy(sprintf "%0x" 14)) "e"
+    test "test2514" (lazy(sprintf "%05x" 14)) "0000e"
+    test "test2515" (lazy(sprintf "%01x" 14)) "e"
+    test "test2516" (lazy(sprintf "%0*x" 7 14)) "000000e"
+    test "test2517" (lazy(sprintf "%-0x" 14)) "e"
+    test "test2518" (lazy(sprintf "%-05x" 14)) "e    "
+    test "test2519" (lazy(sprintf "%-01x" 14)) "e"
+    test "test2520" (lazy(sprintf "%-0*x" 7 14)) "e      "
+    test "test2521" (lazy(sprintf "%+x" 14)) "+e"
+    test "test2522" (lazy(sprintf "%+5x" 14)) "   +e"
+    test "test2523" (lazy(sprintf "%+1x" 14)) "+e"
+    test "test2524" (lazy(sprintf "%+*x" 7 14)) "     +e"
+    test "test2525" (lazy(sprintf "%-+x" 14)) "+e"
+    test "test2526" (lazy(sprintf "%-+5x" 14)) "+e   "
+    test "test2527" (lazy(sprintf "%-+1x" 14)) "+e"
+    test "test2528" (lazy(sprintf "%-+*x" 7 14)) "+e     "
+    test "test2529" (lazy(sprintf "%+0x" 14)) "+e"
+    test "test2530" (lazy(sprintf "%+05x" 14)) "+000e"
+    test "test2531" (lazy(sprintf "%+01x" 14)) "+e"
+    test "test2532" (lazy(sprintf "%+0*x" 7 14)) "+00000e"
+    test "test2533" (lazy(sprintf "%-+0x" 14)) "+e"
+    test "test2534" (lazy(sprintf "%-+05x" 14)) "+e   "
+    test "test2535" (lazy(sprintf "%-+01x" 14)) "+e"
+    test "test2536" (lazy(sprintf "%-+0*x" 7 14)) "+e     "
+    test "test2537" (lazy(sprintf "% x" 14)) " e"
+    test "test2538" (lazy(sprintf "% 5x" 14)) "    e"
+    test "test2539" (lazy(sprintf "% 1x" 14)) " e"
+    test "test2540" (lazy(sprintf "% *x" 7 14)) "      e"
+    test "test2541" (lazy(sprintf "%- x" 14)) " e"
+    test "test2542" (lazy(sprintf "%- 5x" 14)) " e   "
+    test "test2543" (lazy(sprintf "%- 1x" 14)) " e"
+    test "test2544" (lazy(sprintf "%- *x" 7 14)) " e     "
+    test "test2545" (lazy(sprintf "% 0x" 14)) " e"
+    test "test2546" (lazy(sprintf "% 05x" 14)) " 000e"
+    test "test2547" (lazy(sprintf "% 01x" 14)) " e"
+    test "test2548" (lazy(sprintf "% 0*x" 7 14)) " 00000e"
+    test "test2549" (lazy(sprintf "%- 0x" 14)) " e"
+    test "test2550" (lazy(sprintf "%- 05x" 14)) " e   "
+    test "test2551" (lazy(sprintf "%- 01x" 14)) " e"
+    test "test2552" (lazy(sprintf "%- 0*x" 7 14)) " e     "
+    test "test2553" (lazy(sprintf "%x" -10)) "fffffff6"
+    test "test2554" (lazy(sprintf "%5x" -10)) "fffffff6"
+    test "test2555" (lazy(sprintf "%1x" -10)) "fffffff6"
+    test "test2556" (lazy(sprintf "%*x" 7 -10)) "fffffff6"
+    test "test2557" (lazy(sprintf "%-x" -10)) "fffffff6"
+    test "test2558" (lazy(sprintf "%-5x" -10)) "fffffff6"
+    test "test2559" (lazy(sprintf "%-1x" -10)) "fffffff6"
+    test "test2560" (lazy(sprintf "%-*x" 7 -10)) "fffffff6"
+    test "test2561" (lazy(sprintf "%0x" -10)) "fffffff6"
+    test "test2562" (lazy(sprintf "%05x" -10)) "fffffff6"
+    test "test2563" (lazy(sprintf "%01x" -10)) "fffffff6"
+    test "test2564" (lazy(sprintf "%0*x" 7 -10)) "fffffff6"
+    test "test2565" (lazy(sprintf "%-0x" -10)) "fffffff6"
+    test "test2566" (lazy(sprintf "%-05x" -10)) "fffffff6"
+    test "test2567" (lazy(sprintf "%-01x" -10)) "fffffff6"
+    test "test2568" (lazy(sprintf "%-0*x" 7 -10)) "fffffff6"
+    test "test2569" (lazy(sprintf "%+x" -10)) "+fffffff6"
+    test "test2570" (lazy(sprintf "%+5x" -10)) "+fffffff6"
+    test "test2571" (lazy(sprintf "%+1x" -10)) "+fffffff6"
+    test "test2572" (lazy(sprintf "%+*x" 7 -10)) "+fffffff6"
+    test "test2573" (lazy(sprintf "%-+x" -10)) "+fffffff6"
+    test "test2574" (lazy(sprintf "%-+5x" -10)) "+fffffff6"
+    test "test2575" (lazy(sprintf "%-+1x" -10)) "+fffffff6"
+    test "test2576" (lazy(sprintf "%-+*x" 7 -10)) "+fffffff6"
+    test "test2577" (lazy(sprintf "%+0x" -10)) "+fffffff6"
+    test "test2578" (lazy(sprintf "%+05x" -10)) "+fffffff6"
+    test "test2579" (lazy(sprintf "%+01x" -10)) "+fffffff6"
+    test "test2580" (lazy(sprintf "%+0*x" 7 -10)) "+fffffff6"
+    test "test2581" (lazy(sprintf "%-+0x" -10)) "+fffffff6"
+    test "test2582" (lazy(sprintf "%-+05x" -10)) "+fffffff6"
+    test "test2583" (lazy(sprintf "%-+01x" -10)) "+fffffff6"
+    test "test2584" (lazy(sprintf "%-+0*x" 7 -10)) "+fffffff6"
+    test "test2585" (lazy(sprintf "% x" -10)) " fffffff6"
+    test "test2586" (lazy(sprintf "% 5x" -10)) " fffffff6"
+    test "test2587" (lazy(sprintf "% 1x" -10)) " fffffff6"
+    test "test2588" (lazy(sprintf "% *x" 7 -10)) " fffffff6"
+    test "test2589" (lazy(sprintf "%- x" -10)) " fffffff6"
+    test "test2590" (lazy(sprintf "%- 5x" -10)) " fffffff6"
+    test "test2591" (lazy(sprintf "%- 1x" -10)) " fffffff6"
+    test "test2592" (lazy(sprintf "%- *x" 7 -10)) " fffffff6"
+    test "test2593" (lazy(sprintf "% 0x" -10)) " fffffff6"
+    test "test2594" (lazy(sprintf "% 05x" -10)) " fffffff6"
+    test "test2595" (lazy(sprintf "% 01x" -10)) " fffffff6"
+    test "test2596" (lazy(sprintf "% 0*x" 7 -10)) " fffffff6"
+    test "test2597" (lazy(sprintf "%- 0x" -10)) " fffffff6"
+    test "test2598" (lazy(sprintf "%- 05x" -10)) " fffffff6"
+    test "test2599" (lazy(sprintf "%- 01x" -10)) " fffffff6"
+    test "test2600" (lazy(sprintf "%- 0*x" 7 -10)) " fffffff6"
+    test "test2601" (lazy(sprintf "%x" 55s)) "37"
+    test "test2602" (lazy(sprintf "%5x" 55s)) "   37"
+    test "test2603" (lazy(sprintf "%1x" 55s)) "37"
+    test "test2604" (lazy(sprintf "%*x" 7 55s)) "     37"
+    test "test2605" (lazy(sprintf "%-x" 55s)) "37"
+    test "test2606" (lazy(sprintf "%-5x" 55s)) "37   "
+    test "test2607" (lazy(sprintf "%-1x" 55s)) "37"
+    test "test2608" (lazy(sprintf "%-*x" 7 55s)) "37     "
+    test "test2609" (lazy(sprintf "%0x" 55s)) "37"
+    test "test2610" (lazy(sprintf "%05x" 55s)) "00037"
+    test "test2611" (lazy(sprintf "%01x" 55s)) "37"
+    test "test2612" (lazy(sprintf "%0*x" 7 55s)) "0000037"
+    test "test2613" (lazy(sprintf "%-0x" 55s)) "37"
+    test "test2614" (lazy(sprintf "%-05x" 55s)) "37   "
+    test "test2615" (lazy(sprintf "%-01x" 55s)) "37"
+    test "test2616" (lazy(sprintf "%-0*x" 7 55s)) "37     "
+    test "test2617" (lazy(sprintf "%+x" 55s)) "+37"
+    test "test2618" (lazy(sprintf "%+5x" 55s)) "  +37"
+    test "test2619" (lazy(sprintf "%+1x" 55s)) "+37"
+    test "test2620" (lazy(sprintf "%+*x" 7 55s)) "    +37"
+    test "test2621" (lazy(sprintf "%-+x" 55s)) "+37"
+    test "test2622" (lazy(sprintf "%-+5x" 55s)) "+37  "
+    test "test2623" (lazy(sprintf "%-+1x" 55s)) "+37"
+    test "test2624" (lazy(sprintf "%-+*x" 7 55s)) "+37    "
+    test "test2625" (lazy(sprintf "%+0x" 55s)) "+37"
+    test "test2626" (lazy(sprintf "%+05x" 55s)) "+0037"
+    test "test2627" (lazy(sprintf "%+01x" 55s)) "+37"
+    test "test2628" (lazy(sprintf "%+0*x" 7 55s)) "+000037"
+    test "test2629" (lazy(sprintf "%-+0x" 55s)) "+37"
+    test "test2630" (lazy(sprintf "%-+05x" 55s)) "+37  "
+    test "test2631" (lazy(sprintf "%-+01x" 55s)) "+37"
+    test "test2632" (lazy(sprintf "%-+0*x" 7 55s)) "+37    "
+    test "test2633" (lazy(sprintf "% x" 55s)) " 37"
+    test "test2634" (lazy(sprintf "% 5x" 55s)) "   37"
+    test "test2635" (lazy(sprintf "% 1x" 55s)) " 37"
+    test "test2636" (lazy(sprintf "% *x" 7 55s)) "     37"
+    test "test2637" (lazy(sprintf "%- x" 55s)) " 37"
+    test "test2638" (lazy(sprintf "%- 5x" 55s)) " 37  "
+    test "test2639" (lazy(sprintf "%- 1x" 55s)) " 37"
+    test "test2640" (lazy(sprintf "%- *x" 7 55s)) " 37    "
+    test "test2641" (lazy(sprintf "% 0x" 55s)) " 37"
+    test "test2642" (lazy(sprintf "% 05x" 55s)) " 0037"
+    test "test2643" (lazy(sprintf "% 01x" 55s)) " 37"
+    test "test2644" (lazy(sprintf "% 0*x" 7 55s)) " 000037"
+    test "test2645" (lazy(sprintf "%- 0x" 55s)) " 37"
+    test "test2646" (lazy(sprintf "%- 05x" 55s)) " 37  "
+    test "test2647" (lazy(sprintf "%- 01x" 55s)) " 37"
+    test "test2648" (lazy(sprintf "%- 0*x" 7 55s)) " 37    "
+    test "test2649" (lazy(sprintf "%x" -88s)) "ffa8"
+    test "test2650" (lazy(sprintf "%5x" -88s)) " ffa8"
+    test "test2651" (lazy(sprintf "%1x" -88s)) "ffa8"
+    test "test2652" (lazy(sprintf "%*x" 7 -88s)) "   ffa8"
+    test "test2653" (lazy(sprintf "%-x" -88s)) "ffa8"
+    test "test2654" (lazy(sprintf "%-5x" -88s)) "ffa8 "
+    test "test2655" (lazy(sprintf "%-1x" -88s)) "ffa8"
+    test "test2656" (lazy(sprintf "%-*x" 7 -88s)) "ffa8   "
+    test "test2657" (lazy(sprintf "%0x" -88s)) "ffa8"
+    test "test2658" (lazy(sprintf "%05x" -88s)) "0ffa8"
+    test "test2659" (lazy(sprintf "%01x" -88s)) "ffa8"
+    test "test2660" (lazy(sprintf "%0*x" 7 -88s)) "000ffa8"
+    test "test2661" (lazy(sprintf "%-0x" -88s)) "ffa8"
+    test "test2662" (lazy(sprintf "%-05x" -88s)) "ffa8 "
+    test "test2663" (lazy(sprintf "%-01x" -88s)) "ffa8"
+    test "test2664" (lazy(sprintf "%-0*x" 7 -88s)) "ffa8   "
+    test "test2665" (lazy(sprintf "%+x" -88s)) "+ffa8"
+    test "test2666" (lazy(sprintf "%+5x" -88s)) "+ffa8"
+    test "test2667" (lazy(sprintf "%+1x" -88s)) "+ffa8"
+    test "test2668" (lazy(sprintf "%+*x" 7 -88s)) "  +ffa8"
+    test "test2669" (lazy(sprintf "%-+x" -88s)) "+ffa8"
+    test "test2670" (lazy(sprintf "%-+5x" -88s)) "+ffa8"
+    test "test2671" (lazy(sprintf "%-+1x" -88s)) "+ffa8"
+    test "test2672" (lazy(sprintf "%-+*x" 7 -88s)) "+ffa8  "
+    test "test2673" (lazy(sprintf "%+0x" -88s)) "+ffa8"
+    test "test2674" (lazy(sprintf "%+05x" -88s)) "+ffa8"
+    test "test2675" (lazy(sprintf "%+01x" -88s)) "+ffa8"
+    test "test2676" (lazy(sprintf "%+0*x" 7 -88s)) "+00ffa8"
+    test "test2677" (lazy(sprintf "%-+0x" -88s)) "+ffa8"
+    test "test2678" (lazy(sprintf "%-+05x" -88s)) "+ffa8"
+    test "test2679" (lazy(sprintf "%-+01x" -88s)) "+ffa8"
+    test "test2680" (lazy(sprintf "%-+0*x" 7 -88s)) "+ffa8  "
+    test "test2681" (lazy(sprintf "% x" -88s)) " ffa8"
+    test "test2682" (lazy(sprintf "% 5x" -88s)) " ffa8"
+    test "test2683" (lazy(sprintf "% 1x" -88s)) " ffa8"
+    test "test2684" (lazy(sprintf "% *x" 7 -88s)) "   ffa8"
+    test "test2685" (lazy(sprintf "%- x" -88s)) " ffa8"
+    test "test2686" (lazy(sprintf "%- 5x" -88s)) " ffa8"
+    test "test2687" (lazy(sprintf "%- 1x" -88s)) " ffa8"
+    test "test2688" (lazy(sprintf "%- *x" 7 -88s)) " ffa8  "
+    test "test2689" (lazy(sprintf "% 0x" -88s)) " ffa8"
+    test "test2690" (lazy(sprintf "% 05x" -88s)) " ffa8"
+    test "test2691" (lazy(sprintf "% 01x" -88s)) " ffa8"
+    test "test2692" (lazy(sprintf "% 0*x" 7 -88s)) " 00ffa8"
+    test "test2693" (lazy(sprintf "%- 0x" -88s)) " ffa8"
+    test "test2694" (lazy(sprintf "%- 05x" -88s)) " ffa8"
+    test "test2695" (lazy(sprintf "%- 01x" -88s)) " ffa8"
+    test "test2696" (lazy(sprintf "%- 0*x" 7 -88s)) " ffa8  "
+    test "test2697" (lazy(sprintf "%x" 104us)) "68"
+    test "test2698" (lazy(sprintf "%5x" 104us)) "   68"
+    test "test2699" (lazy(sprintf "%1x" 104us)) "68"
+    test "test2700" (lazy(sprintf "%*x" 7 104us)) "     68"
+    test "test2701" (lazy(sprintf "%-x" 104us)) "68"
+    test "test2702" (lazy(sprintf "%-5x" 104us)) "68   "
+    test "test2703" (lazy(sprintf "%-1x" 104us)) "68"
+    test "test2704" (lazy(sprintf "%-*x" 7 104us)) "68     "
+    test "test2705" (lazy(sprintf "%0x" 104us)) "68"
+    test "test2706" (lazy(sprintf "%05x" 104us)) "00068"
+    test "test2707" (lazy(sprintf "%01x" 104us)) "68"
+    test "test2708" (lazy(sprintf "%0*x" 7 104us)) "0000068"
+    test "test2709" (lazy(sprintf "%-0x" 104us)) "68"
+    test "test2710" (lazy(sprintf "%-05x" 104us)) "68   "
+    test "test2711" (lazy(sprintf "%-01x" 104us)) "68"
+    test "test2712" (lazy(sprintf "%-0*x" 7 104us)) "68     "
+    test "test2713" (lazy(sprintf "%+x" 104us)) "+68"
+    test "test2714" (lazy(sprintf "%+5x" 104us)) "  +68"
+    test "test2715" (lazy(sprintf "%+1x" 104us)) "+68"
+    test "test2716" (lazy(sprintf "%+*x" 7 104us)) "    +68"
+    test "test2717" (lazy(sprintf "%-+x" 104us)) "+68"
+    test "test2718" (lazy(sprintf "%-+5x" 104us)) "+68  "
+    test "test2719" (lazy(sprintf "%-+1x" 104us)) "+68"
+    test "test2720" (lazy(sprintf "%-+*x" 7 104us)) "+68    "
+    test "test2721" (lazy(sprintf "%+0x" 104us)) "+68"
+    test "test2722" (lazy(sprintf "%+05x" 104us)) "+0068"
+    test "test2723" (lazy(sprintf "%+01x" 104us)) "+68"
+    test "test2724" (lazy(sprintf "%+0*x" 7 104us)) "+000068"
+    test "test2725" (lazy(sprintf "%-+0x" 104us)) "+68"
+    test "test2726" (lazy(sprintf "%-+05x" 104us)) "+68  "
+    test "test2727" (lazy(sprintf "%-+01x" 104us)) "+68"
+    test "test2728" (lazy(sprintf "%-+0*x" 7 104us)) "+68    "
+    test "test2729" (lazy(sprintf "% x" 104us)) " 68"
+    test "test2730" (lazy(sprintf "% 5x" 104us)) "   68"
+    test "test2731" (lazy(sprintf "% 1x" 104us)) " 68"
+    test "test2732" (lazy(sprintf "% *x" 7 104us)) "     68"
+    test "test2733" (lazy(sprintf "%- x" 104us)) " 68"
+    test "test2734" (lazy(sprintf "%- 5x" 104us)) " 68  "
+    test "test2735" (lazy(sprintf "%- 1x" 104us)) " 68"
+    test "test2736" (lazy(sprintf "%- *x" 7 104us)) " 68    "
+    test "test2737" (lazy(sprintf "% 0x" 104us)) " 68"
+    test "test2738" (lazy(sprintf "% 05x" 104us)) " 0068"
+    test "test2739" (lazy(sprintf "% 01x" 104us)) " 68"
+    test "test2740" (lazy(sprintf "% 0*x" 7 104us)) " 000068"
+    test "test2741" (lazy(sprintf "%- 0x" 104us)) " 68"
+    test "test2742" (lazy(sprintf "%- 05x" 104us)) " 68  "
+    test "test2743" (lazy(sprintf "%- 01x" 104us)) " 68"
+    test "test2744" (lazy(sprintf "%- 0*x" 7 104us)) " 68    "
+    test "test2745" (lazy(sprintf "%x" 12y)) "c"
+    test "test2746" (lazy(sprintf "%5x" 12y)) "    c"
+    test "test2747" (lazy(sprintf "%1x" 12y)) "c"
+    test "test2748" (lazy(sprintf "%*x" 7 12y)) "      c"
+    test "test2749" (lazy(sprintf "%-x" 12y)) "c"
+    test "test2750" (lazy(sprintf "%-5x" 12y)) "c    "
+    test "test2751" (lazy(sprintf "%-1x" 12y)) "c"
+    test "test2752" (lazy(sprintf "%-*x" 7 12y)) "c      "
+    test "test2753" (lazy(sprintf "%0x" 12y)) "c"
+    test "test2754" (lazy(sprintf "%05x" 12y)) "0000c"
+    test "test2755" (lazy(sprintf "%01x" 12y)) "c"
+    test "test2756" (lazy(sprintf "%0*x" 7 12y)) "000000c"
+    test "test2757" (lazy(sprintf "%-0x" 12y)) "c"
+    test "test2758" (lazy(sprintf "%-05x" 12y)) "c    "
+    test "test2759" (lazy(sprintf "%-01x" 12y)) "c"
+    test "test2760" (lazy(sprintf "%-0*x" 7 12y)) "c      "
+    test "test2761" (lazy(sprintf "%+x" 12y)) "+c"
+    test "test2762" (lazy(sprintf "%+5x" 12y)) "   +c"
+    test "test2763" (lazy(sprintf "%+1x" 12y)) "+c"
+    test "test2764" (lazy(sprintf "%+*x" 7 12y)) "     +c"
+    test "test2765" (lazy(sprintf "%-+x" 12y)) "+c"
+    test "test2766" (lazy(sprintf "%-+5x" 12y)) "+c   "
+    test "test2767" (lazy(sprintf "%-+1x" 12y)) "+c"
+    test "test2768" (lazy(sprintf "%-+*x" 7 12y)) "+c     "
+    test "test2769" (lazy(sprintf "%+0x" 12y)) "+c"
+    test "test2770" (lazy(sprintf "%+05x" 12y)) "+000c"
+    test "test2771" (lazy(sprintf "%+01x" 12y)) "+c"
+    test "test2772" (lazy(sprintf "%+0*x" 7 12y)) "+00000c"
+    test "test2773" (lazy(sprintf "%-+0x" 12y)) "+c"
+    test "test2774" (lazy(sprintf "%-+05x" 12y)) "+c   "
+    test "test2775" (lazy(sprintf "%-+01x" 12y)) "+c"
+    test "test2776" (lazy(sprintf "%-+0*x" 7 12y)) "+c     "
+    test "test2777" (lazy(sprintf "% x" 12y)) " c"
+    test "test2778" (lazy(sprintf "% 5x" 12y)) "    c"
+    test "test2779" (lazy(sprintf "% 1x" 12y)) " c"
+    test "test2780" (lazy(sprintf "% *x" 7 12y)) "      c"
+    test "test2781" (lazy(sprintf "%- x" 12y)) " c"
+    test "test2782" (lazy(sprintf "%- 5x" 12y)) " c   "
+    test "test2783" (lazy(sprintf "%- 1x" 12y)) " c"
+    test "test2784" (lazy(sprintf "%- *x" 7 12y)) " c     "
+    test "test2785" (lazy(sprintf "% 0x" 12y)) " c"
+    test "test2786" (lazy(sprintf "% 05x" 12y)) " 000c"
+    test "test2787" (lazy(sprintf "% 01x" 12y)) " c"
+    test "test2788" (lazy(sprintf "% 0*x" 7 12y)) " 00000c"
+    test "test2789" (lazy(sprintf "%- 0x" 12y)) " c"
+    test "test2790" (lazy(sprintf "%- 05x" 12y)) " c   "
+    test "test2791" (lazy(sprintf "%- 01x" 12y)) " c"
+    test "test2792" (lazy(sprintf "%- 0*x" 7 12y)) " c     "
+    test "test2793" (lazy(sprintf "%x" -94y)) "a2"
+    test "test2794" (lazy(sprintf "%5x" -94y)) "   a2"
+    test "test2795" (lazy(sprintf "%1x" -94y)) "a2"
+    test "test2796" (lazy(sprintf "%*x" 7 -94y)) "     a2"
+    test "test2797" (lazy(sprintf "%-x" -94y)) "a2"
+    test "test2798" (lazy(sprintf "%-5x" -94y)) "a2   "
+    test "test2799" (lazy(sprintf "%-1x" -94y)) "a2"
+    test "test2800" (lazy(sprintf "%-*x" 7 -94y)) "a2     "
+    test "test2801" (lazy(sprintf "%0x" -94y)) "a2"
+    test "test2802" (lazy(sprintf "%05x" -94y)) "000a2"
+    test "test2803" (lazy(sprintf "%01x" -94y)) "a2"
+    test "test2804" (lazy(sprintf "%0*x" 7 -94y)) "00000a2"
+    test "test2805" (lazy(sprintf "%-0x" -94y)) "a2"
+    test "test2806" (lazy(sprintf "%-05x" -94y)) "a2   "
+    test "test2807" (lazy(sprintf "%-01x" -94y)) "a2"
+    test "test2808" (lazy(sprintf "%-0*x" 7 -94y)) "a2     "
+    test "test2809" (lazy(sprintf "%+x" -94y)) "+a2"
+    test "test2810" (lazy(sprintf "%+5x" -94y)) "  +a2"
+    test "test2811" (lazy(sprintf "%+1x" -94y)) "+a2"
+    test "test2812" (lazy(sprintf "%+*x" 7 -94y)) "    +a2"
+    test "test2813" (lazy(sprintf "%-+x" -94y)) "+a2"
+    test "test2814" (lazy(sprintf "%-+5x" -94y)) "+a2  "
+    test "test2815" (lazy(sprintf "%-+1x" -94y)) "+a2"
+    test "test2816" (lazy(sprintf "%-+*x" 7 -94y)) "+a2    "
+    test "test2817" (lazy(sprintf "%+0x" -94y)) "+a2"
+    test "test2818" (lazy(sprintf "%+05x" -94y)) "+00a2"
+    test "test2819" (lazy(sprintf "%+01x" -94y)) "+a2"
+    test "test2820" (lazy(sprintf "%+0*x" 7 -94y)) "+0000a2"
+    test "test2821" (lazy(sprintf "%-+0x" -94y)) "+a2"
+    test "test2822" (lazy(sprintf "%-+05x" -94y)) "+a2  "
+    test "test2823" (lazy(sprintf "%-+01x" -94y)) "+a2"
+    test "test2824" (lazy(sprintf "%-+0*x" 7 -94y)) "+a2    "
+    test "test2825" (lazy(sprintf "% x" -94y)) " a2"
+    test "test2826" (lazy(sprintf "% 5x" -94y)) "   a2"
+    test "test2827" (lazy(sprintf "% 1x" -94y)) " a2"
+    test "test2828" (lazy(sprintf "% *x" 7 -94y)) "     a2"
+    test "test2829" (lazy(sprintf "%- x" -94y)) " a2"
+    test "test2830" (lazy(sprintf "%- 5x" -94y)) " a2  "
+    test "test2831" (lazy(sprintf "%- 1x" -94y)) " a2"
+    test "test2832" (lazy(sprintf "%- *x" 7 -94y)) " a2    "
+    test "test2833" (lazy(sprintf "% 0x" -94y)) " a2"
+    test "test2834" (lazy(sprintf "% 05x" -94y)) " 00a2"
+    test "test2835" (lazy(sprintf "% 01x" -94y)) " a2"
+    test "test2836" (lazy(sprintf "% 0*x" 7 -94y)) " 0000a2"
+    test "test2837" (lazy(sprintf "%- 0x" -94y)) " a2"
+    test "test2838" (lazy(sprintf "%- 05x" -94y)) " a2  "
+    test "test2839" (lazy(sprintf "%- 01x" -94y)) " a2"
+    test "test2840" (lazy(sprintf "%- 0*x" 7 -94y)) " a2    "
+    test "test2841" (lazy(sprintf "%x" 88uy)) "58"
+    test "test2842" (lazy(sprintf "%5x" 88uy)) "   58"
+    test "test2843" (lazy(sprintf "%1x" 88uy)) "58"
+    test "test2844" (lazy(sprintf "%*x" 7 88uy)) "     58"
+    test "test2845" (lazy(sprintf "%-x" 88uy)) "58"
+    test "test2846" (lazy(sprintf "%-5x" 88uy)) "58   "
+    test "test2847" (lazy(sprintf "%-1x" 88uy)) "58"
+    test "test2848" (lazy(sprintf "%-*x" 7 88uy)) "58     "
+    test "test2849" (lazy(sprintf "%0x" 88uy)) "58"
+    test "test2850" (lazy(sprintf "%05x" 88uy)) "00058"
+    test "test2851" (lazy(sprintf "%01x" 88uy)) "58"
+    test "test2852" (lazy(sprintf "%0*x" 7 88uy)) "0000058"
+    test "test2853" (lazy(sprintf "%-0x" 88uy)) "58"
+    test "test2854" (lazy(sprintf "%-05x" 88uy)) "58   "
+    test "test2855" (lazy(sprintf "%-01x" 88uy)) "58"
+    test "test2856" (lazy(sprintf "%-0*x" 7 88uy)) "58     "
+    test "test2857" (lazy(sprintf "%+x" 88uy)) "+58"
+    test "test2858" (lazy(sprintf "%+5x" 88uy)) "  +58"
+    test "test2859" (lazy(sprintf "%+1x" 88uy)) "+58"
+    test "test2860" (lazy(sprintf "%+*x" 7 88uy)) "    +58"
+    test "test2861" (lazy(sprintf "%-+x" 88uy)) "+58"
+    test "test2862" (lazy(sprintf "%-+5x" 88uy)) "+58  "
+    test "test2863" (lazy(sprintf "%-+1x" 88uy)) "+58"
+    test "test2864" (lazy(sprintf "%-+*x" 7 88uy)) "+58    "
+    test "test2865" (lazy(sprintf "%+0x" 88uy)) "+58"
+    test "test2866" (lazy(sprintf "%+05x" 88uy)) "+0058"
+    test "test2867" (lazy(sprintf "%+01x" 88uy)) "+58"
+    test "test2868" (lazy(sprintf "%+0*x" 7 88uy)) "+000058"
+    test "test2869" (lazy(sprintf "%-+0x" 88uy)) "+58"
+    test "test2870" (lazy(sprintf "%-+05x" 88uy)) "+58  "
+    test "test2871" (lazy(sprintf "%-+01x" 88uy)) "+58"
+    test "test2872" (lazy(sprintf "%-+0*x" 7 88uy)) "+58    "
+    test "test2873" (lazy(sprintf "% x" 88uy)) " 58"
+    test "test2874" (lazy(sprintf "% 5x" 88uy)) "   58"
+    test "test2875" (lazy(sprintf "% 1x" 88uy)) " 58"
+    test "test2876" (lazy(sprintf "% *x" 7 88uy)) "     58"
+    test "test2877" (lazy(sprintf "%- x" 88uy)) " 58"
+    test "test2878" (lazy(sprintf "%- 5x" 88uy)) " 58  "
+    test "test2879" (lazy(sprintf "%- 1x" 88uy)) " 58"
+    test "test2880" (lazy(sprintf "%- *x" 7 88uy)) " 58    "
+    test "test2881" (lazy(sprintf "% 0x" 88uy)) " 58"
+    test "test2882" (lazy(sprintf "% 05x" 88uy)) " 0058"
+    test "test2883" (lazy(sprintf "% 01x" 88uy)) " 58"
+    test "test2884" (lazy(sprintf "% 0*x" 7 88uy)) " 000058"
+    test "test2885" (lazy(sprintf "%- 0x" 88uy)) " 58"
+    test "test2886" (lazy(sprintf "%- 05x" 88uy)) " 58  "
+    test "test2887" (lazy(sprintf "%- 01x" 88uy)) " 58"
+    test "test2888" (lazy(sprintf "%- 0*x" 7 88uy)) " 58    "
+    test "test2889" (lazy(sprintf "%x" 999L)) "3e7"
+    test "test2890" (lazy(sprintf "%5x" 999L)) "  3e7"
+    test "test2891" (lazy(sprintf "%1x" 999L)) "3e7"
+    test "test2892" (lazy(sprintf "%*x" 7 999L)) "    3e7"
+    test "test2893" (lazy(sprintf "%-x" 999L)) "3e7"
+    test "test2894" (lazy(sprintf "%-5x" 999L)) "3e7  "
+    test "test2895" (lazy(sprintf "%-1x" 999L)) "3e7"
+    test "test2896" (lazy(sprintf "%-*x" 7 999L)) "3e7    "
+    test "test2897" (lazy(sprintf "%0x" 999L)) "3e7"
+    test "test2898" (lazy(sprintf "%05x" 999L)) "003e7"
+    test "test2899" (lazy(sprintf "%01x" 999L)) "3e7"
+    test "test2900" (lazy(sprintf "%0*x" 7 999L)) "00003e7"
+    test "test2901" (lazy(sprintf "%-0x" 999L)) "3e7"
+    test "test2902" (lazy(sprintf "%-05x" 999L)) "3e7  "
+    test "test2903" (lazy(sprintf "%-01x" 999L)) "3e7"
+    test "test2904" (lazy(sprintf "%-0*x" 7 999L)) "3e7    "
+    test "test2905" (lazy(sprintf "%+x" 999L)) "+3e7"
+    test "test2906" (lazy(sprintf "%+5x" 999L)) " +3e7"
+    test "test2907" (lazy(sprintf "%+1x" 999L)) "+3e7"
+    test "test2908" (lazy(sprintf "%+*x" 7 999L)) "   +3e7"
+    test "test2909" (lazy(sprintf "%-+x" 999L)) "+3e7"
+    test "test2910" (lazy(sprintf "%-+5x" 999L)) "+3e7 "
+    test "test2911" (lazy(sprintf "%-+1x" 999L)) "+3e7"
+    test "test2912" (lazy(sprintf "%-+*x" 7 999L)) "+3e7   "
+    test "test2913" (lazy(sprintf "%+0x" 999L)) "+3e7"
+    test "test2914" (lazy(sprintf "%+05x" 999L)) "+03e7"
+    test "test2915" (lazy(sprintf "%+01x" 999L)) "+3e7"
+    test "test2916" (lazy(sprintf "%+0*x" 7 999L)) "+0003e7"
+    test "test2917" (lazy(sprintf "%-+0x" 999L)) "+3e7"
+    test "test2918" (lazy(sprintf "%-+05x" 999L)) "+3e7 "
+    test "test2919" (lazy(sprintf "%-+01x" 999L)) "+3e7"
+    test "test2920" (lazy(sprintf "%-+0*x" 7 999L)) "+3e7   "
+    test "test2921" (lazy(sprintf "% x" 999L)) " 3e7"
+    test "test2922" (lazy(sprintf "% 5x" 999L)) "  3e7"
+    test "test2923" (lazy(sprintf "% 1x" 999L)) " 3e7"
+    test "test2924" (lazy(sprintf "% *x" 7 999L)) "    3e7"
+    test "test2925" (lazy(sprintf "%- x" 999L)) " 3e7"
+    test "test2926" (lazy(sprintf "%- 5x" 999L)) " 3e7 "
+    test "test2927" (lazy(sprintf "%- 1x" 999L)) " 3e7"
+    test "test2928" (lazy(sprintf "%- *x" 7 999L)) " 3e7   "
+    test "test2929" (lazy(sprintf "% 0x" 999L)) " 3e7"
+    test "test2930" (lazy(sprintf "% 05x" 999L)) " 03e7"
+    test "test2931" (lazy(sprintf "% 01x" 999L)) " 3e7"
+    test "test2932" (lazy(sprintf "% 0*x" 7 999L)) " 0003e7"
+    test "test2933" (lazy(sprintf "%- 0x" 999L)) " 3e7"
+    test "test2934" (lazy(sprintf "%- 05x" 999L)) " 3e7 "
+    test "test2935" (lazy(sprintf "%- 01x" 999L)) " 3e7"
+    test "test2936" (lazy(sprintf "%- 0*x" 7 999L)) " 3e7   "
+    test "test2937" (lazy(sprintf "%x" -321L)) "fffffffffffffebf"
+    test "test2938" (lazy(sprintf "%5x" -321L)) "fffffffffffffebf"
+    test "test2939" (lazy(sprintf "%1x" -321L)) "fffffffffffffebf"
+    test "test2940" (lazy(sprintf "%*x" 7 -321L)) "fffffffffffffebf"
+    test "test2941" (lazy(sprintf "%-x" -321L)) "fffffffffffffebf"
+    test "test2942" (lazy(sprintf "%-5x" -321L)) "fffffffffffffebf"
+    test "test2943" (lazy(sprintf "%-1x" -321L)) "fffffffffffffebf"
+    test "test2944" (lazy(sprintf "%-*x" 7 -321L)) "fffffffffffffebf"
+    test "test2945" (lazy(sprintf "%0x" -321L)) "fffffffffffffebf"
+    test "test2946" (lazy(sprintf "%05x" -321L)) "fffffffffffffebf"
+    test "test2947" (lazy(sprintf "%01x" -321L)) "fffffffffffffebf"
+    test "test2948" (lazy(sprintf "%0*x" 7 -321L)) "fffffffffffffebf"
+    test "test2949" (lazy(sprintf "%-0x" -321L)) "fffffffffffffebf"
+    test "test2950" (lazy(sprintf "%-05x" -321L)) "fffffffffffffebf"
+    test "test2951" (lazy(sprintf "%-01x" -321L)) "fffffffffffffebf"
+    test "test2952" (lazy(sprintf "%-0*x" 7 -321L)) "fffffffffffffebf"
+    test "test2953" (lazy(sprintf "%+x" -321L)) "+fffffffffffffebf"
+    test "test2954" (lazy(sprintf "%+5x" -321L)) "+fffffffffffffebf"
+    test "test2955" (lazy(sprintf "%+1x" -321L)) "+fffffffffffffebf"
+    test "test2956" (lazy(sprintf "%+*x" 7 -321L)) "+fffffffffffffebf"
+    test "test2957" (lazy(sprintf "%-+x" -321L)) "+fffffffffffffebf"
+    test "test2958" (lazy(sprintf "%-+5x" -321L)) "+fffffffffffffebf"
+    test "test2959" (lazy(sprintf "%-+1x" -321L)) "+fffffffffffffebf"
+    test "test2960" (lazy(sprintf "%-+*x" 7 -321L)) "+fffffffffffffebf"
+    test "test2961" (lazy(sprintf "%+0x" -321L)) "+fffffffffffffebf"
+    test "test2962" (lazy(sprintf "%+05x" -321L)) "+fffffffffffffebf"
+    test "test2963" (lazy(sprintf "%+01x" -321L)) "+fffffffffffffebf"
+    test "test2964" (lazy(sprintf "%+0*x" 7 -321L)) "+fffffffffffffebf"
+    test "test2965" (lazy(sprintf "%-+0x" -321L)) "+fffffffffffffebf"
+    test "test2966" (lazy(sprintf "%-+05x" -321L)) "+fffffffffffffebf"
+    test "test2967" (lazy(sprintf "%-+01x" -321L)) "+fffffffffffffebf"
+    test "test2968" (lazy(sprintf "%-+0*x" 7 -321L)) "+fffffffffffffebf"
+    test "test2969" (lazy(sprintf "% x" -321L)) " fffffffffffffebf"
+    test "test2970" (lazy(sprintf "% 5x" -321L)) " fffffffffffffebf"
+    test "test2971" (lazy(sprintf "% 1x" -321L)) " fffffffffffffebf"
+    test "test2972" (lazy(sprintf "% *x" 7 -321L)) " fffffffffffffebf"
+    test "test2973" (lazy(sprintf "%- x" -321L)) " fffffffffffffebf"
+    test "test2974" (lazy(sprintf "%- 5x" -321L)) " fffffffffffffebf"
+    test "test2975" (lazy(sprintf "%- 1x" -321L)) " fffffffffffffebf"
+    test "test2976" (lazy(sprintf "%- *x" 7 -321L)) " fffffffffffffebf"
+    test "test2977" (lazy(sprintf "% 0x" -321L)) " fffffffffffffebf"
+    test "test2978" (lazy(sprintf "% 05x" -321L)) " fffffffffffffebf"
+    test "test2979" (lazy(sprintf "% 01x" -321L)) " fffffffffffffebf"
+    test "test2980" (lazy(sprintf "% 0*x" 7 -321L)) " fffffffffffffebf"
+    test "test2981" (lazy(sprintf "%- 0x" -321L)) " fffffffffffffebf"
+    test "test2982" (lazy(sprintf "%- 05x" -321L)) " fffffffffffffebf"
+    test "test2983" (lazy(sprintf "%- 01x" -321L)) " fffffffffffffebf"
+    test "test2984" (lazy(sprintf "%- 0*x" 7 -321L)) " fffffffffffffebf"
+    test "test2985" (lazy(sprintf "%x" 50000UL)) "c350"
+    test "test2986" (lazy(sprintf "%5x" 50000UL)) " c350"
+    test "test2987" (lazy(sprintf "%1x" 50000UL)) "c350"
+    test "test2988" (lazy(sprintf "%*x" 7 50000UL)) "   c350"
+    test "test2989" (lazy(sprintf "%-x" 50000UL)) "c350"
+    test "test2990" (lazy(sprintf "%-5x" 50000UL)) "c350 "
+    test "test2991" (lazy(sprintf "%-1x" 50000UL)) "c350"
+    test "test2992" (lazy(sprintf "%-*x" 7 50000UL)) "c350   "
+    test "test2993" (lazy(sprintf "%0x" 50000UL)) "c350"
+    test "test2994" (lazy(sprintf "%05x" 50000UL)) "0c350"
+    test "test2995" (lazy(sprintf "%01x" 50000UL)) "c350"
+    test "test2996" (lazy(sprintf "%0*x" 7 50000UL)) "000c350"
+    test "test2997" (lazy(sprintf "%-0x" 50000UL)) "c350"
+    test "test2998" (lazy(sprintf "%-05x" 50000UL)) "c350 "
+    test "test2999" (lazy(sprintf "%-01x" 50000UL)) "c350"
+    test "test3000" (lazy(sprintf "%-0*x" 7 50000UL)) "c350   "
+let func3000()=
+    test "test3001" (lazy(sprintf "%+x" 50000UL)) "+c350"
+    test "test3002" (lazy(sprintf "%+5x" 50000UL)) "+c350"
+    test "test3003" (lazy(sprintf "%+1x" 50000UL)) "+c350"
+    test "test3004" (lazy(sprintf "%+*x" 7 50000UL)) "  +c350"
+    test "test3005" (lazy(sprintf "%-+x" 50000UL)) "+c350"
+    test "test3006" (lazy(sprintf "%-+5x" 50000UL)) "+c350"
+    test "test3007" (lazy(sprintf "%-+1x" 50000UL)) "+c350"
+    test "test3008" (lazy(sprintf "%-+*x" 7 50000UL)) "+c350  "
+    test "test3009" (lazy(sprintf "%+0x" 50000UL)) "+c350"
+    test "test3010" (lazy(sprintf "%+05x" 50000UL)) "+c350"
+    test "test3011" (lazy(sprintf "%+01x" 50000UL)) "+c350"
+    test "test3012" (lazy(sprintf "%+0*x" 7 50000UL)) "+00c350"
+    test "test3013" (lazy(sprintf "%-+0x" 50000UL)) "+c350"
+    test "test3014" (lazy(sprintf "%-+05x" 50000UL)) "+c350"
+    test "test3015" (lazy(sprintf "%-+01x" 50000UL)) "+c350"
+    test "test3016" (lazy(sprintf "%-+0*x" 7 50000UL)) "+c350  "
+    test "test3017" (lazy(sprintf "% x" 50000UL)) " c350"
+    test "test3018" (lazy(sprintf "% 5x" 50000UL)) " c350"
+    test "test3019" (lazy(sprintf "% 1x" 50000UL)) " c350"
+    test "test3020" (lazy(sprintf "% *x" 7 50000UL)) "   c350"
+    test "test3021" (lazy(sprintf "%- x" 50000UL)) " c350"
+    test "test3022" (lazy(sprintf "%- 5x" 50000UL)) " c350"
+    test "test3023" (lazy(sprintf "%- 1x" 50000UL)) " c350"
+    test "test3024" (lazy(sprintf "%- *x" 7 50000UL)) " c350  "
+    test "test3025" (lazy(sprintf "% 0x" 50000UL)) " c350"
+    test "test3026" (lazy(sprintf "% 05x" 50000UL)) " c350"
+    test "test3027" (lazy(sprintf "% 01x" 50000UL)) " c350"
+    test "test3028" (lazy(sprintf "% 0*x" 7 50000UL)) " 00c350"
+    test "test3029" (lazy(sprintf "%- 0x" 50000UL)) " c350"
+    test "test3030" (lazy(sprintf "%- 05x" 50000UL)) " c350"
+    test "test3031" (lazy(sprintf "%- 01x" 50000UL)) " c350"
+    test "test3032" (lazy(sprintf "%- 0*x" 7 50000UL)) " c350  "
+    test "test3033" (lazy(sprintf "%x" System.Int32.MaxValue)) "7fffffff"
+    test "test3034" (lazy(sprintf "%5x" System.Int32.MaxValue)) "7fffffff"
+    test "test3035" (lazy(sprintf "%1x" System.Int32.MaxValue)) "7fffffff"
+    test "test3036" (lazy(sprintf "%*x" 7 System.Int32.MaxValue)) "7fffffff"
+    test "test3037" (lazy(sprintf "%-x" System.Int32.MaxValue)) "7fffffff"
+    test "test3038" (lazy(sprintf "%-5x" System.Int32.MaxValue)) "7fffffff"
+    test "test3039" (lazy(sprintf "%-1x" System.Int32.MaxValue)) "7fffffff"
+    test "test3040" (lazy(sprintf "%-*x" 7 System.Int32.MaxValue)) "7fffffff"
+    test "test3041" (lazy(sprintf "%0x" System.Int32.MaxValue)) "7fffffff"
+    test "test3042" (lazy(sprintf "%05x" System.Int32.MaxValue)) "7fffffff"
+    test "test3043" (lazy(sprintf "%01x" System.Int32.MaxValue)) "7fffffff"
+    test "test3044" (lazy(sprintf "%0*x" 7 System.Int32.MaxValue)) "7fffffff"
+    test "test3045" (lazy(sprintf "%-0x" System.Int32.MaxValue)) "7fffffff"
+    test "test3046" (lazy(sprintf "%-05x" System.Int32.MaxValue)) "7fffffff"
+    test "test3047" (lazy(sprintf "%-01x" System.Int32.MaxValue)) "7fffffff"
+    test "test3048" (lazy(sprintf "%-0*x" 7 System.Int32.MaxValue)) "7fffffff"
+    test "test3049" (lazy(sprintf "%+x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3050" (lazy(sprintf "%+5x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3051" (lazy(sprintf "%+1x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3052" (lazy(sprintf "%+*x" 7 System.Int32.MaxValue)) "+7fffffff"
+    test "test3053" (lazy(sprintf "%-+x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3054" (lazy(sprintf "%-+5x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3055" (lazy(sprintf "%-+1x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3056" (lazy(sprintf "%-+*x" 7 System.Int32.MaxValue)) "+7fffffff"
+    test "test3057" (lazy(sprintf "%+0x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3058" (lazy(sprintf "%+05x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3059" (lazy(sprintf "%+01x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3060" (lazy(sprintf "%+0*x" 7 System.Int32.MaxValue)) "+7fffffff"
+    test "test3061" (lazy(sprintf "%-+0x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3062" (lazy(sprintf "%-+05x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3063" (lazy(sprintf "%-+01x" System.Int32.MaxValue)) "+7fffffff"
+    test "test3064" (lazy(sprintf "%-+0*x" 7 System.Int32.MaxValue)) "+7fffffff"
+    test "test3065" (lazy(sprintf "% x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3066" (lazy(sprintf "% 5x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3067" (lazy(sprintf "% 1x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3068" (lazy(sprintf "% *x" 7 System.Int32.MaxValue)) " 7fffffff"
+    test "test3069" (lazy(sprintf "%- x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3070" (lazy(sprintf "%- 5x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3071" (lazy(sprintf "%- 1x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3072" (lazy(sprintf "%- *x" 7 System.Int32.MaxValue)) " 7fffffff"
+    test "test3073" (lazy(sprintf "% 0x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3074" (lazy(sprintf "% 05x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3075" (lazy(sprintf "% 01x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3076" (lazy(sprintf "% 0*x" 7 System.Int32.MaxValue)) " 7fffffff"
+    test "test3077" (lazy(sprintf "%- 0x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3078" (lazy(sprintf "%- 05x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3079" (lazy(sprintf "%- 01x" System.Int32.MaxValue)) " 7fffffff"
+    test "test3080" (lazy(sprintf "%- 0*x" 7 System.Int32.MaxValue)) " 7fffffff"
+    test "test3081" (lazy(sprintf "%x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3082" (lazy(sprintf "%5x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3083" (lazy(sprintf "%1x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3084" (lazy(sprintf "%*x" 7 System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3085" (lazy(sprintf "%-x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3086" (lazy(sprintf "%-5x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3087" (lazy(sprintf "%-1x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3088" (lazy(sprintf "%-*x" 7 System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3089" (lazy(sprintf "%0x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3090" (lazy(sprintf "%05x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3091" (lazy(sprintf "%01x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3092" (lazy(sprintf "%0*x" 7 System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3093" (lazy(sprintf "%-0x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3094" (lazy(sprintf "%-05x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3095" (lazy(sprintf "%-01x" System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3096" (lazy(sprintf "%-0*x" 7 System.Int64.MaxValue)) "7fffffffffffffff"
+    test "test3097" (lazy(sprintf "%+x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3098" (lazy(sprintf "%+5x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3099" (lazy(sprintf "%+1x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3100" (lazy(sprintf "%+*x" 7 System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3101" (lazy(sprintf "%-+x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3102" (lazy(sprintf "%-+5x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3103" (lazy(sprintf "%-+1x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3104" (lazy(sprintf "%-+*x" 7 System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3105" (lazy(sprintf "%+0x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3106" (lazy(sprintf "%+05x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3107" (lazy(sprintf "%+01x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3108" (lazy(sprintf "%+0*x" 7 System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3109" (lazy(sprintf "%-+0x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3110" (lazy(sprintf "%-+05x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3111" (lazy(sprintf "%-+01x" System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3112" (lazy(sprintf "%-+0*x" 7 System.Int64.MaxValue)) "+7fffffffffffffff"
+    test "test3113" (lazy(sprintf "% x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3114" (lazy(sprintf "% 5x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3115" (lazy(sprintf "% 1x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3116" (lazy(sprintf "% *x" 7 System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3117" (lazy(sprintf "%- x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3118" (lazy(sprintf "%- 5x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3119" (lazy(sprintf "%- 1x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3120" (lazy(sprintf "%- *x" 7 System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3121" (lazy(sprintf "% 0x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3122" (lazy(sprintf "% 05x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3123" (lazy(sprintf "% 01x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3124" (lazy(sprintf "% 0*x" 7 System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3125" (lazy(sprintf "%- 0x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3126" (lazy(sprintf "%- 05x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3127" (lazy(sprintf "%- 01x" System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3128" (lazy(sprintf "%- 0*x" 7 System.Int64.MaxValue)) " 7fffffffffffffff"
+    test "test3129" (lazy(sprintf "%x" System.Int32.MinValue)) "80000000"
+    test "test3130" (lazy(sprintf "%5x" System.Int32.MinValue)) "80000000"
+    test "test3131" (lazy(sprintf "%1x" System.Int32.MinValue)) "80000000"
+    test "test3132" (lazy(sprintf "%*x" 7 System.Int32.MinValue)) "80000000"
+    test "test3133" (lazy(sprintf "%-x" System.Int32.MinValue)) "80000000"
+    test "test3134" (lazy(sprintf "%-5x" System.Int32.MinValue)) "80000000"
+    test "test3135" (lazy(sprintf "%-1x" System.Int32.MinValue)) "80000000"
+    test "test3136" (lazy(sprintf "%-*x" 7 System.Int32.MinValue)) "80000000"
+    test "test3137" (lazy(sprintf "%0x" System.Int32.MinValue)) "80000000"
+    test "test3138" (lazy(sprintf "%05x" System.Int32.MinValue)) "80000000"
+    test "test3139" (lazy(sprintf "%01x" System.Int32.MinValue)) "80000000"
+    test "test3140" (lazy(sprintf "%0*x" 7 System.Int32.MinValue)) "80000000"
+    test "test3141" (lazy(sprintf "%-0x" System.Int32.MinValue)) "80000000"
+    test "test3142" (lazy(sprintf "%-05x" System.Int32.MinValue)) "80000000"
+    test "test3143" (lazy(sprintf "%-01x" System.Int32.MinValue)) "80000000"
+    test "test3144" (lazy(sprintf "%-0*x" 7 System.Int32.MinValue)) "80000000"
+    test "test3145" (lazy(sprintf "%+x" System.Int32.MinValue)) "+80000000"
+    test "test3146" (lazy(sprintf "%+5x" System.Int32.MinValue)) "+80000000"
+    test "test3147" (lazy(sprintf "%+1x" System.Int32.MinValue)) "+80000000"
+    test "test3148" (lazy(sprintf "%+*x" 7 System.Int32.MinValue)) "+80000000"
+    test "test3149" (lazy(sprintf "%-+x" System.Int32.MinValue)) "+80000000"
+    test "test3150" (lazy(sprintf "%-+5x" System.Int32.MinValue)) "+80000000"
+    test "test3151" (lazy(sprintf "%-+1x" System.Int32.MinValue)) "+80000000"
+    test "test3152" (lazy(sprintf "%-+*x" 7 System.Int32.MinValue)) "+80000000"
+    test "test3153" (lazy(sprintf "%+0x" System.Int32.MinValue)) "+80000000"
+    test "test3154" (lazy(sprintf "%+05x" System.Int32.MinValue)) "+80000000"
+    test "test3155" (lazy(sprintf "%+01x" System.Int32.MinValue)) "+80000000"
+    test "test3156" (lazy(sprintf "%+0*x" 7 System.Int32.MinValue)) "+80000000"
+    test "test3157" (lazy(sprintf "%-+0x" System.Int32.MinValue)) "+80000000"
+    test "test3158" (lazy(sprintf "%-+05x" System.Int32.MinValue)) "+80000000"
+    test "test3159" (lazy(sprintf "%-+01x" System.Int32.MinValue)) "+80000000"
+    test "test3160" (lazy(sprintf "%-+0*x" 7 System.Int32.MinValue)) "+80000000"
+    test "test3161" (lazy(sprintf "% x" System.Int32.MinValue)) " 80000000"
+    test "test3162" (lazy(sprintf "% 5x" System.Int32.MinValue)) " 80000000"
+    test "test3163" (lazy(sprintf "% 1x" System.Int32.MinValue)) " 80000000"
+    test "test3164" (lazy(sprintf "% *x" 7 System.Int32.MinValue)) " 80000000"
+    test "test3165" (lazy(sprintf "%- x" System.Int32.MinValue)) " 80000000"
+    test "test3166" (lazy(sprintf "%- 5x" System.Int32.MinValue)) " 80000000"
+    test "test3167" (lazy(sprintf "%- 1x" System.Int32.MinValue)) " 80000000"
+    test "test3168" (lazy(sprintf "%- *x" 7 System.Int32.MinValue)) " 80000000"
+    test "test3169" (lazy(sprintf "% 0x" System.Int32.MinValue)) " 80000000"
+    test "test3170" (lazy(sprintf "% 05x" System.Int32.MinValue)) " 80000000"
+    test "test3171" (lazy(sprintf "% 01x" System.Int32.MinValue)) " 80000000"
+    test "test3172" (lazy(sprintf "% 0*x" 7 System.Int32.MinValue)) " 80000000"
+    test "test3173" (lazy(sprintf "%- 0x" System.Int32.MinValue)) " 80000000"
+    test "test3174" (lazy(sprintf "%- 05x" System.Int32.MinValue)) " 80000000"
+    test "test3175" (lazy(sprintf "%- 01x" System.Int32.MinValue)) " 80000000"
+    test "test3176" (lazy(sprintf "%- 0*x" 7 System.Int32.MinValue)) " 80000000"
+    test "test3177" (lazy(sprintf "%x" System.Int64.MinValue)) "8000000000000000"
+    test "test3178" (lazy(sprintf "%5x" System.Int64.MinValue)) "8000000000000000"
+    test "test3179" (lazy(sprintf "%1x" System.Int64.MinValue)) "8000000000000000"
+    test "test3180" (lazy(sprintf "%*x" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test3181" (lazy(sprintf "%-x" System.Int64.MinValue)) "8000000000000000"
+    test "test3182" (lazy(sprintf "%-5x" System.Int64.MinValue)) "8000000000000000"
+    test "test3183" (lazy(sprintf "%-1x" System.Int64.MinValue)) "8000000000000000"
+    test "test3184" (lazy(sprintf "%-*x" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test3185" (lazy(sprintf "%0x" System.Int64.MinValue)) "8000000000000000"
+    test "test3186" (lazy(sprintf "%05x" System.Int64.MinValue)) "8000000000000000"
+    test "test3187" (lazy(sprintf "%01x" System.Int64.MinValue)) "8000000000000000"
+    test "test3188" (lazy(sprintf "%0*x" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test3189" (lazy(sprintf "%-0x" System.Int64.MinValue)) "8000000000000000"
+    test "test3190" (lazy(sprintf "%-05x" System.Int64.MinValue)) "8000000000000000"
+    test "test3191" (lazy(sprintf "%-01x" System.Int64.MinValue)) "8000000000000000"
+    test "test3192" (lazy(sprintf "%-0*x" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test3193" (lazy(sprintf "%+x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3194" (lazy(sprintf "%+5x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3195" (lazy(sprintf "%+1x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3196" (lazy(sprintf "%+*x" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test3197" (lazy(sprintf "%-+x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3198" (lazy(sprintf "%-+5x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3199" (lazy(sprintf "%-+1x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3200" (lazy(sprintf "%-+*x" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test3201" (lazy(sprintf "%+0x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3202" (lazy(sprintf "%+05x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3203" (lazy(sprintf "%+01x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3204" (lazy(sprintf "%+0*x" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test3205" (lazy(sprintf "%-+0x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3206" (lazy(sprintf "%-+05x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3207" (lazy(sprintf "%-+01x" System.Int64.MinValue)) "+8000000000000000"
+    test "test3208" (lazy(sprintf "%-+0*x" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test3209" (lazy(sprintf "% x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3210" (lazy(sprintf "% 5x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3211" (lazy(sprintf "% 1x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3212" (lazy(sprintf "% *x" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test3213" (lazy(sprintf "%- x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3214" (lazy(sprintf "%- 5x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3215" (lazy(sprintf "%- 1x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3216" (lazy(sprintf "%- *x" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test3217" (lazy(sprintf "% 0x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3218" (lazy(sprintf "% 05x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3219" (lazy(sprintf "% 01x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3220" (lazy(sprintf "% 0*x" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test3221" (lazy(sprintf "%- 0x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3222" (lazy(sprintf "%- 05x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3223" (lazy(sprintf "%- 01x" System.Int64.MinValue)) " 8000000000000000"
+    test "test3224" (lazy(sprintf "%- 0*x" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test3225" (lazy(sprintf "%x" 55n)) "37"
+    test "test3226" (lazy(sprintf "%5x" 55n)) "   37"
+    test "test3227" (lazy(sprintf "%1x" 55n)) "37"
+    test "test3228" (lazy(sprintf "%*x" 7 55n)) "     37"
+    test "test3229" (lazy(sprintf "%-x" 55n)) "37"
+    test "test3230" (lazy(sprintf "%-5x" 55n)) "37   "
+    test "test3231" (lazy(sprintf "%-1x" 55n)) "37"
+    test "test3232" (lazy(sprintf "%-*x" 7 55n)) "37     "
+    test "test3233" (lazy(sprintf "%0x" 55n)) "37"
+    test "test3234" (lazy(sprintf "%05x" 55n)) "00037"
+    test "test3235" (lazy(sprintf "%01x" 55n)) "37"
+    test "test3236" (lazy(sprintf "%0*x" 7 55n)) "0000037"
+    test "test3237" (lazy(sprintf "%-0x" 55n)) "37"
+    test "test3238" (lazy(sprintf "%-05x" 55n)) "37   "
+    test "test3239" (lazy(sprintf "%-01x" 55n)) "37"
+    test "test3240" (lazy(sprintf "%-0*x" 7 55n)) "37     "
+    test "test3241" (lazy(sprintf "%+x" 55n)) "+37"
+    test "test3242" (lazy(sprintf "%+5x" 55n)) "  +37"
+    test "test3243" (lazy(sprintf "%+1x" 55n)) "+37"
+    test "test3244" (lazy(sprintf "%+*x" 7 55n)) "    +37"
+    test "test3245" (lazy(sprintf "%-+x" 55n)) "+37"
+    test "test3246" (lazy(sprintf "%-+5x" 55n)) "+37  "
+    test "test3247" (lazy(sprintf "%-+1x" 55n)) "+37"
+    test "test3248" (lazy(sprintf "%-+*x" 7 55n)) "+37    "
+    test "test3249" (lazy(sprintf "%+0x" 55n)) "+37"
+    test "test3250" (lazy(sprintf "%+05x" 55n)) "+0037"
+    test "test3251" (lazy(sprintf "%+01x" 55n)) "+37"
+    test "test3252" (lazy(sprintf "%+0*x" 7 55n)) "+000037"
+    test "test3253" (lazy(sprintf "%-+0x" 55n)) "+37"
+    test "test3254" (lazy(sprintf "%-+05x" 55n)) "+37  "
+    test "test3255" (lazy(sprintf "%-+01x" 55n)) "+37"
+    test "test3256" (lazy(sprintf "%-+0*x" 7 55n)) "+37    "
+    test "test3257" (lazy(sprintf "% x" 55n)) " 37"
+    test "test3258" (lazy(sprintf "% 5x" 55n)) "   37"
+    test "test3259" (lazy(sprintf "% 1x" 55n)) " 37"
+    test "test3260" (lazy(sprintf "% *x" 7 55n)) "     37"
+    test "test3261" (lazy(sprintf "%- x" 55n)) " 37"
+    test "test3262" (lazy(sprintf "%- 5x" 55n)) " 37  "
+    test "test3263" (lazy(sprintf "%- 1x" 55n)) " 37"
+    test "test3264" (lazy(sprintf "%- *x" 7 55n)) " 37    "
+    test "test3265" (lazy(sprintf "% 0x" 55n)) " 37"
+    test "test3266" (lazy(sprintf "% 05x" 55n)) " 0037"
+    test "test3267" (lazy(sprintf "% 01x" 55n)) " 37"
+    test "test3268" (lazy(sprintf "% 0*x" 7 55n)) " 000037"
+    test "test3269" (lazy(sprintf "%- 0x" 55n)) " 37"
+    test "test3270" (lazy(sprintf "%- 05x" 55n)) " 37  "
+    test "test3271" (lazy(sprintf "%- 01x" 55n)) " 37"
+    test "test3272" (lazy(sprintf "%- 0*x" 7 55n)) " 37    "
+    test "test3273" (lazy(sprintf "%x" 999un)) "3e7"
+    test "test3274" (lazy(sprintf "%5x" 999un)) "  3e7"
+    test "test3275" (lazy(sprintf "%1x" 999un)) "3e7"
+    test "test3276" (lazy(sprintf "%*x" 7 999un)) "    3e7"
+    test "test3277" (lazy(sprintf "%-x" 999un)) "3e7"
+    test "test3278" (lazy(sprintf "%-5x" 999un)) "3e7  "
+    test "test3279" (lazy(sprintf "%-1x" 999un)) "3e7"
+    test "test3280" (lazy(sprintf "%-*x" 7 999un)) "3e7    "
+    test "test3281" (lazy(sprintf "%0x" 999un)) "3e7"
+    test "test3282" (lazy(sprintf "%05x" 999un)) "003e7"
+    test "test3283" (lazy(sprintf "%01x" 999un)) "3e7"
+    test "test3284" (lazy(sprintf "%0*x" 7 999un)) "00003e7"
+    test "test3285" (lazy(sprintf "%-0x" 999un)) "3e7"
+    test "test3286" (lazy(sprintf "%-05x" 999un)) "3e7  "
+    test "test3287" (lazy(sprintf "%-01x" 999un)) "3e7"
+    test "test3288" (lazy(sprintf "%-0*x" 7 999un)) "3e7    "
+    test "test3289" (lazy(sprintf "%+x" 999un)) "+3e7"
+    test "test3290" (lazy(sprintf "%+5x" 999un)) " +3e7"
+    test "test3291" (lazy(sprintf "%+1x" 999un)) "+3e7"
+    test "test3292" (lazy(sprintf "%+*x" 7 999un)) "   +3e7"
+    test "test3293" (lazy(sprintf "%-+x" 999un)) "+3e7"
+    test "test3294" (lazy(sprintf "%-+5x" 999un)) "+3e7 "
+    test "test3295" (lazy(sprintf "%-+1x" 999un)) "+3e7"
+    test "test3296" (lazy(sprintf "%-+*x" 7 999un)) "+3e7   "
+    test "test3297" (lazy(sprintf "%+0x" 999un)) "+3e7"
+    test "test3298" (lazy(sprintf "%+05x" 999un)) "+03e7"
+    test "test3299" (lazy(sprintf "%+01x" 999un)) "+3e7"
+    test "test3300" (lazy(sprintf "%+0*x" 7 999un)) "+0003e7"
+    test "test3301" (lazy(sprintf "%-+0x" 999un)) "+3e7"
+    test "test3302" (lazy(sprintf "%-+05x" 999un)) "+3e7 "
+    test "test3303" (lazy(sprintf "%-+01x" 999un)) "+3e7"
+    test "test3304" (lazy(sprintf "%-+0*x" 7 999un)) "+3e7   "
+    test "test3305" (lazy(sprintf "% x" 999un)) " 3e7"
+    test "test3306" (lazy(sprintf "% 5x" 999un)) "  3e7"
+    test "test3307" (lazy(sprintf "% 1x" 999un)) " 3e7"
+    test "test3308" (lazy(sprintf "% *x" 7 999un)) "    3e7"
+    test "test3309" (lazy(sprintf "%- x" 999un)) " 3e7"
+    test "test3310" (lazy(sprintf "%- 5x" 999un)) " 3e7 "
+    test "test3311" (lazy(sprintf "%- 1x" 999un)) " 3e7"
+    test "test3312" (lazy(sprintf "%- *x" 7 999un)) " 3e7   "
+    test "test3313" (lazy(sprintf "% 0x" 999un)) " 3e7"
+    test "test3314" (lazy(sprintf "% 05x" 999un)) " 03e7"
+    test "test3315" (lazy(sprintf "% 01x" 999un)) " 3e7"
+    test "test3316" (lazy(sprintf "% 0*x" 7 999un)) " 0003e7"
+    test "test3317" (lazy(sprintf "%- 0x" 999un)) " 3e7"
+    test "test3318" (lazy(sprintf "%- 05x" 999un)) " 3e7 "
+    test "test3319" (lazy(sprintf "%- 01x" 999un)) " 3e7"
+    test "test3320" (lazy(sprintf "%- 0*x" 7 999un)) " 3e7   "
+    test "test3321" (lazy(sprintf "%X" 14)) "E"
+    test "test3322" (lazy(sprintf "%5X" 14)) "    E"
+    test "test3323" (lazy(sprintf "%1X" 14)) "E"
+    test "test3324" (lazy(sprintf "%*X" 7 14)) "      E"
+    test "test3325" (lazy(sprintf "%-X" 14)) "E"
+    test "test3326" (lazy(sprintf "%-5X" 14)) "E    "
+    test "test3327" (lazy(sprintf "%-1X" 14)) "E"
+    test "test3328" (lazy(sprintf "%-*X" 7 14)) "E      "
+    test "test3329" (lazy(sprintf "%0X" 14)) "E"
+    test "test3330" (lazy(sprintf "%05X" 14)) "0000E"
+    test "test3331" (lazy(sprintf "%01X" 14)) "E"
+    test "test3332" (lazy(sprintf "%0*X" 7 14)) "000000E"
+    test "test3333" (lazy(sprintf "%-0X" 14)) "E"
+    test "test3334" (lazy(sprintf "%-05X" 14)) "E    "
+    test "test3335" (lazy(sprintf "%-01X" 14)) "E"
+    test "test3336" (lazy(sprintf "%-0*X" 7 14)) "E      "
+    test "test3337" (lazy(sprintf "%+X" 14)) "+E"
+    test "test3338" (lazy(sprintf "%+5X" 14)) "   +E"
+    test "test3339" (lazy(sprintf "%+1X" 14)) "+E"
+    test "test3340" (lazy(sprintf "%+*X" 7 14)) "     +E"
+    test "test3341" (lazy(sprintf "%-+X" 14)) "+E"
+    test "test3342" (lazy(sprintf "%-+5X" 14)) "+E   "
+    test "test3343" (lazy(sprintf "%-+1X" 14)) "+E"
+    test "test3344" (lazy(sprintf "%-+*X" 7 14)) "+E     "
+    test "test3345" (lazy(sprintf "%+0X" 14)) "+E"
+    test "test3346" (lazy(sprintf "%+05X" 14)) "+000E"
+    test "test3347" (lazy(sprintf "%+01X" 14)) "+E"
+    test "test3348" (lazy(sprintf "%+0*X" 7 14)) "+00000E"
+    test "test3349" (lazy(sprintf "%-+0X" 14)) "+E"
+    test "test3350" (lazy(sprintf "%-+05X" 14)) "+E   "
+    test "test3351" (lazy(sprintf "%-+01X" 14)) "+E"
+    test "test3352" (lazy(sprintf "%-+0*X" 7 14)) "+E     "
+    test "test3353" (lazy(sprintf "% X" 14)) " E"
+    test "test3354" (lazy(sprintf "% 5X" 14)) "    E"
+    test "test3355" (lazy(sprintf "% 1X" 14)) " E"
+    test "test3356" (lazy(sprintf "% *X" 7 14)) "      E"
+    test "test3357" (lazy(sprintf "%- X" 14)) " E"
+    test "test3358" (lazy(sprintf "%- 5X" 14)) " E   "
+    test "test3359" (lazy(sprintf "%- 1X" 14)) " E"
+    test "test3360" (lazy(sprintf "%- *X" 7 14)) " E     "
+    test "test3361" (lazy(sprintf "% 0X" 14)) " E"
+    test "test3362" (lazy(sprintf "% 05X" 14)) " 000E"
+    test "test3363" (lazy(sprintf "% 01X" 14)) " E"
+    test "test3364" (lazy(sprintf "% 0*X" 7 14)) " 00000E"
+    test "test3365" (lazy(sprintf "%- 0X" 14)) " E"
+    test "test3366" (lazy(sprintf "%- 05X" 14)) " E   "
+    test "test3367" (lazy(sprintf "%- 01X" 14)) " E"
+    test "test3368" (lazy(sprintf "%- 0*X" 7 14)) " E     "
+    test "test3369" (lazy(sprintf "%X" -10)) "FFFFFFF6"
+    test "test3370" (lazy(sprintf "%5X" -10)) "FFFFFFF6"
+    test "test3371" (lazy(sprintf "%1X" -10)) "FFFFFFF6"
+    test "test3372" (lazy(sprintf "%*X" 7 -10)) "FFFFFFF6"
+    test "test3373" (lazy(sprintf "%-X" -10)) "FFFFFFF6"
+    test "test3374" (lazy(sprintf "%-5X" -10)) "FFFFFFF6"
+    test "test3375" (lazy(sprintf "%-1X" -10)) "FFFFFFF6"
+    test "test3376" (lazy(sprintf "%-*X" 7 -10)) "FFFFFFF6"
+    test "test3377" (lazy(sprintf "%0X" -10)) "FFFFFFF6"
+    test "test3378" (lazy(sprintf "%05X" -10)) "FFFFFFF6"
+    test "test3379" (lazy(sprintf "%01X" -10)) "FFFFFFF6"
+    test "test3380" (lazy(sprintf "%0*X" 7 -10)) "FFFFFFF6"
+    test "test3381" (lazy(sprintf "%-0X" -10)) "FFFFFFF6"
+    test "test3382" (lazy(sprintf "%-05X" -10)) "FFFFFFF6"
+    test "test3383" (lazy(sprintf "%-01X" -10)) "FFFFFFF6"
+    test "test3384" (lazy(sprintf "%-0*X" 7 -10)) "FFFFFFF6"
+    test "test3385" (lazy(sprintf "%+X" -10)) "+FFFFFFF6"
+    test "test3386" (lazy(sprintf "%+5X" -10)) "+FFFFFFF6"
+    test "test3387" (lazy(sprintf "%+1X" -10)) "+FFFFFFF6"
+    test "test3388" (lazy(sprintf "%+*X" 7 -10)) "+FFFFFFF6"
+    test "test3389" (lazy(sprintf "%-+X" -10)) "+FFFFFFF6"
+    test "test3390" (lazy(sprintf "%-+5X" -10)) "+FFFFFFF6"
+    test "test3391" (lazy(sprintf "%-+1X" -10)) "+FFFFFFF6"
+    test "test3392" (lazy(sprintf "%-+*X" 7 -10)) "+FFFFFFF6"
+    test "test3393" (lazy(sprintf "%+0X" -10)) "+FFFFFFF6"
+    test "test3394" (lazy(sprintf "%+05X" -10)) "+FFFFFFF6"
+    test "test3395" (lazy(sprintf "%+01X" -10)) "+FFFFFFF6"
+    test "test3396" (lazy(sprintf "%+0*X" 7 -10)) "+FFFFFFF6"
+    test "test3397" (lazy(sprintf "%-+0X" -10)) "+FFFFFFF6"
+    test "test3398" (lazy(sprintf "%-+05X" -10)) "+FFFFFFF6"
+    test "test3399" (lazy(sprintf "%-+01X" -10)) "+FFFFFFF6"
+    test "test3400" (lazy(sprintf "%-+0*X" 7 -10)) "+FFFFFFF6"
+    test "test3401" (lazy(sprintf "% X" -10)) " FFFFFFF6"
+    test "test3402" (lazy(sprintf "% 5X" -10)) " FFFFFFF6"
+    test "test3403" (lazy(sprintf "% 1X" -10)) " FFFFFFF6"
+    test "test3404" (lazy(sprintf "% *X" 7 -10)) " FFFFFFF6"
+    test "test3405" (lazy(sprintf "%- X" -10)) " FFFFFFF6"
+    test "test3406" (lazy(sprintf "%- 5X" -10)) " FFFFFFF6"
+    test "test3407" (lazy(sprintf "%- 1X" -10)) " FFFFFFF6"
+    test "test3408" (lazy(sprintf "%- *X" 7 -10)) " FFFFFFF6"
+    test "test3409" (lazy(sprintf "% 0X" -10)) " FFFFFFF6"
+    test "test3410" (lazy(sprintf "% 05X" -10)) " FFFFFFF6"
+    test "test3411" (lazy(sprintf "% 01X" -10)) " FFFFFFF6"
+    test "test3412" (lazy(sprintf "% 0*X" 7 -10)) " FFFFFFF6"
+    test "test3413" (lazy(sprintf "%- 0X" -10)) " FFFFFFF6"
+    test "test3414" (lazy(sprintf "%- 05X" -10)) " FFFFFFF6"
+    test "test3415" (lazy(sprintf "%- 01X" -10)) " FFFFFFF6"
+    test "test3416" (lazy(sprintf "%- 0*X" 7 -10)) " FFFFFFF6"
+    test "test3417" (lazy(sprintf "%X" 55s)) "37"
+    test "test3418" (lazy(sprintf "%5X" 55s)) "   37"
+    test "test3419" (lazy(sprintf "%1X" 55s)) "37"
+    test "test3420" (lazy(sprintf "%*X" 7 55s)) "     37"
+    test "test3421" (lazy(sprintf "%-X" 55s)) "37"
+    test "test3422" (lazy(sprintf "%-5X" 55s)) "37   "
+    test "test3423" (lazy(sprintf "%-1X" 55s)) "37"
+    test "test3424" (lazy(sprintf "%-*X" 7 55s)) "37     "
+    test "test3425" (lazy(sprintf "%0X" 55s)) "37"
+    test "test3426" (lazy(sprintf "%05X" 55s)) "00037"
+    test "test3427" (lazy(sprintf "%01X" 55s)) "37"
+    test "test3428" (lazy(sprintf "%0*X" 7 55s)) "0000037"
+    test "test3429" (lazy(sprintf "%-0X" 55s)) "37"
+    test "test3430" (lazy(sprintf "%-05X" 55s)) "37   "
+    test "test3431" (lazy(sprintf "%-01X" 55s)) "37"
+    test "test3432" (lazy(sprintf "%-0*X" 7 55s)) "37     "
+    test "test3433" (lazy(sprintf "%+X" 55s)) "+37"
+    test "test3434" (lazy(sprintf "%+5X" 55s)) "  +37"
+    test "test3435" (lazy(sprintf "%+1X" 55s)) "+37"
+    test "test3436" (lazy(sprintf "%+*X" 7 55s)) "    +37"
+    test "test3437" (lazy(sprintf "%-+X" 55s)) "+37"
+    test "test3438" (lazy(sprintf "%-+5X" 55s)) "+37  "
+    test "test3439" (lazy(sprintf "%-+1X" 55s)) "+37"
+    test "test3440" (lazy(sprintf "%-+*X" 7 55s)) "+37    "
+    test "test3441" (lazy(sprintf "%+0X" 55s)) "+37"
+    test "test3442" (lazy(sprintf "%+05X" 55s)) "+0037"
+    test "test3443" (lazy(sprintf "%+01X" 55s)) "+37"
+    test "test3444" (lazy(sprintf "%+0*X" 7 55s)) "+000037"
+    test "test3445" (lazy(sprintf "%-+0X" 55s)) "+37"
+    test "test3446" (lazy(sprintf "%-+05X" 55s)) "+37  "
+    test "test3447" (lazy(sprintf "%-+01X" 55s)) "+37"
+    test "test3448" (lazy(sprintf "%-+0*X" 7 55s)) "+37    "
+    test "test3449" (lazy(sprintf "% X" 55s)) " 37"
+    test "test3450" (lazy(sprintf "% 5X" 55s)) "   37"
+    test "test3451" (lazy(sprintf "% 1X" 55s)) " 37"
+    test "test3452" (lazy(sprintf "% *X" 7 55s)) "     37"
+    test "test3453" (lazy(sprintf "%- X" 55s)) " 37"
+    test "test3454" (lazy(sprintf "%- 5X" 55s)) " 37  "
+    test "test3455" (lazy(sprintf "%- 1X" 55s)) " 37"
+    test "test3456" (lazy(sprintf "%- *X" 7 55s)) " 37    "
+    test "test3457" (lazy(sprintf "% 0X" 55s)) " 37"
+    test "test3458" (lazy(sprintf "% 05X" 55s)) " 0037"
+    test "test3459" (lazy(sprintf "% 01X" 55s)) " 37"
+    test "test3460" (lazy(sprintf "% 0*X" 7 55s)) " 000037"
+    test "test3461" (lazy(sprintf "%- 0X" 55s)) " 37"
+    test "test3462" (lazy(sprintf "%- 05X" 55s)) " 37  "
+    test "test3463" (lazy(sprintf "%- 01X" 55s)) " 37"
+    test "test3464" (lazy(sprintf "%- 0*X" 7 55s)) " 37    "
+    test "test3465" (lazy(sprintf "%X" -88s)) "FFA8"
+    test "test3466" (lazy(sprintf "%5X" -88s)) " FFA8"
+    test "test3467" (lazy(sprintf "%1X" -88s)) "FFA8"
+    test "test3468" (lazy(sprintf "%*X" 7 -88s)) "   FFA8"
+    test "test3469" (lazy(sprintf "%-X" -88s)) "FFA8"
+    test "test3470" (lazy(sprintf "%-5X" -88s)) "FFA8 "
+    test "test3471" (lazy(sprintf "%-1X" -88s)) "FFA8"
+    test "test3472" (lazy(sprintf "%-*X" 7 -88s)) "FFA8   "
+    test "test3473" (lazy(sprintf "%0X" -88s)) "FFA8"
+    test "test3474" (lazy(sprintf "%05X" -88s)) "0FFA8"
+    test "test3475" (lazy(sprintf "%01X" -88s)) "FFA8"
+    test "test3476" (lazy(sprintf "%0*X" 7 -88s)) "000FFA8"
+    test "test3477" (lazy(sprintf "%-0X" -88s)) "FFA8"
+    test "test3478" (lazy(sprintf "%-05X" -88s)) "FFA8 "
+    test "test3479" (lazy(sprintf "%-01X" -88s)) "FFA8"
+    test "test3480" (lazy(sprintf "%-0*X" 7 -88s)) "FFA8   "
+    test "test3481" (lazy(sprintf "%+X" -88s)) "+FFA8"
+    test "test3482" (lazy(sprintf "%+5X" -88s)) "+FFA8"
+    test "test3483" (lazy(sprintf "%+1X" -88s)) "+FFA8"
+    test "test3484" (lazy(sprintf "%+*X" 7 -88s)) "  +FFA8"
+    test "test3485" (lazy(sprintf "%-+X" -88s)) "+FFA8"
+    test "test3486" (lazy(sprintf "%-+5X" -88s)) "+FFA8"
+    test "test3487" (lazy(sprintf "%-+1X" -88s)) "+FFA8"
+    test "test3488" (lazy(sprintf "%-+*X" 7 -88s)) "+FFA8  "
+    test "test3489" (lazy(sprintf "%+0X" -88s)) "+FFA8"
+    test "test3490" (lazy(sprintf "%+05X" -88s)) "+FFA8"
+    test "test3491" (lazy(sprintf "%+01X" -88s)) "+FFA8"
+    test "test3492" (lazy(sprintf "%+0*X" 7 -88s)) "+00FFA8"
+    test "test3493" (lazy(sprintf "%-+0X" -88s)) "+FFA8"
+    test "test3494" (lazy(sprintf "%-+05X" -88s)) "+FFA8"
+    test "test3495" (lazy(sprintf "%-+01X" -88s)) "+FFA8"
+    test "test3496" (lazy(sprintf "%-+0*X" 7 -88s)) "+FFA8  "
+    test "test3497" (lazy(sprintf "% X" -88s)) " FFA8"
+    test "test3498" (lazy(sprintf "% 5X" -88s)) " FFA8"
+    test "test3499" (lazy(sprintf "% 1X" -88s)) " FFA8"
+    test "test3500" (lazy(sprintf "% *X" 7 -88s)) "   FFA8"
+    test "test3501" (lazy(sprintf "%- X" -88s)) " FFA8"
+    test "test3502" (lazy(sprintf "%- 5X" -88s)) " FFA8"
+    test "test3503" (lazy(sprintf "%- 1X" -88s)) " FFA8"
+    test "test3504" (lazy(sprintf "%- *X" 7 -88s)) " FFA8  "
+    test "test3505" (lazy(sprintf "% 0X" -88s)) " FFA8"
+    test "test3506" (lazy(sprintf "% 05X" -88s)) " FFA8"
+    test "test3507" (lazy(sprintf "% 01X" -88s)) " FFA8"
+    test "test3508" (lazy(sprintf "% 0*X" 7 -88s)) " 00FFA8"
+    test "test3509" (lazy(sprintf "%- 0X" -88s)) " FFA8"
+    test "test3510" (lazy(sprintf "%- 05X" -88s)) " FFA8"
+    test "test3511" (lazy(sprintf "%- 01X" -88s)) " FFA8"
+    test "test3512" (lazy(sprintf "%- 0*X" 7 -88s)) " FFA8  "
+    test "test3513" (lazy(sprintf "%X" 104us)) "68"
+    test "test3514" (lazy(sprintf "%5X" 104us)) "   68"
+    test "test3515" (lazy(sprintf "%1X" 104us)) "68"
+    test "test3516" (lazy(sprintf "%*X" 7 104us)) "     68"
+    test "test3517" (lazy(sprintf "%-X" 104us)) "68"
+    test "test3518" (lazy(sprintf "%-5X" 104us)) "68   "
+    test "test3519" (lazy(sprintf "%-1X" 104us)) "68"
+    test "test3520" (lazy(sprintf "%-*X" 7 104us)) "68     "
+    test "test3521" (lazy(sprintf "%0X" 104us)) "68"
+    test "test3522" (lazy(sprintf "%05X" 104us)) "00068"
+    test "test3523" (lazy(sprintf "%01X" 104us)) "68"
+    test "test3524" (lazy(sprintf "%0*X" 7 104us)) "0000068"
+    test "test3525" (lazy(sprintf "%-0X" 104us)) "68"
+    test "test3526" (lazy(sprintf "%-05X" 104us)) "68   "
+    test "test3527" (lazy(sprintf "%-01X" 104us)) "68"
+    test "test3528" (lazy(sprintf "%-0*X" 7 104us)) "68     "
+    test "test3529" (lazy(sprintf "%+X" 104us)) "+68"
+    test "test3530" (lazy(sprintf "%+5X" 104us)) "  +68"
+    test "test3531" (lazy(sprintf "%+1X" 104us)) "+68"
+    test "test3532" (lazy(sprintf "%+*X" 7 104us)) "    +68"
+    test "test3533" (lazy(sprintf "%-+X" 104us)) "+68"
+    test "test3534" (lazy(sprintf "%-+5X" 104us)) "+68  "
+    test "test3535" (lazy(sprintf "%-+1X" 104us)) "+68"
+    test "test3536" (lazy(sprintf "%-+*X" 7 104us)) "+68    "
+    test "test3537" (lazy(sprintf "%+0X" 104us)) "+68"
+    test "test3538" (lazy(sprintf "%+05X" 104us)) "+0068"
+    test "test3539" (lazy(sprintf "%+01X" 104us)) "+68"
+    test "test3540" (lazy(sprintf "%+0*X" 7 104us)) "+000068"
+    test "test3541" (lazy(sprintf "%-+0X" 104us)) "+68"
+    test "test3542" (lazy(sprintf "%-+05X" 104us)) "+68  "
+    test "test3543" (lazy(sprintf "%-+01X" 104us)) "+68"
+    test "test3544" (lazy(sprintf "%-+0*X" 7 104us)) "+68    "
+    test "test3545" (lazy(sprintf "% X" 104us)) " 68"
+    test "test3546" (lazy(sprintf "% 5X" 104us)) "   68"
+    test "test3547" (lazy(sprintf "% 1X" 104us)) " 68"
+    test "test3548" (lazy(sprintf "% *X" 7 104us)) "     68"
+    test "test3549" (lazy(sprintf "%- X" 104us)) " 68"
+    test "test3550" (lazy(sprintf "%- 5X" 104us)) " 68  "
+    test "test3551" (lazy(sprintf "%- 1X" 104us)) " 68"
+    test "test3552" (lazy(sprintf "%- *X" 7 104us)) " 68    "
+    test "test3553" (lazy(sprintf "% 0X" 104us)) " 68"
+    test "test3554" (lazy(sprintf "% 05X" 104us)) " 0068"
+    test "test3555" (lazy(sprintf "% 01X" 104us)) " 68"
+    test "test3556" (lazy(sprintf "% 0*X" 7 104us)) " 000068"
+    test "test3557" (lazy(sprintf "%- 0X" 104us)) " 68"
+    test "test3558" (lazy(sprintf "%- 05X" 104us)) " 68  "
+    test "test3559" (lazy(sprintf "%- 01X" 104us)) " 68"
+    test "test3560" (lazy(sprintf "%- 0*X" 7 104us)) " 68    "
+    test "test3561" (lazy(sprintf "%X" 12y)) "C"
+    test "test3562" (lazy(sprintf "%5X" 12y)) "    C"
+    test "test3563" (lazy(sprintf "%1X" 12y)) "C"
+    test "test3564" (lazy(sprintf "%*X" 7 12y)) "      C"
+    test "test3565" (lazy(sprintf "%-X" 12y)) "C"
+    test "test3566" (lazy(sprintf "%-5X" 12y)) "C    "
+    test "test3567" (lazy(sprintf "%-1X" 12y)) "C"
+    test "test3568" (lazy(sprintf "%-*X" 7 12y)) "C      "
+    test "test3569" (lazy(sprintf "%0X" 12y)) "C"
+    test "test3570" (lazy(sprintf "%05X" 12y)) "0000C"
+    test "test3571" (lazy(sprintf "%01X" 12y)) "C"
+    test "test3572" (lazy(sprintf "%0*X" 7 12y)) "000000C"
+    test "test3573" (lazy(sprintf "%-0X" 12y)) "C"
+    test "test3574" (lazy(sprintf "%-05X" 12y)) "C    "
+    test "test3575" (lazy(sprintf "%-01X" 12y)) "C"
+    test "test3576" (lazy(sprintf "%-0*X" 7 12y)) "C      "
+    test "test3577" (lazy(sprintf "%+X" 12y)) "+C"
+    test "test3578" (lazy(sprintf "%+5X" 12y)) "   +C"
+    test "test3579" (lazy(sprintf "%+1X" 12y)) "+C"
+    test "test3580" (lazy(sprintf "%+*X" 7 12y)) "     +C"
+    test "test3581" (lazy(sprintf "%-+X" 12y)) "+C"
+    test "test3582" (lazy(sprintf "%-+5X" 12y)) "+C   "
+    test "test3583" (lazy(sprintf "%-+1X" 12y)) "+C"
+    test "test3584" (lazy(sprintf "%-+*X" 7 12y)) "+C     "
+    test "test3585" (lazy(sprintf "%+0X" 12y)) "+C"
+    test "test3586" (lazy(sprintf "%+05X" 12y)) "+000C"
+    test "test3587" (lazy(sprintf "%+01X" 12y)) "+C"
+    test "test3588" (lazy(sprintf "%+0*X" 7 12y)) "+00000C"
+    test "test3589" (lazy(sprintf "%-+0X" 12y)) "+C"
+    test "test3590" (lazy(sprintf "%-+05X" 12y)) "+C   "
+    test "test3591" (lazy(sprintf "%-+01X" 12y)) "+C"
+    test "test3592" (lazy(sprintf "%-+0*X" 7 12y)) "+C     "
+    test "test3593" (lazy(sprintf "% X" 12y)) " C"
+    test "test3594" (lazy(sprintf "% 5X" 12y)) "    C"
+    test "test3595" (lazy(sprintf "% 1X" 12y)) " C"
+    test "test3596" (lazy(sprintf "% *X" 7 12y)) "      C"
+    test "test3597" (lazy(sprintf "%- X" 12y)) " C"
+    test "test3598" (lazy(sprintf "%- 5X" 12y)) " C   "
+    test "test3599" (lazy(sprintf "%- 1X" 12y)) " C"
+    test "test3600" (lazy(sprintf "%- *X" 7 12y)) " C     "
+    test "test3601" (lazy(sprintf "% 0X" 12y)) " C"
+    test "test3602" (lazy(sprintf "% 05X" 12y)) " 000C"
+    test "test3603" (lazy(sprintf "% 01X" 12y)) " C"
+    test "test3604" (lazy(sprintf "% 0*X" 7 12y)) " 00000C"
+    test "test3605" (lazy(sprintf "%- 0X" 12y)) " C"
+    test "test3606" (lazy(sprintf "%- 05X" 12y)) " C   "
+    test "test3607" (lazy(sprintf "%- 01X" 12y)) " C"
+    test "test3608" (lazy(sprintf "%- 0*X" 7 12y)) " C     "
+    test "test3609" (lazy(sprintf "%X" -94y)) "A2"
+    test "test3610" (lazy(sprintf "%5X" -94y)) "   A2"
+    test "test3611" (lazy(sprintf "%1X" -94y)) "A2"
+    test "test3612" (lazy(sprintf "%*X" 7 -94y)) "     A2"
+    test "test3613" (lazy(sprintf "%-X" -94y)) "A2"
+    test "test3614" (lazy(sprintf "%-5X" -94y)) "A2   "
+    test "test3615" (lazy(sprintf "%-1X" -94y)) "A2"
+    test "test3616" (lazy(sprintf "%-*X" 7 -94y)) "A2     "
+    test "test3617" (lazy(sprintf "%0X" -94y)) "A2"
+    test "test3618" (lazy(sprintf "%05X" -94y)) "000A2"
+    test "test3619" (lazy(sprintf "%01X" -94y)) "A2"
+    test "test3620" (lazy(sprintf "%0*X" 7 -94y)) "00000A2"
+    test "test3621" (lazy(sprintf "%-0X" -94y)) "A2"
+    test "test3622" (lazy(sprintf "%-05X" -94y)) "A2   "
+    test "test3623" (lazy(sprintf "%-01X" -94y)) "A2"
+    test "test3624" (lazy(sprintf "%-0*X" 7 -94y)) "A2     "
+    test "test3625" (lazy(sprintf "%+X" -94y)) "+A2"
+    test "test3626" (lazy(sprintf "%+5X" -94y)) "  +A2"
+    test "test3627" (lazy(sprintf "%+1X" -94y)) "+A2"
+    test "test3628" (lazy(sprintf "%+*X" 7 -94y)) "    +A2"
+    test "test3629" (lazy(sprintf "%-+X" -94y)) "+A2"
+    test "test3630" (lazy(sprintf "%-+5X" -94y)) "+A2  "
+    test "test3631" (lazy(sprintf "%-+1X" -94y)) "+A2"
+    test "test3632" (lazy(sprintf "%-+*X" 7 -94y)) "+A2    "
+    test "test3633" (lazy(sprintf "%+0X" -94y)) "+A2"
+    test "test3634" (lazy(sprintf "%+05X" -94y)) "+00A2"
+    test "test3635" (lazy(sprintf "%+01X" -94y)) "+A2"
+    test "test3636" (lazy(sprintf "%+0*X" 7 -94y)) "+0000A2"
+    test "test3637" (lazy(sprintf "%-+0X" -94y)) "+A2"
+    test "test3638" (lazy(sprintf "%-+05X" -94y)) "+A2  "
+    test "test3639" (lazy(sprintf "%-+01X" -94y)) "+A2"
+    test "test3640" (lazy(sprintf "%-+0*X" 7 -94y)) "+A2    "
+    test "test3641" (lazy(sprintf "% X" -94y)) " A2"
+    test "test3642" (lazy(sprintf "% 5X" -94y)) "   A2"
+    test "test3643" (lazy(sprintf "% 1X" -94y)) " A2"
+    test "test3644" (lazy(sprintf "% *X" 7 -94y)) "     A2"
+    test "test3645" (lazy(sprintf "%- X" -94y)) " A2"
+    test "test3646" (lazy(sprintf "%- 5X" -94y)) " A2  "
+    test "test3647" (lazy(sprintf "%- 1X" -94y)) " A2"
+    test "test3648" (lazy(sprintf "%- *X" 7 -94y)) " A2    "
+    test "test3649" (lazy(sprintf "% 0X" -94y)) " A2"
+    test "test3650" (lazy(sprintf "% 05X" -94y)) " 00A2"
+    test "test3651" (lazy(sprintf "% 01X" -94y)) " A2"
+    test "test3652" (lazy(sprintf "% 0*X" 7 -94y)) " 0000A2"
+    test "test3653" (lazy(sprintf "%- 0X" -94y)) " A2"
+    test "test3654" (lazy(sprintf "%- 05X" -94y)) " A2  "
+    test "test3655" (lazy(sprintf "%- 01X" -94y)) " A2"
+    test "test3656" (lazy(sprintf "%- 0*X" 7 -94y)) " A2    "
+    test "test3657" (lazy(sprintf "%X" 88uy)) "58"
+    test "test3658" (lazy(sprintf "%5X" 88uy)) "   58"
+    test "test3659" (lazy(sprintf "%1X" 88uy)) "58"
+    test "test3660" (lazy(sprintf "%*X" 7 88uy)) "     58"
+    test "test3661" (lazy(sprintf "%-X" 88uy)) "58"
+    test "test3662" (lazy(sprintf "%-5X" 88uy)) "58   "
+    test "test3663" (lazy(sprintf "%-1X" 88uy)) "58"
+    test "test3664" (lazy(sprintf "%-*X" 7 88uy)) "58     "
+    test "test3665" (lazy(sprintf "%0X" 88uy)) "58"
+    test "test3666" (lazy(sprintf "%05X" 88uy)) "00058"
+    test "test3667" (lazy(sprintf "%01X" 88uy)) "58"
+    test "test3668" (lazy(sprintf "%0*X" 7 88uy)) "0000058"
+    test "test3669" (lazy(sprintf "%-0X" 88uy)) "58"
+    test "test3670" (lazy(sprintf "%-05X" 88uy)) "58   "
+    test "test3671" (lazy(sprintf "%-01X" 88uy)) "58"
+    test "test3672" (lazy(sprintf "%-0*X" 7 88uy)) "58     "
+    test "test3673" (lazy(sprintf "%+X" 88uy)) "+58"
+    test "test3674" (lazy(sprintf "%+5X" 88uy)) "  +58"
+    test "test3675" (lazy(sprintf "%+1X" 88uy)) "+58"
+    test "test3676" (lazy(sprintf "%+*X" 7 88uy)) "    +58"
+    test "test3677" (lazy(sprintf "%-+X" 88uy)) "+58"
+    test "test3678" (lazy(sprintf "%-+5X" 88uy)) "+58  "
+    test "test3679" (lazy(sprintf "%-+1X" 88uy)) "+58"
+    test "test3680" (lazy(sprintf "%-+*X" 7 88uy)) "+58    "
+    test "test3681" (lazy(sprintf "%+0X" 88uy)) "+58"
+    test "test3682" (lazy(sprintf "%+05X" 88uy)) "+0058"
+    test "test3683" (lazy(sprintf "%+01X" 88uy)) "+58"
+    test "test3684" (lazy(sprintf "%+0*X" 7 88uy)) "+000058"
+    test "test3685" (lazy(sprintf "%-+0X" 88uy)) "+58"
+    test "test3686" (lazy(sprintf "%-+05X" 88uy)) "+58  "
+    test "test3687" (lazy(sprintf "%-+01X" 88uy)) "+58"
+    test "test3688" (lazy(sprintf "%-+0*X" 7 88uy)) "+58    "
+    test "test3689" (lazy(sprintf "% X" 88uy)) " 58"
+    test "test3690" (lazy(sprintf "% 5X" 88uy)) "   58"
+    test "test3691" (lazy(sprintf "% 1X" 88uy)) " 58"
+    test "test3692" (lazy(sprintf "% *X" 7 88uy)) "     58"
+    test "test3693" (lazy(sprintf "%- X" 88uy)) " 58"
+    test "test3694" (lazy(sprintf "%- 5X" 88uy)) " 58  "
+    test "test3695" (lazy(sprintf "%- 1X" 88uy)) " 58"
+    test "test3696" (lazy(sprintf "%- *X" 7 88uy)) " 58    "
+    test "test3697" (lazy(sprintf "% 0X" 88uy)) " 58"
+    test "test3698" (lazy(sprintf "% 05X" 88uy)) " 0058"
+    test "test3699" (lazy(sprintf "% 01X" 88uy)) " 58"
+    test "test3700" (lazy(sprintf "% 0*X" 7 88uy)) " 000058"
+    test "test3701" (lazy(sprintf "%- 0X" 88uy)) " 58"
+    test "test3702" (lazy(sprintf "%- 05X" 88uy)) " 58  "
+    test "test3703" (lazy(sprintf "%- 01X" 88uy)) " 58"
+    test "test3704" (lazy(sprintf "%- 0*X" 7 88uy)) " 58    "
+    test "test3705" (lazy(sprintf "%X" 999L)) "3E7"
+    test "test3706" (lazy(sprintf "%5X" 999L)) "  3E7"
+    test "test3707" (lazy(sprintf "%1X" 999L)) "3E7"
+    test "test3708" (lazy(sprintf "%*X" 7 999L)) "    3E7"
+    test "test3709" (lazy(sprintf "%-X" 999L)) "3E7"
+    test "test3710" (lazy(sprintf "%-5X" 999L)) "3E7  "
+    test "test3711" (lazy(sprintf "%-1X" 999L)) "3E7"
+    test "test3712" (lazy(sprintf "%-*X" 7 999L)) "3E7    "
+    test "test3713" (lazy(sprintf "%0X" 999L)) "3E7"
+    test "test3714" (lazy(sprintf "%05X" 999L)) "003E7"
+    test "test3715" (lazy(sprintf "%01X" 999L)) "3E7"
+    test "test3716" (lazy(sprintf "%0*X" 7 999L)) "00003E7"
+    test "test3717" (lazy(sprintf "%-0X" 999L)) "3E7"
+    test "test3718" (lazy(sprintf "%-05X" 999L)) "3E7  "
+    test "test3719" (lazy(sprintf "%-01X" 999L)) "3E7"
+    test "test3720" (lazy(sprintf "%-0*X" 7 999L)) "3E7    "
+    test "test3721" (lazy(sprintf "%+X" 999L)) "+3E7"
+    test "test3722" (lazy(sprintf "%+5X" 999L)) " +3E7"
+    test "test3723" (lazy(sprintf "%+1X" 999L)) "+3E7"
+    test "test3724" (lazy(sprintf "%+*X" 7 999L)) "   +3E7"
+    test "test3725" (lazy(sprintf "%-+X" 999L)) "+3E7"
+    test "test3726" (lazy(sprintf "%-+5X" 999L)) "+3E7 "
+    test "test3727" (lazy(sprintf "%-+1X" 999L)) "+3E7"
+    test "test3728" (lazy(sprintf "%-+*X" 7 999L)) "+3E7   "
+    test "test3729" (lazy(sprintf "%+0X" 999L)) "+3E7"
+    test "test3730" (lazy(sprintf "%+05X" 999L)) "+03E7"
+    test "test3731" (lazy(sprintf "%+01X" 999L)) "+3E7"
+    test "test3732" (lazy(sprintf "%+0*X" 7 999L)) "+0003E7"
+    test "test3733" (lazy(sprintf "%-+0X" 999L)) "+3E7"
+    test "test3734" (lazy(sprintf "%-+05X" 999L)) "+3E7 "
+    test "test3735" (lazy(sprintf "%-+01X" 999L)) "+3E7"
+    test "test3736" (lazy(sprintf "%-+0*X" 7 999L)) "+3E7   "
+    test "test3737" (lazy(sprintf "% X" 999L)) " 3E7"
+    test "test3738" (lazy(sprintf "% 5X" 999L)) "  3E7"
+    test "test3739" (lazy(sprintf "% 1X" 999L)) " 3E7"
+    test "test3740" (lazy(sprintf "% *X" 7 999L)) "    3E7"
+    test "test3741" (lazy(sprintf "%- X" 999L)) " 3E7"
+    test "test3742" (lazy(sprintf "%- 5X" 999L)) " 3E7 "
+    test "test3743" (lazy(sprintf "%- 1X" 999L)) " 3E7"
+    test "test3744" (lazy(sprintf "%- *X" 7 999L)) " 3E7   "
+    test "test3745" (lazy(sprintf "% 0X" 999L)) " 3E7"
+    test "test3746" (lazy(sprintf "% 05X" 999L)) " 03E7"
+    test "test3747" (lazy(sprintf "% 01X" 999L)) " 3E7"
+    test "test3748" (lazy(sprintf "% 0*X" 7 999L)) " 0003E7"
+    test "test3749" (lazy(sprintf "%- 0X" 999L)) " 3E7"
+    test "test3750" (lazy(sprintf "%- 05X" 999L)) " 3E7 "
+    test "test3751" (lazy(sprintf "%- 01X" 999L)) " 3E7"
+    test "test3752" (lazy(sprintf "%- 0*X" 7 999L)) " 3E7   "
+    test "test3753" (lazy(sprintf "%X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3754" (lazy(sprintf "%5X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3755" (lazy(sprintf "%1X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3756" (lazy(sprintf "%*X" 7 -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3757" (lazy(sprintf "%-X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3758" (lazy(sprintf "%-5X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3759" (lazy(sprintf "%-1X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3760" (lazy(sprintf "%-*X" 7 -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3761" (lazy(sprintf "%0X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3762" (lazy(sprintf "%05X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3763" (lazy(sprintf "%01X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3764" (lazy(sprintf "%0*X" 7 -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3765" (lazy(sprintf "%-0X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3766" (lazy(sprintf "%-05X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3767" (lazy(sprintf "%-01X" -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3768" (lazy(sprintf "%-0*X" 7 -321L)) "FFFFFFFFFFFFFEBF"
+    test "test3769" (lazy(sprintf "%+X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3770" (lazy(sprintf "%+5X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3771" (lazy(sprintf "%+1X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3772" (lazy(sprintf "%+*X" 7 -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3773" (lazy(sprintf "%-+X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3774" (lazy(sprintf "%-+5X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3775" (lazy(sprintf "%-+1X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3776" (lazy(sprintf "%-+*X" 7 -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3777" (lazy(sprintf "%+0X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3778" (lazy(sprintf "%+05X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3779" (lazy(sprintf "%+01X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3780" (lazy(sprintf "%+0*X" 7 -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3781" (lazy(sprintf "%-+0X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3782" (lazy(sprintf "%-+05X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3783" (lazy(sprintf "%-+01X" -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3784" (lazy(sprintf "%-+0*X" 7 -321L)) "+FFFFFFFFFFFFFEBF"
+    test "test3785" (lazy(sprintf "% X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3786" (lazy(sprintf "% 5X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3787" (lazy(sprintf "% 1X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3788" (lazy(sprintf "% *X" 7 -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3789" (lazy(sprintf "%- X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3790" (lazy(sprintf "%- 5X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3791" (lazy(sprintf "%- 1X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3792" (lazy(sprintf "%- *X" 7 -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3793" (lazy(sprintf "% 0X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3794" (lazy(sprintf "% 05X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3795" (lazy(sprintf "% 01X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3796" (lazy(sprintf "% 0*X" 7 -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3797" (lazy(sprintf "%- 0X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3798" (lazy(sprintf "%- 05X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3799" (lazy(sprintf "%- 01X" -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3800" (lazy(sprintf "%- 0*X" 7 -321L)) " FFFFFFFFFFFFFEBF"
+    test "test3801" (lazy(sprintf "%X" 50000UL)) "C350"
+    test "test3802" (lazy(sprintf "%5X" 50000UL)) " C350"
+    test "test3803" (lazy(sprintf "%1X" 50000UL)) "C350"
+    test "test3804" (lazy(sprintf "%*X" 7 50000UL)) "   C350"
+    test "test3805" (lazy(sprintf "%-X" 50000UL)) "C350"
+    test "test3806" (lazy(sprintf "%-5X" 50000UL)) "C350 "
+    test "test3807" (lazy(sprintf "%-1X" 50000UL)) "C350"
+    test "test3808" (lazy(sprintf "%-*X" 7 50000UL)) "C350   "
+    test "test3809" (lazy(sprintf "%0X" 50000UL)) "C350"
+    test "test3810" (lazy(sprintf "%05X" 50000UL)) "0C350"
+    test "test3811" (lazy(sprintf "%01X" 50000UL)) "C350"
+    test "test3812" (lazy(sprintf "%0*X" 7 50000UL)) "000C350"
+    test "test3813" (lazy(sprintf "%-0X" 50000UL)) "C350"
+    test "test3814" (lazy(sprintf "%-05X" 50000UL)) "C350 "
+    test "test3815" (lazy(sprintf "%-01X" 50000UL)) "C350"
+    test "test3816" (lazy(sprintf "%-0*X" 7 50000UL)) "C350   "
+    test "test3817" (lazy(sprintf "%+X" 50000UL)) "+C350"
+    test "test3818" (lazy(sprintf "%+5X" 50000UL)) "+C350"
+    test "test3819" (lazy(sprintf "%+1X" 50000UL)) "+C350"
+    test "test3820" (lazy(sprintf "%+*X" 7 50000UL)) "  +C350"
+    test "test3821" (lazy(sprintf "%-+X" 50000UL)) "+C350"
+    test "test3822" (lazy(sprintf "%-+5X" 50000UL)) "+C350"
+    test "test3823" (lazy(sprintf "%-+1X" 50000UL)) "+C350"
+    test "test3824" (lazy(sprintf "%-+*X" 7 50000UL)) "+C350  "
+    test "test3825" (lazy(sprintf "%+0X" 50000UL)) "+C350"
+    test "test3826" (lazy(sprintf "%+05X" 50000UL)) "+C350"
+    test "test3827" (lazy(sprintf "%+01X" 50000UL)) "+C350"
+    test "test3828" (lazy(sprintf "%+0*X" 7 50000UL)) "+00C350"
+    test "test3829" (lazy(sprintf "%-+0X" 50000UL)) "+C350"
+    test "test3830" (lazy(sprintf "%-+05X" 50000UL)) "+C350"
+    test "test3831" (lazy(sprintf "%-+01X" 50000UL)) "+C350"
+    test "test3832" (lazy(sprintf "%-+0*X" 7 50000UL)) "+C350  "
+    test "test3833" (lazy(sprintf "% X" 50000UL)) " C350"
+    test "test3834" (lazy(sprintf "% 5X" 50000UL)) " C350"
+    test "test3835" (lazy(sprintf "% 1X" 50000UL)) " C350"
+    test "test3836" (lazy(sprintf "% *X" 7 50000UL)) "   C350"
+    test "test3837" (lazy(sprintf "%- X" 50000UL)) " C350"
+    test "test3838" (lazy(sprintf "%- 5X" 50000UL)) " C350"
+    test "test3839" (lazy(sprintf "%- 1X" 50000UL)) " C350"
+    test "test3840" (lazy(sprintf "%- *X" 7 50000UL)) " C350  "
+    test "test3841" (lazy(sprintf "% 0X" 50000UL)) " C350"
+    test "test3842" (lazy(sprintf "% 05X" 50000UL)) " C350"
+    test "test3843" (lazy(sprintf "% 01X" 50000UL)) " C350"
+    test "test3844" (lazy(sprintf "% 0*X" 7 50000UL)) " 00C350"
+    test "test3845" (lazy(sprintf "%- 0X" 50000UL)) " C350"
+    test "test3846" (lazy(sprintf "%- 05X" 50000UL)) " C350"
+    test "test3847" (lazy(sprintf "%- 01X" 50000UL)) " C350"
+    test "test3848" (lazy(sprintf "%- 0*X" 7 50000UL)) " C350  "
+    test "test3849" (lazy(sprintf "%X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3850" (lazy(sprintf "%5X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3851" (lazy(sprintf "%1X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3852" (lazy(sprintf "%*X" 7 System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3853" (lazy(sprintf "%-X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3854" (lazy(sprintf "%-5X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3855" (lazy(sprintf "%-1X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3856" (lazy(sprintf "%-*X" 7 System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3857" (lazy(sprintf "%0X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3858" (lazy(sprintf "%05X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3859" (lazy(sprintf "%01X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3860" (lazy(sprintf "%0*X" 7 System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3861" (lazy(sprintf "%-0X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3862" (lazy(sprintf "%-05X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3863" (lazy(sprintf "%-01X" System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3864" (lazy(sprintf "%-0*X" 7 System.Int32.MaxValue)) "7FFFFFFF"
+    test "test3865" (lazy(sprintf "%+X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3866" (lazy(sprintf "%+5X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3867" (lazy(sprintf "%+1X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3868" (lazy(sprintf "%+*X" 7 System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3869" (lazy(sprintf "%-+X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3870" (lazy(sprintf "%-+5X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3871" (lazy(sprintf "%-+1X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3872" (lazy(sprintf "%-+*X" 7 System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3873" (lazy(sprintf "%+0X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3874" (lazy(sprintf "%+05X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3875" (lazy(sprintf "%+01X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3876" (lazy(sprintf "%+0*X" 7 System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3877" (lazy(sprintf "%-+0X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3878" (lazy(sprintf "%-+05X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3879" (lazy(sprintf "%-+01X" System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3880" (lazy(sprintf "%-+0*X" 7 System.Int32.MaxValue)) "+7FFFFFFF"
+    test "test3881" (lazy(sprintf "% X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3882" (lazy(sprintf "% 5X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3883" (lazy(sprintf "% 1X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3884" (lazy(sprintf "% *X" 7 System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3885" (lazy(sprintf "%- X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3886" (lazy(sprintf "%- 5X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3887" (lazy(sprintf "%- 1X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3888" (lazy(sprintf "%- *X" 7 System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3889" (lazy(sprintf "% 0X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3890" (lazy(sprintf "% 05X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3891" (lazy(sprintf "% 01X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3892" (lazy(sprintf "% 0*X" 7 System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3893" (lazy(sprintf "%- 0X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3894" (lazy(sprintf "%- 05X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3895" (lazy(sprintf "%- 01X" System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3896" (lazy(sprintf "%- 0*X" 7 System.Int32.MaxValue)) " 7FFFFFFF"
+    test "test3897" (lazy(sprintf "%X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3898" (lazy(sprintf "%5X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3899" (lazy(sprintf "%1X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3900" (lazy(sprintf "%*X" 7 System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3901" (lazy(sprintf "%-X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3902" (lazy(sprintf "%-5X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3903" (lazy(sprintf "%-1X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3904" (lazy(sprintf "%-*X" 7 System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3905" (lazy(sprintf "%0X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3906" (lazy(sprintf "%05X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3907" (lazy(sprintf "%01X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3908" (lazy(sprintf "%0*X" 7 System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3909" (lazy(sprintf "%-0X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3910" (lazy(sprintf "%-05X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3911" (lazy(sprintf "%-01X" System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3912" (lazy(sprintf "%-0*X" 7 System.Int64.MaxValue)) "7FFFFFFFFFFFFFFF"
+    test "test3913" (lazy(sprintf "%+X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3914" (lazy(sprintf "%+5X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3915" (lazy(sprintf "%+1X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3916" (lazy(sprintf "%+*X" 7 System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3917" (lazy(sprintf "%-+X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3918" (lazy(sprintf "%-+5X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3919" (lazy(sprintf "%-+1X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3920" (lazy(sprintf "%-+*X" 7 System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3921" (lazy(sprintf "%+0X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3922" (lazy(sprintf "%+05X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3923" (lazy(sprintf "%+01X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3924" (lazy(sprintf "%+0*X" 7 System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3925" (lazy(sprintf "%-+0X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3926" (lazy(sprintf "%-+05X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3927" (lazy(sprintf "%-+01X" System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3928" (lazy(sprintf "%-+0*X" 7 System.Int64.MaxValue)) "+7FFFFFFFFFFFFFFF"
+    test "test3929" (lazy(sprintf "% X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3930" (lazy(sprintf "% 5X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3931" (lazy(sprintf "% 1X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3932" (lazy(sprintf "% *X" 7 System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3933" (lazy(sprintf "%- X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3934" (lazy(sprintf "%- 5X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3935" (lazy(sprintf "%- 1X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3936" (lazy(sprintf "%- *X" 7 System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3937" (lazy(sprintf "% 0X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3938" (lazy(sprintf "% 05X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3939" (lazy(sprintf "% 01X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3940" (lazy(sprintf "% 0*X" 7 System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3941" (lazy(sprintf "%- 0X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3942" (lazy(sprintf "%- 05X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3943" (lazy(sprintf "%- 01X" System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3944" (lazy(sprintf "%- 0*X" 7 System.Int64.MaxValue)) " 7FFFFFFFFFFFFFFF"
+    test "test3945" (lazy(sprintf "%X" System.Int32.MinValue)) "80000000"
+    test "test3946" (lazy(sprintf "%5X" System.Int32.MinValue)) "80000000"
+    test "test3947" (lazy(sprintf "%1X" System.Int32.MinValue)) "80000000"
+    test "test3948" (lazy(sprintf "%*X" 7 System.Int32.MinValue)) "80000000"
+    test "test3949" (lazy(sprintf "%-X" System.Int32.MinValue)) "80000000"
+    test "test3950" (lazy(sprintf "%-5X" System.Int32.MinValue)) "80000000"
+    test "test3951" (lazy(sprintf "%-1X" System.Int32.MinValue)) "80000000"
+    test "test3952" (lazy(sprintf "%-*X" 7 System.Int32.MinValue)) "80000000"
+    test "test3953" (lazy(sprintf "%0X" System.Int32.MinValue)) "80000000"
+    test "test3954" (lazy(sprintf "%05X" System.Int32.MinValue)) "80000000"
+    test "test3955" (lazy(sprintf "%01X" System.Int32.MinValue)) "80000000"
+    test "test3956" (lazy(sprintf "%0*X" 7 System.Int32.MinValue)) "80000000"
+    test "test3957" (lazy(sprintf "%-0X" System.Int32.MinValue)) "80000000"
+    test "test3958" (lazy(sprintf "%-05X" System.Int32.MinValue)) "80000000"
+    test "test3959" (lazy(sprintf "%-01X" System.Int32.MinValue)) "80000000"
+    test "test3960" (lazy(sprintf "%-0*X" 7 System.Int32.MinValue)) "80000000"
+    test "test3961" (lazy(sprintf "%+X" System.Int32.MinValue)) "+80000000"
+    test "test3962" (lazy(sprintf "%+5X" System.Int32.MinValue)) "+80000000"
+    test "test3963" (lazy(sprintf "%+1X" System.Int32.MinValue)) "+80000000"
+    test "test3964" (lazy(sprintf "%+*X" 7 System.Int32.MinValue)) "+80000000"
+    test "test3965" (lazy(sprintf "%-+X" System.Int32.MinValue)) "+80000000"
+    test "test3966" (lazy(sprintf "%-+5X" System.Int32.MinValue)) "+80000000"
+    test "test3967" (lazy(sprintf "%-+1X" System.Int32.MinValue)) "+80000000"
+    test "test3968" (lazy(sprintf "%-+*X" 7 System.Int32.MinValue)) "+80000000"
+    test "test3969" (lazy(sprintf "%+0X" System.Int32.MinValue)) "+80000000"
+    test "test3970" (lazy(sprintf "%+05X" System.Int32.MinValue)) "+80000000"
+    test "test3971" (lazy(sprintf "%+01X" System.Int32.MinValue)) "+80000000"
+    test "test3972" (lazy(sprintf "%+0*X" 7 System.Int32.MinValue)) "+80000000"
+    test "test3973" (lazy(sprintf "%-+0X" System.Int32.MinValue)) "+80000000"
+    test "test3974" (lazy(sprintf "%-+05X" System.Int32.MinValue)) "+80000000"
+    test "test3975" (lazy(sprintf "%-+01X" System.Int32.MinValue)) "+80000000"
+    test "test3976" (lazy(sprintf "%-+0*X" 7 System.Int32.MinValue)) "+80000000"
+    test "test3977" (lazy(sprintf "% X" System.Int32.MinValue)) " 80000000"
+    test "test3978" (lazy(sprintf "% 5X" System.Int32.MinValue)) " 80000000"
+    test "test3979" (lazy(sprintf "% 1X" System.Int32.MinValue)) " 80000000"
+    test "test3980" (lazy(sprintf "% *X" 7 System.Int32.MinValue)) " 80000000"
+    test "test3981" (lazy(sprintf "%- X" System.Int32.MinValue)) " 80000000"
+    test "test3982" (lazy(sprintf "%- 5X" System.Int32.MinValue)) " 80000000"
+    test "test3983" (lazy(sprintf "%- 1X" System.Int32.MinValue)) " 80000000"
+    test "test3984" (lazy(sprintf "%- *X" 7 System.Int32.MinValue)) " 80000000"
+    test "test3985" (lazy(sprintf "% 0X" System.Int32.MinValue)) " 80000000"
+    test "test3986" (lazy(sprintf "% 05X" System.Int32.MinValue)) " 80000000"
+    test "test3987" (lazy(sprintf "% 01X" System.Int32.MinValue)) " 80000000"
+    test "test3988" (lazy(sprintf "% 0*X" 7 System.Int32.MinValue)) " 80000000"
+    test "test3989" (lazy(sprintf "%- 0X" System.Int32.MinValue)) " 80000000"
+    test "test3990" (lazy(sprintf "%- 05X" System.Int32.MinValue)) " 80000000"
+    test "test3991" (lazy(sprintf "%- 01X" System.Int32.MinValue)) " 80000000"
+    test "test3992" (lazy(sprintf "%- 0*X" 7 System.Int32.MinValue)) " 80000000"
+    test "test3993" (lazy(sprintf "%X" System.Int64.MinValue)) "8000000000000000"
+    test "test3994" (lazy(sprintf "%5X" System.Int64.MinValue)) "8000000000000000"
+    test "test3995" (lazy(sprintf "%1X" System.Int64.MinValue)) "8000000000000000"
+    test "test3996" (lazy(sprintf "%*X" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test3997" (lazy(sprintf "%-X" System.Int64.MinValue)) "8000000000000000"
+    test "test3998" (lazy(sprintf "%-5X" System.Int64.MinValue)) "8000000000000000"
+    test "test3999" (lazy(sprintf "%-1X" System.Int64.MinValue)) "8000000000000000"
+    test "test4000" (lazy(sprintf "%-*X" 7 System.Int64.MinValue)) "8000000000000000"
+let func4000()=
+    test "test4001" (lazy(sprintf "%0X" System.Int64.MinValue)) "8000000000000000"
+    test "test4002" (lazy(sprintf "%05X" System.Int64.MinValue)) "8000000000000000"
+    test "test4003" (lazy(sprintf "%01X" System.Int64.MinValue)) "8000000000000000"
+    test "test4004" (lazy(sprintf "%0*X" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test4005" (lazy(sprintf "%-0X" System.Int64.MinValue)) "8000000000000000"
+    test "test4006" (lazy(sprintf "%-05X" System.Int64.MinValue)) "8000000000000000"
+    test "test4007" (lazy(sprintf "%-01X" System.Int64.MinValue)) "8000000000000000"
+    test "test4008" (lazy(sprintf "%-0*X" 7 System.Int64.MinValue)) "8000000000000000"
+    test "test4009" (lazy(sprintf "%+X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4010" (lazy(sprintf "%+5X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4011" (lazy(sprintf "%+1X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4012" (lazy(sprintf "%+*X" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test4013" (lazy(sprintf "%-+X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4014" (lazy(sprintf "%-+5X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4015" (lazy(sprintf "%-+1X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4016" (lazy(sprintf "%-+*X" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test4017" (lazy(sprintf "%+0X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4018" (lazy(sprintf "%+05X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4019" (lazy(sprintf "%+01X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4020" (lazy(sprintf "%+0*X" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test4021" (lazy(sprintf "%-+0X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4022" (lazy(sprintf "%-+05X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4023" (lazy(sprintf "%-+01X" System.Int64.MinValue)) "+8000000000000000"
+    test "test4024" (lazy(sprintf "%-+0*X" 7 System.Int64.MinValue)) "+8000000000000000"
+    test "test4025" (lazy(sprintf "% X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4026" (lazy(sprintf "% 5X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4027" (lazy(sprintf "% 1X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4028" (lazy(sprintf "% *X" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test4029" (lazy(sprintf "%- X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4030" (lazy(sprintf "%- 5X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4031" (lazy(sprintf "%- 1X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4032" (lazy(sprintf "%- *X" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test4033" (lazy(sprintf "% 0X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4034" (lazy(sprintf "% 05X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4035" (lazy(sprintf "% 01X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4036" (lazy(sprintf "% 0*X" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test4037" (lazy(sprintf "%- 0X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4038" (lazy(sprintf "%- 05X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4039" (lazy(sprintf "%- 01X" System.Int64.MinValue)) " 8000000000000000"
+    test "test4040" (lazy(sprintf "%- 0*X" 7 System.Int64.MinValue)) " 8000000000000000"
+    test "test4041" (lazy(sprintf "%X" 55n)) "37"
+    test "test4042" (lazy(sprintf "%5X" 55n)) "   37"
+    test "test4043" (lazy(sprintf "%1X" 55n)) "37"
+    test "test4044" (lazy(sprintf "%*X" 7 55n)) "     37"
+    test "test4045" (lazy(sprintf "%-X" 55n)) "37"
+    test "test4046" (lazy(sprintf "%-5X" 55n)) "37   "
+    test "test4047" (lazy(sprintf "%-1X" 55n)) "37"
+    test "test4048" (lazy(sprintf "%-*X" 7 55n)) "37     "
+    test "test4049" (lazy(sprintf "%0X" 55n)) "37"
+    test "test4050" (lazy(sprintf "%05X" 55n)) "00037"
+    test "test4051" (lazy(sprintf "%01X" 55n)) "37"
+    test "test4052" (lazy(sprintf "%0*X" 7 55n)) "0000037"
+    test "test4053" (lazy(sprintf "%-0X" 55n)) "37"
+    test "test4054" (lazy(sprintf "%-05X" 55n)) "37   "
+    test "test4055" (lazy(sprintf "%-01X" 55n)) "37"
+    test "test4056" (lazy(sprintf "%-0*X" 7 55n)) "37     "
+    test "test4057" (lazy(sprintf "%+X" 55n)) "+37"
+    test "test4058" (lazy(sprintf "%+5X" 55n)) "  +37"
+    test "test4059" (lazy(sprintf "%+1X" 55n)) "+37"
+    test "test4060" (lazy(sprintf "%+*X" 7 55n)) "    +37"
+    test "test4061" (lazy(sprintf "%-+X" 55n)) "+37"
+    test "test4062" (lazy(sprintf "%-+5X" 55n)) "+37  "
+    test "test4063" (lazy(sprintf "%-+1X" 55n)) "+37"
+    test "test4064" (lazy(sprintf "%-+*X" 7 55n)) "+37    "
+    test "test4065" (lazy(sprintf "%+0X" 55n)) "+37"
+    test "test4066" (lazy(sprintf "%+05X" 55n)) "+0037"
+    test "test4067" (lazy(sprintf "%+01X" 55n)) "+37"
+    test "test4068" (lazy(sprintf "%+0*X" 7 55n)) "+000037"
+    test "test4069" (lazy(sprintf "%-+0X" 55n)) "+37"
+    test "test4070" (lazy(sprintf "%-+05X" 55n)) "+37  "
+    test "test4071" (lazy(sprintf "%-+01X" 55n)) "+37"
+    test "test4072" (lazy(sprintf "%-+0*X" 7 55n)) "+37    "
+    test "test4073" (lazy(sprintf "% X" 55n)) " 37"
+    test "test4074" (lazy(sprintf "% 5X" 55n)) "   37"
+    test "test4075" (lazy(sprintf "% 1X" 55n)) " 37"
+    test "test4076" (lazy(sprintf "% *X" 7 55n)) "     37"
+    test "test4077" (lazy(sprintf "%- X" 55n)) " 37"
+    test "test4078" (lazy(sprintf "%- 5X" 55n)) " 37  "
+    test "test4079" (lazy(sprintf "%- 1X" 55n)) " 37"
+    test "test4080" (lazy(sprintf "%- *X" 7 55n)) " 37    "
+    test "test4081" (lazy(sprintf "% 0X" 55n)) " 37"
+    test "test4082" (lazy(sprintf "% 05X" 55n)) " 0037"
+    test "test4083" (lazy(sprintf "% 01X" 55n)) " 37"
+    test "test4084" (lazy(sprintf "% 0*X" 7 55n)) " 000037"
+    test "test4085" (lazy(sprintf "%- 0X" 55n)) " 37"
+    test "test4086" (lazy(sprintf "%- 05X" 55n)) " 37  "
+    test "test4087" (lazy(sprintf "%- 01X" 55n)) " 37"
+    test "test4088" (lazy(sprintf "%- 0*X" 7 55n)) " 37    "
+    test "test4089" (lazy(sprintf "%X" 999un)) "3E7"
+    test "test4090" (lazy(sprintf "%5X" 999un)) "  3E7"
+    test "test4091" (lazy(sprintf "%1X" 999un)) "3E7"
+    test "test4092" (lazy(sprintf "%*X" 7 999un)) "    3E7"
+    test "test4093" (lazy(sprintf "%-X" 999un)) "3E7"
+    test "test4094" (lazy(sprintf "%-5X" 999un)) "3E7  "
+    test "test4095" (lazy(sprintf "%-1X" 999un)) "3E7"
+    test "test4096" (lazy(sprintf "%-*X" 7 999un)) "3E7    "
+    test "test4097" (lazy(sprintf "%0X" 999un)) "3E7"
+    test "test4098" (lazy(sprintf "%05X" 999un)) "003E7"
+    test "test4099" (lazy(sprintf "%01X" 999un)) "3E7"
+    test "test4100" (lazy(sprintf "%0*X" 7 999un)) "00003E7"
+    test "test4101" (lazy(sprintf "%-0X" 999un)) "3E7"
+    test "test4102" (lazy(sprintf "%-05X" 999un)) "3E7  "
+    test "test4103" (lazy(sprintf "%-01X" 999un)) "3E7"
+    test "test4104" (lazy(sprintf "%-0*X" 7 999un)) "3E7    "
+    test "test4105" (lazy(sprintf "%+X" 999un)) "+3E7"
+    test "test4106" (lazy(sprintf "%+5X" 999un)) " +3E7"
+    test "test4107" (lazy(sprintf "%+1X" 999un)) "+3E7"
+    test "test4108" (lazy(sprintf "%+*X" 7 999un)) "   +3E7"
+    test "test4109" (lazy(sprintf "%-+X" 999un)) "+3E7"
+    test "test4110" (lazy(sprintf "%-+5X" 999un)) "+3E7 "
+    test "test4111" (lazy(sprintf "%-+1X" 999un)) "+3E7"
+    test "test4112" (lazy(sprintf "%-+*X" 7 999un)) "+3E7   "
+    test "test4113" (lazy(sprintf "%+0X" 999un)) "+3E7"
+    test "test4114" (lazy(sprintf "%+05X" 999un)) "+03E7"
+    test "test4115" (lazy(sprintf "%+01X" 999un)) "+3E7"
+    test "test4116" (lazy(sprintf "%+0*X" 7 999un)) "+0003E7"
+    test "test4117" (lazy(sprintf "%-+0X" 999un)) "+3E7"
+    test "test4118" (lazy(sprintf "%-+05X" 999un)) "+3E7 "
+    test "test4119" (lazy(sprintf "%-+01X" 999un)) "+3E7"
+    test "test4120" (lazy(sprintf "%-+0*X" 7 999un)) "+3E7   "
+    test "test4121" (lazy(sprintf "% X" 999un)) " 3E7"
+    test "test4122" (lazy(sprintf "% 5X" 999un)) "  3E7"
+    test "test4123" (lazy(sprintf "% 1X" 999un)) " 3E7"
+    test "test4124" (lazy(sprintf "% *X" 7 999un)) "    3E7"
+    test "test4125" (lazy(sprintf "%- X" 999un)) " 3E7"
+    test "test4126" (lazy(sprintf "%- 5X" 999un)) " 3E7 "
+    test "test4127" (lazy(sprintf "%- 1X" 999un)) " 3E7"
+    test "test4128" (lazy(sprintf "%- *X" 7 999un)) " 3E7   "
+    test "test4129" (lazy(sprintf "% 0X" 999un)) " 3E7"
+    test "test4130" (lazy(sprintf "% 05X" 999un)) " 03E7"
+    test "test4131" (lazy(sprintf "% 01X" 999un)) " 3E7"
+    test "test4132" (lazy(sprintf "% 0*X" 7 999un)) " 0003E7"
+    test "test4133" (lazy(sprintf "%- 0X" 999un)) " 3E7"
+    test "test4134" (lazy(sprintf "%- 05X" 999un)) " 3E7 "
+    test "test4135" (lazy(sprintf "%- 01X" 999un)) " 3E7"
+    test "test4136" (lazy(sprintf "%- 0*X" 7 999un)) " 3E7   "
+    test "test4137" (lazy(sprintf "%o" 14)) "16"
+    test "test4138" (lazy(sprintf "%5o" 14)) "   16"
+    test "test4139" (lazy(sprintf "%1o" 14)) "16"
+    test "test4140" (lazy(sprintf "%*o" 7 14)) "     16"
+    test "test4141" (lazy(sprintf "%-o" 14)) "16"
+    test "test4142" (lazy(sprintf "%-5o" 14)) "16   "
+    test "test4143" (lazy(sprintf "%-1o" 14)) "16"
+    test "test4144" (lazy(sprintf "%-*o" 7 14)) "16     "
+    test "test4145" (lazy(sprintf "%0o" 14)) "16"
+    test "test4146" (lazy(sprintf "%05o" 14)) "00016"
+    test "test4147" (lazy(sprintf "%01o" 14)) "16"
+    test "test4148" (lazy(sprintf "%0*o" 7 14)) "0000016"
+    test "test4149" (lazy(sprintf "%-0o" 14)) "16"
+    test "test4150" (lazy(sprintf "%-05o" 14)) "16   "
+    test "test4151" (lazy(sprintf "%-01o" 14)) "16"
+    test "test4152" (lazy(sprintf "%-0*o" 7 14)) "16     "
+    test "test4153" (lazy(sprintf "%+o" 14)) "+16"
+    test "test4154" (lazy(sprintf "%+5o" 14)) "  +16"
+    test "test4155" (lazy(sprintf "%+1o" 14)) "+16"
+    test "test4156" (lazy(sprintf "%+*o" 7 14)) "    +16"
+    test "test4157" (lazy(sprintf "%-+o" 14)) "+16"
+    test "test4158" (lazy(sprintf "%-+5o" 14)) "+16  "
+    test "test4159" (lazy(sprintf "%-+1o" 14)) "+16"
+    test "test4160" (lazy(sprintf "%-+*o" 7 14)) "+16    "
+    test "test4161" (lazy(sprintf "%+0o" 14)) "+16"
+    test "test4162" (lazy(sprintf "%+05o" 14)) "+0016"
+    test "test4163" (lazy(sprintf "%+01o" 14)) "+16"
+    test "test4164" (lazy(sprintf "%+0*o" 7 14)) "+000016"
+    test "test4165" (lazy(sprintf "%-+0o" 14)) "+16"
+    test "test4166" (lazy(sprintf "%-+05o" 14)) "+16  "
+    test "test4167" (lazy(sprintf "%-+01o" 14)) "+16"
+    test "test4168" (lazy(sprintf "%-+0*o" 7 14)) "+16    "
+    test "test4169" (lazy(sprintf "% o" 14)) " 16"
+    test "test4170" (lazy(sprintf "% 5o" 14)) "   16"
+    test "test4171" (lazy(sprintf "% 1o" 14)) " 16"
+    test "test4172" (lazy(sprintf "% *o" 7 14)) "     16"
+    test "test4173" (lazy(sprintf "%- o" 14)) " 16"
+    test "test4174" (lazy(sprintf "%- 5o" 14)) " 16  "
+    test "test4175" (lazy(sprintf "%- 1o" 14)) " 16"
+    test "test4176" (lazy(sprintf "%- *o" 7 14)) " 16    "
+    test "test4177" (lazy(sprintf "% 0o" 14)) " 16"
+    test "test4178" (lazy(sprintf "% 05o" 14)) " 0016"
+    test "test4179" (lazy(sprintf "% 01o" 14)) " 16"
+    test "test4180" (lazy(sprintf "% 0*o" 7 14)) " 000016"
+    test "test4181" (lazy(sprintf "%- 0o" 14)) " 16"
+    test "test4182" (lazy(sprintf "%- 05o" 14)) " 16  "
+    test "test4183" (lazy(sprintf "%- 01o" 14)) " 16"
+    test "test4184" (lazy(sprintf "%- 0*o" 7 14)) " 16    "
+    test "test4185" (lazy(sprintf "%o" -10)) "37777777766"
+    test "test4186" (lazy(sprintf "%5o" -10)) "37777777766"
+    test "test4187" (lazy(sprintf "%1o" -10)) "37777777766"
+    test "test4188" (lazy(sprintf "%*o" 7 -10)) "37777777766"
+    test "test4189" (lazy(sprintf "%-o" -10)) "37777777766"
+    test "test4190" (lazy(sprintf "%-5o" -10)) "37777777766"
+    test "test4191" (lazy(sprintf "%-1o" -10)) "37777777766"
+    test "test4192" (lazy(sprintf "%-*o" 7 -10)) "37777777766"
+    test "test4193" (lazy(sprintf "%0o" -10)) "37777777766"
+    test "test4194" (lazy(sprintf "%05o" -10)) "37777777766"
+    test "test4195" (lazy(sprintf "%01o" -10)) "37777777766"
+    test "test4196" (lazy(sprintf "%0*o" 7 -10)) "37777777766"
+    test "test4197" (lazy(sprintf "%-0o" -10)) "37777777766"
+    test "test4198" (lazy(sprintf "%-05o" -10)) "37777777766"
+    test "test4199" (lazy(sprintf "%-01o" -10)) "37777777766"
+    test "test4200" (lazy(sprintf "%-0*o" 7 -10)) "37777777766"
+    test "test4201" (lazy(sprintf "%+o" -10)) "+37777777766"
+    test "test4202" (lazy(sprintf "%+5o" -10)) "+37777777766"
+    test "test4203" (lazy(sprintf "%+1o" -10)) "+37777777766"
+    test "test4204" (lazy(sprintf "%+*o" 7 -10)) "+37777777766"
+    test "test4205" (lazy(sprintf "%-+o" -10)) "+37777777766"
+    test "test4206" (lazy(sprintf "%-+5o" -10)) "+37777777766"
+    test "test4207" (lazy(sprintf "%-+1o" -10)) "+37777777766"
+    test "test4208" (lazy(sprintf "%-+*o" 7 -10)) "+37777777766"
+    test "test4209" (lazy(sprintf "%+0o" -10)) "+37777777766"
+    test "test4210" (lazy(sprintf "%+05o" -10)) "+37777777766"
+    test "test4211" (lazy(sprintf "%+01o" -10)) "+37777777766"
+    test "test4212" (lazy(sprintf "%+0*o" 7 -10)) "+37777777766"
+    test "test4213" (lazy(sprintf "%-+0o" -10)) "+37777777766"
+    test "test4214" (lazy(sprintf "%-+05o" -10)) "+37777777766"
+    test "test4215" (lazy(sprintf "%-+01o" -10)) "+37777777766"
+    test "test4216" (lazy(sprintf "%-+0*o" 7 -10)) "+37777777766"
+    test "test4217" (lazy(sprintf "% o" -10)) " 37777777766"
+    test "test4218" (lazy(sprintf "% 5o" -10)) " 37777777766"
+    test "test4219" (lazy(sprintf "% 1o" -10)) " 37777777766"
+    test "test4220" (lazy(sprintf "% *o" 7 -10)) " 37777777766"
+    test "test4221" (lazy(sprintf "%- o" -10)) " 37777777766"
+    test "test4222" (lazy(sprintf "%- 5o" -10)) " 37777777766"
+    test "test4223" (lazy(sprintf "%- 1o" -10)) " 37777777766"
+    test "test4224" (lazy(sprintf "%- *o" 7 -10)) " 37777777766"
+    test "test4225" (lazy(sprintf "% 0o" -10)) " 37777777766"
+    test "test4226" (lazy(sprintf "% 05o" -10)) " 37777777766"
+    test "test4227" (lazy(sprintf "% 01o" -10)) " 37777777766"
+    test "test4228" (lazy(sprintf "% 0*o" 7 -10)) " 37777777766"
+    test "test4229" (lazy(sprintf "%- 0o" -10)) " 37777777766"
+    test "test4230" (lazy(sprintf "%- 05o" -10)) " 37777777766"
+    test "test4231" (lazy(sprintf "%- 01o" -10)) " 37777777766"
+    test "test4232" (lazy(sprintf "%- 0*o" 7 -10)) " 37777777766"
+    test "test4233" (lazy(sprintf "%o" 55s)) "67"
+    test "test4234" (lazy(sprintf "%5o" 55s)) "   67"
+    test "test4235" (lazy(sprintf "%1o" 55s)) "67"
+    test "test4236" (lazy(sprintf "%*o" 7 55s)) "     67"
+    test "test4237" (lazy(sprintf "%-o" 55s)) "67"
+    test "test4238" (lazy(sprintf "%-5o" 55s)) "67   "
+    test "test4239" (lazy(sprintf "%-1o" 55s)) "67"
+    test "test4240" (lazy(sprintf "%-*o" 7 55s)) "67     "
+    test "test4241" (lazy(sprintf "%0o" 55s)) "67"
+    test "test4242" (lazy(sprintf "%05o" 55s)) "00067"
+    test "test4243" (lazy(sprintf "%01o" 55s)) "67"
+    test "test4244" (lazy(sprintf "%0*o" 7 55s)) "0000067"
+    test "test4245" (lazy(sprintf "%-0o" 55s)) "67"
+    test "test4246" (lazy(sprintf "%-05o" 55s)) "67   "
+    test "test4247" (lazy(sprintf "%-01o" 55s)) "67"
+    test "test4248" (lazy(sprintf "%-0*o" 7 55s)) "67     "
+    test "test4249" (lazy(sprintf "%+o" 55s)) "+67"
+    test "test4250" (lazy(sprintf "%+5o" 55s)) "  +67"
+    test "test4251" (lazy(sprintf "%+1o" 55s)) "+67"
+    test "test4252" (lazy(sprintf "%+*o" 7 55s)) "    +67"
+    test "test4253" (lazy(sprintf "%-+o" 55s)) "+67"
+    test "test4254" (lazy(sprintf "%-+5o" 55s)) "+67  "
+    test "test4255" (lazy(sprintf "%-+1o" 55s)) "+67"
+    test "test4256" (lazy(sprintf "%-+*o" 7 55s)) "+67    "
+    test "test4257" (lazy(sprintf "%+0o" 55s)) "+67"
+    test "test4258" (lazy(sprintf "%+05o" 55s)) "+0067"
+    test "test4259" (lazy(sprintf "%+01o" 55s)) "+67"
+    test "test4260" (lazy(sprintf "%+0*o" 7 55s)) "+000067"
+    test "test4261" (lazy(sprintf "%-+0o" 55s)) "+67"
+    test "test4262" (lazy(sprintf "%-+05o" 55s)) "+67  "
+    test "test4263" (lazy(sprintf "%-+01o" 55s)) "+67"
+    test "test4264" (lazy(sprintf "%-+0*o" 7 55s)) "+67    "
+    test "test4265" (lazy(sprintf "% o" 55s)) " 67"
+    test "test4266" (lazy(sprintf "% 5o" 55s)) "   67"
+    test "test4267" (lazy(sprintf "% 1o" 55s)) " 67"
+    test "test4268" (lazy(sprintf "% *o" 7 55s)) "     67"
+    test "test4269" (lazy(sprintf "%- o" 55s)) " 67"
+    test "test4270" (lazy(sprintf "%- 5o" 55s)) " 67  "
+    test "test4271" (lazy(sprintf "%- 1o" 55s)) " 67"
+    test "test4272" (lazy(sprintf "%- *o" 7 55s)) " 67    "
+    test "test4273" (lazy(sprintf "% 0o" 55s)) " 67"
+    test "test4274" (lazy(sprintf "% 05o" 55s)) " 0067"
+    test "test4275" (lazy(sprintf "% 01o" 55s)) " 67"
+    test "test4276" (lazy(sprintf "% 0*o" 7 55s)) " 000067"
+    test "test4277" (lazy(sprintf "%- 0o" 55s)) " 67"
+    test "test4278" (lazy(sprintf "%- 05o" 55s)) " 67  "
+    test "test4279" (lazy(sprintf "%- 01o" 55s)) " 67"
+    test "test4280" (lazy(sprintf "%- 0*o" 7 55s)) " 67    "
+    test "test4281" (lazy(sprintf "%o" -88s)) "177650"
+    test "test4282" (lazy(sprintf "%5o" -88s)) "177650"
+    test "test4283" (lazy(sprintf "%1o" -88s)) "177650"
+    test "test4284" (lazy(sprintf "%*o" 7 -88s)) " 177650"
+    test "test4285" (lazy(sprintf "%-o" -88s)) "177650"
+    test "test4286" (lazy(sprintf "%-5o" -88s)) "177650"
+    test "test4287" (lazy(sprintf "%-1o" -88s)) "177650"
+    test "test4288" (lazy(sprintf "%-*o" 7 -88s)) "177650 "
+    test "test4289" (lazy(sprintf "%0o" -88s)) "177650"
+    test "test4290" (lazy(sprintf "%05o" -88s)) "177650"
+    test "test4291" (lazy(sprintf "%01o" -88s)) "177650"
+    test "test4292" (lazy(sprintf "%0*o" 7 -88s)) "0177650"
+    test "test4293" (lazy(sprintf "%-0o" -88s)) "177650"
+    test "test4294" (lazy(sprintf "%-05o" -88s)) "177650"
+    test "test4295" (lazy(sprintf "%-01o" -88s)) "177650"
+    test "test4296" (lazy(sprintf "%-0*o" 7 -88s)) "177650 "
+    test "test4297" (lazy(sprintf "%+o" -88s)) "+177650"
+    test "test4298" (lazy(sprintf "%+5o" -88s)) "+177650"
+    test "test4299" (lazy(sprintf "%+1o" -88s)) "+177650"
+    test "test4300" (lazy(sprintf "%+*o" 7 -88s)) "+177650"
+    test "test4301" (lazy(sprintf "%-+o" -88s)) "+177650"
+    test "test4302" (lazy(sprintf "%-+5o" -88s)) "+177650"
+    test "test4303" (lazy(sprintf "%-+1o" -88s)) "+177650"
+    test "test4304" (lazy(sprintf "%-+*o" 7 -88s)) "+177650"
+    test "test4305" (lazy(sprintf "%+0o" -88s)) "+177650"
+    test "test4306" (lazy(sprintf "%+05o" -88s)) "+177650"
+    test "test4307" (lazy(sprintf "%+01o" -88s)) "+177650"
+    test "test4308" (lazy(sprintf "%+0*o" 7 -88s)) "+177650"
+    test "test4309" (lazy(sprintf "%-+0o" -88s)) "+177650"
+    test "test4310" (lazy(sprintf "%-+05o" -88s)) "+177650"
+    test "test4311" (lazy(sprintf "%-+01o" -88s)) "+177650"
+    test "test4312" (lazy(sprintf "%-+0*o" 7 -88s)) "+177650"
+    test "test4313" (lazy(sprintf "% o" -88s)) " 177650"
+    test "test4314" (lazy(sprintf "% 5o" -88s)) " 177650"
+    test "test4315" (lazy(sprintf "% 1o" -88s)) " 177650"
+    test "test4316" (lazy(sprintf "% *o" 7 -88s)) " 177650"
+    test "test4317" (lazy(sprintf "%- o" -88s)) " 177650"
+    test "test4318" (lazy(sprintf "%- 5o" -88s)) " 177650"
+    test "test4319" (lazy(sprintf "%- 1o" -88s)) " 177650"
+    test "test4320" (lazy(sprintf "%- *o" 7 -88s)) " 177650"
+    test "test4321" (lazy(sprintf "% 0o" -88s)) " 177650"
+    test "test4322" (lazy(sprintf "% 05o" -88s)) " 177650"
+    test "test4323" (lazy(sprintf "% 01o" -88s)) " 177650"
+    test "test4324" (lazy(sprintf "% 0*o" 7 -88s)) " 177650"
+    test "test4325" (lazy(sprintf "%- 0o" -88s)) " 177650"
+    test "test4326" (lazy(sprintf "%- 05o" -88s)) " 177650"
+    test "test4327" (lazy(sprintf "%- 01o" -88s)) " 177650"
+    test "test4328" (lazy(sprintf "%- 0*o" 7 -88s)) " 177650"
+    test "test4329" (lazy(sprintf "%o" 104us)) "150"
+    test "test4330" (lazy(sprintf "%5o" 104us)) "  150"
+    test "test4331" (lazy(sprintf "%1o" 104us)) "150"
+    test "test4332" (lazy(sprintf "%*o" 7 104us)) "    150"
+    test "test4333" (lazy(sprintf "%-o" 104us)) "150"
+    test "test4334" (lazy(sprintf "%-5o" 104us)) "150  "
+    test "test4335" (lazy(sprintf "%-1o" 104us)) "150"
+    test "test4336" (lazy(sprintf "%-*o" 7 104us)) "150    "
+    test "test4337" (lazy(sprintf "%0o" 104us)) "150"
+    test "test4338" (lazy(sprintf "%05o" 104us)) "00150"
+    test "test4339" (lazy(sprintf "%01o" 104us)) "150"
+    test "test4340" (lazy(sprintf "%0*o" 7 104us)) "0000150"
+    test "test4341" (lazy(sprintf "%-0o" 104us)) "150"
+    test "test4342" (lazy(sprintf "%-05o" 104us)) "150  "
+    test "test4343" (lazy(sprintf "%-01o" 104us)) "150"
+    test "test4344" (lazy(sprintf "%-0*o" 7 104us)) "150    "
+    test "test4345" (lazy(sprintf "%+o" 104us)) "+150"
+    test "test4346" (lazy(sprintf "%+5o" 104us)) " +150"
+    test "test4347" (lazy(sprintf "%+1o" 104us)) "+150"
+    test "test4348" (lazy(sprintf "%+*o" 7 104us)) "   +150"
+    test "test4349" (lazy(sprintf "%-+o" 104us)) "+150"
+    test "test4350" (lazy(sprintf "%-+5o" 104us)) "+150 "
+    test "test4351" (lazy(sprintf "%-+1o" 104us)) "+150"
+    test "test4352" (lazy(sprintf "%-+*o" 7 104us)) "+150   "
+    test "test4353" (lazy(sprintf "%+0o" 104us)) "+150"
+    test "test4354" (lazy(sprintf "%+05o" 104us)) "+0150"
+    test "test4355" (lazy(sprintf "%+01o" 104us)) "+150"
+    test "test4356" (lazy(sprintf "%+0*o" 7 104us)) "+000150"
+    test "test4357" (lazy(sprintf "%-+0o" 104us)) "+150"
+    test "test4358" (lazy(sprintf "%-+05o" 104us)) "+150 "
+    test "test4359" (lazy(sprintf "%-+01o" 104us)) "+150"
+    test "test4360" (lazy(sprintf "%-+0*o" 7 104us)) "+150   "
+    test "test4361" (lazy(sprintf "% o" 104us)) " 150"
+    test "test4362" (lazy(sprintf "% 5o" 104us)) "  150"
+    test "test4363" (lazy(sprintf "% 1o" 104us)) " 150"
+    test "test4364" (lazy(sprintf "% *o" 7 104us)) "    150"
+    test "test4365" (lazy(sprintf "%- o" 104us)) " 150"
+    test "test4366" (lazy(sprintf "%- 5o" 104us)) " 150 "
+    test "test4367" (lazy(sprintf "%- 1o" 104us)) " 150"
+    test "test4368" (lazy(sprintf "%- *o" 7 104us)) " 150   "
+    test "test4369" (lazy(sprintf "% 0o" 104us)) " 150"
+    test "test4370" (lazy(sprintf "% 05o" 104us)) " 0150"
+    test "test4371" (lazy(sprintf "% 01o" 104us)) " 150"
+    test "test4372" (lazy(sprintf "% 0*o" 7 104us)) " 000150"
+    test "test4373" (lazy(sprintf "%- 0o" 104us)) " 150"
+    test "test4374" (lazy(sprintf "%- 05o" 104us)) " 150 "
+    test "test4375" (lazy(sprintf "%- 01o" 104us)) " 150"
+    test "test4376" (lazy(sprintf "%- 0*o" 7 104us)) " 150   "
+    test "test4377" (lazy(sprintf "%o" 12y)) "14"
+    test "test4378" (lazy(sprintf "%5o" 12y)) "   14"
+    test "test4379" (lazy(sprintf "%1o" 12y)) "14"
+    test "test4380" (lazy(sprintf "%*o" 7 12y)) "     14"
+    test "test4381" (lazy(sprintf "%-o" 12y)) "14"
+    test "test4382" (lazy(sprintf "%-5o" 12y)) "14   "
+    test "test4383" (lazy(sprintf "%-1o" 12y)) "14"
+    test "test4384" (lazy(sprintf "%-*o" 7 12y)) "14     "
+    test "test4385" (lazy(sprintf "%0o" 12y)) "14"
+    test "test4386" (lazy(sprintf "%05o" 12y)) "00014"
+    test "test4387" (lazy(sprintf "%01o" 12y)) "14"
+    test "test4388" (lazy(sprintf "%0*o" 7 12y)) "0000014"
+    test "test4389" (lazy(sprintf "%-0o" 12y)) "14"
+    test "test4390" (lazy(sprintf "%-05o" 12y)) "14   "
+    test "test4391" (lazy(sprintf "%-01o" 12y)) "14"
+    test "test4392" (lazy(sprintf "%-0*o" 7 12y)) "14     "
+    test "test4393" (lazy(sprintf "%+o" 12y)) "+14"
+    test "test4394" (lazy(sprintf "%+5o" 12y)) "  +14"
+    test "test4395" (lazy(sprintf "%+1o" 12y)) "+14"
+    test "test4396" (lazy(sprintf "%+*o" 7 12y)) "    +14"
+    test "test4397" (lazy(sprintf "%-+o" 12y)) "+14"
+    test "test4398" (lazy(sprintf "%-+5o" 12y)) "+14  "
+    test "test4399" (lazy(sprintf "%-+1o" 12y)) "+14"
+    test "test4400" (lazy(sprintf "%-+*o" 7 12y)) "+14    "
+    test "test4401" (lazy(sprintf "%+0o" 12y)) "+14"
+    test "test4402" (lazy(sprintf "%+05o" 12y)) "+0014"
+    test "test4403" (lazy(sprintf "%+01o" 12y)) "+14"
+    test "test4404" (lazy(sprintf "%+0*o" 7 12y)) "+000014"
+    test "test4405" (lazy(sprintf "%-+0o" 12y)) "+14"
+    test "test4406" (lazy(sprintf "%-+05o" 12y)) "+14  "
+    test "test4407" (lazy(sprintf "%-+01o" 12y)) "+14"
+    test "test4408" (lazy(sprintf "%-+0*o" 7 12y)) "+14    "
+    test "test4409" (lazy(sprintf "% o" 12y)) " 14"
+    test "test4410" (lazy(sprintf "% 5o" 12y)) "   14"
+    test "test4411" (lazy(sprintf "% 1o" 12y)) " 14"
+    test "test4412" (lazy(sprintf "% *o" 7 12y)) "     14"
+    test "test4413" (lazy(sprintf "%- o" 12y)) " 14"
+    test "test4414" (lazy(sprintf "%- 5o" 12y)) " 14  "
+    test "test4415" (lazy(sprintf "%- 1o" 12y)) " 14"
+    test "test4416" (lazy(sprintf "%- *o" 7 12y)) " 14    "
+    test "test4417" (lazy(sprintf "% 0o" 12y)) " 14"
+    test "test4418" (lazy(sprintf "% 05o" 12y)) " 0014"
+    test "test4419" (lazy(sprintf "% 01o" 12y)) " 14"
+    test "test4420" (lazy(sprintf "% 0*o" 7 12y)) " 000014"
+    test "test4421" (lazy(sprintf "%- 0o" 12y)) " 14"
+    test "test4422" (lazy(sprintf "%- 05o" 12y)) " 14  "
+    test "test4423" (lazy(sprintf "%- 01o" 12y)) " 14"
+    test "test4424" (lazy(sprintf "%- 0*o" 7 12y)) " 14    "
+    test "test4425" (lazy(sprintf "%o" -94y)) "242"
+    test "test4426" (lazy(sprintf "%5o" -94y)) "  242"
+    test "test4427" (lazy(sprintf "%1o" -94y)) "242"
+    test "test4428" (lazy(sprintf "%*o" 7 -94y)) "    242"
+    test "test4429" (lazy(sprintf "%-o" -94y)) "242"
+    test "test4430" (lazy(sprintf "%-5o" -94y)) "242  "
+    test "test4431" (lazy(sprintf "%-1o" -94y)) "242"
+    test "test4432" (lazy(sprintf "%-*o" 7 -94y)) "242    "
+    test "test4433" (lazy(sprintf "%0o" -94y)) "242"
+    test "test4434" (lazy(sprintf "%05o" -94y)) "00242"
+    test "test4435" (lazy(sprintf "%01o" -94y)) "242"
+    test "test4436" (lazy(sprintf "%0*o" 7 -94y)) "0000242"
+    test "test4437" (lazy(sprintf "%-0o" -94y)) "242"
+    test "test4438" (lazy(sprintf "%-05o" -94y)) "242  "
+    test "test4439" (lazy(sprintf "%-01o" -94y)) "242"
+    test "test4440" (lazy(sprintf "%-0*o" 7 -94y)) "242    "
+    test "test4441" (lazy(sprintf "%+o" -94y)) "+242"
+    test "test4442" (lazy(sprintf "%+5o" -94y)) " +242"
+    test "test4443" (lazy(sprintf "%+1o" -94y)) "+242"
+    test "test4444" (lazy(sprintf "%+*o" 7 -94y)) "   +242"
+    test "test4445" (lazy(sprintf "%-+o" -94y)) "+242"
+    test "test4446" (lazy(sprintf "%-+5o" -94y)) "+242 "
+    test "test4447" (lazy(sprintf "%-+1o" -94y)) "+242"
+    test "test4448" (lazy(sprintf "%-+*o" 7 -94y)) "+242   "
+    test "test4449" (lazy(sprintf "%+0o" -94y)) "+242"
+    test "test4450" (lazy(sprintf "%+05o" -94y)) "+0242"
+    test "test4451" (lazy(sprintf "%+01o" -94y)) "+242"
+    test "test4452" (lazy(sprintf "%+0*o" 7 -94y)) "+000242"
+    test "test4453" (lazy(sprintf "%-+0o" -94y)) "+242"
+    test "test4454" (lazy(sprintf "%-+05o" -94y)) "+242 "
+    test "test4455" (lazy(sprintf "%-+01o" -94y)) "+242"
+    test "test4456" (lazy(sprintf "%-+0*o" 7 -94y)) "+242   "
+    test "test4457" (lazy(sprintf "% o" -94y)) " 242"
+    test "test4458" (lazy(sprintf "% 5o" -94y)) "  242"
+    test "test4459" (lazy(sprintf "% 1o" -94y)) " 242"
+    test "test4460" (lazy(sprintf "% *o" 7 -94y)) "    242"
+    test "test4461" (lazy(sprintf "%- o" -94y)) " 242"
+    test "test4462" (lazy(sprintf "%- 5o" -94y)) " 242 "
+    test "test4463" (lazy(sprintf "%- 1o" -94y)) " 242"
+    test "test4464" (lazy(sprintf "%- *o" 7 -94y)) " 242   "
+    test "test4465" (lazy(sprintf "% 0o" -94y)) " 242"
+    test "test4466" (lazy(sprintf "% 05o" -94y)) " 0242"
+    test "test4467" (lazy(sprintf "% 01o" -94y)) " 242"
+    test "test4468" (lazy(sprintf "% 0*o" 7 -94y)) " 000242"
+    test "test4469" (lazy(sprintf "%- 0o" -94y)) " 242"
+    test "test4470" (lazy(sprintf "%- 05o" -94y)) " 242 "
+    test "test4471" (lazy(sprintf "%- 01o" -94y)) " 242"
+    test "test4472" (lazy(sprintf "%- 0*o" 7 -94y)) " 242   "
+    test "test4473" (lazy(sprintf "%o" 88uy)) "130"
+    test "test4474" (lazy(sprintf "%5o" 88uy)) "  130"
+    test "test4475" (lazy(sprintf "%1o" 88uy)) "130"
+    test "test4476" (lazy(sprintf "%*o" 7 88uy)) "    130"
+    test "test4477" (lazy(sprintf "%-o" 88uy)) "130"
+    test "test4478" (lazy(sprintf "%-5o" 88uy)) "130  "
+    test "test4479" (lazy(sprintf "%-1o" 88uy)) "130"
+    test "test4480" (lazy(sprintf "%-*o" 7 88uy)) "130    "
+    test "test4481" (lazy(sprintf "%0o" 88uy)) "130"
+    test "test4482" (lazy(sprintf "%05o" 88uy)) "00130"
+    test "test4483" (lazy(sprintf "%01o" 88uy)) "130"
+    test "test4484" (lazy(sprintf "%0*o" 7 88uy)) "0000130"
+    test "test4485" (lazy(sprintf "%-0o" 88uy)) "130"
+    test "test4486" (lazy(sprintf "%-05o" 88uy)) "130  "
+    test "test4487" (lazy(sprintf "%-01o" 88uy)) "130"
+    test "test4488" (lazy(sprintf "%-0*o" 7 88uy)) "130    "
+    test "test4489" (lazy(sprintf "%+o" 88uy)) "+130"
+    test "test4490" (lazy(sprintf "%+5o" 88uy)) " +130"
+    test "test4491" (lazy(sprintf "%+1o" 88uy)) "+130"
+    test "test4492" (lazy(sprintf "%+*o" 7 88uy)) "   +130"
+    test "test4493" (lazy(sprintf "%-+o" 88uy)) "+130"
+    test "test4494" (lazy(sprintf "%-+5o" 88uy)) "+130 "
+    test "test4495" (lazy(sprintf "%-+1o" 88uy)) "+130"
+    test "test4496" (lazy(sprintf "%-+*o" 7 88uy)) "+130   "
+    test "test4497" (lazy(sprintf "%+0o" 88uy)) "+130"
+    test "test4498" (lazy(sprintf "%+05o" 88uy)) "+0130"
+    test "test4499" (lazy(sprintf "%+01o" 88uy)) "+130"
+    test "test4500" (lazy(sprintf "%+0*o" 7 88uy)) "+000130"
+    test "test4501" (lazy(sprintf "%-+0o" 88uy)) "+130"
+    test "test4502" (lazy(sprintf "%-+05o" 88uy)) "+130 "
+    test "test4503" (lazy(sprintf "%-+01o" 88uy)) "+130"
+    test "test4504" (lazy(sprintf "%-+0*o" 7 88uy)) "+130   "
+    test "test4505" (lazy(sprintf "% o" 88uy)) " 130"
+    test "test4506" (lazy(sprintf "% 5o" 88uy)) "  130"
+    test "test4507" (lazy(sprintf "% 1o" 88uy)) " 130"
+    test "test4508" (lazy(sprintf "% *o" 7 88uy)) "    130"
+    test "test4509" (lazy(sprintf "%- o" 88uy)) " 130"
+    test "test4510" (lazy(sprintf "%- 5o" 88uy)) " 130 "
+    test "test4511" (lazy(sprintf "%- 1o" 88uy)) " 130"
+    test "test4512" (lazy(sprintf "%- *o" 7 88uy)) " 130   "
+    test "test4513" (lazy(sprintf "% 0o" 88uy)) " 130"
+    test "test4514" (lazy(sprintf "% 05o" 88uy)) " 0130"
+    test "test4515" (lazy(sprintf "% 01o" 88uy)) " 130"
+    test "test4516" (lazy(sprintf "% 0*o" 7 88uy)) " 000130"
+    test "test4517" (lazy(sprintf "%- 0o" 88uy)) " 130"
+    test "test4518" (lazy(sprintf "%- 05o" 88uy)) " 130 "
+    test "test4519" (lazy(sprintf "%- 01o" 88uy)) " 130"
+    test "test4520" (lazy(sprintf "%- 0*o" 7 88uy)) " 130   "
+    test "test4521" (lazy(sprintf "%o" 999L)) "1747"
+    test "test4522" (lazy(sprintf "%5o" 999L)) " 1747"
+    test "test4523" (lazy(sprintf "%1o" 999L)) "1747"
+    test "test4524" (lazy(sprintf "%*o" 7 999L)) "   1747"
+    test "test4525" (lazy(sprintf "%-o" 999L)) "1747"
+    test "test4526" (lazy(sprintf "%-5o" 999L)) "1747 "
+    test "test4527" (lazy(sprintf "%-1o" 999L)) "1747"
+    test "test4528" (lazy(sprintf "%-*o" 7 999L)) "1747   "
+    test "test4529" (lazy(sprintf "%0o" 999L)) "1747"
+    test "test4530" (lazy(sprintf "%05o" 999L)) "01747"
+    test "test4531" (lazy(sprintf "%01o" 999L)) "1747"
+    test "test4532" (lazy(sprintf "%0*o" 7 999L)) "0001747"
+    test "test4533" (lazy(sprintf "%-0o" 999L)) "1747"
+    test "test4534" (lazy(sprintf "%-05o" 999L)) "1747 "
+    test "test4535" (lazy(sprintf "%-01o" 999L)) "1747"
+    test "test4536" (lazy(sprintf "%-0*o" 7 999L)) "1747   "
+    test "test4537" (lazy(sprintf "%+o" 999L)) "+1747"
+    test "test4538" (lazy(sprintf "%+5o" 999L)) "+1747"
+    test "test4539" (lazy(sprintf "%+1o" 999L)) "+1747"
+    test "test4540" (lazy(sprintf "%+*o" 7 999L)) "  +1747"
+    test "test4541" (lazy(sprintf "%-+o" 999L)) "+1747"
+    test "test4542" (lazy(sprintf "%-+5o" 999L)) "+1747"
+    test "test4543" (lazy(sprintf "%-+1o" 999L)) "+1747"
+    test "test4544" (lazy(sprintf "%-+*o" 7 999L)) "+1747  "
+    test "test4545" (lazy(sprintf "%+0o" 999L)) "+1747"
+    test "test4546" (lazy(sprintf "%+05o" 999L)) "+1747"
+    test "test4547" (lazy(sprintf "%+01o" 999L)) "+1747"
+    test "test4548" (lazy(sprintf "%+0*o" 7 999L)) "+001747"
+    test "test4549" (lazy(sprintf "%-+0o" 999L)) "+1747"
+    test "test4550" (lazy(sprintf "%-+05o" 999L)) "+1747"
+    test "test4551" (lazy(sprintf "%-+01o" 999L)) "+1747"
+    test "test4552" (lazy(sprintf "%-+0*o" 7 999L)) "+1747  "
+    test "test4553" (lazy(sprintf "% o" 999L)) " 1747"
+    test "test4554" (lazy(sprintf "% 5o" 999L)) " 1747"
+    test "test4555" (lazy(sprintf "% 1o" 999L)) " 1747"
+    test "test4556" (lazy(sprintf "% *o" 7 999L)) "   1747"
+    test "test4557" (lazy(sprintf "%- o" 999L)) " 1747"
+    test "test4558" (lazy(sprintf "%- 5o" 999L)) " 1747"
+    test "test4559" (lazy(sprintf "%- 1o" 999L)) " 1747"
+    test "test4560" (lazy(sprintf "%- *o" 7 999L)) " 1747  "
+    test "test4561" (lazy(sprintf "% 0o" 999L)) " 1747"
+    test "test4562" (lazy(sprintf "% 05o" 999L)) " 1747"
+    test "test4563" (lazy(sprintf "% 01o" 999L)) " 1747"
+    test "test4564" (lazy(sprintf "% 0*o" 7 999L)) " 001747"
+    test "test4565" (lazy(sprintf "%- 0o" 999L)) " 1747"
+    test "test4566" (lazy(sprintf "%- 05o" 999L)) " 1747"
+    test "test4567" (lazy(sprintf "%- 01o" 999L)) " 1747"
+    test "test4568" (lazy(sprintf "%- 0*o" 7 999L)) " 1747  "
+    test "test4569" (lazy(sprintf "%o" -321L)) "1777777777777777777277"
+    test "test4570" (lazy(sprintf "%5o" -321L)) "1777777777777777777277"
+    test "test4571" (lazy(sprintf "%1o" -321L)) "1777777777777777777277"
+    test "test4572" (lazy(sprintf "%*o" 7 -321L)) "1777777777777777777277"
+    test "test4573" (lazy(sprintf "%-o" -321L)) "1777777777777777777277"
+    test "test4574" (lazy(sprintf "%-5o" -321L)) "1777777777777777777277"
+    test "test4575" (lazy(sprintf "%-1o" -321L)) "1777777777777777777277"
+    test "test4576" (lazy(sprintf "%-*o" 7 -321L)) "1777777777777777777277"
+    test "test4577" (lazy(sprintf "%0o" -321L)) "1777777777777777777277"
+    test "test4578" (lazy(sprintf "%05o" -321L)) "1777777777777777777277"
+    test "test4579" (lazy(sprintf "%01o" -321L)) "1777777777777777777277"
+    test "test4580" (lazy(sprintf "%0*o" 7 -321L)) "1777777777777777777277"
+    test "test4581" (lazy(sprintf "%-0o" -321L)) "1777777777777777777277"
+    test "test4582" (lazy(sprintf "%-05o" -321L)) "1777777777777777777277"
+    test "test4583" (lazy(sprintf "%-01o" -321L)) "1777777777777777777277"
+    test "test4584" (lazy(sprintf "%-0*o" 7 -321L)) "1777777777777777777277"
+    test "test4585" (lazy(sprintf "%+o" -321L)) "+1777777777777777777277"
+    test "test4586" (lazy(sprintf "%+5o" -321L)) "+1777777777777777777277"
+    test "test4587" (lazy(sprintf "%+1o" -321L)) "+1777777777777777777277"
+    test "test4588" (lazy(sprintf "%+*o" 7 -321L)) "+1777777777777777777277"
+    test "test4589" (lazy(sprintf "%-+o" -321L)) "+1777777777777777777277"
+    test "test4590" (lazy(sprintf "%-+5o" -321L)) "+1777777777777777777277"
+    test "test4591" (lazy(sprintf "%-+1o" -321L)) "+1777777777777777777277"
+    test "test4592" (lazy(sprintf "%-+*o" 7 -321L)) "+1777777777777777777277"
+    test "test4593" (lazy(sprintf "%+0o" -321L)) "+1777777777777777777277"
+    test "test4594" (lazy(sprintf "%+05o" -321L)) "+1777777777777777777277"
+    test "test4595" (lazy(sprintf "%+01o" -321L)) "+1777777777777777777277"
+    test "test4596" (lazy(sprintf "%+0*o" 7 -321L)) "+1777777777777777777277"
+    test "test4597" (lazy(sprintf "%-+0o" -321L)) "+1777777777777777777277"
+    test "test4598" (lazy(sprintf "%-+05o" -321L)) "+1777777777777777777277"
+    test "test4599" (lazy(sprintf "%-+01o" -321L)) "+1777777777777777777277"
+    test "test4600" (lazy(sprintf "%-+0*o" 7 -321L)) "+1777777777777777777277"
+    test "test4601" (lazy(sprintf "% o" -321L)) " 1777777777777777777277"
+    test "test4602" (lazy(sprintf "% 5o" -321L)) " 1777777777777777777277"
+    test "test4603" (lazy(sprintf "% 1o" -321L)) " 1777777777777777777277"
+    test "test4604" (lazy(sprintf "% *o" 7 -321L)) " 1777777777777777777277"
+    test "test4605" (lazy(sprintf "%- o" -321L)) " 1777777777777777777277"
+    test "test4606" (lazy(sprintf "%- 5o" -321L)) " 1777777777777777777277"
+    test "test4607" (lazy(sprintf "%- 1o" -321L)) " 1777777777777777777277"
+    test "test4608" (lazy(sprintf "%- *o" 7 -321L)) " 1777777777777777777277"
+    test "test4609" (lazy(sprintf "% 0o" -321L)) " 1777777777777777777277"
+    test "test4610" (lazy(sprintf "% 05o" -321L)) " 1777777777777777777277"
+    test "test4611" (lazy(sprintf "% 01o" -321L)) " 1777777777777777777277"
+    test "test4612" (lazy(sprintf "% 0*o" 7 -321L)) " 1777777777777777777277"
+    test "test4613" (lazy(sprintf "%- 0o" -321L)) " 1777777777777777777277"
+    test "test4614" (lazy(sprintf "%- 05o" -321L)) " 1777777777777777777277"
+    test "test4615" (lazy(sprintf "%- 01o" -321L)) " 1777777777777777777277"
+    test "test4616" (lazy(sprintf "%- 0*o" 7 -321L)) " 1777777777777777777277"
+    test "test4617" (lazy(sprintf "%o" 50000UL)) "141520"
+    test "test4618" (lazy(sprintf "%5o" 50000UL)) "141520"
+    test "test4619" (lazy(sprintf "%1o" 50000UL)) "141520"
+    test "test4620" (lazy(sprintf "%*o" 7 50000UL)) " 141520"
+    test "test4621" (lazy(sprintf "%-o" 50000UL)) "141520"
+    test "test4622" (lazy(sprintf "%-5o" 50000UL)) "141520"
+    test "test4623" (lazy(sprintf "%-1o" 50000UL)) "141520"
+    test "test4624" (lazy(sprintf "%-*o" 7 50000UL)) "141520 "
+    test "test4625" (lazy(sprintf "%0o" 50000UL)) "141520"
+    test "test4626" (lazy(sprintf "%05o" 50000UL)) "141520"
+    test "test4627" (lazy(sprintf "%01o" 50000UL)) "141520"
+    test "test4628" (lazy(sprintf "%0*o" 7 50000UL)) "0141520"
+    test "test4629" (lazy(sprintf "%-0o" 50000UL)) "141520"
+    test "test4630" (lazy(sprintf "%-05o" 50000UL)) "141520"
+    test "test4631" (lazy(sprintf "%-01o" 50000UL)) "141520"
+    test "test4632" (lazy(sprintf "%-0*o" 7 50000UL)) "141520 "
+    test "test4633" (lazy(sprintf "%+o" 50000UL)) "+141520"
+    test "test4634" (lazy(sprintf "%+5o" 50000UL)) "+141520"
+    test "test4635" (lazy(sprintf "%+1o" 50000UL)) "+141520"
+    test "test4636" (lazy(sprintf "%+*o" 7 50000UL)) "+141520"
+    test "test4637" (lazy(sprintf "%-+o" 50000UL)) "+141520"
+    test "test4638" (lazy(sprintf "%-+5o" 50000UL)) "+141520"
+    test "test4639" (lazy(sprintf "%-+1o" 50000UL)) "+141520"
+    test "test4640" (lazy(sprintf "%-+*o" 7 50000UL)) "+141520"
+    test "test4641" (lazy(sprintf "%+0o" 50000UL)) "+141520"
+    test "test4642" (lazy(sprintf "%+05o" 50000UL)) "+141520"
+    test "test4643" (lazy(sprintf "%+01o" 50000UL)) "+141520"
+    test "test4644" (lazy(sprintf "%+0*o" 7 50000UL)) "+141520"
+    test "test4645" (lazy(sprintf "%-+0o" 50000UL)) "+141520"
+    test "test4646" (lazy(sprintf "%-+05o" 50000UL)) "+141520"
+    test "test4647" (lazy(sprintf "%-+01o" 50000UL)) "+141520"
+    test "test4648" (lazy(sprintf "%-+0*o" 7 50000UL)) "+141520"
+    test "test4649" (lazy(sprintf "% o" 50000UL)) " 141520"
+    test "test4650" (lazy(sprintf "% 5o" 50000UL)) " 141520"
+    test "test4651" (lazy(sprintf "% 1o" 50000UL)) " 141520"
+    test "test4652" (lazy(sprintf "% *o" 7 50000UL)) " 141520"
+    test "test4653" (lazy(sprintf "%- o" 50000UL)) " 141520"
+    test "test4654" (lazy(sprintf "%- 5o" 50000UL)) " 141520"
+    test "test4655" (lazy(sprintf "%- 1o" 50000UL)) " 141520"
+    test "test4656" (lazy(sprintf "%- *o" 7 50000UL)) " 141520"
+    test "test4657" (lazy(sprintf "% 0o" 50000UL)) " 141520"
+    test "test4658" (lazy(sprintf "% 05o" 50000UL)) " 141520"
+    test "test4659" (lazy(sprintf "% 01o" 50000UL)) " 141520"
+    test "test4660" (lazy(sprintf "% 0*o" 7 50000UL)) " 141520"
+    test "test4661" (lazy(sprintf "%- 0o" 50000UL)) " 141520"
+    test "test4662" (lazy(sprintf "%- 05o" 50000UL)) " 141520"
+    test "test4663" (lazy(sprintf "%- 01o" 50000UL)) " 141520"
+    test "test4664" (lazy(sprintf "%- 0*o" 7 50000UL)) " 141520"
+    test "test4665" (lazy(sprintf "%o" System.Int32.MaxValue)) "17777777777"
+    test "test4666" (lazy(sprintf "%5o" System.Int32.MaxValue)) "17777777777"
+    test "test4667" (lazy(sprintf "%1o" System.Int32.MaxValue)) "17777777777"
+    test "test4668" (lazy(sprintf "%*o" 7 System.Int32.MaxValue)) "17777777777"
+    test "test4669" (lazy(sprintf "%-o" System.Int32.MaxValue)) "17777777777"
+    test "test4670" (lazy(sprintf "%-5o" System.Int32.MaxValue)) "17777777777"
+    test "test4671" (lazy(sprintf "%-1o" System.Int32.MaxValue)) "17777777777"
+    test "test4672" (lazy(sprintf "%-*o" 7 System.Int32.MaxValue)) "17777777777"
+    test "test4673" (lazy(sprintf "%0o" System.Int32.MaxValue)) "17777777777"
+    test "test4674" (lazy(sprintf "%05o" System.Int32.MaxValue)) "17777777777"
+    test "test4675" (lazy(sprintf "%01o" System.Int32.MaxValue)) "17777777777"
+    test "test4676" (lazy(sprintf "%0*o" 7 System.Int32.MaxValue)) "17777777777"
+    test "test4677" (lazy(sprintf "%-0o" System.Int32.MaxValue)) "17777777777"
+    test "test4678" (lazy(sprintf "%-05o" System.Int32.MaxValue)) "17777777777"
+    test "test4679" (lazy(sprintf "%-01o" System.Int32.MaxValue)) "17777777777"
+    test "test4680" (lazy(sprintf "%-0*o" 7 System.Int32.MaxValue)) "17777777777"
+    test "test4681" (lazy(sprintf "%+o" System.Int32.MaxValue)) "+17777777777"
+    test "test4682" (lazy(sprintf "%+5o" System.Int32.MaxValue)) "+17777777777"
+    test "test4683" (lazy(sprintf "%+1o" System.Int32.MaxValue)) "+17777777777"
+    test "test4684" (lazy(sprintf "%+*o" 7 System.Int32.MaxValue)) "+17777777777"
+    test "test4685" (lazy(sprintf "%-+o" System.Int32.MaxValue)) "+17777777777"
+    test "test4686" (lazy(sprintf "%-+5o" System.Int32.MaxValue)) "+17777777777"
+    test "test4687" (lazy(sprintf "%-+1o" System.Int32.MaxValue)) "+17777777777"
+    test "test4688" (lazy(sprintf "%-+*o" 7 System.Int32.MaxValue)) "+17777777777"
+    test "test4689" (lazy(sprintf "%+0o" System.Int32.MaxValue)) "+17777777777"
+    test "test4690" (lazy(sprintf "%+05o" System.Int32.MaxValue)) "+17777777777"
+    test "test4691" (lazy(sprintf "%+01o" System.Int32.MaxValue)) "+17777777777"
+    test "test4692" (lazy(sprintf "%+0*o" 7 System.Int32.MaxValue)) "+17777777777"
+    test "test4693" (lazy(sprintf "%-+0o" System.Int32.MaxValue)) "+17777777777"
+    test "test4694" (lazy(sprintf "%-+05o" System.Int32.MaxValue)) "+17777777777"
+    test "test4695" (lazy(sprintf "%-+01o" System.Int32.MaxValue)) "+17777777777"
+    test "test4696" (lazy(sprintf "%-+0*o" 7 System.Int32.MaxValue)) "+17777777777"
+    test "test4697" (lazy(sprintf "% o" System.Int32.MaxValue)) " 17777777777"
+    test "test4698" (lazy(sprintf "% 5o" System.Int32.MaxValue)) " 17777777777"
+    test "test4699" (lazy(sprintf "% 1o" System.Int32.MaxValue)) " 17777777777"
+    test "test4700" (lazy(sprintf "% *o" 7 System.Int32.MaxValue)) " 17777777777"
+    test "test4701" (lazy(sprintf "%- o" System.Int32.MaxValue)) " 17777777777"
+    test "test4702" (lazy(sprintf "%- 5o" System.Int32.MaxValue)) " 17777777777"
+    test "test4703" (lazy(sprintf "%- 1o" System.Int32.MaxValue)) " 17777777777"
+    test "test4704" (lazy(sprintf "%- *o" 7 System.Int32.MaxValue)) " 17777777777"
+    test "test4705" (lazy(sprintf "% 0o" System.Int32.MaxValue)) " 17777777777"
+    test "test4706" (lazy(sprintf "% 05o" System.Int32.MaxValue)) " 17777777777"
+    test "test4707" (lazy(sprintf "% 01o" System.Int32.MaxValue)) " 17777777777"
+    test "test4708" (lazy(sprintf "% 0*o" 7 System.Int32.MaxValue)) " 17777777777"
+    test "test4709" (lazy(sprintf "%- 0o" System.Int32.MaxValue)) " 17777777777"
+    test "test4710" (lazy(sprintf "%- 05o" System.Int32.MaxValue)) " 17777777777"
+    test "test4711" (lazy(sprintf "%- 01o" System.Int32.MaxValue)) " 17777777777"
+    test "test4712" (lazy(sprintf "%- 0*o" 7 System.Int32.MaxValue)) " 17777777777"
+    test "test4713" (lazy(sprintf "%o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4714" (lazy(sprintf "%5o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4715" (lazy(sprintf "%1o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4716" (lazy(sprintf "%*o" 7 System.Int64.MaxValue)) "777777777777777777777"
+    test "test4717" (lazy(sprintf "%-o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4718" (lazy(sprintf "%-5o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4719" (lazy(sprintf "%-1o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4720" (lazy(sprintf "%-*o" 7 System.Int64.MaxValue)) "777777777777777777777"
+    test "test4721" (lazy(sprintf "%0o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4722" (lazy(sprintf "%05o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4723" (lazy(sprintf "%01o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4724" (lazy(sprintf "%0*o" 7 System.Int64.MaxValue)) "777777777777777777777"
+    test "test4725" (lazy(sprintf "%-0o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4726" (lazy(sprintf "%-05o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4727" (lazy(sprintf "%-01o" System.Int64.MaxValue)) "777777777777777777777"
+    test "test4728" (lazy(sprintf "%-0*o" 7 System.Int64.MaxValue)) "777777777777777777777"
+    test "test4729" (lazy(sprintf "%+o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4730" (lazy(sprintf "%+5o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4731" (lazy(sprintf "%+1o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4732" (lazy(sprintf "%+*o" 7 System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4733" (lazy(sprintf "%-+o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4734" (lazy(sprintf "%-+5o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4735" (lazy(sprintf "%-+1o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4736" (lazy(sprintf "%-+*o" 7 System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4737" (lazy(sprintf "%+0o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4738" (lazy(sprintf "%+05o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4739" (lazy(sprintf "%+01o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4740" (lazy(sprintf "%+0*o" 7 System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4741" (lazy(sprintf "%-+0o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4742" (lazy(sprintf "%-+05o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4743" (lazy(sprintf "%-+01o" System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4744" (lazy(sprintf "%-+0*o" 7 System.Int64.MaxValue)) "+777777777777777777777"
+    test "test4745" (lazy(sprintf "% o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4746" (lazy(sprintf "% 5o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4747" (lazy(sprintf "% 1o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4748" (lazy(sprintf "% *o" 7 System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4749" (lazy(sprintf "%- o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4750" (lazy(sprintf "%- 5o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4751" (lazy(sprintf "%- 1o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4752" (lazy(sprintf "%- *o" 7 System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4753" (lazy(sprintf "% 0o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4754" (lazy(sprintf "% 05o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4755" (lazy(sprintf "% 01o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4756" (lazy(sprintf "% 0*o" 7 System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4757" (lazy(sprintf "%- 0o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4758" (lazy(sprintf "%- 05o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4759" (lazy(sprintf "%- 01o" System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4760" (lazy(sprintf "%- 0*o" 7 System.Int64.MaxValue)) " 777777777777777777777"
+    test "test4761" (lazy(sprintf "%o" System.Int32.MinValue)) "20000000000"
+    test "test4762" (lazy(sprintf "%5o" System.Int32.MinValue)) "20000000000"
+    test "test4763" (lazy(sprintf "%1o" System.Int32.MinValue)) "20000000000"
+    test "test4764" (lazy(sprintf "%*o" 7 System.Int32.MinValue)) "20000000000"
+    test "test4765" (lazy(sprintf "%-o" System.Int32.MinValue)) "20000000000"
+    test "test4766" (lazy(sprintf "%-5o" System.Int32.MinValue)) "20000000000"
+    test "test4767" (lazy(sprintf "%-1o" System.Int32.MinValue)) "20000000000"
+    test "test4768" (lazy(sprintf "%-*o" 7 System.Int32.MinValue)) "20000000000"
+    test "test4769" (lazy(sprintf "%0o" System.Int32.MinValue)) "20000000000"
+    test "test4770" (lazy(sprintf "%05o" System.Int32.MinValue)) "20000000000"
+    test "test4771" (lazy(sprintf "%01o" System.Int32.MinValue)) "20000000000"
+    test "test4772" (lazy(sprintf "%0*o" 7 System.Int32.MinValue)) "20000000000"
+    test "test4773" (lazy(sprintf "%-0o" System.Int32.MinValue)) "20000000000"
+    test "test4774" (lazy(sprintf "%-05o" System.Int32.MinValue)) "20000000000"
+    test "test4775" (lazy(sprintf "%-01o" System.Int32.MinValue)) "20000000000"
+    test "test4776" (lazy(sprintf "%-0*o" 7 System.Int32.MinValue)) "20000000000"
+    test "test4777" (lazy(sprintf "%+o" System.Int32.MinValue)) "+20000000000"
+    test "test4778" (lazy(sprintf "%+5o" System.Int32.MinValue)) "+20000000000"
+    test "test4779" (lazy(sprintf "%+1o" System.Int32.MinValue)) "+20000000000"
+    test "test4780" (lazy(sprintf "%+*o" 7 System.Int32.MinValue)) "+20000000000"
+    test "test4781" (lazy(sprintf "%-+o" System.Int32.MinValue)) "+20000000000"
+    test "test4782" (lazy(sprintf "%-+5o" System.Int32.MinValue)) "+20000000000"
+    test "test4783" (lazy(sprintf "%-+1o" System.Int32.MinValue)) "+20000000000"
+    test "test4784" (lazy(sprintf "%-+*o" 7 System.Int32.MinValue)) "+20000000000"
+    test "test4785" (lazy(sprintf "%+0o" System.Int32.MinValue)) "+20000000000"
+    test "test4786" (lazy(sprintf "%+05o" System.Int32.MinValue)) "+20000000000"
+    test "test4787" (lazy(sprintf "%+01o" System.Int32.MinValue)) "+20000000000"
+    test "test4788" (lazy(sprintf "%+0*o" 7 System.Int32.MinValue)) "+20000000000"
+    test "test4789" (lazy(sprintf "%-+0o" System.Int32.MinValue)) "+20000000000"
+    test "test4790" (lazy(sprintf "%-+05o" System.Int32.MinValue)) "+20000000000"
+    test "test4791" (lazy(sprintf "%-+01o" System.Int32.MinValue)) "+20000000000"
+    test "test4792" (lazy(sprintf "%-+0*o" 7 System.Int32.MinValue)) "+20000000000"
+    test "test4793" (lazy(sprintf "% o" System.Int32.MinValue)) " 20000000000"
+    test "test4794" (lazy(sprintf "% 5o" System.Int32.MinValue)) " 20000000000"
+    test "test4795" (lazy(sprintf "% 1o" System.Int32.MinValue)) " 20000000000"
+    test "test4796" (lazy(sprintf "% *o" 7 System.Int32.MinValue)) " 20000000000"
+    test "test4797" (lazy(sprintf "%- o" System.Int32.MinValue)) " 20000000000"
+    test "test4798" (lazy(sprintf "%- 5o" System.Int32.MinValue)) " 20000000000"
+    test "test4799" (lazy(sprintf "%- 1o" System.Int32.MinValue)) " 20000000000"
+    test "test4800" (lazy(sprintf "%- *o" 7 System.Int32.MinValue)) " 20000000000"
+    test "test4801" (lazy(sprintf "% 0o" System.Int32.MinValue)) " 20000000000"
+    test "test4802" (lazy(sprintf "% 05o" System.Int32.MinValue)) " 20000000000"
+    test "test4803" (lazy(sprintf "% 01o" System.Int32.MinValue)) " 20000000000"
+    test "test4804" (lazy(sprintf "% 0*o" 7 System.Int32.MinValue)) " 20000000000"
+    test "test4805" (lazy(sprintf "%- 0o" System.Int32.MinValue)) " 20000000000"
+    test "test4806" (lazy(sprintf "%- 05o" System.Int32.MinValue)) " 20000000000"
+    test "test4807" (lazy(sprintf "%- 01o" System.Int32.MinValue)) " 20000000000"
+    test "test4808" (lazy(sprintf "%- 0*o" 7 System.Int32.MinValue)) " 20000000000"
+    test "test4809" (lazy(sprintf "%o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4810" (lazy(sprintf "%5o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4811" (lazy(sprintf "%1o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4812" (lazy(sprintf "%*o" 7 System.Int64.MinValue)) "1000000000000000000000"
+    test "test4813" (lazy(sprintf "%-o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4814" (lazy(sprintf "%-5o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4815" (lazy(sprintf "%-1o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4816" (lazy(sprintf "%-*o" 7 System.Int64.MinValue)) "1000000000000000000000"
+    test "test4817" (lazy(sprintf "%0o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4818" (lazy(sprintf "%05o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4819" (lazy(sprintf "%01o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4820" (lazy(sprintf "%0*o" 7 System.Int64.MinValue)) "1000000000000000000000"
+    test "test4821" (lazy(sprintf "%-0o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4822" (lazy(sprintf "%-05o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4823" (lazy(sprintf "%-01o" System.Int64.MinValue)) "1000000000000000000000"
+    test "test4824" (lazy(sprintf "%-0*o" 7 System.Int64.MinValue)) "1000000000000000000000"
+    test "test4825" (lazy(sprintf "%+o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4826" (lazy(sprintf "%+5o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4827" (lazy(sprintf "%+1o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4828" (lazy(sprintf "%+*o" 7 System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4829" (lazy(sprintf "%-+o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4830" (lazy(sprintf "%-+5o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4831" (lazy(sprintf "%-+1o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4832" (lazy(sprintf "%-+*o" 7 System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4833" (lazy(sprintf "%+0o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4834" (lazy(sprintf "%+05o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4835" (lazy(sprintf "%+01o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4836" (lazy(sprintf "%+0*o" 7 System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4837" (lazy(sprintf "%-+0o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4838" (lazy(sprintf "%-+05o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4839" (lazy(sprintf "%-+01o" System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4840" (lazy(sprintf "%-+0*o" 7 System.Int64.MinValue)) "+1000000000000000000000"
+    test "test4841" (lazy(sprintf "% o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4842" (lazy(sprintf "% 5o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4843" (lazy(sprintf "% 1o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4844" (lazy(sprintf "% *o" 7 System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4845" (lazy(sprintf "%- o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4846" (lazy(sprintf "%- 5o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4847" (lazy(sprintf "%- 1o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4848" (lazy(sprintf "%- *o" 7 System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4849" (lazy(sprintf "% 0o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4850" (lazy(sprintf "% 05o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4851" (lazy(sprintf "% 01o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4852" (lazy(sprintf "% 0*o" 7 System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4853" (lazy(sprintf "%- 0o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4854" (lazy(sprintf "%- 05o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4855" (lazy(sprintf "%- 01o" System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4856" (lazy(sprintf "%- 0*o" 7 System.Int64.MinValue)) " 1000000000000000000000"
+    test "test4857" (lazy(sprintf "%o" 55n)) "67"
+    test "test4858" (lazy(sprintf "%5o" 55n)) "   67"
+    test "test4859" (lazy(sprintf "%1o" 55n)) "67"
+    test "test4860" (lazy(sprintf "%*o" 7 55n)) "     67"
+    test "test4861" (lazy(sprintf "%-o" 55n)) "67"
+    test "test4862" (lazy(sprintf "%-5o" 55n)) "67   "
+    test "test4863" (lazy(sprintf "%-1o" 55n)) "67"
+    test "test4864" (lazy(sprintf "%-*o" 7 55n)) "67     "
+    test "test4865" (lazy(sprintf "%0o" 55n)) "67"
+    test "test4866" (lazy(sprintf "%05o" 55n)) "00067"
+    test "test4867" (lazy(sprintf "%01o" 55n)) "67"
+    test "test4868" (lazy(sprintf "%0*o" 7 55n)) "0000067"
+    test "test4869" (lazy(sprintf "%-0o" 55n)) "67"
+    test "test4870" (lazy(sprintf "%-05o" 55n)) "67   "
+    test "test4871" (lazy(sprintf "%-01o" 55n)) "67"
+    test "test4872" (lazy(sprintf "%-0*o" 7 55n)) "67     "
+    test "test4873" (lazy(sprintf "%+o" 55n)) "+67"
+    test "test4874" (lazy(sprintf "%+5o" 55n)) "  +67"
+    test "test4875" (lazy(sprintf "%+1o" 55n)) "+67"
+    test "test4876" (lazy(sprintf "%+*o" 7 55n)) "    +67"
+    test "test4877" (lazy(sprintf "%-+o" 55n)) "+67"
+    test "test4878" (lazy(sprintf "%-+5o" 55n)) "+67  "
+    test "test4879" (lazy(sprintf "%-+1o" 55n)) "+67"
+    test "test4880" (lazy(sprintf "%-+*o" 7 55n)) "+67    "
+    test "test4881" (lazy(sprintf "%+0o" 55n)) "+67"
+    test "test4882" (lazy(sprintf "%+05o" 55n)) "+0067"
+    test "test4883" (lazy(sprintf "%+01o" 55n)) "+67"
+    test "test4884" (lazy(sprintf "%+0*o" 7 55n)) "+000067"
+    test "test4885" (lazy(sprintf "%-+0o" 55n)) "+67"
+    test "test4886" (lazy(sprintf "%-+05o" 55n)) "+67  "
+    test "test4887" (lazy(sprintf "%-+01o" 55n)) "+67"
+    test "test4888" (lazy(sprintf "%-+0*o" 7 55n)) "+67    "
+    test "test4889" (lazy(sprintf "% o" 55n)) " 67"
+    test "test4890" (lazy(sprintf "% 5o" 55n)) "   67"
+    test "test4891" (lazy(sprintf "% 1o" 55n)) " 67"
+    test "test4892" (lazy(sprintf "% *o" 7 55n)) "     67"
+    test "test4893" (lazy(sprintf "%- o" 55n)) " 67"
+    test "test4894" (lazy(sprintf "%- 5o" 55n)) " 67  "
+    test "test4895" (lazy(sprintf "%- 1o" 55n)) " 67"
+    test "test4896" (lazy(sprintf "%- *o" 7 55n)) " 67    "
+    test "test4897" (lazy(sprintf "% 0o" 55n)) " 67"
+    test "test4898" (lazy(sprintf "% 05o" 55n)) " 0067"
+    test "test4899" (lazy(sprintf "% 01o" 55n)) " 67"
+    test "test4900" (lazy(sprintf "% 0*o" 7 55n)) " 000067"
+    test "test4901" (lazy(sprintf "%- 0o" 55n)) " 67"
+    test "test4902" (lazy(sprintf "%- 05o" 55n)) " 67  "
+    test "test4903" (lazy(sprintf "%- 01o" 55n)) " 67"
+    test "test4904" (lazy(sprintf "%- 0*o" 7 55n)) " 67    "
+    test "test4905" (lazy(sprintf "%o" 999un)) "1747"
+    test "test4906" (lazy(sprintf "%5o" 999un)) " 1747"
+    test "test4907" (lazy(sprintf "%1o" 999un)) "1747"
+    test "test4908" (lazy(sprintf "%*o" 7 999un)) "   1747"
+    test "test4909" (lazy(sprintf "%-o" 999un)) "1747"
+    test "test4910" (lazy(sprintf "%-5o" 999un)) "1747 "
+    test "test4911" (lazy(sprintf "%-1o" 999un)) "1747"
+    test "test4912" (lazy(sprintf "%-*o" 7 999un)) "1747   "
+    test "test4913" (lazy(sprintf "%0o" 999un)) "1747"
+    test "test4914" (lazy(sprintf "%05o" 999un)) "01747"
+    test "test4915" (lazy(sprintf "%01o" 999un)) "1747"
+    test "test4916" (lazy(sprintf "%0*o" 7 999un)) "0001747"
+    test "test4917" (lazy(sprintf "%-0o" 999un)) "1747"
+    test "test4918" (lazy(sprintf "%-05o" 999un)) "1747 "
+    test "test4919" (lazy(sprintf "%-01o" 999un)) "1747"
+    test "test4920" (lazy(sprintf "%-0*o" 7 999un)) "1747   "
+    test "test4921" (lazy(sprintf "%+o" 999un)) "+1747"
+    test "test4922" (lazy(sprintf "%+5o" 999un)) "+1747"
+    test "test4923" (lazy(sprintf "%+1o" 999un)) "+1747"
+    test "test4924" (lazy(sprintf "%+*o" 7 999un)) "  +1747"
+    test "test4925" (lazy(sprintf "%-+o" 999un)) "+1747"
+    test "test4926" (lazy(sprintf "%-+5o" 999un)) "+1747"
+    test "test4927" (lazy(sprintf "%-+1o" 999un)) "+1747"
+    test "test4928" (lazy(sprintf "%-+*o" 7 999un)) "+1747  "
+    test "test4929" (lazy(sprintf "%+0o" 999un)) "+1747"
+    test "test4930" (lazy(sprintf "%+05o" 999un)) "+1747"
+    test "test4931" (lazy(sprintf "%+01o" 999un)) "+1747"
+    test "test4932" (lazy(sprintf "%+0*o" 7 999un)) "+001747"
+    test "test4933" (lazy(sprintf "%-+0o" 999un)) "+1747"
+    test "test4934" (lazy(sprintf "%-+05o" 999un)) "+1747"
+    test "test4935" (lazy(sprintf "%-+01o" 999un)) "+1747"
+    test "test4936" (lazy(sprintf "%-+0*o" 7 999un)) "+1747  "
+    test "test4937" (lazy(sprintf "% o" 999un)) " 1747"
+    test "test4938" (lazy(sprintf "% 5o" 999un)) " 1747"
+    test "test4939" (lazy(sprintf "% 1o" 999un)) " 1747"
+    test "test4940" (lazy(sprintf "% *o" 7 999un)) "   1747"
+    test "test4941" (lazy(sprintf "%- o" 999un)) " 1747"
+    test "test4942" (lazy(sprintf "%- 5o" 999un)) " 1747"
+    test "test4943" (lazy(sprintf "%- 1o" 999un)) " 1747"
+    test "test4944" (lazy(sprintf "%- *o" 7 999un)) " 1747  "
+    test "test4945" (lazy(sprintf "% 0o" 999un)) " 1747"
+    test "test4946" (lazy(sprintf "% 05o" 999un)) " 1747"
+    test "test4947" (lazy(sprintf "% 01o" 999un)) " 1747"
+    test "test4948" (lazy(sprintf "% 0*o" 7 999un)) " 001747"
+    test "test4949" (lazy(sprintf "%- 0o" 999un)) " 1747"
+    test "test4950" (lazy(sprintf "%- 05o" 999un)) " 1747"
+    test "test4951" (lazy(sprintf "%- 01o" 999un)) " 1747"
+    test "test4952" (lazy(sprintf "%- 0*o" 7 999un)) " 1747  "
+    test "test4953" (lazy(sprintf "%e" 5.0)) "5.000000e+000"
+    test "test4954" (lazy(sprintf "%5e" 5.0)) "5.000000e+000"
+    test "test4955" (lazy(sprintf "%1e" 5.0)) "5.000000e+000"
+    test "test4956" (lazy(sprintf "%*e" 7 5.0)) "5.000000e+000"
+    test "test4957" (lazy(sprintf "%.5e" 5.0)) "5.00000e+000"
+    test "test4958" (lazy(sprintf "%.*e" 4 5.0)) "5.0000e+000"
+    test "test4959" (lazy(sprintf "%*.*e" 5 4 5.0)) "5.0000e+000"
+    test "test4960" (lazy(sprintf "%-e" 5.0)) "5.000000e+000"
+    test "test4961" (lazy(sprintf "%-5e" 5.0)) "5.000000e+000"
+    test "test4962" (lazy(sprintf "%-1e" 5.0)) "5.000000e+000"
+    test "test4963" (lazy(sprintf "%-*e" 7 5.0)) "5.000000e+000"
+    test "test4964" (lazy(sprintf "%-.5e" 5.0)) "5.00000e+000"
+    test "test4965" (lazy(sprintf "%-.*e" 4 5.0)) "5.0000e+000"
+    test "test4966" (lazy(sprintf "%-*.*e" 5 4 5.0)) "5.0000e+000"
+    test "test4967" (lazy(sprintf "%0e" 5.0)) "5.000000e+000"
+    test "test4968" (lazy(sprintf "%05e" 5.0)) "5.000000e+000"
+    test "test4969" (lazy(sprintf "%01e" 5.0)) "5.000000e+000"
+    test "test4970" (lazy(sprintf "%0*e" 7 5.0)) "5.000000e+000"
+    test "test4971" (lazy(sprintf "%0.5e" 5.0)) "5.00000e+000"
+    test "test4972" (lazy(sprintf "%0.*e" 4 5.0)) "5.0000e+000"
+    test "test4973" (lazy(sprintf "%0*.*e" 5 4 5.0)) "5.0000e+000"
+    test "test4974" (lazy(sprintf "%-0e" 5.0)) "5.000000e+000"
+    test "test4975" (lazy(sprintf "%-05e" 5.0)) "5.000000e+000"
+    test "test4976" (lazy(sprintf "%-01e" 5.0)) "5.000000e+000"
+    test "test4977" (lazy(sprintf "%-0*e" 7 5.0)) "5.000000e+000"
+    test "test4978" (lazy(sprintf "%-0.5e" 5.0)) "5.00000e+000"
+    test "test4979" (lazy(sprintf "%-0.*e" 4 5.0)) "5.0000e+000"
+    test "test4980" (lazy(sprintf "%-0*.*e" 5 4 5.0)) "5.0000e+000"
+    test "test4981" (lazy(sprintf "%+e" 5.0)) "+5.000000e+000"
+    test "test4982" (lazy(sprintf "%+5e" 5.0)) "+5.000000e+000"
+    test "test4983" (lazy(sprintf "%+1e" 5.0)) "+5.000000e+000"
+    test "test4984" (lazy(sprintf "%+*e" 7 5.0)) "+5.000000e+000"
+    test "test4985" (lazy(sprintf "%+.5e" 5.0)) "+5.00000e+000"
+    test "test4986" (lazy(sprintf "%+.*e" 4 5.0)) "+5.0000e+000"
+    test "test4987" (lazy(sprintf "%+*.*e" 5 4 5.0)) "+5.0000e+000"
+    test "test4988" (lazy(sprintf "%-+e" 5.0)) "+5.000000e+000"
+    test "test4989" (lazy(sprintf "%-+5e" 5.0)) "+5.000000e+000"
+    test "test4990" (lazy(sprintf "%-+1e" 5.0)) "+5.000000e+000"
+    test "test4991" (lazy(sprintf "%-+*e" 7 5.0)) "+5.000000e+000"
+    test "test4992" (lazy(sprintf "%-+.5e" 5.0)) "+5.00000e+000"
+    test "test4993" (lazy(sprintf "%-+.*e" 4 5.0)) "+5.0000e+000"
+    test "test4994" (lazy(sprintf "%-+*.*e" 5 4 5.0)) "+5.0000e+000"
+    test "test4995" (lazy(sprintf "%+0e" 5.0)) "+5.000000e+000"
+    test "test4996" (lazy(sprintf "%+05e" 5.0)) "+5.000000e+000"
+    test "test4997" (lazy(sprintf "%+01e" 5.0)) "+5.000000e+000"
+    test "test4998" (lazy(sprintf "%+0*e" 7 5.0)) "+5.000000e+000"
+    test "test4999" (lazy(sprintf "%+0.5e" 5.0)) "+5.00000e+000"
+    test "test5000" (lazy(sprintf "%+0.*e" 4 5.0)) "+5.0000e+000"
+let func5000()=
+    test "test5001" (lazy(sprintf "%+0*.*e" 5 4 5.0)) "+5.0000e+000"
+    test "test5002" (lazy(sprintf "%-+0e" 5.0)) "+5.000000e+000"
+    test "test5003" (lazy(sprintf "%-+05e" 5.0)) "+5.000000e+000"
+    test "test5004" (lazy(sprintf "%-+01e" 5.0)) "+5.000000e+000"
+    test "test5005" (lazy(sprintf "%-+0*e" 7 5.0)) "+5.000000e+000"
+    test "test5006" (lazy(sprintf "%-+0.5e" 5.0)) "+5.00000e+000"
+    test "test5007" (lazy(sprintf "%-+0.*e" 4 5.0)) "+5.0000e+000"
+    test "test5008" (lazy(sprintf "%-+0*.*e" 5 4 5.0)) "+5.0000e+000"
+    test "test5009" (lazy(sprintf "% e" 5.0)) " 5.000000e+000"
+    test "test5010" (lazy(sprintf "% 5e" 5.0)) " 5.000000e+000"
+    test "test5011" (lazy(sprintf "% 1e" 5.0)) " 5.000000e+000"
+    test "test5012" (lazy(sprintf "% *e" 7 5.0)) " 5.000000e+000"
+    test "test5013" (lazy(sprintf "% .5e" 5.0)) " 5.00000e+000"
+    test "test5014" (lazy(sprintf "% .*e" 4 5.0)) " 5.0000e+000"
+    test "test5015" (lazy(sprintf "% *.*e" 5 4 5.0)) " 5.0000e+000"
+    test "test5016" (lazy(sprintf "%- e" 5.0)) " 5.000000e+000"
+    test "test5017" (lazy(sprintf "%- 5e" 5.0)) " 5.000000e+000"
+    test "test5018" (lazy(sprintf "%- 1e" 5.0)) " 5.000000e+000"
+    test "test5019" (lazy(sprintf "%- *e" 7 5.0)) " 5.000000e+000"
+    test "test5020" (lazy(sprintf "%- .5e" 5.0)) " 5.00000e+000"
+    test "test5021" (lazy(sprintf "%- .*e" 4 5.0)) " 5.0000e+000"
+    test "test5022" (lazy(sprintf "%- *.*e" 5 4 5.0)) " 5.0000e+000"
+    test "test5023" (lazy(sprintf "% 0e" 5.0)) " 5.000000e+000"
+    test "test5024" (lazy(sprintf "% 05e" 5.0)) " 5.000000e+000"
+    test "test5025" (lazy(sprintf "% 01e" 5.0)) " 5.000000e+000"
+    test "test5026" (lazy(sprintf "% 0*e" 7 5.0)) " 5.000000e+000"
+    test "test5027" (lazy(sprintf "% 0.5e" 5.0)) " 5.00000e+000"
+    test "test5028" (lazy(sprintf "% 0.*e" 4 5.0)) " 5.0000e+000"
+    test "test5029" (lazy(sprintf "% 0*.*e" 5 4 5.0)) " 5.0000e+000"
+    test "test5030" (lazy(sprintf "%- 0e" 5.0)) " 5.000000e+000"
+    test "test5031" (lazy(sprintf "%- 05e" 5.0)) " 5.000000e+000"
+    test "test5032" (lazy(sprintf "%- 01e" 5.0)) " 5.000000e+000"
+    test "test5033" (lazy(sprintf "%- 0*e" 7 5.0)) " 5.000000e+000"
+    test "test5034" (lazy(sprintf "%- 0.5e" 5.0)) " 5.00000e+000"
+    test "test5035" (lazy(sprintf "%- 0.*e" 4 5.0)) " 5.0000e+000"
+    test "test5036" (lazy(sprintf "%- 0*.*e" 5 4 5.0)) " 5.0000e+000"
+    test "test5037" (lazy(sprintf "%e" -10.0)) "-1.000000e+001"
+    test "test5038" (lazy(sprintf "%5e" -10.0)) "-1.000000e+001"
+    test "test5039" (lazy(sprintf "%1e" -10.0)) "-1.000000e+001"
+    test "test5040" (lazy(sprintf "%*e" 7 -10.0)) "-1.000000e+001"
+    test "test5041" (lazy(sprintf "%.5e" -10.0)) "-1.00000e+001"
+    test "test5042" (lazy(sprintf "%.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5043" (lazy(sprintf "%*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5044" (lazy(sprintf "%-e" -10.0)) "-1.000000e+001"
+    test "test5045" (lazy(sprintf "%-5e" -10.0)) "-1.000000e+001"
+    test "test5046" (lazy(sprintf "%-1e" -10.0)) "-1.000000e+001"
+    test "test5047" (lazy(sprintf "%-*e" 7 -10.0)) "-1.000000e+001"
+    test "test5048" (lazy(sprintf "%-.5e" -10.0)) "-1.00000e+001"
+    test "test5049" (lazy(sprintf "%-.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5050" (lazy(sprintf "%-*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5051" (lazy(sprintf "%0e" -10.0)) "-1.000000e+001"
+    test "test5052" (lazy(sprintf "%05e" -10.0)) "-1.000000e+001"
+    test "test5053" (lazy(sprintf "%01e" -10.0)) "-1.000000e+001"
+    test "test5054" (lazy(sprintf "%0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5055" (lazy(sprintf "%0.5e" -10.0)) "-1.00000e+001"
+    test "test5056" (lazy(sprintf "%0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5057" (lazy(sprintf "%0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5058" (lazy(sprintf "%-0e" -10.0)) "-1.000000e+001"
+    test "test5059" (lazy(sprintf "%-05e" -10.0)) "-1.000000e+001"
+    test "test5060" (lazy(sprintf "%-01e" -10.0)) "-1.000000e+001"
+    test "test5061" (lazy(sprintf "%-0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5062" (lazy(sprintf "%-0.5e" -10.0)) "-1.00000e+001"
+    test "test5063" (lazy(sprintf "%-0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5064" (lazy(sprintf "%-0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5065" (lazy(sprintf "%+e" -10.0)) "-1.000000e+001"
+    test "test5066" (lazy(sprintf "%+5e" -10.0)) "-1.000000e+001"
+    test "test5067" (lazy(sprintf "%+1e" -10.0)) "-1.000000e+001"
+    test "test5068" (lazy(sprintf "%+*e" 7 -10.0)) "-1.000000e+001"
+    test "test5069" (lazy(sprintf "%+.5e" -10.0)) "-1.00000e+001"
+    test "test5070" (lazy(sprintf "%+.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5071" (lazy(sprintf "%+*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5072" (lazy(sprintf "%-+e" -10.0)) "-1.000000e+001"
+    test "test5073" (lazy(sprintf "%-+5e" -10.0)) "-1.000000e+001"
+    test "test5074" (lazy(sprintf "%-+1e" -10.0)) "-1.000000e+001"
+    test "test5075" (lazy(sprintf "%-+*e" 7 -10.0)) "-1.000000e+001"
+    test "test5076" (lazy(sprintf "%-+.5e" -10.0)) "-1.00000e+001"
+    test "test5077" (lazy(sprintf "%-+.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5078" (lazy(sprintf "%-+*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5079" (lazy(sprintf "%+0e" -10.0)) "-1.000000e+001"
+    test "test5080" (lazy(sprintf "%+05e" -10.0)) "-1.000000e+001"
+    test "test5081" (lazy(sprintf "%+01e" -10.0)) "-1.000000e+001"
+    test "test5082" (lazy(sprintf "%+0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5083" (lazy(sprintf "%+0.5e" -10.0)) "-1.00000e+001"
+    test "test5084" (lazy(sprintf "%+0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5085" (lazy(sprintf "%+0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5086" (lazy(sprintf "%-+0e" -10.0)) "-1.000000e+001"
+    test "test5087" (lazy(sprintf "%-+05e" -10.0)) "-1.000000e+001"
+    test "test5088" (lazy(sprintf "%-+01e" -10.0)) "-1.000000e+001"
+    test "test5089" (lazy(sprintf "%-+0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5090" (lazy(sprintf "%-+0.5e" -10.0)) "-1.00000e+001"
+    test "test5091" (lazy(sprintf "%-+0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5092" (lazy(sprintf "%-+0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5093" (lazy(sprintf "% e" -10.0)) "-1.000000e+001"
+    test "test5094" (lazy(sprintf "% 5e" -10.0)) "-1.000000e+001"
+    test "test5095" (lazy(sprintf "% 1e" -10.0)) "-1.000000e+001"
+    test "test5096" (lazy(sprintf "% *e" 7 -10.0)) "-1.000000e+001"
+    test "test5097" (lazy(sprintf "% .5e" -10.0)) "-1.00000e+001"
+    test "test5098" (lazy(sprintf "% .*e" 4 -10.0)) "-1.0000e+001"
+    test "test5099" (lazy(sprintf "% *.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5100" (lazy(sprintf "%- e" -10.0)) "-1.000000e+001"
+    test "test5101" (lazy(sprintf "%- 5e" -10.0)) "-1.000000e+001"
+    test "test5102" (lazy(sprintf "%- 1e" -10.0)) "-1.000000e+001"
+    test "test5103" (lazy(sprintf "%- *e" 7 -10.0)) "-1.000000e+001"
+    test "test5104" (lazy(sprintf "%- .5e" -10.0)) "-1.00000e+001"
+    test "test5105" (lazy(sprintf "%- .*e" 4 -10.0)) "-1.0000e+001"
+    test "test5106" (lazy(sprintf "%- *.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5107" (lazy(sprintf "% 0e" -10.0)) "-1.000000e+001"
+    test "test5108" (lazy(sprintf "% 05e" -10.0)) "-1.000000e+001"
+    test "test5109" (lazy(sprintf "% 01e" -10.0)) "-1.000000e+001"
+    test "test5110" (lazy(sprintf "% 0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5111" (lazy(sprintf "% 0.5e" -10.0)) "-1.00000e+001"
+    test "test5112" (lazy(sprintf "% 0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5113" (lazy(sprintf "% 0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5114" (lazy(sprintf "%- 0e" -10.0)) "-1.000000e+001"
+    test "test5115" (lazy(sprintf "%- 05e" -10.0)) "-1.000000e+001"
+    test "test5116" (lazy(sprintf "%- 01e" -10.0)) "-1.000000e+001"
+    test "test5117" (lazy(sprintf "%- 0*e" 7 -10.0)) "-1.000000e+001"
+    test "test5118" (lazy(sprintf "%- 0.5e" -10.0)) "-1.00000e+001"
+    test "test5119" (lazy(sprintf "%- 0.*e" 4 -10.0)) "-1.0000e+001"
+    test "test5120" (lazy(sprintf "%- 0*.*e" 5 4 -10.0)) "-1.0000e+001"
+    test "test5121" (lazy(sprintf "%e" 5.0f)) "5.000000e+000"
+    test "test5122" (lazy(sprintf "%5e" 5.0f)) "5.000000e+000"
+    test "test5123" (lazy(sprintf "%1e" 5.0f)) "5.000000e+000"
+    test "test5124" (lazy(sprintf "%*e" 7 5.0f)) "5.000000e+000"
+    test "test5125" (lazy(sprintf "%.5e" 5.0f)) "5.00000e+000"
+    test "test5126" (lazy(sprintf "%.*e" 4 5.0f)) "5.0000e+000"
+    test "test5127" (lazy(sprintf "%*.*e" 5 4 5.0f)) "5.0000e+000"
+    test "test5128" (lazy(sprintf "%-e" 5.0f)) "5.000000e+000"
+    test "test5129" (lazy(sprintf "%-5e" 5.0f)) "5.000000e+000"
+    test "test5130" (lazy(sprintf "%-1e" 5.0f)) "5.000000e+000"
+    test "test5131" (lazy(sprintf "%-*e" 7 5.0f)) "5.000000e+000"
+    test "test5132" (lazy(sprintf "%-.5e" 5.0f)) "5.00000e+000"
+    test "test5133" (lazy(sprintf "%-.*e" 4 5.0f)) "5.0000e+000"
+    test "test5134" (lazy(sprintf "%-*.*e" 5 4 5.0f)) "5.0000e+000"
+    test "test5135" (lazy(sprintf "%0e" 5.0f)) "5.000000e+000"
+    test "test5136" (lazy(sprintf "%05e" 5.0f)) "5.000000e+000"
+    test "test5137" (lazy(sprintf "%01e" 5.0f)) "5.000000e+000"
+    test "test5138" (lazy(sprintf "%0*e" 7 5.0f)) "5.000000e+000"
+    test "test5139" (lazy(sprintf "%0.5e" 5.0f)) "5.00000e+000"
+    test "test5140" (lazy(sprintf "%0.*e" 4 5.0f)) "5.0000e+000"
+    test "test5141" (lazy(sprintf "%0*.*e" 5 4 5.0f)) "5.0000e+000"
+    test "test5142" (lazy(sprintf "%-0e" 5.0f)) "5.000000e+000"
+    test "test5143" (lazy(sprintf "%-05e" 5.0f)) "5.000000e+000"
+    test "test5144" (lazy(sprintf "%-01e" 5.0f)) "5.000000e+000"
+    test "test5145" (lazy(sprintf "%-0*e" 7 5.0f)) "5.000000e+000"
+    test "test5146" (lazy(sprintf "%-0.5e" 5.0f)) "5.00000e+000"
+    test "test5147" (lazy(sprintf "%-0.*e" 4 5.0f)) "5.0000e+000"
+    test "test5148" (lazy(sprintf "%-0*.*e" 5 4 5.0f)) "5.0000e+000"
+    test "test5149" (lazy(sprintf "%+e" 5.0f)) "+5.000000e+000"
+    test "test5150" (lazy(sprintf "%+5e" 5.0f)) "+5.000000e+000"
+    test "test5151" (lazy(sprintf "%+1e" 5.0f)) "+5.000000e+000"
+    test "test5152" (lazy(sprintf "%+*e" 7 5.0f)) "+5.000000e+000"
+    test "test5153" (lazy(sprintf "%+.5e" 5.0f)) "+5.00000e+000"
+    test "test5154" (lazy(sprintf "%+.*e" 4 5.0f)) "+5.0000e+000"
+    test "test5155" (lazy(sprintf "%+*.*e" 5 4 5.0f)) "+5.0000e+000"
+    test "test5156" (lazy(sprintf "%-+e" 5.0f)) "+5.000000e+000"
+    test "test5157" (lazy(sprintf "%-+5e" 5.0f)) "+5.000000e+000"
+    test "test5158" (lazy(sprintf "%-+1e" 5.0f)) "+5.000000e+000"
+    test "test5159" (lazy(sprintf "%-+*e" 7 5.0f)) "+5.000000e+000"
+    test "test5160" (lazy(sprintf "%-+.5e" 5.0f)) "+5.00000e+000"
+    test "test5161" (lazy(sprintf "%-+.*e" 4 5.0f)) "+5.0000e+000"
+    test "test5162" (lazy(sprintf "%-+*.*e" 5 4 5.0f)) "+5.0000e+000"
+    test "test5163" (lazy(sprintf "%+0e" 5.0f)) "+5.000000e+000"
+    test "test5164" (lazy(sprintf "%+05e" 5.0f)) "+5.000000e+000"
+    test "test5165" (lazy(sprintf "%+01e" 5.0f)) "+5.000000e+000"
+    test "test5166" (lazy(sprintf "%+0*e" 7 5.0f)) "+5.000000e+000"
+    test "test5167" (lazy(sprintf "%+0.5e" 5.0f)) "+5.00000e+000"
+    test "test5168" (lazy(sprintf "%+0.*e" 4 5.0f)) "+5.0000e+000"
+    test "test5169" (lazy(sprintf "%+0*.*e" 5 4 5.0f)) "+5.0000e+000"
+    test "test5170" (lazy(sprintf "%-+0e" 5.0f)) "+5.000000e+000"
+    test "test5171" (lazy(sprintf "%-+05e" 5.0f)) "+5.000000e+000"
+    test "test5172" (lazy(sprintf "%-+01e" 5.0f)) "+5.000000e+000"
+    test "test5173" (lazy(sprintf "%-+0*e" 7 5.0f)) "+5.000000e+000"
+    test "test5174" (lazy(sprintf "%-+0.5e" 5.0f)) "+5.00000e+000"
+    test "test5175" (lazy(sprintf "%-+0.*e" 4 5.0f)) "+5.0000e+000"
+    test "test5176" (lazy(sprintf "%-+0*.*e" 5 4 5.0f)) "+5.0000e+000"
+    test "test5177" (lazy(sprintf "% e" 5.0f)) " 5.000000e+000"
+    test "test5178" (lazy(sprintf "% 5e" 5.0f)) " 5.000000e+000"
+    test "test5179" (lazy(sprintf "% 1e" 5.0f)) " 5.000000e+000"
+    test "test5180" (lazy(sprintf "% *e" 7 5.0f)) " 5.000000e+000"
+    test "test5181" (lazy(sprintf "% .5e" 5.0f)) " 5.00000e+000"
+    test "test5182" (lazy(sprintf "% .*e" 4 5.0f)) " 5.0000e+000"
+    test "test5183" (lazy(sprintf "% *.*e" 5 4 5.0f)) " 5.0000e+000"
+    test "test5184" (lazy(sprintf "%- e" 5.0f)) " 5.000000e+000"
+    test "test5185" (lazy(sprintf "%- 5e" 5.0f)) " 5.000000e+000"
+    test "test5186" (lazy(sprintf "%- 1e" 5.0f)) " 5.000000e+000"
+    test "test5187" (lazy(sprintf "%- *e" 7 5.0f)) " 5.000000e+000"
+    test "test5188" (lazy(sprintf "%- .5e" 5.0f)) " 5.00000e+000"
+    test "test5189" (lazy(sprintf "%- .*e" 4 5.0f)) " 5.0000e+000"
+    test "test5190" (lazy(sprintf "%- *.*e" 5 4 5.0f)) " 5.0000e+000"
+    test "test5191" (lazy(sprintf "% 0e" 5.0f)) " 5.000000e+000"
+    test "test5192" (lazy(sprintf "% 05e" 5.0f)) " 5.000000e+000"
+    test "test5193" (lazy(sprintf "% 01e" 5.0f)) " 5.000000e+000"
+    test "test5194" (lazy(sprintf "% 0*e" 7 5.0f)) " 5.000000e+000"
+    test "test5195" (lazy(sprintf "% 0.5e" 5.0f)) " 5.00000e+000"
+    test "test5196" (lazy(sprintf "% 0.*e" 4 5.0f)) " 5.0000e+000"
+    test "test5197" (lazy(sprintf "% 0*.*e" 5 4 5.0f)) " 5.0000e+000"
+    test "test5198" (lazy(sprintf "%- 0e" 5.0f)) " 5.000000e+000"
+    test "test5199" (lazy(sprintf "%- 05e" 5.0f)) " 5.000000e+000"
+    test "test5200" (lazy(sprintf "%- 01e" 5.0f)) " 5.000000e+000"
+    test "test5201" (lazy(sprintf "%- 0*e" 7 5.0f)) " 5.000000e+000"
+    test "test5202" (lazy(sprintf "%- 0.5e" 5.0f)) " 5.00000e+000"
+    test "test5203" (lazy(sprintf "%- 0.*e" 4 5.0f)) " 5.0000e+000"
+    test "test5204" (lazy(sprintf "%- 0*.*e" 5 4 5.0f)) " 5.0000e+000"
+    test "test5205" (lazy(sprintf "%e" -10.0f)) "-1.000000e+001"
+    test "test5206" (lazy(sprintf "%5e" -10.0f)) "-1.000000e+001"
+    test "test5207" (lazy(sprintf "%1e" -10.0f)) "-1.000000e+001"
+    test "test5208" (lazy(sprintf "%*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5209" (lazy(sprintf "%.5e" -10.0f)) "-1.00000e+001"
+    test "test5210" (lazy(sprintf "%.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5211" (lazy(sprintf "%*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5212" (lazy(sprintf "%-e" -10.0f)) "-1.000000e+001"
+    test "test5213" (lazy(sprintf "%-5e" -10.0f)) "-1.000000e+001"
+    test "test5214" (lazy(sprintf "%-1e" -10.0f)) "-1.000000e+001"
+    test "test5215" (lazy(sprintf "%-*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5216" (lazy(sprintf "%-.5e" -10.0f)) "-1.00000e+001"
+    test "test5217" (lazy(sprintf "%-.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5218" (lazy(sprintf "%-*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5219" (lazy(sprintf "%0e" -10.0f)) "-1.000000e+001"
+    test "test5220" (lazy(sprintf "%05e" -10.0f)) "-1.000000e+001"
+    test "test5221" (lazy(sprintf "%01e" -10.0f)) "-1.000000e+001"
+    test "test5222" (lazy(sprintf "%0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5223" (lazy(sprintf "%0.5e" -10.0f)) "-1.00000e+001"
+    test "test5224" (lazy(sprintf "%0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5225" (lazy(sprintf "%0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5226" (lazy(sprintf "%-0e" -10.0f)) "-1.000000e+001"
+    test "test5227" (lazy(sprintf "%-05e" -10.0f)) "-1.000000e+001"
+    test "test5228" (lazy(sprintf "%-01e" -10.0f)) "-1.000000e+001"
+    test "test5229" (lazy(sprintf "%-0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5230" (lazy(sprintf "%-0.5e" -10.0f)) "-1.00000e+001"
+    test "test5231" (lazy(sprintf "%-0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5232" (lazy(sprintf "%-0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5233" (lazy(sprintf "%+e" -10.0f)) "-1.000000e+001"
+    test "test5234" (lazy(sprintf "%+5e" -10.0f)) "-1.000000e+001"
+    test "test5235" (lazy(sprintf "%+1e" -10.0f)) "-1.000000e+001"
+    test "test5236" (lazy(sprintf "%+*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5237" (lazy(sprintf "%+.5e" -10.0f)) "-1.00000e+001"
+    test "test5238" (lazy(sprintf "%+.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5239" (lazy(sprintf "%+*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5240" (lazy(sprintf "%-+e" -10.0f)) "-1.000000e+001"
+    test "test5241" (lazy(sprintf "%-+5e" -10.0f)) "-1.000000e+001"
+    test "test5242" (lazy(sprintf "%-+1e" -10.0f)) "-1.000000e+001"
+    test "test5243" (lazy(sprintf "%-+*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5244" (lazy(sprintf "%-+.5e" -10.0f)) "-1.00000e+001"
+    test "test5245" (lazy(sprintf "%-+.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5246" (lazy(sprintf "%-+*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5247" (lazy(sprintf "%+0e" -10.0f)) "-1.000000e+001"
+    test "test5248" (lazy(sprintf "%+05e" -10.0f)) "-1.000000e+001"
+    test "test5249" (lazy(sprintf "%+01e" -10.0f)) "-1.000000e+001"
+    test "test5250" (lazy(sprintf "%+0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5251" (lazy(sprintf "%+0.5e" -10.0f)) "-1.00000e+001"
+    test "test5252" (lazy(sprintf "%+0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5253" (lazy(sprintf "%+0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5254" (lazy(sprintf "%-+0e" -10.0f)) "-1.000000e+001"
+    test "test5255" (lazy(sprintf "%-+05e" -10.0f)) "-1.000000e+001"
+    test "test5256" (lazy(sprintf "%-+01e" -10.0f)) "-1.000000e+001"
+    test "test5257" (lazy(sprintf "%-+0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5258" (lazy(sprintf "%-+0.5e" -10.0f)) "-1.00000e+001"
+    test "test5259" (lazy(sprintf "%-+0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5260" (lazy(sprintf "%-+0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5261" (lazy(sprintf "% e" -10.0f)) "-1.000000e+001"
+    test "test5262" (lazy(sprintf "% 5e" -10.0f)) "-1.000000e+001"
+    test "test5263" (lazy(sprintf "% 1e" -10.0f)) "-1.000000e+001"
+    test "test5264" (lazy(sprintf "% *e" 7 -10.0f)) "-1.000000e+001"
+    test "test5265" (lazy(sprintf "% .5e" -10.0f)) "-1.00000e+001"
+    test "test5266" (lazy(sprintf "% .*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5267" (lazy(sprintf "% *.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5268" (lazy(sprintf "%- e" -10.0f)) "-1.000000e+001"
+    test "test5269" (lazy(sprintf "%- 5e" -10.0f)) "-1.000000e+001"
+    test "test5270" (lazy(sprintf "%- 1e" -10.0f)) "-1.000000e+001"
+    test "test5271" (lazy(sprintf "%- *e" 7 -10.0f)) "-1.000000e+001"
+    test "test5272" (lazy(sprintf "%- .5e" -10.0f)) "-1.00000e+001"
+    test "test5273" (lazy(sprintf "%- .*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5274" (lazy(sprintf "%- *.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5275" (lazy(sprintf "% 0e" -10.0f)) "-1.000000e+001"
+    test "test5276" (lazy(sprintf "% 05e" -10.0f)) "-1.000000e+001"
+    test "test5277" (lazy(sprintf "% 01e" -10.0f)) "-1.000000e+001"
+    test "test5278" (lazy(sprintf "% 0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5279" (lazy(sprintf "% 0.5e" -10.0f)) "-1.00000e+001"
+    test "test5280" (lazy(sprintf "% 0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5281" (lazy(sprintf "% 0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5282" (lazy(sprintf "%- 0e" -10.0f)) "-1.000000e+001"
+    test "test5283" (lazy(sprintf "%- 05e" -10.0f)) "-1.000000e+001"
+    test "test5284" (lazy(sprintf "%- 01e" -10.0f)) "-1.000000e+001"
+    test "test5285" (lazy(sprintf "%- 0*e" 7 -10.0f)) "-1.000000e+001"
+    test "test5286" (lazy(sprintf "%- 0.5e" -10.0f)) "-1.00000e+001"
+    test "test5287" (lazy(sprintf "%- 0.*e" 4 -10.0f)) "-1.0000e+001"
+    test "test5288" (lazy(sprintf "%- 0*.*e" 5 4 -10.0f)) "-1.0000e+001"
+    test "test5289" (lazy(sprintf "%e" 5.0M)) "5.000000e+000"
+    test "test5290" (lazy(sprintf "%5e" 5.0M)) "5.000000e+000"
+    test "test5291" (lazy(sprintf "%1e" 5.0M)) "5.000000e+000"
+    test "test5292" (lazy(sprintf "%*e" 7 5.0M)) "5.000000e+000"
+    test "test5293" (lazy(sprintf "%.5e" 5.0M)) "5.00000e+000"
+    test "test5294" (lazy(sprintf "%.*e" 4 5.0M)) "5.0000e+000"
+    test "test5295" (lazy(sprintf "%*.*e" 5 4 5.0M)) "5.0000e+000"
+    test "test5296" (lazy(sprintf "%-e" 5.0M)) "5.000000e+000"
+    test "test5297" (lazy(sprintf "%-5e" 5.0M)) "5.000000e+000"
+    test "test5298" (lazy(sprintf "%-1e" 5.0M)) "5.000000e+000"
+    test "test5299" (lazy(sprintf "%-*e" 7 5.0M)) "5.000000e+000"
+    test "test5300" (lazy(sprintf "%-.5e" 5.0M)) "5.00000e+000"
+    test "test5301" (lazy(sprintf "%-.*e" 4 5.0M)) "5.0000e+000"
+    test "test5302" (lazy(sprintf "%-*.*e" 5 4 5.0M)) "5.0000e+000"
+    test "test5303" (lazy(sprintf "%0e" 5.0M)) "5.000000e+000"
+    test "test5304" (lazy(sprintf "%05e" 5.0M)) "5.000000e+000"
+    test "test5305" (lazy(sprintf "%01e" 5.0M)) "5.000000e+000"
+    test "test5306" (lazy(sprintf "%0*e" 7 5.0M)) "5.000000e+000"
+    test "test5307" (lazy(sprintf "%0.5e" 5.0M)) "5.00000e+000"
+    test "test5308" (lazy(sprintf "%0.*e" 4 5.0M)) "5.0000e+000"
+    test "test5309" (lazy(sprintf "%0*.*e" 5 4 5.0M)) "5.0000e+000"
+    test "test5310" (lazy(sprintf "%-0e" 5.0M)) "5.000000e+000"
+    test "test5311" (lazy(sprintf "%-05e" 5.0M)) "5.000000e+000"
+    test "test5312" (lazy(sprintf "%-01e" 5.0M)) "5.000000e+000"
+    test "test5313" (lazy(sprintf "%-0*e" 7 5.0M)) "5.000000e+000"
+    test "test5314" (lazy(sprintf "%-0.5e" 5.0M)) "5.00000e+000"
+    test "test5315" (lazy(sprintf "%-0.*e" 4 5.0M)) "5.0000e+000"
+    test "test5316" (lazy(sprintf "%-0*.*e" 5 4 5.0M)) "5.0000e+000"
+    test "test5317" (lazy(sprintf "%+e" 5.0M)) "+5.000000e+000"
+    test "test5318" (lazy(sprintf "%+5e" 5.0M)) "+5.000000e+000"
+    test "test5319" (lazy(sprintf "%+1e" 5.0M)) "+5.000000e+000"
+    test "test5320" (lazy(sprintf "%+*e" 7 5.0M)) "+5.000000e+000"
+    test "test5321" (lazy(sprintf "%+.5e" 5.0M)) "+5.00000e+000"
+    test "test5322" (lazy(sprintf "%+.*e" 4 5.0M)) "+5.0000e+000"
+    test "test5323" (lazy(sprintf "%+*.*e" 5 4 5.0M)) "+5.0000e+000"
+    test "test5324" (lazy(sprintf "%-+e" 5.0M)) "+5.000000e+000"
+    test "test5325" (lazy(sprintf "%-+5e" 5.0M)) "+5.000000e+000"
+    test "test5326" (lazy(sprintf "%-+1e" 5.0M)) "+5.000000e+000"
+    test "test5327" (lazy(sprintf "%-+*e" 7 5.0M)) "+5.000000e+000"
+    test "test5328" (lazy(sprintf "%-+.5e" 5.0M)) "+5.00000e+000"
+    test "test5329" (lazy(sprintf "%-+.*e" 4 5.0M)) "+5.0000e+000"
+    test "test5330" (lazy(sprintf "%-+*.*e" 5 4 5.0M)) "+5.0000e+000"
+    test "test5331" (lazy(sprintf "%+0e" 5.0M)) "+5.000000e+000"
+    test "test5332" (lazy(sprintf "%+05e" 5.0M)) "+5.000000e+000"
+    test "test5333" (lazy(sprintf "%+01e" 5.0M)) "+5.000000e+000"
+    test "test5334" (lazy(sprintf "%+0*e" 7 5.0M)) "+5.000000e+000"
+    test "test5335" (lazy(sprintf "%+0.5e" 5.0M)) "+5.00000e+000"
+    test "test5336" (lazy(sprintf "%+0.*e" 4 5.0M)) "+5.0000e+000"
+    test "test5337" (lazy(sprintf "%+0*.*e" 5 4 5.0M)) "+5.0000e+000"
+    test "test5338" (lazy(sprintf "%-+0e" 5.0M)) "+5.000000e+000"
+    test "test5339" (lazy(sprintf "%-+05e" 5.0M)) "+5.000000e+000"
+    test "test5340" (lazy(sprintf "%-+01e" 5.0M)) "+5.000000e+000"
+    test "test5341" (lazy(sprintf "%-+0*e" 7 5.0M)) "+5.000000e+000"
+    test "test5342" (lazy(sprintf "%-+0.5e" 5.0M)) "+5.00000e+000"
+    test "test5343" (lazy(sprintf "%-+0.*e" 4 5.0M)) "+5.0000e+000"
+    test "test5344" (lazy(sprintf "%-+0*.*e" 5 4 5.0M)) "+5.0000e+000"
+    test "test5345" (lazy(sprintf "% e" 5.0M)) " 5.000000e+000"
+    test "test5346" (lazy(sprintf "% 5e" 5.0M)) " 5.000000e+000"
+    test "test5347" (lazy(sprintf "% 1e" 5.0M)) " 5.000000e+000"
+    test "test5348" (lazy(sprintf "% *e" 7 5.0M)) " 5.000000e+000"
+    test "test5349" (lazy(sprintf "% .5e" 5.0M)) " 5.00000e+000"
+    test "test5350" (lazy(sprintf "% .*e" 4 5.0M)) " 5.0000e+000"
+    test "test5351" (lazy(sprintf "% *.*e" 5 4 5.0M)) " 5.0000e+000"
+    test "test5352" (lazy(sprintf "%- e" 5.0M)) " 5.000000e+000"
+    test "test5353" (lazy(sprintf "%- 5e" 5.0M)) " 5.000000e+000"
+    test "test5354" (lazy(sprintf "%- 1e" 5.0M)) " 5.000000e+000"
+    test "test5355" (lazy(sprintf "%- *e" 7 5.0M)) " 5.000000e+000"
+    test "test5356" (lazy(sprintf "%- .5e" 5.0M)) " 5.00000e+000"
+    test "test5357" (lazy(sprintf "%- .*e" 4 5.0M)) " 5.0000e+000"
+    test "test5358" (lazy(sprintf "%- *.*e" 5 4 5.0M)) " 5.0000e+000"
+    test "test5359" (lazy(sprintf "% 0e" 5.0M)) " 5.000000e+000"
+    test "test5360" (lazy(sprintf "% 05e" 5.0M)) " 5.000000e+000"
+    test "test5361" (lazy(sprintf "% 01e" 5.0M)) " 5.000000e+000"
+    test "test5362" (lazy(sprintf "% 0*e" 7 5.0M)) " 5.000000e+000"
+    test "test5363" (lazy(sprintf "% 0.5e" 5.0M)) " 5.00000e+000"
+    test "test5364" (lazy(sprintf "% 0.*e" 4 5.0M)) " 5.0000e+000"
+    test "test5365" (lazy(sprintf "% 0*.*e" 5 4 5.0M)) " 5.0000e+000"
+    test "test5366" (lazy(sprintf "%- 0e" 5.0M)) " 5.000000e+000"
+    test "test5367" (lazy(sprintf "%- 05e" 5.0M)) " 5.000000e+000"
+    test "test5368" (lazy(sprintf "%- 01e" 5.0M)) " 5.000000e+000"
+    test "test5369" (lazy(sprintf "%- 0*e" 7 5.0M)) " 5.000000e+000"
+    test "test5370" (lazy(sprintf "%- 0.5e" 5.0M)) " 5.00000e+000"
+    test "test5371" (lazy(sprintf "%- 0.*e" 4 5.0M)) " 5.0000e+000"
+    test "test5372" (lazy(sprintf "%- 0*.*e" 5 4 5.0M)) " 5.0000e+000"
+    test "test5373" (lazy(sprintf "%e" -10.0M)) "-1.000000e+001"
+    test "test5374" (lazy(sprintf "%5e" -10.0M)) "-1.000000e+001"
+    test "test5375" (lazy(sprintf "%1e" -10.0M)) "-1.000000e+001"
+    test "test5376" (lazy(sprintf "%*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5377" (lazy(sprintf "%.5e" -10.0M)) "-1.00000e+001"
+    test "test5378" (lazy(sprintf "%.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5379" (lazy(sprintf "%*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5380" (lazy(sprintf "%-e" -10.0M)) "-1.000000e+001"
+    test "test5381" (lazy(sprintf "%-5e" -10.0M)) "-1.000000e+001"
+    test "test5382" (lazy(sprintf "%-1e" -10.0M)) "-1.000000e+001"
+    test "test5383" (lazy(sprintf "%-*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5384" (lazy(sprintf "%-.5e" -10.0M)) "-1.00000e+001"
+    test "test5385" (lazy(sprintf "%-.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5386" (lazy(sprintf "%-*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5387" (lazy(sprintf "%0e" -10.0M)) "-1.000000e+001"
+    test "test5388" (lazy(sprintf "%05e" -10.0M)) "-1.000000e+001"
+    test "test5389" (lazy(sprintf "%01e" -10.0M)) "-1.000000e+001"
+    test "test5390" (lazy(sprintf "%0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5391" (lazy(sprintf "%0.5e" -10.0M)) "-1.00000e+001"
+    test "test5392" (lazy(sprintf "%0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5393" (lazy(sprintf "%0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5394" (lazy(sprintf "%-0e" -10.0M)) "-1.000000e+001"
+    test "test5395" (lazy(sprintf "%-05e" -10.0M)) "-1.000000e+001"
+    test "test5396" (lazy(sprintf "%-01e" -10.0M)) "-1.000000e+001"
+    test "test5397" (lazy(sprintf "%-0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5398" (lazy(sprintf "%-0.5e" -10.0M)) "-1.00000e+001"
+    test "test5399" (lazy(sprintf "%-0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5400" (lazy(sprintf "%-0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5401" (lazy(sprintf "%+e" -10.0M)) "-1.000000e+001"
+    test "test5402" (lazy(sprintf "%+5e" -10.0M)) "-1.000000e+001"
+    test "test5403" (lazy(sprintf "%+1e" -10.0M)) "-1.000000e+001"
+    test "test5404" (lazy(sprintf "%+*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5405" (lazy(sprintf "%+.5e" -10.0M)) "-1.00000e+001"
+    test "test5406" (lazy(sprintf "%+.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5407" (lazy(sprintf "%+*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5408" (lazy(sprintf "%-+e" -10.0M)) "-1.000000e+001"
+    test "test5409" (lazy(sprintf "%-+5e" -10.0M)) "-1.000000e+001"
+    test "test5410" (lazy(sprintf "%-+1e" -10.0M)) "-1.000000e+001"
+    test "test5411" (lazy(sprintf "%-+*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5412" (lazy(sprintf "%-+.5e" -10.0M)) "-1.00000e+001"
+    test "test5413" (lazy(sprintf "%-+.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5414" (lazy(sprintf "%-+*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5415" (lazy(sprintf "%+0e" -10.0M)) "-1.000000e+001"
+    test "test5416" (lazy(sprintf "%+05e" -10.0M)) "-1.000000e+001"
+    test "test5417" (lazy(sprintf "%+01e" -10.0M)) "-1.000000e+001"
+    test "test5418" (lazy(sprintf "%+0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5419" (lazy(sprintf "%+0.5e" -10.0M)) "-1.00000e+001"
+    test "test5420" (lazy(sprintf "%+0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5421" (lazy(sprintf "%+0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5422" (lazy(sprintf "%-+0e" -10.0M)) "-1.000000e+001"
+    test "test5423" (lazy(sprintf "%-+05e" -10.0M)) "-1.000000e+001"
+    test "test5424" (lazy(sprintf "%-+01e" -10.0M)) "-1.000000e+001"
+    test "test5425" (lazy(sprintf "%-+0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5426" (lazy(sprintf "%-+0.5e" -10.0M)) "-1.00000e+001"
+    test "test5427" (lazy(sprintf "%-+0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5428" (lazy(sprintf "%-+0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5429" (lazy(sprintf "% e" -10.0M)) "-1.000000e+001"
+    test "test5430" (lazy(sprintf "% 5e" -10.0M)) "-1.000000e+001"
+    test "test5431" (lazy(sprintf "% 1e" -10.0M)) "-1.000000e+001"
+    test "test5432" (lazy(sprintf "% *e" 7 -10.0M)) "-1.000000e+001"
+    test "test5433" (lazy(sprintf "% .5e" -10.0M)) "-1.00000e+001"
+    test "test5434" (lazy(sprintf "% .*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5435" (lazy(sprintf "% *.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5436" (lazy(sprintf "%- e" -10.0M)) "-1.000000e+001"
+    test "test5437" (lazy(sprintf "%- 5e" -10.0M)) "-1.000000e+001"
+    test "test5438" (lazy(sprintf "%- 1e" -10.0M)) "-1.000000e+001"
+    test "test5439" (lazy(sprintf "%- *e" 7 -10.0M)) "-1.000000e+001"
+    test "test5440" (lazy(sprintf "%- .5e" -10.0M)) "-1.00000e+001"
+    test "test5441" (lazy(sprintf "%- .*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5442" (lazy(sprintf "%- *.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5443" (lazy(sprintf "% 0e" -10.0M)) "-1.000000e+001"
+    test "test5444" (lazy(sprintf "% 05e" -10.0M)) "-1.000000e+001"
+    test "test5445" (lazy(sprintf "% 01e" -10.0M)) "-1.000000e+001"
+    test "test5446" (lazy(sprintf "% 0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5447" (lazy(sprintf "% 0.5e" -10.0M)) "-1.00000e+001"
+    test "test5448" (lazy(sprintf "% 0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5449" (lazy(sprintf "% 0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5450" (lazy(sprintf "%- 0e" -10.0M)) "-1.000000e+001"
+    test "test5451" (lazy(sprintf "%- 05e" -10.0M)) "-1.000000e+001"
+    test "test5452" (lazy(sprintf "%- 01e" -10.0M)) "-1.000000e+001"
+    test "test5453" (lazy(sprintf "%- 0*e" 7 -10.0M)) "-1.000000e+001"
+    test "test5454" (lazy(sprintf "%- 0.5e" -10.0M)) "-1.00000e+001"
+    test "test5455" (lazy(sprintf "%- 0.*e" 4 -10.0M)) "-1.0000e+001"
+    test "test5456" (lazy(sprintf "%- 0*.*e" 5 4 -10.0M)) "-1.0000e+001"
+    test "test5457" (lazy(sprintf "%E" 5.0)) "5.000000E+000"
+    test "test5458" (lazy(sprintf "%5E" 5.0)) "5.000000E+000"
+    test "test5459" (lazy(sprintf "%1E" 5.0)) "5.000000E+000"
+    test "test5460" (lazy(sprintf "%*E" 7 5.0)) "5.000000E+000"
+    test "test5461" (lazy(sprintf "%.5E" 5.0)) "5.00000E+000"
+    test "test5462" (lazy(sprintf "%.*E" 4 5.0)) "5.0000E+000"
+    test "test5463" (lazy(sprintf "%*.*E" 5 4 5.0)) "5.0000E+000"
+    test "test5464" (lazy(sprintf "%-E" 5.0)) "5.000000E+000"
+    test "test5465" (lazy(sprintf "%-5E" 5.0)) "5.000000E+000"
+    test "test5466" (lazy(sprintf "%-1E" 5.0)) "5.000000E+000"
+    test "test5467" (lazy(sprintf "%-*E" 7 5.0)) "5.000000E+000"
+    test "test5468" (lazy(sprintf "%-.5E" 5.0)) "5.00000E+000"
+    test "test5469" (lazy(sprintf "%-.*E" 4 5.0)) "5.0000E+000"
+    test "test5470" (lazy(sprintf "%-*.*E" 5 4 5.0)) "5.0000E+000"
+    test "test5471" (lazy(sprintf "%0E" 5.0)) "5.000000E+000"
+    test "test5472" (lazy(sprintf "%05E" 5.0)) "5.000000E+000"
+    test "test5473" (lazy(sprintf "%01E" 5.0)) "5.000000E+000"
+    test "test5474" (lazy(sprintf "%0*E" 7 5.0)) "5.000000E+000"
+    test "test5475" (lazy(sprintf "%0.5E" 5.0)) "5.00000E+000"
+    test "test5476" (lazy(sprintf "%0.*E" 4 5.0)) "5.0000E+000"
+    test "test5477" (lazy(sprintf "%0*.*E" 5 4 5.0)) "5.0000E+000"
+    test "test5478" (lazy(sprintf "%-0E" 5.0)) "5.000000E+000"
+    test "test5479" (lazy(sprintf "%-05E" 5.0)) "5.000000E+000"
+    test "test5480" (lazy(sprintf "%-01E" 5.0)) "5.000000E+000"
+    test "test5481" (lazy(sprintf "%-0*E" 7 5.0)) "5.000000E+000"
+    test "test5482" (lazy(sprintf "%-0.5E" 5.0)) "5.00000E+000"
+    test "test5483" (lazy(sprintf "%-0.*E" 4 5.0)) "5.0000E+000"
+    test "test5484" (lazy(sprintf "%-0*.*E" 5 4 5.0)) "5.0000E+000"
+    test "test5485" (lazy(sprintf "%+E" 5.0)) "+5.000000E+000"
+    test "test5486" (lazy(sprintf "%+5E" 5.0)) "+5.000000E+000"
+    test "test5487" (lazy(sprintf "%+1E" 5.0)) "+5.000000E+000"
+    test "test5488" (lazy(sprintf "%+*E" 7 5.0)) "+5.000000E+000"
+    test "test5489" (lazy(sprintf "%+.5E" 5.0)) "+5.00000E+000"
+    test "test5490" (lazy(sprintf "%+.*E" 4 5.0)) "+5.0000E+000"
+    test "test5491" (lazy(sprintf "%+*.*E" 5 4 5.0)) "+5.0000E+000"
+    test "test5492" (lazy(sprintf "%-+E" 5.0)) "+5.000000E+000"
+    test "test5493" (lazy(sprintf "%-+5E" 5.0)) "+5.000000E+000"
+    test "test5494" (lazy(sprintf "%-+1E" 5.0)) "+5.000000E+000"
+    test "test5495" (lazy(sprintf "%-+*E" 7 5.0)) "+5.000000E+000"
+    test "test5496" (lazy(sprintf "%-+.5E" 5.0)) "+5.00000E+000"
+    test "test5497" (lazy(sprintf "%-+.*E" 4 5.0)) "+5.0000E+000"
+    test "test5498" (lazy(sprintf "%-+*.*E" 5 4 5.0)) "+5.0000E+000"
+    test "test5499" (lazy(sprintf "%+0E" 5.0)) "+5.000000E+000"
+    test "test5500" (lazy(sprintf "%+05E" 5.0)) "+5.000000E+000"
+    test "test5501" (lazy(sprintf "%+01E" 5.0)) "+5.000000E+000"
+    test "test5502" (lazy(sprintf "%+0*E" 7 5.0)) "+5.000000E+000"
+    test "test5503" (lazy(sprintf "%+0.5E" 5.0)) "+5.00000E+000"
+    test "test5504" (lazy(sprintf "%+0.*E" 4 5.0)) "+5.0000E+000"
+    test "test5505" (lazy(sprintf "%+0*.*E" 5 4 5.0)) "+5.0000E+000"
+    test "test5506" (lazy(sprintf "%-+0E" 5.0)) "+5.000000E+000"
+    test "test5507" (lazy(sprintf "%-+05E" 5.0)) "+5.000000E+000"
+    test "test5508" (lazy(sprintf "%-+01E" 5.0)) "+5.000000E+000"
+    test "test5509" (lazy(sprintf "%-+0*E" 7 5.0)) "+5.000000E+000"
+    test "test5510" (lazy(sprintf "%-+0.5E" 5.0)) "+5.00000E+000"
+    test "test5511" (lazy(sprintf "%-+0.*E" 4 5.0)) "+5.0000E+000"
+    test "test5512" (lazy(sprintf "%-+0*.*E" 5 4 5.0)) "+5.0000E+000"
+    test "test5513" (lazy(sprintf "% E" 5.0)) " 5.000000E+000"
+    test "test5514" (lazy(sprintf "% 5E" 5.0)) " 5.000000E+000"
+    test "test5515" (lazy(sprintf "% 1E" 5.0)) " 5.000000E+000"
+    test "test5516" (lazy(sprintf "% *E" 7 5.0)) " 5.000000E+000"
+    test "test5517" (lazy(sprintf "% .5E" 5.0)) " 5.00000E+000"
+    test "test5518" (lazy(sprintf "% .*E" 4 5.0)) " 5.0000E+000"
+    test "test5519" (lazy(sprintf "% *.*E" 5 4 5.0)) " 5.0000E+000"
+    test "test5520" (lazy(sprintf "%- E" 5.0)) " 5.000000E+000"
+    test "test5521" (lazy(sprintf "%- 5E" 5.0)) " 5.000000E+000"
+    test "test5522" (lazy(sprintf "%- 1E" 5.0)) " 5.000000E+000"
+    test "test5523" (lazy(sprintf "%- *E" 7 5.0)) " 5.000000E+000"
+    test "test5524" (lazy(sprintf "%- .5E" 5.0)) " 5.00000E+000"
+    test "test5525" (lazy(sprintf "%- .*E" 4 5.0)) " 5.0000E+000"
+    test "test5526" (lazy(sprintf "%- *.*E" 5 4 5.0)) " 5.0000E+000"
+    test "test5527" (lazy(sprintf "% 0E" 5.0)) " 5.000000E+000"
+    test "test5528" (lazy(sprintf "% 05E" 5.0)) " 5.000000E+000"
+    test "test5529" (lazy(sprintf "% 01E" 5.0)) " 5.000000E+000"
+    test "test5530" (lazy(sprintf "% 0*E" 7 5.0)) " 5.000000E+000"
+    test "test5531" (lazy(sprintf "% 0.5E" 5.0)) " 5.00000E+000"
+    test "test5532" (lazy(sprintf "% 0.*E" 4 5.0)) " 5.0000E+000"
+    test "test5533" (lazy(sprintf "% 0*.*E" 5 4 5.0)) " 5.0000E+000"
+    test "test5534" (lazy(sprintf "%- 0E" 5.0)) " 5.000000E+000"
+    test "test5535" (lazy(sprintf "%- 05E" 5.0)) " 5.000000E+000"
+    test "test5536" (lazy(sprintf "%- 01E" 5.0)) " 5.000000E+000"
+    test "test5537" (lazy(sprintf "%- 0*E" 7 5.0)) " 5.000000E+000"
+    test "test5538" (lazy(sprintf "%- 0.5E" 5.0)) " 5.00000E+000"
+    test "test5539" (lazy(sprintf "%- 0.*E" 4 5.0)) " 5.0000E+000"
+    test "test5540" (lazy(sprintf "%- 0*.*E" 5 4 5.0)) " 5.0000E+000"
+    test "test5541" (lazy(sprintf "%E" -10.0)) "-1.000000E+001"
+    test "test5542" (lazy(sprintf "%5E" -10.0)) "-1.000000E+001"
+    test "test5543" (lazy(sprintf "%1E" -10.0)) "-1.000000E+001"
+    test "test5544" (lazy(sprintf "%*E" 7 -10.0)) "-1.000000E+001"
+    test "test5545" (lazy(sprintf "%.5E" -10.0)) "-1.00000E+001"
+    test "test5546" (lazy(sprintf "%.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5547" (lazy(sprintf "%*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5548" (lazy(sprintf "%-E" -10.0)) "-1.000000E+001"
+    test "test5549" (lazy(sprintf "%-5E" -10.0)) "-1.000000E+001"
+    test "test5550" (lazy(sprintf "%-1E" -10.0)) "-1.000000E+001"
+    test "test5551" (lazy(sprintf "%-*E" 7 -10.0)) "-1.000000E+001"
+    test "test5552" (lazy(sprintf "%-.5E" -10.0)) "-1.00000E+001"
+    test "test5553" (lazy(sprintf "%-.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5554" (lazy(sprintf "%-*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5555" (lazy(sprintf "%0E" -10.0)) "-1.000000E+001"
+    test "test5556" (lazy(sprintf "%05E" -10.0)) "-1.000000E+001"
+    test "test5557" (lazy(sprintf "%01E" -10.0)) "-1.000000E+001"
+    test "test5558" (lazy(sprintf "%0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5559" (lazy(sprintf "%0.5E" -10.0)) "-1.00000E+001"
+    test "test5560" (lazy(sprintf "%0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5561" (lazy(sprintf "%0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5562" (lazy(sprintf "%-0E" -10.0)) "-1.000000E+001"
+    test "test5563" (lazy(sprintf "%-05E" -10.0)) "-1.000000E+001"
+    test "test5564" (lazy(sprintf "%-01E" -10.0)) "-1.000000E+001"
+    test "test5565" (lazy(sprintf "%-0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5566" (lazy(sprintf "%-0.5E" -10.0)) "-1.00000E+001"
+    test "test5567" (lazy(sprintf "%-0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5568" (lazy(sprintf "%-0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5569" (lazy(sprintf "%+E" -10.0)) "-1.000000E+001"
+    test "test5570" (lazy(sprintf "%+5E" -10.0)) "-1.000000E+001"
+    test "test5571" (lazy(sprintf "%+1E" -10.0)) "-1.000000E+001"
+    test "test5572" (lazy(sprintf "%+*E" 7 -10.0)) "-1.000000E+001"
+    test "test5573" (lazy(sprintf "%+.5E" -10.0)) "-1.00000E+001"
+    test "test5574" (lazy(sprintf "%+.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5575" (lazy(sprintf "%+*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5576" (lazy(sprintf "%-+E" -10.0)) "-1.000000E+001"
+    test "test5577" (lazy(sprintf "%-+5E" -10.0)) "-1.000000E+001"
+    test "test5578" (lazy(sprintf "%-+1E" -10.0)) "-1.000000E+001"
+    test "test5579" (lazy(sprintf "%-+*E" 7 -10.0)) "-1.000000E+001"
+    test "test5580" (lazy(sprintf "%-+.5E" -10.0)) "-1.00000E+001"
+    test "test5581" (lazy(sprintf "%-+.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5582" (lazy(sprintf "%-+*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5583" (lazy(sprintf "%+0E" -10.0)) "-1.000000E+001"
+    test "test5584" (lazy(sprintf "%+05E" -10.0)) "-1.000000E+001"
+    test "test5585" (lazy(sprintf "%+01E" -10.0)) "-1.000000E+001"
+    test "test5586" (lazy(sprintf "%+0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5587" (lazy(sprintf "%+0.5E" -10.0)) "-1.00000E+001"
+    test "test5588" (lazy(sprintf "%+0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5589" (lazy(sprintf "%+0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5590" (lazy(sprintf "%-+0E" -10.0)) "-1.000000E+001"
+    test "test5591" (lazy(sprintf "%-+05E" -10.0)) "-1.000000E+001"
+    test "test5592" (lazy(sprintf "%-+01E" -10.0)) "-1.000000E+001"
+    test "test5593" (lazy(sprintf "%-+0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5594" (lazy(sprintf "%-+0.5E" -10.0)) "-1.00000E+001"
+    test "test5595" (lazy(sprintf "%-+0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5596" (lazy(sprintf "%-+0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5597" (lazy(sprintf "% E" -10.0)) "-1.000000E+001"
+    test "test5598" (lazy(sprintf "% 5E" -10.0)) "-1.000000E+001"
+    test "test5599" (lazy(sprintf "% 1E" -10.0)) "-1.000000E+001"
+    test "test5600" (lazy(sprintf "% *E" 7 -10.0)) "-1.000000E+001"
+    test "test5601" (lazy(sprintf "% .5E" -10.0)) "-1.00000E+001"
+    test "test5602" (lazy(sprintf "% .*E" 4 -10.0)) "-1.0000E+001"
+    test "test5603" (lazy(sprintf "% *.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5604" (lazy(sprintf "%- E" -10.0)) "-1.000000E+001"
+    test "test5605" (lazy(sprintf "%- 5E" -10.0)) "-1.000000E+001"
+    test "test5606" (lazy(sprintf "%- 1E" -10.0)) "-1.000000E+001"
+    test "test5607" (lazy(sprintf "%- *E" 7 -10.0)) "-1.000000E+001"
+    test "test5608" (lazy(sprintf "%- .5E" -10.0)) "-1.00000E+001"
+    test "test5609" (lazy(sprintf "%- .*E" 4 -10.0)) "-1.0000E+001"
+    test "test5610" (lazy(sprintf "%- *.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5611" (lazy(sprintf "% 0E" -10.0)) "-1.000000E+001"
+    test "test5612" (lazy(sprintf "% 05E" -10.0)) "-1.000000E+001"
+    test "test5613" (lazy(sprintf "% 01E" -10.0)) "-1.000000E+001"
+    test "test5614" (lazy(sprintf "% 0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5615" (lazy(sprintf "% 0.5E" -10.0)) "-1.00000E+001"
+    test "test5616" (lazy(sprintf "% 0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5617" (lazy(sprintf "% 0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5618" (lazy(sprintf "%- 0E" -10.0)) "-1.000000E+001"
+    test "test5619" (lazy(sprintf "%- 05E" -10.0)) "-1.000000E+001"
+    test "test5620" (lazy(sprintf "%- 01E" -10.0)) "-1.000000E+001"
+    test "test5621" (lazy(sprintf "%- 0*E" 7 -10.0)) "-1.000000E+001"
+    test "test5622" (lazy(sprintf "%- 0.5E" -10.0)) "-1.00000E+001"
+    test "test5623" (lazy(sprintf "%- 0.*E" 4 -10.0)) "-1.0000E+001"
+    test "test5624" (lazy(sprintf "%- 0*.*E" 5 4 -10.0)) "-1.0000E+001"
+    test "test5625" (lazy(sprintf "%E" 5.0f)) "5.000000E+000"
+    test "test5626" (lazy(sprintf "%5E" 5.0f)) "5.000000E+000"
+    test "test5627" (lazy(sprintf "%1E" 5.0f)) "5.000000E+000"
+    test "test5628" (lazy(sprintf "%*E" 7 5.0f)) "5.000000E+000"
+    test "test5629" (lazy(sprintf "%.5E" 5.0f)) "5.00000E+000"
+    test "test5630" (lazy(sprintf "%.*E" 4 5.0f)) "5.0000E+000"
+    test "test5631" (lazy(sprintf "%*.*E" 5 4 5.0f)) "5.0000E+000"
+    test "test5632" (lazy(sprintf "%-E" 5.0f)) "5.000000E+000"
+    test "test5633" (lazy(sprintf "%-5E" 5.0f)) "5.000000E+000"
+    test "test5634" (lazy(sprintf "%-1E" 5.0f)) "5.000000E+000"
+    test "test5635" (lazy(sprintf "%-*E" 7 5.0f)) "5.000000E+000"
+    test "test5636" (lazy(sprintf "%-.5E" 5.0f)) "5.00000E+000"
+    test "test5637" (lazy(sprintf "%-.*E" 4 5.0f)) "5.0000E+000"
+    test "test5638" (lazy(sprintf "%-*.*E" 5 4 5.0f)) "5.0000E+000"
+    test "test5639" (lazy(sprintf "%0E" 5.0f)) "5.000000E+000"
+    test "test5640" (lazy(sprintf "%05E" 5.0f)) "5.000000E+000"
+    test "test5641" (lazy(sprintf "%01E" 5.0f)) "5.000000E+000"
+    test "test5642" (lazy(sprintf "%0*E" 7 5.0f)) "5.000000E+000"
+    test "test5643" (lazy(sprintf "%0.5E" 5.0f)) "5.00000E+000"
+    test "test5644" (lazy(sprintf "%0.*E" 4 5.0f)) "5.0000E+000"
+    test "test5645" (lazy(sprintf "%0*.*E" 5 4 5.0f)) "5.0000E+000"
+    test "test5646" (lazy(sprintf "%-0E" 5.0f)) "5.000000E+000"
+    test "test5647" (lazy(sprintf "%-05E" 5.0f)) "5.000000E+000"
+    test "test5648" (lazy(sprintf "%-01E" 5.0f)) "5.000000E+000"
+    test "test5649" (lazy(sprintf "%-0*E" 7 5.0f)) "5.000000E+000"
+    test "test5650" (lazy(sprintf "%-0.5E" 5.0f)) "5.00000E+000"
+    test "test5651" (lazy(sprintf "%-0.*E" 4 5.0f)) "5.0000E+000"
+    test "test5652" (lazy(sprintf "%-0*.*E" 5 4 5.0f)) "5.0000E+000"
+    test "test5653" (lazy(sprintf "%+E" 5.0f)) "+5.000000E+000"
+    test "test5654" (lazy(sprintf "%+5E" 5.0f)) "+5.000000E+000"
+    test "test5655" (lazy(sprintf "%+1E" 5.0f)) "+5.000000E+000"
+    test "test5656" (lazy(sprintf "%+*E" 7 5.0f)) "+5.000000E+000"
+    test "test5657" (lazy(sprintf "%+.5E" 5.0f)) "+5.00000E+000"
+    test "test5658" (lazy(sprintf "%+.*E" 4 5.0f)) "+5.0000E+000"
+    test "test5659" (lazy(sprintf "%+*.*E" 5 4 5.0f)) "+5.0000E+000"
+    test "test5660" (lazy(sprintf "%-+E" 5.0f)) "+5.000000E+000"
+    test "test5661" (lazy(sprintf "%-+5E" 5.0f)) "+5.000000E+000"
+    test "test5662" (lazy(sprintf "%-+1E" 5.0f)) "+5.000000E+000"
+    test "test5663" (lazy(sprintf "%-+*E" 7 5.0f)) "+5.000000E+000"
+    test "test5664" (lazy(sprintf "%-+.5E" 5.0f)) "+5.00000E+000"
+    test "test5665" (lazy(sprintf "%-+.*E" 4 5.0f)) "+5.0000E+000"
+    test "test5666" (lazy(sprintf "%-+*.*E" 5 4 5.0f)) "+5.0000E+000"
+    test "test5667" (lazy(sprintf "%+0E" 5.0f)) "+5.000000E+000"
+    test "test5668" (lazy(sprintf "%+05E" 5.0f)) "+5.000000E+000"
+    test "test5669" (lazy(sprintf "%+01E" 5.0f)) "+5.000000E+000"
+    test "test5670" (lazy(sprintf "%+0*E" 7 5.0f)) "+5.000000E+000"
+    test "test5671" (lazy(sprintf "%+0.5E" 5.0f)) "+5.00000E+000"
+    test "test5672" (lazy(sprintf "%+0.*E" 4 5.0f)) "+5.0000E+000"
+    test "test5673" (lazy(sprintf "%+0*.*E" 5 4 5.0f)) "+5.0000E+000"
+    test "test5674" (lazy(sprintf "%-+0E" 5.0f)) "+5.000000E+000"
+    test "test5675" (lazy(sprintf "%-+05E" 5.0f)) "+5.000000E+000"
+    test "test5676" (lazy(sprintf "%-+01E" 5.0f)) "+5.000000E+000"
+    test "test5677" (lazy(sprintf "%-+0*E" 7 5.0f)) "+5.000000E+000"
+    test "test5678" (lazy(sprintf "%-+0.5E" 5.0f)) "+5.00000E+000"
+    test "test5679" (lazy(sprintf "%-+0.*E" 4 5.0f)) "+5.0000E+000"
+    test "test5680" (lazy(sprintf "%-+0*.*E" 5 4 5.0f)) "+5.0000E+000"
+    test "test5681" (lazy(sprintf "% E" 5.0f)) " 5.000000E+000"
+    test "test5682" (lazy(sprintf "% 5E" 5.0f)) " 5.000000E+000"
+    test "test5683" (lazy(sprintf "% 1E" 5.0f)) " 5.000000E+000"
+    test "test5684" (lazy(sprintf "% *E" 7 5.0f)) " 5.000000E+000"
+    test "test5685" (lazy(sprintf "% .5E" 5.0f)) " 5.00000E+000"
+    test "test5686" (lazy(sprintf "% .*E" 4 5.0f)) " 5.0000E+000"
+    test "test5687" (lazy(sprintf "% *.*E" 5 4 5.0f)) " 5.0000E+000"
+    test "test5688" (lazy(sprintf "%- E" 5.0f)) " 5.000000E+000"
+    test "test5689" (lazy(sprintf "%- 5E" 5.0f)) " 5.000000E+000"
+    test "test5690" (lazy(sprintf "%- 1E" 5.0f)) " 5.000000E+000"
+    test "test5691" (lazy(sprintf "%- *E" 7 5.0f)) " 5.000000E+000"
+    test "test5692" (lazy(sprintf "%- .5E" 5.0f)) " 5.00000E+000"
+    test "test5693" (lazy(sprintf "%- .*E" 4 5.0f)) " 5.0000E+000"
+    test "test5694" (lazy(sprintf "%- *.*E" 5 4 5.0f)) " 5.0000E+000"
+    test "test5695" (lazy(sprintf "% 0E" 5.0f)) " 5.000000E+000"
+    test "test5696" (lazy(sprintf "% 05E" 5.0f)) " 5.000000E+000"
+    test "test5697" (lazy(sprintf "% 01E" 5.0f)) " 5.000000E+000"
+    test "test5698" (lazy(sprintf "% 0*E" 7 5.0f)) " 5.000000E+000"
+    test "test5699" (lazy(sprintf "% 0.5E" 5.0f)) " 5.00000E+000"
+    test "test5700" (lazy(sprintf "% 0.*E" 4 5.0f)) " 5.0000E+000"
+    test "test5701" (lazy(sprintf "% 0*.*E" 5 4 5.0f)) " 5.0000E+000"
+    test "test5702" (lazy(sprintf "%- 0E" 5.0f)) " 5.000000E+000"
+    test "test5703" (lazy(sprintf "%- 05E" 5.0f)) " 5.000000E+000"
+    test "test5704" (lazy(sprintf "%- 01E" 5.0f)) " 5.000000E+000"
+    test "test5705" (lazy(sprintf "%- 0*E" 7 5.0f)) " 5.000000E+000"
+    test "test5706" (lazy(sprintf "%- 0.5E" 5.0f)) " 5.00000E+000"
+    test "test5707" (lazy(sprintf "%- 0.*E" 4 5.0f)) " 5.0000E+000"
+    test "test5708" (lazy(sprintf "%- 0*.*E" 5 4 5.0f)) " 5.0000E+000"
+    test "test5709" (lazy(sprintf "%E" -10.0f)) "-1.000000E+001"
+    test "test5710" (lazy(sprintf "%5E" -10.0f)) "-1.000000E+001"
+    test "test5711" (lazy(sprintf "%1E" -10.0f)) "-1.000000E+001"
+    test "test5712" (lazy(sprintf "%*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5713" (lazy(sprintf "%.5E" -10.0f)) "-1.00000E+001"
+    test "test5714" (lazy(sprintf "%.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5715" (lazy(sprintf "%*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5716" (lazy(sprintf "%-E" -10.0f)) "-1.000000E+001"
+    test "test5717" (lazy(sprintf "%-5E" -10.0f)) "-1.000000E+001"
+    test "test5718" (lazy(sprintf "%-1E" -10.0f)) "-1.000000E+001"
+    test "test5719" (lazy(sprintf "%-*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5720" (lazy(sprintf "%-.5E" -10.0f)) "-1.00000E+001"
+    test "test5721" (lazy(sprintf "%-.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5722" (lazy(sprintf "%-*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5723" (lazy(sprintf "%0E" -10.0f)) "-1.000000E+001"
+    test "test5724" (lazy(sprintf "%05E" -10.0f)) "-1.000000E+001"
+    test "test5725" (lazy(sprintf "%01E" -10.0f)) "-1.000000E+001"
+    test "test5726" (lazy(sprintf "%0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5727" (lazy(sprintf "%0.5E" -10.0f)) "-1.00000E+001"
+    test "test5728" (lazy(sprintf "%0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5729" (lazy(sprintf "%0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5730" (lazy(sprintf "%-0E" -10.0f)) "-1.000000E+001"
+    test "test5731" (lazy(sprintf "%-05E" -10.0f)) "-1.000000E+001"
+    test "test5732" (lazy(sprintf "%-01E" -10.0f)) "-1.000000E+001"
+    test "test5733" (lazy(sprintf "%-0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5734" (lazy(sprintf "%-0.5E" -10.0f)) "-1.00000E+001"
+    test "test5735" (lazy(sprintf "%-0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5736" (lazy(sprintf "%-0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5737" (lazy(sprintf "%+E" -10.0f)) "-1.000000E+001"
+    test "test5738" (lazy(sprintf "%+5E" -10.0f)) "-1.000000E+001"
+    test "test5739" (lazy(sprintf "%+1E" -10.0f)) "-1.000000E+001"
+    test "test5740" (lazy(sprintf "%+*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5741" (lazy(sprintf "%+.5E" -10.0f)) "-1.00000E+001"
+    test "test5742" (lazy(sprintf "%+.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5743" (lazy(sprintf "%+*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5744" (lazy(sprintf "%-+E" -10.0f)) "-1.000000E+001"
+    test "test5745" (lazy(sprintf "%-+5E" -10.0f)) "-1.000000E+001"
+    test "test5746" (lazy(sprintf "%-+1E" -10.0f)) "-1.000000E+001"
+    test "test5747" (lazy(sprintf "%-+*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5748" (lazy(sprintf "%-+.5E" -10.0f)) "-1.00000E+001"
+    test "test5749" (lazy(sprintf "%-+.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5750" (lazy(sprintf "%-+*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5751" (lazy(sprintf "%+0E" -10.0f)) "-1.000000E+001"
+    test "test5752" (lazy(sprintf "%+05E" -10.0f)) "-1.000000E+001"
+    test "test5753" (lazy(sprintf "%+01E" -10.0f)) "-1.000000E+001"
+    test "test5754" (lazy(sprintf "%+0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5755" (lazy(sprintf "%+0.5E" -10.0f)) "-1.00000E+001"
+    test "test5756" (lazy(sprintf "%+0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5757" (lazy(sprintf "%+0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5758" (lazy(sprintf "%-+0E" -10.0f)) "-1.000000E+001"
+    test "test5759" (lazy(sprintf "%-+05E" -10.0f)) "-1.000000E+001"
+    test "test5760" (lazy(sprintf "%-+01E" -10.0f)) "-1.000000E+001"
+    test "test5761" (lazy(sprintf "%-+0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5762" (lazy(sprintf "%-+0.5E" -10.0f)) "-1.00000E+001"
+    test "test5763" (lazy(sprintf "%-+0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5764" (lazy(sprintf "%-+0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5765" (lazy(sprintf "% E" -10.0f)) "-1.000000E+001"
+    test "test5766" (lazy(sprintf "% 5E" -10.0f)) "-1.000000E+001"
+    test "test5767" (lazy(sprintf "% 1E" -10.0f)) "-1.000000E+001"
+    test "test5768" (lazy(sprintf "% *E" 7 -10.0f)) "-1.000000E+001"
+    test "test5769" (lazy(sprintf "% .5E" -10.0f)) "-1.00000E+001"
+    test "test5770" (lazy(sprintf "% .*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5771" (lazy(sprintf "% *.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5772" (lazy(sprintf "%- E" -10.0f)) "-1.000000E+001"
+    test "test5773" (lazy(sprintf "%- 5E" -10.0f)) "-1.000000E+001"
+    test "test5774" (lazy(sprintf "%- 1E" -10.0f)) "-1.000000E+001"
+    test "test5775" (lazy(sprintf "%- *E" 7 -10.0f)) "-1.000000E+001"
+    test "test5776" (lazy(sprintf "%- .5E" -10.0f)) "-1.00000E+001"
+    test "test5777" (lazy(sprintf "%- .*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5778" (lazy(sprintf "%- *.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5779" (lazy(sprintf "% 0E" -10.0f)) "-1.000000E+001"
+    test "test5780" (lazy(sprintf "% 05E" -10.0f)) "-1.000000E+001"
+    test "test5781" (lazy(sprintf "% 01E" -10.0f)) "-1.000000E+001"
+    test "test5782" (lazy(sprintf "% 0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5783" (lazy(sprintf "% 0.5E" -10.0f)) "-1.00000E+001"
+    test "test5784" (lazy(sprintf "% 0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5785" (lazy(sprintf "% 0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5786" (lazy(sprintf "%- 0E" -10.0f)) "-1.000000E+001"
+    test "test5787" (lazy(sprintf "%- 05E" -10.0f)) "-1.000000E+001"
+    test "test5788" (lazy(sprintf "%- 01E" -10.0f)) "-1.000000E+001"
+    test "test5789" (lazy(sprintf "%- 0*E" 7 -10.0f)) "-1.000000E+001"
+    test "test5790" (lazy(sprintf "%- 0.5E" -10.0f)) "-1.00000E+001"
+    test "test5791" (lazy(sprintf "%- 0.*E" 4 -10.0f)) "-1.0000E+001"
+    test "test5792" (lazy(sprintf "%- 0*.*E" 5 4 -10.0f)) "-1.0000E+001"
+    test "test5793" (lazy(sprintf "%E" 5.0M)) "5.000000E+000"
+    test "test5794" (lazy(sprintf "%5E" 5.0M)) "5.000000E+000"
+    test "test5795" (lazy(sprintf "%1E" 5.0M)) "5.000000E+000"
+    test "test5796" (lazy(sprintf "%*E" 7 5.0M)) "5.000000E+000"
+    test "test5797" (lazy(sprintf "%.5E" 5.0M)) "5.00000E+000"
+    test "test5798" (lazy(sprintf "%.*E" 4 5.0M)) "5.0000E+000"
+    test "test5799" (lazy(sprintf "%*.*E" 5 4 5.0M)) "5.0000E+000"
+    test "test5800" (lazy(sprintf "%-E" 5.0M)) "5.000000E+000"
+    test "test5801" (lazy(sprintf "%-5E" 5.0M)) "5.000000E+000"
+    test "test5802" (lazy(sprintf "%-1E" 5.0M)) "5.000000E+000"
+    test "test5803" (lazy(sprintf "%-*E" 7 5.0M)) "5.000000E+000"
+    test "test5804" (lazy(sprintf "%-.5E" 5.0M)) "5.00000E+000"
+    test "test5805" (lazy(sprintf "%-.*E" 4 5.0M)) "5.0000E+000"
+    test "test5806" (lazy(sprintf "%-*.*E" 5 4 5.0M)) "5.0000E+000"
+    test "test5807" (lazy(sprintf "%0E" 5.0M)) "5.000000E+000"
+    test "test5808" (lazy(sprintf "%05E" 5.0M)) "5.000000E+000"
+    test "test5809" (lazy(sprintf "%01E" 5.0M)) "5.000000E+000"
+    test "test5810" (lazy(sprintf "%0*E" 7 5.0M)) "5.000000E+000"
+    test "test5811" (lazy(sprintf "%0.5E" 5.0M)) "5.00000E+000"
+    test "test5812" (lazy(sprintf "%0.*E" 4 5.0M)) "5.0000E+000"
+    test "test5813" (lazy(sprintf "%0*.*E" 5 4 5.0M)) "5.0000E+000"
+    test "test5814" (lazy(sprintf "%-0E" 5.0M)) "5.000000E+000"
+    test "test5815" (lazy(sprintf "%-05E" 5.0M)) "5.000000E+000"
+    test "test5816" (lazy(sprintf "%-01E" 5.0M)) "5.000000E+000"
+    test "test5817" (lazy(sprintf "%-0*E" 7 5.0M)) "5.000000E+000"
+    test "test5818" (lazy(sprintf "%-0.5E" 5.0M)) "5.00000E+000"
+    test "test5819" (lazy(sprintf "%-0.*E" 4 5.0M)) "5.0000E+000"
+    test "test5820" (lazy(sprintf "%-0*.*E" 5 4 5.0M)) "5.0000E+000"
+    test "test5821" (lazy(sprintf "%+E" 5.0M)) "+5.000000E+000"
+    test "test5822" (lazy(sprintf "%+5E" 5.0M)) "+5.000000E+000"
+    test "test5823" (lazy(sprintf "%+1E" 5.0M)) "+5.000000E+000"
+    test "test5824" (lazy(sprintf "%+*E" 7 5.0M)) "+5.000000E+000"
+    test "test5825" (lazy(sprintf "%+.5E" 5.0M)) "+5.00000E+000"
+    test "test5826" (lazy(sprintf "%+.*E" 4 5.0M)) "+5.0000E+000"
+    test "test5827" (lazy(sprintf "%+*.*E" 5 4 5.0M)) "+5.0000E+000"
+    test "test5828" (lazy(sprintf "%-+E" 5.0M)) "+5.000000E+000"
+    test "test5829" (lazy(sprintf "%-+5E" 5.0M)) "+5.000000E+000"
+    test "test5830" (lazy(sprintf "%-+1E" 5.0M)) "+5.000000E+000"
+    test "test5831" (lazy(sprintf "%-+*E" 7 5.0M)) "+5.000000E+000"
+    test "test5832" (lazy(sprintf "%-+.5E" 5.0M)) "+5.00000E+000"
+    test "test5833" (lazy(sprintf "%-+.*E" 4 5.0M)) "+5.0000E+000"
+    test "test5834" (lazy(sprintf "%-+*.*E" 5 4 5.0M)) "+5.0000E+000"
+    test "test5835" (lazy(sprintf "%+0E" 5.0M)) "+5.000000E+000"
+    test "test5836" (lazy(sprintf "%+05E" 5.0M)) "+5.000000E+000"
+    test "test5837" (lazy(sprintf "%+01E" 5.0M)) "+5.000000E+000"
+    test "test5838" (lazy(sprintf "%+0*E" 7 5.0M)) "+5.000000E+000"
+    test "test5839" (lazy(sprintf "%+0.5E" 5.0M)) "+5.00000E+000"
+    test "test5840" (lazy(sprintf "%+0.*E" 4 5.0M)) "+5.0000E+000"
+    test "test5841" (lazy(sprintf "%+0*.*E" 5 4 5.0M)) "+5.0000E+000"
+    test "test5842" (lazy(sprintf "%-+0E" 5.0M)) "+5.000000E+000"
+    test "test5843" (lazy(sprintf "%-+05E" 5.0M)) "+5.000000E+000"
+    test "test5844" (lazy(sprintf "%-+01E" 5.0M)) "+5.000000E+000"
+    test "test5845" (lazy(sprintf "%-+0*E" 7 5.0M)) "+5.000000E+000"
+    test "test5846" (lazy(sprintf "%-+0.5E" 5.0M)) "+5.00000E+000"
+    test "test5847" (lazy(sprintf "%-+0.*E" 4 5.0M)) "+5.0000E+000"
+    test "test5848" (lazy(sprintf "%-+0*.*E" 5 4 5.0M)) "+5.0000E+000"
+    test "test5849" (lazy(sprintf "% E" 5.0M)) " 5.000000E+000"
+    test "test5850" (lazy(sprintf "% 5E" 5.0M)) " 5.000000E+000"
+    test "test5851" (lazy(sprintf "% 1E" 5.0M)) " 5.000000E+000"
+    test "test5852" (lazy(sprintf "% *E" 7 5.0M)) " 5.000000E+000"
+    test "test5853" (lazy(sprintf "% .5E" 5.0M)) " 5.00000E+000"
+    test "test5854" (lazy(sprintf "% .*E" 4 5.0M)) " 5.0000E+000"
+    test "test5855" (lazy(sprintf "% *.*E" 5 4 5.0M)) " 5.0000E+000"
+    test "test5856" (lazy(sprintf "%- E" 5.0M)) " 5.000000E+000"
+    test "test5857" (lazy(sprintf "%- 5E" 5.0M)) " 5.000000E+000"
+    test "test5858" (lazy(sprintf "%- 1E" 5.0M)) " 5.000000E+000"
+    test "test5859" (lazy(sprintf "%- *E" 7 5.0M)) " 5.000000E+000"
+    test "test5860" (lazy(sprintf "%- .5E" 5.0M)) " 5.00000E+000"
+    test "test5861" (lazy(sprintf "%- .*E" 4 5.0M)) " 5.0000E+000"
+    test "test5862" (lazy(sprintf "%- *.*E" 5 4 5.0M)) " 5.0000E+000"
+    test "test5863" (lazy(sprintf "% 0E" 5.0M)) " 5.000000E+000"
+    test "test5864" (lazy(sprintf "% 05E" 5.0M)) " 5.000000E+000"
+    test "test5865" (lazy(sprintf "% 01E" 5.0M)) " 5.000000E+000"
+    test "test5866" (lazy(sprintf "% 0*E" 7 5.0M)) " 5.000000E+000"
+    test "test5867" (lazy(sprintf "% 0.5E" 5.0M)) " 5.00000E+000"
+    test "test5868" (lazy(sprintf "% 0.*E" 4 5.0M)) " 5.0000E+000"
+    test "test5869" (lazy(sprintf "% 0*.*E" 5 4 5.0M)) " 5.0000E+000"
+    test "test5870" (lazy(sprintf "%- 0E" 5.0M)) " 5.000000E+000"
+    test "test5871" (lazy(sprintf "%- 05E" 5.0M)) " 5.000000E+000"
+    test "test5872" (lazy(sprintf "%- 01E" 5.0M)) " 5.000000E+000"
+    test "test5873" (lazy(sprintf "%- 0*E" 7 5.0M)) " 5.000000E+000"
+    test "test5874" (lazy(sprintf "%- 0.5E" 5.0M)) " 5.00000E+000"
+    test "test5875" (lazy(sprintf "%- 0.*E" 4 5.0M)) " 5.0000E+000"
+    test "test5876" (lazy(sprintf "%- 0*.*E" 5 4 5.0M)) " 5.0000E+000"
+    test "test5877" (lazy(sprintf "%E" -10.0M)) "-1.000000E+001"
+    test "test5878" (lazy(sprintf "%5E" -10.0M)) "-1.000000E+001"
+    test "test5879" (lazy(sprintf "%1E" -10.0M)) "-1.000000E+001"
+    test "test5880" (lazy(sprintf "%*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5881" (lazy(sprintf "%.5E" -10.0M)) "-1.00000E+001"
+    test "test5882" (lazy(sprintf "%.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5883" (lazy(sprintf "%*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5884" (lazy(sprintf "%-E" -10.0M)) "-1.000000E+001"
+    test "test5885" (lazy(sprintf "%-5E" -10.0M)) "-1.000000E+001"
+    test "test5886" (lazy(sprintf "%-1E" -10.0M)) "-1.000000E+001"
+    test "test5887" (lazy(sprintf "%-*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5888" (lazy(sprintf "%-.5E" -10.0M)) "-1.00000E+001"
+    test "test5889" (lazy(sprintf "%-.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5890" (lazy(sprintf "%-*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5891" (lazy(sprintf "%0E" -10.0M)) "-1.000000E+001"
+    test "test5892" (lazy(sprintf "%05E" -10.0M)) "-1.000000E+001"
+    test "test5893" (lazy(sprintf "%01E" -10.0M)) "-1.000000E+001"
+    test "test5894" (lazy(sprintf "%0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5895" (lazy(sprintf "%0.5E" -10.0M)) "-1.00000E+001"
+    test "test5896" (lazy(sprintf "%0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5897" (lazy(sprintf "%0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5898" (lazy(sprintf "%-0E" -10.0M)) "-1.000000E+001"
+    test "test5899" (lazy(sprintf "%-05E" -10.0M)) "-1.000000E+001"
+    test "test5900" (lazy(sprintf "%-01E" -10.0M)) "-1.000000E+001"
+    test "test5901" (lazy(sprintf "%-0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5902" (lazy(sprintf "%-0.5E" -10.0M)) "-1.00000E+001"
+    test "test5903" (lazy(sprintf "%-0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5904" (lazy(sprintf "%-0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5905" (lazy(sprintf "%+E" -10.0M)) "-1.000000E+001"
+    test "test5906" (lazy(sprintf "%+5E" -10.0M)) "-1.000000E+001"
+    test "test5907" (lazy(sprintf "%+1E" -10.0M)) "-1.000000E+001"
+    test "test5908" (lazy(sprintf "%+*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5909" (lazy(sprintf "%+.5E" -10.0M)) "-1.00000E+001"
+    test "test5910" (lazy(sprintf "%+.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5911" (lazy(sprintf "%+*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5912" (lazy(sprintf "%-+E" -10.0M)) "-1.000000E+001"
+    test "test5913" (lazy(sprintf "%-+5E" -10.0M)) "-1.000000E+001"
+    test "test5914" (lazy(sprintf "%-+1E" -10.0M)) "-1.000000E+001"
+    test "test5915" (lazy(sprintf "%-+*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5916" (lazy(sprintf "%-+.5E" -10.0M)) "-1.00000E+001"
+    test "test5917" (lazy(sprintf "%-+.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5918" (lazy(sprintf "%-+*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5919" (lazy(sprintf "%+0E" -10.0M)) "-1.000000E+001"
+    test "test5920" (lazy(sprintf "%+05E" -10.0M)) "-1.000000E+001"
+    test "test5921" (lazy(sprintf "%+01E" -10.0M)) "-1.000000E+001"
+    test "test5922" (lazy(sprintf "%+0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5923" (lazy(sprintf "%+0.5E" -10.0M)) "-1.00000E+001"
+    test "test5924" (lazy(sprintf "%+0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5925" (lazy(sprintf "%+0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5926" (lazy(sprintf "%-+0E" -10.0M)) "-1.000000E+001"
+    test "test5927" (lazy(sprintf "%-+05E" -10.0M)) "-1.000000E+001"
+    test "test5928" (lazy(sprintf "%-+01E" -10.0M)) "-1.000000E+001"
+    test "test5929" (lazy(sprintf "%-+0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5930" (lazy(sprintf "%-+0.5E" -10.0M)) "-1.00000E+001"
+    test "test5931" (lazy(sprintf "%-+0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5932" (lazy(sprintf "%-+0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5933" (lazy(sprintf "% E" -10.0M)) "-1.000000E+001"
+    test "test5934" (lazy(sprintf "% 5E" -10.0M)) "-1.000000E+001"
+    test "test5935" (lazy(sprintf "% 1E" -10.0M)) "-1.000000E+001"
+    test "test5936" (lazy(sprintf "% *E" 7 -10.0M)) "-1.000000E+001"
+    test "test5937" (lazy(sprintf "% .5E" -10.0M)) "-1.00000E+001"
+    test "test5938" (lazy(sprintf "% .*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5939" (lazy(sprintf "% *.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5940" (lazy(sprintf "%- E" -10.0M)) "-1.000000E+001"
+    test "test5941" (lazy(sprintf "%- 5E" -10.0M)) "-1.000000E+001"
+    test "test5942" (lazy(sprintf "%- 1E" -10.0M)) "-1.000000E+001"
+    test "test5943" (lazy(sprintf "%- *E" 7 -10.0M)) "-1.000000E+001"
+    test "test5944" (lazy(sprintf "%- .5E" -10.0M)) "-1.00000E+001"
+    test "test5945" (lazy(sprintf "%- .*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5946" (lazy(sprintf "%- *.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5947" (lazy(sprintf "% 0E" -10.0M)) "-1.000000E+001"
+    test "test5948" (lazy(sprintf "% 05E" -10.0M)) "-1.000000E+001"
+    test "test5949" (lazy(sprintf "% 01E" -10.0M)) "-1.000000E+001"
+    test "test5950" (lazy(sprintf "% 0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5951" (lazy(sprintf "% 0.5E" -10.0M)) "-1.00000E+001"
+    test "test5952" (lazy(sprintf "% 0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5953" (lazy(sprintf "% 0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5954" (lazy(sprintf "%- 0E" -10.0M)) "-1.000000E+001"
+    test "test5955" (lazy(sprintf "%- 05E" -10.0M)) "-1.000000E+001"
+    test "test5956" (lazy(sprintf "%- 01E" -10.0M)) "-1.000000E+001"
+    test "test5957" (lazy(sprintf "%- 0*E" 7 -10.0M)) "-1.000000E+001"
+    test "test5958" (lazy(sprintf "%- 0.5E" -10.0M)) "-1.00000E+001"
+    test "test5959" (lazy(sprintf "%- 0.*E" 4 -10.0M)) "-1.0000E+001"
+    test "test5960" (lazy(sprintf "%- 0*.*E" 5 4 -10.0M)) "-1.0000E+001"
+    test "test5961" (lazy(sprintf "%f" 5.0)) "5.000000"
+    test "test5962" (lazy(sprintf "%5f" 5.0)) "5.000000"
+    test "test5963" (lazy(sprintf "%1f" 5.0)) "5.000000"
+    test "test5964" (lazy(sprintf "%*f" 7 5.0)) "5.000000"
+    test "test5965" (lazy(sprintf "%.5f" 5.0)) "5.00000"
+    test "test5966" (lazy(sprintf "%.*f" 4 5.0)) "5.0000"
+    test "test5967" (lazy(sprintf "%*.*f" 5 4 5.0)) "5.0000"
+    test "test5968" (lazy(sprintf "%-f" 5.0)) "5.000000"
+    test "test5969" (lazy(sprintf "%-5f" 5.0)) "5.000000"
+    test "test5970" (lazy(sprintf "%-1f" 5.0)) "5.000000"
+    test "test5971" (lazy(sprintf "%-*f" 7 5.0)) "5.000000"
+    test "test5972" (lazy(sprintf "%-.5f" 5.0)) "5.00000"
+    test "test5973" (lazy(sprintf "%-.*f" 4 5.0)) "5.0000"
+    test "test5974" (lazy(sprintf "%-*.*f" 5 4 5.0)) "5.0000"
+    test "test5975" (lazy(sprintf "%0f" 5.0)) "5.000000"
+    test "test5976" (lazy(sprintf "%05f" 5.0)) "5.000000"
+    test "test5977" (lazy(sprintf "%01f" 5.0)) "5.000000"
+    test "test5978" (lazy(sprintf "%0*f" 7 5.0)) "5.000000"
+    test "test5979" (lazy(sprintf "%0.5f" 5.0)) "5.00000"
+    test "test5980" (lazy(sprintf "%0.*f" 4 5.0)) "5.0000"
+    test "test5981" (lazy(sprintf "%0*.*f" 5 4 5.0)) "5.0000"
+    test "test5982" (lazy(sprintf "%-0f" 5.0)) "5.000000"
+    test "test5983" (lazy(sprintf "%-05f" 5.0)) "5.000000"
+    test "test5984" (lazy(sprintf "%-01f" 5.0)) "5.000000"
+    test "test5985" (lazy(sprintf "%-0*f" 7 5.0)) "5.000000"
+    test "test5986" (lazy(sprintf "%-0.5f" 5.0)) "5.00000"
+    test "test5987" (lazy(sprintf "%-0.*f" 4 5.0)) "5.0000"
+    test "test5988" (lazy(sprintf "%-0*.*f" 5 4 5.0)) "5.0000"
+    test "test5989" (lazy(sprintf "%+f" 5.0)) "+5.000000"
+    test "test5990" (lazy(sprintf "%+5f" 5.0)) "+5.000000"
+    test "test5991" (lazy(sprintf "%+1f" 5.0)) "+5.000000"
+    test "test5992" (lazy(sprintf "%+*f" 7 5.0)) "+5.000000"
+    test "test5993" (lazy(sprintf "%+.5f" 5.0)) "+5.00000"
+    test "test5994" (lazy(sprintf "%+.*f" 4 5.0)) "+5.0000"
+    test "test5995" (lazy(sprintf "%+*.*f" 5 4 5.0)) "+5.0000"
+    test "test5996" (lazy(sprintf "%-+f" 5.0)) "+5.000000"
+    test "test5997" (lazy(sprintf "%-+5f" 5.0)) "+5.000000"
+    test "test5998" (lazy(sprintf "%-+1f" 5.0)) "+5.000000"
+    test "test5999" (lazy(sprintf "%-+*f" 7 5.0)) "+5.000000"
+    test "test6000" (lazy(sprintf "%-+.5f" 5.0)) "+5.00000"
+let func6000()=
+    test "test6001" (lazy(sprintf "%-+.*f" 4 5.0)) "+5.0000"
+    test "test6002" (lazy(sprintf "%-+*.*f" 5 4 5.0)) "+5.0000"
+    test "test6003" (lazy(sprintf "%+0f" 5.0)) "+5.000000"
+    test "test6004" (lazy(sprintf "%+05f" 5.0)) "+5.000000"
+    test "test6005" (lazy(sprintf "%+01f" 5.0)) "+5.000000"
+    test "test6006" (lazy(sprintf "%+0*f" 7 5.0)) "+5.000000"
+    test "test6007" (lazy(sprintf "%+0.5f" 5.0)) "+5.00000"
+    test "test6008" (lazy(sprintf "%+0.*f" 4 5.0)) "+5.0000"
+    test "test6009" (lazy(sprintf "%+0*.*f" 5 4 5.0)) "+5.0000"
+    test "test6010" (lazy(sprintf "%-+0f" 5.0)) "+5.000000"
+    test "test6011" (lazy(sprintf "%-+05f" 5.0)) "+5.000000"
+    test "test6012" (lazy(sprintf "%-+01f" 5.0)) "+5.000000"
+    test "test6013" (lazy(sprintf "%-+0*f" 7 5.0)) "+5.000000"
+    test "test6014" (lazy(sprintf "%-+0.5f" 5.0)) "+5.00000"
+    test "test6015" (lazy(sprintf "%-+0.*f" 4 5.0)) "+5.0000"
+    test "test6016" (lazy(sprintf "%-+0*.*f" 5 4 5.0)) "+5.0000"
+    test "test6017" (lazy(sprintf "% f" 5.0)) " 5.000000"
+    test "test6018" (lazy(sprintf "% 5f" 5.0)) " 5.000000"
+    test "test6019" (lazy(sprintf "% 1f" 5.0)) " 5.000000"
+    test "test6020" (lazy(sprintf "% *f" 7 5.0)) " 5.000000"
+    test "test6021" (lazy(sprintf "% .5f" 5.0)) " 5.00000"
+    test "test6022" (lazy(sprintf "% .*f" 4 5.0)) " 5.0000"
+    test "test6023" (lazy(sprintf "% *.*f" 5 4 5.0)) " 5.0000"
+    test "test6024" (lazy(sprintf "%- f" 5.0)) " 5.000000"
+    test "test6025" (lazy(sprintf "%- 5f" 5.0)) " 5.000000"
+    test "test6026" (lazy(sprintf "%- 1f" 5.0)) " 5.000000"
+    test "test6027" (lazy(sprintf "%- *f" 7 5.0)) " 5.000000"
+    test "test6028" (lazy(sprintf "%- .5f" 5.0)) " 5.00000"
+    test "test6029" (lazy(sprintf "%- .*f" 4 5.0)) " 5.0000"
+    test "test6030" (lazy(sprintf "%- *.*f" 5 4 5.0)) " 5.0000"
+    test "test6031" (lazy(sprintf "% 0f" 5.0)) " 5.000000"
+    test "test6032" (lazy(sprintf "% 05f" 5.0)) " 5.000000"
+    test "test6033" (lazy(sprintf "% 01f" 5.0)) " 5.000000"
+    test "test6034" (lazy(sprintf "% 0*f" 7 5.0)) " 5.000000"
+    test "test6035" (lazy(sprintf "% 0.5f" 5.0)) " 5.00000"
+    test "test6036" (lazy(sprintf "% 0.*f" 4 5.0)) " 5.0000"
+    test "test6037" (lazy(sprintf "% 0*.*f" 5 4 5.0)) " 5.0000"
+    test "test6038" (lazy(sprintf "%- 0f" 5.0)) " 5.000000"
+    test "test6039" (lazy(sprintf "%- 05f" 5.0)) " 5.000000"
+    test "test6040" (lazy(sprintf "%- 01f" 5.0)) " 5.000000"
+    test "test6041" (lazy(sprintf "%- 0*f" 7 5.0)) " 5.000000"
+    test "test6042" (lazy(sprintf "%- 0.5f" 5.0)) " 5.00000"
+    test "test6043" (lazy(sprintf "%- 0.*f" 4 5.0)) " 5.0000"
+    test "test6044" (lazy(sprintf "%- 0*.*f" 5 4 5.0)) " 5.0000"
+    test "test6045" (lazy(sprintf "%f" -10.0)) "-10.000000"
+    test "test6046" (lazy(sprintf "%5f" -10.0)) "-10.000000"
+    test "test6047" (lazy(sprintf "%1f" -10.0)) "-10.000000"
+    test "test6048" (lazy(sprintf "%*f" 7 -10.0)) "-10.000000"
+    test "test6049" (lazy(sprintf "%.5f" -10.0)) "-10.00000"
+    test "test6050" (lazy(sprintf "%.*f" 4 -10.0)) "-10.0000"
+    test "test6051" (lazy(sprintf "%*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6052" (lazy(sprintf "%-f" -10.0)) "-10.000000"
+    test "test6053" (lazy(sprintf "%-5f" -10.0)) "-10.000000"
+    test "test6054" (lazy(sprintf "%-1f" -10.0)) "-10.000000"
+    test "test6055" (lazy(sprintf "%-*f" 7 -10.0)) "-10.000000"
+    test "test6056" (lazy(sprintf "%-.5f" -10.0)) "-10.00000"
+    test "test6057" (lazy(sprintf "%-.*f" 4 -10.0)) "-10.0000"
+    test "test6058" (lazy(sprintf "%-*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6059" (lazy(sprintf "%0f" -10.0)) "-10.000000"
+    test "test6060" (lazy(sprintf "%05f" -10.0)) "-10.000000"
+    test "test6061" (lazy(sprintf "%01f" -10.0)) "-10.000000"
+    test "test6062" (lazy(sprintf "%0*f" 7 -10.0)) "-10.000000"
+    test "test6063" (lazy(sprintf "%0.5f" -10.0)) "-10.00000"
+    test "test6064" (lazy(sprintf "%0.*f" 4 -10.0)) "-10.0000"
+    test "test6065" (lazy(sprintf "%0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6066" (lazy(sprintf "%-0f" -10.0)) "-10.000000"
+    test "test6067" (lazy(sprintf "%-05f" -10.0)) "-10.000000"
+    test "test6068" (lazy(sprintf "%-01f" -10.0)) "-10.000000"
+    test "test6069" (lazy(sprintf "%-0*f" 7 -10.0)) "-10.000000"
+    test "test6070" (lazy(sprintf "%-0.5f" -10.0)) "-10.00000"
+    test "test6071" (lazy(sprintf "%-0.*f" 4 -10.0)) "-10.0000"
+    test "test6072" (lazy(sprintf "%-0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6073" (lazy(sprintf "%+f" -10.0)) "-10.000000"
+    test "test6074" (lazy(sprintf "%+5f" -10.0)) "-10.000000"
+    test "test6075" (lazy(sprintf "%+1f" -10.0)) "-10.000000"
+    test "test6076" (lazy(sprintf "%+*f" 7 -10.0)) "-10.000000"
+    test "test6077" (lazy(sprintf "%+.5f" -10.0)) "-10.00000"
+    test "test6078" (lazy(sprintf "%+.*f" 4 -10.0)) "-10.0000"
+    test "test6079" (lazy(sprintf "%+*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6080" (lazy(sprintf "%-+f" -10.0)) "-10.000000"
+    test "test6081" (lazy(sprintf "%-+5f" -10.0)) "-10.000000"
+    test "test6082" (lazy(sprintf "%-+1f" -10.0)) "-10.000000"
+    test "test6083" (lazy(sprintf "%-+*f" 7 -10.0)) "-10.000000"
+    test "test6084" (lazy(sprintf "%-+.5f" -10.0)) "-10.00000"
+    test "test6085" (lazy(sprintf "%-+.*f" 4 -10.0)) "-10.0000"
+    test "test6086" (lazy(sprintf "%-+*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6087" (lazy(sprintf "%+0f" -10.0)) "-10.000000"
+    test "test6088" (lazy(sprintf "%+05f" -10.0)) "-10.000000"
+    test "test6089" (lazy(sprintf "%+01f" -10.0)) "-10.000000"
+    test "test6090" (lazy(sprintf "%+0*f" 7 -10.0)) "-10.000000"
+    test "test6091" (lazy(sprintf "%+0.5f" -10.0)) "-10.00000"
+    test "test6092" (lazy(sprintf "%+0.*f" 4 -10.0)) "-10.0000"
+    test "test6093" (lazy(sprintf "%+0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6094" (lazy(sprintf "%-+0f" -10.0)) "-10.000000"
+    test "test6095" (lazy(sprintf "%-+05f" -10.0)) "-10.000000"
+    test "test6096" (lazy(sprintf "%-+01f" -10.0)) "-10.000000"
+    test "test6097" (lazy(sprintf "%-+0*f" 7 -10.0)) "-10.000000"
+    test "test6098" (lazy(sprintf "%-+0.5f" -10.0)) "-10.00000"
+    test "test6099" (lazy(sprintf "%-+0.*f" 4 -10.0)) "-10.0000"
+    test "test6100" (lazy(sprintf "%-+0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6101" (lazy(sprintf "% f" -10.0)) "-10.000000"
+    test "test6102" (lazy(sprintf "% 5f" -10.0)) "-10.000000"
+    test "test6103" (lazy(sprintf "% 1f" -10.0)) "-10.000000"
+    test "test6104" (lazy(sprintf "% *f" 7 -10.0)) "-10.000000"
+    test "test6105" (lazy(sprintf "% .5f" -10.0)) "-10.00000"
+    test "test6106" (lazy(sprintf "% .*f" 4 -10.0)) "-10.0000"
+    test "test6107" (lazy(sprintf "% *.*f" 5 4 -10.0)) "-10.0000"
+    test "test6108" (lazy(sprintf "%- f" -10.0)) "-10.000000"
+    test "test6109" (lazy(sprintf "%- 5f" -10.0)) "-10.000000"
+    test "test6110" (lazy(sprintf "%- 1f" -10.0)) "-10.000000"
+    test "test6111" (lazy(sprintf "%- *f" 7 -10.0)) "-10.000000"
+    test "test6112" (lazy(sprintf "%- .5f" -10.0)) "-10.00000"
+    test "test6113" (lazy(sprintf "%- .*f" 4 -10.0)) "-10.0000"
+    test "test6114" (lazy(sprintf "%- *.*f" 5 4 -10.0)) "-10.0000"
+    test "test6115" (lazy(sprintf "% 0f" -10.0)) "-10.000000"
+    test "test6116" (lazy(sprintf "% 05f" -10.0)) "-10.000000"
+    test "test6117" (lazy(sprintf "% 01f" -10.0)) "-10.000000"
+    test "test6118" (lazy(sprintf "% 0*f" 7 -10.0)) "-10.000000"
+    test "test6119" (lazy(sprintf "% 0.5f" -10.0)) "-10.00000"
+    test "test6120" (lazy(sprintf "% 0.*f" 4 -10.0)) "-10.0000"
+    test "test6121" (lazy(sprintf "% 0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6122" (lazy(sprintf "%- 0f" -10.0)) "-10.000000"
+    test "test6123" (lazy(sprintf "%- 05f" -10.0)) "-10.000000"
+    test "test6124" (lazy(sprintf "%- 01f" -10.0)) "-10.000000"
+    test "test6125" (lazy(sprintf "%- 0*f" 7 -10.0)) "-10.000000"
+    test "test6126" (lazy(sprintf "%- 0.5f" -10.0)) "-10.00000"
+    test "test6127" (lazy(sprintf "%- 0.*f" 4 -10.0)) "-10.0000"
+    test "test6128" (lazy(sprintf "%- 0*.*f" 5 4 -10.0)) "-10.0000"
+    test "test6129" (lazy(sprintf "%f" 5.0f)) "5.000000"
+    test "test6130" (lazy(sprintf "%5f" 5.0f)) "5.000000"
+    test "test6131" (lazy(sprintf "%1f" 5.0f)) "5.000000"
+    test "test6132" (lazy(sprintf "%*f" 7 5.0f)) "5.000000"
+    test "test6133" (lazy(sprintf "%.5f" 5.0f)) "5.00000"
+    test "test6134" (lazy(sprintf "%.*f" 4 5.0f)) "5.0000"
+    test "test6135" (lazy(sprintf "%*.*f" 5 4 5.0f)) "5.0000"
+    test "test6136" (lazy(sprintf "%-f" 5.0f)) "5.000000"
+    test "test6137" (lazy(sprintf "%-5f" 5.0f)) "5.000000"
+    test "test6138" (lazy(sprintf "%-1f" 5.0f)) "5.000000"
+    test "test6139" (lazy(sprintf "%-*f" 7 5.0f)) "5.000000"
+    test "test6140" (lazy(sprintf "%-.5f" 5.0f)) "5.00000"
+    test "test6141" (lazy(sprintf "%-.*f" 4 5.0f)) "5.0000"
+    test "test6142" (lazy(sprintf "%-*.*f" 5 4 5.0f)) "5.0000"
+    test "test6143" (lazy(sprintf "%0f" 5.0f)) "5.000000"
+    test "test6144" (lazy(sprintf "%05f" 5.0f)) "5.000000"
+    test "test6145" (lazy(sprintf "%01f" 5.0f)) "5.000000"
+    test "test6146" (lazy(sprintf "%0*f" 7 5.0f)) "5.000000"
+    test "test6147" (lazy(sprintf "%0.5f" 5.0f)) "5.00000"
+    test "test6148" (lazy(sprintf "%0.*f" 4 5.0f)) "5.0000"
+    test "test6149" (lazy(sprintf "%0*.*f" 5 4 5.0f)) "5.0000"
+    test "test6150" (lazy(sprintf "%-0f" 5.0f)) "5.000000"
+    test "test6151" (lazy(sprintf "%-05f" 5.0f)) "5.000000"
+    test "test6152" (lazy(sprintf "%-01f" 5.0f)) "5.000000"
+    test "test6153" (lazy(sprintf "%-0*f" 7 5.0f)) "5.000000"
+    test "test6154" (lazy(sprintf "%-0.5f" 5.0f)) "5.00000"
+    test "test6155" (lazy(sprintf "%-0.*f" 4 5.0f)) "5.0000"
+    test "test6156" (lazy(sprintf "%-0*.*f" 5 4 5.0f)) "5.0000"
+    test "test6157" (lazy(sprintf "%+f" 5.0f)) "+5.000000"
+    test "test6158" (lazy(sprintf "%+5f" 5.0f)) "+5.000000"
+    test "test6159" (lazy(sprintf "%+1f" 5.0f)) "+5.000000"
+    test "test6160" (lazy(sprintf "%+*f" 7 5.0f)) "+5.000000"
+    test "test6161" (lazy(sprintf "%+.5f" 5.0f)) "+5.00000"
+    test "test6162" (lazy(sprintf "%+.*f" 4 5.0f)) "+5.0000"
+    test "test6163" (lazy(sprintf "%+*.*f" 5 4 5.0f)) "+5.0000"
+    test "test6164" (lazy(sprintf "%-+f" 5.0f)) "+5.000000"
+    test "test6165" (lazy(sprintf "%-+5f" 5.0f)) "+5.000000"
+    test "test6166" (lazy(sprintf "%-+1f" 5.0f)) "+5.000000"
+    test "test6167" (lazy(sprintf "%-+*f" 7 5.0f)) "+5.000000"
+    test "test6168" (lazy(sprintf "%-+.5f" 5.0f)) "+5.00000"
+    test "test6169" (lazy(sprintf "%-+.*f" 4 5.0f)) "+5.0000"
+    test "test6170" (lazy(sprintf "%-+*.*f" 5 4 5.0f)) "+5.0000"
+    test "test6171" (lazy(sprintf "%+0f" 5.0f)) "+5.000000"
+    test "test6172" (lazy(sprintf "%+05f" 5.0f)) "+5.000000"
+    test "test6173" (lazy(sprintf "%+01f" 5.0f)) "+5.000000"
+    test "test6174" (lazy(sprintf "%+0*f" 7 5.0f)) "+5.000000"
+    test "test6175" (lazy(sprintf "%+0.5f" 5.0f)) "+5.00000"
+    test "test6176" (lazy(sprintf "%+0.*f" 4 5.0f)) "+5.0000"
+    test "test6177" (lazy(sprintf "%+0*.*f" 5 4 5.0f)) "+5.0000"
+    test "test6178" (lazy(sprintf "%-+0f" 5.0f)) "+5.000000"
+    test "test6179" (lazy(sprintf "%-+05f" 5.0f)) "+5.000000"
+    test "test6180" (lazy(sprintf "%-+01f" 5.0f)) "+5.000000"
+    test "test6181" (lazy(sprintf "%-+0*f" 7 5.0f)) "+5.000000"
+    test "test6182" (lazy(sprintf "%-+0.5f" 5.0f)) "+5.00000"
+    test "test6183" (lazy(sprintf "%-+0.*f" 4 5.0f)) "+5.0000"
+    test "test6184" (lazy(sprintf "%-+0*.*f" 5 4 5.0f)) "+5.0000"
+    test "test6185" (lazy(sprintf "% f" 5.0f)) " 5.000000"
+    test "test6186" (lazy(sprintf "% 5f" 5.0f)) " 5.000000"
+    test "test6187" (lazy(sprintf "% 1f" 5.0f)) " 5.000000"
+    test "test6188" (lazy(sprintf "% *f" 7 5.0f)) " 5.000000"
+    test "test6189" (lazy(sprintf "% .5f" 5.0f)) " 5.00000"
+    test "test6190" (lazy(sprintf "% .*f" 4 5.0f)) " 5.0000"
+    test "test6191" (lazy(sprintf "% *.*f" 5 4 5.0f)) " 5.0000"
+    test "test6192" (lazy(sprintf "%- f" 5.0f)) " 5.000000"
+    test "test6193" (lazy(sprintf "%- 5f" 5.0f)) " 5.000000"
+    test "test6194" (lazy(sprintf "%- 1f" 5.0f)) " 5.000000"
+    test "test6195" (lazy(sprintf "%- *f" 7 5.0f)) " 5.000000"
+    test "test6196" (lazy(sprintf "%- .5f" 5.0f)) " 5.00000"
+    test "test6197" (lazy(sprintf "%- .*f" 4 5.0f)) " 5.0000"
+    test "test6198" (lazy(sprintf "%- *.*f" 5 4 5.0f)) " 5.0000"
+    test "test6199" (lazy(sprintf "% 0f" 5.0f)) " 5.000000"
+    test "test6200" (lazy(sprintf "% 05f" 5.0f)) " 5.000000"
+    test "test6201" (lazy(sprintf "% 01f" 5.0f)) " 5.000000"
+    test "test6202" (lazy(sprintf "% 0*f" 7 5.0f)) " 5.000000"
+    test "test6203" (lazy(sprintf "% 0.5f" 5.0f)) " 5.00000"
+    test "test6204" (lazy(sprintf "% 0.*f" 4 5.0f)) " 5.0000"
+    test "test6205" (lazy(sprintf "% 0*.*f" 5 4 5.0f)) " 5.0000"
+    test "test6206" (lazy(sprintf "%- 0f" 5.0f)) " 5.000000"
+    test "test6207" (lazy(sprintf "%- 05f" 5.0f)) " 5.000000"
+    test "test6208" (lazy(sprintf "%- 01f" 5.0f)) " 5.000000"
+    test "test6209" (lazy(sprintf "%- 0*f" 7 5.0f)) " 5.000000"
+    test "test6210" (lazy(sprintf "%- 0.5f" 5.0f)) " 5.00000"
+    test "test6211" (lazy(sprintf "%- 0.*f" 4 5.0f)) " 5.0000"
+    test "test6212" (lazy(sprintf "%- 0*.*f" 5 4 5.0f)) " 5.0000"
+    test "test6213" (lazy(sprintf "%f" -10.0f)) "-10.000000"
+    test "test6214" (lazy(sprintf "%5f" -10.0f)) "-10.000000"
+    test "test6215" (lazy(sprintf "%1f" -10.0f)) "-10.000000"
+    test "test6216" (lazy(sprintf "%*f" 7 -10.0f)) "-10.000000"
+    test "test6217" (lazy(sprintf "%.5f" -10.0f)) "-10.00000"
+    test "test6218" (lazy(sprintf "%.*f" 4 -10.0f)) "-10.0000"
+    test "test6219" (lazy(sprintf "%*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6220" (lazy(sprintf "%-f" -10.0f)) "-10.000000"
+    test "test6221" (lazy(sprintf "%-5f" -10.0f)) "-10.000000"
+    test "test6222" (lazy(sprintf "%-1f" -10.0f)) "-10.000000"
+    test "test6223" (lazy(sprintf "%-*f" 7 -10.0f)) "-10.000000"
+    test "test6224" (lazy(sprintf "%-.5f" -10.0f)) "-10.00000"
+    test "test6225" (lazy(sprintf "%-.*f" 4 -10.0f)) "-10.0000"
+    test "test6226" (lazy(sprintf "%-*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6227" (lazy(sprintf "%0f" -10.0f)) "-10.000000"
+    test "test6228" (lazy(sprintf "%05f" -10.0f)) "-10.000000"
+    test "test6229" (lazy(sprintf "%01f" -10.0f)) "-10.000000"
+    test "test6230" (lazy(sprintf "%0*f" 7 -10.0f)) "-10.000000"
+    test "test6231" (lazy(sprintf "%0.5f" -10.0f)) "-10.00000"
+    test "test6232" (lazy(sprintf "%0.*f" 4 -10.0f)) "-10.0000"
+    test "test6233" (lazy(sprintf "%0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6234" (lazy(sprintf "%-0f" -10.0f)) "-10.000000"
+    test "test6235" (lazy(sprintf "%-05f" -10.0f)) "-10.000000"
+    test "test6236" (lazy(sprintf "%-01f" -10.0f)) "-10.000000"
+    test "test6237" (lazy(sprintf "%-0*f" 7 -10.0f)) "-10.000000"
+    test "test6238" (lazy(sprintf "%-0.5f" -10.0f)) "-10.00000"
+    test "test6239" (lazy(sprintf "%-0.*f" 4 -10.0f)) "-10.0000"
+    test "test6240" (lazy(sprintf "%-0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6241" (lazy(sprintf "%+f" -10.0f)) "-10.000000"
+    test "test6242" (lazy(sprintf "%+5f" -10.0f)) "-10.000000"
+    test "test6243" (lazy(sprintf "%+1f" -10.0f)) "-10.000000"
+    test "test6244" (lazy(sprintf "%+*f" 7 -10.0f)) "-10.000000"
+    test "test6245" (lazy(sprintf "%+.5f" -10.0f)) "-10.00000"
+    test "test6246" (lazy(sprintf "%+.*f" 4 -10.0f)) "-10.0000"
+    test "test6247" (lazy(sprintf "%+*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6248" (lazy(sprintf "%-+f" -10.0f)) "-10.000000"
+    test "test6249" (lazy(sprintf "%-+5f" -10.0f)) "-10.000000"
+    test "test6250" (lazy(sprintf "%-+1f" -10.0f)) "-10.000000"
+    test "test6251" (lazy(sprintf "%-+*f" 7 -10.0f)) "-10.000000"
+    test "test6252" (lazy(sprintf "%-+.5f" -10.0f)) "-10.00000"
+    test "test6253" (lazy(sprintf "%-+.*f" 4 -10.0f)) "-10.0000"
+    test "test6254" (lazy(sprintf "%-+*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6255" (lazy(sprintf "%+0f" -10.0f)) "-10.000000"
+    test "test6256" (lazy(sprintf "%+05f" -10.0f)) "-10.000000"
+    test "test6257" (lazy(sprintf "%+01f" -10.0f)) "-10.000000"
+    test "test6258" (lazy(sprintf "%+0*f" 7 -10.0f)) "-10.000000"
+    test "test6259" (lazy(sprintf "%+0.5f" -10.0f)) "-10.00000"
+    test "test6260" (lazy(sprintf "%+0.*f" 4 -10.0f)) "-10.0000"
+    test "test6261" (lazy(sprintf "%+0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6262" (lazy(sprintf "%-+0f" -10.0f)) "-10.000000"
+    test "test6263" (lazy(sprintf "%-+05f" -10.0f)) "-10.000000"
+    test "test6264" (lazy(sprintf "%-+01f" -10.0f)) "-10.000000"
+    test "test6265" (lazy(sprintf "%-+0*f" 7 -10.0f)) "-10.000000"
+    test "test6266" (lazy(sprintf "%-+0.5f" -10.0f)) "-10.00000"
+    test "test6267" (lazy(sprintf "%-+0.*f" 4 -10.0f)) "-10.0000"
+    test "test6268" (lazy(sprintf "%-+0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6269" (lazy(sprintf "% f" -10.0f)) "-10.000000"
+    test "test6270" (lazy(sprintf "% 5f" -10.0f)) "-10.000000"
+    test "test6271" (lazy(sprintf "% 1f" -10.0f)) "-10.000000"
+    test "test6272" (lazy(sprintf "% *f" 7 -10.0f)) "-10.000000"
+    test "test6273" (lazy(sprintf "% .5f" -10.0f)) "-10.00000"
+    test "test6274" (lazy(sprintf "% .*f" 4 -10.0f)) "-10.0000"
+    test "test6275" (lazy(sprintf "% *.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6276" (lazy(sprintf "%- f" -10.0f)) "-10.000000"
+    test "test6277" (lazy(sprintf "%- 5f" -10.0f)) "-10.000000"
+    test "test6278" (lazy(sprintf "%- 1f" -10.0f)) "-10.000000"
+    test "test6279" (lazy(sprintf "%- *f" 7 -10.0f)) "-10.000000"
+    test "test6280" (lazy(sprintf "%- .5f" -10.0f)) "-10.00000"
+    test "test6281" (lazy(sprintf "%- .*f" 4 -10.0f)) "-10.0000"
+    test "test6282" (lazy(sprintf "%- *.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6283" (lazy(sprintf "% 0f" -10.0f)) "-10.000000"
+    test "test6284" (lazy(sprintf "% 05f" -10.0f)) "-10.000000"
+    test "test6285" (lazy(sprintf "% 01f" -10.0f)) "-10.000000"
+    test "test6286" (lazy(sprintf "% 0*f" 7 -10.0f)) "-10.000000"
+    test "test6287" (lazy(sprintf "% 0.5f" -10.0f)) "-10.00000"
+    test "test6288" (lazy(sprintf "% 0.*f" 4 -10.0f)) "-10.0000"
+    test "test6289" (lazy(sprintf "% 0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6290" (lazy(sprintf "%- 0f" -10.0f)) "-10.000000"
+    test "test6291" (lazy(sprintf "%- 05f" -10.0f)) "-10.000000"
+    test "test6292" (lazy(sprintf "%- 01f" -10.0f)) "-10.000000"
+    test "test6293" (lazy(sprintf "%- 0*f" 7 -10.0f)) "-10.000000"
+    test "test6294" (lazy(sprintf "%- 0.5f" -10.0f)) "-10.00000"
+    test "test6295" (lazy(sprintf "%- 0.*f" 4 -10.0f)) "-10.0000"
+    test "test6296" (lazy(sprintf "%- 0*.*f" 5 4 -10.0f)) "-10.0000"
+    test "test6297" (lazy(sprintf "%f" 5.0M)) "5.000000"
+    test "test6298" (lazy(sprintf "%5f" 5.0M)) "5.000000"
+    test "test6299" (lazy(sprintf "%1f" 5.0M)) "5.000000"
+    test "test6300" (lazy(sprintf "%*f" 7 5.0M)) "5.000000"
+    test "test6301" (lazy(sprintf "%.5f" 5.0M)) "5.00000"
+    test "test6302" (lazy(sprintf "%.*f" 4 5.0M)) "5.0000"
+    test "test6303" (lazy(sprintf "%*.*f" 5 4 5.0M)) "5.0000"
+    test "test6304" (lazy(sprintf "%-f" 5.0M)) "5.000000"
+    test "test6305" (lazy(sprintf "%-5f" 5.0M)) "5.000000"
+    test "test6306" (lazy(sprintf "%-1f" 5.0M)) "5.000000"
+    test "test6307" (lazy(sprintf "%-*f" 7 5.0M)) "5.000000"
+    test "test6308" (lazy(sprintf "%-.5f" 5.0M)) "5.00000"
+    test "test6309" (lazy(sprintf "%-.*f" 4 5.0M)) "5.0000"
+    test "test6310" (lazy(sprintf "%-*.*f" 5 4 5.0M)) "5.0000"
+    test "test6311" (lazy(sprintf "%0f" 5.0M)) "5.000000"
+    test "test6312" (lazy(sprintf "%05f" 5.0M)) "5.000000"
+    test "test6313" (lazy(sprintf "%01f" 5.0M)) "5.000000"
+    test "test6314" (lazy(sprintf "%0*f" 7 5.0M)) "5.000000"
+    test "test6315" (lazy(sprintf "%0.5f" 5.0M)) "5.00000"
+    test "test6316" (lazy(sprintf "%0.*f" 4 5.0M)) "5.0000"
+    test "test6317" (lazy(sprintf "%0*.*f" 5 4 5.0M)) "5.0000"
+    test "test6318" (lazy(sprintf "%-0f" 5.0M)) "5.000000"
+    test "test6319" (lazy(sprintf "%-05f" 5.0M)) "5.000000"
+    test "test6320" (lazy(sprintf "%-01f" 5.0M)) "5.000000"
+    test "test6321" (lazy(sprintf "%-0*f" 7 5.0M)) "5.000000"
+    test "test6322" (lazy(sprintf "%-0.5f" 5.0M)) "5.00000"
+    test "test6323" (lazy(sprintf "%-0.*f" 4 5.0M)) "5.0000"
+    test "test6324" (lazy(sprintf "%-0*.*f" 5 4 5.0M)) "5.0000"
+    test "test6325" (lazy(sprintf "%+f" 5.0M)) "+5.000000"
+    test "test6326" (lazy(sprintf "%+5f" 5.0M)) "+5.000000"
+    test "test6327" (lazy(sprintf "%+1f" 5.0M)) "+5.000000"
+    test "test6328" (lazy(sprintf "%+*f" 7 5.0M)) "+5.000000"
+    test "test6329" (lazy(sprintf "%+.5f" 5.0M)) "+5.00000"
+    test "test6330" (lazy(sprintf "%+.*f" 4 5.0M)) "+5.0000"
+    test "test6331" (lazy(sprintf "%+*.*f" 5 4 5.0M)) "+5.0000"
+    test "test6332" (lazy(sprintf "%-+f" 5.0M)) "+5.000000"
+    test "test6333" (lazy(sprintf "%-+5f" 5.0M)) "+5.000000"
+    test "test6334" (lazy(sprintf "%-+1f" 5.0M)) "+5.000000"
+    test "test6335" (lazy(sprintf "%-+*f" 7 5.0M)) "+5.000000"
+    test "test6336" (lazy(sprintf "%-+.5f" 5.0M)) "+5.00000"
+    test "test6337" (lazy(sprintf "%-+.*f" 4 5.0M)) "+5.0000"
+    test "test6338" (lazy(sprintf "%-+*.*f" 5 4 5.0M)) "+5.0000"
+    test "test6339" (lazy(sprintf "%+0f" 5.0M)) "+5.000000"
+    test "test6340" (lazy(sprintf "%+05f" 5.0M)) "+5.000000"
+    test "test6341" (lazy(sprintf "%+01f" 5.0M)) "+5.000000"
+    test "test6342" (lazy(sprintf "%+0*f" 7 5.0M)) "+5.000000"
+    test "test6343" (lazy(sprintf "%+0.5f" 5.0M)) "+5.00000"
+    test "test6344" (lazy(sprintf "%+0.*f" 4 5.0M)) "+5.0000"
+    test "test6345" (lazy(sprintf "%+0*.*f" 5 4 5.0M)) "+5.0000"
+    test "test6346" (lazy(sprintf "%-+0f" 5.0M)) "+5.000000"
+    test "test6347" (lazy(sprintf "%-+05f" 5.0M)) "+5.000000"
+    test "test6348" (lazy(sprintf "%-+01f" 5.0M)) "+5.000000"
+    test "test6349" (lazy(sprintf "%-+0*f" 7 5.0M)) "+5.000000"
+    test "test6350" (lazy(sprintf "%-+0.5f" 5.0M)) "+5.00000"
+    test "test6351" (lazy(sprintf "%-+0.*f" 4 5.0M)) "+5.0000"
+    test "test6352" (lazy(sprintf "%-+0*.*f" 5 4 5.0M)) "+5.0000"
+    test "test6353" (lazy(sprintf "% f" 5.0M)) " 5.000000"
+    test "test6354" (lazy(sprintf "% 5f" 5.0M)) " 5.000000"
+    test "test6355" (lazy(sprintf "% 1f" 5.0M)) " 5.000000"
+    test "test6356" (lazy(sprintf "% *f" 7 5.0M)) " 5.000000"
+    test "test6357" (lazy(sprintf "% .5f" 5.0M)) " 5.00000"
+    test "test6358" (lazy(sprintf "% .*f" 4 5.0M)) " 5.0000"
+    test "test6359" (lazy(sprintf "% *.*f" 5 4 5.0M)) " 5.0000"
+    test "test6360" (lazy(sprintf "%- f" 5.0M)) " 5.000000"
+    test "test6361" (lazy(sprintf "%- 5f" 5.0M)) " 5.000000"
+    test "test6362" (lazy(sprintf "%- 1f" 5.0M)) " 5.000000"
+    test "test6363" (lazy(sprintf "%- *f" 7 5.0M)) " 5.000000"
+    test "test6364" (lazy(sprintf "%- .5f" 5.0M)) " 5.00000"
+    test "test6365" (lazy(sprintf "%- .*f" 4 5.0M)) " 5.0000"
+    test "test6366" (lazy(sprintf "%- *.*f" 5 4 5.0M)) " 5.0000"
+    test "test6367" (lazy(sprintf "% 0f" 5.0M)) " 5.000000"
+    test "test6368" (lazy(sprintf "% 05f" 5.0M)) " 5.000000"
+    test "test6369" (lazy(sprintf "% 01f" 5.0M)) " 5.000000"
+    test "test6370" (lazy(sprintf "% 0*f" 7 5.0M)) " 5.000000"
+    test "test6371" (lazy(sprintf "% 0.5f" 5.0M)) " 5.00000"
+    test "test6372" (lazy(sprintf "% 0.*f" 4 5.0M)) " 5.0000"
+    test "test6373" (lazy(sprintf "% 0*.*f" 5 4 5.0M)) " 5.0000"
+    test "test6374" (lazy(sprintf "%- 0f" 5.0M)) " 5.000000"
+    test "test6375" (lazy(sprintf "%- 05f" 5.0M)) " 5.000000"
+    test "test6376" (lazy(sprintf "%- 01f" 5.0M)) " 5.000000"
+    test "test6377" (lazy(sprintf "%- 0*f" 7 5.0M)) " 5.000000"
+    test "test6378" (lazy(sprintf "%- 0.5f" 5.0M)) " 5.00000"
+    test "test6379" (lazy(sprintf "%- 0.*f" 4 5.0M)) " 5.0000"
+    test "test6380" (lazy(sprintf "%- 0*.*f" 5 4 5.0M)) " 5.0000"
+    test "test6381" (lazy(sprintf "%f" -10.0M)) "-10.000000"
+    test "test6382" (lazy(sprintf "%5f" -10.0M)) "-10.000000"
+    test "test6383" (lazy(sprintf "%1f" -10.0M)) "-10.000000"
+    test "test6384" (lazy(sprintf "%*f" 7 -10.0M)) "-10.000000"
+    test "test6385" (lazy(sprintf "%.5f" -10.0M)) "-10.00000"
+    test "test6386" (lazy(sprintf "%.*f" 4 -10.0M)) "-10.0000"
+    test "test6387" (lazy(sprintf "%*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6388" (lazy(sprintf "%-f" -10.0M)) "-10.000000"
+    test "test6389" (lazy(sprintf "%-5f" -10.0M)) "-10.000000"
+    test "test6390" (lazy(sprintf "%-1f" -10.0M)) "-10.000000"
+    test "test6391" (lazy(sprintf "%-*f" 7 -10.0M)) "-10.000000"
+    test "test6392" (lazy(sprintf "%-.5f" -10.0M)) "-10.00000"
+    test "test6393" (lazy(sprintf "%-.*f" 4 -10.0M)) "-10.0000"
+    test "test6394" (lazy(sprintf "%-*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6395" (lazy(sprintf "%0f" -10.0M)) "-10.000000"
+    test "test6396" (lazy(sprintf "%05f" -10.0M)) "-10.000000"
+    test "test6397" (lazy(sprintf "%01f" -10.0M)) "-10.000000"
+    test "test6398" (lazy(sprintf "%0*f" 7 -10.0M)) "-10.000000"
+    test "test6399" (lazy(sprintf "%0.5f" -10.0M)) "-10.00000"
+    test "test6400" (lazy(sprintf "%0.*f" 4 -10.0M)) "-10.0000"
+    test "test6401" (lazy(sprintf "%0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6402" (lazy(sprintf "%-0f" -10.0M)) "-10.000000"
+    test "test6403" (lazy(sprintf "%-05f" -10.0M)) "-10.000000"
+    test "test6404" (lazy(sprintf "%-01f" -10.0M)) "-10.000000"
+    test "test6405" (lazy(sprintf "%-0*f" 7 -10.0M)) "-10.000000"
+    test "test6406" (lazy(sprintf "%-0.5f" -10.0M)) "-10.00000"
+    test "test6407" (lazy(sprintf "%-0.*f" 4 -10.0M)) "-10.0000"
+    test "test6408" (lazy(sprintf "%-0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6409" (lazy(sprintf "%+f" -10.0M)) "-10.000000"
+    test "test6410" (lazy(sprintf "%+5f" -10.0M)) "-10.000000"
+    test "test6411" (lazy(sprintf "%+1f" -10.0M)) "-10.000000"
+    test "test6412" (lazy(sprintf "%+*f" 7 -10.0M)) "-10.000000"
+    test "test6413" (lazy(sprintf "%+.5f" -10.0M)) "-10.00000"
+    test "test6414" (lazy(sprintf "%+.*f" 4 -10.0M)) "-10.0000"
+    test "test6415" (lazy(sprintf "%+*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6416" (lazy(sprintf "%-+f" -10.0M)) "-10.000000"
+    test "test6417" (lazy(sprintf "%-+5f" -10.0M)) "-10.000000"
+    test "test6418" (lazy(sprintf "%-+1f" -10.0M)) "-10.000000"
+    test "test6419" (lazy(sprintf "%-+*f" 7 -10.0M)) "-10.000000"
+    test "test6420" (lazy(sprintf "%-+.5f" -10.0M)) "-10.00000"
+    test "test6421" (lazy(sprintf "%-+.*f" 4 -10.0M)) "-10.0000"
+    test "test6422" (lazy(sprintf "%-+*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6423" (lazy(sprintf "%+0f" -10.0M)) "-10.000000"
+    test "test6424" (lazy(sprintf "%+05f" -10.0M)) "-10.000000"
+    test "test6425" (lazy(sprintf "%+01f" -10.0M)) "-10.000000"
+    test "test6426" (lazy(sprintf "%+0*f" 7 -10.0M)) "-10.000000"
+    test "test6427" (lazy(sprintf "%+0.5f" -10.0M)) "-10.00000"
+    test "test6428" (lazy(sprintf "%+0.*f" 4 -10.0M)) "-10.0000"
+    test "test6429" (lazy(sprintf "%+0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6430" (lazy(sprintf "%-+0f" -10.0M)) "-10.000000"
+    test "test6431" (lazy(sprintf "%-+05f" -10.0M)) "-10.000000"
+    test "test6432" (lazy(sprintf "%-+01f" -10.0M)) "-10.000000"
+    test "test6433" (lazy(sprintf "%-+0*f" 7 -10.0M)) "-10.000000"
+    test "test6434" (lazy(sprintf "%-+0.5f" -10.0M)) "-10.00000"
+    test "test6435" (lazy(sprintf "%-+0.*f" 4 -10.0M)) "-10.0000"
+    test "test6436" (lazy(sprintf "%-+0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6437" (lazy(sprintf "% f" -10.0M)) "-10.000000"
+    test "test6438" (lazy(sprintf "% 5f" -10.0M)) "-10.000000"
+    test "test6439" (lazy(sprintf "% 1f" -10.0M)) "-10.000000"
+    test "test6440" (lazy(sprintf "% *f" 7 -10.0M)) "-10.000000"
+    test "test6441" (lazy(sprintf "% .5f" -10.0M)) "-10.00000"
+    test "test6442" (lazy(sprintf "% .*f" 4 -10.0M)) "-10.0000"
+    test "test6443" (lazy(sprintf "% *.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6444" (lazy(sprintf "%- f" -10.0M)) "-10.000000"
+    test "test6445" (lazy(sprintf "%- 5f" -10.0M)) "-10.000000"
+    test "test6446" (lazy(sprintf "%- 1f" -10.0M)) "-10.000000"
+    test "test6447" (lazy(sprintf "%- *f" 7 -10.0M)) "-10.000000"
+    test "test6448" (lazy(sprintf "%- .5f" -10.0M)) "-10.00000"
+    test "test6449" (lazy(sprintf "%- .*f" 4 -10.0M)) "-10.0000"
+    test "test6450" (lazy(sprintf "%- *.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6451" (lazy(sprintf "% 0f" -10.0M)) "-10.000000"
+    test "test6452" (lazy(sprintf "% 05f" -10.0M)) "-10.000000"
+    test "test6453" (lazy(sprintf "% 01f" -10.0M)) "-10.000000"
+    test "test6454" (lazy(sprintf "% 0*f" 7 -10.0M)) "-10.000000"
+    test "test6455" (lazy(sprintf "% 0.5f" -10.0M)) "-10.00000"
+    test "test6456" (lazy(sprintf "% 0.*f" 4 -10.0M)) "-10.0000"
+    test "test6457" (lazy(sprintf "% 0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6458" (lazy(sprintf "%- 0f" -10.0M)) "-10.000000"
+    test "test6459" (lazy(sprintf "%- 05f" -10.0M)) "-10.000000"
+    test "test6460" (lazy(sprintf "%- 01f" -10.0M)) "-10.000000"
+    test "test6461" (lazy(sprintf "%- 0*f" 7 -10.0M)) "-10.000000"
+    test "test6462" (lazy(sprintf "%- 0.5f" -10.0M)) "-10.00000"
+    test "test6463" (lazy(sprintf "%- 0.*f" 4 -10.0M)) "-10.0000"
+    test "test6464" (lazy(sprintf "%- 0*.*f" 5 4 -10.0M)) "-10.0000"
+    test "test6465" (lazy(sprintf "%F" 5.0)) "5.000000"
+    test "test6466" (lazy(sprintf "%5F" 5.0)) "5.000000"
+    test "test6467" (lazy(sprintf "%1F" 5.0)) "5.000000"
+    test "test6468" (lazy(sprintf "%*F" 7 5.0)) "5.000000"
+    test "test6469" (lazy(sprintf "%.5F" 5.0)) "5.00000"
+    test "test6470" (lazy(sprintf "%.*F" 4 5.0)) "5.0000"
+    test "test6471" (lazy(sprintf "%*.*F" 5 4 5.0)) "5.0000"
+    test "test6472" (lazy(sprintf "%-F" 5.0)) "5.000000"
+    test "test6473" (lazy(sprintf "%-5F" 5.0)) "5.000000"
+    test "test6474" (lazy(sprintf "%-1F" 5.0)) "5.000000"
+    test "test6475" (lazy(sprintf "%-*F" 7 5.0)) "5.000000"
+    test "test6476" (lazy(sprintf "%-.5F" 5.0)) "5.00000"
+    test "test6477" (lazy(sprintf "%-.*F" 4 5.0)) "5.0000"
+    test "test6478" (lazy(sprintf "%-*.*F" 5 4 5.0)) "5.0000"
+    test "test6479" (lazy(sprintf "%0F" 5.0)) "5.000000"
+    test "test6480" (lazy(sprintf "%05F" 5.0)) "5.000000"
+    test "test6481" (lazy(sprintf "%01F" 5.0)) "5.000000"
+    test "test6482" (lazy(sprintf "%0*F" 7 5.0)) "5.000000"
+    test "test6483" (lazy(sprintf "%0.5F" 5.0)) "5.00000"
+    test "test6484" (lazy(sprintf "%0.*F" 4 5.0)) "5.0000"
+    test "test6485" (lazy(sprintf "%0*.*F" 5 4 5.0)) "5.0000"
+    test "test6486" (lazy(sprintf "%-0F" 5.0)) "5.000000"
+    test "test6487" (lazy(sprintf "%-05F" 5.0)) "5.000000"
+    test "test6488" (lazy(sprintf "%-01F" 5.0)) "5.000000"
+    test "test6489" (lazy(sprintf "%-0*F" 7 5.0)) "5.000000"
+    test "test6490" (lazy(sprintf "%-0.5F" 5.0)) "5.00000"
+    test "test6491" (lazy(sprintf "%-0.*F" 4 5.0)) "5.0000"
+    test "test6492" (lazy(sprintf "%-0*.*F" 5 4 5.0)) "5.0000"
+    test "test6493" (lazy(sprintf "%+F" 5.0)) "+5.000000"
+    test "test6494" (lazy(sprintf "%+5F" 5.0)) "+5.000000"
+    test "test6495" (lazy(sprintf "%+1F" 5.0)) "+5.000000"
+    test "test6496" (lazy(sprintf "%+*F" 7 5.0)) "+5.000000"
+    test "test6497" (lazy(sprintf "%+.5F" 5.0)) "+5.00000"
+    test "test6498" (lazy(sprintf "%+.*F" 4 5.0)) "+5.0000"
+    test "test6499" (lazy(sprintf "%+*.*F" 5 4 5.0)) "+5.0000"
+    test "test6500" (lazy(sprintf "%-+F" 5.0)) "+5.000000"
+    test "test6501" (lazy(sprintf "%-+5F" 5.0)) "+5.000000"
+    test "test6502" (lazy(sprintf "%-+1F" 5.0)) "+5.000000"
+    test "test6503" (lazy(sprintf "%-+*F" 7 5.0)) "+5.000000"
+    test "test6504" (lazy(sprintf "%-+.5F" 5.0)) "+5.00000"
+    test "test6505" (lazy(sprintf "%-+.*F" 4 5.0)) "+5.0000"
+    test "test6506" (lazy(sprintf "%-+*.*F" 5 4 5.0)) "+5.0000"
+    test "test6507" (lazy(sprintf "%+0F" 5.0)) "+5.000000"
+    test "test6508" (lazy(sprintf "%+05F" 5.0)) "+5.000000"
+    test "test6509" (lazy(sprintf "%+01F" 5.0)) "+5.000000"
+    test "test6510" (lazy(sprintf "%+0*F" 7 5.0)) "+5.000000"
+    test "test6511" (lazy(sprintf "%+0.5F" 5.0)) "+5.00000"
+    test "test6512" (lazy(sprintf "%+0.*F" 4 5.0)) "+5.0000"
+    test "test6513" (lazy(sprintf "%+0*.*F" 5 4 5.0)) "+5.0000"
+    test "test6514" (lazy(sprintf "%-+0F" 5.0)) "+5.000000"
+    test "test6515" (lazy(sprintf "%-+05F" 5.0)) "+5.000000"
+    test "test6516" (lazy(sprintf "%-+01F" 5.0)) "+5.000000"
+    test "test6517" (lazy(sprintf "%-+0*F" 7 5.0)) "+5.000000"
+    test "test6518" (lazy(sprintf "%-+0.5F" 5.0)) "+5.00000"
+    test "test6519" (lazy(sprintf "%-+0.*F" 4 5.0)) "+5.0000"
+    test "test6520" (lazy(sprintf "%-+0*.*F" 5 4 5.0)) "+5.0000"
+    test "test6521" (lazy(sprintf "% F" 5.0)) " 5.000000"
+    test "test6522" (lazy(sprintf "% 5F" 5.0)) " 5.000000"
+    test "test6523" (lazy(sprintf "% 1F" 5.0)) " 5.000000"
+    test "test6524" (lazy(sprintf "% *F" 7 5.0)) " 5.000000"
+    test "test6525" (lazy(sprintf "% .5F" 5.0)) " 5.00000"
+    test "test6526" (lazy(sprintf "% .*F" 4 5.0)) " 5.0000"
+    test "test6527" (lazy(sprintf "% *.*F" 5 4 5.0)) " 5.0000"
+    test "test6528" (lazy(sprintf "%- F" 5.0)) " 5.000000"
+    test "test6529" (lazy(sprintf "%- 5F" 5.0)) " 5.000000"
+    test "test6530" (lazy(sprintf "%- 1F" 5.0)) " 5.000000"
+    test "test6531" (lazy(sprintf "%- *F" 7 5.0)) " 5.000000"
+    test "test6532" (lazy(sprintf "%- .5F" 5.0)) " 5.00000"
+    test "test6533" (lazy(sprintf "%- .*F" 4 5.0)) " 5.0000"
+    test "test6534" (lazy(sprintf "%- *.*F" 5 4 5.0)) " 5.0000"
+    test "test6535" (lazy(sprintf "% 0F" 5.0)) " 5.000000"
+    test "test6536" (lazy(sprintf "% 05F" 5.0)) " 5.000000"
+    test "test6537" (lazy(sprintf "% 01F" 5.0)) " 5.000000"
+    test "test6538" (lazy(sprintf "% 0*F" 7 5.0)) " 5.000000"
+    test "test6539" (lazy(sprintf "% 0.5F" 5.0)) " 5.00000"
+    test "test6540" (lazy(sprintf "% 0.*F" 4 5.0)) " 5.0000"
+    test "test6541" (lazy(sprintf "% 0*.*F" 5 4 5.0)) " 5.0000"
+    test "test6542" (lazy(sprintf "%- 0F" 5.0)) " 5.000000"
+    test "test6543" (lazy(sprintf "%- 05F" 5.0)) " 5.000000"
+    test "test6544" (lazy(sprintf "%- 01F" 5.0)) " 5.000000"
+    test "test6545" (lazy(sprintf "%- 0*F" 7 5.0)) " 5.000000"
+    test "test6546" (lazy(sprintf "%- 0.5F" 5.0)) " 5.00000"
+    test "test6547" (lazy(sprintf "%- 0.*F" 4 5.0)) " 5.0000"
+    test "test6548" (lazy(sprintf "%- 0*.*F" 5 4 5.0)) " 5.0000"
+    test "test6549" (lazy(sprintf "%F" -10.0)) "-10.000000"
+    test "test6550" (lazy(sprintf "%5F" -10.0)) "-10.000000"
+    test "test6551" (lazy(sprintf "%1F" -10.0)) "-10.000000"
+    test "test6552" (lazy(sprintf "%*F" 7 -10.0)) "-10.000000"
+    test "test6553" (lazy(sprintf "%.5F" -10.0)) "-10.00000"
+    test "test6554" (lazy(sprintf "%.*F" 4 -10.0)) "-10.0000"
+    test "test6555" (lazy(sprintf "%*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6556" (lazy(sprintf "%-F" -10.0)) "-10.000000"
+    test "test6557" (lazy(sprintf "%-5F" -10.0)) "-10.000000"
+    test "test6558" (lazy(sprintf "%-1F" -10.0)) "-10.000000"
+    test "test6559" (lazy(sprintf "%-*F" 7 -10.0)) "-10.000000"
+    test "test6560" (lazy(sprintf "%-.5F" -10.0)) "-10.00000"
+    test "test6561" (lazy(sprintf "%-.*F" 4 -10.0)) "-10.0000"
+    test "test6562" (lazy(sprintf "%-*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6563" (lazy(sprintf "%0F" -10.0)) "-10.000000"
+    test "test6564" (lazy(sprintf "%05F" -10.0)) "-10.000000"
+    test "test6565" (lazy(sprintf "%01F" -10.0)) "-10.000000"
+    test "test6566" (lazy(sprintf "%0*F" 7 -10.0)) "-10.000000"
+    test "test6567" (lazy(sprintf "%0.5F" -10.0)) "-10.00000"
+    test "test6568" (lazy(sprintf "%0.*F" 4 -10.0)) "-10.0000"
+    test "test6569" (lazy(sprintf "%0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6570" (lazy(sprintf "%-0F" -10.0)) "-10.000000"
+    test "test6571" (lazy(sprintf "%-05F" -10.0)) "-10.000000"
+    test "test6572" (lazy(sprintf "%-01F" -10.0)) "-10.000000"
+    test "test6573" (lazy(sprintf "%-0*F" 7 -10.0)) "-10.000000"
+    test "test6574" (lazy(sprintf "%-0.5F" -10.0)) "-10.00000"
+    test "test6575" (lazy(sprintf "%-0.*F" 4 -10.0)) "-10.0000"
+    test "test6576" (lazy(sprintf "%-0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6577" (lazy(sprintf "%+F" -10.0)) "-10.000000"
+    test "test6578" (lazy(sprintf "%+5F" -10.0)) "-10.000000"
+    test "test6579" (lazy(sprintf "%+1F" -10.0)) "-10.000000"
+    test "test6580" (lazy(sprintf "%+*F" 7 -10.0)) "-10.000000"
+    test "test6581" (lazy(sprintf "%+.5F" -10.0)) "-10.00000"
+    test "test6582" (lazy(sprintf "%+.*F" 4 -10.0)) "-10.0000"
+    test "test6583" (lazy(sprintf "%+*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6584" (lazy(sprintf "%-+F" -10.0)) "-10.000000"
+    test "test6585" (lazy(sprintf "%-+5F" -10.0)) "-10.000000"
+    test "test6586" (lazy(sprintf "%-+1F" -10.0)) "-10.000000"
+    test "test6587" (lazy(sprintf "%-+*F" 7 -10.0)) "-10.000000"
+    test "test6588" (lazy(sprintf "%-+.5F" -10.0)) "-10.00000"
+    test "test6589" (lazy(sprintf "%-+.*F" 4 -10.0)) "-10.0000"
+    test "test6590" (lazy(sprintf "%-+*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6591" (lazy(sprintf "%+0F" -10.0)) "-10.000000"
+    test "test6592" (lazy(sprintf "%+05F" -10.0)) "-10.000000"
+    test "test6593" (lazy(sprintf "%+01F" -10.0)) "-10.000000"
+    test "test6594" (lazy(sprintf "%+0*F" 7 -10.0)) "-10.000000"
+    test "test6595" (lazy(sprintf "%+0.5F" -10.0)) "-10.00000"
+    test "test6596" (lazy(sprintf "%+0.*F" 4 -10.0)) "-10.0000"
+    test "test6597" (lazy(sprintf "%+0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6598" (lazy(sprintf "%-+0F" -10.0)) "-10.000000"
+    test "test6599" (lazy(sprintf "%-+05F" -10.0)) "-10.000000"
+    test "test6600" (lazy(sprintf "%-+01F" -10.0)) "-10.000000"
+    test "test6601" (lazy(sprintf "%-+0*F" 7 -10.0)) "-10.000000"
+    test "test6602" (lazy(sprintf "%-+0.5F" -10.0)) "-10.00000"
+    test "test6603" (lazy(sprintf "%-+0.*F" 4 -10.0)) "-10.0000"
+    test "test6604" (lazy(sprintf "%-+0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6605" (lazy(sprintf "% F" -10.0)) "-10.000000"
+    test "test6606" (lazy(sprintf "% 5F" -10.0)) "-10.000000"
+    test "test6607" (lazy(sprintf "% 1F" -10.0)) "-10.000000"
+    test "test6608" (lazy(sprintf "% *F" 7 -10.0)) "-10.000000"
+    test "test6609" (lazy(sprintf "% .5F" -10.0)) "-10.00000"
+    test "test6610" (lazy(sprintf "% .*F" 4 -10.0)) "-10.0000"
+    test "test6611" (lazy(sprintf "% *.*F" 5 4 -10.0)) "-10.0000"
+    test "test6612" (lazy(sprintf "%- F" -10.0)) "-10.000000"
+    test "test6613" (lazy(sprintf "%- 5F" -10.0)) "-10.000000"
+    test "test6614" (lazy(sprintf "%- 1F" -10.0)) "-10.000000"
+    test "test6615" (lazy(sprintf "%- *F" 7 -10.0)) "-10.000000"
+    test "test6616" (lazy(sprintf "%- .5F" -10.0)) "-10.00000"
+    test "test6617" (lazy(sprintf "%- .*F" 4 -10.0)) "-10.0000"
+    test "test6618" (lazy(sprintf "%- *.*F" 5 4 -10.0)) "-10.0000"
+    test "test6619" (lazy(sprintf "% 0F" -10.0)) "-10.000000"
+    test "test6620" (lazy(sprintf "% 05F" -10.0)) "-10.000000"
+    test "test6621" (lazy(sprintf "% 01F" -10.0)) "-10.000000"
+    test "test6622" (lazy(sprintf "% 0*F" 7 -10.0)) "-10.000000"
+    test "test6623" (lazy(sprintf "% 0.5F" -10.0)) "-10.00000"
+    test "test6624" (lazy(sprintf "% 0.*F" 4 -10.0)) "-10.0000"
+    test "test6625" (lazy(sprintf "% 0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6626" (lazy(sprintf "%- 0F" -10.0)) "-10.000000"
+    test "test6627" (lazy(sprintf "%- 05F" -10.0)) "-10.000000"
+    test "test6628" (lazy(sprintf "%- 01F" -10.0)) "-10.000000"
+    test "test6629" (lazy(sprintf "%- 0*F" 7 -10.0)) "-10.000000"
+    test "test6630" (lazy(sprintf "%- 0.5F" -10.0)) "-10.00000"
+    test "test6631" (lazy(sprintf "%- 0.*F" 4 -10.0)) "-10.0000"
+    test "test6632" (lazy(sprintf "%- 0*.*F" 5 4 -10.0)) "-10.0000"
+    test "test6633" (lazy(sprintf "%F" 5.0f)) "5.000000"
+    test "test6634" (lazy(sprintf "%5F" 5.0f)) "5.000000"
+    test "test6635" (lazy(sprintf "%1F" 5.0f)) "5.000000"
+    test "test6636" (lazy(sprintf "%*F" 7 5.0f)) "5.000000"
+    test "test6637" (lazy(sprintf "%.5F" 5.0f)) "5.00000"
+    test "test6638" (lazy(sprintf "%.*F" 4 5.0f)) "5.0000"
+    test "test6639" (lazy(sprintf "%*.*F" 5 4 5.0f)) "5.0000"
+    test "test6640" (lazy(sprintf "%-F" 5.0f)) "5.000000"
+    test "test6641" (lazy(sprintf "%-5F" 5.0f)) "5.000000"
+    test "test6642" (lazy(sprintf "%-1F" 5.0f)) "5.000000"
+    test "test6643" (lazy(sprintf "%-*F" 7 5.0f)) "5.000000"
+    test "test6644" (lazy(sprintf "%-.5F" 5.0f)) "5.00000"
+    test "test6645" (lazy(sprintf "%-.*F" 4 5.0f)) "5.0000"
+    test "test6646" (lazy(sprintf "%-*.*F" 5 4 5.0f)) "5.0000"
+    test "test6647" (lazy(sprintf "%0F" 5.0f)) "5.000000"
+    test "test6648" (lazy(sprintf "%05F" 5.0f)) "5.000000"
+    test "test6649" (lazy(sprintf "%01F" 5.0f)) "5.000000"
+    test "test6650" (lazy(sprintf "%0*F" 7 5.0f)) "5.000000"
+    test "test6651" (lazy(sprintf "%0.5F" 5.0f)) "5.00000"
+    test "test6652" (lazy(sprintf "%0.*F" 4 5.0f)) "5.0000"
+    test "test6653" (lazy(sprintf "%0*.*F" 5 4 5.0f)) "5.0000"
+    test "test6654" (lazy(sprintf "%-0F" 5.0f)) "5.000000"
+    test "test6655" (lazy(sprintf "%-05F" 5.0f)) "5.000000"
+    test "test6656" (lazy(sprintf "%-01F" 5.0f)) "5.000000"
+    test "test6657" (lazy(sprintf "%-0*F" 7 5.0f)) "5.000000"
+    test "test6658" (lazy(sprintf "%-0.5F" 5.0f)) "5.00000"
+    test "test6659" (lazy(sprintf "%-0.*F" 4 5.0f)) "5.0000"
+    test "test6660" (lazy(sprintf "%-0*.*F" 5 4 5.0f)) "5.0000"
+    test "test6661" (lazy(sprintf "%+F" 5.0f)) "+5.000000"
+    test "test6662" (lazy(sprintf "%+5F" 5.0f)) "+5.000000"
+    test "test6663" (lazy(sprintf "%+1F" 5.0f)) "+5.000000"
+    test "test6664" (lazy(sprintf "%+*F" 7 5.0f)) "+5.000000"
+    test "test6665" (lazy(sprintf "%+.5F" 5.0f)) "+5.00000"
+    test "test6666" (lazy(sprintf "%+.*F" 4 5.0f)) "+5.0000"
+    test "test6667" (lazy(sprintf "%+*.*F" 5 4 5.0f)) "+5.0000"
+    test "test6668" (lazy(sprintf "%-+F" 5.0f)) "+5.000000"
+    test "test6669" (lazy(sprintf "%-+5F" 5.0f)) "+5.000000"
+    test "test6670" (lazy(sprintf "%-+1F" 5.0f)) "+5.000000"
+    test "test6671" (lazy(sprintf "%-+*F" 7 5.0f)) "+5.000000"
+    test "test6672" (lazy(sprintf "%-+.5F" 5.0f)) "+5.00000"
+    test "test6673" (lazy(sprintf "%-+.*F" 4 5.0f)) "+5.0000"
+    test "test6674" (lazy(sprintf "%-+*.*F" 5 4 5.0f)) "+5.0000"
+    test "test6675" (lazy(sprintf "%+0F" 5.0f)) "+5.000000"
+    test "test6676" (lazy(sprintf "%+05F" 5.0f)) "+5.000000"
+    test "test6677" (lazy(sprintf "%+01F" 5.0f)) "+5.000000"
+    test "test6678" (lazy(sprintf "%+0*F" 7 5.0f)) "+5.000000"
+    test "test6679" (lazy(sprintf "%+0.5F" 5.0f)) "+5.00000"
+    test "test6680" (lazy(sprintf "%+0.*F" 4 5.0f)) "+5.0000"
+    test "test6681" (lazy(sprintf "%+0*.*F" 5 4 5.0f)) "+5.0000"
+    test "test6682" (lazy(sprintf "%-+0F" 5.0f)) "+5.000000"
+    test "test6683" (lazy(sprintf "%-+05F" 5.0f)) "+5.000000"
+    test "test6684" (lazy(sprintf "%-+01F" 5.0f)) "+5.000000"
+    test "test6685" (lazy(sprintf "%-+0*F" 7 5.0f)) "+5.000000"
+    test "test6686" (lazy(sprintf "%-+0.5F" 5.0f)) "+5.00000"
+    test "test6687" (lazy(sprintf "%-+0.*F" 4 5.0f)) "+5.0000"
+    test "test6688" (lazy(sprintf "%-+0*.*F" 5 4 5.0f)) "+5.0000"
+    test "test6689" (lazy(sprintf "% F" 5.0f)) " 5.000000"
+    test "test6690" (lazy(sprintf "% 5F" 5.0f)) " 5.000000"
+    test "test6691" (lazy(sprintf "% 1F" 5.0f)) " 5.000000"
+    test "test6692" (lazy(sprintf "% *F" 7 5.0f)) " 5.000000"
+    test "test6693" (lazy(sprintf "% .5F" 5.0f)) " 5.00000"
+    test "test6694" (lazy(sprintf "% .*F" 4 5.0f)) " 5.0000"
+    test "test6695" (lazy(sprintf "% *.*F" 5 4 5.0f)) " 5.0000"
+    test "test6696" (lazy(sprintf "%- F" 5.0f)) " 5.000000"
+    test "test6697" (lazy(sprintf "%- 5F" 5.0f)) " 5.000000"
+    test "test6698" (lazy(sprintf "%- 1F" 5.0f)) " 5.000000"
+    test "test6699" (lazy(sprintf "%- *F" 7 5.0f)) " 5.000000"
+    test "test6700" (lazy(sprintf "%- .5F" 5.0f)) " 5.00000"
+    test "test6701" (lazy(sprintf "%- .*F" 4 5.0f)) " 5.0000"
+    test "test6702" (lazy(sprintf "%- *.*F" 5 4 5.0f)) " 5.0000"
+    test "test6703" (lazy(sprintf "% 0F" 5.0f)) " 5.000000"
+    test "test6704" (lazy(sprintf "% 05F" 5.0f)) " 5.000000"
+    test "test6705" (lazy(sprintf "% 01F" 5.0f)) " 5.000000"
+    test "test6706" (lazy(sprintf "% 0*F" 7 5.0f)) " 5.000000"
+    test "test6707" (lazy(sprintf "% 0.5F" 5.0f)) " 5.00000"
+    test "test6708" (lazy(sprintf "% 0.*F" 4 5.0f)) " 5.0000"
+    test "test6709" (lazy(sprintf "% 0*.*F" 5 4 5.0f)) " 5.0000"
+    test "test6710" (lazy(sprintf "%- 0F" 5.0f)) " 5.000000"
+    test "test6711" (lazy(sprintf "%- 05F" 5.0f)) " 5.000000"
+    test "test6712" (lazy(sprintf "%- 01F" 5.0f)) " 5.000000"
+    test "test6713" (lazy(sprintf "%- 0*F" 7 5.0f)) " 5.000000"
+    test "test6714" (lazy(sprintf "%- 0.5F" 5.0f)) " 5.00000"
+    test "test6715" (lazy(sprintf "%- 0.*F" 4 5.0f)) " 5.0000"
+    test "test6716" (lazy(sprintf "%- 0*.*F" 5 4 5.0f)) " 5.0000"
+    test "test6717" (lazy(sprintf "%F" -10.0f)) "-10.000000"
+    test "test6718" (lazy(sprintf "%5F" -10.0f)) "-10.000000"
+    test "test6719" (lazy(sprintf "%1F" -10.0f)) "-10.000000"
+    test "test6720" (lazy(sprintf "%*F" 7 -10.0f)) "-10.000000"
+    test "test6721" (lazy(sprintf "%.5F" -10.0f)) "-10.00000"
+    test "test6722" (lazy(sprintf "%.*F" 4 -10.0f)) "-10.0000"
+    test "test6723" (lazy(sprintf "%*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6724" (lazy(sprintf "%-F" -10.0f)) "-10.000000"
+    test "test6725" (lazy(sprintf "%-5F" -10.0f)) "-10.000000"
+    test "test6726" (lazy(sprintf "%-1F" -10.0f)) "-10.000000"
+    test "test6727" (lazy(sprintf "%-*F" 7 -10.0f)) "-10.000000"
+    test "test6728" (lazy(sprintf "%-.5F" -10.0f)) "-10.00000"
+    test "test6729" (lazy(sprintf "%-.*F" 4 -10.0f)) "-10.0000"
+    test "test6730" (lazy(sprintf "%-*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6731" (lazy(sprintf "%0F" -10.0f)) "-10.000000"
+    test "test6732" (lazy(sprintf "%05F" -10.0f)) "-10.000000"
+    test "test6733" (lazy(sprintf "%01F" -10.0f)) "-10.000000"
+    test "test6734" (lazy(sprintf "%0*F" 7 -10.0f)) "-10.000000"
+    test "test6735" (lazy(sprintf "%0.5F" -10.0f)) "-10.00000"
+    test "test6736" (lazy(sprintf "%0.*F" 4 -10.0f)) "-10.0000"
+    test "test6737" (lazy(sprintf "%0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6738" (lazy(sprintf "%-0F" -10.0f)) "-10.000000"
+    test "test6739" (lazy(sprintf "%-05F" -10.0f)) "-10.000000"
+    test "test6740" (lazy(sprintf "%-01F" -10.0f)) "-10.000000"
+    test "test6741" (lazy(sprintf "%-0*F" 7 -10.0f)) "-10.000000"
+    test "test6742" (lazy(sprintf "%-0.5F" -10.0f)) "-10.00000"
+    test "test6743" (lazy(sprintf "%-0.*F" 4 -10.0f)) "-10.0000"
+    test "test6744" (lazy(sprintf "%-0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6745" (lazy(sprintf "%+F" -10.0f)) "-10.000000"
+    test "test6746" (lazy(sprintf "%+5F" -10.0f)) "-10.000000"
+    test "test6747" (lazy(sprintf "%+1F" -10.0f)) "-10.000000"
+    test "test6748" (lazy(sprintf "%+*F" 7 -10.0f)) "-10.000000"
+    test "test6749" (lazy(sprintf "%+.5F" -10.0f)) "-10.00000"
+    test "test6750" (lazy(sprintf "%+.*F" 4 -10.0f)) "-10.0000"
+    test "test6751" (lazy(sprintf "%+*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6752" (lazy(sprintf "%-+F" -10.0f)) "-10.000000"
+    test "test6753" (lazy(sprintf "%-+5F" -10.0f)) "-10.000000"
+    test "test6754" (lazy(sprintf "%-+1F" -10.0f)) "-10.000000"
+    test "test6755" (lazy(sprintf "%-+*F" 7 -10.0f)) "-10.000000"
+    test "test6756" (lazy(sprintf "%-+.5F" -10.0f)) "-10.00000"
+    test "test6757" (lazy(sprintf "%-+.*F" 4 -10.0f)) "-10.0000"
+    test "test6758" (lazy(sprintf "%-+*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6759" (lazy(sprintf "%+0F" -10.0f)) "-10.000000"
+    test "test6760" (lazy(sprintf "%+05F" -10.0f)) "-10.000000"
+    test "test6761" (lazy(sprintf "%+01F" -10.0f)) "-10.000000"
+    test "test6762" (lazy(sprintf "%+0*F" 7 -10.0f)) "-10.000000"
+    test "test6763" (lazy(sprintf "%+0.5F" -10.0f)) "-10.00000"
+    test "test6764" (lazy(sprintf "%+0.*F" 4 -10.0f)) "-10.0000"
+    test "test6765" (lazy(sprintf "%+0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6766" (lazy(sprintf "%-+0F" -10.0f)) "-10.000000"
+    test "test6767" (lazy(sprintf "%-+05F" -10.0f)) "-10.000000"
+    test "test6768" (lazy(sprintf "%-+01F" -10.0f)) "-10.000000"
+    test "test6769" (lazy(sprintf "%-+0*F" 7 -10.0f)) "-10.000000"
+    test "test6770" (lazy(sprintf "%-+0.5F" -10.0f)) "-10.00000"
+    test "test6771" (lazy(sprintf "%-+0.*F" 4 -10.0f)) "-10.0000"
+    test "test6772" (lazy(sprintf "%-+0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6773" (lazy(sprintf "% F" -10.0f)) "-10.000000"
+    test "test6774" (lazy(sprintf "% 5F" -10.0f)) "-10.000000"
+    test "test6775" (lazy(sprintf "% 1F" -10.0f)) "-10.000000"
+    test "test6776" (lazy(sprintf "% *F" 7 -10.0f)) "-10.000000"
+    test "test6777" (lazy(sprintf "% .5F" -10.0f)) "-10.00000"
+    test "test6778" (lazy(sprintf "% .*F" 4 -10.0f)) "-10.0000"
+    test "test6779" (lazy(sprintf "% *.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6780" (lazy(sprintf "%- F" -10.0f)) "-10.000000"
+    test "test6781" (lazy(sprintf "%- 5F" -10.0f)) "-10.000000"
+    test "test6782" (lazy(sprintf "%- 1F" -10.0f)) "-10.000000"
+    test "test6783" (lazy(sprintf "%- *F" 7 -10.0f)) "-10.000000"
+    test "test6784" (lazy(sprintf "%- .5F" -10.0f)) "-10.00000"
+    test "test6785" (lazy(sprintf "%- .*F" 4 -10.0f)) "-10.0000"
+    test "test6786" (lazy(sprintf "%- *.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6787" (lazy(sprintf "% 0F" -10.0f)) "-10.000000"
+    test "test6788" (lazy(sprintf "% 05F" -10.0f)) "-10.000000"
+    test "test6789" (lazy(sprintf "% 01F" -10.0f)) "-10.000000"
+    test "test6790" (lazy(sprintf "% 0*F" 7 -10.0f)) "-10.000000"
+    test "test6791" (lazy(sprintf "% 0.5F" -10.0f)) "-10.00000"
+    test "test6792" (lazy(sprintf "% 0.*F" 4 -10.0f)) "-10.0000"
+    test "test6793" (lazy(sprintf "% 0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6794" (lazy(sprintf "%- 0F" -10.0f)) "-10.000000"
+    test "test6795" (lazy(sprintf "%- 05F" -10.0f)) "-10.000000"
+    test "test6796" (lazy(sprintf "%- 01F" -10.0f)) "-10.000000"
+    test "test6797" (lazy(sprintf "%- 0*F" 7 -10.0f)) "-10.000000"
+    test "test6798" (lazy(sprintf "%- 0.5F" -10.0f)) "-10.00000"
+    test "test6799" (lazy(sprintf "%- 0.*F" 4 -10.0f)) "-10.0000"
+    test "test6800" (lazy(sprintf "%- 0*.*F" 5 4 -10.0f)) "-10.0000"
+    test "test6801" (lazy(sprintf "%F" 5.0M)) "5.000000"
+    test "test6802" (lazy(sprintf "%5F" 5.0M)) "5.000000"
+    test "test6803" (lazy(sprintf "%1F" 5.0M)) "5.000000"
+    test "test6804" (lazy(sprintf "%*F" 7 5.0M)) "5.000000"
+    test "test6805" (lazy(sprintf "%.5F" 5.0M)) "5.00000"
+    test "test6806" (lazy(sprintf "%.*F" 4 5.0M)) "5.0000"
+    test "test6807" (lazy(sprintf "%*.*F" 5 4 5.0M)) "5.0000"
+    test "test6808" (lazy(sprintf "%-F" 5.0M)) "5.000000"
+    test "test6809" (lazy(sprintf "%-5F" 5.0M)) "5.000000"
+    test "test6810" (lazy(sprintf "%-1F" 5.0M)) "5.000000"
+    test "test6811" (lazy(sprintf "%-*F" 7 5.0M)) "5.000000"
+    test "test6812" (lazy(sprintf "%-.5F" 5.0M)) "5.00000"
+    test "test6813" (lazy(sprintf "%-.*F" 4 5.0M)) "5.0000"
+    test "test6814" (lazy(sprintf "%-*.*F" 5 4 5.0M)) "5.0000"
+    test "test6815" (lazy(sprintf "%0F" 5.0M)) "5.000000"
+    test "test6816" (lazy(sprintf "%05F" 5.0M)) "5.000000"
+    test "test6817" (lazy(sprintf "%01F" 5.0M)) "5.000000"
+    test "test6818" (lazy(sprintf "%0*F" 7 5.0M)) "5.000000"
+    test "test6819" (lazy(sprintf "%0.5F" 5.0M)) "5.00000"
+    test "test6820" (lazy(sprintf "%0.*F" 4 5.0M)) "5.0000"
+    test "test6821" (lazy(sprintf "%0*.*F" 5 4 5.0M)) "5.0000"
+    test "test6822" (lazy(sprintf "%-0F" 5.0M)) "5.000000"
+    test "test6823" (lazy(sprintf "%-05F" 5.0M)) "5.000000"
+    test "test6824" (lazy(sprintf "%-01F" 5.0M)) "5.000000"
+    test "test6825" (lazy(sprintf "%-0*F" 7 5.0M)) "5.000000"
+    test "test6826" (lazy(sprintf "%-0.5F" 5.0M)) "5.00000"
+    test "test6827" (lazy(sprintf "%-0.*F" 4 5.0M)) "5.0000"
+    test "test6828" (lazy(sprintf "%-0*.*F" 5 4 5.0M)) "5.0000"
+    test "test6829" (lazy(sprintf "%+F" 5.0M)) "+5.000000"
+    test "test6830" (lazy(sprintf "%+5F" 5.0M)) "+5.000000"
+    test "test6831" (lazy(sprintf "%+1F" 5.0M)) "+5.000000"
+    test "test6832" (lazy(sprintf "%+*F" 7 5.0M)) "+5.000000"
+    test "test6833" (lazy(sprintf "%+.5F" 5.0M)) "+5.00000"
+    test "test6834" (lazy(sprintf "%+.*F" 4 5.0M)) "+5.0000"
+    test "test6835" (lazy(sprintf "%+*.*F" 5 4 5.0M)) "+5.0000"
+    test "test6836" (lazy(sprintf "%-+F" 5.0M)) "+5.000000"
+    test "test6837" (lazy(sprintf "%-+5F" 5.0M)) "+5.000000"
+    test "test6838" (lazy(sprintf "%-+1F" 5.0M)) "+5.000000"
+    test "test6839" (lazy(sprintf "%-+*F" 7 5.0M)) "+5.000000"
+    test "test6840" (lazy(sprintf "%-+.5F" 5.0M)) "+5.00000"
+    test "test6841" (lazy(sprintf "%-+.*F" 4 5.0M)) "+5.0000"
+    test "test6842" (lazy(sprintf "%-+*.*F" 5 4 5.0M)) "+5.0000"
+    test "test6843" (lazy(sprintf "%+0F" 5.0M)) "+5.000000"
+    test "test6844" (lazy(sprintf "%+05F" 5.0M)) "+5.000000"
+    test "test6845" (lazy(sprintf "%+01F" 5.0M)) "+5.000000"
+    test "test6846" (lazy(sprintf "%+0*F" 7 5.0M)) "+5.000000"
+    test "test6847" (lazy(sprintf "%+0.5F" 5.0M)) "+5.00000"
+    test "test6848" (lazy(sprintf "%+0.*F" 4 5.0M)) "+5.0000"
+    test "test6849" (lazy(sprintf "%+0*.*F" 5 4 5.0M)) "+5.0000"
+    test "test6850" (lazy(sprintf "%-+0F" 5.0M)) "+5.000000"
+    test "test6851" (lazy(sprintf "%-+05F" 5.0M)) "+5.000000"
+    test "test6852" (lazy(sprintf "%-+01F" 5.0M)) "+5.000000"
+    test "test6853" (lazy(sprintf "%-+0*F" 7 5.0M)) "+5.000000"
+    test "test6854" (lazy(sprintf "%-+0.5F" 5.0M)) "+5.00000"
+    test "test6855" (lazy(sprintf "%-+0.*F" 4 5.0M)) "+5.0000"
+    test "test6856" (lazy(sprintf "%-+0*.*F" 5 4 5.0M)) "+5.0000"
+    test "test6857" (lazy(sprintf "% F" 5.0M)) " 5.000000"
+    test "test6858" (lazy(sprintf "% 5F" 5.0M)) " 5.000000"
+    test "test6859" (lazy(sprintf "% 1F" 5.0M)) " 5.000000"
+    test "test6860" (lazy(sprintf "% *F" 7 5.0M)) " 5.000000"
+    test "test6861" (lazy(sprintf "% .5F" 5.0M)) " 5.00000"
+    test "test6862" (lazy(sprintf "% .*F" 4 5.0M)) " 5.0000"
+    test "test6863" (lazy(sprintf "% *.*F" 5 4 5.0M)) " 5.0000"
+    test "test6864" (lazy(sprintf "%- F" 5.0M)) " 5.000000"
+    test "test6865" (lazy(sprintf "%- 5F" 5.0M)) " 5.000000"
+    test "test6866" (lazy(sprintf "%- 1F" 5.0M)) " 5.000000"
+    test "test6867" (lazy(sprintf "%- *F" 7 5.0M)) " 5.000000"
+    test "test6868" (lazy(sprintf "%- .5F" 5.0M)) " 5.00000"
+    test "test6869" (lazy(sprintf "%- .*F" 4 5.0M)) " 5.0000"
+    test "test6870" (lazy(sprintf "%- *.*F" 5 4 5.0M)) " 5.0000"
+    test "test6871" (lazy(sprintf "% 0F" 5.0M)) " 5.000000"
+    test "test6872" (lazy(sprintf "% 05F" 5.0M)) " 5.000000"
+    test "test6873" (lazy(sprintf "% 01F" 5.0M)) " 5.000000"
+    test "test6874" (lazy(sprintf "% 0*F" 7 5.0M)) " 5.000000"
+    test "test6875" (lazy(sprintf "% 0.5F" 5.0M)) " 5.00000"
+    test "test6876" (lazy(sprintf "% 0.*F" 4 5.0M)) " 5.0000"
+    test "test6877" (lazy(sprintf "% 0*.*F" 5 4 5.0M)) " 5.0000"
+    test "test6878" (lazy(sprintf "%- 0F" 5.0M)) " 5.000000"
+    test "test6879" (lazy(sprintf "%- 05F" 5.0M)) " 5.000000"
+    test "test6880" (lazy(sprintf "%- 01F" 5.0M)) " 5.000000"
+    test "test6881" (lazy(sprintf "%- 0*F" 7 5.0M)) " 5.000000"
+    test "test6882" (lazy(sprintf "%- 0.5F" 5.0M)) " 5.00000"
+    test "test6883" (lazy(sprintf "%- 0.*F" 4 5.0M)) " 5.0000"
+    test "test6884" (lazy(sprintf "%- 0*.*F" 5 4 5.0M)) " 5.0000"
+    test "test6885" (lazy(sprintf "%F" -10.0M)) "-10.000000"
+    test "test6886" (lazy(sprintf "%5F" -10.0M)) "-10.000000"
+    test "test6887" (lazy(sprintf "%1F" -10.0M)) "-10.000000"
+    test "test6888" (lazy(sprintf "%*F" 7 -10.0M)) "-10.000000"
+    test "test6889" (lazy(sprintf "%.5F" -10.0M)) "-10.00000"
+    test "test6890" (lazy(sprintf "%.*F" 4 -10.0M)) "-10.0000"
+    test "test6891" (lazy(sprintf "%*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6892" (lazy(sprintf "%-F" -10.0M)) "-10.000000"
+    test "test6893" (lazy(sprintf "%-5F" -10.0M)) "-10.000000"
+    test "test6894" (lazy(sprintf "%-1F" -10.0M)) "-10.000000"
+    test "test6895" (lazy(sprintf "%-*F" 7 -10.0M)) "-10.000000"
+    test "test6896" (lazy(sprintf "%-.5F" -10.0M)) "-10.00000"
+    test "test6897" (lazy(sprintf "%-.*F" 4 -10.0M)) "-10.0000"
+    test "test6898" (lazy(sprintf "%-*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6899" (lazy(sprintf "%0F" -10.0M)) "-10.000000"
+    test "test6900" (lazy(sprintf "%05F" -10.0M)) "-10.000000"
+    test "test6901" (lazy(sprintf "%01F" -10.0M)) "-10.000000"
+    test "test6902" (lazy(sprintf "%0*F" 7 -10.0M)) "-10.000000"
+    test "test6903" (lazy(sprintf "%0.5F" -10.0M)) "-10.00000"
+    test "test6904" (lazy(sprintf "%0.*F" 4 -10.0M)) "-10.0000"
+    test "test6905" (lazy(sprintf "%0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6906" (lazy(sprintf "%-0F" -10.0M)) "-10.000000"
+    test "test6907" (lazy(sprintf "%-05F" -10.0M)) "-10.000000"
+    test "test6908" (lazy(sprintf "%-01F" -10.0M)) "-10.000000"
+    test "test6909" (lazy(sprintf "%-0*F" 7 -10.0M)) "-10.000000"
+    test "test6910" (lazy(sprintf "%-0.5F" -10.0M)) "-10.00000"
+    test "test6911" (lazy(sprintf "%-0.*F" 4 -10.0M)) "-10.0000"
+    test "test6912" (lazy(sprintf "%-0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6913" (lazy(sprintf "%+F" -10.0M)) "-10.000000"
+    test "test6914" (lazy(sprintf "%+5F" -10.0M)) "-10.000000"
+    test "test6915" (lazy(sprintf "%+1F" -10.0M)) "-10.000000"
+    test "test6916" (lazy(sprintf "%+*F" 7 -10.0M)) "-10.000000"
+    test "test6917" (lazy(sprintf "%+.5F" -10.0M)) "-10.00000"
+    test "test6918" (lazy(sprintf "%+.*F" 4 -10.0M)) "-10.0000"
+    test "test6919" (lazy(sprintf "%+*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6920" (lazy(sprintf "%-+F" -10.0M)) "-10.000000"
+    test "test6921" (lazy(sprintf "%-+5F" -10.0M)) "-10.000000"
+    test "test6922" (lazy(sprintf "%-+1F" -10.0M)) "-10.000000"
+    test "test6923" (lazy(sprintf "%-+*F" 7 -10.0M)) "-10.000000"
+    test "test6924" (lazy(sprintf "%-+.5F" -10.0M)) "-10.00000"
+    test "test6925" (lazy(sprintf "%-+.*F" 4 -10.0M)) "-10.0000"
+    test "test6926" (lazy(sprintf "%-+*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6927" (lazy(sprintf "%+0F" -10.0M)) "-10.000000"
+    test "test6928" (lazy(sprintf "%+05F" -10.0M)) "-10.000000"
+    test "test6929" (lazy(sprintf "%+01F" -10.0M)) "-10.000000"
+    test "test6930" (lazy(sprintf "%+0*F" 7 -10.0M)) "-10.000000"
+    test "test6931" (lazy(sprintf "%+0.5F" -10.0M)) "-10.00000"
+    test "test6932" (lazy(sprintf "%+0.*F" 4 -10.0M)) "-10.0000"
+    test "test6933" (lazy(sprintf "%+0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6934" (lazy(sprintf "%-+0F" -10.0M)) "-10.000000"
+    test "test6935" (lazy(sprintf "%-+05F" -10.0M)) "-10.000000"
+    test "test6936" (lazy(sprintf "%-+01F" -10.0M)) "-10.000000"
+    test "test6937" (lazy(sprintf "%-+0*F" 7 -10.0M)) "-10.000000"
+    test "test6938" (lazy(sprintf "%-+0.5F" -10.0M)) "-10.00000"
+    test "test6939" (lazy(sprintf "%-+0.*F" 4 -10.0M)) "-10.0000"
+    test "test6940" (lazy(sprintf "%-+0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6941" (lazy(sprintf "% F" -10.0M)) "-10.000000"
+    test "test6942" (lazy(sprintf "% 5F" -10.0M)) "-10.000000"
+    test "test6943" (lazy(sprintf "% 1F" -10.0M)) "-10.000000"
+    test "test6944" (lazy(sprintf "% *F" 7 -10.0M)) "-10.000000"
+    test "test6945" (lazy(sprintf "% .5F" -10.0M)) "-10.00000"
+    test "test6946" (lazy(sprintf "% .*F" 4 -10.0M)) "-10.0000"
+    test "test6947" (lazy(sprintf "% *.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6948" (lazy(sprintf "%- F" -10.0M)) "-10.000000"
+    test "test6949" (lazy(sprintf "%- 5F" -10.0M)) "-10.000000"
+    test "test6950" (lazy(sprintf "%- 1F" -10.0M)) "-10.000000"
+    test "test6951" (lazy(sprintf "%- *F" 7 -10.0M)) "-10.000000"
+    test "test6952" (lazy(sprintf "%- .5F" -10.0M)) "-10.00000"
+    test "test6953" (lazy(sprintf "%- .*F" 4 -10.0M)) "-10.0000"
+    test "test6954" (lazy(sprintf "%- *.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6955" (lazy(sprintf "% 0F" -10.0M)) "-10.000000"
+    test "test6956" (lazy(sprintf "% 05F" -10.0M)) "-10.000000"
+    test "test6957" (lazy(sprintf "% 01F" -10.0M)) "-10.000000"
+    test "test6958" (lazy(sprintf "% 0*F" 7 -10.0M)) "-10.000000"
+    test "test6959" (lazy(sprintf "% 0.5F" -10.0M)) "-10.00000"
+    test "test6960" (lazy(sprintf "% 0.*F" 4 -10.0M)) "-10.0000"
+    test "test6961" (lazy(sprintf "% 0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6962" (lazy(sprintf "%- 0F" -10.0M)) "-10.000000"
+    test "test6963" (lazy(sprintf "%- 05F" -10.0M)) "-10.000000"
+    test "test6964" (lazy(sprintf "%- 01F" -10.0M)) "-10.000000"
+    test "test6965" (lazy(sprintf "%- 0*F" 7 -10.0M)) "-10.000000"
+    test "test6966" (lazy(sprintf "%- 0.5F" -10.0M)) "-10.00000"
+    test "test6967" (lazy(sprintf "%- 0.*F" 4 -10.0M)) "-10.0000"
+    test "test6968" (lazy(sprintf "%- 0*.*F" 5 4 -10.0M)) "-10.0000"
+    test "test6969" (lazy(sprintf "%g" 5.0)) "5"
+    test "test6970" (lazy(sprintf "%5g" 5.0)) "    5"
+    test "test6971" (lazy(sprintf "%1g" 5.0)) "5"
+    test "test6972" (lazy(sprintf "%*g" 7 5.0)) "      5"
+    test "test6973" (lazy(sprintf "%.5g" 5.0)) "5"
+    test "test6974" (lazy(sprintf "%.*g" 4 5.0)) "5"
+    test "test6975" (lazy(sprintf "%*.*g" 5 4 5.0)) "    5"
+    test "test6976" (lazy(sprintf "%-g" 5.0)) "5"
+    test "test6977" (lazy(sprintf "%-5g" 5.0)) "5    "
+    test "test6978" (lazy(sprintf "%-1g" 5.0)) "5"
+    test "test6979" (lazy(sprintf "%-*g" 7 5.0)) "5      "
+    test "test6980" (lazy(sprintf "%-.5g" 5.0)) "5"
+    test "test6981" (lazy(sprintf "%-.*g" 4 5.0)) "5"
+    test "test6982" (lazy(sprintf "%-*.*g" 5 4 5.0)) "5    "
+    test "test6983" (lazy(sprintf "%0g" 5.0)) "5"
+    test "test6984" (lazy(sprintf "%05g" 5.0)) "00005"
+    test "test6985" (lazy(sprintf "%01g" 5.0)) "5"
+    test "test6986" (lazy(sprintf "%0*g" 7 5.0)) "0000005"
+    test "test6987" (lazy(sprintf "%0.5g" 5.0)) "5"
+    test "test6988" (lazy(sprintf "%0.*g" 4 5.0)) "5"
+    test "test6989" (lazy(sprintf "%0*.*g" 5 4 5.0)) "00005"
+    test "test6990" (lazy(sprintf "%-0g" 5.0)) "5"
+    test "test6991" (lazy(sprintf "%-05g" 5.0)) "5    "// "50000"
+    test "test6992" (lazy(sprintf "%-01g" 5.0)) "5"
+    test "test6993" (lazy(sprintf "%-0*g" 7 5.0)) "5      "//"5000000"
+    test "test6994" (lazy(sprintf "%-0.5g" 5.0)) "5"
+    test "test6995" (lazy(sprintf "%-0.*g" 4 5.0)) "5"
+    test "test6996" (lazy(sprintf "%-0*.*g" 5 4 5.0)) "5    "// "50000"
+    test "test6997" (lazy(sprintf "%+g" 5.0)) "+5"
+    test "test6998" (lazy(sprintf "%+5g" 5.0)) "   +5"
+    test "test6999" (lazy(sprintf "%+1g" 5.0)) "+5"
+    test "test7000" (lazy(sprintf "%+*g" 7 5.0)) "     +5"
+let func7000()=
+    test "test7001" (lazy(sprintf "%+.5g" 5.0)) "+5"
+    test "test7002" (lazy(sprintf "%+.*g" 4 5.0)) "+5"
+    test "test7003" (lazy(sprintf "%+*.*g" 5 4 5.0)) "   +5"
+    test "test7004" (lazy(sprintf "%-+g" 5.0)) "+5"
+    test "test7005" (lazy(sprintf "%-+5g" 5.0)) "+5   "
+    test "test7006" (lazy(sprintf "%-+1g" 5.0)) "+5"
+    test "test7007" (lazy(sprintf "%-+*g" 7 5.0)) "+5     "
+    test "test7008" (lazy(sprintf "%-+.5g" 5.0)) "+5"
+    test "test7009" (lazy(sprintf "%-+.*g" 4 5.0)) "+5"
+    test "test7010" (lazy(sprintf "%-+*.*g" 5 4 5.0)) "+5   "
+    test "test7011" (lazy(sprintf "%+0g" 5.0)) "+5"
+    test "test7012" (lazy(sprintf "%+05g" 5.0)) "+0005"//"000+5"
+    test "test7013" (lazy(sprintf "%+01g" 5.0)) "+5"
+    test "test7014" (lazy(sprintf "%+0*g" 7 5.0)) "+000005"// "00000+5"
+    test "test7015" (lazy(sprintf "%+0.5g" 5.0)) "+5"
+    test "test7016" (lazy(sprintf "%+0.*g" 4 5.0)) "+5"
+    test "test7017" (lazy(sprintf "%+0*.*g" 5 4 5.0)) "+0005"// "000+5"
+    test "test7018" (lazy(sprintf "%-+0g" 5.0)) "+5"
+    test "test7019" (lazy(sprintf "%-+05g" 5.0)) "+5   "//"+5000"
+    test "test7020" (lazy(sprintf "%-+01g" 5.0)) "+5"
+    test "test7021" (lazy(sprintf "%-+0*g" 7 5.0)) "+5     "// "+500000"
+    test "test7022" (lazy(sprintf "%-+0.5g" 5.0)) "+5"
+    test "test7023" (lazy(sprintf "%-+0.*g" 4 5.0)) "+5"
+    test "test7024" (lazy(sprintf "%-+0*.*g" 5 4 5.0)) "+5   "//"+5000"
+    test "test7025" (lazy(sprintf "% g" 5.0)) " 5"
+    test "test7026" (lazy(sprintf "% 5g" 5.0)) "    5"
+    test "test7027" (lazy(sprintf "% 1g" 5.0)) " 5"
+    test "test7028" (lazy(sprintf "% *g" 7 5.0)) "      5"
+    test "test7029" (lazy(sprintf "% .5g" 5.0)) " 5"
+    test "test7030" (lazy(sprintf "% .*g" 4 5.0)) " 5"
+    test "test7031" (lazy(sprintf "% *.*g" 5 4 5.0)) "    5"
+    test "test7032" (lazy(sprintf "%- g" 5.0)) " 5"
+    test "test7033" (lazy(sprintf "%- 5g" 5.0)) " 5   "
+    test "test7034" (lazy(sprintf "%- 1g" 5.0)) " 5"
+    test "test7035" (lazy(sprintf "%- *g" 7 5.0)) " 5     "
+    test "test7036" (lazy(sprintf "%- .5g" 5.0)) " 5"
+    test "test7037" (lazy(sprintf "%- .*g" 4 5.0)) " 5"
+    test "test7038" (lazy(sprintf "%- *.*g" 5 4 5.0)) " 5   "
+    test "test7039" (lazy(sprintf "% 0g" 5.0)) " 5"
+    test "test7040" (lazy(sprintf "% 05g" 5.0)) " 0005"//"000 5"
+    test "test7041" (lazy(sprintf "% 01g" 5.0)) " 5"
+    test "test7042" (lazy(sprintf "% 0*g" 7 5.0)) " 000005"//"00000 5"
+    test "test7043" (lazy(sprintf "% 0.5g" 5.0)) " 5"
+    test "test7044" (lazy(sprintf "% 0.*g" 4 5.0)) " 5"
+    test "test7045" (lazy(sprintf "% 0*.*g" 5 4 5.0)) " 0005"// "000 5"
+    test "test7046" (lazy(sprintf "%- 0g" 5.0)) " 5"
+    test "test7047" (lazy(sprintf "%- 05g" 5.0)) " 5   "//" 5000"
+    test "test7048" (lazy(sprintf "%- 01g" 5.0)) " 5"
+    test "test7049" (lazy(sprintf "%- 0*g" 7 5.0)) " 5     "// " 500000"
+    test "test7050" (lazy(sprintf "%- 0.5g" 5.0)) " 5"
+    test "test7051" (lazy(sprintf "%- 0.*g" 4 5.0)) " 5"
+    test "test7052" (lazy(sprintf "%- 0*.*g" 5 4 5.0)) " 5   "// " 5000"
+    test "test7053" (lazy(sprintf "%g" -10.0)) "-10"
+    test "test7054" (lazy(sprintf "%5g" -10.0)) "  -10"
+    test "test7055" (lazy(sprintf "%1g" -10.0)) "-10"
+    test "test7056" (lazy(sprintf "%*g" 7 -10.0)) "    -10"
+    test "test7057" (lazy(sprintf "%.5g" -10.0)) "-10"
+    test "test7058" (lazy(sprintf "%.*g" 4 -10.0)) "-10"
+    test "test7059" (lazy(sprintf "%*.*g" 5 4 -10.0)) "  -10"
+    test "test7060" (lazy(sprintf "%-g" -10.0)) "-10"
+    test "test7061" (lazy(sprintf "%-5g" -10.0)) "-10  "
+    test "test7062" (lazy(sprintf "%-1g" -10.0)) "-10"
+    test "test7063" (lazy(sprintf "%-*g" 7 -10.0)) "-10    "
+    test "test7064" (lazy(sprintf "%-.5g" -10.0)) "-10"
+    test "test7065" (lazy(sprintf "%-.*g" 4 -10.0)) "-10"
+    test "test7066" (lazy(sprintf "%-*.*g" 5 4 -10.0)) "-10  "
+    test "test7067" (lazy(sprintf "%0g" -10.0)) "-10"
+    test "test7068" (lazy(sprintf "%05g" -10.0)) "-0010"// "00-10"
+    test "test7069" (lazy(sprintf "%01g" -10.0)) "-10"
+    test "test7070" (lazy(sprintf "%0*g" 7 -10.0)) "-000010"// "0000-10"
+    test "test7071" (lazy(sprintf "%0.5g" -10.0)) "-10"
+    test "test7072" (lazy(sprintf "%0.*g" 4 -10.0)) "-10"
+    test "test7073" (lazy(sprintf "%0*.*g" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7074" (lazy(sprintf "%-0g" -10.0)) "-10"
+    test "test7075" (lazy(sprintf "%-05g" -10.0)) "-10  "// "-1000"
+    test "test7076" (lazy(sprintf "%-01g" -10.0)) "-10"
+    test "test7077" (lazy(sprintf "%-0*g" 7 -10.0)) "-10    "//  "-100000"
+    test "test7078" (lazy(sprintf "%-0.5g" -10.0)) "-10"
+    test "test7079" (lazy(sprintf "%-0.*g" 4 -10.0)) "-10"
+    test "test7080" (lazy(sprintf "%-0*.*g" 5 4 -10.0)) "-10  "//   "-1000"
+    test "test7081" (lazy(sprintf "%+g" -10.0)) "-10"
+    test "test7082" (lazy(sprintf "%+5g" -10.0)) "  -10"
+    test "test7083" (lazy(sprintf "%+1g" -10.0)) "-10"
+    test "test7084" (lazy(sprintf "%+*g" 7 -10.0)) "    -10"
+    test "test7085" (lazy(sprintf "%+.5g" -10.0)) "-10"
+    test "test7086" (lazy(sprintf "%+.*g" 4 -10.0)) "-10"
+    test "test7087" (lazy(sprintf "%+*.*g" 5 4 -10.0)) "  -10"
+    test "test7088" (lazy(sprintf "%-+g" -10.0)) "-10"
+    test "test7089" (lazy(sprintf "%-+5g" -10.0)) "-10  "
+    test "test7090" (lazy(sprintf "%-+1g" -10.0)) "-10"
+    test "test7091" (lazy(sprintf "%-+*g" 7 -10.0)) "-10    "
+    test "test7092" (lazy(sprintf "%-+.5g" -10.0)) "-10"
+    test "test7093" (lazy(sprintf "%-+.*g" 4 -10.0)) "-10"
+    test "test7094" (lazy(sprintf "%-+*.*g" 5 4 -10.0)) "-10  "
+    test "test7095" (lazy(sprintf "%+0g" -10.0)) "-10"
+    test "test7096" (lazy(sprintf "%+05g" -10.0)) "-0010"// "00-10"
+    test "test7097" (lazy(sprintf "%+01g" -10.0)) "-10"
+    test "test7098" (lazy(sprintf "%+0*g" 7 -10.0)) "-000010"//  "0000-10"
+    test "test7099" (lazy(sprintf "%+0.5g" -10.0)) "-10"
+    test "test7100" (lazy(sprintf "%+0.*g" 4 -10.0)) "-10"
+    test "test7101" (lazy(sprintf "%+0*.*g" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7102" (lazy(sprintf "%-+0g" -10.0)) "-10"
+    test "test7103" (lazy(sprintf "%-+05g" -10.0)) "-10  "// "-1000"
+    test "test7104" (lazy(sprintf "%-+01g" -10.0)) "-10"
+    test "test7105" (lazy(sprintf "%-+0*g" 7 -10.0)) "-10    "// "-100000"
+    test "test7106" (lazy(sprintf "%-+0.5g" -10.0)) "-10"
+    test "test7107" (lazy(sprintf "%-+0.*g" 4 -10.0)) "-10"
+    test "test7108" (lazy(sprintf "%-+0*.*g" 5 4 -10.0)) "-10  "//  "-1000"
+    test "test7109" (lazy(sprintf "% g" -10.0)) "-10"
+    test "test7110" (lazy(sprintf "% 5g" -10.0)) "  -10"
+    test "test7111" (lazy(sprintf "% 1g" -10.0)) "-10"
+    test "test7112" (lazy(sprintf "% *g" 7 -10.0)) "    -10"
+    test "test7113" (lazy(sprintf "% .5g" -10.0)) "-10"
+    test "test7114" (lazy(sprintf "% .*g" 4 -10.0)) "-10"
+    test "test7115" (lazy(sprintf "% *.*g" 5 4 -10.0)) "  -10"
+    test "test7116" (lazy(sprintf "%- g" -10.0)) "-10"
+    test "test7117" (lazy(sprintf "%- 5g" -10.0)) "-10  "
+    test "test7118" (lazy(sprintf "%- 1g" -10.0)) "-10"
+    test "test7119" (lazy(sprintf "%- *g" 7 -10.0)) "-10    "
+    test "test7120" (lazy(sprintf "%- .5g" -10.0)) "-10"
+    test "test7121" (lazy(sprintf "%- .*g" 4 -10.0)) "-10"
+    test "test7122" (lazy(sprintf "%- *.*g" 5 4 -10.0)) "-10  "
+    test "test7123" (lazy(sprintf "% 0g" -10.0)) "-10"
+    test "test7124" (lazy(sprintf "% 05g" -10.0)) "-0010"// "00-10"
+    test "test7125" (lazy(sprintf "% 01g" -10.0)) "-10"
+    test "test7126" (lazy(sprintf "% 0*g" 7 -10.0)) "-000010"// "0000-10"
+    test "test7127" (lazy(sprintf "% 0.5g" -10.0)) "-10"
+    test "test7128" (lazy(sprintf "% 0.*g" 4 -10.0)) "-10"
+    test "test7129" (lazy(sprintf "% 0*.*g" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7130" (lazy(sprintf "%- 0g" -10.0)) "-10"
+    test "test7131" (lazy(sprintf "%- 05g" -10.0)) "-10  "//  "-1000"
+    test "test7132" (lazy(sprintf "%- 01g" -10.0)) "-10"
+    test "test7133" (lazy(sprintf "%- 0*g" 7 -10.0)) "-10    "// "-100000"
+    test "test7134" (lazy(sprintf "%- 0.5g" -10.0)) "-10"
+    test "test7135" (lazy(sprintf "%- 0.*g" 4 -10.0)) "-10"
+    test "test7136" (lazy(sprintf "%- 0*.*g" 5 4 -10.0)) "-10  "//  "-1000"
+    test "test7137" (lazy(sprintf "%g" 5.0f)) "5"
+    test "test7138" (lazy(sprintf "%5g" 5.0f)) "    5"
+    test "test7139" (lazy(sprintf "%1g" 5.0f)) "5"
+    test "test7140" (lazy(sprintf "%*g" 7 5.0f)) "      5"
+    test "test7141" (lazy(sprintf "%.5g" 5.0f)) "5"
+    test "test7142" (lazy(sprintf "%.*g" 4 5.0f)) "5"
+    test "test7143" (lazy(sprintf "%*.*g" 5 4 5.0f)) "    5"
+    test "test7144" (lazy(sprintf "%-g" 5.0f)) "5"
+    test "test7145" (lazy(sprintf "%-5g" 5.0f)) "5    "
+    test "test7146" (lazy(sprintf "%-1g" 5.0f)) "5"
+    test "test7147" (lazy(sprintf "%-*g" 7 5.0f)) "5      "
+    test "test7148" (lazy(sprintf "%-.5g" 5.0f)) "5"
+    test "test7149" (lazy(sprintf "%-.*g" 4 5.0f)) "5"
+    test "test7150" (lazy(sprintf "%-*.*g" 5 4 5.0f)) "5    "
+    test "test7151" (lazy(sprintf "%0g" 5.0f)) "5"
+    test "test7152" (lazy(sprintf "%05g" 5.0f)) "00005"
+    test "test7153" (lazy(sprintf "%01g" 5.0f)) "5"
+    test "test7154" (lazy(sprintf "%0*g" 7 5.0f)) "0000005"
+    test "test7155" (lazy(sprintf "%0.5g" 5.0f)) "5"
+    test "test7156" (lazy(sprintf "%0.*g" 4 5.0f)) "5"
+    test "test7157" (lazy(sprintf "%0*.*g" 5 4 5.0f)) "00005"
+    test "test7158" (lazy(sprintf "%-0g" 5.0f)) "5"
+    test "test7159" (lazy(sprintf "%-05g" 5.0f)) "5    "// "50000"
+    test "test7160" (lazy(sprintf "%-01g" 5.0f)) "5"
+    test "test7161" (lazy(sprintf "%-0*g" 7 5.0f)) "5      "//  "5000000"
+    test "test7162" (lazy(sprintf "%-0.5g" 5.0f)) "5"
+    test "test7163" (lazy(sprintf "%-0.*g" 4 5.0f)) "5"
+    test "test7164" (lazy(sprintf "%-0*.*g" 5 4 5.0f)) "5    "// "50000"
+    test "test7165" (lazy(sprintf "%+g" 5.0f)) "+5"
+    test "test7166" (lazy(sprintf "%+5g" 5.0f)) "   +5"
+    test "test7167" (lazy(sprintf "%+1g" 5.0f)) "+5"
+    test "test7168" (lazy(sprintf "%+*g" 7 5.0f)) "     +5"
+    test "test7169" (lazy(sprintf "%+.5g" 5.0f)) "+5"
+    test "test7170" (lazy(sprintf "%+.*g" 4 5.0f)) "+5"
+    test "test7171" (lazy(sprintf "%+*.*g" 5 4 5.0f)) "   +5"
+    test "test7172" (lazy(sprintf "%-+g" 5.0f)) "+5"
+    test "test7173" (lazy(sprintf "%-+5g" 5.0f)) "+5   "
+    test "test7174" (lazy(sprintf "%-+1g" 5.0f)) "+5"
+    test "test7175" (lazy(sprintf "%-+*g" 7 5.0f)) "+5     "
+    test "test7176" (lazy(sprintf "%-+.5g" 5.0f)) "+5"
+    test "test7177" (lazy(sprintf "%-+.*g" 4 5.0f)) "+5"
+    test "test7178" (lazy(sprintf "%-+*.*g" 5 4 5.0f)) "+5   "
+    test "test7179" (lazy(sprintf "%+0g" 5.0f)) "+5"
+    test "test7180" (lazy(sprintf "%+05g" 5.0f)) "+0005"// "000+5"
+    test "test7181" (lazy(sprintf "%+01g" 5.0f)) "+5"
+    test "test7182" (lazy(sprintf "%+0*g" 7 5.0f)) "+000005"//  "00000+5"
+    test "test7183" (lazy(sprintf "%+0.5g" 5.0f)) "+5"
+    test "test7184" (lazy(sprintf "%+0.*g" 4 5.0f)) "+5"
+    test "test7185" (lazy(sprintf "%+0*.*g" 5 4 5.0f)) "+0005"//  "000+5"
+    test "test7186" (lazy(sprintf "%-+0g" 5.0f)) "+5"
+    test "test7187" (lazy(sprintf "%-+05g" 5.0f)) "+5   "// "+5000"
+    test "test7188" (lazy(sprintf "%-+01g" 5.0f)) "+5"
+    test "test7189" (lazy(sprintf "%-+0*g" 7 5.0f)) "+5     "// "+500000"
+    test "test7190" (lazy(sprintf "%-+0.5g" 5.0f)) "+5"
+    test "test7191" (lazy(sprintf "%-+0.*g" 4 5.0f)) "+5"
+    test "test7192" (lazy(sprintf "%-+0*.*g" 5 4 5.0f)) "+5   "// "+5000"
+    test "test7193" (lazy(sprintf "% g" 5.0f)) " 5"
+    test "test7194" (lazy(sprintf "% 5g" 5.0f)) "    5"
+    test "test7195" (lazy(sprintf "% 1g" 5.0f)) " 5"
+    test "test7196" (lazy(sprintf "% *g" 7 5.0f)) "      5"
+    test "test7197" (lazy(sprintf "% .5g" 5.0f)) " 5"
+    test "test7198" (lazy(sprintf "% .*g" 4 5.0f)) " 5"
+    test "test7199" (lazy(sprintf "% *.*g" 5 4 5.0f)) "    5"
+    test "test7200" (lazy(sprintf "%- g" 5.0f)) " 5"
+    test "test7201" (lazy(sprintf "%- 5g" 5.0f)) " 5   "
+    test "test7202" (lazy(sprintf "%- 1g" 5.0f)) " 5"
+    test "test7203" (lazy(sprintf "%- *g" 7 5.0f)) " 5     "
+    test "test7204" (lazy(sprintf "%- .5g" 5.0f)) " 5"
+    test "test7205" (lazy(sprintf "%- .*g" 4 5.0f)) " 5"
+    test "test7206" (lazy(sprintf "%- *.*g" 5 4 5.0f)) " 5   "
+    test "test7207" (lazy(sprintf "% 0g" 5.0f)) " 5"
+    test "test7208" (lazy(sprintf "% 05g" 5.0f)) " 0005"// "000 5"
+    test "test7209" (lazy(sprintf "% 01g" 5.0f)) " 5"
+    test "test7210" (lazy(sprintf "% 0*g" 7 5.0f)) " 000005"//  "00000 5"
+    test "test7211" (lazy(sprintf "% 0.5g" 5.0f)) " 5"
+    test "test7212" (lazy(sprintf "% 0.*g" 4 5.0f)) " 5"
+    test "test7213" (lazy(sprintf "% 0*.*g" 5 4 5.0f)) " 0005"// "000 5"
+    test "test7214" (lazy(sprintf "%- 0g" 5.0f)) " 5"
+    test "test7215" (lazy(sprintf "%- 05g" 5.0f)) " 5   "//  " 5000"
+    test "test7216" (lazy(sprintf "%- 01g" 5.0f)) " 5"
+    test "test7217" (lazy(sprintf "%- 0*g" 7 5.0f)) " 5     "// " 500000"
+    test "test7218" (lazy(sprintf "%- 0.5g" 5.0f)) " 5"
+    test "test7219" (lazy(sprintf "%- 0.*g" 4 5.0f)) " 5"
+    test "test7220" (lazy(sprintf "%- 0*.*g" 5 4 5.0f)) " 5   "//  " 5000"
+    test "test7221" (lazy(sprintf "%g" -10.0f)) "-10"
+    test "test7222" (lazy(sprintf "%5g" -10.0f)) "  -10"
+    test "test7223" (lazy(sprintf "%1g" -10.0f)) "-10"
+    test "test7224" (lazy(sprintf "%*g" 7 -10.0f)) "    -10"
+    test "test7225" (lazy(sprintf "%.5g" -10.0f)) "-10"
+    test "test7226" (lazy(sprintf "%.*g" 4 -10.0f)) "-10"
+    test "test7227" (lazy(sprintf "%*.*g" 5 4 -10.0f)) "  -10"
+    test "test7228" (lazy(sprintf "%-g" -10.0f)) "-10"
+    test "test7229" (lazy(sprintf "%-5g" -10.0f)) "-10  "
+    test "test7230" (lazy(sprintf "%-1g" -10.0f)) "-10"
+    test "test7231" (lazy(sprintf "%-*g" 7 -10.0f)) "-10    "
+    test "test7232" (lazy(sprintf "%-.5g" -10.0f)) "-10"
+    test "test7233" (lazy(sprintf "%-.*g" 4 -10.0f)) "-10"
+    test "test7234" (lazy(sprintf "%-*.*g" 5 4 -10.0f)) "-10  "
+    test "test7235" (lazy(sprintf "%0g" -10.0f)) "-10"
+    test "test7236" (lazy(sprintf "%05g" -10.0f)) "-0010"//"00-10"
+    test "test7237" (lazy(sprintf "%01g" -10.0f)) "-10"
+    test "test7238" (lazy(sprintf "%0*g" 7 -10.0f)) "-000010"//  "0000-10"
+    test "test7239" (lazy(sprintf "%0.5g" -10.0f)) "-10"
+    test "test7240" (lazy(sprintf "%0.*g" 4 -10.0f)) "-10"
+    test "test7241" (lazy(sprintf "%0*.*g" 5 4 -10.0f)) "-0010"//  "00-10"
+    test "test7242" (lazy(sprintf "%-0g" -10.0f)) "-10"
+    test "test7243" (lazy(sprintf "%-05g" -10.0f)) "-10  "// "-1000"
+    test "test7244" (lazy(sprintf "%-01g" -10.0f)) "-10"
+    test "test7245" (lazy(sprintf "%-0*g" 7 -10.0f)) "-10    "//  "-100000"
+    test "test7246" (lazy(sprintf "%-0.5g" -10.0f)) "-10"
+    test "test7247" (lazy(sprintf "%-0.*g" 4 -10.0f)) "-10"
+    test "test7248" (lazy(sprintf "%-0*.*g" 5 4 -10.0f)) "-10  "// "-1000"
+    test "test7249" (lazy(sprintf "%+g" -10.0f)) "-10"
+    test "test7250" (lazy(sprintf "%+5g" -10.0f)) "  -10"
+    test "test7251" (lazy(sprintf "%+1g" -10.0f)) "-10"
+    test "test7252" (lazy(sprintf "%+*g" 7 -10.0f)) "    -10"
+    test "test7253" (lazy(sprintf "%+.5g" -10.0f)) "-10"
+    test "test7254" (lazy(sprintf "%+.*g" 4 -10.0f)) "-10"
+    test "test7255" (lazy(sprintf "%+*.*g" 5 4 -10.0f)) "  -10"
+    test "test7256" (lazy(sprintf "%-+g" -10.0f)) "-10"
+    test "test7257" (lazy(sprintf "%-+5g" -10.0f)) "-10  "
+    test "test7258" (lazy(sprintf "%-+1g" -10.0f)) "-10"
+    test "test7259" (lazy(sprintf "%-+*g" 7 -10.0f)) "-10    "
+    test "test7260" (lazy(sprintf "%-+.5g" -10.0f)) "-10"
+    test "test7261" (lazy(sprintf "%-+.*g" 4 -10.0f)) "-10"
+    test "test7262" (lazy(sprintf "%-+*.*g" 5 4 -10.0f)) "-10  "
+    test "test7263" (lazy(sprintf "%+0g" -10.0f)) "-10"
+    test "test7264" (lazy(sprintf "%+05g" -10.0f)) "-0010"// "00-10"
+    test "test7265" (lazy(sprintf "%+01g" -10.0f)) "-10"
+    test "test7266" (lazy(sprintf "%+0*g" 7 -10.0f)) "-000010"//  "0000-10"
+    test "test7267" (lazy(sprintf "%+0.5g" -10.0f)) "-10"
+    test "test7268" (lazy(sprintf "%+0.*g" 4 -10.0f)) "-10"
+    test "test7269" (lazy(sprintf "%+0*.*g" 5 4 -10.0f)) "-0010"// "00-10"
+    test "test7270" (lazy(sprintf "%-+0g" -10.0f)) "-10"
+    test "test7271" (lazy(sprintf "%-+05g" -10.0f)) "-10  " // "-1000"
+    test "test7272" (lazy(sprintf "%-+01g" -10.0f)) "-10"
+    test "test7273" (lazy(sprintf "%-+0*g" 7 -10.0f)) "-10    "// "-100000"
+    test "test7274" (lazy(sprintf "%-+0.5g" -10.0f)) "-10"
+    test "test7275" (lazy(sprintf "%-+0.*g" 4 -10.0f)) "-10"
+    test "test7276" (lazy(sprintf "%-+0*.*g" 5 4 -10.0f)) "-10  "// "-1000"
+    test "test7277" (lazy(sprintf "% g" -10.0f)) "-10"
+    test "test7278" (lazy(sprintf "% 5g" -10.0f)) "  -10"
+    test "test7279" (lazy(sprintf "% 1g" -10.0f)) "-10"
+    test "test7280" (lazy(sprintf "% *g" 7 -10.0f)) "    -10"
+    test "test7281" (lazy(sprintf "% .5g" -10.0f)) "-10"
+    test "test7282" (lazy(sprintf "% .*g" 4 -10.0f)) "-10"
+    test "test7283" (lazy(sprintf "% *.*g" 5 4 -10.0f)) "  -10"
+    test "test7284" (lazy(sprintf "%- g" -10.0f)) "-10"
+    test "test7285" (lazy(sprintf "%- 5g" -10.0f)) "-10  "
+    test "test7286" (lazy(sprintf "%- 1g" -10.0f)) "-10"
+    test "test7287" (lazy(sprintf "%- *g" 7 -10.0f)) "-10    "
+    test "test7288" (lazy(sprintf "%- .5g" -10.0f)) "-10"
+    test "test7289" (lazy(sprintf "%- .*g" 4 -10.0f)) "-10"
+    test "test7290" (lazy(sprintf "%- *.*g" 5 4 -10.0f)) "-10  "
+    test "test7291" (lazy(sprintf "% 0g" -10.0f)) "-10"
+    test "test7292" (lazy(sprintf "% 05g" -10.0f)) "-0010"//  "00-10"
+    test "test7293" (lazy(sprintf "% 01g" -10.0f)) "-10"
+    test "test7294" (lazy(sprintf "% 0*g" 7 -10.0f)) "-000010"//  "0000-10"
+    test "test7295" (lazy(sprintf "% 0.5g" -10.0f)) "-10"
+    test "test7296" (lazy(sprintf "% 0.*g" 4 -10.0f)) "-10"
+    test "test7297" (lazy(sprintf "% 0*.*g" 5 4 -10.0f)) "-0010"//  "00-10"
+    test "test7298" (lazy(sprintf "%- 0g" -10.0f)) "-10"
+    test "test7299" (lazy(sprintf "%- 05g" -10.0f)) "-10  "// "-1000"
+    test "test7300" (lazy(sprintf "%- 01g" -10.0f)) "-10"
+    test "test7301" (lazy(sprintf "%- 0*g" 7 -10.0f)) "-10    "//  "-100000"
+    test "test7302" (lazy(sprintf "%- 0.5g" -10.0f)) "-10"
+    test "test7303" (lazy(sprintf "%- 0.*g" 4 -10.0f)) "-10"
+    test "test7304" (lazy(sprintf "%- 0*.*g" 5 4 -10.0f)) "-10  "//  "-1000"
+    test "test7305" (lazy(sprintf "%g" 5.0M)) "5"
+    test "test7306" (lazy(sprintf "%5g" 5.0M)) "    5"
+    test "test7307" (lazy(sprintf "%1g" 5.0M)) "5"
+    test "test7308" (lazy(sprintf "%*g" 7 5.0M)) "      5"
+    test "test7309" (lazy(sprintf "%.5g" 5.0M)) "5"
+    test "test7310" (lazy(sprintf "%.*g" 4 5.0M)) "5"
+    test "test7311" (lazy(sprintf "%*.*g" 5 4 5.0M)) "    5"
+    test "test7312" (lazy(sprintf "%-g" 5.0M)) "5"
+    test "test7313" (lazy(sprintf "%-5g" 5.0M)) "5    "
+    test "test7314" (lazy(sprintf "%-1g" 5.0M)) "5"
+    test "test7315" (lazy(sprintf "%-*g" 7 5.0M)) "5      "
+    test "test7316" (lazy(sprintf "%-.5g" 5.0M)) "5"
+    test "test7317" (lazy(sprintf "%-.*g" 4 5.0M)) "5"
+    test "test7318" (lazy(sprintf "%-*.*g" 5 4 5.0M)) "5    "
+    test "test7319" (lazy(sprintf "%0g" 5.0M)) "5"
+    test "test7320" (lazy(sprintf "%05g" 5.0M)) "00005"
+    test "test7321" (lazy(sprintf "%01g" 5.0M)) "5"
+    test "test7322" (lazy(sprintf "%0*g" 7 5.0M)) "0000005"
+    test "test7323" (lazy(sprintf "%0.5g" 5.0M)) "5"
+    test "test7324" (lazy(sprintf "%0.*g" 4 5.0M)) "5"
+    test "test7325" (lazy(sprintf "%0*.*g" 5 4 5.0M)) "00005"
+    test "test7326" (lazy(sprintf "%-0g" 5.0M)) "5"
+    test "test7327" (lazy(sprintf "%-05g" 5.0M)) "5    "// "50000"
+    test "test7328" (lazy(sprintf "%-01g" 5.0M)) "5"
+    test "test7329" (lazy(sprintf "%-0*g" 7 5.0M)) "5      "// "5000000"
+    test "test7330" (lazy(sprintf "%-0.5g" 5.0M)) "5"
+    test "test7331" (lazy(sprintf "%-0.*g" 4 5.0M)) "5"
+    test "test7332" (lazy(sprintf "%-0*.*g" 5 4 5.0M)) "5    "// "50000"
+    test "test7333" (lazy(sprintf "%+g" 5.0M)) "+5"
+    test "test7334" (lazy(sprintf "%+5g" 5.0M)) "   +5"
+    test "test7335" (lazy(sprintf "%+1g" 5.0M)) "+5"
+    test "test7336" (lazy(sprintf "%+*g" 7 5.0M)) "     +5"
+    test "test7337" (lazy(sprintf "%+.5g" 5.0M)) "+5"
+    test "test7338" (lazy(sprintf "%+.*g" 4 5.0M)) "+5"
+    test "test7339" (lazy(sprintf "%+*.*g" 5 4 5.0M)) "   +5"
+    test "test7340" (lazy(sprintf "%-+g" 5.0M)) "+5"
+    test "test7341" (lazy(sprintf "%-+5g" 5.0M)) "+5   "
+    test "test7342" (lazy(sprintf "%-+1g" 5.0M)) "+5"
+    test "test7343" (lazy(sprintf "%-+*g" 7 5.0M)) "+5     "
+    test "test7344" (lazy(sprintf "%-+.5g" 5.0M)) "+5"
+    test "test7345" (lazy(sprintf "%-+.*g" 4 5.0M)) "+5"
+    test "test7346" (lazy(sprintf "%-+*.*g" 5 4 5.0M)) "+5   "
+    test "test7347" (lazy(sprintf "%+0g" 5.0M)) "+5"
+    test "test7348" (lazy(sprintf "%+05g" 5.0M)) "+0005"// "000+5"
+    test "test7349" (lazy(sprintf "%+01g" 5.0M)) "+5"
+    test "test7350" (lazy(sprintf "%+0*g" 7 5.0M)) "+000005"//  "00000+5"
+    test "test7351" (lazy(sprintf "%+0.5g" 5.0M)) "+5"
+    test "test7352" (lazy(sprintf "%+0.*g" 4 5.0M)) "+5"
+    test "test7353" (lazy(sprintf "%+0*.*g" 5 4 5.0M)) "+0005"//  "000+5"
+    test "test7354" (lazy(sprintf "%-+0g" 5.0M)) "+5"
+    test "test7355" (lazy(sprintf "%-+05g" 5.0M)) "+5   "// "+5000"
+    test "test7356" (lazy(sprintf "%-+01g" 5.0M)) "+5"
+    test "test7357" (lazy(sprintf "%-+0*g" 7 5.0M)) "+5     "// "+500000"
+    test "test7358" (lazy(sprintf "%-+0.5g" 5.0M)) "+5"
+    test "test7359" (lazy(sprintf "%-+0.*g" 4 5.0M)) "+5"
+    test "test7360" (lazy(sprintf "%-+0*.*g" 5 4 5.0M)) "+5   "//"+5000"
+    test "test7361" (lazy(sprintf "% g" 5.0M)) " 5"
+    test "test7362" (lazy(sprintf "% 5g" 5.0M)) "    5"
+    test "test7363" (lazy(sprintf "% 1g" 5.0M)) " 5"
+    test "test7364" (lazy(sprintf "% *g" 7 5.0M)) "      5"
+    test "test7365" (lazy(sprintf "% .5g" 5.0M)) " 5"
+    test "test7366" (lazy(sprintf "% .*g" 4 5.0M)) " 5"
+    test "test7367" (lazy(sprintf "% *.*g" 5 4 5.0M)) "    5"
+    test "test7368" (lazy(sprintf "%- g" 5.0M)) " 5"
+    test "test7369" (lazy(sprintf "%- 5g" 5.0M)) " 5   "
+    test "test7370" (lazy(sprintf "%- 1g" 5.0M)) " 5"
+    test "test7371" (lazy(sprintf "%- *g" 7 5.0M)) " 5     "
+    test "test7372" (lazy(sprintf "%- .5g" 5.0M)) " 5"
+    test "test7373" (lazy(sprintf "%- .*g" 4 5.0M)) " 5"
+    test "test7374" (lazy(sprintf "%- *.*g" 5 4 5.0M)) " 5   "
+    test "test7375" (lazy(sprintf "% 0g" 5.0M)) " 5"
+    test "test7376" (lazy(sprintf "% 05g" 5.0M)) " 0005"// "000 5"
+    test "test7377" (lazy(sprintf "% 01g" 5.0M)) " 5"
+    test "test7378" (lazy(sprintf "% 0*g" 7 5.0M)) " 000005"// "00000 5"
+    test "test7379" (lazy(sprintf "% 0.5g" 5.0M)) " 5"
+    test "test7380" (lazy(sprintf "% 0.*g" 4 5.0M)) " 5"
+    test "test7381" (lazy(sprintf "% 0*.*g" 5 4 5.0M)) " 0005"// "000 5"
+    test "test7382" (lazy(sprintf "%- 0g" 5.0M)) " 5"
+    test "test7383" (lazy(sprintf "%- 05g" 5.0M)) " 5   "// " 5000"
+    test "test7384" (lazy(sprintf "%- 01g" 5.0M)) " 5"
+    test "test7385" (lazy(sprintf "%- 0*g" 7 5.0M)) " 5     "// " 500000"
+    test "test7386" (lazy(sprintf "%- 0.5g" 5.0M)) " 5"
+    test "test7387" (lazy(sprintf "%- 0.*g" 4 5.0M)) " 5"
+    test "test7388" (lazy(sprintf "%- 0*.*g" 5 4 5.0M)) " 5   "//  " 5000"
+    test "test7389" (lazy(sprintf "%g" -10.0M)) "-10"
+    test "test7390" (lazy(sprintf "%5g" -10.0M)) "  -10"
+    test "test7391" (lazy(sprintf "%1g" -10.0M)) "-10"
+    test "test7392" (lazy(sprintf "%*g" 7 -10.0M)) "    -10"
+    test "test7393" (lazy(sprintf "%.5g" -10.0M)) "-10"
+    test "test7394" (lazy(sprintf "%.*g" 4 -10.0M)) "-10"
+    test "test7395" (lazy(sprintf "%*.*g" 5 4 -10.0M)) "  -10"
+    test "test7396" (lazy(sprintf "%-g" -10.0M)) "-10"
+    test "test7397" (lazy(sprintf "%-5g" -10.0M)) "-10  "
+    test "test7398" (lazy(sprintf "%-1g" -10.0M)) "-10"
+    test "test7399" (lazy(sprintf "%-*g" 7 -10.0M)) "-10    "
+    test "test7400" (lazy(sprintf "%-.5g" -10.0M)) "-10"
+    test "test7401" (lazy(sprintf "%-.*g" 4 -10.0M)) "-10"
+    test "test7402" (lazy(sprintf "%-*.*g" 5 4 -10.0M)) "-10  "
+    test "test7403" (lazy(sprintf "%0g" -10.0M)) "-10"
+    test "test7404" (lazy(sprintf "%05g" -10.0M)) "-0010"//  "00-10"
+    test "test7405" (lazy(sprintf "%01g" -10.0M)) "-10"
+    test "test7406" (lazy(sprintf "%0*g" 7 -10.0M)) "-000010"// "0000-10"
+    test "test7407" (lazy(sprintf "%0.5g" -10.0M)) "-10"
+    test "test7408" (lazy(sprintf "%0.*g" 4 -10.0M)) "-10"
+    test "test7409" (lazy(sprintf "%0*.*g" 5 4 -10.0M)) "-0010"//  "00-10"
+    test "test7410" (lazy(sprintf "%-0g" -10.0M)) "-10"
+    test "test7411" (lazy(sprintf "%-05g" -10.0M)) "-10  "// "-1000"
+    test "test7412" (lazy(sprintf "%-01g" -10.0M)) "-10"
+    test "test7413" (lazy(sprintf "%-0*g" 7 -10.0M)) "-10    "//  "-100000"
+    test "test7414" (lazy(sprintf "%-0.5g" -10.0M)) "-10"
+    test "test7415" (lazy(sprintf "%-0.*g" 4 -10.0M)) "-10"
+    test "test7416" (lazy(sprintf "%-0*.*g" 5 4 -10.0M)) "-10  "// "-1000"
+    test "test7417" (lazy(sprintf "%+g" -10.0M)) "-10"
+    test "test7418" (lazy(sprintf "%+5g" -10.0M)) "  -10"
+    test "test7419" (lazy(sprintf "%+1g" -10.0M)) "-10"
+    test "test7420" (lazy(sprintf "%+*g" 7 -10.0M)) "    -10"
+    test "test7421" (lazy(sprintf "%+.5g" -10.0M)) "-10"
+    test "test7422" (lazy(sprintf "%+.*g" 4 -10.0M)) "-10"
+    test "test7423" (lazy(sprintf "%+*.*g" 5 4 -10.0M)) "  -10"
+    test "test7424" (lazy(sprintf "%-+g" -10.0M)) "-10"
+    test "test7425" (lazy(sprintf "%-+5g" -10.0M)) "-10  "
+    test "test7426" (lazy(sprintf "%-+1g" -10.0M)) "-10"
+    test "test7427" (lazy(sprintf "%-+*g" 7 -10.0M)) "-10    "
+    test "test7428" (lazy(sprintf "%-+.5g" -10.0M)) "-10"
+    test "test7429" (lazy(sprintf "%-+.*g" 4 -10.0M)) "-10"
+    test "test7430" (lazy(sprintf "%-+*.*g" 5 4 -10.0M)) "-10  "
+    test "test7431" (lazy(sprintf "%+0g" -10.0M)) "-10"
+    test "test7432" (lazy(sprintf "%+05g" -10.0M)) "-0010"// "00-10"
+    test "test7433" (lazy(sprintf "%+01g" -10.0M)) "-10"
+    test "test7434" (lazy(sprintf "%+0*g" 7 -10.0M)) "-000010"// "0000-10"
+    test "test7435" (lazy(sprintf "%+0.5g" -10.0M)) "-10"
+    test "test7436" (lazy(sprintf "%+0.*g" 4 -10.0M)) "-10"
+    test "test7437" (lazy(sprintf "%+0*.*g" 5 4 -10.0M)) "-0010"// "00-10"
+    test "test7438" (lazy(sprintf "%-+0g" -10.0M)) "-10"
+    test "test7439" (lazy(sprintf "%-+05g" -10.0M)) "-10  "// "-1000"
+    test "test7440" (lazy(sprintf "%-+01g" -10.0M)) "-10"
+    test "test7441" (lazy(sprintf "%-+0*g" 7 -10.0M)) "-10    "//  "-100000"
+    test "test7442" (lazy(sprintf "%-+0.5g" -10.0M)) "-10"
+    test "test7443" (lazy(sprintf "%-+0.*g" 4 -10.0M)) "-10"
+    test "test7444" (lazy(sprintf "%-+0*.*g" 5 4 -10.0M)) "-10  "//"-1000"
+    test "test7445" (lazy(sprintf "% g" -10.0M)) "-10"
+    test "test7446" (lazy(sprintf "% 5g" -10.0M)) "  -10"
+    test "test7447" (lazy(sprintf "% 1g" -10.0M)) "-10"
+    test "test7448" (lazy(sprintf "% *g" 7 -10.0M)) "    -10"
+    test "test7449" (lazy(sprintf "% .5g" -10.0M)) "-10"
+    test "test7450" (lazy(sprintf "% .*g" 4 -10.0M)) "-10"
+    test "test7451" (lazy(sprintf "% *.*g" 5 4 -10.0M)) "  -10"
+    test "test7452" (lazy(sprintf "%- g" -10.0M)) "-10"
+    test "test7453" (lazy(sprintf "%- 5g" -10.0M)) "-10  "
+    test "test7454" (lazy(sprintf "%- 1g" -10.0M)) "-10"
+    test "test7455" (lazy(sprintf "%- *g" 7 -10.0M)) "-10    "
+    test "test7456" (lazy(sprintf "%- .5g" -10.0M)) "-10"
+    test "test7457" (lazy(sprintf "%- .*g" 4 -10.0M)) "-10"
+    test "test7458" (lazy(sprintf "%- *.*g" 5 4 -10.0M)) "-10  "
+    test "test7459" (lazy(sprintf "% 0g" -10.0M)) "-10"
+    test "test7460" (lazy(sprintf "% 05g" -10.0M)) "-0010"// "00-10"
+    test "test7461" (lazy(sprintf "% 01g" -10.0M)) "-10"
+    test "test7462" (lazy(sprintf "% 0*g" 7 -10.0M)) "-000010"//  "0000-10"
+    test "test7463" (lazy(sprintf "% 0.5g" -10.0M)) "-10"
+    test "test7464" (lazy(sprintf "% 0.*g" 4 -10.0M)) "-10"
+    test "test7465" (lazy(sprintf "% 0*.*g" 5 4 -10.0M)) "-0010"//  "00-10"
+    test "test7466" (lazy(sprintf "%- 0g" -10.0M)) "-10"
+    test "test7467" (lazy(sprintf "%- 05g" -10.0M)) "-10  "// "-1000"
+    test "test7468" (lazy(sprintf "%- 01g" -10.0M)) "-10"
+    test "test7469" (lazy(sprintf "%- 0*g" 7 -10.0M)) "-10    "// "-100000"
+    test "test7470" (lazy(sprintf "%- 0.5g" -10.0M)) "-10"
+    test "test7471" (lazy(sprintf "%- 0.*g" 4 -10.0M)) "-10"
+    test "test7472" (lazy(sprintf "%- 0*.*g" 5 4 -10.0M)) "-10  "// "-1000"
+    test "test7473" (lazy(sprintf "%G" 5.0)) "5"
+    test "test7474" (lazy(sprintf "%5G" 5.0)) "    5"
+    test "test7475" (lazy(sprintf "%1G" 5.0)) "5"
+    test "test7476" (lazy(sprintf "%*G" 7 5.0)) "      5"
+    test "test7477" (lazy(sprintf "%.5G" 5.0)) "5"
+    test "test7478" (lazy(sprintf "%.*G" 4 5.0)) "5"
+    test "test7479" (lazy(sprintf "%*.*G" 5 4 5.0)) "    5"
+    test "test7480" (lazy(sprintf "%-G" 5.0)) "5"
+    test "test7481" (lazy(sprintf "%-5G" 5.0)) "5    "
+    test "test7482" (lazy(sprintf "%-1G" 5.0)) "5"
+    test "test7483" (lazy(sprintf "%-*G" 7 5.0)) "5      "
+    test "test7484" (lazy(sprintf "%-.5G" 5.0)) "5"
+    test "test7485" (lazy(sprintf "%-.*G" 4 5.0)) "5"
+    test "test7486" (lazy(sprintf "%-*.*G" 5 4 5.0)) "5    "
+    test "test7487" (lazy(sprintf "%0G" 5.0)) "5"
+    test "test7488" (lazy(sprintf "%05G" 5.0)) "00005"
+    test "test7489" (lazy(sprintf "%01G" 5.0)) "5"
+    test "test7490" (lazy(sprintf "%0*G" 7 5.0)) "0000005"
+    test "test7491" (lazy(sprintf "%0.5G" 5.0)) "5"
+    test "test7492" (lazy(sprintf "%0.*G" 4 5.0)) "5"
+    test "test7493" (lazy(sprintf "%0*.*G" 5 4 5.0)) "00005"
+    test "test7494" (lazy(sprintf "%-0G" 5.0)) "5"
+    test "test7495" (lazy(sprintf "%-05G" 5.0)) "5    "// "50000"
+    test "test7496" (lazy(sprintf "%-01G" 5.0)) "5"
+    test "test7497" (lazy(sprintf "%-0*G" 7 5.0)) "5      "//  "5000000"
+    test "test7498" (lazy(sprintf "%-0.5G" 5.0)) "5"
+    test "test7499" (lazy(sprintf "%-0.*G" 4 5.0)) "5"
+    test "test7500" (lazy(sprintf "%-0*.*G" 5 4 5.0)) "5    "// "50000"
+    test "test7501" (lazy(sprintf "%+G" 5.0)) "+5"
+    test "test7502" (lazy(sprintf "%+5G" 5.0)) "   +5"
+    test "test7503" (lazy(sprintf "%+1G" 5.0)) "+5"
+    test "test7504" (lazy(sprintf "%+*G" 7 5.0)) "     +5"
+    test "test7505" (lazy(sprintf "%+.5G" 5.0)) "+5"
+    test "test7506" (lazy(sprintf "%+.*G" 4 5.0)) "+5"
+    test "test7507" (lazy(sprintf "%+*.*G" 5 4 5.0)) "   +5"
+    test "test7508" (lazy(sprintf "%-+G" 5.0)) "+5"
+    test "test7509" (lazy(sprintf "%-+5G" 5.0)) "+5   "
+    test "test7510" (lazy(sprintf "%-+1G" 5.0)) "+5"
+    test "test7511" (lazy(sprintf "%-+*G" 7 5.0)) "+5     "
+    test "test7512" (lazy(sprintf "%-+.5G" 5.0)) "+5"
+    test "test7513" (lazy(sprintf "%-+.*G" 4 5.0)) "+5"
+    test "test7514" (lazy(sprintf "%-+*.*G" 5 4 5.0)) "+5   "
+    test "test7515" (lazy(sprintf "%+0G" 5.0)) "+5"
+    test "test7516" (lazy(sprintf "%+05G" 5.0)) "+0005"// "000+5"
+    test "test7517" (lazy(sprintf "%+01G" 5.0)) "+5"
+    test "test7518" (lazy(sprintf "%+0*G" 7 5.0)) "+000005"//  "00000+5"
+    test "test7519" (lazy(sprintf "%+0.5G" 5.0)) "+5"
+    test "test7520" (lazy(sprintf "%+0.*G" 4 5.0)) "+5"
+    test "test7521" (lazy(sprintf "%+0*.*G" 5 4 5.0)) "+0005"// "000+5"
+    test "test7522" (lazy(sprintf "%-+0G" 5.0)) "+5"
+    test "test7523" (lazy(sprintf "%-+05G" 5.0)) "+5   "//"+5000"
+    test "test7524" (lazy(sprintf "%-+01G" 5.0)) "+5"
+    test "test7525" (lazy(sprintf "%-+0*G" 7 5.0)) "+5     "// "+500000"
+    test "test7526" (lazy(sprintf "%-+0.5G" 5.0)) "+5"
+    test "test7527" (lazy(sprintf "%-+0.*G" 4 5.0)) "+5"
+    test "test7528" (lazy(sprintf "%-+0*.*G" 5 4 5.0)) "+5   "// "+5000"
+    test "test7529" (lazy(sprintf "% G" 5.0)) " 5"
+    test "test7530" (lazy(sprintf "% 5G" 5.0)) "    5"
+    test "test7531" (lazy(sprintf "% 1G" 5.0)) " 5"
+    test "test7532" (lazy(sprintf "% *G" 7 5.0)) "      5"
+    test "test7533" (lazy(sprintf "% .5G" 5.0)) " 5"
+    test "test7534" (lazy(sprintf "% .*G" 4 5.0)) " 5"
+    test "test7535" (lazy(sprintf "% *.*G" 5 4 5.0)) "    5"
+    test "test7536" (lazy(sprintf "%- G" 5.0)) " 5"
+    test "test7537" (lazy(sprintf "%- 5G" 5.0)) " 5   "
+    test "test7538" (lazy(sprintf "%- 1G" 5.0)) " 5"
+    test "test7539" (lazy(sprintf "%- *G" 7 5.0)) " 5     "
+    test "test7540" (lazy(sprintf "%- .5G" 5.0)) " 5"
+    test "test7541" (lazy(sprintf "%- .*G" 4 5.0)) " 5"
+    test "test7542" (lazy(sprintf "%- *.*G" 5 4 5.0)) " 5   "
+    test "test7543" (lazy(sprintf "% 0G" 5.0)) " 5"
+    test "test7544" (lazy(sprintf "% 05G" 5.0)) " 0005"// "000 5"
+    test "test7545" (lazy(sprintf "% 01G" 5.0)) " 5"
+    test "test7546" (lazy(sprintf "% 0*G" 7 5.0)) " 000005"// "00000 5"
+    test "test7547" (lazy(sprintf "% 0.5G" 5.0)) " 5"
+    test "test7548" (lazy(sprintf "% 0.*G" 4 5.0)) " 5"
+    test "test7549" (lazy(sprintf "% 0*.*G" 5 4 5.0)) " 0005"//  "000 5"
+    test "test7550" (lazy(sprintf "%- 0G" 5.0)) " 5"
+    test "test7551" (lazy(sprintf "%- 05G" 5.0)) " 5   "// " 5000"
+    test "test7552" (lazy(sprintf "%- 01G" 5.0)) " 5"
+    test "test7553" (lazy(sprintf "%- 0*G" 7 5.0)) " 5     "// " 500000"
+    test "test7554" (lazy(sprintf "%- 0.5G" 5.0)) " 5"
+    test "test7555" (lazy(sprintf "%- 0.*G" 4 5.0)) " 5"
+    test "test7556" (lazy(sprintf "%- 0*.*G" 5 4 5.0)) " 5   "//" 5000"
+    test "test7557" (lazy(sprintf "%G" -10.0)) "-10"
+    test "test7558" (lazy(sprintf "%5G" -10.0)) "  -10"
+    test "test7559" (lazy(sprintf "%1G" -10.0)) "-10"
+    test "test7560" (lazy(sprintf "%*G" 7 -10.0)) "    -10"
+    test "test7561" (lazy(sprintf "%.5G" -10.0)) "-10"
+    test "test7562" (lazy(sprintf "%.*G" 4 -10.0)) "-10"
+    test "test7563" (lazy(sprintf "%*.*G" 5 4 -10.0)) "  -10"
+    test "test7564" (lazy(sprintf "%-G" -10.0)) "-10"
+    test "test7565" (lazy(sprintf "%-5G" -10.0)) "-10  "
+    test "test7566" (lazy(sprintf "%-1G" -10.0)) "-10"
+    test "test7567" (lazy(sprintf "%-*G" 7 -10.0)) "-10    "
+    test "test7568" (lazy(sprintf "%-.5G" -10.0)) "-10"
+    test "test7569" (lazy(sprintf "%-.*G" 4 -10.0)) "-10"
+    test "test7570" (lazy(sprintf "%-*.*G" 5 4 -10.0)) "-10  "
+    test "test7571" (lazy(sprintf "%0G" -10.0)) "-10"
+    test "test7572" (lazy(sprintf "%05G" -10.0)) "-0010"//  "00-10"
+    test "test7573" (lazy(sprintf "%01G" -10.0)) "-10"
+    test "test7574" (lazy(sprintf "%0*G" 7 -10.0)) "-000010"//  "0000-10"
+    test "test7575" (lazy(sprintf "%0.5G" -10.0)) "-10"
+    test "test7576" (lazy(sprintf "%0.*G" 4 -10.0)) "-10"
+    test "test7577" (lazy(sprintf "%0*.*G" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7578" (lazy(sprintf "%-0G" -10.0)) "-10"
+    test "test7579" (lazy(sprintf "%-05G" -10.0)) "-10  "// "-1000"
+    test "test7580" (lazy(sprintf "%-01G" -10.0)) "-10"
+    test "test7581" (lazy(sprintf "%-0*G" 7 -10.0)) "-10    "// "-100000"
+    test "test7582" (lazy(sprintf "%-0.5G" -10.0)) "-10"
+    test "test7583" (lazy(sprintf "%-0.*G" 4 -10.0)) "-10"
+    test "test7584" (lazy(sprintf "%-0*.*G" 5 4 -10.0)) "-10  "// "-1000"
+    test "test7585" (lazy(sprintf "%+G" -10.0)) "-10"
+    test "test7586" (lazy(sprintf "%+5G" -10.0)) "  -10"
+    test "test7587" (lazy(sprintf "%+1G" -10.0)) "-10"
+    test "test7588" (lazy(sprintf "%+*G" 7 -10.0)) "    -10"
+    test "test7589" (lazy(sprintf "%+.5G" -10.0)) "-10"
+    test "test7590" (lazy(sprintf "%+.*G" 4 -10.0)) "-10"
+    test "test7591" (lazy(sprintf "%+*.*G" 5 4 -10.0)) "  -10"
+    test "test7592" (lazy(sprintf "%-+G" -10.0)) "-10"
+    test "test7593" (lazy(sprintf "%-+5G" -10.0)) "-10  "
+    test "test7594" (lazy(sprintf "%-+1G" -10.0)) "-10"
+    test "test7595" (lazy(sprintf "%-+*G" 7 -10.0)) "-10    "
+    test "test7596" (lazy(sprintf "%-+.5G" -10.0)) "-10"
+    test "test7597" (lazy(sprintf "%-+.*G" 4 -10.0)) "-10"
+    test "test7598" (lazy(sprintf "%-+*.*G" 5 4 -10.0)) "-10  "
+    test "test7599" (lazy(sprintf "%+0G" -10.0)) "-10"
+    test "test7600" (lazy(sprintf "%+05G" -10.0)) "-0010"//"00-10"
+    test "test7601" (lazy(sprintf "%+01G" -10.0)) "-10"
+    test "test7602" (lazy(sprintf "%+0*G" 7 -10.0)) "-000010"// "0000-10"
+    test "test7603" (lazy(sprintf "%+0.5G" -10.0)) "-10"
+    test "test7604" (lazy(sprintf "%+0.*G" 4 -10.0)) "-10"
+    test "test7605" (lazy(sprintf "%+0*.*G" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7606" (lazy(sprintf "%-+0G" -10.0)) "-10"
+    test "test7607" (lazy(sprintf "%-+05G" -10.0)) "-10  "// "-1000"
+    test "test7608" (lazy(sprintf "%-+01G" -10.0)) "-10"
+    test "test7609" (lazy(sprintf "%-+0*G" 7 -10.0)) "-10    "//  "-100000"
+    test "test7610" (lazy(sprintf "%-+0.5G" -10.0)) "-10"
+    test "test7611" (lazy(sprintf "%-+0.*G" 4 -10.0)) "-10"
+    test "test7612" (lazy(sprintf "%-+0*.*G" 5 4 -10.0)) "-10  "// "-1000"
+    test "test7613" (lazy(sprintf "% G" -10.0)) "-10"
+    test "test7614" (lazy(sprintf "% 5G" -10.0)) "  -10"
+    test "test7615" (lazy(sprintf "% 1G" -10.0)) "-10"
+    test "test7616" (lazy(sprintf "% *G" 7 -10.0)) "    -10"
+    test "test7617" (lazy(sprintf "% .5G" -10.0)) "-10"
+    test "test7618" (lazy(sprintf "% .*G" 4 -10.0)) "-10"
+    test "test7619" (lazy(sprintf "% *.*G" 5 4 -10.0)) "  -10"
+    test "test7620" (lazy(sprintf "%- G" -10.0)) "-10"
+    test "test7621" (lazy(sprintf "%- 5G" -10.0)) "-10  "
+    test "test7622" (lazy(sprintf "%- 1G" -10.0)) "-10"
+    test "test7623" (lazy(sprintf "%- *G" 7 -10.0)) "-10    "
+    test "test7624" (lazy(sprintf "%- .5G" -10.0)) "-10"
+    test "test7625" (lazy(sprintf "%- .*G" 4 -10.0)) "-10"
+    test "test7626" (lazy(sprintf "%- *.*G" 5 4 -10.0)) "-10  "
+    test "test7627" (lazy(sprintf "% 0G" -10.0)) "-10"
+    test "test7628" (lazy(sprintf "% 05G" -10.0)) "-0010"// "00-10"
+    test "test7629" (lazy(sprintf "% 01G" -10.0)) "-10"
+    test "test7630" (lazy(sprintf "% 0*G" 7 -10.0)) "-000010"//  "0000-10"
+    test "test7631" (lazy(sprintf "% 0.5G" -10.0)) "-10"
+    test "test7632" (lazy(sprintf "% 0.*G" 4 -10.0)) "-10"
+    test "test7633" (lazy(sprintf "% 0*.*G" 5 4 -10.0)) "-0010"//  "00-10"
+    test "test7634" (lazy(sprintf "%- 0G" -10.0)) "-10"
+    test "test7635" (lazy(sprintf "%- 05G" -10.0)) "-10  "//  "-1000"
+    test "test7636" (lazy(sprintf "%- 01G" -10.0)) "-10"
+    test "test7637" (lazy(sprintf "%- 0*G" 7 -10.0)) "-10    "// "-100000"
+    test "test7638" (lazy(sprintf "%- 0.5G" -10.0)) "-10"
+    test "test7639" (lazy(sprintf "%- 0.*G" 4 -10.0)) "-10"
+    test "test7640" (lazy(sprintf "%- 0*.*G" 5 4 -10.0)) "-10  "// "-1000"
+    test "test7641" (lazy(sprintf "%G" 5.0f)) "5"
+    test "test7642" (lazy(sprintf "%5G" 5.0f)) "    5"
+    test "test7643" (lazy(sprintf "%1G" 5.0f)) "5"
+    test "test7644" (lazy(sprintf "%*G" 7 5.0f)) "      5"
+    test "test7645" (lazy(sprintf "%.5G" 5.0f)) "5"
+    test "test7646" (lazy(sprintf "%.*G" 4 5.0f)) "5"
+    test "test7647" (lazy(sprintf "%*.*G" 5 4 5.0f)) "    5"
+    test "test7648" (lazy(sprintf "%-G" 5.0f)) "5"
+    test "test7649" (lazy(sprintf "%-5G" 5.0f)) "5    "
+    test "test7650" (lazy(sprintf "%-1G" 5.0f)) "5"
+    test "test7651" (lazy(sprintf "%-*G" 7 5.0f)) "5      "
+    test "test7652" (lazy(sprintf "%-.5G" 5.0f)) "5"
+    test "test7653" (lazy(sprintf "%-.*G" 4 5.0f)) "5"
+    test "test7654" (lazy(sprintf "%-*.*G" 5 4 5.0f)) "5    "
+    test "test7655" (lazy(sprintf "%0G" 5.0f)) "5"
+    test "test7656" (lazy(sprintf "%05G" 5.0f)) "00005"
+    test "test7657" (lazy(sprintf "%01G" 5.0f)) "5"
+    test "test7658" (lazy(sprintf "%0*G" 7 5.0f)) "0000005"
+    test "test7659" (lazy(sprintf "%0.5G" 5.0f)) "5"
+    test "test7660" (lazy(sprintf "%0.*G" 4 5.0f)) "5"
+    test "test7661" (lazy(sprintf "%0*.*G" 5 4 5.0f)) "00005"
+    test "test7662" (lazy(sprintf "%-0G" 5.0f)) "5"
+    test "test7663" (lazy(sprintf "%-05G" 5.0f)) "5    "// "50000"
+    test "test7664" (lazy(sprintf "%-01G" 5.0f)) "5"
+    test "test7665" (lazy(sprintf "%-0*G" 7 5.0f)) "5      "// "5000000"
+    test "test7666" (lazy(sprintf "%-0.5G" 5.0f)) "5"
+    test "test7667" (lazy(sprintf "%-0.*G" 4 5.0f)) "5"
+    test "test7668" (lazy(sprintf "%-0*.*G" 5 4 5.0f)) "5    "// "50000"
+    test "test7669" (lazy(sprintf "%+G" 5.0f)) "+5"
+    test "test7670" (lazy(sprintf "%+5G" 5.0f)) "   +5"
+    test "test7671" (lazy(sprintf "%+1G" 5.0f)) "+5"
+    test "test7672" (lazy(sprintf "%+*G" 7 5.0f)) "     +5"
+    test "test7673" (lazy(sprintf "%+.5G" 5.0f)) "+5"
+    test "test7674" (lazy(sprintf "%+.*G" 4 5.0f)) "+5"
+    test "test7675" (lazy(sprintf "%+*.*G" 5 4 5.0f)) "   +5"
+    test "test7676" (lazy(sprintf "%-+G" 5.0f)) "+5"
+    test "test7677" (lazy(sprintf "%-+5G" 5.0f)) "+5   "
+    test "test7678" (lazy(sprintf "%-+1G" 5.0f)) "+5"
+    test "test7679" (lazy(sprintf "%-+*G" 7 5.0f)) "+5     "
+    test "test7680" (lazy(sprintf "%-+.5G" 5.0f)) "+5"
+    test "test7681" (lazy(sprintf "%-+.*G" 4 5.0f)) "+5"
+    test "test7682" (lazy(sprintf "%-+*.*G" 5 4 5.0f)) "+5   "
+    test "test7683" (lazy(sprintf "%+0G" 5.0f)) "+5"
+    test "test7684" (lazy(sprintf "%+05G" 5.0f)) "+0005"// "000+5"
+    test "test7685" (lazy(sprintf "%+01G" 5.0f)) "+5"
+    test "test7686" (lazy(sprintf "%+0*G" 7 5.0f)) "+000005"// "00000+5"
+    test "test7687" (lazy(sprintf "%+0.5G" 5.0f)) "+5"
+    test "test7688" (lazy(sprintf "%+0.*G" 4 5.0f)) "+5"
+    test "test7689" (lazy(sprintf "%+0*.*G" 5 4 5.0f)) "+0005"// "000+5"
+    test "test7690" (lazy(sprintf "%-+0G" 5.0f)) "+5"
+    test "test7691" (lazy(sprintf "%-+05G" 5.0f)) "+5   "// "+5000"
+    test "test7692" (lazy(sprintf "%-+01G" 5.0f)) "+5"
+    test "test7693" (lazy(sprintf "%-+0*G" 7 5.0f)) "+5     "// "+500000"
+    test "test7694" (lazy(sprintf "%-+0.5G" 5.0f)) "+5"
+    test "test7695" (lazy(sprintf "%-+0.*G" 4 5.0f)) "+5"
+    test "test7696" (lazy(sprintf "%-+0*.*G" 5 4 5.0f)) "+5   "//  "+5000"
+    test "test7697" (lazy(sprintf "% G" 5.0f)) " 5"
+    test "test7698" (lazy(sprintf "% 5G" 5.0f)) "    5"
+    test "test7699" (lazy(sprintf "% 1G" 5.0f)) " 5"
+    test "test7700" (lazy(sprintf "% *G" 7 5.0f)) "      5"
+    test "test7701" (lazy(sprintf "% .5G" 5.0f)) " 5"
+    test "test7702" (lazy(sprintf "% .*G" 4 5.0f)) " 5"
+    test "test7703" (lazy(sprintf "% *.*G" 5 4 5.0f)) "    5"
+    test "test7704" (lazy(sprintf "%- G" 5.0f)) " 5"
+    test "test7705" (lazy(sprintf "%- 5G" 5.0f)) " 5   "
+    test "test7706" (lazy(sprintf "%- 1G" 5.0f)) " 5"
+    test "test7707" (lazy(sprintf "%- *G" 7 5.0f)) " 5     "
+    test "test7708" (lazy(sprintf "%- .5G" 5.0f)) " 5"
+    test "test7709" (lazy(sprintf "%- .*G" 4 5.0f)) " 5"
+    test "test7710" (lazy(sprintf "%- *.*G" 5 4 5.0f)) " 5   "
+    test "test7711" (lazy(sprintf "% 0G" 5.0f)) " 5"
+    test "test7712" (lazy(sprintf "% 05G" 5.0f)) " 0005"//"000 5"
+    test "test7713" (lazy(sprintf "% 01G" 5.0f)) " 5"
+    test "test7714" (lazy(sprintf "% 0*G" 7 5.0f)) " 000005"// "00000 5"
+    test "test7715" (lazy(sprintf "% 0.5G" 5.0f)) " 5"
+    test "test7716" (lazy(sprintf "% 0.*G" 4 5.0f)) " 5"
+    test "test7717" (lazy(sprintf "% 0*.*G" 5 4 5.0f)) " 0005"//  "000 5"
+    test "test7718" (lazy(sprintf "%- 0G" 5.0f)) " 5"
+    test "test7719" (lazy(sprintf "%- 05G" 5.0f)) " 5   "//  " 5000"
+    test "test7720" (lazy(sprintf "%- 01G" 5.0f)) " 5"
+    test "test7721" (lazy(sprintf "%- 0*G" 7 5.0f)) " 5     "// " 500000"
+    test "test7722" (lazy(sprintf "%- 0.5G" 5.0f)) " 5"
+    test "test7723" (lazy(sprintf "%- 0.*G" 4 5.0f)) " 5"
+    test "test7724" (lazy(sprintf "%- 0*.*G" 5 4 5.0f)) " 5   "// " 5000"
+    test "test7725" (lazy(sprintf "%G" -10.0f)) "-10"
+    test "test7726" (lazy(sprintf "%5G" -10.0f)) "  -10"
+    test "test7727" (lazy(sprintf "%1G" -10.0f)) "-10"
+    test "test7728" (lazy(sprintf "%*G" 7 -10.0f)) "    -10"
+    test "test7729" (lazy(sprintf "%.5G" -10.0f)) "-10"
+    test "test7730" (lazy(sprintf "%.*G" 4 -10.0f)) "-10"
+    test "test7731" (lazy(sprintf "%*.*G" 5 4 -10.0f)) "  -10"
+    test "test7732" (lazy(sprintf "%-G" -10.0f)) "-10"
+    test "test7733" (lazy(sprintf "%-5G" -10.0f)) "-10  "
+    test "test7734" (lazy(sprintf "%-1G" -10.0f)) "-10"
+    test "test7735" (lazy(sprintf "%-*G" 7 -10.0f)) "-10    "
+    test "test7736" (lazy(sprintf "%-.5G" -10.0f)) "-10"
+    test "test7737" (lazy(sprintf "%-.*G" 4 -10.0f)) "-10"
+    test "test7738" (lazy(sprintf "%-*.*G" 5 4 -10.0f)) "-10  "
+    test "test7739" (lazy(sprintf "%0G" -10.0f)) "-10"
+    test "test7740" (lazy(sprintf "%05G" -10.0f)) "-0010"// "00-10"
+    test "test7741" (lazy(sprintf "%01G" -10.0f)) "-10"
+    test "test7742" (lazy(sprintf "%0*G" 7 -10.0f)) "-000010"// "0000-10"
+    test "test7743" (lazy(sprintf "%0.5G" -10.0f)) "-10"
+    test "test7744" (lazy(sprintf "%0.*G" 4 -10.0f)) "-10"
+    test "test7745" (lazy(sprintf "%0*.*G" 5 4 -10.0f)) "-0010"// "00-10"
+    test "test7746" (lazy(sprintf "%-0G" -10.0f)) "-10"
+    test "test7747" (lazy(sprintf "%-05G" -10.0f)) "-10  "//"-1000"
+    test "test7748" (lazy(sprintf "%-01G" -10.0f)) "-10"
+    test "test7749" (lazy(sprintf "%-0*G" 7 -10.0f)) "-10    "// "-100000"
+    test "test7750" (lazy(sprintf "%-0.5G" -10.0f)) "-10"
+    test "test7751" (lazy(sprintf "%-0.*G" 4 -10.0f)) "-10"
+    test "test7752" (lazy(sprintf "%-0*.*G" 5 4 -10.0f)) "-10  "// "-1000"
+    test "test7753" (lazy(sprintf "%+G" -10.0f)) "-10"
+    test "test7754" (lazy(sprintf "%+5G" -10.0f)) "  -10"
+    test "test7755" (lazy(sprintf "%+1G" -10.0f)) "-10"
+    test "test7756" (lazy(sprintf "%+*G" 7 -10.0f)) "    -10"
+    test "test7757" (lazy(sprintf "%+.5G" -10.0f)) "-10"
+    test "test7758" (lazy(sprintf "%+.*G" 4 -10.0f)) "-10"
+    test "test7759" (lazy(sprintf "%+*.*G" 5 4 -10.0f)) "  -10"
+    test "test7760" (lazy(sprintf "%-+G" -10.0f)) "-10"
+    test "test7761" (lazy(sprintf "%-+5G" -10.0f)) "-10  "
+    test "test7762" (lazy(sprintf "%-+1G" -10.0f)) "-10"
+    test "test7763" (lazy(sprintf "%-+*G" 7 -10.0f)) "-10    "
+    test "test7764" (lazy(sprintf "%-+.5G" -10.0f)) "-10"
+    test "test7765" (lazy(sprintf "%-+.*G" 4 -10.0f)) "-10"
+    test "test7766" (lazy(sprintf "%-+*.*G" 5 4 -10.0f)) "-10  "
+    test "test7767" (lazy(sprintf "%+0G" -10.0f)) "-10"
+    test "test7768" (lazy(sprintf "%+05G" -10.0f)) "-0010"// "00-10"
+    test "test7769" (lazy(sprintf "%+01G" -10.0f)) "-10"
+    test "test7770" (lazy(sprintf "%+0*G" 7 -10.0f)) "-000010"// "0000-10"
+    test "test7771" (lazy(sprintf "%+0.5G" -10.0f)) "-10"
+    test "test7772" (lazy(sprintf "%+0.*G" 4 -10.0f)) "-10"
+    test "test7773" (lazy(sprintf "%+0*.*G" 5 4 -10.0f)) "-0010"// "00-10"
+    test "test7774" (lazy(sprintf "%-+0G" -10.0f)) "-10"
+    test "test7775" (lazy(sprintf "%-+05G" -10.0f)) "-10  "//"-1000"
+    test "test7776" (lazy(sprintf "%-+01G" -10.0f)) "-10"
+    test "test7777" (lazy(sprintf "%-+0*G" 7 -10.0f)) "-10    "//"-100000"
+    test "test7778" (lazy(sprintf "%-+0.5G" -10.0f)) "-10"
+    test "test7779" (lazy(sprintf "%-+0.*G" 4 -10.0f)) "-10"
+    test "test7780" (lazy(sprintf "%-+0*.*G" 5 4 -10.0f)) "-10  "//  "-1000"
+    test "test7781" (lazy(sprintf "% G" -10.0f)) "-10"
+    test "test7782" (lazy(sprintf "% 5G" -10.0f)) "  -10"
+    test "test7783" (lazy(sprintf "% 1G" -10.0f)) "-10"
+    test "test7784" (lazy(sprintf "% *G" 7 -10.0f)) "    -10"
+    test "test7785" (lazy(sprintf "% .5G" -10.0f)) "-10"
+    test "test7786" (lazy(sprintf "% .*G" 4 -10.0f)) "-10"
+    test "test7787" (lazy(sprintf "% *.*G" 5 4 -10.0f)) "  -10"
+    test "test7788" (lazy(sprintf "%- G" -10.0f)) "-10"
+    test "test7789" (lazy(sprintf "%- 5G" -10.0f)) "-10  "
+    test "test7790" (lazy(sprintf "%- 1G" -10.0f)) "-10"
+    test "test7791" (lazy(sprintf "%- *G" 7 -10.0f)) "-10    "
+    test "test7792" (lazy(sprintf "%- .5G" -10.0f)) "-10"
+    test "test7793" (lazy(sprintf "%- .*G" 4 -10.0f)) "-10"
+    test "test7794" (lazy(sprintf "%- *.*G" 5 4 -10.0f)) "-10  "
+    test "test7795" (lazy(sprintf "% 0G" -10.0f)) "-10"
+    test "test7796" (lazy(sprintf "% 05G" -10.0f)) "-0010"// "00-10"
+    test "test7797" (lazy(sprintf "% 01G" -10.0f)) "-10"
+    test "test7798" (lazy(sprintf "% 0*G" 7 -10.0f)) "-000010"// "0000-10"
+    test "test7799" (lazy(sprintf "% 0.5G" -10.0f)) "-10"
+    test "test7800" (lazy(sprintf "% 0.*G" 4 -10.0f)) "-10"
+    test "test7801" (lazy(sprintf "% 0*.*G" 5 4 -10.0f)) "-0010"// "00-10"
+    test "test7802" (lazy(sprintf "%- 0G" -10.0f)) "-10"
+    test "test7803" (lazy(sprintf "%- 05G" -10.0f)) "-10  "// "-1000"
+    test "test7804" (lazy(sprintf "%- 01G" -10.0f)) "-10"
+    test "test7805" (lazy(sprintf "%- 0*G" 7 -10.0f)) "-10    "// "-100000"
+    test "test7806" (lazy(sprintf "%- 0.5G" -10.0f)) "-10"
+    test "test7807" (lazy(sprintf "%- 0.*G" 4 -10.0f)) "-10"
+    test "test7808" (lazy(sprintf "%- 0*.*G" 5 4 -10.0f)) "-10  "//  "-1000"
+    test "test7809" (lazy(sprintf "%G" 5.0M)) "5"
+    test "test7810" (lazy(sprintf "%5G" 5.0M)) "    5"
+    test "test7811" (lazy(sprintf "%1G" 5.0M)) "5"
+    test "test7812" (lazy(sprintf "%*G" 7 5.0M)) "      5"
+    test "test7813" (lazy(sprintf "%.5G" 5.0M)) "5"
+    test "test7814" (lazy(sprintf "%.*G" 4 5.0M)) "5"
+    test "test7815" (lazy(sprintf "%*.*G" 5 4 5.0M)) "    5"
+    test "test7816" (lazy(sprintf "%-G" 5.0M)) "5"
+    test "test7817" (lazy(sprintf "%-5G" 5.0M)) "5    "
+    test "test7818" (lazy(sprintf "%-1G" 5.0M)) "5"
+    test "test7819" (lazy(sprintf "%-*G" 7 5.0M)) "5      "
+    test "test7820" (lazy(sprintf "%-.5G" 5.0M)) "5"
+    test "test7821" (lazy(sprintf "%-.*G" 4 5.0M)) "5"
+    test "test7822" (lazy(sprintf "%-*.*G" 5 4 5.0M)) "5    "
+    test "test7823" (lazy(sprintf "%0G" 5.0M)) "5"
+    test "test7824" (lazy(sprintf "%05G" 5.0M)) "00005"
+    test "test7825" (lazy(sprintf "%01G" 5.0M)) "5"
+    test "test7826" (lazy(sprintf "%0*G" 7 5.0M)) "0000005"
+    test "test7827" (lazy(sprintf "%0.5G" 5.0M)) "5"
+    test "test7828" (lazy(sprintf "%0.*G" 4 5.0M)) "5"
+    test "test7829" (lazy(sprintf "%0*.*G" 5 4 5.0M)) "00005"
+    test "test7830" (lazy(sprintf "%-0G" 5.0M)) "5"
+    test "test7831" (lazy(sprintf "%-05G" 5.0M)) "5    "// "50000"
+    test "test7832" (lazy(sprintf "%-01G" 5.0M)) "5"
+    test "test7833" (lazy(sprintf "%-0*G" 7 5.0M)) "5      "// "5000000"
+    test "test7834" (lazy(sprintf "%-0.5G" 5.0M)) "5"
+    test "test7835" (lazy(sprintf "%-0.*G" 4 5.0M)) "5"
+    test "test7836" (lazy(sprintf "%-0*.*G" 5 4 5.0M)) "5    "// "50000"
+    test "test7837" (lazy(sprintf "%+G" 5.0M)) "+5"
+    test "test7838" (lazy(sprintf "%+5G" 5.0M)) "   +5"
+    test "test7839" (lazy(sprintf "%+1G" 5.0M)) "+5"
+    test "test7840" (lazy(sprintf "%+*G" 7 5.0M)) "     +5"
+    test "test7841" (lazy(sprintf "%+.5G" 5.0M)) "+5"
+    test "test7842" (lazy(sprintf "%+.*G" 4 5.0M)) "+5"
+    test "test7843" (lazy(sprintf "%+*.*G" 5 4 5.0M)) "   +5"
+    test "test7844" (lazy(sprintf "%-+G" 5.0M)) "+5"
+    test "test7845" (lazy(sprintf "%-+5G" 5.0M)) "+5   "
+    test "test7846" (lazy(sprintf "%-+1G" 5.0M)) "+5"
+    test "test7847" (lazy(sprintf "%-+*G" 7 5.0M)) "+5     "
+    test "test7848" (lazy(sprintf "%-+.5G" 5.0M)) "+5"
+    test "test7849" (lazy(sprintf "%-+.*G" 4 5.0M)) "+5"
+    test "test7850" (lazy(sprintf "%-+*.*G" 5 4 5.0M)) "+5   "
+    test "test7851" (lazy(sprintf "%+0G" 5.0M)) "+5"
+    test "test7852" (lazy(sprintf "%+05G" 5.0M)) "+0005"// "000+5"
+    test "test7853" (lazy(sprintf "%+01G" 5.0M)) "+5"
+    test "test7854" (lazy(sprintf "%+0*G" 7 5.0M)) "+000005"// "00000+5"
+    test "test7855" (lazy(sprintf "%+0.5G" 5.0M)) "+5"
+    test "test7856" (lazy(sprintf "%+0.*G" 4 5.0M)) "+5"
+    test "test7857" (lazy(sprintf "%+0*.*G" 5 4 5.0M)) "+0005"// "000+5"
+    test "test7858" (lazy(sprintf "%-+0G" 5.0M)) "+5"
+    test "test7859" (lazy(sprintf "%-+05G" 5.0M)) "+5   "// "+5000"
+    test "test7860" (lazy(sprintf "%-+01G" 5.0M)) "+5"
+    test "test7861" (lazy(sprintf "%-+0*G" 7 5.0M)) "+5     "// "+500000"
+    test "test7862" (lazy(sprintf "%-+0.5G" 5.0M)) "+5"
+    test "test7863" (lazy(sprintf "%-+0.*G" 4 5.0M)) "+5"
+    test "test7864" (lazy(sprintf "%-+0*.*G" 5 4 5.0M)) "+5   "//  "+5000"
+    test "test7865" (lazy(sprintf "% G" 5.0M)) " 5"
+    test "test7866" (lazy(sprintf "% 5G" 5.0M)) "    5"
+    test "test7867" (lazy(sprintf "% 1G" 5.0M)) " 5"
+    test "test7868" (lazy(sprintf "% *G" 7 5.0M)) "      5"
+    test "test7869" (lazy(sprintf "% .5G" 5.0M)) " 5"
+    test "test7870" (lazy(sprintf "% .*G" 4 5.0M)) " 5"
+    test "test7871" (lazy(sprintf "% *.*G" 5 4 5.0M)) "    5"
+    test "test7872" (lazy(sprintf "%- G" 5.0M)) " 5"
+    test "test7873" (lazy(sprintf "%- 5G" 5.0M)) " 5   "
+    test "test7874" (lazy(sprintf "%- 1G" 5.0M)) " 5"
+    test "test7875" (lazy(sprintf "%- *G" 7 5.0M)) " 5     "
+    test "test7876" (lazy(sprintf "%- .5G" 5.0M)) " 5"
+    test "test7877" (lazy(sprintf "%- .*G" 4 5.0M)) " 5"
+    test "test7878" (lazy(sprintf "%- *.*G" 5 4 5.0M)) " 5   "
+    test "test7879" (lazy(sprintf "% 0G" 5.0M)) " 5"
+    test "test7880" (lazy(sprintf "% 05G" 5.0M)) " 0005"// "000 5"
+    test "test7881" (lazy(sprintf "% 01G" 5.0M)) " 5"
+    test "test7882" (lazy(sprintf "% 0*G" 7 5.0M)) " 000005"// "00000 5"
+    test "test7883" (lazy(sprintf "% 0.5G" 5.0M)) " 5"
+    test "test7884" (lazy(sprintf "% 0.*G" 4 5.0M)) " 5"
+    test "test7885" (lazy(sprintf "% 0*.*G" 5 4 5.0M)) " 0005"// "000 5"
+    test "test7886" (lazy(sprintf "%- 0G" 5.0M)) " 5"
+    test "test7887" (lazy(sprintf "%- 05G" 5.0M)) " 5   "// " 5000"
+    test "test7888" (lazy(sprintf "%- 01G" 5.0M)) " 5"
+    test "test7889" (lazy(sprintf "%- 0*G" 7 5.0M)) " 5     "// " 500000"
+    test "test7890" (lazy(sprintf "%- 0.5G" 5.0M)) " 5"
+    test "test7891" (lazy(sprintf "%- 0.*G" 4 5.0M)) " 5"
+    test "test7892" (lazy(sprintf "%- 0*.*G" 5 4 5.0M)) " 5   "// " 5000"
+    test "test7893" (lazy(sprintf "%G" -10.0M)) "-10"
+    test "test7894" (lazy(sprintf "%5G" -10.0M)) "  -10"
+    test "test7895" (lazy(sprintf "%1G" -10.0M)) "-10"
+    test "test7896" (lazy(sprintf "%*G" 7 -10.0M)) "    -10"
+    test "test7897" (lazy(sprintf "%.5G" -10.0M)) "-10"
+    test "test7898" (lazy(sprintf "%.*G" 4 -10.0M)) "-10"
+    test "test7899" (lazy(sprintf "%*.*G" 5 4 -10.0M)) "  -10"
+    test "test7900" (lazy(sprintf "%-G" -10.0M)) "-10"
+    test "test7901" (lazy(sprintf "%-5G" -10.0M)) "-10  "
+    test "test7902" (lazy(sprintf "%-1G" -10.0M)) "-10"
+    test "test7903" (lazy(sprintf "%-*G" 7 -10.0M)) "-10    "
+    test "test7904" (lazy(sprintf "%-.5G" -10.0M)) "-10"
+    test "test7905" (lazy(sprintf "%-.*G" 4 -10.0M)) "-10"
+    test "test7906" (lazy(sprintf "%-*.*G" 5 4 -10.0M)) "-10  "
+    test "test7907" (lazy(sprintf "%0G" -10.0M)) "-10"
+    test "test7908" (lazy(sprintf "%05G" -10.0M)) "-0010"// "00-10"
+    test "test7909" (lazy(sprintf "%01G" -10.0M)) "-10"
+    test "test7910" (lazy(sprintf "%0*G" 7 -10.0M)) "-000010"// "0000-10"
+    test "test7911" (lazy(sprintf "%0.5G" -10.0M)) "-10"
+    test "test7912" (lazy(sprintf "%0.*G" 4 -10.0M)) "-10"
+    test "test7913" (lazy(sprintf "%0*.*G" 5 4 -10.0M)) "-0010"// "00-10"
+    test "test7914" (lazy(sprintf "%-0G" -10.0M)) "-10"
+    test "test7915" (lazy(sprintf "%-05G" -10.0M)) "-10  "// "-1000"
+    test "test7916" (lazy(sprintf "%-01G" -10.0M)) "-10"
+    test "test7917" (lazy(sprintf "%-0*G" 7 -10.0M)) "-10    "// "-100000"
+    test "test7918" (lazy(sprintf "%-0.5G" -10.0M)) "-10"
+    test "test7919" (lazy(sprintf "%-0.*G" 4 -10.0M)) "-10"
+    test "test7920" (lazy(sprintf "%-0*.*G" 5 4 -10.0M)) "-10  "// "-1000"
+    test "test7921" (lazy(sprintf "%+G" -10.0M)) "-10"
+    test "test7922" (lazy(sprintf "%+5G" -10.0M)) "  -10"
+    test "test7923" (lazy(sprintf "%+1G" -10.0M)) "-10"
+    test "test7924" (lazy(sprintf "%+*G" 7 -10.0M)) "    -10"
+    test "test7925" (lazy(sprintf "%+.5G" -10.0M)) "-10"
+    test "test7926" (lazy(sprintf "%+.*G" 4 -10.0M)) "-10"
+    test "test7927" (lazy(sprintf "%+*.*G" 5 4 -10.0M)) "  -10"
+    test "test7928" (lazy(sprintf "%-+G" -10.0M)) "-10"
+    test "test7929" (lazy(sprintf "%-+5G" -10.0M)) "-10  "
+    test "test7930" (lazy(sprintf "%-+1G" -10.0M)) "-10"
+    test "test7931" (lazy(sprintf "%-+*G" 7 -10.0M)) "-10    "
+    test "test7932" (lazy(sprintf "%-+.5G" -10.0M)) "-10"
+    test "test7933" (lazy(sprintf "%-+.*G" 4 -10.0M)) "-10"
+    test "test7934" (lazy(sprintf "%-+*.*G" 5 4 -10.0M)) "-10  "
+    test "test7935" (lazy(sprintf "%+0G" -10.0M)) "-10"
+    test "test7936" (lazy(sprintf "%+05G" -10.0M)) "-0010"//  "00-10"
+    test "test7937" (lazy(sprintf "%+01G" -10.0M)) "-10"
+    test "test7938" (lazy(sprintf "%+0*G" 7 -10.0M)) "-000010"/// "0000-10"
+    test "test7939" (lazy(sprintf "%+0.5G" -10.0M)) "-10"
+    test "test7940" (lazy(sprintf "%+0.*G" 4 -10.0M)) "-10"
+    test "test7941" (lazy(sprintf "%+0*.*G" 5 4 -10.0M)) "-0010"// "00-10"
+    test "test7942" (lazy(sprintf "%-+0G" -10.0M)) "-10"
+    test "test7943" (lazy(sprintf "%-+05G" -10.0M)) "-10  "// "-1000"
+    test "test7944" (lazy(sprintf "%-+01G" -10.0M)) "-10"
+    test "test7945" (lazy(sprintf "%-+0*G" 7 -10.0M)) "-10    "// "-100000"
+    test "test7946" (lazy(sprintf "%-+0.5G" -10.0M)) "-10"
+    test "test7947" (lazy(sprintf "%-+0.*G" 4 -10.0M)) "-10"
+    test "test7948" (lazy(sprintf "%-+0*.*G" 5 4 -10.0M)) "-10  "// "-1000"
+    test "test7949" (lazy(sprintf "% G" -10.0M)) "-10"
+    test "test7950" (lazy(sprintf "% 5G" -10.0M)) "  -10"
+    test "test7951" (lazy(sprintf "% 1G" -10.0M)) "-10"
+    test "test7952" (lazy(sprintf "% *G" 7 -10.0M)) "    -10"
+    test "test7953" (lazy(sprintf "% .5G" -10.0M)) "-10"
+    test "test7954" (lazy(sprintf "% .*G" 4 -10.0M)) "-10"
+    test "test7955" (lazy(sprintf "% *.*G" 5 4 -10.0M)) "  -10"
+    test "test7956" (lazy(sprintf "%- G" -10.0M)) "-10"
+    test "test7957" (lazy(sprintf "%- 5G" -10.0M)) "-10  "
+    test "test7958" (lazy(sprintf "%- 1G" -10.0M)) "-10"
+    test "test7959" (lazy(sprintf "%- *G" 7 -10.0M)) "-10    "
+    test "test7960" (lazy(sprintf "%- .5G" -10.0M)) "-10"
+    test "test7961" (lazy(sprintf "%- .*G" 4 -10.0M)) "-10"
+    test "test7962" (lazy(sprintf "%- *.*G" 5 4 -10.0M)) "-10  "
+    test "test7963" (lazy(sprintf "% 0G" -10.0M)) "-10"
+    test "test7964" (lazy(sprintf "% 05G" -10.0M)) "-0010"// "00-10"
+    test "test7965" (lazy(sprintf "% 01G" -10.0M)) "-10"
+    test "test7966" (lazy(sprintf "% 0*G" 7 -10.0M)) "-000010"//  "0000-10"
+    test "test7967" (lazy(sprintf "% 0.5G" -10.0M)) "-10"
+    test "test7968" (lazy(sprintf "% 0.*G" 4 -10.0M)) "-10"
+    test "test7969" (lazy(sprintf "% 0*.*G" 5 4 -10.0M)) "-0010"// "00-10"
+    test "test7970" (lazy(sprintf "%- 0G" -10.0M)) "-10"
+    test "test7971" (lazy(sprintf "%- 05G" -10.0M)) "-10  "// "-1000"
+    test "test7972" (lazy(sprintf "%- 01G" -10.0M)) "-10"
+    test "test7973" (lazy(sprintf "%- 0*G" 7 -10.0M)) "-10    "// "-100000"
+    test "test7974" (lazy(sprintf "%- 0.5G" -10.0M)) "-10"
+    test "test7975" (lazy(sprintf "%- 0.*G" 4 -10.0M)) "-10"
+    test "test7976" (lazy(sprintf "%- 0*.*G" 5 4 -10.0M)) "-10  "// "-1000"
+    test "test7977" (lazy(sprintf "%M" 10M)) "10"
+    test "test7978" (lazy(sprintf "%5M" 10M)) "   10"
+    test "test7979" (lazy(sprintf "%1M" 10M)) "10"
+    test "test7980" (lazy(sprintf "%*M" 7 10M)) "     10"
+    test "test7981" (lazy(sprintf "%.5M" 10M)) "10"
+    test "test7982" (lazy(sprintf "%.*M" 4 10M)) "10"
+    test "test7983" (lazy(sprintf "%*.*M" 5 4 10M)) "   10"
+    test "test7984" (lazy(sprintf "%-M" 10M)) "10"
+    test "test7985" (lazy(sprintf "%-5M" 10M)) "10   "
+    test "test7986" (lazy(sprintf "%-1M" 10M)) "10"
+    test "test7987" (lazy(sprintf "%-*M" 7 10M)) "10     "
+    test "test7988" (lazy(sprintf "%-.5M" 10M)) "10"
+    test "test7989" (lazy(sprintf "%-.*M" 4 10M)) "10"
+    test "test7990" (lazy(sprintf "%-*.*M" 5 4 10M)) "10   "
+    test "test7991" (lazy(sprintf "%0M" 10M)) "10"
+    test "test7992" (lazy(sprintf "%05M" 10M)) "00010"
+    test "test7993" (lazy(sprintf "%01M" 10M)) "10"
+    test "test7994" (lazy(sprintf "%0*M" 7 10M)) "0000010"
+    test "test7995" (lazy(sprintf "%0.5M" 10M)) "10"
+    test "test7996" (lazy(sprintf "%0.*M" 4 10M)) "10"
+    test "test7997" (lazy(sprintf "%0*.*M" 5 4 10M)) "00010"
+    test "test7998" (lazy(sprintf "%-0M" 10M)) "10"
+    test "test7999" (lazy(sprintf "%-05M" 10M)) "10   "//"10000"
+    test "test8000" (lazy(sprintf "%-01M" 10M)) "10"
+let func8000()=
+    test "test8001" (lazy(sprintf "%-0*M" 7 10M)) "10     "//"1000000"
+    test "test8002" (lazy(sprintf "%-0.5M" 10M)) "10"
+    test "test8003" (lazy(sprintf "%-0.*M" 4 10M)) "10"
+    test "test8004" (lazy(sprintf "%-0*.*M" 5 4 10M)) "10   "//"10000"
+    test "test8005" (lazy(sprintf "%+M" 10M)) "+10"
+    test "test8006" (lazy(sprintf "%+5M" 10M)) "  +10"
+    test "test8007" (lazy(sprintf "%+1M" 10M)) "+10"
+    test "test8008" (lazy(sprintf "%+*M" 7 10M)) "    +10"
+    test "test8009" (lazy(sprintf "%+.5M" 10M)) "+10"
+    test "test8010" (lazy(sprintf "%+.*M" 4 10M)) "+10"
+    test "test8011" (lazy(sprintf "%+*.*M" 5 4 10M)) "  +10"
+    test "test8012" (lazy(sprintf "%-+M" 10M)) "+10"
+    test "test8013" (lazy(sprintf "%-+5M" 10M)) "+10  "
+    test "test8014" (lazy(sprintf "%-+1M" 10M)) "+10"
+    test "test8015" (lazy(sprintf "%-+*M" 7 10M)) "+10    "
+    test "test8016" (lazy(sprintf "%-+.5M" 10M)) "+10"
+    test "test8017" (lazy(sprintf "%-+.*M" 4 10M)) "+10"
+    test "test8018" (lazy(sprintf "%-+*.*M" 5 4 10M)) "+10  "
+    test "test8019" (lazy(sprintf "%+0M" 10M)) "+10"
+    test "test8020" (lazy(sprintf "%+05M" 10M)) "+0010"// "00+10"
+    test "test8021" (lazy(sprintf "%+01M" 10M)) "+10"
+    test "test8022" (lazy(sprintf "%+0*M" 7 10M)) "+000010"// "0000+10"
+    test "test8023" (lazy(sprintf "%+0.5M" 10M)) "+10"
+    test "test8024" (lazy(sprintf "%+0.*M" 4 10M)) "+10"
+    test "test8025" (lazy(sprintf "%+0*.*M" 5 4 10M)) "+0010"// "00+10"
+    test "test8026" (lazy(sprintf "%-+0M" 10M)) "+10"
+    test "test8027" (lazy(sprintf "%-+05M" 10M)) "+10  "//"+1000"
+    test "test8028" (lazy(sprintf "%-+01M" 10M)) "+10"
+    test "test8029" (lazy(sprintf "%-+0*M" 7 10M)) "+10    "// "+100000"
+    test "test8030" (lazy(sprintf "%-+0.5M" 10M)) "+10"
+    test "test8031" (lazy(sprintf "%-+0.*M" 4 10M)) "+10"
+    test "test8032" (lazy(sprintf "%-+0*.*M" 5 4 10M)) "+10  "//"+1000"
+    test "test8033" (lazy(sprintf "% M" 10M)) " 10"
+    test "test8034" (lazy(sprintf "% 5M" 10M)) "   10"
+    test "test8035" (lazy(sprintf "% 1M" 10M)) " 10"
+    test "test8036" (lazy(sprintf "% *M" 7 10M)) "     10"
+    test "test8037" (lazy(sprintf "% .5M" 10M)) " 10"
+    test "test8038" (lazy(sprintf "% .*M" 4 10M)) " 10"
+    test "test8039" (lazy(sprintf "% *.*M" 5 4 10M)) "   10"
+    test "test8040" (lazy(sprintf "%- M" 10M)) " 10"
+    test "test8041" (lazy(sprintf "%- 5M" 10M)) " 10  "
+    test "test8042" (lazy(sprintf "%- 1M" 10M)) " 10"
+    test "test8043" (lazy(sprintf "%- *M" 7 10M)) " 10    "
+    test "test8044" (lazy(sprintf "%- .5M" 10M)) " 10"
+    test "test8045" (lazy(sprintf "%- .*M" 4 10M)) " 10"
+    test "test8046" (lazy(sprintf "%- *.*M" 5 4 10M)) " 10  "
+    test "test8047" (lazy(sprintf "% 0M" 10M)) " 10"
+    test "test8048" (lazy(sprintf "% 05M" 10M)) " 0010"// "00 10"
+    test "test8049" (lazy(sprintf "% 01M" 10M)) " 10"
+    test "test8050" (lazy(sprintf "% 0*M" 7 10M)) " 000010"//  "0000 10"
+    test "test8051" (lazy(sprintf "% 0.5M" 10M)) " 10"
+    test "test8052" (lazy(sprintf "% 0.*M" 4 10M)) " 10"
+    test "test8053" (lazy(sprintf "% 0*.*M" 5 4 10M)) " 0010"// "00 10"
+    test "test8054" (lazy(sprintf "%- 0M" 10M)) " 10"
+    test "test8055" (lazy(sprintf "%- 05M" 10M)) " 10  "// " 1000"
+    test "test8056" (lazy(sprintf "%- 01M" 10M)) " 10"
+    test "test8057" (lazy(sprintf "%- 0*M" 7 10M)) " 10    "//" 100000"
+    test "test8058" (lazy(sprintf "%- 0.5M" 10M)) " 10"
+    test "test8059" (lazy(sprintf "%- 0.*M" 4 10M)) " 10"
+    test "test8060" (lazy(sprintf "%- 0*.*M" 5 4 10M)) " 10  "//" 1000"
+    test "test8061" (lazy(sprintf "%M" 1.3M)) "1.3"
+    test "test8062" (lazy(sprintf "%5M" 1.3M)) "  1.3"
+    test "test8063" (lazy(sprintf "%1M" 1.3M)) "1.3"
+    test "test8064" (lazy(sprintf "%*M" 7 1.3M)) "    1.3"
+    test "test8065" (lazy(sprintf "%.5M" 1.3M)) "1.3"
+    test "test8066" (lazy(sprintf "%.*M" 4 1.3M)) "1.3"
+    test "test8067" (lazy(sprintf "%*.*M" 5 4 1.3M)) "  1.3"
+    test "test8068" (lazy(sprintf "%-M" 1.3M)) "1.3"
+    test "test8069" (lazy(sprintf "%-5M" 1.3M)) "1.3  "
+    test "test8070" (lazy(sprintf "%-1M" 1.3M)) "1.3"
+    test "test8071" (lazy(sprintf "%-*M" 7 1.3M)) "1.3    "
+    test "test8072" (lazy(sprintf "%-.5M" 1.3M)) "1.3"
+    test "test8073" (lazy(sprintf "%-.*M" 4 1.3M)) "1.3"
+    test "test8074" (lazy(sprintf "%-*.*M" 5 4 1.3M)) "1.3  "
+    test "test8075" (lazy(sprintf "%0M" 1.3M)) "1.3"
+    test "test8076" (lazy(sprintf "%05M" 1.3M)) "001.3"
+    test "test8077" (lazy(sprintf "%01M" 1.3M)) "1.3"
+    test "test8078" (lazy(sprintf "%0*M" 7 1.3M)) "00001.3"
+    test "test8079" (lazy(sprintf "%0.5M" 1.3M)) "1.3"
+    test "test8080" (lazy(sprintf "%0.*M" 4 1.3M)) "1.3"
+    test "test8081" (lazy(sprintf "%0*.*M" 5 4 1.3M)) "001.3"
+    test "test8082" (lazy(sprintf "%-0M" 1.3M)) "1.3"
+    test "test8083" (lazy(sprintf "%-05M" 1.3M)) "1.300"
+    test "test8084" (lazy(sprintf "%-01M" 1.3M)) "1.3"
+    test "test8085" (lazy(sprintf "%-0*M" 7 1.3M)) "1.30000"
+    test "test8086" (lazy(sprintf "%-0.5M" 1.3M)) "1.3"
+    test "test8087" (lazy(sprintf "%-0.*M" 4 1.3M)) "1.3"
+    test "test8088" (lazy(sprintf "%-0*.*M" 5 4 1.3M)) "1.300"
+    test "test8089" (lazy(sprintf "%+M" 1.3M)) "+1.3"
+    test "test8090" (lazy(sprintf "%+5M" 1.3M)) " +1.3"
+    test "test8091" (lazy(sprintf "%+1M" 1.3M)) "+1.3"
+    test "test8092" (lazy(sprintf "%+*M" 7 1.3M)) "   +1.3"
+    test "test8093" (lazy(sprintf "%+.5M" 1.3M)) "+1.3"
+    test "test8094" (lazy(sprintf "%+.*M" 4 1.3M)) "+1.3"
+    test "test8095" (lazy(sprintf "%+*.*M" 5 4 1.3M)) " +1.3"
+    test "test8096" (lazy(sprintf "%-+M" 1.3M)) "+1.3"
+    test "test8097" (lazy(sprintf "%-+5M" 1.3M)) "+1.3 "
+    test "test8098" (lazy(sprintf "%-+1M" 1.3M)) "+1.3"
+    test "test8099" (lazy(sprintf "%-+*M" 7 1.3M)) "+1.3   "
+    test "test8100" (lazy(sprintf "%-+.5M" 1.3M)) "+1.3"
+    test "test8101" (lazy(sprintf "%-+.*M" 4 1.3M)) "+1.3"
+    test "test8102" (lazy(sprintf "%-+*.*M" 5 4 1.3M)) "+1.3 "
+    test "test8103" (lazy(sprintf "%+0M" 1.3M)) "+1.3"
+    test "test8104" (lazy(sprintf "%+05M" 1.3M)) "+01.3"//"0+1.3"
+    test "test8105" (lazy(sprintf "%+01M" 1.3M)) "+1.3"
+    test "test8106" (lazy(sprintf "%+0*M" 7 1.3M)) "+0001.3"//"000+1.3"
+    test "test8107" (lazy(sprintf "%+0.5M" 1.3M)) "+1.3"
+    test "test8108" (lazy(sprintf "%+0.*M" 4 1.3M)) "+1.3"
+    test "test8109" (lazy(sprintf "%+0*.*M" 5 4 1.3M)) "+01.3"//"0+1.3"
+    test "test8110" (lazy(sprintf "%-+0M" 1.3M)) "+1.3"
+    test "test8111" (lazy(sprintf "%-+05M" 1.3M)) "+1.30"
+    test "test8112" (lazy(sprintf "%-+01M" 1.3M)) "+1.3"
+    test "test8113" (lazy(sprintf "%-+0*M" 7 1.3M)) "+1.3000"
+    test "test8114" (lazy(sprintf "%-+0.5M" 1.3M)) "+1.3"
+    test "test8115" (lazy(sprintf "%-+0.*M" 4 1.3M)) "+1.3"
+    test "test8116" (lazy(sprintf "%-+0*.*M" 5 4 1.3M)) "+1.30"
+    test "test8117" (lazy(sprintf "% M" 1.3M)) " 1.3"
+    test "test8118" (lazy(sprintf "% 5M" 1.3M)) "  1.3"
+    test "test8119" (lazy(sprintf "% 1M" 1.3M)) " 1.3"
+    test "test8120" (lazy(sprintf "% *M" 7 1.3M)) "    1.3"
+    test "test8121" (lazy(sprintf "% .5M" 1.3M)) " 1.3"
+    test "test8122" (lazy(sprintf "% .*M" 4 1.3M)) " 1.3"
+    test "test8123" (lazy(sprintf "% *.*M" 5 4 1.3M)) "  1.3"
+    test "test8124" (lazy(sprintf "%- M" 1.3M)) " 1.3"
+    test "test8125" (lazy(sprintf "%- 5M" 1.3M)) " 1.3 "
+    test "test8126" (lazy(sprintf "%- 1M" 1.3M)) " 1.3"
+    test "test8127" (lazy(sprintf "%- *M" 7 1.3M)) " 1.3   "
+    test "test8128" (lazy(sprintf "%- .5M" 1.3M)) " 1.3"
+    test "test8129" (lazy(sprintf "%- .*M" 4 1.3M)) " 1.3"
+    test "test8130" (lazy(sprintf "%- *.*M" 5 4 1.3M)) " 1.3 "
+    test "test8131" (lazy(sprintf "% 0M" 1.3M)) " 1.3"
+    test "test8132" (lazy(sprintf "% 05M" 1.3M)) " 01.3"//"0 1.3"
+    test "test8133" (lazy(sprintf "% 01M" 1.3M)) " 1.3"
+    test "test8134" (lazy(sprintf "% 0*M" 7 1.3M)) " 0001.3"// "000 1.3"
+    test "test8135" (lazy(sprintf "% 0.5M" 1.3M)) " 1.3"
+    test "test8136" (lazy(sprintf "% 0.*M" 4 1.3M)) " 1.3"
+    test "test8137" (lazy(sprintf "% 0*.*M" 5 4 1.3M)) " 01.3"// "0 1.3"
+    test "test8138" (lazy(sprintf "%- 0M" 1.3M)) " 1.3"
+    test "test8139" (lazy(sprintf "%- 05M" 1.3M)) " 1.30"
+    test "test8140" (lazy(sprintf "%- 01M" 1.3M)) " 1.3"
+    test "test8141" (lazy(sprintf "%- 0*M" 7 1.3M)) " 1.3000"
+    test "test8142" (lazy(sprintf "%- 0.5M" 1.3M)) " 1.3"
+    test "test8143" (lazy(sprintf "%- 0.*M" 4 1.3M)) " 1.3"
+    test "test8144" (lazy(sprintf "%- 0*.*M" 5 4 1.3M)) " 1.30"
+    test "test8145" (lazy(sprintf "%M" -15.5M)) "-15.5"
+    test "test8146" (lazy(sprintf "%5M" -15.5M)) "-15.5"
+    test "test8147" (lazy(sprintf "%1M" -15.5M)) "-15.5"
+    test "test8148" (lazy(sprintf "%*M" 7 -15.5M)) "  -15.5"
+    test "test8149" (lazy(sprintf "%.5M" -15.5M)) "-15.5"
+    test "test8150" (lazy(sprintf "%.*M" 4 -15.5M)) "-15.5"
+    test "test8151" (lazy(sprintf "%*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8152" (lazy(sprintf "%-M" -15.5M)) "-15.5"
+    test "test8153" (lazy(sprintf "%-5M" -15.5M)) "-15.5"
+    test "test8154" (lazy(sprintf "%-1M" -15.5M)) "-15.5"
+    test "test8155" (lazy(sprintf "%-*M" 7 -15.5M)) "-15.5  "
+    test "test8156" (lazy(sprintf "%-.5M" -15.5M)) "-15.5"
+    test "test8157" (lazy(sprintf "%-.*M" 4 -15.5M)) "-15.5"
+    test "test8158" (lazy(sprintf "%-*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8159" (lazy(sprintf "%0M" -15.5M)) "-15.5"
+    test "test8160" (lazy(sprintf "%05M" -15.5M)) "-15.5"
+    test "test8161" (lazy(sprintf "%01M" -15.5M)) "-15.5"
+    test "test8162" (lazy(sprintf "%0*M" 7 -15.5M)) "-0015.5"// "00-15.5"
+    test "test8163" (lazy(sprintf "%0.5M" -15.5M)) "-15.5"
+    test "test8164" (lazy(sprintf "%0.*M" 4 -15.5M)) "-15.5"
+    test "test8165" (lazy(sprintf "%0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8166" (lazy(sprintf "%-0M" -15.5M)) "-15.5"
+    test "test8167" (lazy(sprintf "%-05M" -15.5M)) "-15.5"
+    test "test8168" (lazy(sprintf "%-01M" -15.5M)) "-15.5"
+    test "test8169" (lazy(sprintf "%-0*M" 7 -15.5M)) "-15.500"
+    test "test8170" (lazy(sprintf "%-0.5M" -15.5M)) "-15.5"
+    test "test8171" (lazy(sprintf "%-0.*M" 4 -15.5M)) "-15.5"
+    test "test8172" (lazy(sprintf "%-0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8173" (lazy(sprintf "%+M" -15.5M)) "-15.5"
+    test "test8174" (lazy(sprintf "%+5M" -15.5M)) "-15.5"
+    test "test8175" (lazy(sprintf "%+1M" -15.5M)) "-15.5"
+    test "test8176" (lazy(sprintf "%+*M" 7 -15.5M)) "  -15.5"
+    test "test8177" (lazy(sprintf "%+.5M" -15.5M)) "-15.5"
+    test "test8178" (lazy(sprintf "%+.*M" 4 -15.5M)) "-15.5"
+    test "test8179" (lazy(sprintf "%+*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8180" (lazy(sprintf "%-+M" -15.5M)) "-15.5"
+    test "test8181" (lazy(sprintf "%-+5M" -15.5M)) "-15.5"
+    test "test8182" (lazy(sprintf "%-+1M" -15.5M)) "-15.5"
+    test "test8183" (lazy(sprintf "%-+*M" 7 -15.5M)) "-15.5  "
+    test "test8184" (lazy(sprintf "%-+.5M" -15.5M)) "-15.5"
+    test "test8185" (lazy(sprintf "%-+.*M" 4 -15.5M)) "-15.5"
+    test "test8186" (lazy(sprintf "%-+*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8187" (lazy(sprintf "%+0M" -15.5M)) "-15.5"
+    test "test8188" (lazy(sprintf "%+05M" -15.5M)) "-15.5"
+    test "test8189" (lazy(sprintf "%+01M" -15.5M)) "-15.5"
+    test "test8190" (lazy(sprintf "%+0*M" 7 -15.5M)) "-0015.5"//"00-15.5"
+    test "test8191" (lazy(sprintf "%+0.5M" -15.5M)) "-15.5"
+    test "test8192" (lazy(sprintf "%+0.*M" 4 -15.5M)) "-15.5"
+    test "test8193" (lazy(sprintf "%+0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8194" (lazy(sprintf "%-+0M" -15.5M)) "-15.5"
+    test "test8195" (lazy(sprintf "%-+05M" -15.5M)) "-15.5"
+    test "test8196" (lazy(sprintf "%-+01M" -15.5M)) "-15.5"
+    test "test8197" (lazy(sprintf "%-+0*M" 7 -15.5M)) "-15.500"
+    test "test8198" (lazy(sprintf "%-+0.5M" -15.5M)) "-15.5"
+    test "test8199" (lazy(sprintf "%-+0.*M" 4 -15.5M)) "-15.5"
+    test "test8200" (lazy(sprintf "%-+0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8201" (lazy(sprintf "% M" -15.5M)) "-15.5"
+    test "test8202" (lazy(sprintf "% 5M" -15.5M)) "-15.5"
+    test "test8203" (lazy(sprintf "% 1M" -15.5M)) "-15.5"
+    test "test8204" (lazy(sprintf "% *M" 7 -15.5M)) "  -15.5"
+    test "test8205" (lazy(sprintf "% .5M" -15.5M)) "-15.5"
+    test "test8206" (lazy(sprintf "% .*M" 4 -15.5M)) "-15.5"
+    test "test8207" (lazy(sprintf "% *.*M" 5 4 -15.5M)) "-15.5"
+    test "test8208" (lazy(sprintf "%- M" -15.5M)) "-15.5"
+    test "test8209" (lazy(sprintf "%- 5M" -15.5M)) "-15.5"
+    test "test8210" (lazy(sprintf "%- 1M" -15.5M)) "-15.5"
+    test "test8211" (lazy(sprintf "%- *M" 7 -15.5M)) "-15.5  "
+    test "test8212" (lazy(sprintf "%- .5M" -15.5M)) "-15.5"
+    test "test8213" (lazy(sprintf "%- .*M" 4 -15.5M)) "-15.5"
+    test "test8214" (lazy(sprintf "%- *.*M" 5 4 -15.5M)) "-15.5"
+    test "test8215" (lazy(sprintf "% 0M" -15.5M)) "-15.5"
+    test "test8216" (lazy(sprintf "% 05M" -15.5M)) "-15.5"
+    test "test8217" (lazy(sprintf "% 01M" -15.5M)) "-15.5"
+    test "test8218" (lazy(sprintf "% 0*M" 7 -15.5M)) "-0015.5"//"00-15.5"
+    test "test8219" (lazy(sprintf "% 0.5M" -15.5M)) "-15.5"
+    test "test8220" (lazy(sprintf "% 0.*M" 4 -15.5M)) "-15.5"
+    test "test8221" (lazy(sprintf "% 0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8222" (lazy(sprintf "%- 0M" -15.5M)) "-15.5"
+    test "test8223" (lazy(sprintf "%- 05M" -15.5M)) "-15.5"
+    test "test8224" (lazy(sprintf "%- 01M" -15.5M)) "-15.5"
+    test "test8225" (lazy(sprintf "%- 0*M" 7 -15.5M)) "-15.500"
+    test "test8226" (lazy(sprintf "%- 0.5M" -15.5M)) "-15.5"
+    test "test8227" (lazy(sprintf "%- 0.*M" 4 -15.5M)) "-15.5"
+    test "test8228" (lazy(sprintf "%- 0*.*M" 5 4 -15.5M)) "-15.5"
+    test "test8229" (lazy(sprintf "%M" -7M)) "-7"
+    test "test8230" (lazy(sprintf "%5M" -7M)) "   -7"
+    test "test8231" (lazy(sprintf "%1M" -7M)) "-7"
+    test "test8232" (lazy(sprintf "%*M" 7 -7M)) "     -7"
+    test "test8233" (lazy(sprintf "%.5M" -7M)) "-7"
+    test "test8234" (lazy(sprintf "%.*M" 4 -7M)) "-7"
+    test "test8235" (lazy(sprintf "%*.*M" 5 4 -7M)) "   -7"
+    test "test8236" (lazy(sprintf "%-M" -7M)) "-7"
+    test "test8237" (lazy(sprintf "%-5M" -7M)) "-7   "
+    test "test8238" (lazy(sprintf "%-1M" -7M)) "-7"
+    test "test8239" (lazy(sprintf "%-*M" 7 -7M)) "-7     "
+    test "test8240" (lazy(sprintf "%-.5M" -7M)) "-7"
+    test "test8241" (lazy(sprintf "%-.*M" 4 -7M)) "-7"
+    test "test8242" (lazy(sprintf "%-*.*M" 5 4 -7M)) "-7   "
+    test "test8243" (lazy(sprintf "%0M" -7M)) "-7"
+    test "test8244" (lazy(sprintf "%05M" -7M)) "-0007"//"000-7"
+    test "test8245" (lazy(sprintf "%01M" -7M)) "-7"
+    test "test8246" (lazy(sprintf "%0*M" 7 -7M)) "-000007"// "00000-7"
+    test "test8247" (lazy(sprintf "%0.5M" -7M)) "-7"
+    test "test8248" (lazy(sprintf "%0.*M" 4 -7M)) "-7"
+    test "test8249" (lazy(sprintf "%0*.*M" 5 4 -7M)) "-0007"// "000-7"
+    test "test8250" (lazy(sprintf "%-0M" -7M)) "-7"
+    test "test8251" (lazy(sprintf "%-05M" -7M)) "-7   "// "-7000"
+    test "test8252" (lazy(sprintf "%-01M" -7M)) "-7"
+    test "test8253" (lazy(sprintf "%-0*M" 7 -7M)) "-7     "//"-700000"
+    test "test8254" (lazy(sprintf "%-0.5M" -7M)) "-7"
+    test "test8255" (lazy(sprintf "%-0.*M" 4 -7M)) "-7"
+    test "test8256" (lazy(sprintf "%-0*.*M" 5 4 -7M)) "-7   "//"-7000"
+    test "test8257" (lazy(sprintf "%+M" -7M)) "-7"
+    test "test8258" (lazy(sprintf "%+5M" -7M)) "   -7"
+    test "test8259" (lazy(sprintf "%+1M" -7M)) "-7"
+    test "test8260" (lazy(sprintf "%+*M" 7 -7M)) "     -7"
+    test "test8261" (lazy(sprintf "%+.5M" -7M)) "-7"
+    test "test8262" (lazy(sprintf "%+.*M" 4 -7M)) "-7"
+    test "test8263" (lazy(sprintf "%+*.*M" 5 4 -7M)) "   -7"
+    test "test8264" (lazy(sprintf "%-+M" -7M)) "-7"
+    test "test8265" (lazy(sprintf "%-+5M" -7M)) "-7   "
+    test "test8266" (lazy(sprintf "%-+1M" -7M)) "-7"
+    test "test8267" (lazy(sprintf "%-+*M" 7 -7M)) "-7     "
+    test "test8268" (lazy(sprintf "%-+.5M" -7M)) "-7"
+    test "test8269" (lazy(sprintf "%-+.*M" 4 -7M)) "-7"
+    test "test8270" (lazy(sprintf "%-+*.*M" 5 4 -7M)) "-7   "
+    test "test8271" (lazy(sprintf "%+0M" -7M)) "-7"
+    test "test8272" (lazy(sprintf "%+05M" -7M)) "-0007"// "000-7"
+    test "test8273" (lazy(sprintf "%+01M" -7M)) "-7"
+    test "test8274" (lazy(sprintf "%+0*M" 7 -7M)) "-000007"//"00000-7"
+    test "test8275" (lazy(sprintf "%+0.5M" -7M)) "-7"
+    test "test8276" (lazy(sprintf "%+0.*M" 4 -7M)) "-7"
+    test "test8277" (lazy(sprintf "%+0*.*M" 5 4 -7M)) "-0007"//"000-7"
+    test "test8278" (lazy(sprintf "%-+0M" -7M)) "-7"
+    test "test8279" (lazy(sprintf "%-+05M" -7M)) "-7   "// "-7000"
+    test "test8280" (lazy(sprintf "%-+01M" -7M)) "-7"
+    test "test8281" (lazy(sprintf "%-+0*M" 7 -7M)) "-7     "// "-700000"
+    test "test8282" (lazy(sprintf "%-+0.5M" -7M)) "-7"
+    test "test8283" (lazy(sprintf "%-+0.*M" 4 -7M)) "-7"
+    test "test8284" (lazy(sprintf "%-+0*.*M" 5 4 -7M)) "-7   "//"-7000"
+    test "test8285" (lazy(sprintf "% M" -7M)) "-7"
+    test "test8286" (lazy(sprintf "% 5M" -7M)) "   -7"
+    test "test8287" (lazy(sprintf "% 1M" -7M)) "-7"
+    test "test8288" (lazy(sprintf "% *M" 7 -7M)) "     -7"
+    test "test8289" (lazy(sprintf "% .5M" -7M)) "-7"
+    test "test8290" (lazy(sprintf "% .*M" 4 -7M)) "-7"
+    test "test8291" (lazy(sprintf "% *.*M" 5 4 -7M)) "   -7"
+    test "test8292" (lazy(sprintf "%- M" -7M)) "-7"
+    test "test8293" (lazy(sprintf "%- 5M" -7M)) "-7   "
+    test "test8294" (lazy(sprintf "%- 1M" -7M)) "-7"
+    test "test8295" (lazy(sprintf "%- *M" 7 -7M)) "-7     "
+    test "test8296" (lazy(sprintf "%- .5M" -7M)) "-7"
+    test "test8297" (lazy(sprintf "%- .*M" 4 -7M)) "-7"
+    test "test8298" (lazy(sprintf "%- *.*M" 5 4 -7M)) "-7   "
+    test "test8299" (lazy(sprintf "% 0M" -7M)) "-7"
+    test "test8300" (lazy(sprintf "% 05M" -7M)) "-0007"//"000-7"
+    test "test8301" (lazy(sprintf "% 01M" -7M)) "-7"
+    test "test8302" (lazy(sprintf "% 0*M" 7 -7M)) "-000007"//"00000-7"
+    test "test8303" (lazy(sprintf "% 0.5M" -7M)) "-7"
+    test "test8304" (lazy(sprintf "% 0.*M" 4 -7M)) "-7"
+    test "test8305" (lazy(sprintf "% 0*.*M" 5 4 -7M)) "-0007"// "000-7"
+    test "test8306" (lazy(sprintf "%- 0M" -7M)) "-7"
+    test "test8307" (lazy(sprintf "%- 05M" -7M)) "-7   "// "-7000"
+    test "test8308" (lazy(sprintf "%- 01M" -7M)) "-7"
+    test "test8309" (lazy(sprintf "%- 0*M" 7 -7M)) "-7     "//"-700000"
+    test "test8310" (lazy(sprintf "%- 0.5M" -7M)) "-7"
+    test "test8311" (lazy(sprintf "%- 0.*M" 4 -7M)) "-7"
+    test "test8312" (lazy(sprintf "%- 0*.*M" 5 4 -7M)) "-7   "///"-7000"
+    test "test8313" (lazy(sprintf "%O" "abc")) "abc"
+    test "test8314" (lazy(sprintf "%5O" "abc")) "  abc"
+    test "test8315" (lazy(sprintf "%1O" "abc")) "abc"
+    test "test8316" (lazy(sprintf "%*O" 7 "abc")) "    abc"
+    test "test8317" (lazy(sprintf "%-O" "abc")) "abc"
+    test "test8318" (lazy(sprintf "%-5O" "abc")) "abc  "
+    test "test8319" (lazy(sprintf "%-1O" "abc")) "abc"
+    test "test8320" (lazy(sprintf "%-*O" 7 "abc")) "abc    "
+    test "test8321" (lazy(sprintf "%O" 15)) "15"
+    test "test8322" (lazy(sprintf "%5O" 15)) "   15"
+    test "test8323" (lazy(sprintf "%1O" 15)) "15"
+    test "test8324" (lazy(sprintf "%*O" 7 15)) "     15"
+    test "test8325" (lazy(sprintf "%-O" 15)) "15"
+    test "test8326" (lazy(sprintf "%-5O" 15)) "15   "
+    test "test8327" (lazy(sprintf "%-1O" 15)) "15"
+    test "test8328" (lazy(sprintf "%-*O" 7 15)) "15     "
+    test "test8329" (lazy(sprintf "%O" -10)) "-10"
+    test "test8330" (lazy(sprintf "%5O" -10)) "  -10"
+    test "test8331" (lazy(sprintf "%1O" -10)) "-10"
+    test "test8332" (lazy(sprintf "%*O" 7 -10)) "    -10"
+    test "test8333" (lazy(sprintf "%-O" -10)) "-10"
+    test "test8334" (lazy(sprintf "%-5O" -10)) "-10  "
+    test "test8335" (lazy(sprintf "%-1O" -10)) "-10"
+    test "test8336" (lazy(sprintf "%-*O" 7 -10)) "-10    "
+    test "test8337" (lazy(sprintf "%O" null)) "<null>"
+    test "test8338" (lazy(sprintf "%5O" null)) "<null>"
+    test "test8339" (lazy(sprintf "%1O" null)) "<null>"
+    test "test8340" (lazy(sprintf "%*O" 7 null)) " <null>"
+    test "test8341" (lazy(sprintf "%-O" null)) "<null>"
+    test "test8342" (lazy(sprintf "%-5O" null)) "<null>"
+    test "test8343" (lazy(sprintf "%-1O" null)) "<null>"
+    test "test8344" (lazy(sprintf "%-*O" 7 null)) "<null> "
+    test "test8345" (lazy(sprintf "%O" 'P')) "P"
+    test "test8346" (lazy(sprintf "%5O" 'P')) "    P"
+    test "test8347" (lazy(sprintf "%1O" 'P')) "P"
+    test "test8348" (lazy(sprintf "%*O" 7 'P')) "      P"
+    test "test8349" (lazy(sprintf "%-O" 'P')) "P"
+    test "test8350" (lazy(sprintf "%-5O" 'P')) "P    "
+    test "test8351" (lazy(sprintf "%-1O" 'P')) "P"
+    test "test8352" (lazy(sprintf "%-*O" 7 'P')) "P      "
+    test "test8353" (lazy(sprintf "%O" System.IO.FileShare.None)) "None"
+    test "test8354" (lazy(sprintf "%5O" System.IO.FileShare.None)) " None"
+    test "test8355" (lazy(sprintf "%1O" System.IO.FileShare.None)) "None"
+    test "test8356" (lazy(sprintf "%*O" 7 System.IO.FileShare.None)) "   None"
+    test "test8357" (lazy(sprintf "%-O" System.IO.FileShare.None)) "None"
+    test "test8358" (lazy(sprintf "%-5O" System.IO.FileShare.None)) "None "
+    test "test8359" (lazy(sprintf "%-1O" System.IO.FileShare.None)) "None"
+    test "test8360" (lazy(sprintf "%-*O" 7 System.IO.FileShare.None)) "None   "
+    test "test8361" (lazy(sprintf "%A" "abc")) "\"abc\""
+    test "test8362" (lazy(sprintf "%5A" "abc")) "\"abc\""
+    test "test8363" (lazy(sprintf "%1A" "abc")) "\"abc\""
+    test "test8364" (lazy(sprintf "%*A" 7 "abc")) "\"abc\""
+    test "test8365" (lazy(sprintf "%.5A" "abc")) "\"abc\""
+    test "test8366" (lazy(sprintf "%.*A" 4 "abc")) "\"abc\""
+    test "test8367" (lazy(sprintf "%*.*A" 5 4 "abc")) "\"abc\""
+    test "test8368" (lazy(sprintf "%-A" "abc")) "\"abc\""
+    test "test8369" (lazy(sprintf "%-5A" "abc")) "\"abc\""
+    test "test8370" (lazy(sprintf "%-1A" "abc")) "\"abc\""
+    test "test8371" (lazy(sprintf "%-*A" 7 "abc")) "\"abc\""
+    test "test8372" (lazy(sprintf "%-.5A" "abc")) "\"abc\""
+    test "test8373" (lazy(sprintf "%-.*A" 4 "abc")) "\"abc\""
+    test "test8374" (lazy(sprintf "%-*.*A" 5 4 "abc")) "\"abc\""
+    test "test8375" (lazy(sprintf "%+A" "abc")) "\"abc\""
+    test "test8376" (lazy(sprintf "%+5A" "abc")) "\"abc\""
+    test "test8377" (lazy(sprintf "%+1A" "abc")) "\"abc\""
+    test "test8378" (lazy(sprintf "%+*A" 7 "abc")) "\"abc\""
+    test "test8379" (lazy(sprintf "%+.5A" "abc")) "\"abc\""
+    test "test8380" (lazy(sprintf "%+.*A" 4 "abc")) "\"abc\""
+    test "test8381" (lazy(sprintf "%+*.*A" 5 4 "abc")) "\"abc\""
+    test "test8382" (lazy(sprintf "%-+A" "abc")) "\"abc\""
+    test "test8383" (lazy(sprintf "%-+5A" "abc")) "\"abc\""
+    test "test8384" (lazy(sprintf "%-+1A" "abc")) "\"abc\""
+    test "test8385" (lazy(sprintf "%-+*A" 7 "abc")) "\"abc\""
+    test "test8386" (lazy(sprintf "%-+.5A" "abc")) "\"abc\""
+    test "test8387" (lazy(sprintf "%-+.*A" 4 "abc")) "\"abc\""
+    test "test8388" (lazy(sprintf "%-+*.*A" 5 4 "abc")) "\"abc\""
+    test "test8389" (lazy(sprintf "%A" 15)) "15"
+    test "test8390" (lazy(sprintf "%5A" 15)) "15"
+    test "test8391" (lazy(sprintf "%1A" 15)) "15"
+    test "test8392" (lazy(sprintf "%*A" 7 15)) "15"
+    test "test8393" (lazy(sprintf "%.5A" 15)) "15"
+    test "test8394" (lazy(sprintf "%.*A" 4 15)) "15"
+    test "test8395" (lazy(sprintf "%*.*A" 5 4 15)) "15"
+    test "test8396" (lazy(sprintf "%-A" 15)) "15"
+    test "test8397" (lazy(sprintf "%-5A" 15)) "15"
+    test "test8398" (lazy(sprintf "%-1A" 15)) "15"
+    test "test8399" (lazy(sprintf "%-*A" 7 15)) "15"
+    test "test8400" (lazy(sprintf "%-.5A" 15)) "15"
+    test "test8401" (lazy(sprintf "%-.*A" 4 15)) "15"
+    test "test8402" (lazy(sprintf "%-*.*A" 5 4 15)) "15"
+    test "test8403" (lazy(sprintf "%+A" 15)) "15"
+    test "test8404" (lazy(sprintf "%+5A" 15)) "15"
+    test "test8405" (lazy(sprintf "%+1A" 15)) "15"
+    test "test8406" (lazy(sprintf "%+*A" 7 15)) "15"
+    test "test8407" (lazy(sprintf "%+.5A" 15)) "15"
+    test "test8408" (lazy(sprintf "%+.*A" 4 15)) "15"
+    test "test8409" (lazy(sprintf "%+*.*A" 5 4 15)) "15"
+    test "test8410" (lazy(sprintf "%-+A" 15)) "15"
+    test "test8411" (lazy(sprintf "%-+5A" 15)) "15"
+    test "test8412" (lazy(sprintf "%-+1A" 15)) "15"
+    test "test8413" (lazy(sprintf "%-+*A" 7 15)) "15"
+    test "test8414" (lazy(sprintf "%-+.5A" 15)) "15"
+    test "test8415" (lazy(sprintf "%-+.*A" 4 15)) "15"
+    test "test8416" (lazy(sprintf "%-+*.*A" 5 4 15)) "15"
+    test "test8417" (lazy(sprintf "%A" -10)) "-10"
+    test "test8418" (lazy(sprintf "%5A" -10)) "-10"
+    test "test8419" (lazy(sprintf "%1A" -10)) "-10"
+    test "test8420" (lazy(sprintf "%*A" 7 -10)) "-10"
+    test "test8421" (lazy(sprintf "%.5A" -10)) "-10"
+    test "test8422" (lazy(sprintf "%.*A" 4 -10)) "-10"
+    test "test8423" (lazy(sprintf "%*.*A" 5 4 -10)) "-10"
+    test "test8424" (lazy(sprintf "%-A" -10)) "-10"
+    test "test8425" (lazy(sprintf "%-5A" -10)) "-10"
+    test "test8426" (lazy(sprintf "%-1A" -10)) "-10"
+    test "test8427" (lazy(sprintf "%-*A" 7 -10)) "-10"
+    test "test8428" (lazy(sprintf "%-.5A" -10)) "-10"
+    test "test8429" (lazy(sprintf "%-.*A" 4 -10)) "-10"
+    test "test8430" (lazy(sprintf "%-*.*A" 5 4 -10)) "-10"
+    test "test8431" (lazy(sprintf "%+A" -10)) "-10"
+    test "test8432" (lazy(sprintf "%+5A" -10)) "-10"
+    test "test8433" (lazy(sprintf "%+1A" -10)) "-10"
+    test "test8434" (lazy(sprintf "%+*A" 7 -10)) "-10"
+    test "test8435" (lazy(sprintf "%+.5A" -10)) "-10"
+    test "test8436" (lazy(sprintf "%+.*A" 4 -10)) "-10"
+    test "test8437" (lazy(sprintf "%+*.*A" 5 4 -10)) "-10"
+    test "test8438" (lazy(sprintf "%-+A" -10)) "-10"
+    test "test8439" (lazy(sprintf "%-+5A" -10)) "-10"
+    test "test8440" (lazy(sprintf "%-+1A" -10)) "-10"
+    test "test8441" (lazy(sprintf "%-+*A" 7 -10)) "-10"
+    test "test8442" (lazy(sprintf "%-+.5A" -10)) "-10"
+    test "test8443" (lazy(sprintf "%-+.*A" 4 -10)) "-10"
+    test "test8444" (lazy(sprintf "%-+*.*A" 5 4 -10)) "-10"
+    test "test8445" (lazy(sprintf "%A" null)) "<null>"
+    test "test8446" (lazy(sprintf "%5A" null)) "<null>"
+    test "test8447" (lazy(sprintf "%1A" null)) "<null>"
+    test "test8448" (lazy(sprintf "%*A" 7 null)) "<null>"
+    test "test8449" (lazy(sprintf "%.5A" null)) "<null>"
+    test "test8450" (lazy(sprintf "%.*A" 4 null)) "<null>"
+    test "test8451" (lazy(sprintf "%*.*A" 5 4 null)) "<null>"
+    test "test8452" (lazy(sprintf "%-A" null)) "<null>"
+    test "test8453" (lazy(sprintf "%-5A" null)) "<null>"
+    test "test8454" (lazy(sprintf "%-1A" null)) "<null>"
+    test "test8455" (lazy(sprintf "%-*A" 7 null)) "<null>"
+    test "test8456" (lazy(sprintf "%-.5A" null)) "<null>"
+    test "test8457" (lazy(sprintf "%-.*A" 4 null)) "<null>"
+    test "test8458" (lazy(sprintf "%-*.*A" 5 4 null)) "<null>"
+    test "test8459" (lazy(sprintf "%+A" null)) "<null>"
+    test "test8460" (lazy(sprintf "%+5A" null)) "<null>"
+    test "test8461" (lazy(sprintf "%+1A" null)) "<null>"
+    test "test8462" (lazy(sprintf "%+*A" 7 null)) "<null>"
+    test "test8463" (lazy(sprintf "%+.5A" null)) "<null>"
+    test "test8464" (lazy(sprintf "%+.*A" 4 null)) "<null>"
+    test "test8465" (lazy(sprintf "%+*.*A" 5 4 null)) "<null>"
+    test "test8466" (lazy(sprintf "%-+A" null)) "<null>"
+    test "test8467" (lazy(sprintf "%-+5A" null)) "<null>"
+    test "test8468" (lazy(sprintf "%-+1A" null)) "<null>"
+    test "test8469" (lazy(sprintf "%-+*A" 7 null)) "<null>"
+    test "test8470" (lazy(sprintf "%-+.5A" null)) "<null>"
+    test "test8471" (lazy(sprintf "%-+.*A" 4 null)) "<null>"
+    test "test8472" (lazy(sprintf "%-+*.*A" 5 4 null)) "<null>"
+    test "test8473" (lazy(sprintf "%A" 'P')) "'P'"
+    test "test8474" (lazy(sprintf "%5A" 'P')) "'P'"
+    test "test8475" (lazy(sprintf "%1A" 'P')) "'P'"
+    test "test8476" (lazy(sprintf "%*A" 7 'P')) "'P'"
+    test "test8477" (lazy(sprintf "%.5A" 'P')) "'P'"
+    test "test8478" (lazy(sprintf "%.*A" 4 'P')) "'P'"
+    test "test8479" (lazy(sprintf "%*.*A" 5 4 'P')) "'P'"
+    test "test8480" (lazy(sprintf "%-A" 'P')) "'P'"
+    test "test8481" (lazy(sprintf "%-5A" 'P')) "'P'"
+    test "test8482" (lazy(sprintf "%-1A" 'P')) "'P'"
+    test "test8483" (lazy(sprintf "%-*A" 7 'P')) "'P'"
+    test "test8484" (lazy(sprintf "%-.5A" 'P')) "'P'"
+    test "test8485" (lazy(sprintf "%-.*A" 4 'P')) "'P'"
+    test "test8486" (lazy(sprintf "%-*.*A" 5 4 'P')) "'P'"
+    test "test8487" (lazy(sprintf "%+A" 'P')) "'P'"
+    test "test8488" (lazy(sprintf "%+5A" 'P')) "'P'"
+    test "test8489" (lazy(sprintf "%+1A" 'P')) "'P'"
+    test "test8490" (lazy(sprintf "%+*A" 7 'P')) "'P'"
+    test "test8491" (lazy(sprintf "%+.5A" 'P')) "'P'"
+    test "test8492" (lazy(sprintf "%+.*A" 4 'P')) "'P'"
+    test "test8493" (lazy(sprintf "%+*.*A" 5 4 'P')) "'P'"
+    test "test8494" (lazy(sprintf "%-+A" 'P')) "'P'"
+    test "test8495" (lazy(sprintf "%-+5A" 'P')) "'P'"
+    test "test8496" (lazy(sprintf "%-+1A" 'P')) "'P'"
+    test "test8497" (lazy(sprintf "%-+*A" 7 'P')) "'P'"
+    test "test8498" (lazy(sprintf "%-+.5A" 'P')) "'P'"
+    test "test8499" (lazy(sprintf "%-+.*A" 4 'P')) "'P'"
+    test "test8500" (lazy(sprintf "%-+*.*A" 5 4 'P')) "'P'"
+    test "test8501" (lazy(sprintf "%A" System.IO.FileShare.None)) "None"
+    test "test8502" (lazy(sprintf "%5A" System.IO.FileShare.None)) "None"
+    test "test8503" (lazy(sprintf "%1A" System.IO.FileShare.None)) "None"
+    test "test8504" (lazy(sprintf "%*A" 7 System.IO.FileShare.None)) "None"
+    test "test8505" (lazy(sprintf "%.5A" System.IO.FileShare.None)) "None"
+    test "test8506" (lazy(sprintf "%.*A" 4 System.IO.FileShare.None)) "None"
+    test "test8507" (lazy(sprintf "%*.*A" 5 4 System.IO.FileShare.None)) "None"
+    test "test8508" (lazy(sprintf "%-A" System.IO.FileShare.None)) "None"
+    test "test8509" (lazy(sprintf "%-5A" System.IO.FileShare.None)) "None"
+    test "test8510" (lazy(sprintf "%-1A" System.IO.FileShare.None)) "None"
+    test "test8511" (lazy(sprintf "%-*A" 7 System.IO.FileShare.None)) "None"
+    test "test8512" (lazy(sprintf "%-.5A" System.IO.FileShare.None)) "None"
+    test "test8513" (lazy(sprintf "%-.*A" 4 System.IO.FileShare.None)) "None"
+    test "test8514" (lazy(sprintf "%-*.*A" 5 4 System.IO.FileShare.None)) "None"
+    test "test8515" (lazy(sprintf "%+A" System.IO.FileShare.None)) "None"
+    test "test8516" (lazy(sprintf "%+5A" System.IO.FileShare.None)) "None"
+    test "test8517" (lazy(sprintf "%+1A" System.IO.FileShare.None)) "None"
+    test "test8518" (lazy(sprintf "%+*A" 7 System.IO.FileShare.None)) "None"
+    test "test8519" (lazy(sprintf "%+.5A" System.IO.FileShare.None)) "None"
+    test "test8520" (lazy(sprintf "%+.*A" 4 System.IO.FileShare.None)) "None"
+    test "test8521" (lazy(sprintf "%+*.*A" 5 4 System.IO.FileShare.None)) "None"
+    test "test8522" (lazy(sprintf "%-+A" System.IO.FileShare.None)) "None"
+    test "test8523" (lazy(sprintf "%-+5A" System.IO.FileShare.None)) "None"
+    test "test8524" (lazy(sprintf "%-+1A" System.IO.FileShare.None)) "None"
+    test "test8525" (lazy(sprintf "%-+*A" 7 System.IO.FileShare.None)) "None"
+    test "test8526" (lazy(sprintf "%-+.5A" System.IO.FileShare.None)) "None"
+    test "test8527" (lazy(sprintf "%-+.*A" 4 System.IO.FileShare.None)) "None"
+    test "test8528" (lazy(sprintf "%-+*.*A" 5 4 System.IO.FileShare.None)) "None"
+    test "test8529" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") "abc")) "abc!!!"
+    test "test8530" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") 15)) "15!!!"
+    test "test8531" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") -10)) "-10!!!"
+    test "test8532" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") null)) "!!!"
+    test "test8533" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") 'P')) "P!!!"
+    test "test8534" (lazy(sprintf "%a" (fun _ s -> (string s) + "!!!") System.IO.FileShare.None)) "None!!!"
+    test "test8535" (lazy(sprintf "%t" (fun _ -> "???"))) "???"
+    test "test8536" (lazy(sprintf "A%dB" 0)) "A0B"
+    test "test8537" (lazy(sprintf "A%dB%dC" 0 1)) "A0B1C"
+    test "test8538" (lazy(sprintf "A%dB%dC%dD" 0 1 2)) "A0B1C2D"
+    test "test8539" (lazy(sprintf "A%dB%dC%dD%dE" 0 1 2 3)) "A0B1C2D3E"
+    test "test8540" (lazy(sprintf "A%dB%dC%dD%dE%dF" 0 1 2 3 4)) "A0B1C2D3E4F"
+    test "test8541" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG" 0 1 2 3 4 5)) "A0B1C2D3E4F5G"
+    test "test8542" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH" 0 1 2 3 4 5 6)) "A0B1C2D3E4F5G6H"
+    test "test8543" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI" 0 1 2 3 4 5 6 7)) "A0B1C2D3E4F5G6H7I"
+    test "test8544" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ" 0 1 2 3 4 5 6 7 8)) "A0B1C2D3E4F5G6H7I8J"
+    test "test8545" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK" 0 1 2 3 4 5 6 7 8 9)) "A0B1C2D3E4F5G6H7I8J9K"
+    test "test8546" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL" 0 1 2 3 4 5 6 7 8 9 10)) "A0B1C2D3E4F5G6H7I8J9K10L"
+    test "test8547" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM" 0 1 2 3 4 5 6 7 8 9 10 11)) "A0B1C2D3E4F5G6H7I8J9K10L11M"
+    test "test8548" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN" 0 1 2 3 4 5 6 7 8 9 10 11 12)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N"
+    test "test8549" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO" 0 1 2 3 4 5 6 7 8 9 10 11 12 13)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O"
+    test "test8550" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P"
+    test "test8551" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP%dQ" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P15Q"
+    test "test8552" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP%dQ%dR" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P15Q16R"
+    test "test8553" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP%dQ%dR%dS" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P15Q16R17S"
+    test "test8554" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP%dQ%dR%dS%dT" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P15Q16R17S18T"
+    test "test8555" (lazy(sprintf "A%dB%dC%dD%dE%dF%dG%dH%dI%dJ%dK%dL%dM%dN%dO%dP%dQ%dR%dS%dT%dU" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P15Q16R17S18T19U"
+    test "test8556" (lazy(sprintf "A%aB" (fun _ v -> string v) 0)) "A0B"
+    test "test8557" (lazy(sprintf "A%aB%aC" (fun _ v -> string v) 0 (fun _ v -> string v) 1)) "A0B1C"
+    test "test8558" (lazy(sprintf "A%aB%aC%aD" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2)) "A0B1C2D"
+    test "test8559" (lazy(sprintf "A%aB%aC%aD%aE" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3)) "A0B1C2D3E"
+    test "test8560" (lazy(sprintf "A%aB%aC%aD%aE%aF" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4)) "A0B1C2D3E4F"
+    test "test8561" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5)) "A0B1C2D3E4F5G"
+    test "test8562" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6)) "A0B1C2D3E4F5G6H"
+    test "test8563" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7)) "A0B1C2D3E4F5G6H7I"
+    test "test8564" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8)) "A0B1C2D3E4F5G6H7I8J"
+    test "test8565" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9)) "A0B1C2D3E4F5G6H7I8J9K"
+    test "test8566" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10)) "A0B1C2D3E4F5G6H7I8J9K10L"
+    test "test8567" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11)) "A0B1C2D3E4F5G6H7I8J9K10L11M"
+    test "test8568" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N"
+    test "test8569" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O"
+    test "test8570" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14)) "A0B1C2D3E4F5G6H7I8J9K10L11M12N13O14P"
+    test "test8571" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP%aQ" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14 (fun _ v -> string v) 15)) "A0B1C2D3E4F5G [...]
+    test "test8572" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP%aQ%aR" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14 (fun _ v -> string v) 15 (fun _ v -> s [...]
+    test "test8573" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP%aQ%aR%aS" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14 (fun _ v -> string v) 15 (fun _ v - [...]
+    test "test8574" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP%aQ%aR%aS%aT" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14 (fun _ v -> string v) 15 (fun _  [...]
+    test "test8575" (lazy(sprintf "A%aB%aC%aD%aE%aF%aG%aH%aI%aJ%aK%aL%aM%aN%aO%aP%aQ%aR%aS%aT%aU" (fun _ v -> string v) 0 (fun _ v -> string v) 1 (fun _ v -> string v) 2 (fun _ v -> string v) 3 (fun _ v -> string v) 4 (fun _ v -> string v) 5 (fun _ v -> string v) 6 (fun _ v -> string v) 7 (fun _ v -> string v) 8 (fun _ v -> string v) 9 (fun _ v -> string v) 10 (fun _ v -> string v) 11 (fun _ v -> string v) 12 (fun _ v -> string v) 13 (fun _ v -> string v) 14 (fun _ v -> string v) 15 (fun [...]
+    test "test8576" (lazy(sprintf "01-00%d01-01%a11-10%d11-11" 0  (fun _ v -> (string v) + "X") 1  10 )) "01-00001-011X11-101011-11"
+    test "test8577" (lazy(sprintf "01-00%d01-01%a11-10%d11-11%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-011X11-101011-11ReadX_TAIL"
+    test "test8578" (lazy(sprintf "01-00%d01-01%d01-02%a11-10%d11-11%d11-12" 0 1  (fun _ v -> (string v) + "X") 1  10 11 )) "01-00001-01101-021X11-101011-111111-12"
+    test "test8579" (lazy(sprintf "01-00%d01-01%d01-02%a11-10%d11-11%d11-12%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-021X11-101011-111111-12ReadX_TAIL"
+    test "test8580" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%a11-10%d11-11%d11-12%d11-13" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12 )) "01-00001-01101-02201-031X11-101011-111111-121211-13"
+    test "test8581" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%a11-10%d11-11%d11-12%d11-13%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-031X11-101011-111111-121211-13ReadX_TAIL"
+    test "test8582" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%a11-10%d11-11%d11-12%d11-13%d11-14" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13 )) "01-00001-01101-02201-03301-041X11-101011-111111-121211-131311-14"
+    test "test8583" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%a11-10%d11-11%d11-12%d11-13%d11-14%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-041X11-101011-111111-121211-131311-14ReadX_TAIL"
+    test "test8584" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 )) "01-00001-01101-02201-03301-04401-051X11-101011-111111-121211-131311-141411-15"
+    test "test8585" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-04401-051X11-101011-111111-121211-131311-141411-15ReadX_TAIL"
+    test "test8586" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 )) "01-00001-01101-02201-03301-04401-05501-061X11-101011-111111-121211-131311-141411-151511-16"
+    test "test8587" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-04401-05501-061X11-101011-111111-121211-131311-141411-151511-16ReadX_TAIL"
+    test "test8588" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 )) "01-00001-01101-02201-03301-04401-05501-06601-071X11-101011-111111-121211-131311-141411-151511-161611-17"
+    test "test8589" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-04401-05501-06601-071X11-101011-111111-121211-131311-141411-151511-161611-17ReadX_TAIL"
+    test "test8590" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%d01-08%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17%d11-18" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 )) "01-00001-01101-02201-03301-04401-05501-06601-07701-081X11-101011-111111-121211-131311-141411-151511-161611-171711-18"
+    test "test8591" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%d01-08%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17%d11-18%a_TAIL" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-04401-05501-06601-07701-081X11-101011-111111-121211-131311-141411-151511-161611-171711-18ReadX_TAIL"
+    test "test8592" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%d01-08%d01-09%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17%d11-18%d11-19" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18 )) "01-00001-01101-02201-03301-04401-05501-06601-07701-08801-091X11-101011-111111-121211-131311-141411-151511-161611-171711-181811-19"
+    test "test8593" (lazy(sprintf "01-00%d01-01%d01-02%d01-03%d01-04%d01-05%d01-06%d01-07%d01-08%d01-09%a11-10%d11-11%d11-12%d11-13%d11-14%d11-15%d11-16%d11-17%d11-18%d11-19%a_TAIL" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "01-00001-01101-02201-03301-04401-05501-06601-07701-08801-091X11-101011-111111-121211-131311-141411-151511-161611-171711-181811-19ReadX_TAIL"
+    test "test8594" (lazy(sprintf "02-00%d02-01%a12-10%d12-11%a22-20%d22-21" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20 )) "02-00002-011X12-101012-112X22-202022-21"
+    test "test8595" (lazy(sprintf "02-00%d02-01%a12-10%d12-11%a22-20%d22-21%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-011X12-101012-112X22-202022-21ReadX_TAIL"
+    test "test8596" (lazy(sprintf "02-00%d02-01%d02-02%a12-10%d12-11%d12-12%a22-20%d22-21%d22-22" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21 )) "02-00002-01102-021X12-101012-111112-122X22-202022-212122-22"
+    test "test8597" (lazy(sprintf "02-00%d02-01%d02-02%a12-10%d12-11%d12-12%a22-20%d22-21%d22-22%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-021X12-101012-111112-122X22-202022-212122-22ReadX_TAIL"
+    test "test8598" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%a12-10%d12-11%d12-12%d12-13%a22-20%d22-21%d22-22%d22-23" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22 )) "02-00002-01102-02202-031X12-101012-111112-121212-132X22-202022-212122-222222-23"
+    test "test8599" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%a12-10%d12-11%d12-12%d12-13%a22-20%d22-21%d22-22%d22-23%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-031X12-101012-111112-121212-132X22-202022-212122-222222-23ReadX_TAIL"
+    test "test8600" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%a12-10%d12-11%d12-12%d12-13%d12-14%a22-20%d22-21%d22-22%d22-23%d22-24" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23 )) "02-00002-01102-02202-03302-041X12-101012-111112-121212-131312-142X22-202022-212122-222222-232322-24"
+    test "test8601" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%a12-10%d12-11%d12-12%d12-13%d12-14%a22-20%d22-21%d22-22%d22-23%d22-24%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-041X12-101012-111112-121212-131312-142X22-202022-212122-222222-232322-24ReadX_TAIL"
+    test "test8602" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 )) "02-00002-01102-02202-03302-04402-051X12-101012-111112-121212-131312-141412-152X22-202022-212122-222222-232322-242422-25"
+    test "test8603" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-04402-051X12-101012-111112-121212-131312-141412-152X22-202022-212122-222222-232322-242422-25ReadX_TAIL"
+    test "test8604" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 )) "02-00002-01102-02202-03302-04402-05502-061X12-101012-111112-121212-131312-141412-151512-162X22-202022-212122-222222-232322-242422-252522-26"
+    test "test8605" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-04402-05502-061X12-101012-111112-121212-131312-141412-151512-162X22-202022-212122-222222-232322-2424 [...]
+    test "test8606" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 )) "02-00002-01102-02202-03302-04402-05502-06602-071X12-101012-111112-121212-131312-141412-151512-161612-172X22-202022-212122-222222-232322-242422-252522-262622-27"
+    test "test8607" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-04402-05502-06602-071X12-101012-111112-121212-131312-141412-151512-1616 [...]
+    test "test8608" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%d02-08%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%d12-18%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27%d22-28" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 )) "02-00002-01102-02202-03302-04402-05502-06602-07702-081X12-101012-111112-121212-131312-141412-151512-161612-171712-182X22-202022-2121 [...]
+    test "test8609" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%d02-08%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%d12-18%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27%d22-28%a_TAIL" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-04402-05502-06602-07702-081X12-101012-1111 [...]
+    test "test8610" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%d02-08%d02-09%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%d12-18%d12-19%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27%d22-28%d22-29" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 28 )) "02-00002-01102-02202-03302-04402-05502-06602-07702-08802-091X12-101012-111112-121212-131312-141412-1515 [...]
+    test "test8611" (lazy(sprintf "02-00%d02-01%d02-02%d02-03%d02-04%d02-05%d02-06%d02-07%d02-08%d02-09%a12-10%d12-11%d12-12%d12-13%d12-14%d12-15%d12-16%d12-17%d12-18%d12-19%a22-20%d22-21%d22-22%d22-23%d22-24%d22-25%d22-26%d22-27%d22-28%d22-29%a_TAIL" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 28 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "02-00002-01102-02202-03302-04402-05502-0 [...]
+    test "test8612" (lazy(sprintf "03-00%d03-01%a13-10%d13-11%a23-20%d23-21%a33-30%d33-31" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30 )) "03-00003-011X13-101013-112X23-202023-213X33-303033-31"
+    test "test8613" (lazy(sprintf "03-00%d03-01%a13-10%d13-11%a23-20%d23-21%a33-30%d33-31%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-011X13-101013-112X23-202023-213X33-303033-31ReadX_TAIL"
+    test "test8614" (lazy(sprintf "03-00%d03-01%d03-02%a13-10%d13-11%d13-12%a23-20%d23-21%d23-22%a33-30%d33-31%d33-32" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31 )) "03-00003-01103-021X13-101013-111113-122X23-202023-212123-223X33-303033-313133-32"
+    test "test8615" (lazy(sprintf "03-00%d03-01%d03-02%a13-10%d13-11%d13-12%a23-20%d23-21%d23-22%a33-30%d33-31%d33-32%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-01103-021X13-101013-111113-122X23-202023-212123-223X33-303033-313133-32ReadX_TAIL"
+    test "test8616" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%a13-10%d13-11%d13-12%d13-13%a23-20%d23-21%d23-22%d23-23%a33-30%d33-31%d33-32%d33-33" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32 )) "03-00003-01103-02203-031X13-101013-111113-121213-132X23-202023-212123-222223-233X33-303033-313133-323233-33"
+    test "test8617" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%a13-10%d13-11%d13-12%d13-13%a23-20%d23-21%d23-22%d23-23%a33-30%d33-31%d33-32%d33-33%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-01103-02203-031X13-101013-111113-121213-132X23-202023-212123-222223-233X33-303033-313133-323233-33ReadX_TAIL"
+    test "test8618" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%a13-10%d13-11%d13-12%d13-13%d13-14%a23-20%d23-21%d23-22%d23-23%d23-24%a33-30%d33-31%d33-32%d33-33%d33-34" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33 )) "03-00003-01103-02203-03303-041X13-101013-111113-121213-131313-142X23-202023-212123-222223-232323-243X33-303033-313133-323233-333333-34"
+    test "test8619" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%a13-10%d13-11%d13-12%d13-13%d13-14%a23-20%d23-21%d23-22%d23-23%d23-24%a33-30%d33-31%d33-32%d33-33%d33-34%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-01103-02203-03303-041X13-101013-111113-121213-131313-142X23-202023-212123-222223-232323-243X33- [...]
+    test "test8620" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 )) "03-00003-01103-02203-03303-04403-051X13-101013-111113-121213-131313-141413-152X23-202023-212123-222223-232323-242423-253X33-3030 [...]
+    test "test8621" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-01103-02203-03303-04403-051X13-101013-111113-121213-1313 [...]
+    test "test8622" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 )) "03-00003-01103-02203-03303-04403-05503-061X13-101013-111113-121213-131313-141413-151513-1 [...]
+    test "test8623" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "03-00003-01103-02203-03303 [...]
+    test "test8624" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 36 )) "03-00003-01103-02203-03303-04403-05503-06603-071X1 [...]
+    test "test8625" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 36 (fun _ v -> (string v) + "X") System.IO.FileSha [...]
+    test "test8626" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%d03-08%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%d13-18%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%d23-28%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37%d33-38" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 36 37 )) "03-00003-01 [...]
+    test "test8627" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%d03-08%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%d13-18%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%d23-28%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37%d33-38%a_TAIL" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 36 37 (fun _ v [...]
+    test "test8628" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%d03-08%d03-09%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%d13-18%d13-19%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%d23-28%d23-29%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37%d33-38%d33-39" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 28  (fun _ v -> (string v) + "X") 3  30  [...]
+    test "test8629" (lazy(sprintf "03-00%d03-01%d03-02%d03-03%d03-04%d03-05%d03-06%d03-07%d03-08%d03-09%a13-10%d13-11%d13-12%d13-13%d13-14%d13-15%d13-16%d13-17%d13-18%d13-19%a23-20%d23-21%d23-22%d23-23%d23-24%d23-25%d23-26%d23-27%d23-28%d23-29%a33-30%d33-31%d33-32%d33-33%d33-34%d33-35%d33-36%d33-37%d33-38%d33-39%a_TAIL" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27 28  (fun _ v -> (string v) + "X") [...]
+    test "test8630" (lazy(sprintf "04-00%d04-01%a14-10%d14-11%a24-20%d24-21%a34-30%d34-31%a44-40%d44-41" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40 )) "04-00004-011X14-101014-112X24-202024-213X34-303034-314X44-404044-41"
+    test "test8631" (lazy(sprintf "04-00%d04-01%a14-10%d14-11%a24-20%d24-21%a34-30%d34-31%a44-40%d44-41%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "04-00004-011X14-101014-112X24-202024-213X34-303034-314X44-404044-41ReadX_TAIL"
+    test "test8632" (lazy(sprintf "04-00%d04-01%d04-02%a14-10%d14-11%d14-12%a24-20%d24-21%d24-22%a34-30%d34-31%d34-32%a44-40%d44-41%d44-42" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41 )) "04-00004-01104-021X14-101014-111114-122X24-202024-212124-223X34-303034-313134-324X44-404044-414144-42"
+    test "test8633" (lazy(sprintf "04-00%d04-01%d04-02%a14-10%d14-11%d14-12%a24-20%d24-21%d24-22%a34-30%d34-31%d34-32%a44-40%d44-41%d44-42%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "04-00004-01104-021X14-101014-111114-122X24-202024-212124-223X34-303034-313134-324X44-404044-414144-42ReadX_TAIL"
+    test "test8634" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%a14-10%d14-11%d14-12%d14-13%a24-20%d24-21%d24-22%d24-23%a34-30%d34-31%d34-32%d34-33%a44-40%d44-41%d44-42%d44-43" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42 )) "04-00004-01104-02204-031X14-101014-111114-121214-132X24-202024-212124-222224-233X34-303034-313134-323234-334X44-404044-414144-424244-43"
+    test "test8635" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%a14-10%d14-11%d14-12%d14-13%a24-20%d24-21%d24-22%d24-23%a34-30%d34-31%d34-32%d34-33%a44-40%d44-41%d44-42%d44-43%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "04-00004-01104-02204-031X14-101014-111114-121214-132X24-202024-212124-22 [...]
+    test "test8636" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%a14-10%d14-11%d14-12%d14-13%d14-14%a24-20%d24-21%d24-22%d24-23%d24-24%a34-30%d34-31%d34-32%d34-33%d34-34%a44-40%d44-41%d44-42%d44-43%d44-44" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43 )) "04-00004-01104-02204-03304-041X14-101014-111114-121214-131314-142X24-202024-212124-222 [...]
+    test "test8637" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%a14-10%d14-11%d14-12%d14-13%d14-14%a24-20%d24-21%d24-22%d24-23%d24-24%a34-30%d34-31%d34-32%d34-33%d34-34%a44-40%d44-41%d44-42%d44-43%d44-44%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "04-00004-01104-02204-03 [...]
+    test "test8638" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34  (fun _ v -> (string v) + "X") 4  40 41 42 43 44 )) "04-00004-01104-02204-03304-04404-051X [...]
+    test "test8639" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34  (fun _ v -> (string v) + "X") 4  40 41 42 43 44 (fun _ v -> (string v) + "X") Syst [...]
+    test "test8640" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35  (fun _ v -> (string v) + "X") 4  40 41 42 4 [...]
+    test "test8641" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35  (fun _ v -> (string v) + "X") 4  40  [...]
+    test "test8642" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 35 3 [...]
+    test "test8643" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26  (fun _ v -> (string v) + "X") 3  30 31 32 33  [...]
+    test "test8644" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%d04-08%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%d14-18%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%d24-28%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%d34-38%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47%d44-48" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27  (fun _ v  [...]
+    test "test8645" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%d04-08%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%d14-18%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%d24-28%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%d34-38%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47%d44-48%a_TAIL" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25 26 27  (f [...]
+    test "test8646" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%d04-08%d04-09%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%d14-18%d14-19%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%d24-28%d24-29%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%d34-38%d34-39%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47%d44-48%d44-49" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string v) + "X [...]
+    test "test8647" (lazy(sprintf "04-00%d04-01%d04-02%d04-03%d04-04%d04-05%d04-06%d04-07%d04-08%d04-09%a14-10%d14-11%d14-12%d14-13%d14-14%d14-15%d14-16%d14-17%d14-18%d14-19%a24-20%d24-21%d24-22%d24-23%d24-24%d24-25%d24-26%d24-27%d24-28%d24-29%a34-30%d34-31%d34-32%d34-33%d34-34%d34-35%d34-36%d34-37%d34-38%d34-39%a44-40%d44-41%d44-42%d44-43%d44-44%d44-45%d44-46%d44-47%d44-48%d44-49%a_TAIL" 0 1 2 3 4 5 6 7 8  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17 18  (fun _ v -> (string  [...]
+    test "test8648" (lazy(sprintf "05-00%d05-01%a15-10%d15-11%a25-20%d25-21%a35-30%d35-31%a45-40%d45-41%a55-50%d55-51" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50 )) "05-00005-011X15-101015-112X25-202025-213X35-303035-314X45-404045-415X55-505055-51"
+    test "test8649" (lazy(sprintf "05-00%d05-01%a15-10%d15-11%a25-20%d25-21%a35-30%d35-31%a45-40%d45-41%a55-50%d55-51%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "05-00005-011X15-101015-112X25-202025-213X35-303035-314X45-404045-415X55-505055-51ReadX_TAIL"
+    test "test8650" (lazy(sprintf "05-00%d05-01%d05-02%a15-10%d15-11%d15-12%a25-20%d25-21%d25-22%a35-30%d35-31%d35-32%a45-40%d45-41%d45-42%a55-50%d55-51%d55-52" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51 )) "05-00005-01105-021X15-101015-111115-122X25-202025-212125-223X35-303035-313135-324X45-404045-414145-425X55-505055-515155-52"
+    test "test8651" (lazy(sprintf "05-00%d05-01%d05-02%a15-10%d15-11%d15-12%a25-20%d25-21%d25-22%a35-30%d35-31%d35-32%a45-40%d45-41%d45-42%a55-50%d55-51%d55-52%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "05-00005-01105-021X15-101015-111115-122X25-202025-212125-223 [...]
+    test "test8652" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%a15-10%d15-11%d15-12%d15-13%a25-20%d25-21%d25-22%d25-23%a35-30%d35-31%d35-32%d35-33%a45-40%d45-41%d45-42%d45-43%a55-50%d55-51%d55-52%d55-53" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52 )) "05-00005-01105-02205-031X15-101015-111115-121215-132X25-202025-2 [...]
+    test "test8653" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%a15-10%d15-11%d15-12%d15-13%a25-20%d25-21%d25-22%d25-23%a35-30%d35-31%d35-32%d35-33%a45-40%d45-41%d45-42%d45-43%a55-50%d55-51%d55-52%d55-53%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "0 [...]
+    test "test8654" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%a15-10%d15-11%d15-12%d15-13%d15-14%a25-20%d25-21%d25-22%d25-23%d25-24%a35-30%d35-31%d35-32%d35-33%d35-34%a45-40%d45-41%d45-42%d45-43%d45-44%a55-50%d55-51%d55-52%d55-53%d55-54" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43  (fun _ v -> (string v) + "X") 5  50 51 52 53 )) "05-00 [...]
+    test "test8655" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%a15-10%d15-11%d15-12%d15-13%d15-14%a25-20%d25-21%d25-22%d25-23%d25-24%a35-30%d35-31%d35-32%d35-33%d35-34%a45-40%d45-41%d45-42%d45-43%d45-44%a55-50%d55-51%d55-52%d55-53%d55-54%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43  (fun _ v -> (string v) + "X") 5  50 51 52 53 (f [...]
+    test "test8656" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34  (fun _ v -> (string v) + "X") 4  40 41 42 43 44 [...]
+    test "test8657" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34  (fun _ v -> (string v) + "X") 4  40 41 4 [...]
+    test "test8658" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31 32 33 3 [...]
+    test "test8659" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  (fun _ v -> (string v) + "X") 3  30 31  [...]
+    test "test8660" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 25  [...]
+    test "test8661" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16  (fun _ v -> (string v) + "X") 2  20 21 22 23 [...]
+    test "test8662" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%d05-08%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%d15-18%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%d25-28%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%d35-38%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%d45-48%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57%d55-58" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 17  (fun [...]
+    test "test8663" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%d05-08%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%d15-18%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%d25-28%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%d35-38%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%d45-48%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57%d55-58%a_TAIL" 0 1 2 3 4 5 6 7  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 16 1 [...]
+    test "test8664" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%d05-08%d05-09%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%d15-18%d15-19%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%d25-28%d25-29%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%d35-38%d35-39%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%d45-48%d45-49%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57%d55-58%d55-59" 0 1 2 3 4 5 6 7 8  (fun _ v -> (strin [...]
+    test "test8665" (lazy(sprintf "05-00%d05-01%d05-02%d05-03%d05-04%d05-05%d05-06%d05-07%d05-08%d05-09%a15-10%d15-11%d15-12%d15-13%d15-14%d15-15%d15-16%d15-17%d15-18%d15-19%a25-20%d25-21%d25-22%d25-23%d25-24%d25-25%d25-26%d25-27%d25-28%d25-29%a35-30%d35-31%d35-32%d35-33%d35-34%d35-35%d35-36%d35-37%d35-38%d35-39%a45-40%d45-41%d45-42%d45-43%d45-44%d45-45%d45-46%d45-47%d45-48%d45-49%a55-50%d55-51%d55-52%d55-53%d55-54%d55-55%d55-56%d55-57%d55-58%d55-59%a_TAIL" 0 1 2 3 4 5 6 7 8  (fun _ v -> [...]
+    test "test8666" (lazy(sprintf "06-00%d06-01%a16-10%d16-11%a26-20%d26-21%a36-30%d36-31%a46-40%d46-41%a56-50%d56-51%a66-60%d66-61" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60 )) "06-00006-011X16-101016-112X26-202026-213X36-303036-314X46-404046-415X56-505056-516X66-606066-61"
+    test "test8667" (lazy(sprintf "06-00%d06-01%a16-10%d16-11%a26-20%d26-21%a36-30%d36-31%a46-40%d46-41%a56-50%d56-51%a66-60%d66-61%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "06-00006-011X16-101016-112X26-202026-213X36-303036-314X46-404046-415 [...]
+    test "test8668" (lazy(sprintf "06-00%d06-01%d06-02%a16-10%d16-11%d16-12%a26-20%d26-21%d26-22%a36-30%d36-31%d36-32%a46-40%d46-41%d46-42%a56-50%d56-51%d56-52%a66-60%d66-61%d66-62" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61 )) "06-00006-01106-021X16-101016-111116-122X26-202026-212126-223X3 [...]
+    test "test8669" (lazy(sprintf "06-00%d06-01%d06-02%a16-10%d16-11%d16-12%a26-20%d26-21%d26-22%a36-30%d36-31%d36-32%a46-40%d46-41%d46-42%a56-50%d56-51%d56-52%a66-60%d66-61%d66-62%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  ))  [...]
+    test "test8670" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%a16-10%d16-11%d16-12%d16-13%a26-20%d26-21%d26-22%d26-23%a36-30%d36-31%d36-32%d36-33%a46-40%d46-41%d46-42%d46-43%a56-50%d56-51%d56-52%d56-53%a66-60%d66-61%d66-62%d66-63" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52  (fun _ v -> (string v) + "X") 6  60 61  [...]
+    test "test8671" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%a16-10%d16-11%d16-12%d16-13%a26-20%d26-21%d26-22%d26-23%a36-30%d36-31%d36-32%d36-33%a46-40%d46-41%d46-42%d46-43%a56-50%d56-51%d56-52%d56-53%a66-60%d66-61%d66-62%d66-63%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52  (fun _ v -> (string v) + "X") 6  [...]
+    test "test8672" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%a16-10%d16-11%d16-12%d16-13%d16-14%a26-20%d26-21%d26-22%d26-23%d26-24%a36-30%d36-31%d36-32%d36-33%d36-34%a46-40%d46-41%d46-42%d46-43%d46-44%a56-50%d56-51%d56-52%d56-53%d56-54%a66-60%d66-61%d66-62%d66-63%d66-64" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43  (fun _ v -> (string [...]
+    test "test8673" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%a16-10%d16-11%d16-12%d16-13%d16-14%a26-20%d26-21%d26-22%d26-23%d26-24%a36-30%d36-31%d36-32%d36-33%d36-34%a46-40%d46-41%d46-42%d46-43%d46-44%a56-50%d56-51%d56-52%d56-53%d56-54%a66-60%d66-61%d66-62%d66-63%d66-64%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X") 4  40 41 42 43  (fun _ v ->  [...]
+    test "test8674" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34  (fun  [...]
+    test "test8675" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v -> (string v) + "X") 3  30 31 32 33 34 [...]
+    test "test8676" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22 23 24 2 [...]
+    test "test8677" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15  (fun _ v -> (string v) + "X") 2  20 21 22  [...]
+    test "test8678" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66%d66-67" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15 [...]
+    test "test8679" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66%d66-67%a_TAIL" 0 1 2 3 4 5 6  (fun _ v -> (string v) + "X") 1  10 11 12 1 [...]
+    test "test8680" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%d06-08%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%d16-18%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%d26-28%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%d36-38%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%d46-48%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%d56-58%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66%d66-67%d66-68" 0 1 2 3 4 5 6 7  [...]
+    test "test8681" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%d06-08%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%d16-18%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%d26-28%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%d36-38%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%d46-48%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%d56-58%a66-60%d66-61%d66-62%d66-63%d66-64%d66-65%d66-66%d66-67%d66-68%a_TAIL" 0 1 2 3 4 [...]
+    test "test8682" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%d06-08%d06-09%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%d16-18%d16-19%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%d26-28%d26-29%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%d36-38%d36-39%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%d46-48%d46-49%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%d56-58%d56-59%a66-60%d66-61%d66-62%d66-63%d66-64%d66 [...]
+    test "test8683" (lazy(sprintf "06-00%d06-01%d06-02%d06-03%d06-04%d06-05%d06-06%d06-07%d06-08%d06-09%a16-10%d16-11%d16-12%d16-13%d16-14%d16-15%d16-16%d16-17%d16-18%d16-19%a26-20%d26-21%d26-22%d26-23%d26-24%d26-25%d26-26%d26-27%d26-28%d26-29%a36-30%d36-31%d36-32%d36-33%d36-34%d36-35%d36-36%d36-37%d36-38%d36-39%a46-40%d46-41%d46-42%d46-43%d46-44%d46-45%d46-46%d46-47%d46-48%d46-49%a56-50%d56-51%d56-52%d56-53%d56-54%d56-55%d56-56%d56-57%d56-58%d56-59%a66-60%d66-61%d66-62%d66-63%d66-64%d66 [...]
+    test "test8684" (lazy(sprintf "07-00%d07-01%a17-10%d17-11%a27-20%d27-21%a37-30%d37-31%a47-40%d47-41%a57-50%d57-51%a67-60%d67-61%a77-70%d77-71" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70 )) "07-00007-011X17-101017-112X27-202027-213X37-303037-314X47-404047-415X57-505057-5 [...]
+    test "test8685" (lazy(sprintf "07-00%d07-01%a17-10%d17-11%a27-20%d27-21%a37-30%d37-31%a47-40%d47-41%a57-50%d57-51%a67-60%d67-61%a77-70%d77-71%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70 (fun _ v -> (string v) + "X") System.IO.FileShare.Read  )) "07-00007-011X17-1 [...]
+    test "test8686" (lazy(sprintf "07-00%d07-01%d07-02%a17-10%d17-11%d17-12%a27-20%d27-21%d27-22%a37-30%d37-31%d37-32%a47-40%d47-41%d47-42%a57-50%d57-51%d57-52%a67-60%d67-61%d67-62%a77-70%d77-71%d77-72" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61  (fun _ v -> (string v) + "X") 7  70 71 )) "0 [...]
+    test "test8687" (lazy(sprintf "07-00%d07-01%d07-02%a17-10%d17-11%d17-12%a27-20%d27-21%d27-22%a37-30%d37-31%d37-32%a47-40%d47-41%d47-42%a57-50%d57-51%d57-52%a67-60%d67-61%d67-62%a77-70%d77-71%d77-72%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61  (fun _ v -> (string v) + "X") 7  70 7 [...]
+    test "test8688" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%a17-10%d17-11%d17-12%d17-13%a27-20%d27-21%d27-22%d27-23%a37-30%d37-31%d37-32%d37-33%a47-40%d47-41%d47-42%d47-43%a57-50%d57-51%d57-52%d57-53%a67-60%d67-61%d67-62%d67-63%a77-70%d77-71%d77-72%d77-73" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52  (fun _ v -> [...]
+    test "test8689" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%a17-10%d17-11%d17-12%d17-13%a27-20%d27-21%d27-22%d27-23%a37-30%d37-31%d37-32%d37-33%a47-40%d47-41%d47-42%d47-43%a57-50%d57-51%d57-52%d57-53%a67-60%d67-61%d67-62%d67-63%a77-70%d77-71%d77-72%d77-73%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + "X") 5  50 51 52  (fun [...]
+    test "test8690" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%a17-10%d17-11%d17-12%d17-13%d17-14%a27-20%d27-21%d27-22%d27-23%d27-24%a37-30%d37-31%d37-32%d37-33%d37-34%a47-40%d47-41%d47-42%d47-43%d47-44%a57-50%d57-51%d57-52%d57-53%d57-54%a67-60%d67-61%d67-62%d67-63%d67-64%a77-70%d77-71%d77-72%d77-73%d77-74" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v) + "X")  [...]
+    test "test8691" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%a17-10%d17-11%d17-12%d17-13%d17-14%a27-20%d27-21%d27-22%d27-23%d27-24%a37-30%d37-31%d37-32%d37-33%d37-34%a47-40%d47-41%d47-42%d47-43%d47-44%a57-50%d57-51%d57-52%d57-53%d57-54%a67-60%d67-61%d67-62%d67-63%d67-64%a77-70%d77-71%d77-72%d77-73%d77-74%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 33  (fun _ v -> (string v)  [...]
+    test "test8692" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun _ v ->  [...]
+    test "test8693" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string v) + "X") 2  20 21 22 23 24  (fun  [...]
+    test "test8694" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75%d77-76" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13 14 15   [...]
+    test "test8695" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75%d77-76%a_TAIL" 0 1 2 3 4 5  (fun _ v -> (string v) + "X") 1  10 11 12 13  [...]
+    test "test8696" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%d67-67%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75%d77-76%d77-77" 0 1 2 3 4 [...]
+    test "test8697" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%d67-67%a77-70%d77-71%d77-72%d77-73%d77-74%d77-75%d77-76%d77-77%a_TAIL" 0  [...]
+    test "test8698" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%d07-08%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%d17-18%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%d27-28%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%d37-38%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%d47-48%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%d57-58%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%d67-67%d67-68%a77-70%d77-71%d77 [...]
+    test "test8699" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%d07-08%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%d17-18%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%d27-28%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%d37-38%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%d47-48%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%d57-58%a67-60%d67-61%d67-62%d67-63%d67-64%d67-65%d67-66%d67-67%d67-68%a77-70%d77-71%d77 [...]
+    test "test8700" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%d07-08%d07-09%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%d17-18%d17-19%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%d27-28%d27-29%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%d37-38%d37-39%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%d47-48%d47-49%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%d57-58%d57-59%a67-60%d67-61%d67-62%d67-63%d67-64%d67 [...]
+    test "test8701" (lazy(sprintf "07-00%d07-01%d07-02%d07-03%d07-04%d07-05%d07-06%d07-07%d07-08%d07-09%a17-10%d17-11%d17-12%d17-13%d17-14%d17-15%d17-16%d17-17%d17-18%d17-19%a27-20%d27-21%d27-22%d27-23%d27-24%d27-25%d27-26%d27-27%d27-28%d27-29%a37-30%d37-31%d37-32%d37-33%d37-34%d37-35%d37-36%d37-37%d37-38%d37-39%a47-40%d47-41%d47-42%d47-43%d47-44%d47-45%d47-46%d47-47%d47-48%d47-49%a57-50%d57-51%d57-52%d57-53%d57-54%d57-55%d57-56%d57-57%d57-58%d57-59%a67-60%d67-61%d67-62%d67-63%d67-64%d67 [...]
+    test "test8702" (lazy(sprintf "08-00%d08-01%a18-10%d18-11%a28-20%d28-21%a38-30%d38-31%a48-40%d48-41%a58-50%d58-51%a68-60%d68-61%a78-70%d78-71%a88-80%d88-81" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70  (fun _ v -> (string v) + "X") 8  80 )) "08-00008-011X18-101018-112X28 [...]
+    test "test8703" (lazy(sprintf "08-00%d08-01%a18-10%d18-11%a28-20%d28-21%a38-30%d38-31%a48-40%d48-41%a58-50%d58-51%a68-60%d68-61%a78-70%d78-71%a88-80%d88-81%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70  (fun _ v -> (string v) + "X") 8  80 (fun _ v -> (string v) + " [...]
+    test "test8704" (lazy(sprintf "08-00%d08-01%d08-02%a18-10%d18-11%d18-12%a28-20%d28-21%d28-22%a38-30%d38-31%d38-32%a48-40%d48-41%d48-42%a58-50%d58-51%d58-52%a68-60%d68-61%d68-62%a78-70%d78-71%d78-72%a88-80%d88-81%d88-82" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61  (fun _ v -> (string v)  [...]
+    test "test8705" (lazy(sprintf "08-00%d08-01%d08-02%a18-10%d18-11%d18-12%a28-20%d28-21%d28-22%a38-30%d38-31%d38-32%a48-40%d48-41%d48-42%a58-50%d58-51%d58-52%a68-60%d68-61%d68-62%a78-70%d78-71%d78-72%a88-80%d88-81%d88-82%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61  (fun _ v -> (str [...]
+    test "test8706" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%a18-10%d18-11%d18-12%d18-13%a28-20%d28-21%d28-22%d28-23%a38-30%d38-31%d38-32%d38-33%a48-40%d48-41%d48-42%d48-43%a58-50%d58-51%d58-52%d58-53%a68-60%d68-61%d68-62%d68-63%a78-70%d78-71%d78-72%d78-73%a88-80%d88-81%d88-82%d88-83" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string v) + " [...]
+    test "test8707" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%a18-10%d18-11%d18-12%d18-13%a28-20%d28-21%d28-22%d28-23%a38-30%d38-31%d38-32%d38-33%a48-40%d48-41%d48-42%d48-43%a58-50%d58-51%d58-52%d58-53%a68-60%d68-61%d68-62%d68-63%a78-70%d78-71%d78-72%d78-73%a88-80%d88-81%d88-82%d88-83%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42  (fun _ v -> (string [...]
+    test "test8708" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%a18-10%d18-11%d18-12%d18-13%d18-14%a28-20%d28-21%d28-22%d28-23%d28-24%a38-30%d38-31%d38-32%d38-33%d38-34%a48-40%d48-41%d48-42%d48-43%d48-44%a58-50%d58-51%d58-52%d58-53%d58-54%a68-60%d68-61%d68-62%d68-63%d68-64%a78-70%d78-71%d78-72%d78-73%d78-74%a88-80%d88-81%d88-82%d88-83%d88-84" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  30 31 32 [...]
+    test "test8709" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%a18-10%d18-11%d18-12%d18-13%d18-14%a28-20%d28-21%d28-22%d28-23%d28-24%a38-30%d38-31%d38-32%d38-33%d38-34%a48-40%d48-41%d48-42%d48-43%d48-44%a58-50%d58-51%d58-52%d58-53%d58-54%a68-60%d68-61%d68-62%d68-63%d68-64%a78-70%d78-71%d78-72%d78-73%d78-74%a88-80%d88-81%d88-82%d88-83%d88-84%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ v -> (string v) + "X") 3  3 [...]
+    test "test8710" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%a88-80%d88-81%d88-82%d88-83%d88-84%d88-85" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v -> (string [...]
+    test "test8711" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%a88-80%d88-81%d88-82%d88-83%d88-84%d88-85%a_TAIL" 0 1 2 3 4  (fun _ v -> (string v) + "X") 1  10 11 12 13 14  (fun _ v ->  [...]
+    test "test8712" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%d78-76%a88-80%d88-81%d88-82%d88-83%d88-84%d88-85%d88-86" 0 1 2 3 4 5  (fu [...]
+    test "test8713" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%d78-76%a88-80%d88-81%d88-82%d88-83%d88-84%d88-85%d88-86%a_TAIL" 0 1 2 3 4 [...]
+    test "test8714" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%d68-67%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%d78-76%d78-77%a88-80%d88 [...]
+    test "test8715" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%d68-67%a78-70%d78-71%d78-72%d78-73%d78-74%d78-75%d78-76%d78-77%a88-80%d88 [...]
+    test "test8716" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%d08-08%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%d18-18%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%d28-28%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%d38-38%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%d48-48%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%d58-58%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%d68-67%d68-68%a78-70%d78-71%d78 [...]
+    test "test8717" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%d08-08%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%d18-18%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%d28-28%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%d38-38%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%d48-48%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%d58-58%a68-60%d68-61%d68-62%d68-63%d68-64%d68-65%d68-66%d68-67%d68-68%a78-70%d78-71%d78 [...]
+    test "test8718" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%d08-08%d08-09%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%d18-18%d18-19%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%d28-28%d28-29%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%d38-38%d38-39%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%d48-48%d48-49%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%d58-58%d58-59%a68-60%d68-61%d68-62%d68-63%d68-64%d68 [...]
+    test "test8719" (lazy(sprintf "08-00%d08-01%d08-02%d08-03%d08-04%d08-05%d08-06%d08-07%d08-08%d08-09%a18-10%d18-11%d18-12%d18-13%d18-14%d18-15%d18-16%d18-17%d18-18%d18-19%a28-20%d28-21%d28-22%d28-23%d28-24%d28-25%d28-26%d28-27%d28-28%d28-29%a38-30%d38-31%d38-32%d38-33%d38-34%d38-35%d38-36%d38-37%d38-38%d38-39%a48-40%d48-41%d48-42%d48-43%d48-44%d48-45%d48-46%d48-47%d48-48%d48-49%a58-50%d58-51%d58-52%d58-53%d58-54%d58-55%d58-56%d58-57%d58-58%d58-59%a68-60%d68-61%d68-62%d68-63%d68-64%d68 [...]
+    test "test8720" (lazy(sprintf "09-00%d09-01%a19-10%d19-11%a29-20%d29-21%a39-30%d39-31%a49-40%d49-41%a59-50%d59-51%a69-60%d69-61%a79-70%d79-71%a89-80%d89-81%a99-90%d99-91" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70  (fun _ v -> (string v) + "X") 8  80  (fun _ v -> (strin [...]
+    test "test8721" (lazy(sprintf "09-00%d09-01%a19-10%d19-11%a29-20%d29-21%a39-30%d39-31%a49-40%d49-41%a59-50%d59-51%a69-60%d69-61%a79-70%d79-71%a89-80%d89-81%a99-90%d99-91%a_TAIL" 0  (fun _ v -> (string v) + "X") 1  10  (fun _ v -> (string v) + "X") 2  20  (fun _ v -> (string v) + "X") 3  30  (fun _ v -> (string v) + "X") 4  40  (fun _ v -> (string v) + "X") 5  50  (fun _ v -> (string v) + "X") 6  60  (fun _ v -> (string v) + "X") 7  70  (fun _ v -> (string v) + "X") 8  80  (fun _ v -> [...]
+    test "test8722" (lazy(sprintf "09-00%d09-01%d09-02%a19-10%d19-11%d19-12%a29-20%d29-21%d29-22%a39-30%d39-31%d39-32%a49-40%d49-41%d49-42%a59-50%d59-51%d59-52%a69-60%d69-61%d69-62%a79-70%d79-71%d79-72%a89-80%d89-81%d89-82%a99-90%d99-91%d99-92" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 61  (f [...]
+    test "test8723" (lazy(sprintf "09-00%d09-01%d09-02%a19-10%d19-11%d19-12%a29-20%d29-21%d29-22%a39-30%d39-31%d39-32%a49-40%d49-41%d49-42%a59-50%d59-51%d59-52%a69-60%d69-61%d69-62%a79-70%d79-71%d79-72%a89-80%d89-81%d89-82%a99-90%d99-91%d99-92%a_TAIL" 0 1  (fun _ v -> (string v) + "X") 1  10 11  (fun _ v -> (string v) + "X") 2  20 21  (fun _ v -> (string v) + "X") 3  30 31  (fun _ v -> (string v) + "X") 4  40 41  (fun _ v -> (string v) + "X") 5  50 51  (fun _ v -> (string v) + "X") 6  60 [...]
+    test "test8724" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%a19-10%d19-11%d19-12%d19-13%a29-20%d29-21%d29-22%d29-23%a39-30%d39-31%d39-32%d39-33%a49-40%d49-41%d49-42%d49-43%a59-50%d59-51%d59-52%d59-53%a69-60%d69-61%d69-62%d69-63%a79-70%d79-71%d79-72%d79-73%a89-80%d89-81%d89-82%d89-83%a99-90%d99-91%d99-92%d99-93" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  40 41 42 [...]
+    test "test8725" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%a19-10%d19-11%d19-12%d19-13%a29-20%d29-21%d29-22%d29-23%a39-30%d39-31%d39-32%d39-33%a49-40%d49-41%d49-42%d49-43%a59-50%d59-51%d59-52%d59-53%a69-60%d69-61%d69-62%d69-63%a79-70%d79-71%d79-72%d79-73%a89-80%d89-81%d89-82%d89-83%a99-90%d99-91%d99-92%d99-93%a_TAIL" 0 1 2  (fun _ v -> (string v) + "X") 1  10 11 12  (fun _ v -> (string v) + "X") 2  20 21 22  (fun _ v -> (string v) + "X") 3  30 31 32  (fun _ v -> (string v) + "X") 4  4 [...]
+    test "test8726" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%a19-10%d19-11%d19-12%d19-13%d19-14%a29-20%d29-21%d29-22%d29-23%d29-24%a39-30%d39-31%d39-32%d39-33%d39-34%a49-40%d49-41%d49-42%d49-43%d49-44%a59-50%d59-51%d59-52%d59-53%d59-54%a69-60%d69-61%d69-62%d69-63%d69-64%a79-70%d79-71%d79-72%d79-73%d79-74%a89-80%d89-81%d89-82%d89-83%d89-84%a99-90%d99-91%d99-92%d99-93%d99-94" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  (fun _ [...]
+    test "test8727" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%a19-10%d19-11%d19-12%d19-13%d19-14%a29-20%d29-21%d29-22%d29-23%d29-24%a39-30%d39-31%d39-32%d39-33%d39-34%a49-40%d49-41%d49-42%d49-43%d49-44%a59-50%d59-51%d59-52%d59-53%d59-54%a69-60%d69-61%d69-62%d69-63%d69-64%a79-70%d79-71%d79-72%d79-73%d79-74%a89-80%d89-81%d89-82%d89-83%d89-84%a99-90%d99-91%d99-92%d99-93%d99-94%a_TAIL" 0 1 2 3  (fun _ v -> (string v) + "X") 1  10 11 12 13  (fun _ v -> (string v) + "X") 2  20 21 22 23  [...]
+    test "test8728" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%a89-80%d89-81%d89-82%d89-83%d89-84%d89-85%a99-90%d99-91%d99-92%d99-93%d99-94%d99-95" 0 1 2 3 4  (fun _ v -> (string v) + " [...]
+    test "test8729" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%a89-80%d89-81%d89-82%d89-83%d89-84%d89-85%a99-90%d99-91%d99-92%d99-93%d99-94%d99-95%a_TAIL" 0 1 2 3 4  (fun _ v -> (string [...]
+    test "test8730" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%d79-76%a89-80%d89-81%d89-82%d89-83%d89-84%d89-85%d89-86%a99-90%d99-91%d99 [...]
+    test "test8731" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%d79-76%a89-80%d89-81%d89-82%d89-83%d89-84%d89-85%d89-86%a99-90%d99-91%d99 [...]
+    test "test8732" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%d69-67%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%d79-76%d79-77%a89-80%d89 [...]
+    test "test8733" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%d69-67%a79-70%d79-71%d79-72%d79-73%d79-74%d79-75%d79-76%d79-77%a89-80%d89 [...]
+    test "test8734" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%d09-08%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%d19-18%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%d29-28%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%d39-38%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%d49-48%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%d59-58%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%d69-67%d69-68%a79-70%d79-71%d79 [...]
+    test "test8735" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%d09-08%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%d19-18%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%d29-28%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%d39-38%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%d49-48%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%d59-58%a69-60%d69-61%d69-62%d69-63%d69-64%d69-65%d69-66%d69-67%d69-68%a79-70%d79-71%d79 [...]
+    test "test8736" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%d09-08%d09-09%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%d19-18%d19-19%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%d29-28%d29-29%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%d39-38%d39-39%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%d49-48%d49-49%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%d59-58%d59-59%a69-60%d69-61%d69-62%d69-63%d69-64%d69 [...]
+    test "test8737" (lazy(sprintf "09-00%d09-01%d09-02%d09-03%d09-04%d09-05%d09-06%d09-07%d09-08%d09-09%a19-10%d19-11%d19-12%d19-13%d19-14%d19-15%d19-16%d19-17%d19-18%d19-19%a29-20%d29-21%d29-22%d29-23%d29-24%d29-25%d29-26%d29-27%d29-28%d29-29%a39-30%d39-31%d39-32%d39-33%d39-34%d39-35%d39-36%d39-37%d39-38%d39-39%a49-40%d49-41%d49-42%d49-43%d49-44%d49-45%d49-46%d49-47%d49-48%d49-49%a59-50%d59-51%d59-52%d59-53%d59-54%d59-55%d59-56%d59-57%d59-58%d59-59%a69-60%d69-61%d69-62%d69-63%d69-64%d69 [...]
+func0()
+func1000()
+func2000()
+func3000()
+func4000()
+func5000()
+func6000()
+func7000()
+func8000()
+
+#if Portable
+let aa =
+    if !failures then (printfn "Test Failed, failures = %A" failures; exit 1)
+    else (stdout.WriteLine "Test Passed"; exit 0)
+#else
+let _ = 
+    if !failures then (printf "Test Failed"; exit 1) 
+#endif
+  
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/printing/build.bat b/tests/fsharp/core/printing/build.bat
new file mode 100644
index 0000000..e953a5a
--- /dev/null
+++ b/tests/fsharp/core/printing/build.bat
@@ -0,0 +1,99 @@
+if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+rem recall  >fred.txt 2>&1 merges stderr into the stdout redirect
+rem however 2>&1  >fred.txt did not seem to do it.
+
+REM Here we use diff.exe without -dew option to trap whitespace changes, like bug 4429.
+REM Any whitespace change needs to be investigated, these tests are to check exact output.
+REM Base line updates are easy: sd edit and delete the .bsl and rerun the test.
+set PRDIFF=%~d0%~p0..\..\..\fsharpqa\testenv\bin\%processor_architecture%\diff.exe
+echo Diff tool is %PRDIFF%
+if NOT EXIST %PRDIFF% (
+    echo ERROR: Diff tool not found at %PRDIFF%
+    exit /b 1
+)
+
+echo == Plain
+"%FSI%" %fsc_flags_errors_ok%  --nologo                                    <test.fsx >z.raw.output.test.default.txt 2>&1
+echo == PrintSize 1000
+"%FSI%" %fsc_flags_errors_ok%  --nologo --use:preludePrintSize1000.fsx     <test.fsx >z.raw.output.test.1000.txt    2>&1 
+echo == PrintSize 200
+"%FSI%" %fsc_flags_errors_ok%  --nologo --use:preludePrintSize200.fsx      <test.fsx >z.raw.output.test.200.txt     2>&1 
+echo == ShowDeclarationValues off
+"%FSI%" %fsc_flags_errors_ok%  --nologo --use:preludeShowDeclarationValuesFalse.fsx <test.fsx >z.raw.output.test.off.txt     2>&1
+echo == Quiet
+"%FSI%" %fsc_flags_errors_ok% --nologo --quiet                              <test.fsx >z.raw.output.test.quiet.txt   2>&1
+
+REM REVIEW: want to normalise CWD paths, not suppress them. 
+findstr /v "%CD%" z.raw.output.test.default.txt | findstr /v -C:"--help' for options" > z.output.test.default.txt
+findstr /v "%CD%" z.raw.output.test.1000.txt    | findstr /v -C:"--help' for options" > z.output.test.1000.txt
+findstr /v "%CD%" z.raw.output.test.200.txt     | findstr /v -C:"--help' for options" > z.output.test.200.txt
+findstr /v "%CD%" z.raw.output.test.off.txt     | findstr /v -C:"--help' for options" > z.output.test.off.txt
+findstr /v "%CD%" z.raw.output.test.quiet.txt   | findstr /v -C:"--help' for options" > z.output.test.quiet.txt
+
+
+if NOT EXIST z.output.test.default.bsl COPY z.output.test.default.txt z.output.test.default.bsl
+if NOT EXIST z.output.test.off.bsl     COPY z.output.test.off.txt     z.output.test.off.bsl
+if NOT EXIST z.output.test.1000.bsl    COPY z.output.test.1000.txt    z.output.test.1000.bsl
+if NOT EXIST z.output.test.200.bsl     COPY z.output.test.200.txt     z.output.test.200.bsl
+if NOT EXIST z.output.test.quiet.bsl   COPY z.output.test.quiet.txt   z.output.test.quiet.bsl
+
+%PRDIFF% z.output.test.default.txt z.output.test.default.bsl > z.output.test.default.diff
+%PRDIFF% z.output.test.off.txt     z.output.test.off.bsl     > z.output.test.off.diff
+%PRDIFF% z.output.test.1000.txt    z.output.test.1000.bsl    > z.output.test.1000.diff
+%PRDIFF% z.output.test.200.txt     z.output.test.200.bsl     > z.output.test.200.diff
+%PRDIFF% z.output.test.quiet.txt   z.output.test.quiet.bsl   > z.output.test.quiet.diff
+
+echo ======== Differences From ========
+TYPE  z.output.test.default.diff
+TYPE  z.output.test.off.diff
+TYPE  z.output.test.1000.diff
+TYPE  z.output.test.200.diff
+TYPE  z.output.test.quiet.diff
+echo ========= Differences To =========
+
+TYPE  z.output.test.default.diff  > zz.alldiffs
+TYPE  z.output.test.off.diff     >> zz.alldiffs
+TYPE  z.output.test.1000.diff    >> zz.alldiffs
+TYPE  z.output.test.200.diff     >> zz.alldiffs
+TYPE  z.output.test.quiet.diff   >> zz.alldiffs
+
+for /f %%c IN (zz.alldiffs) do (
+  echo NOTE -------------------------------------
+  echo NOTE ---------- THERE ARE DIFFs ----------
+  echo NOTE -------------------------------------
+  echo .
+  echo To update baselines: "sd edit *bsl", "del *bsl", "build.bat" regenerates bsl, "sd diff ...", check what changed.
+  goto Error
+)
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+rem Hardwire ERRORLEVEL to be 1, since routes in here from diff check do not have ERRORLEVEL set
+rem call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/core/printing/preludePrintSize1000.fsx b/tests/fsharp/core/printing/preludePrintSize1000.fsx
new file mode 100644
index 0000000..7b5da17
--- /dev/null
+++ b/tests/fsharp/core/printing/preludePrintSize1000.fsx
@@ -0,0 +1,3 @@
+// Pre-test configuration
+fsi.PrintSize <- 1000
+
diff --git a/tests/fsharp/core/printing/preludePrintSize200.fsx b/tests/fsharp/core/printing/preludePrintSize200.fsx
new file mode 100644
index 0000000..01e0bf8
--- /dev/null
+++ b/tests/fsharp/core/printing/preludePrintSize200.fsx
@@ -0,0 +1,3 @@
+// Pre-test configuration
+fsi.PrintSize <- 200
+
diff --git a/tests/fsharp/core/printing/preludeShowDeclarationValuesFalse.fsx b/tests/fsharp/core/printing/preludeShowDeclarationValuesFalse.fsx
new file mode 100644
index 0000000..87b244a
--- /dev/null
+++ b/tests/fsharp/core/printing/preludeShowDeclarationValuesFalse.fsx
@@ -0,0 +1,3 @@
+// Pre-test configuration
+fsi.ShowDeclarationValues <- false
+
diff --git a/tests/fsharp/core/printing/test.fsx b/tests/fsharp/core/printing/test.fsx
new file mode 100644
index 0000000..3454692
--- /dev/null
+++ b/tests/fsharp/core/printing/test.fsx
@@ -0,0 +1,926 @@
+// #Regression #Conformance #Printing #FSI #Regression 
+#light;;
+
+let repeatId = "A";;
+let repeatId = "B";;
+
+#load "testLoadFile.fsx";;                     (* single load *)
+#load "testLoadFile.fsx" "testLoadFile2.fsx";; (* multi load *)
+
+let x1 = Seq.initInfinite string  
+let x2 = Seq.init 9 string
+let x3 = Seq.init System.Int32.MaxValue string
+
+let f1 = new System.Windows.Forms.Form(Text="f1 form")
+let fs = Array.init 200 (fun i -> new System.Windows.Forms.Form(Text=sprintf "fs #%d" i))
+
+let xs  = List.init  200 string 
+let xa  = Array.init 200 string
+let xa2 = Array2D.init 8 8 (fun i j -> string (i*10+j))
+
+
+let sxs0  = List.init  0 string |> Set.ofList;; 
+let sxs1  = List.init  1 string |> Set.ofList;; 
+let sxs2  = List.init  2 string |> Set.ofList ;;
+let sxs3  = List.init  3 string |> Set.ofList ;;
+let sxs4  = List.init  4 string |> Set.ofList ;;
+let sxs200  = List.init  200 string |> Set.ofList ;;
+
+let msxs0  = List.init  0 (fun i -> (i,string i)) |> Map.ofList ;;
+let msxs1  = List.init  1 (fun i -> (i,string i)) |> Map.ofList ;;
+let msxs2  = List.init  2 (fun i -> (i,string i)) |> Map.ofList ;;
+let msxs3  = List.init  3 (fun i -> (i,string i)) |> Map.ofList ;;
+let msxs4  = List.init  4 (fun i -> (i,string i)) |> Map.ofList ;;
+let msxs200  = List.init  200 (fun i -> (i,string i)) |> Map.ofList ;;
+
+module M = begin
+  let a = "sub-binding"
+  let b = Some (x1,x2,x3,f1),Some(xs,xs,xa2)
+end
+
+type T(a,b) =
+    member z.AProperty  = a
+    member z.AMethod(x) = a*b+x*2
+    static member StaticProperty = 101
+    static member StaticMethod(x) = 102+x
+
+let f_as_method :  int -> int  = fun x -> x+1
+let f_as_thunk  : (int -> int) = f_as_method
+
+// Moved to fsharpqa suite where we can easily handle differences between Dev10 and VS2008
+//let lazyExit = lazy (exit 999; "this should never be forced")
+let refCell  = ref "value"
+
+module D1 = begin
+  let words     = dict ["alpha",1;"beta",2]
+  let words2000 = dict (List.init 2000 (fun i -> i,string i))
+end;;
+
+// Repeat words, but open namespace, reduces the type name paths
+open System.Collections.Generic
+;; // <-- close interaction before reduced NS comes into effect
+
+module D2 = begin
+  open System.Collections.Generic
+  let words     = dict ["alpha",1;"beta",2]
+  let words2000 = dict (List.init 2000 (fun i -> i,string i))  
+end
+
+let opt1  = None 
+let opt1b = None : int option
+let opt4  = Some (Some (Some (None)))
+let opt4b = Some (Some (Some (None : int option)))
+let opt5  = [Some(Some(Some(Some(None))));
+             Some(Some(Some(Some(Some [1;2;3;4;5;6]))));
+             Some(Some(Some(Some(Some [1;2;3;4;5;6;7;8;9;0;1;2;3;4;5;6;7;8;9;01;2;3;4;5;6;7;8;9;01;2;3;4;5;6;7;8;9;01;2;3;4;5;6;7;8;9;01;2;3;4;5;6;7;8;9;0]))))]
+
+
+let mkStr n = String.init n (fun _ -> "-")
+let strs  = Array.init 100 (fun i -> mkStr (i  ))
+let str7s = Array.init 100 (fun i -> mkStr (i*7))
+let grids = Array2D.init 50 50 (fun i j -> mkStr (i*j))
+;;  
+
+type tree = L | N of tree list
+let rec mkT w d = if d=0 then L else N (List.init w (fun i -> mkT w (d-1)))
+let tree w d =
+  printf "[Building %d %d..." w d    
+  let res = mkT w d in
+  printfn "done]"
+  res
+;;  
+let tree_2_4  = tree 2 4  ;;
+let tree_2_6  = tree 2 6  ;;
+let tree_2_8  = tree 2 8  ;;
+let tree_2_10 = tree 2 10 ;;
+let tree_2_12 = tree 2 12 ;;
+let tree_2_14 = tree 2 14 ;;
+
+let tree_3_8  = tree 3 8  ;;
+let tree_4_8  = tree 4 8  ;;
+let tree_5_8  = tree 5 8  ;;
+let tree_6_8  = tree 6 8  ;;
+  
+let tree_5_3  = tree 5 3  ;;
+;;
+
+type X =
+  | Var of int
+  | Bop of int * X * X
+let rec generate x =
+  match x%2 with
+    | 0 -> Var x
+    | 1 -> Bop (x,generate (x/2),generate (x/3))
+    | _ -> failwith "unexpected residue"
+;;
+let exps = List.map generate [1;2;3;4;5;6;7;8;9;10;
+                              213;
+                              21342314;
+                              3214;
+                              1231357;
+                              5234547;
+                              923759825;
+                              2435234;
+                              12396777;
+                              3333333;
+                              1312311237;
+                              System.Int32.MaxValue;
+                             ]
+;;  
+module Exprs = begin
+  let x1 = generate 213
+  let x2 = generate 21342314
+  let x3 = generate 3214
+  let x4 = generate 1231357
+  let x5 = generate 5234547
+  let x6 = generate 923759825
+  let x7 = generate 2435234
+  let x8 = generate 12396777
+  let x9 = generate 3333333
+  let x10 = generate 1312311237
+  let x11 = generate System.Int32.MaxValue
+end
+;;
+
+
+type C(x:string) =
+    override z.ToString() = failwithf "Trouble_%s" x
+
+let c1  = C "A"
+//  cs = Array.init 200 (string >> C) // constructors are not yet first class functions...
+let csA = Array.init 200 (string >> (fun x -> C x))
+let csB = Array.init 200 (fun x -> C (string x))
+let csC = Array.init 999 (fun x -> C (string x))
+;;
+
+(* Bug 4045 *)
+exception Abc;;
+exception AbcInt of int;;
+exception AbcString of string;;
+exception AbcExn of exn list;;
+exception AbcException of System.Exception list;;
+let exA1 = Abc
+let exA2 = AbcInt 2
+let exA3 = AbcString "3"
+let exA4 = AbcExn [exA1;exA2;exA3]
+let exA5 = AbcException [exA4]
+
+(* Bug 4045 *)
+exception Ex0
+exception ExUnit of unit
+exception ExUnits of unit * unit
+exception ExUnitOption of unit option
+
+let ex0  = Ex0
+let exU  = ExUnit ()
+let exUs = ExUnits ((),())
+let exUSome = ExUnitOption (Some ())
+let exUNone = ExUnitOption (None)
+
+(* Bug 4063 *)
+// ctor case
+type 'a T4063 = AT4063 of 'a;;
+let valAT3063_12   = AT4063 12;;
+let valAT3063_True = AT4063 true;;
+let valAT3063_text = AT4063 "text";;
+let valAT3063_null = AT4063 (null:System.Object);;
+
+type M4063<'a> = class new(x:'a) = {} end;;
+let v4063 =  M4063<int>(1);;
+
+// method case?
+type Taaaaa<'a>() = class end;;
+type Taaaaa2<'a>() = class inherit Taaaaa<'a>() member x.M() = x end;;
+
+// method case?
+type Tbbbbb<'a>(x:'a) = class member this.M() = x end;;
+type Tbbbbb2(x) = class inherit Tbbbbb<string>(x) end;;
+let t2 = Tbbbbb2("2") in t2.M;;
+
+// Moved to fsharpqa suite where we can easily handle differences between Dev10 and VS2008
+(* Bug 4068: printing lazy property values forces the lazy value... *)
+//let lazy12 = lazy 12;;
+//lazy12;;
+//lazy12;;
+//lazy 13;;
+//it;;
+
+(* Bug 1532 *)
+module RepeatedModule = begin let repeatedByteLiteral = [| 12uy; 13uy; 14uy |] end;;
+module RepeatedModule = begin let repeatedByteLiteral = [| 12uy; 13uy; 14uy |] end;;
+
+(* Regressions for standard responses... *)
+"Check #help";;
+#help;;
+"Check #time on and then off";;
+#time;; (* time on *)
+(* no eval in between, since time can vary and look like a regression *)
+#time;; (* time off *)
+"Check #unknown command";;
+#blaaaaaa;; // blaaaaaa is not a known command
+"Check #I with a known directory (to avoid a warning, which includes the location of this file, which is fragile...)";;
+#I "/";;
+
+(* Regressions for #r and binding responses... *)
+// Moved to FSHARPQA - we can't have hardcoded string in tests!
+
+(* Regression 4006 *)
+type internal T1 = A | B;;
+type internal T2 = {x: int};;
+type internal T3 = class end;;
+type internal T4 = class new() = {} end;;
+type T1 = internal A | B;;
+type T2 = internal {x: int};;
+type private  T1 = A | B;;
+type private  T2 = {x: int};;
+type T1 = private  A | B;;
+type T2 = private  {x: int};;
+type internal T1 = private  A | B;;
+type internal T2 = private  {x: int};;
+type private  T3 = class end;;
+type private  T4 = class new() = {} end;;
+
+
+(* Regression 4086 *)
+exception X1 of int;;
+exception private X2 of int;;
+exception internal X3 of int;;
+
+
+
+(* Regression 3552 *)
+type T0         = class new() = {} end
+type T1Post<'a> = class new() = {} end
+type 'a T1Pre   = class new() = {} end
+;;
+type T0 with
+    member this.M() = [this]
+    member this.P   = this,this
+    member this.E   = (new Event<int>()).Publish
+;;
+type T1Post<'a> with
+    member this.M() = [this]
+    member this.P   = this,this
+    member this.E   = (new Event<_>()).Publish
+;;
+type 'a T1Pre with
+    member this.M() = [this]
+    member this.P   = this,this
+    member this.E   = (new Event<_>()).Publish
+;;
+(* Mix up pre and post *)
+type 'a T1Post with
+    member this.M() = [this]
+    member this.P   = this,this
+    member this.E   = (new Event<_>()).Publish
+;;
+type T1Pre<'a> with
+    member this.M() = [this]
+    member this.P   = this,this
+    member this.E   = (new Event<_>()).Publish
+;;
+
+
+
+
+(* Regression 4090: request for pretty printing to count record fields as one item w.r.t. PrintSize total node count *)
+type r = { f0 : int;
+           f1 : int;
+           f2 : int;
+           f3 : int;           
+           f4 : int;           
+           f5 : int;           
+           f6 : int;           
+           f7 : int;           
+           f8 : int;           
+           f9 : int; }
+let r10 = { f0 = 0; f1 = 1; f2 = 2; f3 = 3; f4 = 4; f5 = 5; f6 = 6; f7 = 7; f8 = 8; f9 = 9 }
+let r10s  = Array.init 37 (fun i -> r10)
+let r10s' = "one extra node",Array.init 37 (fun i -> r10)
+;;
+
+(* Regression 1564: allow #directives to interleave definitions in fsi without need for ;; *)
+let x1564_A1 = 1
+#I "\\"
+let x1564_A2 = 2
+#I "\\"
+let x1564_A3 = 3
+;;
+
+
+
+type internal Foo2() = 
+     member public this.Prop1 = 12
+     member internal this.Prop2 = 12
+     member private this.Prop3 = 12
+     public new(x:int) = new Foo2()
+     internal new(x:int,y:int) = new Foo2()
+     private new(x:int,y:int,z:int) = new Foo2();;
+     
+module internal InternalM = 
+    let internal x = 1
+
+    type internal Foo2() = 
+       member public this.Prop1 = 12
+       member internal this.Prop2 = 12
+       member private this.Prop3 = 12
+       public new(x:int) = new Foo2()
+       internal new(x:int,y:int) = new Foo2()
+       private new(x:int,y:int,z:int) = new Foo2()
+       
+    type private Foo3() = 
+       member public this.Prop1 = 12
+       member internal this.Prop2 = 12
+       member private this.Prop3 = 12
+       public new(x:int) = new Foo3()
+       internal new(x:int,y:int) = new Foo3()
+       private new(x:int,y:int,z:int) = new Foo3()
+
+    type internal T1 = A | B
+    type internal T2 = {x: int}
+    type internal T3 = class end
+    type internal T4 = class new() = {} end
+    type T5 = internal A | B
+    type T6 = internal {x: int}
+    type private  T7 = A | B
+    type private  T8 = {x: int}
+    type T9 = private  A | B
+    type T10 = private  {x: int}
+    type internal T11 = private  A | B
+    type internal T12 = private  {x: int}
+    type private  T13 = class end
+    type private  T14 = class new() = {} end
+       
+module internal PrivateM = 
+    let private x = 1
+
+    type private Foo2() = 
+       member public this.Prop1 = 12
+       member internal this.Prop2 = 12
+       member private this.Prop3 = 12
+       public new(x:int) = new Foo2()
+       internal new(x:int,y:int) = new Foo2()
+       private new(x:int,y:int,z:int) = new Foo2()
+
+    type internal T1 = A | B
+    type internal T2 = {x: int}
+    type internal T3 = class end
+    type internal T4 = class new() = {} end
+    type T5 = internal A | B
+    type T6 = internal {x: int}
+    type private  T7 = A | B
+    type private  T8 = {x: int}
+    type T9 = private  A | B
+    type T10 = private  {x: int}
+    type internal T11 = private  A | B
+    type internal T12 = private  {x: int}
+    type private  T13 = class end
+    type private  T14 = class new() = {} end
+
+
+(* Regression 4412: Do not break before = on val it = <expr> *)
+;;[(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] |> Seq.readonly
+;;
+
+(* Regression: 4343 a) Long strings print prefix and indication of remaining characters *)
+module Test4343a =
+  let mk i = String.init i (fun i -> string (i%10))
+  let x100 = mk 100
+  let x90  = mk 90
+  let x80  = mk 80
+  let x75  = mk 75
+  let x74  = mk 74
+  let x73  = mk 73
+  let x72  = mk 72
+  let x71  = mk 71
+  let x70  = mk 70
+ 
+(* Regression: 4343 b) Functions (1st class) not printed *)
+module Test4343b =
+  let fA (x:int) = x+2
+  let fB<'a> (x:'a) (y:'a) = [x;y]
+  let gA = fA
+  let gB = fB
+  let gAB = fA,fB
+  let hA,hB = gAB
+
+(* Regression: 4343 c) Type functions, not printed *)
+module Test4343c =
+  let typename<'a> = typeof<'a>.FullName
+  let typename2<'a> = typename<'a>,typename<'a list>
+
+(* Regression: 4343 d) Sequences not printed, unless a known sequence type, like, list, array etc, which take precedence *)
+module Test4343d =
+  let xList   = [1;2;3]    // ienumerable
+  let xArray  = [|1;2;3|]  // ienumerable
+  let xString = "abcdef"   // ienumerable
+  let xOption = Some 12    // could be ienumerable, but not currently
+  let xArray2 = Array2D.init 2 2 (fun x y -> x,y)
+  let xSeq    = [1;2;3] |> Seq.readonly // seq proper, expect no RHS value to be printed
+
+(* Regression: 4343 e) Values that would use the default System.Object.ToString() are not printed, since this only prints the type, i.e. val x : T = T *)
+module Test4343e =
+  // C uses default .ToString
+  type C(x:int) = class end
+  let cA = C(1)
+  let cB = C(2)
+  let cAB = cA,cB,[cA;cB] (* note: these print with FSI_xxxx prefix. That is bug 4299. *)
+  // D defines it's own .ToString
+  type D(x:int) = class override this.ToString() = "D(" + string x + ")" end
+  let dA = D(1)
+  let dB = D(2)
+  let dAB = dA,dB,[dA;dB]
+
+  module Generic =
+    // C<Generic> uses default .ToString
+    type CGeneric<'a>(x:'a) = class end
+    let cA = C(1)
+    let cB = C(2)
+    let cAB = cA,cB,[cA;cB] (* note: these print with FSI_xxxx prefix. That is bug 4299. *)
+    // D<Generic> defines it's own .ToString
+    type D<'a>(x:'a) = class override this.ToString() = "D(" + string (box x) + ")" end
+    let dA = D<int>(1)
+    let dB = D<int>(2)
+    let dAB = dA,dB,[dA;dB ]
+    let dC = D<bool>(true)
+    let boxed_dABC = [box dA;box dB;box dC]
+
+(* Regression: 4624. printing C# and F# classes can sort their member, inherit, implements, fields, ctors, instance, statics etc. *)
+[<AbstractClass>]
+type F1 =
+    class
+        inherit System.Windows.Forms.Form                         (* inherit *)
+        abstract AAA : int  with get                              (* abstract getter *)
+        abstract ZZZ : int  with get                              (* abstract setter *)
+        abstract BBB : bool with set
+        abstract MMM : bool -> bool                               (* abstract method *)
+        val x : F1                                                (* instance field *)
+        [<DefaultValue>]
+        static val mutable private sx : F1                        (* static field *)
+        static member A() = 12                                    (* static method *)
+        member this.B() = 12                                      (* instance method *)
+        static member C() = 12
+        member this.D() = 12
+        member this.D2 with get() = 12 and set(x:int) = ()        (* instance getter setter *)
+        member this.D(x:int,y:int) = 12
+        member this.D(x:int) = 12
+     //   member this.D x y z = [1;x;y;z]  // you can't define a curried member with same name as tupled member, even with different signature
+        member this.E with get() = 12                             (* instance getter *)
+        member this.E with set(x:int) = ()                        (* instance setter *)                  
+        val x2 : F1                                               (* instance field *)
+        [<DefaultValue>]
+        static val mutable private sx2 : F1                       (* static field *)      
+        override this.ToString() = ""                             (* instance override *)
+        interface System.IDisposable with                         (* interface implementation *)
+            override this.Dispose() = ()
+        end
+    end
+
+(* Regression 4643: not a regression, but a corner case: static fields on struct *)
+[<Struct>]
+type IP(x:int,y:int) =
+  [<DefaultValue>]
+  static val mutable private AA : IP
+
+
+(* Bug 4643: infinite loop in typechecker - caused by recursive struct check via self typed static field *)  
+module Regression4643 =  
+   [<Struct>]
+   type RIP(x:int) =
+      [<DefaultValue>]
+      static val mutable private y : RIP
+
+   [<Struct>]
+   type arg_unused_is_RIP(x:RIP) = struct end
+
+   [<Struct>]
+   type arg_used_is_RIP(x:RIP) =
+        member this.X = x
+
+   [<Struct>]
+   type field_is_RIP =
+      val x :RIP
+
+(* Bug 5152: Provide appropriate message for the InvalidOperation exns thrown by Seq find, pick and findIndex *)
+type Either<'a,'b> = This of 'a | That of 'b
+let catch f = try This (f ()) with e -> That (e.GetType().FullName,e.Message)
+let seqFindIndexFailure = catch (fun () -> Seq.findIndex (fun _ -> false) [1;2])
+let seqFindFailure      = catch (fun () -> Seq.find      (fun _ -> false) [1;2])
+let seqPickFailure      = catch (fun () -> Seq.pick      (fun _ -> None : int option)  [1;2])
+        
+(* Bug 5218. Tuple printing of arity beyond maxTuple representation exercises F# tuple reflection in reflect.fs *)
+module Regression5218 =
+    let t1  = 1
+    let t2  = 1,2
+    let t3  = 1,2,3
+    let t4  = 1,2,3,4
+    let t5  = 1,2,3,4,5
+    let t6  = 1,2,3,4,5,6
+    let t7  = 1,2,3,4,5,6,7
+    let t8  = 1,2,3,4,5,6,7,8
+    let t9  = 1,2,3,4,5,6,7,8,9
+    let t10 = 1,2,3,4,5,6,7,8,9,10
+    let t11 = 1,2,3,4,5,6,7,8,9,10,11
+    let t12 = 1,2,3,4,5,6,7,8,9,10,11,12
+    let t13 = 1,2,3,4,5,6,7,8,9,10,11,12,13
+    let t14 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14
+    let t15 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+;;
+
+(* Bug 3739: ICE in fsi with interface constraint on type generic parameter (for interface defined in the same interaction) *)
+module Regression3739 =    
+    type IB = 
+       abstract AbstractMember : int -> int
+    // Expected: type C accepted
+    // Observed: Could not load type 'IB' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
+    type C<'a when 'a :> IB>() = 
+        static member StaticMember(x:'a) = x.AbstractMember(1)
+;; (* intentional ;; *)
+
+    
+(* Bug 3739: ICE in fsi with interface constraint on type generic parameter (for interface defined in the same interaction) *)
+module Regression3739 =    
+    type IB = 
+       abstract AbstractMember : int -> int
+    // Expected: type C accepted
+    // Observed: Could not load type 'IB' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
+    type C<'a when 'a :> IB>() = 
+        static member StaticMember(x:'a) = x.AbstractMember(1)
+;; (* intentional ;; *)
+
+(* Bug 4368: FSI throws ICE for interface with override name colliding with method name [was: when running test fsharp\samples\mort3] *)
+module Regression3740 =        
+    type Writer<'a> = 
+      interface
+        abstract member get_path : unit -> string
+      end
+      
+    type MyClass =
+      class
+        val path: string
+        interface Writer<int> with
+          member self.get_path () = "hello"
+        end
+      end
+;; (* intentional ;; *)
+
+(* Bug 4319: Sanity checks for overloaded and user defined operators? *)
+// EXPECT: T2 accepted
+type Regression4319_T2  = static member (+-+-+) (x,y)            = "2 arguments";;
+
+// EXPECT: warnings on all the following. The ;; are intentional, so warnings and output interleave.
+type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+
+type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+
+type Regression4319_check =
+    static member (:=)             = "COLON_EQUALS"
+    //static member (||)           = "BAR_BAR"
+    //static member (|)            = "INFIX_BAR_OP"                                              
+    //static member ($..$|)          = "INFIX_BAR_OP"
+    static member (&)              = "AMP"
+    static member (&^)             = "AMP_AMP"
+    static member (=)              = "EQUALS"
+    //static member (=)            = "INFIX_COMPARE_OP"    
+    static member (!=)             = "INFIX_COMPARE_OP"
+    //static member (<)            = "INFIX_COMPARE_OP"
+    //static member (>)            = "INFIX_COMPARE_OP"
+    //static member ($)            = "INFIX_COMPARE_OP"                    
+    static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+    static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+    static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+    static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+    //static member (...$)          = "INFIX_COMPARE_OP" // with $ suffix
+    static member ($)              = "DOLLAR"
+    static member (<)              = "LESS"
+    static member (>)              = "GREATER"
+    static member (@)              = "INFIX_AT_HAT_OP"
+    static member (^)              = "INFIX_AT_HAT_OP"        
+    static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+    static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+    static member (%)              = "PERCENT_OP"        
+    //static member (::)           = "COLON_COLON"        
+    static member (-)              = "MINUS"
+    static member ( * )            = "STAR"
+    //static member ( * )          = "INFIX_STAR_DIV_MOD_OP"
+    static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+    //static member (%)            = "INFIX_STAR_DIV_MOD_OP"
+    static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+    static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+    static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+    static member ( ** )           = "INFIX_STAR_STAR_OP"
+;; (* intentional ;; *)
+
+
+type Regression4469() =
+    member this.ToString() = "ABC"
+let r4469 = Regression4469()
+printfn "Expect ABC = %s" (r4469.ToString());; // <-- semi here, but not before, is important to split the interactions
+printfn "Expect ABC = %s" (r4469.ToString());;
+
+module Regression1019_short =
+  let double_nan      = nan
+  let double_infinity = infinity
+  let single_nan      = nanf
+  let single_infinity = infinityf
+
+module Regression1019_long =
+  let double_nan      = System.Double.NaN
+  let double_infinity = System.Double.PositiveInfinity
+  let single_nan      = System.Single.NaN
+  let single_infinity = System.Single.PositiveInfinity
+    
+// check 'it' doesn't get collected if it is referenced
+;;
+ref 1;;
+let x,f = it, (fun () -> !it);; // this will read from the static storage for 'it'
+f();; // expect 1
+x := 3;;
+f();; // expect 3
+
+// check 'it' does get collected if it is not referenced, 400K * 100 = 40000MB = 40GB, so we'd better have some collection here
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+(Array.zeroCreate 100000 : int[]);; // 400K
+
+(* Check [] and some other values can be generalized when used as 'it' expressions *)
+[];;
+[[]];;
+None;;
+([],[]);;
+(fun x -> x);;
+let fff x = x;;
+fff;;
+
+let note_ExpectDupMethod = "Regression4927: Expect error due to duplicate methods in the following definition";; (* <-- semi-semi matters *)
+type ExpectDupMethod() =
+  class
+    member this.M() = 12
+    member this.M() = "string"
+end;;  (* <-- semi-semi matters, -ve test *)
+
+let note_ExpectDupProperty = "Regression4927: Expect error due to duplicate properties in the following definition";; (* <-- semi-semi matters *)
+type ExpectDupProperty() =
+  class
+    member this.P = 12
+    member this.P = "string"
+end;; (* <-- semi-semi matters, -ve test *)
+
+;;
+"NOTE: Expect IAPrivate less accessible IBPublic";;
+module Regression5265_PriPub =
+    type private  IAPrivate  = interface abstract P: int end
+    type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+;; (* <-- semi-semi matters, -ve test *)
+"NOTE: Expect IAPrivate less accessible IBInternal";;
+module Regression5265_PriInt =
+    type private  IAPrivate  = interface abstract P: int end
+    type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+;; (* <-- semi-semi matters, -ve test *)
+module Regression5265_PriPri =
+    type private  IAPrivate  = interface abstract P: int end
+    type private  IBPrivate  = interface inherit IAPrivate abstract Q : int end
+;;
+"NOTE: Expect IAInternal less accessible IBPublic";;
+module Regression5265_IntPub =
+    type internal IAInternal = interface abstract P: int end
+    type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+;; (* <-- semi-semi matters, -ve test *)
+module Regression5265_IntInt =
+    type internal IAInternal = interface abstract P: int end
+    type internal IBInternal = interface inherit IAInternal abstract Q : int end
+;;
+module Regression5265_IntPri =
+    type internal IAInternal = interface abstract P: int end
+    type private  IBPrivate  = interface inherit IAInternal abstract Q : int end
+;;
+module Regression5265_PubPub =
+    type public   IAPublic   = interface abstract P: int end
+    type public   IBPublic   = interface inherit IAPublic abstract Q : int end
+;;
+module Regression5265_PubInt =
+    type public   IAPublic   = interface abstract P: int end
+    type internal IBInternal = interface inherit IAPublic abstract Q : int end
+;;
+module Regression5265_PubPri =
+    type public   IAPublic   = interface abstract P: int end
+    type private  IBPrivate  = interface inherit IAPublic abstract Q : int end
+;; (* ;; needed, to issolate error regressions *)
+
+"Regression4232: Expect an error about duplicate virtual methods from parent type";;
+module Regression4232 =
+    [<AbstractClass>]
+    type D<'T,'U>() = 
+        abstract M : 'T  -> int
+        abstract M : 'U -> int
+
+    type E() = 
+        inherit D<string,string>()
+        override x.M(a:string) = 1
+;; (* ;; needed, to issolate error regressions *)
+
+"** Expect AnAxHostSubClass to be accepted. AxHost has a newslot virtual RightToLeft property outscope RightToLeft on Control";;
+type AnAxHostSubClass(x) = class inherit System.Windows.Forms.AxHost(x) end;;
+
+(*Regression 5590*)
+"** Expect error because the active pattern result contains free type variables";;
+let (|A|B|) (x:int) = A x;;
+
+"** Expect error because the active pattern result contains free type variables (match value generic)";;
+let (|A|B|) (x:'a) = A x;;
+
+"** Expect error because the active pattern result contains free type variables (when active pattern also has parameters)";;
+let (|A|B|) (p:'a) (x:int) = A p;;
+
+"** Expect OK, since error message says constraint should work!";;
+let (|A|B|) (x:int) : Choice<int,unit> = A x;;
+
+"** Expect error since active pattern is not a function!";;
+let (|A|B|) = failwith "" : Choice<int,int>;;
+
+"** Expect OK since active pattern result is not too generic, typars depend on match val";;
+let (|A|B|) (p:bool) (x : 'a * 'b) = if p then A (fst x) else B (snd x);;
+
+"** Expect OK since active pattern result is not too generic, typars depend on parameters";;
+let (|A|B|) (aval:'a) (bval:'b) (x : bool) = if x then A aval else B bval;;
+
+"** Expect OK since active pattern result is generic, but it typar from closure, so OK";;
+let outer (x:'a) =
+    let (|A|B|) (k:int) = if k = 0 then A else B (x:'a)
+    fun x -> match x with A -> None | B res -> Some res;;
+
+"** Expect OK, BUG 472278: revert unintended breaking change to Active Patterns in F# 3.0";;
+let (|Check1|) (a : int) = a, None;;
+
+;; 
+module ReflectionEmit =
+    // Interfaces cross-constrained via method gps - targets reflection emit in fsi
+    type IA = 
+        abstract M : 'a -> int when 'a :> IB 
+    and  IB = 
+        abstract M : 'b -> int when 'b :> IA
+
+    // Interfaces cross-constrained via method gps - targets reflection emit in fsi
+    type IA2<'a when 'a :> IB2<'a> and 'a :> IA2<'a>> = 
+        abstract M : int
+    and  IB2<'b when 'b :> IA2<'b> and 'b :> IB2<'b>> = 
+        abstract M : int
+;;
+"Regression_139182: Expect the follow code to be accepted without error";;
+[<Struct>]
+type S =
+  member x.TheMethod() = x.TheMethod() : int64
+let theMethod (s:S) = s.TheMethod()
+type T() =
+  static let s = S()
+  static let str = "test"
+  let s2 = S()
+  static member Prop1 = s.TheMethod()                // error FS0422
+  static member Prop2 = theMethod s                  // ok
+  static member Prop3 = let s' = s in s'.TheMethod() // ok
+  static member Prop4 = str.ToLower()                // ok
+  member x.Prop5      = s2.TheMethod()               // ok
+;;
+
+// BCL type with Value property that is annotated with DebuggerBrowsable(Never)
+[new System.Threading.ThreadLocal<int>()]
+;;
+
+// named DU fields.
+// only fields whose names do not match auto-generated field names (Item1, Item2, ...) should be printed
+type MyDU =
+  | Case1 of Val1 : int * Val2 : string
+  | Case2 of string * V2 : bool * float
+  | Case3 of Item : int
+  | Case4 of Item1 : bool
+  | Case5 of Item1 : bool * Item2 : string
+  | Case6 of Val1 : int * bool * Item3 : string
+  | Case7 of ``Big Name`` : int
+
+let namedFieldVar1 = Case1(5, "")
+let namedFieldVar2 = Case7(25)
+;;
+
+// F# exception types use similar printing logic for named fields as DUs
+// auto-generated names use "Data" instead of "Item"
+exception MyNamedException1 of Val1 : int * Val2 : string
+exception MyNamedException2 of string * V2 : bool * float
+exception MyNamedException3 of Data : int
+exception MyNamedException4 of Data0 : bool
+exception MyNamedException5 of Data0 : int * Data1 : string
+exception MyNamedException6 of Val1 : int * bool * Data2 : string * Data8 : float
+exception MyNamedException7 of ``Big Named Field`` : int
+
+let namedEx1 = MyNamedException1(5, "")
+let namedEx2 = MyNamedException7(25)
+;;
+
+;; (* ;; needed, to isolate error regressions *)
+
+;;exit 0;; (* piped in to enable error regressions *)
diff --git a/tests/fsharp/core/printing/testLoadFile.fsx b/tests/fsharp/core/printing/testLoadFile.fsx
new file mode 100644
index 0000000..85347b3
--- /dev/null
+++ b/tests/fsharp/core/printing/testLoadFile.fsx
@@ -0,0 +1,10 @@
+#light
+let x1 = 1
+let x2 = "hello"
+let x3 = None
+let x4 = None : int option
+let x5 = []
+let x6 = [1;2;3]
+let x7 = new System.Windows.Forms.Form(Text="x7 form")
+let x8 = Array2D.init 5 5 (fun i j -> i*10 + j)
+let x9 = lazy (exit 999; "this lazy value should not be forced!!")  
diff --git a/tests/fsharp/core/printing/testLoadFile2.fsx b/tests/fsharp/core/printing/testLoadFile2.fsx
new file mode 100644
index 0000000..85347b3
--- /dev/null
+++ b/tests/fsharp/core/printing/testLoadFile2.fsx
@@ -0,0 +1,10 @@
+#light
+let x1 = 1
+let x2 = "hello"
+let x3 = None
+let x4 = None : int option
+let x5 = []
+let x6 = [1;2;3]
+let x7 = new System.Windows.Forms.Form(Text="x7 form")
+let x8 = Array2D.init 5 5 (fun i j -> i*10 + j)
+let x9 = lazy (exit 999; "this lazy value should not be forced!!")  
diff --git a/tests/fsharp/core/printing/z.output.test.1000.bsl b/tests/fsharp/core/printing/z.output.test.1000.bsl
new file mode 100644
index 0000000..9d21952
--- /dev/null
+++ b/tests/fsharp/core/printing/z.output.test.1000.bsl
@@ -0,0 +1,2994 @@
+
+> val it : unit = ()
+> > 
+val repeatId : string = "A"
+
+> 
+val repeatId : string = "B"
+
+
+namespace FSI_0005
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+> 
+val x1 : seq<string>
+val x2 : seq<string>
+val x3 : seq<string>
+val f1 : System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form
+val fs : System.Windows.Forms.Form [] =
+  [|System.Windows.Forms.Form, Text: fs #0;
+    System.Windows.Forms.Form, Text: fs #1;
+    System.Windows.Forms.Form, Text: fs #2;
+    System.Windows.Forms.Form, Text: fs #3;
+    System.Windows.Forms.Form, Text: fs #4;
+    System.Windows.Forms.Form, Text: fs #5;
+    System.Windows.Forms.Form, Text: fs #6;
+    System.Windows.Forms.Form, Text: fs #7;
+    System.Windows.Forms.Form, Text: fs #8;
+    System.Windows.Forms.Form, Text: fs #9;
+    System.Windows.Forms.Form, Text: fs #10;
+    System.Windows.Forms.Form, Text: fs #11;
+    System.Windows.Forms.Form, Text: fs #12;
+    System.Windows.Forms.Form, Text: fs #13;
+    System.Windows.Forms.Form, Text: fs #14;
+    System.Windows.Forms.Form, Text: fs #15;
+    System.Windows.Forms.Form, Text: fs #16;
+    System.Windows.Forms.Form, Text: fs #17;
+    System.Windows.Forms.Form, Text: fs #18;
+    System.Windows.Forms.Form, Text: fs #19;
+    System.Windows.Forms.Form, Text: fs #20;
+    System.Windows.Forms.Form, Text: fs #21;
+    System.Windows.Forms.Form, Text: fs #22;
+    System.Windows.Forms.Form, Text: fs #23;
+    System.Windows.Forms.Form, Text: fs #24;
+    System.Windows.Forms.Form, Text: fs #25;
+    System.Windows.Forms.Form, Text: fs #26;
+    System.Windows.Forms.Form, Text: fs #27;
+    System.Windows.Forms.Form, Text: fs #28;
+    System.Windows.Forms.Form, Text: fs #29;
+    System.Windows.Forms.Form, Text: fs #30;
+    System.Windows.Forms.Form, Text: fs #31;
+    System.Windows.Forms.Form, Text: fs #32;
+    System.Windows.Forms.Form, Text: fs #33;
+    System.Windows.Forms.Form, Text: fs #34;
+    System.Windows.Forms.Form, Text: fs #35;
+    System.Windows.Forms.Form, Text: fs #36;
+    System.Windows.Forms.Form, Text: fs #37;
+    System.Windows.Forms.Form, Text: fs #38;
+    System.Windows.Forms.Form, Text: fs #39;
+    System.Windows.Forms.Form, Text: fs #40;
+    System.Windows.Forms.Form, Text: fs #41;
+    System.Windows.Forms.Form, Text: fs #42;
+    System.Windows.Forms.Form, Text: fs #43;
+    System.Windows.Forms.Form, Text: fs #44;
+    System.Windows.Forms.Form, Text: fs #45;
+    System.Windows.Forms.Form, Text: fs #46;
+    System.Windows.Forms.Form, Text: fs #47;
+    System.Windows.Forms.Form, Text: fs #48;
+    System.Windows.Forms.Form, Text: fs #49;
+    System.Windows.Forms.Form, Text: fs #50;
+    System.Windows.Forms.Form, Text: fs #51;
+    System.Windows.Forms.Form, Text: fs #52;
+    System.Windows.Forms.Form, Text: fs #53;
+    System.Windows.Forms.Form, Text: fs #54;
+    System.Windows.Forms.Form, Text: fs #55;
+    System.Windows.Forms.Form, Text: fs #56;
+    System.Windows.Forms.Form, Text: fs #57;
+    System.Windows.Forms.Form, Text: fs #58;
+    System.Windows.Forms.Form, Text: fs #59;
+    System.Windows.Forms.Form, Text: fs #60;
+    System.Windows.Forms.Form, Text: fs #61;
+    System.Windows.Forms.Form, Text: fs #62;
+    System.Windows.Forms.Form, Text: fs #63;
+    System.Windows.Forms.Form, Text: fs #64;
+    System.Windows.Forms.Form, Text: fs #65;
+    System.Windows.Forms.Form, Text: fs #66;
+    System.Windows.Forms.Form, Text: fs #67;
+    System.Windows.Forms.Form, Text: fs #68;
+    System.Windows.Forms.Form, Text: fs #69;
+    System.Windows.Forms.Form, Text: fs #70;
+    System.Windows.Forms.Form, Text: fs #71;
+    System.Windows.Forms.Form, Text: fs #72;
+    System.Windows.Forms.Form, Text: fs #73;
+    System.Windows.Forms.Form, Text: fs #74;
+    System.Windows.Forms.Form, Text: fs #75;
+    System.Windows.Forms.Form, Text: fs #76;
+    System.Windows.Forms.Form, Text: fs #77;
+    System.Windows.Forms.Form, Text: fs #78;
+    System.Windows.Forms.Form, Text: fs #79;
+    System.Windows.Forms.Form, Text: fs #80;
+    System.Windows.Forms.Form, Text: fs #81;
+    System.Windows.Forms.Form, Text: fs #82;
+    System.Windows.Forms.Form, Text: fs #83;
+    System.Windows.Forms.Form, Text: fs #84;
+    System.Windows.Forms.Form, Text: fs #85;
+    System.Windows.Forms.Form, Text: fs #86;
+    System.Windows.Forms.Form, Text: fs #87;
+    System.Windows.Forms.Form, Text: fs #88;
+    System.Windows.Forms.Form, Text: fs #89;
+    System.Windows.Forms.Form, Text: fs #90;
+    System.Windows.Forms.Form, Text: fs #91;
+    System.Windows.Forms.Form, Text: fs #92;
+    System.Windows.Forms.Form, Text: fs #93;
+    System.Windows.Forms.Form, Text: fs #94;
+    System.Windows.Forms.Form, Text: fs #95;
+    System.Windows.Forms.Form, Text: fs #96;
+    System.Windows.Forms.Form, Text: fs #97;
+    System.Windows.Forms.Form, Text: fs #98;
+    System.Windows.Forms.Form, Text: fs #99; ...|]
+val xs : string list =
+  ["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+   "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23"; "24"; "25";
+   "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34"; "35"; "36"; "37";
+   "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"; "48"; "49";
+   "50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"; "58"; "59"; "60"; "61";
+   "62"; "63"; "64"; "65"; "66"; "67"; "68"; "69"; "70"; "71"; "72"; "73";
+   "74"; "75"; "76"; "77"; "78"; "79"; "80"; "81"; "82"; "83"; "84"; "85";
+   "86"; "87"; "88"; "89"; "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97";
+   "98"; "99"; ...]
+val xa : string [] =
+  [|"0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+    "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23"; "24"; "25";
+    "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34"; "35"; "36"; "37";
+    "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"; "48"; "49";
+    "50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"; "58"; "59"; "60"; "61";
+    "62"; "63"; "64"; "65"; "66"; "67"; "68"; "69"; "70"; "71"; "72"; "73";
+    "74"; "75"; "76"; "77"; "78"; "79"; "80"; "81"; "82"; "83"; "84"; "85";
+    "86"; "87"; "88"; "89"; "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97";
+    "98"; "99"; ...|]
+val xa2 : string [,] = [["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"]
+                        ["10"; "11"; "12"; "13"; "14"; "15"; "16"; "17"]
+                        ["20"; "21"; "22"; "23"; "24"; "25"; "26"; "27"]
+                        ["30"; "31"; "32"; "33"; "34"; "35"; "36"; "37"]
+                        ["40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"]
+                        ["50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"]
+                        ["60"; "61"; "62"; "63"; "64"; "65"; "66"; "67"]
+                        ["70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"]]
+val sxs0 : Set<string> = set []
+
+> 
+val sxs1 : Set<string> = set ["0"]
+
+> 
+val sxs2 : Set<string> = set ["0"; "1"]
+
+> 
+val sxs3 : Set<string> = set ["0"; "1"; "2"]
+
+> 
+val sxs4 : Set<string> = set ["0"; "1"; "2"; "3"]
+
+> 
+val sxs200 : Set<string> =
+  set ["0"; "1"; "10"; "100"; "101"; "102"; "103"; "104"; "105"; ...]
+
+> 
+val msxs0 : Map<int,string> = map []
+
+> 
+val msxs1 : Map<int,string> = map [(0, "0")]
+
+> 
+val msxs2 : Map<int,string> = map [(0, "0"); (1, "1")]
+
+> 
+val msxs3 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2")]
+
+> 
+val msxs4 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2"); (3, "3")]
+
+> 
+val msxs200 : Map<int,string> =
+  map
+    [(0, "0"); (1, "1"); (2, "2"); (3, "3"); (4, "4"); (5, "5"); (6, "6");
+     (7, "7"); (8, "8"); ...]
+
+> 
+module M = begin
+  val a : string = "sub-binding"
+  val b :
+    (seq<string> * seq<string> * seq<string> * System.Windows.Forms.Form) option *
+    (string list * string list * string [,]) option =
+    (Some (<seq>, <seq>, <seq>, System.Windows.Forms.Form, Text: f1 form),
+     Some
+       (["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12";
+         "13"; "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23";
+         "24"; "25"; "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34";
+         "35"; "36"; "37"; "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45";
+         "46"; "47"; "48"; "49"; "50"; "51"; "52"; "53"; "54"; "55"; "56";
+         "57"; "58"; "59"; "60"; "61"; "62"; "63"; "64"; "65"; "66"; "67";
+         "68"; "69"; "70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"; "78";
+         "79"; "80"; "81"; "82"; "83"; "84"; "85"; "86"; "87"; "88"; "89";
+         "90"; "91"; "92"; "93"; "94"; "95"; "96"; ...], ..., ...))
+end
+type T =
+  class
+    new : a:int * b:int -> T
+    member AMethod : x:int -> int
+    member AProperty : int
+    static member StaticMethod : x:int -> int
+    static member StaticProperty : int
+  end
+val f_as_method : x:int -> int
+val f_as_thunk : (int -> int)
+val refCell : string ref = {contents = "value";}
+module D1 = begin
+  val words : System.Collections.Generic.IDictionary<string,int>
+  val words2000 : System.Collections.Generic.IDictionary<int,string>
+end
+
+> > 
+module D2 = begin
+  val words : IDictionary<string,int>
+  val words2000 : IDictionary<int,string>
+end
+val opt1 : 'a option
+val opt1b : int option = None
+val opt4 : 'a option option option option
+val opt4b : int option option option option = Some (Some (Some null))
+val opt5 : int list option option option option option list =
+  [Some (Some (Some (Some null)));
+   Some (Some (Some (Some (Some [1; 2; 3; 4; 5; 6]))));
+   Some
+     (Some
+        (Some
+           (Some
+              (Some
+                 [1; 2; 3; 4; 5; 6; 7; 8; 9; 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1;
+                  2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3;
+                  4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0]))))]
+val mkStr : n:int -> string
+val strs : string [] =
+  [|""; "-"; "--"; "---"; "----"; "-----"; "------"; "-------"; "--------";
+    "---------"; "----------"; "-----------"; "------------"; "-------------";
+    "--------------"; "---------------"; "----------------";
+    "-----------------"; "------------------"; "-------------------";
+    "--------------------"; "---------------------"; "----------------------";
+    "-----------------------"; "------------------------";
+    "-------------------------"; "--------------------------";
+    "---------------------------"; "----------------------------";
+    "-----------------------------"; "------------------------------";
+    "-------------------------------"; "--------------------------------";
+    "---------------------------------"; "----------------------------------";
+    "-----------------------------------";
+    "------------------------------------";
+    "-------------------------------------";
+    "--------------------------------------";
+    "---------------------------------------";
+    "----------------------------------------";
+    "-----------------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------";
+    "--------------------------------------------";
+    "---------------------------------------------";
+    "----------------------------------------------";
+    "-----------------------------------------------";
+    "------------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------";
+    "---------------------------------------------------";
+    "----------------------------------------------------";
+    "-----------------------------------------------------";
+    "------------------------------------------------------";
+    "-------------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------";
+    "----------------------------------------------------------";
+    "-----------------------------------------------------------";
+    "------------------------------------------------------------";
+    "-------------------------------------------------------------";
+    "--------------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------";
+    "-----------------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "-------------------------------------------------------------------";
+    "--------------------------------------------------------------------";
+    "---------------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-----------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[12 chars];
+    "-------------------------------------------------------------"+[13 chars];
+    "-------------------------------------------------------------"+[14 chars];
+    "-------------------------------------------------------------"+[15 chars];
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[18 chars];
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[20 chars];
+    "-------------------------------------------------------------"+[21 chars];
+    "-------------------------------------------------------------"+[22 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[24 chars];
+    "-------------------------------------------------------------"+[25 chars];
+    "-------------------------------------------------------------"+[26 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[28 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[31 chars];
+    "-------------------------------------------------------------"+[32 chars];
+    "-------------------------------------------------------------"+[33 chars];
+    "-------------------------------------------------------------"+[34 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[36 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[38 chars];
+    ...|]
+val str7s : string [] =
+  [|""; "-------"; "--------------"; "---------------------";
+    "----------------------------"; "-----------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[58 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[72 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[86 chars];
+    "-------------------------------------------------------------"+[93 chars];
+    "-------------------------------------------------------------"+[100 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[114 chars];
+    "-------------------------------------------------------------"+[121 chars];
+    "-------------------------------------------------------------"+[128 chars];
+    "-------------------------------------------------------------"+[135 chars];
+    "-------------------------------------------------------------"+[142 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[156 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[170 chars];
+    "-------------------------------------------------------------"+[177 chars];
+    "-------------------------------------------------------------"+[184 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[198 chars];
+    "-------------------------------------------------------------"+[205 chars];
+    "-------------------------------------------------------------"+[212 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[226 chars];
+    "-------------------------------------------------------------"+[233 chars];
+    "-------------------------------------------------------------"+[240 chars];
+    "-------------------------------------------------------------"+[247 chars];
+    "-------------------------------------------------------------"+[254 chars];
+    "-------------------------------------------------------------"+[261 chars];
+    "-------------------------------------------------------------"+[268 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[282 chars];
+    "-------------------------------------------------------------"+[289 chars];
+    "-------------------------------------------------------------"+[296 chars];
+    "-------------------------------------------------------------"+[303 chars];
+    "-------------------------------------------------------------"+[310 chars];
+    "-------------------------------------------------------------"+[317 chars];
+    "-------------------------------------------------------------"+[324 chars];
+    "-------------------------------------------------------------"+[331 chars];
+    "-------------------------------------------------------------"+[338 chars];
+    "-------------------------------------------------------------"+[345 chars];
+    "-------------------------------------------------------------"+[352 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[366 chars];
+    "-------------------------------------------------------------"+[373 chars];
+    "-------------------------------------------------------------"+[380 chars];
+    "-------------------------------------------------------------"+[387 chars];
+    "-------------------------------------------------------------"+[394 chars];
+    "-------------------------------------------------------------"+[401 chars];
+    "-------------------------------------------------------------"+[408 chars];
+    "-------------------------------------------------------------"+[415 chars];
+    "-------------------------------------------------------------"+[422 chars];
+    "-------------------------------------------------------------"+[429 chars];
+    "-------------------------------------------------------------"+[436 chars];
+    "-------------------------------------------------------------"+[443 chars];
+    "-------------------------------------------------------------"+[450 chars];
+    "-------------------------------------------------------------"+[457 chars];
+    "-------------------------------------------------------------"+[464 chars];
+    "-------------------------------------------------------------"+[471 chars];
+    "-------------------------------------------------------------"+[478 chars];
+    "-------------------------------------------------------------"+[485 chars];
+    "-------------------------------------------------------------"+[492 chars];
+    "-------------------------------------------------------------"+[499 chars];
+    "-------------------------------------------------------------"+[506 chars];
+    "-------------------------------------------------------------"+[513 chars];
+    "-------------------------------------------------------------"+[520 chars];
+    "-------------------------------------------------------------"+[527 chars];
+    "-------------------------------------------------------------"+[534 chars];
+    "-------------------------------------------------------------"+[541 chars];
+    "-------------------------------------------------------------"+[548 chars];
+    "-------------------------------------------------------------"+[555 chars];
+    "-------------------------------------------------------------"+[562 chars];
+    "-------------------------------------------------------------"+[569 chars];
+    "-------------------------------------------------------------"+[576 chars];
+    "-------------------------------------------------------------"+[583 chars];
+    "-------------------------------------------------------------"+[590 chars];
+    "-------------------------------------------------------------"+[597 chars];
+    "-------------------------------------------------------------"+[604 chars];
+    "-------------------------------------------------------------"+[611 chars];
+    "-------------------------------------------------------------"+[618 chars];
+    "-------------------------------------------------------------"+[625 chars];
+    "-------------------------------------------------------------"+[632 chars];
+    ...|]
+val grids : string [,] =
+  [[""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "";
+    ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "";
+    ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""]
+   [""; "-"; "--"; "---"; "----"; "-----"; "------"; "-------"; "--------";
+    "---------"; "----------"; "-----------"; "------------"; "-------------";
+    "--------------"; "---------------"; "----------------";
+    "-----------------"; "------------------"; "-------------------";
+    "--------------------"; "---------------------"; "----------------------";
+    "-----------------------"; "------------------------";
+    "-------------------------"; "--------------------------";
+    "---------------------------"; "----------------------------";
+    "-----------------------------"; "------------------------------";
+    "-------------------------------"; "--------------------------------";
+    "---------------------------------"; "----------------------------------";
+    "-----------------------------------";
+    "------------------------------------";
+    "-------------------------------------";
+    "--------------------------------------";
+    "---------------------------------------";
+    "----------------------------------------";
+    "-----------------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------";
+    "--------------------------------------------";
+    "---------------------------------------------";
+    "----------------------------------------------";
+    "-----------------------------------------------";
+    "------------------------------------------------";
+    "-------------------------------------------------"; ...]
+   ...]
+
+> 
+type tree =
+  | L
+  | N of tree list
+val mkT : w:int -> d:int -> tree
+val tree : w:int -> d:int -> tree
+
+> [Building 2 4...done]
+
+val tree_2_4 : tree =
+  N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+     N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]
+
+> [Building 2 6...done]
+
+val tree_2_6 : tree =
+  N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+        N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+     N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+        N [N [N [N ...; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 8...done]
+
+val tree_2_8 : tree =
+  N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+           N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N ...; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 10...done]
+
+val tree_2_10 : tree =
+  N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]];
+                          N [N [L; L]; N [L; L; ...]; ...]; ...]; ...]; ...];
+                 ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 12...done]
+
+val tree_2_12 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]];
+                                N [N [L; L]; N ...; ...]; ...]; ...]; ...];
+                       ...]; ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 14...done]
+
+val tree_2_14 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; ...]; ...]; ...]; ...]; ...];
+                             ...]; ...]; ...]; ...]; ...]; ...]; ...]; ...];
+     ...]
+
+> [Building 3 8...done]
+
+val tree_3_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]]; N ...; ...];
+                 ...]; ...]; ...]; ...]; ...]
+
+> [Building 4 8...done]
+
+val tree_4_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; ...]; ...]; ...]; ...]; ...];
+           ...]; ...]; ...]
+
+> [Building 5 8...done]
+
+val tree_5_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]; N ...; ...]; ...];
+              ...]; ...]; ...]; ...]
+
+> [Building 6 8...done]
+
+val tree_6_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L; ...]; ...]; ...]; ...]; ...]; ...];
+        ...]; ...]
+
+> [Building 5 3...done]
+
+val tree_5_3 : tree =
+  N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]]; N [N [L; L; L; L; ...]; ...];
+     ...]
+
+> > 
+type X =
+  | Var of int
+  | Bop of int * X * X
+val generate : x:int -> X
+
+> 
+val exps : X list =
+  [Bop (1,Var 0,Var 0); Var 2; Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0));
+   Var 4; Bop (5,Var 2,Bop (1,Var 0,Var 0)); Var 6;
+   Bop (7,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)),Var 2); Var 8;
+   Bop (9,Var 4,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0))); Var 10;
+   Bop
+     (213,Var 106,
+      Bop
+        (71,
+         Bop
+           (35,Bop (17,Var 8,Bop (5,Var 2,Bop (1,Var 0,Var 0))),
+            Bop (11,...,...)),...)); ...]
+
+> 
+module Exprs = begin
+  val x1 : X =
+    Bop
+      (213,Var 106,
+       Bop
+         (71,
+          Bop
+            (35,Bop (17,Var 8,Bop (5,Var 2,Bop (1,Var 0,Var 0))),
+             Bop
+               (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+                Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)))),
+          Bop
+            (23,
+             Bop
+               (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+                Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0))),
+             Bop (7,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)),Var 2))))
+  val x2 : X = Var 21342314
+  val x3 : X = Var 3214
+  val x4 : X = Bop (1231357,Var 615678,Var 410452)
+  val x5 : X =
+    Bop
+      (5234547,Bop (2617273,Var 1308636,Var 872424),
+       Bop (1744849,Var 872424,Var 581616))
+  val x6 : X =
+    Bop (923759825,Var 461879912,Bop (307919941,Var 153959970,Var 102639980))
+  val x7 : X = Var 2435234
+  val x8 : X =
+    Bop
+      (12396777,Var 6198388,
+       Bop
+         (4132259,
+          Bop
+            (2066129,Var 1033064,
+             Bop
+               (688709,Var 344354,
+                Bop
+                  (229569,Var 114784,
+                   Bop
+                     (76523,
+                      Bop
+                        (38261,Var 19130,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472)))),
+                      Bop
+                        (25507,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472))),Var 8502))))),
+          Bop
+            (1377419,
+             Bop
+               (688709,Var 344354,
+                Bop
+                  (229569,Var 114784,
+                   Bop
+                     (76523,
+                      Bop
+                        (38261,Var 19130,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472)))),
+                      Bop (25507,...,...)))),...)))
+  val x9 : X =
+    Bop
+      (3333333,Var 1666666,
+       Bop
+         (1111111,
+          Bop
+            (555555,Bop (277777,Var 138888,Var 92592),
+             Bop (185185,Var 92592,Var 61728)),Var 370370))
+  val x10 : X =
+    Bop
+      (1312311237,Var 656155618,
+       Bop
+         (437437079,
+          Bop
+            (218718539,
+             Bop
+               (109359269,Var 54679634,
+                Bop
+                  (36453089,Var 18226544,
+                   Bop
+                     (12151029,Var 6075514,
+                      Bop
+                        (4050343,
+                         Bop
+                           (2025171,Bop (1012585,Var 506292,Var 337528),
+                            Bop
+                              (675057,Var 337528,
+                               Bop
+                                 (225019,
+                                  Bop
+                                    (112509,Var 56254,
+                                     Bop
+                                       (37503,
+                                        Bop
+                                          (18751,
+                                           Bop
+                                             (9375,
+                                              Bop
+                                                (4687,
+                                                 Bop
+                                                   (2343,
+                                                    Bop
+                                                      (1171,
+                                                       Bop
+                                                         (585,Var 292,
+                                                          Bop
+                                                            (195,
+                                                             Bop
+                                                               (97,Var 48,
+                                                                Var 32),
+                                                             Bop
+                                                               (65,Var 32,
+                                                                Bop
+                                                                  (21,Var 10,
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))),
+                                                       Var 390),
+                                                    Bop (781,Var 390,Var 260)),
+                                                 Var 1562),...),...),...)),...))),
+                         ...)))),...),...))
+  val x11 : X =
+    Bop
+      (2147483647,
+       Bop
+         (1073741823,
+          Bop
+            (536870911,
+             Bop
+               (268435455,
+                Bop
+                  (134217727,
+                   Bop
+                     (67108863,
+                      Bop
+                        (33554431,
+                         Bop
+                           (16777215,
+                            Bop
+                              (8388607,
+                               Bop
+                                 (4194303,
+                                  Bop
+                                    (2097151,
+                                     Bop
+                                       (1048575,
+                                        Bop
+                                          (524287,
+                                           Bop
+                                             (262143,
+                                              Bop
+                                                (131071,
+                                                 Bop
+                                                   (65535,
+                                                    Bop
+                                                      (32767,
+                                                       Bop
+                                                         (16383,
+                                                          Bop
+                                                            (8191,
+                                                             Bop
+                                                               (4095,
+                                                                Bop
+                                                                  (2047,
+                                                                   Bop
+                                                                     (1023,
+                                                                      Bop
+                                                                        (511,
+                                                                         Bop
+                                                                           (255,
+                                                                            Bop
+                                                                              (127,
+                                                                               Bop
+                                                                                 (63,
+                                                                                  Bop
+                                                                                    (31,
+                                                                                     Bop
+                                                                                       (15,
+                                                                                        Bop
+                                                                                          (7,
+                                                                                           Bop
+                                                                                             (3,
+                                                                                              Bop
+                                                                                                (1,
+                                                                                                 Var
+                                                                                                   0,
+                                                                                                 Var
+                                                                                                   0),
+                                                                                              Bop
+                                                                                                (1,
+                                                                                                 Var
+                                                                                                   0,
+                                                                                                 Var
+                                                                                                   0)),
+                                                                                           Var
+                                                                                             2),
+                                                                                        Bop
+                                                                                          (5,
+                                                                                           Var
+                                                                                             2,
+                                                                                           Bop
+                                                                                             (1,
+                                                                                              Var
+                                                                                                0,
+                                                                                              Var
+                                                                                                0))),
+                                                                                     Var
+                                                                                       10),
+                                                                                  Bop
+                                                                                    (21,
+                                                                                     Var
+                                                                                       10,
+                                                                                     Bop
+                                                                                       (7,
+                                                                                        Bop
+                                                                                          (3,
+                                                                                           Bop
+                                                                                             (1,
+                                                                                              Var
+                                                                                                0,
+                                                                                              Var
+                                                                                                0),
+                                                                                           ...),
+                                                                                        ...))),
+                                                                               ...),
+                                                                            ...),
+                                                                         ...),
+                                                                      ...),...),
+                                                                ...),...),...),
+                                                       ...),...),...),...),...),
+                                        ...),...),...),...),...),...),...),...),
+                ...),...),...),...)
+end
+
+> 
+type C =
+  class
+    new : x:string -> C
+    override ToString : unit -> string
+  end
+val c1 : C = <ToString exception: Trouble_A>
+val csA : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+val csB : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+val csC : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+
+> 
+exception Abc
+
+> 
+exception AbcInt of int
+
+> 
+exception AbcString of string
+
+> 
+exception AbcExn of exn list
+
+> 
+exception AbcException of System.Exception list
+
+> 
+val exA1 : exn = Abc
+val exA2 : exn = AbcInt 2
+val exA3 : exn = AbcString "3"
+val exA4 : exn = AbcExn [Abc; AbcInt 2; AbcString "3"]
+val exA5 : exn = AbcException [AbcExn [Abc; AbcInt 2; AbcString "3"]]
+exception Ex0
+exception ExUnit of unit
+exception ExUnits of unit * unit
+exception ExUnitOption of unit option
+val ex0 : exn = Ex0
+val exU : exn = ExUnit null
+val exUs : exn = ExUnits (null,null)
+val exUSome : exn = ExUnitOption (Some null)
+val exUNone : exn = ExUnitOption null
+type 'a T4063 = | AT4063 of 'a
+
+> 
+val valAT3063_12 : int T4063 = AT4063 12
+
+> 
+val valAT3063_True : bool T4063 = AT4063 true
+
+> 
+val valAT3063_text : string T4063 = AT4063 "text"
+
+> 
+val valAT3063_null : System.Object T4063 = AT4063 null
+
+> 
+type M4063<'a> =
+  class
+    new : x:'a -> M4063<'a>
+  end
+
+> 
+val v4063 : M4063<int>
+
+> 
+type Taaaaa<'a> =
+  class
+    new : unit -> Taaaaa<'a>
+  end
+
+> 
+type Taaaaa2<'a> =
+  class
+    inherit Taaaaa<'a>
+    new : unit -> Taaaaa2<'a>
+    member M : unit -> Taaaaa2<'a>
+  end
+
+> 
+type Tbbbbb<'a> =
+  class
+    new : x:'a -> Tbbbbb<'a>
+    member M : unit -> 'a
+  end
+
+> 
+type Tbbbbb2 =
+  class
+    inherit Tbbbbb<string>
+    new : x:string -> Tbbbbb2
+  end
+
+> val it : (unit -> string) = <fun:it at 198>
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> val it : string = "Check #help"
+> 
+  F# Interactive directives:
+
+    #r "file.dll";;        Reference (dynamically load) the given DLL
+    #I "path";;            Add the given search path for referenced DLLs
+    #load "file.fs" ...;;  Load the given file(s) as if compiled and referenced
+    #time ["on"|"off"];;   Toggle timing on/off
+    #help;;                Display help
+    #quit;;                Exit
+
+  F# Interactive command line options:
+
+
+
+> val it : string = "Check #time on and then off"
+> 
+--> Timing now on
+
+> 
+--> Timing now off
+
+> val it : string = "Check #unknown command"
+> Invalid directive '#blaaaaaa '
+> val it : string =
+  "Check #I with a known directory (to avoid a warning, which includes the location of this file, which is fragile...)"
+> 
+--> Added '/' to library include path
+
+> 
+type internal T1 =
+  | A
+  | B
+
+> 
+type internal T2 =
+  {x: int;}
+
+> 
+type internal T3
+
+> 
+type internal T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+type T1 =
+  internal | A
+           | B
+
+> 
+type T2 =
+  internal {x: int;}
+
+> 
+type private T1 =
+  | A
+  | B
+
+> 
+type private T2 =
+  {x: int;}
+
+> 
+type T1 =
+  private | A
+          | B
+
+> 
+type T2 =
+  private {x: int;}
+
+> 
+type internal T1 =
+  private | A
+          | B
+
+> 
+type internal T2 =
+  private {x: int;}
+
+> 
+type private T3
+
+> 
+type private T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+exception X1 of int
+
+> 
+exception private X2 of int
+
+> 
+exception internal X3 of int
+
+> 
+type T0 =
+  class
+    new : unit -> T0
+  end
+type T1Post<'a> =
+  class
+    new : unit -> T1Post<'a>
+  end
+type 'a T1Pre =
+  class
+    new : unit -> 'a T1Pre
+  end
+
+> 
+type T0 with
+  member M : unit -> T0 list
+type T0 with
+  member P : T0 * T0
+type T0 with
+  member E : IEvent<int>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type r =
+  {f0: int;
+   f1: int;
+   f2: int;
+   f3: int;
+   f4: int;
+   f5: int;
+   f6: int;
+   f7: int;
+   f8: int;
+   f9: int;}
+val r10 : r = {f0 = 0;
+               f1 = 1;
+               f2 = 2;
+               f3 = 3;
+               f4 = 4;
+               f5 = 5;
+               f6 = 6;
+               f7 = 7;
+               f8 = 8;
+               f9 = 9;}
+val r10s : r [] =
+  [|{f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; ...|]
+val r10s' : string * r [] =
+  ("one extra node",
+   [|{f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = ...;}; ...|])
+
+> 
+val x1564_A1 : int = 1
+
+
+--> Added '\' to library include path
+
+
+val x1564_A2 : int = 2
+
+
+--> Added '\' to library include path
+
+
+val x1564_A3 : int = 3
+
+> 
+type internal Foo2 =
+  class
+    new : unit -> Foo2
+    new : x:int -> Foo2
+    new : x:int * y:int -> Foo2
+    private new : x:int * y:int * z:int -> Foo2
+    member Prop1 : int
+    member Prop2 : int
+    member private Prop3 : int
+  end
+
+> 
+module internal InternalM = begin
+  val x : int = 1
+  type Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      private new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member private Prop3 : int
+    end
+  type private Foo3 =
+    class
+      new : unit -> Foo3
+      new : x:int -> Foo3
+      new : x:int * y:int -> Foo3
+      new : x:int * y:int * z:int -> Foo3
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+module internal PrivateM = begin
+  val private x : int = 1
+  type private Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+
+> val it : seq<int * string * int> =
+  seq
+    [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2);
+     (58, "2/10/2009", 1)]
+> 
+module Test4343a = begin
+  val mk : i:int -> string
+  val x100 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[39 chars]
+  val x90 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[29 chars]
+  val x80 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[19 chars]
+  val x75 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[14 chars]
+  val x74 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[13 chars]
+  val x73 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[12 chars]
+  val x72 : string =
+    "012345678901234567890123456789012345678901234567890123456789012345678901"
+  val x71 : string =
+    "01234567890123456789012345678901234567890123456789012345678901234567890"
+  val x70 : string =
+    "0123456789012345678901234567890123456789012345678901234567890123456789"
+end
+module Test4343b = begin
+  val fA : x:int -> int
+  val fB : x:'a -> y:'a -> 'a list
+  val gA : (int -> int)
+  val gB : ('a -> 'a -> 'a list)
+  val gAB : (int -> int) * ('a -> 'a -> 'a list)
+  val hB : ('a -> 'a -> 'a list)
+  val hA : (int -> int)
+end
+module Test4343c = begin
+  val typename<'a> : string
+  val typename2<'a> : string * string
+end
+module Test4343d = begin
+  val xList : int list = [1; 2; 3]
+  val xArray : int [] = [|1; 2; 3|]
+  val xString : string = "abcdef"
+  val xOption : int option = Some 12
+  val xArray2 : (int * int) [,] = [[(0, 0); (0, 1)]
+                                   [(1, 0); (1, 1)]]
+  val xSeq : seq<int>
+end
+module Test4343e = begin
+  type C =
+    class
+      new : x:int -> C
+    end
+  val cA : C
+  val cB : C
+  val cAB : C * C * C list =
+    (FSI_0091+Test4343e+C, FSI_0091+Test4343e+C,
+     [FSI_0091+Test4343e+C; FSI_0091+Test4343e+C])
+  type D =
+    class
+      new : x:int -> D
+      override ToString : unit -> string
+    end
+  val dA : D = D(1)
+  val dB : D = D(2)
+  val dAB : D * D * D list = (D(1), D(2), [D(1); D(2)])
+  module Generic = begin
+    type CGeneric<'a> =
+      class
+        new : x:'a -> CGeneric<'a>
+      end
+    val cA : C
+    val cB : C
+    val cAB : C * C * C list =
+      (FSI_0091+Test4343e+C, FSI_0091+Test4343e+C,
+       [FSI_0091+Test4343e+C; FSI_0091+Test4343e+C])
+    type D<'a> =
+      class
+        new : x:'a -> D<'a>
+        override ToString : unit -> string
+      end
+    val dA : D<int> = D(1)
+    val dB : D<int> = D(2)
+    val dAB : D<int> * D<int> * D<int> list = (D(1), D(2), [D(1); D(2)])
+    val dC : D<bool> = D(True)
+    val boxed_dABC : obj list = [D(1); D(2); D(True)]
+  end
+end
+type F1 =
+  class
+    inherit System.Windows.Forms.Form
+    interface System.IDisposable
+    val x: F1
+    val x2: F1
+    abstract member MMM : bool -> bool
+    abstract member AAA : int
+    abstract member ZZZ : int
+    abstract member BBB : bool with set
+    member B : unit -> int
+    member D : unit -> int
+    member D : x:int -> int
+    member D : x:int * y:int -> int
+    override ToString : unit -> string
+    member D2 : int
+    member E : int
+    member D2 : int with set
+    member E : int with set
+    static val mutable private sx: F1
+    static val mutable private sx2: F1
+    static member A : unit -> int
+    static member C : unit -> int
+  end
+type IP =
+  struct
+    new : x:int * y:int -> IP
+    static val mutable private AA: IP
+  end
+module Regression4643 = begin
+  type RIP =
+    struct
+      new : x:int -> RIP
+      static val mutable private y: RIP
+    end
+  type arg_unused_is_RIP =
+    struct
+      new : x:RIP -> arg_unused_is_RIP
+    end
+  type arg_used_is_RIP =
+    struct
+      new : x:RIP -> arg_used_is_RIP
+      member X : RIP
+    end
+  type field_is_RIP =
+    struct
+      val x: RIP
+    end
+end
+type Either<'a,'b> =
+  | This of 'a
+  | That of 'b
+val catch : f:(unit -> 'a) -> Either<'a,(string * string)>
+val seqFindIndexFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqFindFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqPickFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+module Regression5218 = begin
+  val t1 : int = 1
+  val t2 : int * int = (1, 2)
+  val t3 : int * int * int = (1, 2, 3)
+  val t4 : int * int * int * int = (1, 2, 3, 4)
+  val t5 : int * int * int * int * int = (1, 2, 3, 4, 5)
+  val t6 : int * int * int * int * int * int = (1, 2, 3, 4, 5, 6)
+  val t7 : int * int * int * int * int * int * int = (1, 2, 3, 4, 5, 6, 7)
+  val t8 : int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8)
+  val t9 : int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9)
+  val t10 : int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+  val t11 : int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
+  val t12 :
+    int * int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
+  val t13 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
+  val t14 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
+  val t15 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3740 = begin
+  type Writer<'a> =
+    interface
+      abstract member get_path : unit -> string
+    end
+  type MyClass =
+    class
+      interface Writer<int>
+      val path: string
+    end
+end
+
+> 
+type Regression4319_T2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> string
+  end
+
+> 
+  type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(572,42): warning FS1172: Infix operator member '+-+-+' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T0 =
+  class
+    static member ( +-+-+ ) : string
+  end
+
+> 
+  type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+  -----------------------------------------^^^^^
+
+stdin(573,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1 =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+  -----------------------------------------^^^^^
+
+stdin(574,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1b =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(575,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1c =
+  class
+    static member ( +-+-+ ) : x:('a * 'b) -> string
+  end
+
+> 
+  type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(576,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1d =
+  class
+    static member ( +-+-+ ) : x:(int * int) -> string
+  end
+
+> 
+  type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(578,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> string
+  end
+
+> 
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1 =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1b =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(581,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> moreArgs:'c -> string
+  end
+
+> 
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> moreArgs:'d -> string
+  end
+
+> 
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS1172: Infix operator member ':=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS0086: The name '(:=)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS1172: Infix operator member '&' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS0086: The name '(&)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name 'op_Amp' instead.
+
+      static member (&^)             = "AMP_AMP"
+  -------------------^^
+
+stdin(590,20): warning FS1172: Infix operator member '&^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS1172: Infix operator member '=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS0086: The name '(=)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name 'op_Equality' instead.
+
+      static member (!=)             = "INFIX_COMPARE_OP"
+  -------------------^^
+
+stdin(593,20): warning FS1172: Infix operator member '!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(597,20): warning FS1172: Infix operator member '...=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^^
+
+stdin(598,20): warning FS1172: Infix operator member '...!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(599,20): warning FS1172: Infix operator member '...<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(600,20): warning FS1172: Infix operator member '...>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ($)              = "DOLLAR"
+  -------------------^
+
+stdin(602,20): warning FS1172: Infix operator member '$' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS1172: Infix operator member '<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS0086: The name '(<)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_LessThan' instead.
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS1172: Infix operator member '>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS0086: The name '(>)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_GreaterThan' instead.
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS1172: Infix operator member '@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS0086: The name '(@)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS1172: Infix operator member '^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS0086: The name '(^)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(607,20): warning FS1172: Infix operator member '...@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(608,20): warning FS1172: Infix operator member '...^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (%)              = "PERCENT_OP"        
+  -------------------^
+
+stdin(609,20): warning FS1172: Infix operator member '%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (-)              = "MINUS"
+  -------------------^
+
+stdin(611,20): warning FS1172: Infix operator member '-' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( * )            = "STAR"
+  --------------------^
+
+stdin(612,21): warning FS1172: Infix operator member '*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+  -------------------^
+
+stdin(614,20): warning FS1172: Infix operator member '/' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(616,21): warning FS1172: Infix operator member '...*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(617,21): warning FS1172: Infix operator member '.../' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+  --------------------^^^^
+
+stdin(618,21): warning FS1172: Infix operator member '...%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ** )           = "INFIX_STAR_STAR_OP"
+  --------------------^^
+
+stdin(619,21): warning FS1172: Infix operator member '**' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_check =
+  class
+    static member ( & ) : string
+    static member ( &^ ) : string
+    static member ( @ ) : string
+    static member ( != ) : string
+    static member ( := ) : string
+    static member ( ^ ) : string
+    static member ( / ) : string
+    static member ( $ ) : string
+    static member ( ...@ ) : string
+    static member ( ...!= ) : string
+    static member ( .../ ) : string
+    static member ( ...= ) : string
+    static member ( ...> ) : string
+    static member ( ...^ ) : string
+    static member ( ...< ) : string
+    static member ( ...* ) : string
+    static member ( ...% ) : string
+    static member ( = ) : string
+    static member ( ** ) : string
+    static member ( > ) : string
+    static member ( < ) : string
+    static member ( % ) : string
+    static member ( * ) : string
+    static member ( - ) : string
+  end
+
+> 
+      member this.ToString() = "ABC"
+  ----------------^^^^^^^^
+
+stdin(624,17): warning FS0864: This new member hides the abstract member 'System.Object.ToString() : string'. Rename the member or use 'override' instead.
+Expect ABC = ABC
+
+type Regression4469 =
+  class
+    new : unit -> Regression4469
+    member ToString : unit -> string
+  end
+val r4469 : Regression4469 = FSI_0107+Regression4469
+val it : unit = ()
+
+> Expect ABC = ABC
+val it : unit = ()
+> 
+module Regression1019_short = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+module Regression1019_long = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+
+> val it : int ref = {contents = 1;}
+> 
+val x : int ref = {contents = 1;}
+val f : (unit -> int)
+
+> val it : int = 1
+> val it : unit = ()
+> val it : int = 3
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : 'a list = []
+> val it : 'a list list = [[]]
+> val it : 'a option = None
+> val it : 'a list * 'b list = ([], [])
+> val it : x:'a -> 'a = <fun:clo at 757-3>
+> 
+val fff : x:'a -> 'a
+
+> val it : ('a -> 'a) = <fun:clo at 759-4>
+> 
+val note_ExpectDupMethod : string =
+  "Regression4927: Expect error due to duplicate methods in the "+[20 chars]
+
+> 
+      member this.M() = "string"
+  ----------------^
+
+stdin(765,17): error FS0438: Duplicate method. The method 'M' has the same name and signature as another method in this type.
+> 
+val note_ExpectDupProperty : string =
+  "Regression4927: Expect error due to duplicate properties in t"+[23 chars]
+
+> 
+      member this.P = "string"
+  ----------------^
+
+stdin(772,17): error FS0438: Duplicate method. The method 'get_P' has the same name and signature as another method in this type.
+> > val it : string = "NOTE: Expect IAPrivate less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(779,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBPublic' it is used in
+> val it : string = "NOTE: Expect IAPrivate less accessible IBInternal"
+> 
+      type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^^^
+
+stdin(784,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBInternal' it is used in
+> 
+module Regression5265_PriPri = begin
+  type private IAPrivate =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPrivate
+      abstract member Q : int
+    end
+end
+
+> val it : string = "NOTE: Expect IAInternal less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(793,19): error FS0410: The type 'IAInternal' is less accessible than the value, member or type 'IBPublic' it is used in
+> 
+module Regression5265_IntInt = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_IntPri = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPub = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type IBPublic =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubInt = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPri = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> val it : string =
+  "Regression4232: Expect an error about duplicate virtual methods from parent type"
+> 
+          override x.M(a:string) = 1
+  -------------------^
+
+stdin(825,20): error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member Regression4232.D.M : 'U -> int' and 'abstract member Regression4232.D.M : 'T -> int'
+> val it : string =
+  "** Expect AnAxHostSubClass to be accepted. AxHost has a newslot virtual RightToLeft property outscope RightToLeft on Control"
+> 
+type AnAxHostSubClass =
+  class
+    inherit System.Windows.Forms.AxHost
+    new : x:string -> AnAxHostSubClass
+  end
+
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables"
+> 
+  let (|A|B|) (x:int) = A x;;
+  -----^^^^^
+
+stdin(833,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (match value generic)"
+> 
+  let (|A|B|) (x:'a) = A x;;
+  -----^^^^^
+
+stdin(836,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (when active pattern also has parameters)"
+> 
+  let (|A|B|) (p:'a) (x:int) = A p;;
+  -----^^^^^
+
+stdin(839,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect OK, since error message says constraint should work!"
+> 
+val ( |A|B| ) : x:int -> Choice<int,unit>
+
+> val it : string = "** Expect error since active pattern is not a function!"
+> 
+  let (|A|B|) = failwith "" : Choice<int,int>;;
+  -----^^^^^
+
+stdin(845,6): error FS1209: Active pattern '|A|B|' is not a function
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on match val"
+> 
+val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on parameters"
+> 
+val ( |A|B| ) : aval:'a -> bval:'b -> x:bool -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is generic, but it typar from closure, so OK"
+> 
+val outer : x:'a -> (int -> 'a option)
+
+> val it : string =
+  "** Expect OK, BUG 472278: revert unintended breaking change to Active Patterns in F# 3.0"
+> 
+val ( |Check1| ) : a:int -> int * 'a option
+
+> > 
+module ReflectionEmit = begin
+  type IA =
+    interface
+      abstract member M : #IB -> int
+    end
+  and IB =
+    interface
+      abstract member M : #IA -> int
+    end
+  type IA2<'a when 'a :> IB2<'a> and 'a :> IA2<'a>> =
+    interface
+      abstract member M : int
+    end
+  and IB2<'b when 'b :> IA2<'b> and 'b :> IB2<'b>> =
+    interface
+      abstract member M : int
+    end
+end
+
+> val it : string =
+  "Regression_139182: Expect the follow code to be accepted without error"
+> 
+type S =
+  struct
+    member TheMethod : unit -> int64
+  end
+val theMethod : s:S -> int64
+type T =
+  class
+    new : unit -> T
+    member Prop5 : int64
+    static member Prop1 : int64
+    static member Prop2 : int64
+    static member Prop3 : int64
+    static member Prop4 : string
+  end
+
+> val it : System.Threading.ThreadLocal<int> list = [0 {IsValueCreated = false;
+                                                      Values = ?;}]
+> 
+type MyDU =
+  | Case1 of Val1: int * Val2: string
+  | Case2 of string * V2: bool * float
+  | Case3 of int
+  | Case4 of Item1: bool
+  | Case5 of bool * string
+  | Case6 of Val1: int * bool * string
+  | Case7 of Big Name: int
+val namedFieldVar1 : MyDU = Case1 (5,"")
+val namedFieldVar2 : MyDU = Case7 25
+
+> 
+exception MyNamedException1 of Val1: int * Val2: string
+exception MyNamedException2 of string * V2: bool * float
+exception MyNamedException3 of Data: int
+exception MyNamedException4 of bool
+exception MyNamedException5 of int * string
+exception MyNamedException6 of Val1: int * bool * string * Data8: float
+exception MyNamedException7 of Big Named Field: int
+val namedEx1 : exn = MyNamedException1 (5,"")
+val namedEx2 : exn = MyNamedException7 25
+
+> > > 
diff --git a/tests/fsharp/core/printing/z.output.test.200.bsl b/tests/fsharp/core/printing/z.output.test.200.bsl
new file mode 100644
index 0000000..75fa080
--- /dev/null
+++ b/tests/fsharp/core/printing/z.output.test.200.bsl
@@ -0,0 +1,2243 @@
+
+> val it : unit = ()
+> > 
+val repeatId : string = "A"
+
+> 
+val repeatId : string = "B"
+
+
+namespace FSI_0005
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+> 
+val x1 : seq<string>
+val x2 : seq<string>
+val x3 : seq<string>
+val f1 : System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form
+val fs : System.Windows.Forms.Form [] =
+  [|System.Windows.Forms.Form, Text: fs #0;
+    System.Windows.Forms.Form, Text: fs #1;
+    System.Windows.Forms.Form, Text: fs #2;
+    System.Windows.Forms.Form, Text: fs #3;
+    System.Windows.Forms.Form, Text: fs #4;
+    System.Windows.Forms.Form, Text: fs #5;
+    System.Windows.Forms.Form, Text: fs #6;
+    System.Windows.Forms.Form, Text: fs #7;
+    System.Windows.Forms.Form, Text: fs #8;
+    System.Windows.Forms.Form, Text: fs #9;
+    System.Windows.Forms.Form, Text: fs #10;
+    System.Windows.Forms.Form, Text: fs #11;
+    System.Windows.Forms.Form, Text: fs #12;
+    System.Windows.Forms.Form, Text: fs #13;
+    System.Windows.Forms.Form, Text: fs #14;
+    System.Windows.Forms.Form, Text: fs #15;
+    System.Windows.Forms.Form, Text: fs #16;
+    System.Windows.Forms.Form, Text: fs #17;
+    System.Windows.Forms.Form, Text: fs #18;
+    System.Windows.Forms.Form, Text: fs #19; ...|]
+val xs : string list =
+  ["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+   "14"; "15"; "16"; "17"; "18"; "19"; ...]
+val xa : string [] =
+  [|"0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+    "14"; "15"; "16"; "17"; "18"; "19"; ...|]
+val xa2 : string [,] = [["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"]
+                        ["10"; "11"; "12"; "13"; "14"; "15"; "16"; "17"]
+                        ["20"; "21"; "22"; "23"; ...]
+                        ...]
+val sxs0 : Set<string> = set []
+
+> 
+val sxs1 : Set<string> = set ["0"]
+
+> 
+val sxs2 : Set<string> = set ["0"; "1"]
+
+> 
+val sxs3 : Set<string> = set ["0"; "1"; "2"]
+
+> 
+val sxs4 : Set<string> = set ["0"; "1"; "2"; "3"]
+
+> 
+val sxs200 : Set<string> =
+  set ["0"; "1"; "10"; "100"; "101"; "102"; "103"; "104"; "105"; ...]
+
+> 
+val msxs0 : Map<int,string> = map []
+
+> 
+val msxs1 : Map<int,string> = map [(0, "0")]
+
+> 
+val msxs2 : Map<int,string> = map [(0, "0"); (1, "1")]
+
+> 
+val msxs3 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2")]
+
+> 
+val msxs4 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2"); (3, "3")]
+
+> 
+val msxs200 : Map<int,string> =
+  map
+    [(0, "0"); (1, "1"); (2, "2"); (3, "3"); (4, "4"); (5, "5"); (6, "6");
+     (7, "7"); (8, "8"); ...]
+
+> 
+module M = begin
+  val a : string = "sub-binding"
+  val b :
+    (seq<string> * seq<string> * seq<string> * System.Windows.Forms.Form) option *
+    (string list * string list * string [,]) option =
+    (Some (<seq>, <seq>, <seq>, System.Windows.Forms.Form, Text: f1 form),
+     Some
+       (["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12";
+         "13"; "14"; "15"; "16"; ...], ..., ...))
+end
+type T =
+  class
+    new : a:int * b:int -> T
+    member AMethod : x:int -> int
+    member AProperty : int
+    static member StaticMethod : x:int -> int
+    static member StaticProperty : int
+  end
+val f_as_method : x:int -> int
+val f_as_thunk : (int -> int)
+val refCell : string ref = {contents = "value";}
+module D1 = begin
+  val words : System.Collections.Generic.IDictionary<string,int>
+  val words2000 : System.Collections.Generic.IDictionary<int,string>
+end
+
+> > 
+module D2 = begin
+  val words : IDictionary<string,int>
+  val words2000 : IDictionary<int,string>
+end
+val opt1 : 'a option
+val opt1b : int option = None
+val opt4 : 'a option option option option
+val opt4b : int option option option option = Some (Some (Some null))
+val opt5 : int list option option option option option list =
+  [Some (Some (Some (Some null)));
+   Some (Some (Some (Some (Some [1; 2; 3; 4; 5; 6]))));
+   Some (Some (Some (Some ...))); ...]
+val mkStr : n:int -> string
+val strs : string [] =
+  [|""; "-"; "--"; "---"; "----"; "-----"; "------"; "-------"; "--------";
+    "---------"; "----------"; "-----------"; "------------"; "-------------";
+    "--------------"; "---------------"; "----------------";
+    "-----------------"; "------------------"; "-------------------"; ...|]
+val str7s : string [] =
+  [|""; "-------"; "--------------"; "---------------------";
+    "----------------------------"; "-----------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[58 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[72 chars];
+    ...|]
+val grids : string [,] =
+  [[""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "";
+    ""; ...]
+   ...]
+
+> 
+type tree =
+  | L
+  | N of tree list
+val mkT : w:int -> d:int -> tree
+val tree : w:int -> d:int -> tree
+
+> [Building 2 4...done]
+
+val tree_2_4 : tree =
+  N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+     N [N [N [L; ...]; ...]; ...]; ...]
+
+> [Building 2 6...done]
+
+val tree_2_6 : tree =
+  N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]; N [N ...; ...];
+           ...]; ...]; ...]
+
+> [Building 2 8...done]
+
+val tree_2_8 : tree =
+  N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L; ...]; ...];
+                    ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 10...done]
+
+val tree_2_10 : tree =
+  N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N ...; ...];
+                          ...]; ...]; ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 12...done]
+
+val tree_2_12 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; ...]; ...];
+                                ...]; ...]; ...]; ...]; ...]; ...]; ...]; ...];
+        ...]; ...]
+
+> [Building 2 14...done]
+
+val tree_2_14 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N ...; ...]; ...];
+                                ...]; ...]; ...]; ...]; ...]; ...]; ...]; ...];
+        ...]; ...]
+
+> [Building 3 8...done]
+
+val tree_3_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]]; N ...; ...];
+                 ...]; ...]; ...]; ...]; ...]
+
+> [Building 4 8...done]
+
+val tree_4_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; ...]; ...];
+                    ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 5 8...done]
+
+val tree_5_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N ...; ...]; ...];
+                 ...]; ...]; ...]; ...]; ...]
+
+> [Building 6 8...done]
+
+val tree_6_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; ...]; ...]; ...];
+                 ...]; ...]; ...]; ...]; ...]
+
+> [Building 5 3...done]
+
+val tree_5_3 : tree =
+  N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L; ...]; ...];
+     ...]
+
+> > 
+type X =
+  | Var of int
+  | Bop of int * X * X
+val generate : x:int -> X
+
+> 
+val exps : X list =
+  [Bop (1,Var 0,Var 0); Var 2; Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,...));
+   ...]
+
+> 
+module Exprs = begin
+  val x1 : X =
+    Bop
+      (213,Var 106,
+       Bop
+         (71,Bop (35,Bop (17,Var 8,Bop (5,Var 2,Bop (1,Var 0,...))),...),...))
+  val x2 : X = Var 21342314
+  val x3 : X = Var 3214
+  val x4 : X = Bop (1231357,Var 615678,Var 410452)
+  val x5 : X =
+    Bop
+      (5234547,Bop (2617273,Var 1308636,Var 872424),
+       Bop (1744849,Var 872424,Var 581616))
+  val x6 : X =
+    Bop (923759825,Var 461879912,Bop (307919941,Var 153959970,Var 102639980))
+  val x7 : X = Var 2435234
+  val x8 : X =
+    Bop
+      (12396777,Var 6198388,
+       Bop
+         (4132259,
+          Bop
+            (2066129,Var 1033064,
+             Bop
+               (688709,Var 344354,Bop (229569,Var 114784,Bop (76523,...,...)))),
+          ...))
+  val x9 : X =
+    Bop
+      (3333333,Var 1666666,
+       Bop
+         (1111111,
+          Bop
+            (555555,Bop (277777,Var 138888,Var 92592),
+             Bop (185185,Var 92592,Var 61728)),...))
+  val x10 : X =
+    Bop
+      (1312311237,Var 656155618,
+       Bop
+         (437437079,
+          Bop
+            (218718539,
+             Bop
+               (109359269,Var 54679634,
+                Bop (36453089,Var 18226544,Bop (12151029,Var 6075514,...))),
+             ...),...))
+  val x11 : X =
+    Bop
+      (2147483647,
+       Bop
+         (1073741823,
+          Bop
+            (536870911,
+             Bop
+               (268435455,
+                Bop
+                  (134217727,
+                   Bop
+                     (67108863,
+                      Bop
+                        (33554431,
+                         Bop
+                           (16777215,Bop (8388607,Bop (4194303,...,...),...),
+                            ...),...),...),...),...),...),...),...)
+end
+
+> 
+type C =
+  class
+    new : x:string -> C
+    override ToString : unit -> string
+  end
+val c1 : C = <ToString exception: Trouble_A>
+val csA : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>; ...|]
+val csB : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>; ...|]
+val csC : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>; ...|]
+
+> 
+exception Abc
+
+> 
+exception AbcInt of int
+
+> 
+exception AbcString of string
+
+> 
+exception AbcExn of exn list
+
+> 
+exception AbcException of System.Exception list
+
+> 
+val exA1 : exn = Abc
+val exA2 : exn = AbcInt 2
+val exA3 : exn = AbcString "3"
+val exA4 : exn = AbcExn [Abc; AbcInt 2; AbcString "3"]
+val exA5 : exn = AbcException [AbcExn [Abc; AbcInt 2; AbcString "3"]]
+exception Ex0
+exception ExUnit of unit
+exception ExUnits of unit * unit
+exception ExUnitOption of unit option
+val ex0 : exn = Ex0
+val exU : exn = ExUnit null
+val exUs : exn = ExUnits (null,null)
+val exUSome : exn = ExUnitOption (Some null)
+val exUNone : exn = ExUnitOption null
+type 'a T4063 = | AT4063 of 'a
+
+> 
+val valAT3063_12 : int T4063 = AT4063 12
+
+> 
+val valAT3063_True : bool T4063 = AT4063 true
+
+> 
+val valAT3063_text : string T4063 = AT4063 "text"
+
+> 
+val valAT3063_null : System.Object T4063 = AT4063 null
+
+> 
+type M4063<'a> =
+  class
+    new : x:'a -> M4063<'a>
+  end
+
+> 
+val v4063 : M4063<int>
+
+> 
+type Taaaaa<'a> =
+  class
+    new : unit -> Taaaaa<'a>
+  end
+
+> 
+type Taaaaa2<'a> =
+  class
+    inherit Taaaaa<'a>
+    new : unit -> Taaaaa2<'a>
+    member M : unit -> Taaaaa2<'a>
+  end
+
+> 
+type Tbbbbb<'a> =
+  class
+    new : x:'a -> Tbbbbb<'a>
+    member M : unit -> 'a
+  end
+
+> 
+type Tbbbbb2 =
+  class
+    inherit Tbbbbb<string>
+    new : x:string -> Tbbbbb2
+  end
+
+> val it : (unit -> string) = <fun:it at 198>
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> val it : string = "Check #help"
+> 
+  F# Interactive directives:
+
+    #r "file.dll";;        Reference (dynamically load) the given DLL
+    #I "path";;            Add the given search path for referenced DLLs
+    #load "file.fs" ...;;  Load the given file(s) as if compiled and referenced
+    #time ["on"|"off"];;   Toggle timing on/off
+    #help;;                Display help
+    #quit;;                Exit
+
+  F# Interactive command line options:
+
+
+
+> val it : string = "Check #time on and then off"
+> 
+--> Timing now on
+
+> 
+--> Timing now off
+
+> val it : string = "Check #unknown command"
+> Invalid directive '#blaaaaaa '
+> val it : string =
+  "Check #I with a known directory (to avoid a warning, which includes the location of this file, which is fragile...)"
+> 
+--> Added '/' to library include path
+
+> 
+type internal T1 =
+  | A
+  | B
+
+> 
+type internal T2 =
+  {x: int;}
+
+> 
+type internal T3
+
+> 
+type internal T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+type T1 =
+  internal | A
+           | B
+
+> 
+type T2 =
+  internal {x: int;}
+
+> 
+type private T1 =
+  | A
+  | B
+
+> 
+type private T2 =
+  {x: int;}
+
+> 
+type T1 =
+  private | A
+          | B
+
+> 
+type T2 =
+  private {x: int;}
+
+> 
+type internal T1 =
+  private | A
+          | B
+
+> 
+type internal T2 =
+  private {x: int;}
+
+> 
+type private T3
+
+> 
+type private T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+exception X1 of int
+
+> 
+exception private X2 of int
+
+> 
+exception internal X3 of int
+
+> 
+type T0 =
+  class
+    new : unit -> T0
+  end
+type T1Post<'a> =
+  class
+    new : unit -> T1Post<'a>
+  end
+type 'a T1Pre =
+  class
+    new : unit -> 'a T1Pre
+  end
+
+> 
+type T0 with
+  member M : unit -> T0 list
+type T0 with
+  member P : T0 * T0
+type T0 with
+  member E : IEvent<int>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type r =
+  {f0: int;
+   f1: int;
+   f2: int;
+   f3: int;
+   f4: int;
+   f5: int;
+   f6: int;
+   f7: int;
+   f8: int;
+   f9: int;}
+val r10 : r = {f0 = 0;
+               f1 = 1;
+               f2 = 2;
+               f3 = 3;
+               f4 = 4;
+               f5 = 5;
+               f6 = 6;
+               f7 = 7;
+               f8 = 8;
+               f9 = 9;}
+val r10s : r [] = [|{f0 = 0;
+                     f1 = 1;
+                     f2 = 2;
+                     f3 = 3;
+                     f4 = 4;
+                     f5 = 5;
+                     f6 = 6;
+                     f7 = 7;
+                     f8 = 8;
+                     f9 = 9;}; ...|]
+val r10s' : string * r [] = ("one extra node", [|{f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = ...;}; ...|])
+
+> 
+val x1564_A1 : int = 1
+
+
+--> Added '\' to library include path
+
+
+val x1564_A2 : int = 2
+
+
+--> Added '\' to library include path
+
+
+val x1564_A3 : int = 3
+
+> 
+type internal Foo2 =
+  class
+    new : unit -> Foo2
+    new : x:int -> Foo2
+    new : x:int * y:int -> Foo2
+    private new : x:int * y:int * z:int -> Foo2
+    member Prop1 : int
+    member Prop2 : int
+    member private Prop3 : int
+  end
+
+> 
+module internal InternalM = begin
+  val x : int = 1
+  type Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      private new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member private Prop3 : int
+    end
+  type private Foo3 =
+    class
+      new : unit -> Foo3
+      new : x:int -> Foo3
+      new : x:int * y:int -> Foo3
+      new : x:int * y:int * z:int -> Foo3
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+module internal PrivateM = begin
+  val private x : int = 1
+  type private Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+
+> val it : seq<int * string * int> =
+  seq
+    [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2);
+     (58, "2/10/2009", 1)]
+> 
+module Test4343a = begin
+  val mk : i:int -> string
+  val x100 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[39 chars]
+  val x90 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[29 chars]
+  val x80 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[19 chars]
+  val x75 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[14 chars]
+  val x74 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[13 chars]
+  val x73 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[12 chars]
+  val x72 : string =
+    "012345678901234567890123456789012345678901234567890123456789012345678901"
+  val x71 : string =
+    "01234567890123456789012345678901234567890123456789012345678901234567890"
+  val x70 : string =
+    "0123456789012345678901234567890123456789012345678901234567890123456789"
+end
+module Test4343b = begin
+  val fA : x:int -> int
+  val fB : x:'a -> y:'a -> 'a list
+  val gA : (int -> int)
+  val gB : ('a -> 'a -> 'a list)
+  val gAB : (int -> int) * ('a -> 'a -> 'a list)
+  val hB : ('a -> 'a -> 'a list)
+  val hA : (int -> int)
+end
+module Test4343c = begin
+  val typename<'a> : string
+  val typename2<'a> : string * string
+end
+module Test4343d = begin
+  val xList : int list = [1; 2; 3]
+  val xArray : int [] = [|1; 2; 3|]
+  val xString : string = "abcdef"
+  val xOption : int option = Some 12
+  val xArray2 : (int * int) [,] = [[(0, 0); (0, 1)]
+                                   [(1, 0); (1, 1)]]
+  val xSeq : seq<int>
+end
+module Test4343e = begin
+  type C =
+    class
+      new : x:int -> C
+    end
+  val cA : C
+  val cB : C
+  val cAB : C * C * C list =
+    (FSI_0091+Test4343e+C, FSI_0091+Test4343e+C,
+     [FSI_0091+Test4343e+C; FSI_0091+Test4343e+C])
+  type D =
+    class
+      new : x:int -> D
+      override ToString : unit -> string
+    end
+  val dA : D = D(1)
+  val dB : D = D(2)
+  val dAB : D * D * D list = (D(1), D(2), [D(1); D(2)])
+  module Generic = begin
+    type CGeneric<'a> =
+      class
+        new : x:'a -> CGeneric<'a>
+      end
+    val cA : C
+    val cB : C
+    val cAB : C * C * C list =
+      (FSI_0091+Test4343e+C, FSI_0091+Test4343e+C,
+       [FSI_0091+Test4343e+C; FSI_0091+Test4343e+C])
+    type D<'a> =
+      class
+        new : x:'a -> D<'a>
+        override ToString : unit -> string
+      end
+    val dA : D<int> = D(1)
+    val dB : D<int> = D(2)
+    val dAB : D<int> * D<int> * D<int> list = (D(1), D(2), [D(1); D(2)])
+    val dC : D<bool> = D(True)
+    val boxed_dABC : obj list = [D(1); D(2); D(True)]
+  end
+end
+type F1 =
+  class
+    inherit System.Windows.Forms.Form
+    interface System.IDisposable
+    val x: F1
+    val x2: F1
+    abstract member MMM : bool -> bool
+    abstract member AAA : int
+    abstract member ZZZ : int
+    abstract member BBB : bool with set
+    member B : unit -> int
+    member D : unit -> int
+    member D : x:int -> int
+    member D : x:int * y:int -> int
+    override ToString : unit -> string
+    member D2 : int
+    member E : int
+    member D2 : int with set
+    member E : int with set
+    static val mutable private sx: F1
+    static val mutable private sx2: F1
+    static member A : unit -> int
+    static member C : unit -> int
+  end
+type IP =
+  struct
+    new : x:int * y:int -> IP
+    static val mutable private AA: IP
+  end
+module Regression4643 = begin
+  type RIP =
+    struct
+      new : x:int -> RIP
+      static val mutable private y: RIP
+    end
+  type arg_unused_is_RIP =
+    struct
+      new : x:RIP -> arg_unused_is_RIP
+    end
+  type arg_used_is_RIP =
+    struct
+      new : x:RIP -> arg_used_is_RIP
+      member X : RIP
+    end
+  type field_is_RIP =
+    struct
+      val x: RIP
+    end
+end
+type Either<'a,'b> =
+  | This of 'a
+  | That of 'b
+val catch : f:(unit -> 'a) -> Either<'a,(string * string)>
+val seqFindIndexFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqFindFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqPickFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+module Regression5218 = begin
+  val t1 : int = 1
+  val t2 : int * int = (1, 2)
+  val t3 : int * int * int = (1, 2, 3)
+  val t4 : int * int * int * int = (1, 2, 3, 4)
+  val t5 : int * int * int * int * int = (1, 2, 3, 4, 5)
+  val t6 : int * int * int * int * int * int = (1, 2, 3, 4, 5, 6)
+  val t7 : int * int * int * int * int * int * int = (1, 2, 3, 4, 5, 6, 7)
+  val t8 : int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8)
+  val t9 : int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9)
+  val t10 : int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+  val t11 : int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
+  val t12 :
+    int * int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
+  val t13 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
+  val t14 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
+  val t15 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3740 = begin
+  type Writer<'a> =
+    interface
+      abstract member get_path : unit -> string
+    end
+  type MyClass =
+    class
+      interface Writer<int>
+      val path: string
+    end
+end
+
+> 
+type Regression4319_T2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> string
+  end
+
+> 
+  type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(572,42): warning FS1172: Infix operator member '+-+-+' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T0 =
+  class
+    static member ( +-+-+ ) : string
+  end
+
+> 
+  type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+  -----------------------------------------^^^^^
+
+stdin(573,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1 =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+  -----------------------------------------^^^^^
+
+stdin(574,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1b =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(575,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1c =
+  class
+    static member ( +-+-+ ) : x:('a * 'b) -> string
+  end
+
+> 
+  type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(576,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1d =
+  class
+    static member ( +-+-+ ) : x:(int * int) -> string
+  end
+
+> 
+  type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(578,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> string
+  end
+
+> 
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1 =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1b =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(581,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> moreArgs:'c -> string
+  end
+
+> 
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> moreArgs:'d -> string
+  end
+
+> 
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS1172: Infix operator member ':=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS0086: The name '(:=)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS1172: Infix operator member '&' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS0086: The name '(&)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name 'op_Amp' instead.
+
+      static member (&^)             = "AMP_AMP"
+  -------------------^^
+
+stdin(590,20): warning FS1172: Infix operator member '&^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS1172: Infix operator member '=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS0086: The name '(=)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name 'op_Equality' instead.
+
+      static member (!=)             = "INFIX_COMPARE_OP"
+  -------------------^^
+
+stdin(593,20): warning FS1172: Infix operator member '!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(597,20): warning FS1172: Infix operator member '...=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^^
+
+stdin(598,20): warning FS1172: Infix operator member '...!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(599,20): warning FS1172: Infix operator member '...<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(600,20): warning FS1172: Infix operator member '...>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ($)              = "DOLLAR"
+  -------------------^
+
+stdin(602,20): warning FS1172: Infix operator member '$' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS1172: Infix operator member '<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS0086: The name '(<)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_LessThan' instead.
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS1172: Infix operator member '>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS0086: The name '(>)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_GreaterThan' instead.
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS1172: Infix operator member '@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS0086: The name '(@)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS1172: Infix operator member '^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS0086: The name '(^)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(607,20): warning FS1172: Infix operator member '...@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(608,20): warning FS1172: Infix operator member '...^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (%)              = "PERCENT_OP"        
+  -------------------^
+
+stdin(609,20): warning FS1172: Infix operator member '%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (-)              = "MINUS"
+  -------------------^
+
+stdin(611,20): warning FS1172: Infix operator member '-' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( * )            = "STAR"
+  --------------------^
+
+stdin(612,21): warning FS1172: Infix operator member '*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+  -------------------^
+
+stdin(614,20): warning FS1172: Infix operator member '/' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(616,21): warning FS1172: Infix operator member '...*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(617,21): warning FS1172: Infix operator member '.../' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+  --------------------^^^^
+
+stdin(618,21): warning FS1172: Infix operator member '...%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ** )           = "INFIX_STAR_STAR_OP"
+  --------------------^^
+
+stdin(619,21): warning FS1172: Infix operator member '**' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_check =
+  class
+    static member ( & ) : string
+    static member ( &^ ) : string
+    static member ( @ ) : string
+    static member ( != ) : string
+    static member ( := ) : string
+    static member ( ^ ) : string
+    static member ( / ) : string
+    static member ( $ ) : string
+    static member ( ...@ ) : string
+    static member ( ...!= ) : string
+    static member ( .../ ) : string
+    static member ( ...= ) : string
+    static member ( ...> ) : string
+    static member ( ...^ ) : string
+    static member ( ...< ) : string
+    static member ( ...* ) : string
+    static member ( ...% ) : string
+    static member ( = ) : string
+    static member ( ** ) : string
+    static member ( > ) : string
+    static member ( < ) : string
+    static member ( % ) : string
+    static member ( * ) : string
+    static member ( - ) : string
+  end
+
+> 
+      member this.ToString() = "ABC"
+  ----------------^^^^^^^^
+
+stdin(624,17): warning FS0864: This new member hides the abstract member 'System.Object.ToString() : string'. Rename the member or use 'override' instead.
+Expect ABC = ABC
+
+type Regression4469 =
+  class
+    new : unit -> Regression4469
+    member ToString : unit -> string
+  end
+val r4469 : Regression4469 = FSI_0107+Regression4469
+val it : unit = ()
+
+> Expect ABC = ABC
+val it : unit = ()
+> 
+module Regression1019_short = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+module Regression1019_long = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+
+> val it : int ref = {contents = 1;}
+> 
+val x : int ref = {contents = 1;}
+val f : (unit -> int)
+
+> val it : int = 1
+> val it : unit = ()
+> val it : int = 3
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : 'a list = []
+> val it : 'a list list = [[]]
+> val it : 'a option = None
+> val it : 'a list * 'b list = ([], [])
+> val it : x:'a -> 'a = <fun:clo at 757-3>
+> 
+val fff : x:'a -> 'a
+
+> val it : ('a -> 'a) = <fun:clo at 759-4>
+> 
+val note_ExpectDupMethod : string =
+  "Regression4927: Expect error due to duplicate methods in the "+[20 chars]
+
+> 
+      member this.M() = "string"
+  ----------------^
+
+stdin(765,17): error FS0438: Duplicate method. The method 'M' has the same name and signature as another method in this type.
+> 
+val note_ExpectDupProperty : string =
+  "Regression4927: Expect error due to duplicate properties in t"+[23 chars]
+
+> 
+      member this.P = "string"
+  ----------------^
+
+stdin(772,17): error FS0438: Duplicate method. The method 'get_P' has the same name and signature as another method in this type.
+> > val it : string = "NOTE: Expect IAPrivate less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(779,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBPublic' it is used in
+> val it : string = "NOTE: Expect IAPrivate less accessible IBInternal"
+> 
+      type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^^^
+
+stdin(784,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBInternal' it is used in
+> 
+module Regression5265_PriPri = begin
+  type private IAPrivate =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPrivate
+      abstract member Q : int
+    end
+end
+
+> val it : string = "NOTE: Expect IAInternal less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(793,19): error FS0410: The type 'IAInternal' is less accessible than the value, member or type 'IBPublic' it is used in
+> 
+module Regression5265_IntInt = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_IntPri = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPub = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type IBPublic =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubInt = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPri = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> val it : string =
+  "Regression4232: Expect an error about duplicate virtual methods from parent type"
+> 
+          override x.M(a:string) = 1
+  -------------------^
+
+stdin(825,20): error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member Regression4232.D.M : 'U -> int' and 'abstract member Regression4232.D.M : 'T -> int'
+> val it : string =
+  "** Expect AnAxHostSubClass to be accepted. AxHost has a newslot virtual RightToLeft property outscope RightToLeft on Control"
+> 
+type AnAxHostSubClass =
+  class
+    inherit System.Windows.Forms.AxHost
+    new : x:string -> AnAxHostSubClass
+  end
+
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables"
+> 
+  let (|A|B|) (x:int) = A x;;
+  -----^^^^^
+
+stdin(833,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (match value generic)"
+> 
+  let (|A|B|) (x:'a) = A x;;
+  -----^^^^^
+
+stdin(836,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (when active pattern also has parameters)"
+> 
+  let (|A|B|) (p:'a) (x:int) = A p;;
+  -----^^^^^
+
+stdin(839,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect OK, since error message says constraint should work!"
+> 
+val ( |A|B| ) : x:int -> Choice<int,unit>
+
+> val it : string = "** Expect error since active pattern is not a function!"
+> 
+  let (|A|B|) = failwith "" : Choice<int,int>;;
+  -----^^^^^
+
+stdin(845,6): error FS1209: Active pattern '|A|B|' is not a function
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on match val"
+> 
+val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on parameters"
+> 
+val ( |A|B| ) : aval:'a -> bval:'b -> x:bool -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is generic, but it typar from closure, so OK"
+> 
+val outer : x:'a -> (int -> 'a option)
+
+> val it : string =
+  "** Expect OK, BUG 472278: revert unintended breaking change to Active Patterns in F# 3.0"
+> 
+val ( |Check1| ) : a:int -> int * 'a option
+
+> > 
+module ReflectionEmit = begin
+  type IA =
+    interface
+      abstract member M : #IB -> int
+    end
+  and IB =
+    interface
+      abstract member M : #IA -> int
+    end
+  type IA2<'a when 'a :> IB2<'a> and 'a :> IA2<'a>> =
+    interface
+      abstract member M : int
+    end
+  and IB2<'b when 'b :> IA2<'b> and 'b :> IB2<'b>> =
+    interface
+      abstract member M : int
+    end
+end
+
+> val it : string =
+  "Regression_139182: Expect the follow code to be accepted without error"
+> 
+type S =
+  struct
+    member TheMethod : unit -> int64
+  end
+val theMethod : s:S -> int64
+type T =
+  class
+    new : unit -> T
+    member Prop5 : int64
+    static member Prop1 : int64
+    static member Prop2 : int64
+    static member Prop3 : int64
+    static member Prop4 : string
+  end
+
+> val it : System.Threading.ThreadLocal<int> list = [0 {IsValueCreated = false;
+                                                      Values = ?;}]
+> 
+type MyDU =
+  | Case1 of Val1: int * Val2: string
+  | Case2 of string * V2: bool * float
+  | Case3 of int
+  | Case4 of Item1: bool
+  | Case5 of bool * string
+  | Case6 of Val1: int * bool * string
+  | Case7 of Big Name: int
+val namedFieldVar1 : MyDU = Case1 (5,"")
+val namedFieldVar2 : MyDU = Case7 25
+
+> 
+exception MyNamedException1 of Val1: int * Val2: string
+exception MyNamedException2 of string * V2: bool * float
+exception MyNamedException3 of Data: int
+exception MyNamedException4 of bool
+exception MyNamedException5 of int * string
+exception MyNamedException6 of Val1: int * bool * string * Data8: float
+exception MyNamedException7 of Big Named Field: int
+val namedEx1 : exn = MyNamedException1 (5,"")
+val namedEx2 : exn = MyNamedException7 25
+
+> > > 
diff --git a/tests/fsharp/core/printing/z.output.test.default.bsl b/tests/fsharp/core/printing/z.output.test.default.bsl
new file mode 100644
index 0000000..c9d3abc
--- /dev/null
+++ b/tests/fsharp/core/printing/z.output.test.default.bsl
@@ -0,0 +1,6521 @@
+
+> > 
+val repeatId : string = "A"
+
+> 
+val repeatId : string = "B"
+
+
+namespace FSI_0004
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0005
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0005
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+> 
+val x1 : seq<string>
+val x2 : seq<string>
+val x3 : seq<string>
+val f1 : System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form
+val fs : System.Windows.Forms.Form [] =
+  [|System.Windows.Forms.Form, Text: fs #0;
+    System.Windows.Forms.Form, Text: fs #1;
+    System.Windows.Forms.Form, Text: fs #2;
+    System.Windows.Forms.Form, Text: fs #3;
+    System.Windows.Forms.Form, Text: fs #4;
+    System.Windows.Forms.Form, Text: fs #5;
+    System.Windows.Forms.Form, Text: fs #6;
+    System.Windows.Forms.Form, Text: fs #7;
+    System.Windows.Forms.Form, Text: fs #8;
+    System.Windows.Forms.Form, Text: fs #9;
+    System.Windows.Forms.Form, Text: fs #10;
+    System.Windows.Forms.Form, Text: fs #11;
+    System.Windows.Forms.Form, Text: fs #12;
+    System.Windows.Forms.Form, Text: fs #13;
+    System.Windows.Forms.Form, Text: fs #14;
+    System.Windows.Forms.Form, Text: fs #15;
+    System.Windows.Forms.Form, Text: fs #16;
+    System.Windows.Forms.Form, Text: fs #17;
+    System.Windows.Forms.Form, Text: fs #18;
+    System.Windows.Forms.Form, Text: fs #19;
+    System.Windows.Forms.Form, Text: fs #20;
+    System.Windows.Forms.Form, Text: fs #21;
+    System.Windows.Forms.Form, Text: fs #22;
+    System.Windows.Forms.Form, Text: fs #23;
+    System.Windows.Forms.Form, Text: fs #24;
+    System.Windows.Forms.Form, Text: fs #25;
+    System.Windows.Forms.Form, Text: fs #26;
+    System.Windows.Forms.Form, Text: fs #27;
+    System.Windows.Forms.Form, Text: fs #28;
+    System.Windows.Forms.Form, Text: fs #29;
+    System.Windows.Forms.Form, Text: fs #30;
+    System.Windows.Forms.Form, Text: fs #31;
+    System.Windows.Forms.Form, Text: fs #32;
+    System.Windows.Forms.Form, Text: fs #33;
+    System.Windows.Forms.Form, Text: fs #34;
+    System.Windows.Forms.Form, Text: fs #35;
+    System.Windows.Forms.Form, Text: fs #36;
+    System.Windows.Forms.Form, Text: fs #37;
+    System.Windows.Forms.Form, Text: fs #38;
+    System.Windows.Forms.Form, Text: fs #39;
+    System.Windows.Forms.Form, Text: fs #40;
+    System.Windows.Forms.Form, Text: fs #41;
+    System.Windows.Forms.Form, Text: fs #42;
+    System.Windows.Forms.Form, Text: fs #43;
+    System.Windows.Forms.Form, Text: fs #44;
+    System.Windows.Forms.Form, Text: fs #45;
+    System.Windows.Forms.Form, Text: fs #46;
+    System.Windows.Forms.Form, Text: fs #47;
+    System.Windows.Forms.Form, Text: fs #48;
+    System.Windows.Forms.Form, Text: fs #49;
+    System.Windows.Forms.Form, Text: fs #50;
+    System.Windows.Forms.Form, Text: fs #51;
+    System.Windows.Forms.Form, Text: fs #52;
+    System.Windows.Forms.Form, Text: fs #53;
+    System.Windows.Forms.Form, Text: fs #54;
+    System.Windows.Forms.Form, Text: fs #55;
+    System.Windows.Forms.Form, Text: fs #56;
+    System.Windows.Forms.Form, Text: fs #57;
+    System.Windows.Forms.Form, Text: fs #58;
+    System.Windows.Forms.Form, Text: fs #59;
+    System.Windows.Forms.Form, Text: fs #60;
+    System.Windows.Forms.Form, Text: fs #61;
+    System.Windows.Forms.Form, Text: fs #62;
+    System.Windows.Forms.Form, Text: fs #63;
+    System.Windows.Forms.Form, Text: fs #64;
+    System.Windows.Forms.Form, Text: fs #65;
+    System.Windows.Forms.Form, Text: fs #66;
+    System.Windows.Forms.Form, Text: fs #67;
+    System.Windows.Forms.Form, Text: fs #68;
+    System.Windows.Forms.Form, Text: fs #69;
+    System.Windows.Forms.Form, Text: fs #70;
+    System.Windows.Forms.Form, Text: fs #71;
+    System.Windows.Forms.Form, Text: fs #72;
+    System.Windows.Forms.Form, Text: fs #73;
+    System.Windows.Forms.Form, Text: fs #74;
+    System.Windows.Forms.Form, Text: fs #75;
+    System.Windows.Forms.Form, Text: fs #76;
+    System.Windows.Forms.Form, Text: fs #77;
+    System.Windows.Forms.Form, Text: fs #78;
+    System.Windows.Forms.Form, Text: fs #79;
+    System.Windows.Forms.Form, Text: fs #80;
+    System.Windows.Forms.Form, Text: fs #81;
+    System.Windows.Forms.Form, Text: fs #82;
+    System.Windows.Forms.Form, Text: fs #83;
+    System.Windows.Forms.Form, Text: fs #84;
+    System.Windows.Forms.Form, Text: fs #85;
+    System.Windows.Forms.Form, Text: fs #86;
+    System.Windows.Forms.Form, Text: fs #87;
+    System.Windows.Forms.Form, Text: fs #88;
+    System.Windows.Forms.Form, Text: fs #89;
+    System.Windows.Forms.Form, Text: fs #90;
+    System.Windows.Forms.Form, Text: fs #91;
+    System.Windows.Forms.Form, Text: fs #92;
+    System.Windows.Forms.Form, Text: fs #93;
+    System.Windows.Forms.Form, Text: fs #94;
+    System.Windows.Forms.Form, Text: fs #95;
+    System.Windows.Forms.Form, Text: fs #96;
+    System.Windows.Forms.Form, Text: fs #97;
+    System.Windows.Forms.Form, Text: fs #98;
+    System.Windows.Forms.Form, Text: fs #99; ...|]
+val xs : string list =
+  ["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+   "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23"; "24"; "25";
+   "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34"; "35"; "36"; "37";
+   "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"; "48"; "49";
+   "50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"; "58"; "59"; "60"; "61";
+   "62"; "63"; "64"; "65"; "66"; "67"; "68"; "69"; "70"; "71"; "72"; "73";
+   "74"; "75"; "76"; "77"; "78"; "79"; "80"; "81"; "82"; "83"; "84"; "85";
+   "86"; "87"; "88"; "89"; "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97";
+   "98"; "99"; ...]
+val xa : string [] =
+  [|"0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12"; "13";
+    "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23"; "24"; "25";
+    "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34"; "35"; "36"; "37";
+    "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"; "48"; "49";
+    "50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"; "58"; "59"; "60"; "61";
+    "62"; "63"; "64"; "65"; "66"; "67"; "68"; "69"; "70"; "71"; "72"; "73";
+    "74"; "75"; "76"; "77"; "78"; "79"; "80"; "81"; "82"; "83"; "84"; "85";
+    "86"; "87"; "88"; "89"; "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97";
+    "98"; "99"; ...|]
+val xa2 : string [,] = [["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"]
+                        ["10"; "11"; "12"; "13"; "14"; "15"; "16"; "17"]
+                        ["20"; "21"; "22"; "23"; "24"; "25"; "26"; "27"]
+                        ["30"; "31"; "32"; "33"; "34"; "35"; "36"; "37"]
+                        ["40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"]
+                        ["50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"]
+                        ["60"; "61"; "62"; "63"; "64"; "65"; "66"; "67"]
+                        ["70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"]]
+val sxs0 : Set<string> = set []
+
+> 
+val sxs1 : Set<string> = set ["0"]
+
+> 
+val sxs2 : Set<string> = set ["0"; "1"]
+
+> 
+val sxs3 : Set<string> = set ["0"; "1"; "2"]
+
+> 
+val sxs4 : Set<string> = set ["0"; "1"; "2"; "3"]
+
+> 
+val sxs200 : Set<string> =
+  set ["0"; "1"; "10"; "100"; "101"; "102"; "103"; "104"; "105"; ...]
+
+> 
+val msxs0 : Map<int,string> = map []
+
+> 
+val msxs1 : Map<int,string> = map [(0, "0")]
+
+> 
+val msxs2 : Map<int,string> = map [(0, "0"); (1, "1")]
+
+> 
+val msxs3 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2")]
+
+> 
+val msxs4 : Map<int,string> = map [(0, "0"); (1, "1"); (2, "2"); (3, "3")]
+
+> 
+val msxs200 : Map<int,string> =
+  map
+    [(0, "0"); (1, "1"); (2, "2"); (3, "3"); (4, "4"); (5, "5"); (6, "6");
+     (7, "7"); (8, "8"); ...]
+
+> 
+module M = begin
+  val a : string = "sub-binding"
+  val b :
+    (seq<string> * seq<string> * seq<string> * System.Windows.Forms.Form) option *
+    (string list * string list * string [,]) option =
+    (Some (<seq>, <seq>, <seq>, System.Windows.Forms.Form, Text: f1 form),
+     Some
+       (["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12";
+         "13"; "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23";
+         "24"; "25"; "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34";
+         "35"; "36"; "37"; "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45";
+         "46"; "47"; "48"; "49"; "50"; "51"; "52"; "53"; "54"; "55"; "56";
+         "57"; "58"; "59"; "60"; "61"; "62"; "63"; "64"; "65"; "66"; "67";
+         "68"; "69"; "70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"; "78";
+         "79"; "80"; "81"; "82"; "83"; "84"; "85"; "86"; "87"; "88"; "89";
+         "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97"; "98"; "99"; ...],
+        ["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9"; "10"; "11"; "12";
+         "13"; "14"; "15"; "16"; "17"; "18"; "19"; "20"; "21"; "22"; "23";
+         "24"; "25"; "26"; "27"; "28"; "29"; "30"; "31"; "32"; "33"; "34";
+         "35"; "36"; "37"; "38"; "39"; "40"; "41"; "42"; "43"; "44"; "45";
+         "46"; "47"; "48"; "49"; "50"; "51"; "52"; "53"; "54"; "55"; "56";
+         "57"; "58"; "59"; "60"; "61"; "62"; "63"; "64"; "65"; "66"; "67";
+         "68"; "69"; "70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"; "78";
+         "79"; "80"; "81"; "82"; "83"; "84"; "85"; "86"; "87"; "88"; "89";
+         "90"; "91"; "92"; "93"; "94"; "95"; "96"; "97"; "98"; "99"; ...],
+        [["0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"]
+         ["10"; "11"; "12"; "13"; "14"; "15"; "16"; "17"]
+         ["20"; "21"; "22"; "23"; "24"; "25"; "26"; "27"]
+         ["30"; "31"; "32"; "33"; "34"; "35"; "36"; "37"]
+         ["40"; "41"; "42"; "43"; "44"; "45"; "46"; "47"]
+         ["50"; "51"; "52"; "53"; "54"; "55"; "56"; "57"]
+         ["60"; "61"; "62"; "63"; "64"; "65"; "66"; "67"]
+         ["70"; "71"; "72"; "73"; "74"; "75"; "76"; "77"]]))
+end
+type T =
+  class
+    new : a:int * b:int -> T
+    member AMethod : x:int -> int
+    member AProperty : int
+    static member StaticMethod : x:int -> int
+    static member StaticProperty : int
+  end
+val f_as_method : x:int -> int
+val f_as_thunk : (int -> int)
+val refCell : string ref = {contents = "value";}
+module D1 = begin
+  val words : System.Collections.Generic.IDictionary<string,int>
+  val words2000 : System.Collections.Generic.IDictionary<int,string>
+end
+
+> > 
+module D2 = begin
+  val words : IDictionary<string,int>
+  val words2000 : IDictionary<int,string>
+end
+val opt1 : 'a option
+val opt1b : int option = None
+val opt4 : 'a option option option option
+val opt4b : int option option option option = Some (Some (Some null))
+val opt5 : int list option option option option option list =
+  [Some (Some (Some (Some null)));
+   Some (Some (Some (Some (Some [1; 2; 3; 4; 5; 6]))));
+   Some
+     (Some
+        (Some
+           (Some
+              (Some
+                 [1; 2; 3; 4; 5; 6; 7; 8; 9; 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1;
+                  2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8; 9; 1; 2; 3;
+                  4; 5; 6; 7; 8; 9; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0]))))]
+val mkStr : n:int -> string
+val strs : string [] =
+  [|""; "-"; "--"; "---"; "----"; "-----"; "------"; "-------"; "--------";
+    "---------"; "----------"; "-----------"; "------------"; "-------------";
+    "--------------"; "---------------"; "----------------";
+    "-----------------"; "------------------"; "-------------------";
+    "--------------------"; "---------------------"; "----------------------";
+    "-----------------------"; "------------------------";
+    "-------------------------"; "--------------------------";
+    "---------------------------"; "----------------------------";
+    "-----------------------------"; "------------------------------";
+    "-------------------------------"; "--------------------------------";
+    "---------------------------------"; "----------------------------------";
+    "-----------------------------------";
+    "------------------------------------";
+    "-------------------------------------";
+    "--------------------------------------";
+    "---------------------------------------";
+    "----------------------------------------";
+    "-----------------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------";
+    "--------------------------------------------";
+    "---------------------------------------------";
+    "----------------------------------------------";
+    "-----------------------------------------------";
+    "------------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------";
+    "---------------------------------------------------";
+    "----------------------------------------------------";
+    "-----------------------------------------------------";
+    "------------------------------------------------------";
+    "-------------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------";
+    "----------------------------------------------------------";
+    "-----------------------------------------------------------";
+    "------------------------------------------------------------";
+    "-------------------------------------------------------------";
+    "--------------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------";
+    "-----------------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "-------------------------------------------------------------------";
+    "--------------------------------------------------------------------";
+    "---------------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-----------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[12 chars];
+    "-------------------------------------------------------------"+[13 chars];
+    "-------------------------------------------------------------"+[14 chars];
+    "-------------------------------------------------------------"+[15 chars];
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[18 chars];
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[20 chars];
+    "-------------------------------------------------------------"+[21 chars];
+    "-------------------------------------------------------------"+[22 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[24 chars];
+    "-------------------------------------------------------------"+[25 chars];
+    "-------------------------------------------------------------"+[26 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[28 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[31 chars];
+    "-------------------------------------------------------------"+[32 chars];
+    "-------------------------------------------------------------"+[33 chars];
+    "-------------------------------------------------------------"+[34 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[36 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[38 chars]|]
+val str7s : string [] =
+  [|""; "-------"; "--------------"; "---------------------";
+    "----------------------------"; "-----------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[58 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[72 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[86 chars];
+    "-------------------------------------------------------------"+[93 chars];
+    "-------------------------------------------------------------"+[100 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[114 chars];
+    "-------------------------------------------------------------"+[121 chars];
+    "-------------------------------------------------------------"+[128 chars];
+    "-------------------------------------------------------------"+[135 chars];
+    "-------------------------------------------------------------"+[142 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[156 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[170 chars];
+    "-------------------------------------------------------------"+[177 chars];
+    "-------------------------------------------------------------"+[184 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[198 chars];
+    "-------------------------------------------------------------"+[205 chars];
+    "-------------------------------------------------------------"+[212 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[226 chars];
+    "-------------------------------------------------------------"+[233 chars];
+    "-------------------------------------------------------------"+[240 chars];
+    "-------------------------------------------------------------"+[247 chars];
+    "-------------------------------------------------------------"+[254 chars];
+    "-------------------------------------------------------------"+[261 chars];
+    "-------------------------------------------------------------"+[268 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[282 chars];
+    "-------------------------------------------------------------"+[289 chars];
+    "-------------------------------------------------------------"+[296 chars];
+    "-------------------------------------------------------------"+[303 chars];
+    "-------------------------------------------------------------"+[310 chars];
+    "-------------------------------------------------------------"+[317 chars];
+    "-------------------------------------------------------------"+[324 chars];
+    "-------------------------------------------------------------"+[331 chars];
+    "-------------------------------------------------------------"+[338 chars];
+    "-------------------------------------------------------------"+[345 chars];
+    "-------------------------------------------------------------"+[352 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[366 chars];
+    "-------------------------------------------------------------"+[373 chars];
+    "-------------------------------------------------------------"+[380 chars];
+    "-------------------------------------------------------------"+[387 chars];
+    "-------------------------------------------------------------"+[394 chars];
+    "-------------------------------------------------------------"+[401 chars];
+    "-------------------------------------------------------------"+[408 chars];
+    "-------------------------------------------------------------"+[415 chars];
+    "-------------------------------------------------------------"+[422 chars];
+    "-------------------------------------------------------------"+[429 chars];
+    "-------------------------------------------------------------"+[436 chars];
+    "-------------------------------------------------------------"+[443 chars];
+    "-------------------------------------------------------------"+[450 chars];
+    "-------------------------------------------------------------"+[457 chars];
+    "-------------------------------------------------------------"+[464 chars];
+    "-------------------------------------------------------------"+[471 chars];
+    "-------------------------------------------------------------"+[478 chars];
+    "-------------------------------------------------------------"+[485 chars];
+    "-------------------------------------------------------------"+[492 chars];
+    "-------------------------------------------------------------"+[499 chars];
+    "-------------------------------------------------------------"+[506 chars];
+    "-------------------------------------------------------------"+[513 chars];
+    "-------------------------------------------------------------"+[520 chars];
+    "-------------------------------------------------------------"+[527 chars];
+    "-------------------------------------------------------------"+[534 chars];
+    "-------------------------------------------------------------"+[541 chars];
+    "-------------------------------------------------------------"+[548 chars];
+    "-------------------------------------------------------------"+[555 chars];
+    "-------------------------------------------------------------"+[562 chars];
+    "-------------------------------------------------------------"+[569 chars];
+    "-------------------------------------------------------------"+[576 chars];
+    "-------------------------------------------------------------"+[583 chars];
+    "-------------------------------------------------------------"+[590 chars];
+    "-------------------------------------------------------------"+[597 chars];
+    "-------------------------------------------------------------"+[604 chars];
+    "-------------------------------------------------------------"+[611 chars];
+    "-------------------------------------------------------------"+[618 chars];
+    "-------------------------------------------------------------"+[625 chars];
+    "-------------------------------------------------------------"+[632 chars]|]
+val grids : string [,] =
+  [[""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "";
+    ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; "";
+    ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""]
+   [""; "-"; "--"; "---"; "----"; "-----"; "------"; "-------"; "--------";
+    "---------"; "----------"; "-----------"; "------------"; "-------------";
+    "--------------"; "---------------"; "----------------";
+    "-----------------"; "------------------"; "-------------------";
+    "--------------------"; "---------------------"; "----------------------";
+    "-----------------------"; "------------------------";
+    "-------------------------"; "--------------------------";
+    "---------------------------"; "----------------------------";
+    "-----------------------------"; "------------------------------";
+    "-------------------------------"; "--------------------------------";
+    "---------------------------------"; "----------------------------------";
+    "-----------------------------------";
+    "------------------------------------";
+    "-------------------------------------";
+    "--------------------------------------";
+    "---------------------------------------";
+    "----------------------------------------";
+    "-----------------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------";
+    "--------------------------------------------";
+    "---------------------------------------------";
+    "----------------------------------------------";
+    "-----------------------------------------------";
+    "------------------------------------------------";
+    "-------------------------------------------------"]
+   [""; "--"; "----"; "------"; "--------"; "----------"; "------------";
+    "--------------"; "----------------"; "------------------";
+    "--------------------"; "----------------------";
+    "------------------------"; "--------------------------";
+    "----------------------------"; "------------------------------";
+    "--------------------------------"; "----------------------------------";
+    "------------------------------------";
+    "--------------------------------------";
+    "----------------------------------------";
+    "------------------------------------------";
+    "--------------------------------------------";
+    "----------------------------------------------";
+    "------------------------------------------------";
+    "--------------------------------------------------";
+    "----------------------------------------------------";
+    "------------------------------------------------------";
+    "--------------------------------------------------------";
+    "----------------------------------------------------------";
+    "------------------------------------------------------------";
+    "--------------------------------------------------------------";
+    "----------------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "--------------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[13 chars];
+    "-------------------------------------------------------------"+[15 chars];
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[21 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[25 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[31 chars];
+    "-------------------------------------------------------------"+[33 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[37 chars]]
+   [""; "---"; "------"; "---------"; "------------"; "---------------";
+    "------------------"; "---------------------"; "------------------------";
+    "---------------------------"; "------------------------------";
+    "---------------------------------";
+    "------------------------------------";
+    "---------------------------------------";
+    "------------------------------------------";
+    "---------------------------------------------";
+    "------------------------------------------------";
+    "---------------------------------------------------";
+    "------------------------------------------------------";
+    "---------------------------------------------------------";
+    "------------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "---------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[14 chars];
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[20 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[26 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[32 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[38 chars];
+    "-------------------------------------------------------------"+[41 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[50 chars];
+    "-------------------------------------------------------------"+[53 chars];
+    "-------------------------------------------------------------"+[56 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[62 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[68 chars];
+    "-------------------------------------------------------------"+[71 chars];
+    "-------------------------------------------------------------"+[74 chars];
+    "-------------------------------------------------------------"+[77 chars];
+    "-------------------------------------------------------------"+[80 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[86 chars]]
+   [""; "----"; "--------"; "------------"; "----------------";
+    "--------------------"; "------------------------";
+    "----------------------------"; "--------------------------------";
+    "------------------------------------";
+    "----------------------------------------";
+    "--------------------------------------------";
+    "------------------------------------------------";
+    "----------------------------------------------------";
+    "--------------------------------------------------------";
+    "------------------------------------------------------------";
+    "----------------------------------------------------------------";
+    "--------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[15 chars];
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[31 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[39 chars];
+    "-------------------------------------------------------------"+[43 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[55 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[63 chars];
+    "-------------------------------------------------------------"+[67 chars];
+    "-------------------------------------------------------------"+[71 chars];
+    "-------------------------------------------------------------"+[75 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[87 chars];
+    "-------------------------------------------------------------"+[91 chars];
+    "-------------------------------------------------------------"+[95 chars];
+    "-------------------------------------------------------------"+[99 chars];
+    "-------------------------------------------------------------"+[103 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[111 chars];
+    "-------------------------------------------------------------"+[115 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[123 chars];
+    "-------------------------------------------------------------"+[127 chars];
+    "-------------------------------------------------------------"+[131 chars];
+    "-------------------------------------------------------------"+[135 chars]]
+   [""; "-----"; "----------"; "---------------"; "--------------------";
+    "-------------------------"; "------------------------------";
+    "-----------------------------------";
+    "----------------------------------------";
+    "---------------------------------------------";
+    "--------------------------------------------------";
+    "-------------------------------------------------------";
+    "------------------------------------------------------------";
+    "-----------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[14 chars];
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[24 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[34 chars];
+    "-------------------------------------------------------------"+[39 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[49 chars];
+    "-------------------------------------------------------------"+[54 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[64 chars];
+    "-------------------------------------------------------------"+[69 chars];
+    "-------------------------------------------------------------"+[74 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[84 chars];
+    "-------------------------------------------------------------"+[89 chars];
+    "-------------------------------------------------------------"+[94 chars];
+    "-------------------------------------------------------------"+[99 chars];
+    "-------------------------------------------------------------"+[104 chars];
+    "-------------------------------------------------------------"+[109 chars];
+    "-------------------------------------------------------------"+[114 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[124 chars];
+    "-------------------------------------------------------------"+[129 chars];
+    "-------------------------------------------------------------"+[134 chars];
+    "-------------------------------------------------------------"+[139 chars];
+    "-------------------------------------------------------------"+[144 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[154 chars];
+    "-------------------------------------------------------------"+[159 chars];
+    "-------------------------------------------------------------"+[164 chars];
+    "-------------------------------------------------------------"+[169 chars];
+    "-------------------------------------------------------------"+[174 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[184 chars]]
+   [""; "------"; "------------"; "------------------";
+    "------------------------"; "------------------------------";
+    "------------------------------------";
+    "------------------------------------------";
+    "------------------------------------------------";
+    "------------------------------------------------------";
+    "------------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[41 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[53 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[71 chars];
+    "-------------------------------------------------------------"+[77 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[89 chars];
+    "-------------------------------------------------------------"+[95 chars];
+    "-------------------------------------------------------------"+[101 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[113 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[125 chars];
+    "-------------------------------------------------------------"+[131 chars];
+    "-------------------------------------------------------------"+[137 chars];
+    "-------------------------------------------------------------"+[143 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[155 chars];
+    "-------------------------------------------------------------"+[161 chars];
+    "-------------------------------------------------------------"+[167 chars];
+    "-------------------------------------------------------------"+[173 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[185 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[197 chars];
+    "-------------------------------------------------------------"+[203 chars];
+    "-------------------------------------------------------------"+[209 chars];
+    "-------------------------------------------------------------"+[215 chars];
+    "-------------------------------------------------------------"+[221 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[233 chars]]
+   [""; "-------"; "--------------"; "---------------------";
+    "----------------------------"; "-----------------------------------";
+    "------------------------------------------";
+    "-------------------------------------------------";
+    "--------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[58 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[72 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[86 chars];
+    "-------------------------------------------------------------"+[93 chars];
+    "-------------------------------------------------------------"+[100 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[114 chars];
+    "-------------------------------------------------------------"+[121 chars];
+    "-------------------------------------------------------------"+[128 chars];
+    "-------------------------------------------------------------"+[135 chars];
+    "-------------------------------------------------------------"+[142 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[156 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[170 chars];
+    "-------------------------------------------------------------"+[177 chars];
+    "-------------------------------------------------------------"+[184 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[198 chars];
+    "-------------------------------------------------------------"+[205 chars];
+    "-------------------------------------------------------------"+[212 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[226 chars];
+    "-------------------------------------------------------------"+[233 chars];
+    "-------------------------------------------------------------"+[240 chars];
+    "-------------------------------------------------------------"+[247 chars];
+    "-------------------------------------------------------------"+[254 chars];
+    "-------------------------------------------------------------"+[261 chars];
+    "-------------------------------------------------------------"+[268 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[282 chars]]
+   [""; "--------"; "----------------"; "------------------------";
+    "--------------------------------";
+    "----------------------------------------";
+    "------------------------------------------------";
+    "--------------------------------------------------------";
+    "----------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[43 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[67 chars];
+    "-------------------------------------------------------------"+[75 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[91 chars];
+    "-------------------------------------------------------------"+[99 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[115 chars];
+    "-------------------------------------------------------------"+[123 chars];
+    "-------------------------------------------------------------"+[131 chars];
+    "-------------------------------------------------------------"+[139 chars];
+    "-------------------------------------------------------------"+[147 chars];
+    "-------------------------------------------------------------"+[155 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[171 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[187 chars];
+    "-------------------------------------------------------------"+[195 chars];
+    "-------------------------------------------------------------"+[203 chars];
+    "-------------------------------------------------------------"+[211 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[235 chars];
+    "-------------------------------------------------------------"+[243 chars];
+    "-------------------------------------------------------------"+[251 chars];
+    "-------------------------------------------------------------"+[259 chars];
+    "-------------------------------------------------------------"+[267 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[283 chars];
+    "-------------------------------------------------------------"+[291 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[307 chars];
+    "-------------------------------------------------------------"+[315 chars];
+    "-------------------------------------------------------------"+[323 chars];
+    "-------------------------------------------------------------"+[331 chars]]
+   [""; "---------"; "------------------"; "---------------------------";
+    "------------------------------------";
+    "---------------------------------------------";
+    "------------------------------------------------------";
+    "---------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[20 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[38 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[56 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[74 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[92 chars];
+    "-------------------------------------------------------------"+[101 chars];
+    "-------------------------------------------------------------"+[110 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[128 chars];
+    "-------------------------------------------------------------"+[137 chars];
+    "-------------------------------------------------------------"+[146 chars];
+    "-------------------------------------------------------------"+[155 chars];
+    "-------------------------------------------------------------"+[164 chars];
+    "-------------------------------------------------------------"+[173 chars];
+    "-------------------------------------------------------------"+[182 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[200 chars];
+    "-------------------------------------------------------------"+[209 chars];
+    "-------------------------------------------------------------"+[218 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[236 chars];
+    "-------------------------------------------------------------"+[245 chars];
+    "-------------------------------------------------------------"+[254 chars];
+    "-------------------------------------------------------------"+[263 chars];
+    "-------------------------------------------------------------"+[272 chars];
+    "-------------------------------------------------------------"+[281 chars];
+    "-------------------------------------------------------------"+[290 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[308 chars];
+    "-------------------------------------------------------------"+[317 chars];
+    "-------------------------------------------------------------"+[326 chars];
+    "-------------------------------------------------------------"+[335 chars];
+    "-------------------------------------------------------------"+[344 chars];
+    "-------------------------------------------------------------"+[353 chars];
+    "-------------------------------------------------------------"+[362 chars];
+    "-------------------------------------------------------------"+[371 chars];
+    "-------------------------------------------------------------"+[380 chars]]
+   [""; "----------"; "--------------------"; "------------------------------";
+    "----------------------------------------";
+    "--------------------------------------------------";
+    "------------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[39 chars];
+    "-------------------------------------------------------------"+[49 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[69 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[89 chars];
+    "-------------------------------------------------------------"+[99 chars];
+    "-------------------------------------------------------------"+[109 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[129 chars];
+    "-------------------------------------------------------------"+[139 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[159 chars];
+    "-------------------------------------------------------------"+[169 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[189 chars];
+    "-------------------------------------------------------------"+[199 chars];
+    "-------------------------------------------------------------"+[209 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[229 chars];
+    "-------------------------------------------------------------"+[239 chars];
+    "-------------------------------------------------------------"+[249 chars];
+    "-------------------------------------------------------------"+[259 chars];
+    "-------------------------------------------------------------"+[269 chars];
+    "-------------------------------------------------------------"+[279 chars];
+    "-------------------------------------------------------------"+[289 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[309 chars];
+    "-------------------------------------------------------------"+[319 chars];
+    "-------------------------------------------------------------"+[329 chars];
+    "-------------------------------------------------------------"+[339 chars];
+    "-------------------------------------------------------------"+[349 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[369 chars];
+    "-------------------------------------------------------------"+[379 chars];
+    "-------------------------------------------------------------"+[389 chars];
+    "-------------------------------------------------------------"+[399 chars];
+    "-------------------------------------------------------------"+[409 chars];
+    "-------------------------------------------------------------"+[419 chars];
+    "-------------------------------------------------------------"+[429 chars]]
+   [""; "-----------"; "----------------------";
+    "---------------------------------";
+    "--------------------------------------------";
+    "-------------------------------------------------------";
+    "------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[16 chars];
+    "-------------------------------------------------------------"+[27 chars];
+    "-------------------------------------------------------------"+[38 chars];
+    "-------------------------------------------------------------"+[49 chars];
+    "-------------------------------------------------------------"+[60 chars];
+    "-------------------------------------------------------------"+[71 chars];
+    "-------------------------------------------------------------"+[82 chars];
+    "-------------------------------------------------------------"+[93 chars];
+    "-------------------------------------------------------------"+[104 chars];
+    "-------------------------------------------------------------"+[115 chars];
+    "-------------------------------------------------------------"+[126 chars];
+    "-------------------------------------------------------------"+[137 chars];
+    "-------------------------------------------------------------"+[148 chars];
+    "-------------------------------------------------------------"+[159 chars];
+    "-------------------------------------------------------------"+[170 chars];
+    "-------------------------------------------------------------"+[181 chars];
+    "-------------------------------------------------------------"+[192 chars];
+    "-------------------------------------------------------------"+[203 chars];
+    "-------------------------------------------------------------"+[214 chars];
+    "-------------------------------------------------------------"+[225 chars];
+    "-------------------------------------------------------------"+[236 chars];
+    "-------------------------------------------------------------"+[247 chars];
+    "-------------------------------------------------------------"+[258 chars];
+    "-------------------------------------------------------------"+[269 chars];
+    "-------------------------------------------------------------"+[280 chars];
+    "-------------------------------------------------------------"+[291 chars];
+    "-------------------------------------------------------------"+[302 chars];
+    "-------------------------------------------------------------"+[313 chars];
+    "-------------------------------------------------------------"+[324 chars];
+    "-------------------------------------------------------------"+[335 chars];
+    "-------------------------------------------------------------"+[346 chars];
+    "-------------------------------------------------------------"+[357 chars];
+    "-------------------------------------------------------------"+[368 chars];
+    "-------------------------------------------------------------"+[379 chars];
+    "-------------------------------------------------------------"+[390 chars];
+    "-------------------------------------------------------------"+[401 chars];
+    "-------------------------------------------------------------"+[412 chars];
+    "-------------------------------------------------------------"+[423 chars];
+    "-------------------------------------------------------------"+[434 chars];
+    "-------------------------------------------------------------"+[445 chars];
+    "-------------------------------------------------------------"+[456 chars];
+    "-------------------------------------------------------------"+[467 chars];
+    "-------------------------------------------------------------"+[478 chars]]
+   [""; "------------"; "------------------------";
+    "------------------------------------";
+    "------------------------------------------------";
+    "------------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[71 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[95 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[131 chars];
+    "-------------------------------------------------------------"+[143 chars];
+    "-------------------------------------------------------------"+[155 chars];
+    "-------------------------------------------------------------"+[167 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[203 chars];
+    "-------------------------------------------------------------"+[215 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[239 chars];
+    "-------------------------------------------------------------"+[251 chars];
+    "-------------------------------------------------------------"+[263 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[287 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[311 chars];
+    "-------------------------------------------------------------"+[323 chars];
+    "-------------------------------------------------------------"+[335 chars];
+    "-------------------------------------------------------------"+[347 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[371 chars];
+    "-------------------------------------------------------------"+[383 chars];
+    "-------------------------------------------------------------"+[395 chars];
+    "-------------------------------------------------------------"+[407 chars];
+    "-------------------------------------------------------------"+[419 chars];
+    "-------------------------------------------------------------"+[431 chars];
+    "-------------------------------------------------------------"+[443 chars];
+    "-------------------------------------------------------------"+[455 chars];
+    "-------------------------------------------------------------"+[467 chars];
+    "-------------------------------------------------------------"+[479 chars];
+    "-------------------------------------------------------------"+[491 chars];
+    "-------------------------------------------------------------"+[503 chars];
+    "-------------------------------------------------------------"+[515 chars];
+    "-------------------------------------------------------------"+[527 chars]]
+   [""; "-------------"; "--------------------------";
+    "---------------------------------------";
+    "----------------------------------------------------";
+    "-----------------------------------------------------------------";
+    "-------------------------------------------------------------"+[17 chars];
+    "-------------------------------------------------------------"+[30 chars];
+    "-------------------------------------------------------------"+[43 chars];
+    "-------------------------------------------------------------"+[56 chars];
+    "-------------------------------------------------------------"+[69 chars];
+    "-------------------------------------------------------------"+[82 chars];
+    "-------------------------------------------------------------"+[95 chars];
+    "-------------------------------------------------------------"+[108 chars];
+    "-------------------------------------------------------------"+[121 chars];
+    "-------------------------------------------------------------"+[134 chars];
+    "-------------------------------------------------------------"+[147 chars];
+    "-------------------------------------------------------------"+[160 chars];
+    "-------------------------------------------------------------"+[173 chars];
+    "-------------------------------------------------------------"+[186 chars];
+    "-------------------------------------------------------------"+[199 chars];
+    "-------------------------------------------------------------"+[212 chars];
+    "-------------------------------------------------------------"+[225 chars];
+    "-------------------------------------------------------------"+[238 chars];
+    "-------------------------------------------------------------"+[251 chars];
+    "-------------------------------------------------------------"+[264 chars];
+    "-------------------------------------------------------------"+[277 chars];
+    "-------------------------------------------------------------"+[290 chars];
+    "-------------------------------------------------------------"+[303 chars];
+    "-------------------------------------------------------------"+[316 chars];
+    "-------------------------------------------------------------"+[329 chars];
+    "-------------------------------------------------------------"+[342 chars];
+    "-------------------------------------------------------------"+[355 chars];
+    "-------------------------------------------------------------"+[368 chars];
+    "-------------------------------------------------------------"+[381 chars];
+    "-------------------------------------------------------------"+[394 chars];
+    "-------------------------------------------------------------"+[407 chars];
+    "-------------------------------------------------------------"+[420 chars];
+    "-------------------------------------------------------------"+[433 chars];
+    "-------------------------------------------------------------"+[446 chars];
+    "-------------------------------------------------------------"+[459 chars];
+    "-------------------------------------------------------------"+[472 chars];
+    "-------------------------------------------------------------"+[485 chars];
+    "-------------------------------------------------------------"+[498 chars];
+    "-------------------------------------------------------------"+[511 chars];
+    "-------------------------------------------------------------"+[524 chars];
+    "-------------------------------------------------------------"+[537 chars];
+    "-------------------------------------------------------------"+[550 chars];
+    "-------------------------------------------------------------"+[563 chars];
+    "-------------------------------------------------------------"+[576 chars]]
+   [""; "--------------"; "----------------------------";
+    "------------------------------------------";
+    "--------------------------------------------------------";
+    "----------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[23 chars];
+    "-------------------------------------------------------------"+[37 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[79 chars];
+    "-------------------------------------------------------------"+[93 chars];
+    "-------------------------------------------------------------"+[107 chars];
+    "-------------------------------------------------------------"+[121 chars];
+    "-------------------------------------------------------------"+[135 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[177 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[205 chars];
+    "-------------------------------------------------------------"+[219 chars];
+    "-------------------------------------------------------------"+[233 chars];
+    "-------------------------------------------------------------"+[247 chars];
+    "-------------------------------------------------------------"+[261 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[289 chars];
+    "-------------------------------------------------------------"+[303 chars];
+    "-------------------------------------------------------------"+[317 chars];
+    "-------------------------------------------------------------"+[331 chars];
+    "-------------------------------------------------------------"+[345 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[373 chars];
+    "-------------------------------------------------------------"+[387 chars];
+    "-------------------------------------------------------------"+[401 chars];
+    "-------------------------------------------------------------"+[415 chars];
+    "-------------------------------------------------------------"+[429 chars];
+    "-------------------------------------------------------------"+[443 chars];
+    "-------------------------------------------------------------"+[457 chars];
+    "-------------------------------------------------------------"+[471 chars];
+    "-------------------------------------------------------------"+[485 chars];
+    "-------------------------------------------------------------"+[499 chars];
+    "-------------------------------------------------------------"+[513 chars];
+    "-------------------------------------------------------------"+[527 chars];
+    "-------------------------------------------------------------"+[541 chars];
+    "-------------------------------------------------------------"+[555 chars];
+    "-------------------------------------------------------------"+[569 chars];
+    "-------------------------------------------------------------"+[583 chars];
+    "-------------------------------------------------------------"+[597 chars];
+    "-------------------------------------------------------------"+[611 chars];
+    "-------------------------------------------------------------"+[625 chars]]
+   [""; "---------------"; "------------------------------";
+    "---------------------------------------------";
+    "------------------------------------------------------------";
+    "-------------------------------------------------------------"+[14 chars];
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[44 chars];
+    "-------------------------------------------------------------"+[59 chars];
+    "-------------------------------------------------------------"+[74 chars];
+    "-------------------------------------------------------------"+[89 chars];
+    "-------------------------------------------------------------"+[104 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[134 chars];
+    "-------------------------------------------------------------"+[149 chars];
+    "-------------------------------------------------------------"+[164 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[194 chars];
+    "-------------------------------------------------------------"+[209 chars];
+    "-------------------------------------------------------------"+[224 chars];
+    "-------------------------------------------------------------"+[239 chars];
+    "-------------------------------------------------------------"+[254 chars];
+    "-------------------------------------------------------------"+[269 chars];
+    "-------------------------------------------------------------"+[284 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[314 chars];
+    "-------------------------------------------------------------"+[329 chars];
+    "-------------------------------------------------------------"+[344 chars];
+    "-------------------------------------------------------------"+[359 chars];
+    "-------------------------------------------------------------"+[374 chars];
+    "-------------------------------------------------------------"+[389 chars];
+    "-------------------------------------------------------------"+[404 chars];
+    "-------------------------------------------------------------"+[419 chars];
+    "-------------------------------------------------------------"+[434 chars];
+    "-------------------------------------------------------------"+[449 chars];
+    "-------------------------------------------------------------"+[464 chars];
+    "-------------------------------------------------------------"+[479 chars];
+    "-------------------------------------------------------------"+[494 chars];
+    "-------------------------------------------------------------"+[509 chars];
+    "-------------------------------------------------------------"+[524 chars];
+    "-------------------------------------------------------------"+[539 chars];
+    "-------------------------------------------------------------"+[554 chars];
+    "-------------------------------------------------------------"+[569 chars];
+    "-------------------------------------------------------------"+[584 chars];
+    "-------------------------------------------------------------"+[599 chars];
+    "-------------------------------------------------------------"+[614 chars];
+    "-------------------------------------------------------------"+[629 chars];
+    "-------------------------------------------------------------"+[644 chars];
+    "-------------------------------------------------------------"+[659 chars];
+    "-------------------------------------------------------------"+[674 chars]]
+   [""; "----------------"; "--------------------------------";
+    "------------------------------------------------";
+    "----------------------------------------------------------------";
+    "-------------------------------------------------------------"+[19 chars];
+    "-------------------------------------------------------------"+[35 chars];
+    "-------------------------------------------------------------"+[51 chars];
+    "-------------------------------------------------------------"+[67 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[99 chars];
+    "-------------------------------------------------------------"+[115 chars];
+    "-------------------------------------------------------------"+[131 chars];
+    "-------------------------------------------------------------"+[147 chars];
+    "-------------------------------------------------------------"+[163 chars];
+    "-------------------------------------------------------------"+[179 chars];
+    "-------------------------------------------------------------"+[195 chars];
+    "-------------------------------------------------------------"+[211 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[243 chars];
+    "-------------------------------------------------------------"+[259 chars];
+    "-------------------------------------------------------------"+[275 chars];
+    "-------------------------------------------------------------"+[291 chars];
+    "-------------------------------------------------------------"+[307 chars];
+    "-------------------------------------------------------------"+[323 chars];
+    "-------------------------------------------------------------"+[339 chars];
+    "-------------------------------------------------------------"+[355 chars];
+    "-------------------------------------------------------------"+[371 chars];
+    "-------------------------------------------------------------"+[387 chars];
+    "-------------------------------------------------------------"+[403 chars];
+    "-------------------------------------------------------------"+[419 chars];
+    "-------------------------------------------------------------"+[435 chars];
+    "-------------------------------------------------------------"+[451 chars];
+    "-------------------------------------------------------------"+[467 chars];
+    "-------------------------------------------------------------"+[483 chars];
+    "-------------------------------------------------------------"+[499 chars];
+    "-------------------------------------------------------------"+[515 chars];
+    "-------------------------------------------------------------"+[531 chars];
+    "-------------------------------------------------------------"+[547 chars];
+    "-------------------------------------------------------------"+[563 chars];
+    "-------------------------------------------------------------"+[579 chars];
+    "-------------------------------------------------------------"+[595 chars];
+    "-------------------------------------------------------------"+[611 chars];
+    "-------------------------------------------------------------"+[627 chars];
+    "-------------------------------------------------------------"+[643 chars];
+    "-------------------------------------------------------------"+[659 chars];
+    "-------------------------------------------------------------"+[675 chars];
+    "-------------------------------------------------------------"+[691 chars];
+    "-------------------------------------------------------------"+[707 chars];
+    "-------------------------------------------------------------"+[723 chars]]
+   [""; "-----------------"; "----------------------------------";
+    "---------------------------------------------------";
+    "--------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[24 chars];
+    "-------------------------------------------------------------"+[41 chars];
+    "-------------------------------------------------------------"+[58 chars];
+    "-------------------------------------------------------------"+[75 chars];
+    "-------------------------------------------------------------"+[92 chars];
+    "-------------------------------------------------------------"+[109 chars];
+    "-------------------------------------------------------------"+[126 chars];
+    "-------------------------------------------------------------"+[143 chars];
+    "-------------------------------------------------------------"+[160 chars];
+    "-------------------------------------------------------------"+[177 chars];
+    "-------------------------------------------------------------"+[194 chars];
+    "-------------------------------------------------------------"+[211 chars];
+    "-------------------------------------------------------------"+[228 chars];
+    "-------------------------------------------------------------"+[245 chars];
+    "-------------------------------------------------------------"+[262 chars];
+    "-------------------------------------------------------------"+[279 chars];
+    "-------------------------------------------------------------"+[296 chars];
+    "-------------------------------------------------------------"+[313 chars];
+    "-------------------------------------------------------------"+[330 chars];
+    "-------------------------------------------------------------"+[347 chars];
+    "-------------------------------------------------------------"+[364 chars];
+    "-------------------------------------------------------------"+[381 chars];
+    "-------------------------------------------------------------"+[398 chars];
+    "-------------------------------------------------------------"+[415 chars];
+    "-------------------------------------------------------------"+[432 chars];
+    "-------------------------------------------------------------"+[449 chars];
+    "-------------------------------------------------------------"+[466 chars];
+    "-------------------------------------------------------------"+[483 chars];
+    "-------------------------------------------------------------"+[500 chars];
+    "-------------------------------------------------------------"+[517 chars];
+    "-------------------------------------------------------------"+[534 chars];
+    "-------------------------------------------------------------"+[551 chars];
+    "-------------------------------------------------------------"+[568 chars];
+    "-------------------------------------------------------------"+[585 chars];
+    "-------------------------------------------------------------"+[602 chars];
+    "-------------------------------------------------------------"+[619 chars];
+    "-------------------------------------------------------------"+[636 chars];
+    "-------------------------------------------------------------"+[653 chars];
+    "-------------------------------------------------------------"+[670 chars];
+    "-------------------------------------------------------------"+[687 chars];
+    "-------------------------------------------------------------"+[704 chars];
+    "-------------------------------------------------------------"+[721 chars];
+    "-------------------------------------------------------------"+[738 chars];
+    "-------------------------------------------------------------"+[755 chars];
+    "-------------------------------------------------------------"+[772 chars]]
+   [""; "------------------"; "------------------------------------";
+    "------------------------------------------------------";
+    "------------------------------------------------------------------------";
+    "-------------------------------------------------------------"+[29 chars];
+    "-------------------------------------------------------------"+[47 chars];
+    "-------------------------------------------------------------"+[65 chars];
+    "-------------------------------------------------------------"+[83 chars];
+    "-------------------------------------------------------------"+[101 chars];
+    "-------------------------------------------------------------"+[119 chars];
+    "-------------------------------------------------------------"+[137 chars];
+    "-------------------------------------------------------------"+[155 chars];
+    "-------------------------------------------------------------"+[173 chars];
+    "-------------------------------------------------------------"+[191 chars];
+    "-------------------------------------------------------------"+[209 chars];
+    "-------------------------------------------------------------"+[227 chars];
+    "-------------------------------------------------------------"+[245 chars];
+    "-------------------------------------------------------------"+[263 chars];
+    "-------------------------------------------------------------"+[281 chars];
+    "-------------------------------------------------------------"+[299 chars];
+    "-------------------------------------------------------------"+[317 chars];
+    "-------------------------------------------------------------"+[335 chars];
+    "-------------------------------------------------------------"+[353 chars];
+    "-------------------------------------------------------------"+[371 chars];
+    "-------------------------------------------------------------"+[389 chars];
+    "-------------------------------------------------------------"+[407 chars];
+    "-------------------------------------------------------------"+[425 chars];
+    "-------------------------------------------------------------"+[443 chars];
+    "-------------------------------------------------------------"+[461 chars];
+    "-------------------------------------------------------------"+[479 chars];
+    "-------------------------------------------------------------"+[497 chars];
+    "-------------------------------------------------------------"+[515 chars];
+    "-------------------------------------------------------------"+[533 chars];
+    "-------------------------------------------------------------"+[551 chars];
+    "-------------------------------------------------------------"+[569 chars];
+    "-------------------------------------------------------------"+[587 chars];
+    "-------------------------------------------------------------"+[605 chars];
+    "-------------------------------------------------------------"+[623 chars];
+    "-------------------------------------------------------------"+[641 chars];
+    "-------------------------------------------------------------"+[659 chars];
+    "-------------------------------------------------------------"+[677 chars];
+    "-------------------------------------------------------------"+[695 chars];
+    "-------------------------------------------------------------"+[713 chars];
+    "-------------------------------------------------------------"+[731 chars];
+    "-------------------------------------------------------------"+[749 chars];
+    "-------------------------------------------------------------"+[767 chars];
+    "-------------------------------------------------------------"+[785 chars];
+    "-------------------------------------------------------------"+[803 chars];
+    "-------------------------------------------------------------"+[821 chars]]
+   [""; "-------------------"; "--------------------------------------";
+    "---------------------------------------------------------";
+    "-------------------------------------------------------------"+[15 chars];
+    "-------------------------------------------------------------"+[34 chars];
+    "-------------------------------------------------------------"+[53 chars];
+    "-------------------------------------------------------------"+[72 chars];
+    "-------------------------------------------------------------"+[91 chars];
+    "-------------------------------------------------------------"+[110 chars];
+    "-------------------------------------------------------------"+[129 chars];
+    "-------------------------------------------------------------"+[148 chars];
+    "-------------------------------------------------------------"+[167 chars];
+    "-------------------------------------------------------------"+[186 chars];
+    "-------------------------------------------------------------"+[205 chars];
+    "-------------------------------------------------------------"+[224 chars];
+    "-------------------------------------------------------------"+[243 chars];
+    "-------------------------------------------------------------"+[262 chars];
+    "-------------------------------------------------------------"+[281 chars];
+    "-------------------------------------------------------------"+[300 chars];
+    "-------------------------------------------------------------"+[319 chars];
+    "-------------------------------------------------------------"+[338 chars];
+    "-------------------------------------------------------------"+[357 chars];
+    "-------------------------------------------------------------"+[376 chars];
+    "-------------------------------------------------------------"+[395 chars];
+    "-------------------------------------------------------------"+[414 chars];
+    "-------------------------------------------------------------"+[433 chars];
+    "-------------------------------------------------------------"+[452 chars];
+    "-------------------------------------------------------------"+[471 chars];
+    "-------------------------------------------------------------"+[490 chars];
+    "-------------------------------------------------------------"+[509 chars];
+    "-------------------------------------------------------------"+[528 chars];
+    "-------------------------------------------------------------"+[547 chars];
+    "-------------------------------------------------------------"+[566 chars];
+    "-------------------------------------------------------------"+[585 chars];
+    "-------------------------------------------------------------"+[604 chars];
+    "-------------------------------------------------------------"+[623 chars];
+    "-------------------------------------------------------------"+[642 chars];
+    "-------------------------------------------------------------"+[661 chars];
+    "-------------------------------------------------------------"+[680 chars];
+    "-------------------------------------------------------------"+[699 chars];
+    "-------------------------------------------------------------"+[718 chars];
+    "-------------------------------------------------------------"+[737 chars];
+    "-------------------------------------------------------------"+[756 chars];
+    "-------------------------------------------------------------"+[775 chars];
+    "-------------------------------------------------------------"+[794 chars];
+    "-------------------------------------------------------------"+[813 chars];
+    "-------------------------------------------------------------"+[832 chars];
+    "-------------------------------------------------------------"+[851 chars];
+    "-------------------------------------------------------------"+[870 chars];
+    ...]
+   ...]
+
+> 
+type tree =
+  | L
+  | N of tree list
+val mkT : w:int -> d:int -> tree
+val tree : w:int -> d:int -> tree
+
+> [Building 2 4...done]
+
+val tree_2_4 : tree =
+  N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+     N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]
+
+> [Building 2 6...done]
+
+val tree_2_6 : tree =
+  N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+        N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+     N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+        N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+           N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]
+
+> [Building 2 8...done]
+
+val tree_2_8 : tree =
+  N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+           N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+        N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+           N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]];
+     N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+           N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+        N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+           N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+              N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                 N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]]]
+
+> [Building 2 10...done]
+
+val tree_2_10 : tree =
+  N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+              N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]];
+           N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+              N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]]];
+        N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+              N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]];
+           N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+              N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                 N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                       N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                    N [N [N [N [L; L]; N ...; ...]; ...]; ...]; ...]; ...];
+              ...]; ...]; ...]; ...]
+
+> [Building 2 12...done]
+
+val tree_2_12 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+                    N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]];
+                 N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+                    N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]]];
+              N [N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+                    N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]]];
+                 N [N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]]];
+                    N [N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]]];
+                       N [N [N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]];
+                             N [N [N [L; L]; N [L; L]]; N [N [L; L]; N [L; L]]]];
+                          N [N [N [N [L; ...]; ...]; ...]; ...]; ...]; ...];
+                    ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 2 14...done]
+
+val tree_2_14 : tree =
+  N [N [N [N [N [N [N [N [N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]];
+                          N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]]];
+                       N [N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]];
+                          N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]]]];
+                    N [N [N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]];
+                          N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]]];
+                       N [N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]]];
+                          N [N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]]];
+                             N [N [N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]];
+                                   N [N [N [L; L]; N [L; L]];
+                                      N [N [L; L]; N [L; L]]]];
+                                N [N [N ...; ...]; ...]; ...]; ...]; ...]; ...];
+                    ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 3 8...done]
+
+val tree_3_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]]];
+           N [N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]]];
+           N [N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]];
+                 N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; L; L]]]];
+              N [N [N [N [L; L; L]; N [L; L; L]; N [L; L; L]];
+                    N [N [L; L; L]; N [L; L; L]; N [L; ...]; ...]; ...]; ...];
+              ...]; ...]; ...]; ...]
+
+> [Building 4 8...done]
+
+val tree_4_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]]];
+              N [N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]]];
+              N [N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]]];
+                 N [N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; L];
+                       N [L; L; L; L]];
+                    N [N [L; L; L; L]; N [L; L; L; L]; N [L; L; L; ...]; ...];
+                    ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 5 8...done]
+
+val tree_5_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]]];
+              N [N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N [L; L; L; L; L]];
+                    N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+                       N [L; L; L; L; L]; N ...; ...]; ...]; ...]; ...]; ...];
+        ...]; ...]
+
+> [Building 6 8...done]
+
+val tree_6_8 : tree =
+  N [N [N [N [N [N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]]];
+                 N [N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L];
+                       N [L; L; L; L; L; L]; N [L; L; L; L; L; L]];
+                    N [N ...; ...]; ...]; ...]; ...]; ...]; ...]; ...]
+
+> [Building 5 3...done]
+
+val tree_5_3 : tree =
+  N [N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]];
+     N [N [L; L; L; L; L]; N [L; L; L; L; L]; N [L; L; L; L; L];
+        N [L; L; L; L; L]; N [L; L; L; L; L]]]
+
+> > 
+type X =
+  | Var of int
+  | Bop of int * X * X
+val generate : x:int -> X
+
+> 
+val exps : X list =
+  [Bop (1,Var 0,Var 0); Var 2; Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0));
+   Var 4; Bop (5,Var 2,Bop (1,Var 0,Var 0)); Var 6;
+   Bop (7,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)),Var 2); Var 8;
+   Bop (9,Var 4,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0))); Var 10;
+   Bop
+     (213,Var 106,
+      Bop
+        (71,
+         Bop
+           (35,Bop (17,Var 8,Bop (5,Var 2,Bop (1,Var 0,Var 0))),
+            Bop
+              (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+               Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)))),
+         Bop
+           (23,
+            Bop
+              (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+               Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0))),
+            Bop (7,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)),Var 2))));
+   Var 21342314; Var 3214; Bop (1231357,Var 615678,Var 410452);
+   Bop
+     (5234547,Bop (2617273,Var 1308636,Var 872424),
+      Bop (1744849,Var 872424,Var 581616));
+   Bop (923759825,Var 461879912,Bop (307919941,Var 153959970,Var 102639980));
+   Var 2435234;
+   Bop
+     (12396777,Var 6198388,
+      Bop
+        (4132259,
+         Bop
+           (2066129,Var 1033064,
+            Bop
+              (688709,Var 344354,
+               Bop
+                 (229569,Var 114784,
+                  Bop
+                    (76523,
+                     Bop
+                       (38261,Var 19130,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472)))),
+                     Bop
+                       (25507,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472))),Var 8502))))),
+         Bop
+           (1377419,
+            Bop
+              (688709,Var 344354,
+               Bop
+                 (229569,Var 114784,
+                  Bop
+                    (76523,
+                     Bop
+                       (38261,Var 19130,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472)))),
+                     Bop
+                       (25507,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472))),Var 8502)))),
+            Bop
+              (459139,
+               Bop
+                 (229569,Var 114784,
+                  Bop
+                    (76523,
+                     Bop
+                       (38261,Var 19130,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472)))),
+                     Bop
+                       (25507,
+                        Bop
+                          (12753,Var 6376,
+                           Bop
+                             (4251,Bop (2125,Var 1062,Var 708),
+                              Bop (1417,Var 708,Var 472))),Var 8502))),
+               Var 153046))));
+   Bop
+     (3333333,Var 1666666,
+      Bop
+        (1111111,
+         Bop
+           (555555,Bop (277777,Var 138888,Var 92592),
+            Bop (185185,Var 92592,Var 61728)),Var 370370));
+   Bop
+     (1312311237,Var 656155618,
+      Bop
+        (437437079,
+         Bop
+           (218718539,
+            Bop
+              (109359269,Var 54679634,
+               Bop
+                 (36453089,Var 18226544,
+                  Bop
+                    (12151029,Var 6075514,
+                     Bop
+                       (4050343,
+                        Bop
+                          (2025171,Bop (1012585,Var 506292,Var 337528),
+                           Bop
+                             (675057,Var 337528,
+                              Bop
+                                (225019,
+                                 Bop
+                                   (112509,Var 56254,
+                                    Bop
+                                      (37503,
+                                       Bop
+                                         (18751,
+                                          Bop
+                                            (9375,
+                                             Bop
+                                               (4687,
+                                                Bop
+                                                  (2343,
+                                                   Bop
+                                                     (1171,
+                                                      Bop
+                                                        (585,Var 292,
+                                                         Bop
+                                                           (195,
+                                                            Bop
+                                                              (97,Var 48,
+                                                               Var 32),
+                                                            Bop
+                                                              (65,Var 32,
+                                                               Bop
+                                                                 (21,Var 10,
+                                                                  Bop
+                                                                    (7,
+                                                                     Bop
+                                                                       (3,
+                                                                        Bop
+                                                                          (1,
+                                                                           Var
+                                                                             0,
+                                                                           Var
+                                                                             0),
+                                                                        Bop
+                                                                          (1,
+                                                                           Var
+                                                                             0,
+                                                                           Var
+                                                                             0)),
+                                                                     Var 2))))),
+                                                      Var 390),
+                                                   Bop (781,Var 390,Var 260)),
+                                                Var 1562),
+                                             Bop
+                                               (3125,Var 1562,
+                                                Bop
+                                                  (1041,Var 520,
+                                                   Bop
+                                                     (347,
+                                                      Bop
+                                                        (173,Var 86,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6))),
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38))))),
+                                          Var 6250),
+                                       Bop
+                                         (12501,Var 6250,
+                                          Bop
+                                            (4167,
+                                             Bop
+                                               (2083,
+                                                Bop
+                                                  (1041,Var 520,
+                                                   Bop
+                                                     (347,
+                                                      Bop
+                                                        (173,Var 86,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6))),
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38))),
+                                                Var 694),
+                                             Bop
+                                               (1389,Var 694,
+                                                Bop
+                                                  (463,
+                                                   Bop
+                                                     (231,
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38),
+                                                      Bop
+                                                        (77,Var 38,
+                                                         Bop (25,Var 12,Var 8))),
+                                                   Var 154)))))),Var 75006))),
+                        Var 1350114)))),
+            Bop
+              (72906179,
+               Bop
+                 (36453089,Var 18226544,
+                  Bop
+                    (12151029,Var 6075514,
+                     Bop
+                       (4050343,
+                        Bop
+                          (2025171,Bop (1012585,Var 506292,Var 337528),
+                           Bop
+                             (675057,Var 337528,
+                              Bop
+                                (225019,
+                                 Bop
+                                   (112509,Var 56254,
+                                    Bop
+                                      (37503,
+                                       Bop
+                                         (18751,
+                                          Bop
+                                            (9375,
+                                             Bop
+                                               (4687,
+                                                Bop
+                                                  (2343,
+                                                   Bop
+                                                     (1171,
+                                                      Bop
+                                                        (585,Var 292,
+                                                         Bop
+                                                           (195,
+                                                            Bop
+                                                              (97,Var 48,
+                                                               Var 32),
+                                                            Bop
+                                                              (65,Var 32,
+                                                               Bop
+                                                                 (21,Var 10,
+                                                                  Bop
+                                                                    (7,
+                                                                     Bop
+                                                                       (3,
+                                                                        Bop
+                                                                          (1,
+                                                                           Var
+                                                                             0,
+                                                                           Var
+                                                                             0),
+                                                                        Bop
+                                                                          (1,
+                                                                           Var
+                                                                             0,
+                                                                           Var
+                                                                             0)),
+                                                                     Var 2))))),
+                                                      Var 390),
+                                                   Bop (781,Var 390,Var 260)),
+                                                Var 1562),
+                                             Bop
+                                               (3125,Var 1562,
+                                                Bop
+                                                  (1041,Var 520,
+                                                   Bop
+                                                     (347,
+                                                      Bop
+                                                        (173,Var 86,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6))),
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38))))),
+                                          Var 6250),
+                                       Bop
+                                         (12501,Var 6250,
+                                          Bop
+                                            (4167,
+                                             Bop
+                                               (2083,
+                                                Bop
+                                                  (1041,Var 520,
+                                                   Bop
+                                                     (347,
+                                                      Bop
+                                                        (173,Var 86,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6))),
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38))),
+                                                Var 694),
+                                             Bop
+                                               (1389,Var 694,
+                                                Bop
+                                                  (463,
+                                                   Bop
+                                                     (231,
+                                                      Bop
+                                                        (115,
+                                                         Bop
+                                                           (57,Var 28,
+                                                            Bop
+                                                              (19,
+                                                               Bop
+                                                                 (9,Var 4,
+                                                                  Bop
+                                                                    (3,
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0),
+                                                                     Bop
+                                                                       (1,
+                                                                        Var 0,
+                                                                        Var 0))),
+                                                               Var 6)),Var 38),
+                                                      Bop
+                                                        (77,Var 38,
+                                                         Bop (25,Var 12,Var 8))),
+                                                   Var 154)))))),Var 75006))),
+                        Var 1350114))),
+               Bop (24302059,Bop (12151029,...,...),...))),...)); ...]
+
+> 
+module Exprs = begin
+  val x1 : X =
+    Bop
+      (213,Var 106,
+       Bop
+         (71,
+          Bop
+            (35,Bop (17,Var 8,Bop (5,Var 2,Bop (1,Var 0,Var 0))),
+             Bop
+               (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+                Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)))),
+          Bop
+            (23,
+             Bop
+               (11,Bop (5,Var 2,Bop (1,Var 0,Var 0)),
+                Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0))),
+             Bop (7,Bop (3,Bop (1,Var 0,Var 0),Bop (1,Var 0,Var 0)),Var 2))))
+  val x2 : X = Var 21342314
+  val x3 : X = Var 3214
+  val x4 : X = Bop (1231357,Var 615678,Var 410452)
+  val x5 : X =
+    Bop
+      (5234547,Bop (2617273,Var 1308636,Var 872424),
+       Bop (1744849,Var 872424,Var 581616))
+  val x6 : X =
+    Bop (923759825,Var 461879912,Bop (307919941,Var 153959970,Var 102639980))
+  val x7 : X = Var 2435234
+  val x8 : X =
+    Bop
+      (12396777,Var 6198388,
+       Bop
+         (4132259,
+          Bop
+            (2066129,Var 1033064,
+             Bop
+               (688709,Var 344354,
+                Bop
+                  (229569,Var 114784,
+                   Bop
+                     (76523,
+                      Bop
+                        (38261,Var 19130,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472)))),
+                      Bop
+                        (25507,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472))),Var 8502))))),
+          Bop
+            (1377419,
+             Bop
+               (688709,Var 344354,
+                Bop
+                  (229569,Var 114784,
+                   Bop
+                     (76523,
+                      Bop
+                        (38261,Var 19130,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472)))),
+                      Bop
+                        (25507,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472))),Var 8502)))),
+             Bop
+               (459139,
+                Bop
+                  (229569,Var 114784,
+                   Bop
+                     (76523,
+                      Bop
+                        (38261,Var 19130,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472)))),
+                      Bop
+                        (25507,
+                         Bop
+                           (12753,Var 6376,
+                            Bop
+                              (4251,Bop (2125,Var 1062,Var 708),
+                               Bop (1417,Var 708,Var 472))),Var 8502))),
+                Var 153046))))
+  val x9 : X =
+    Bop
+      (3333333,Var 1666666,
+       Bop
+         (1111111,
+          Bop
+            (555555,Bop (277777,Var 138888,Var 92592),
+             Bop (185185,Var 92592,Var 61728)),Var 370370))
+  val x10 : X =
+    Bop
+      (1312311237,Var 656155618,
+       Bop
+         (437437079,
+          Bop
+            (218718539,
+             Bop
+               (109359269,Var 54679634,
+                Bop
+                  (36453089,Var 18226544,
+                   Bop
+                     (12151029,Var 6075514,
+                      Bop
+                        (4050343,
+                         Bop
+                           (2025171,Bop (1012585,Var 506292,Var 337528),
+                            Bop
+                              (675057,Var 337528,
+                               Bop
+                                 (225019,
+                                  Bop
+                                    (112509,Var 56254,
+                                     Bop
+                                       (37503,
+                                        Bop
+                                          (18751,
+                                           Bop
+                                             (9375,
+                                              Bop
+                                                (4687,
+                                                 Bop
+                                                   (2343,
+                                                    Bop
+                                                      (1171,
+                                                       Bop
+                                                         (585,Var 292,
+                                                          Bop
+                                                            (195,
+                                                             Bop
+                                                               (97,Var 48,
+                                                                Var 32),
+                                                             Bop
+                                                               (65,Var 32,
+                                                                Bop
+                                                                  (21,Var 10,
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))),
+                                                       Var 390),
+                                                    Bop (781,Var 390,Var 260)),
+                                                 Var 1562),
+                                              Bop
+                                                (3125,Var 1562,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))))),
+                                           Var 6250),
+                                        Bop
+                                          (12501,Var 6250,
+                                           Bop
+                                             (4167,
+                                              Bop
+                                                (2083,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))),
+                                                 Var 694),
+                                              Bop
+                                                (1389,Var 694,
+                                                 Bop
+                                                   (463,
+                                                    Bop
+                                                      (231,
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38),
+                                                       Bop
+                                                         (77,Var 38,
+                                                          Bop
+                                                            (25,Var 12,Var 8))),
+                                                    Var 154)))))),Var 75006))),
+                         Var 1350114)))),
+             Bop
+               (72906179,
+                Bop
+                  (36453089,Var 18226544,
+                   Bop
+                     (12151029,Var 6075514,
+                      Bop
+                        (4050343,
+                         Bop
+                           (2025171,Bop (1012585,Var 506292,Var 337528),
+                            Bop
+                              (675057,Var 337528,
+                               Bop
+                                 (225019,
+                                  Bop
+                                    (112509,Var 56254,
+                                     Bop
+                                       (37503,
+                                        Bop
+                                          (18751,
+                                           Bop
+                                             (9375,
+                                              Bop
+                                                (4687,
+                                                 Bop
+                                                   (2343,
+                                                    Bop
+                                                      (1171,
+                                                       Bop
+                                                         (585,Var 292,
+                                                          Bop
+                                                            (195,
+                                                             Bop
+                                                               (97,Var 48,
+                                                                Var 32),
+                                                             Bop
+                                                               (65,Var 32,
+                                                                Bop
+                                                                  (21,Var 10,
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))),
+                                                       Var 390),
+                                                    Bop (781,Var 390,Var 260)),
+                                                 Var 1562),
+                                              Bop
+                                                (3125,Var 1562,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))))),
+                                           Var 6250),
+                                        Bop
+                                          (12501,Var 6250,
+                                           Bop
+                                             (4167,
+                                              Bop
+                                                (2083,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))),
+                                                 Var 694),
+                                              Bop
+                                                (1389,Var 694,
+                                                 Bop
+                                                   (463,
+                                                    Bop
+                                                      (231,
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38),
+                                                       Bop
+                                                         (77,Var 38,
+                                                          Bop
+                                                            (25,Var 12,Var 8))),
+                                                    Var 154)))))),Var 75006))),
+                         Var 1350114))),
+                Bop
+                  (24302059,
+                   Bop
+                     (12151029,Var 6075514,
+                      Bop
+                        (4050343,
+                         Bop
+                           (2025171,Bop (1012585,Var 506292,Var 337528),
+                            Bop
+                              (675057,Var 337528,
+                               Bop
+                                 (225019,
+                                  Bop
+                                    (112509,Var 56254,
+                                     Bop
+                                       (37503,
+                                        Bop
+                                          (18751,
+                                           Bop
+                                             (9375,
+                                              Bop
+                                                (4687,
+                                                 Bop
+                                                   (2343,
+                                                    Bop
+                                                      (1171,
+                                                       Bop
+                                                         (585,Var 292,
+                                                          Bop
+                                                            (195,
+                                                             Bop
+                                                               (97,Var 48,
+                                                                Var 32),
+                                                             Bop
+                                                               (65,Var 32,
+                                                                Bop
+                                                                  (21,Var 10,
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))),
+                                                       Var 390),
+                                                    Bop (781,Var 390,Var 260)),
+                                                 Var 1562),
+                                              Bop
+                                                (3125,Var 1562,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))))),
+                                           Var 6250),
+                                        Bop
+                                          (12501,Var 6250,
+                                           Bop
+                                             (4167,
+                                              Bop
+                                                (2083,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6))),
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38))),
+                                                 Var 694),
+                                              Bop
+                                                (1389,Var 694,
+                                                 Bop
+                                                   (463,
+                                                    Bop
+                                                      (231,
+                                                       Bop
+                                                         (115,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,
+                                                                   Bop
+                                                                     (3,
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0),
+                                                                      Bop
+                                                                        (1,
+                                                                         Var 0,
+                                                                         Var 0))),
+                                                                Var 6)),Var 38),
+                                                       Bop
+                                                         (77,Var 38,
+                                                          Bop
+                                                            (25,Var 12,Var 8))),
+                                                    Var 154)))))),Var 75006))),
+                         Var 1350114)),Var 8100686))),
+          Bop
+            (145812359,
+             Bop
+               (72906179,
+                Bop
+                  (36453089,Var 18226544,
+                   Bop
+                     (12151029,Var 6075514,
+                      Bop
+                        (4050343,
+                         Bop
+                           (2025171,Bop (1012585,Var 506292,Var 337528),
+                            Bop
+                              (675057,Var 337528,
+                               Bop
+                                 (225019,
+                                  Bop
+                                    (112509,Var 56254,
+                                     Bop
+                                       (37503,
+                                        Bop
+                                          (18751,
+                                           Bop
+                                             (9375,
+                                              Bop
+                                                (4687,
+                                                 Bop
+                                                   (2343,
+                                                    Bop
+                                                      (1171,
+                                                       Bop
+                                                         (585,Var 292,
+                                                          Bop
+                                                            (195,
+                                                             Bop
+                                                               (97,Var 48,
+                                                                Var 32),
+                                                             Bop
+                                                               (65,Var 32,
+                                                                Bop
+                                                                  (21,Var 10,
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))),
+                                                       Var 390),
+                                                    Bop (781,Var 390,Var 260)),
+                                                 Var 1562),
+                                              Bop
+                                                (3125,Var 1562,
+                                                 Bop
+                                                   (1041,Var 520,
+                                                    Bop
+                                                      (347,
+                                                       Bop
+                                                         (173,Var 86,
+                                                          Bop
+                                                            (57,Var 28,
+                                                             Bop
+                                                               (19,
+                                                                Bop
+                                                                  (9,Var 4,...),
+                                                                ...))),...)))),
+                                           ...),...)),...))),...))),...),...)))
+  val x11 : X =
+    Bop
+      (2147483647,
+       Bop
+         (1073741823,
+          Bop
+            (536870911,
+             Bop
+               (268435455,
+                Bop
+                  (134217727,
+                   Bop
+                     (67108863,
+                      Bop
+                        (33554431,
+                         Bop
+                           (16777215,
+                            Bop
+                              (8388607,
+                               Bop
+                                 (4194303,
+                                  Bop
+                                    (2097151,
+                                     Bop
+                                       (1048575,
+                                        Bop
+                                          (524287,
+                                           Bop
+                                             (262143,
+                                              Bop
+                                                (131071,
+                                                 Bop
+                                                   (65535,
+                                                    Bop
+                                                      (32767,
+                                                       Bop
+                                                         (16383,
+                                                          Bop
+                                                            (8191,
+                                                             Bop
+                                                               (4095,
+                                                                Bop
+                                                                  (2047,
+                                                                   Bop
+                                                                     (1023,
+                                                                      Bop
+                                                                        (511,
+                                                                         Bop
+                                                                           (255,
+                                                                            Bop
+                                                                              (127,
+                                                                               Bop
+                                                                                 (63,
+                                                                                  Bop
+                                                                                    (31,
+                                                                                     Bop
+                                                                                       (15,
+                                                                                        Bop
+                                                                                          (7,
+                                                                                           Bop
+                                                                                             (3,
+                                                                                              Bop
+                                                                                                (1,
+                                                                                                 Var
+                                                                                                   0,
+                                                                                                 Var
+                                                                                                   0),
+                                                                                              Bop
+                                                                                                (1,
+                                                                                                 Var
+                                                                                                   0,
+                                                                                                 Var
+                                                                                                   0)),
+                                                                                           Var
+                                                                                             2),
+                                                                                        Bop
+                                                                                          (5,
+                                                                                           Var
+                                                                                             2,
+                                                                                           Bop
+                                                                                             (1,
+                                                                                              Var
+                                                                                                0,
+                                                                                              Var
+                                                                                                0))),
+                                                                                     Var
+                                                                                       10),
+                                                                                  Bop
+                                                                                    (21,
+                                                                                     Var
+                                                                                       10,
+                                                                                     Bop
+                                                                                       (7,
+                                                                                        Bop
+                                                                                          (3,
+                                                                                           Bop
+                                                                                             (1,
+                                                                                              Var
+                                                                                                0,
+                                                                                              Var
+                                                                                                0),
+                                                                                           Bop
+                                                                                             (1,
+                                                                                              Var
+                                                                                                0,
+                                                                                              Var
+                                                                                                0)),
+                                                                                        Var
+                                                                                          2))),
+                                                                               Var
+                                                                                 42),
+                                                                            Bop
+                                                                              (85,
+                                                                               Var
+                                                                                 42,
+                                                                               Var
+                                                                                 28)),
+                                                                         Var
+                                                                           170),
+                                                                      Bop
+                                                                        (341,
+                                                                         Var
+                                                                           170,
+                                                                         Bop
+                                                                           (113,
+                                                                            Var
+                                                                              56,
+                                                                            Bop
+                                                                              (37,
+                                                                               Var
+                                                                                 18,
+                                                                               Var
+                                                                                 12)))),
+                                                                   Var 682),
+                                                                Bop
+                                                                  (1365,
+                                                                   Var 682,
+                                                                   Bop
+                                                                     (455,
+                                                                      Bop
+                                                                        (227,
+                                                                         Bop
+                                                                           (113,
+                                                                            Var
+                                                                              56,
+                                                                            Bop
+                                                                              (37,
+                                                                               Var
+                                                                                 18,
+                                                                               Var
+                                                                                 12)),
+                                                                         Bop
+                                                                           (75,
+                                                                            Bop
+                                                                              (37,
+                                                                               Var
+                                                                                 18,
+                                                                               Var
+                                                                                 12),
+                                                                            Bop
+                                                                              (25,
+                                                                               Var
+                                                                                 12,
+                                                                               Var
+                                                                                 8))),
+                                                                      Bop
+                                                                        (151,
+                                                                         Bop
+                                                                           (75,
+                                                                            Bop
+                                                                              (37,
+                                                                               Var
+                                                                                 18,
+                                                                               Var
+                                                                                 12),
+                                                                            Bop
+                                                                              (25,
+                                                                               Var
+                                                                                 12,
+                                                                               Var
+                                                                                 8)),
+                                                                         Var
+                                                                           50)))),
+                                                             Var 2730),
+                                                          Bop
+                                                            (5461,Var 2730,
+                                                             Var 1820)),
+                                                       Var 10922),
+                                                    Bop
+                                                      (21845,Var 10922,
+                                                       Bop
+                                                         (7281,Var 3640,
+                                                          Bop
+                                                            (2427,
+                                                             Bop
+                                                               (1213,Var 606,
+                                                                Var 404),
+                                                             Bop
+                                                               (809,Var 404,
+                                                                Bop
+                                                                  (269,Var 134,
+                                                                   Bop
+                                                                     (89,
+                                                                      Var 44,
+                                                                      Bop
+                                                                        (29,
+                                                                         Var
+                                                                           14,
+                                                                         Bop
+                                                                           (9,
+                                                                            Var
+                                                                              4,
+                                                                            Bop
+                                                                              (3,
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0),
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0))))))))))),
+                                                 Var 43690),
+                                              Bop
+                                                (87381,Var 43690,
+                                                 Bop
+                                                   (29127,
+                                                    Bop
+                                                      (14563,
+                                                       Bop
+                                                         (7281,Var 3640,
+                                                          Bop
+                                                            (2427,
+                                                             Bop
+                                                               (1213,Var 606,
+                                                                Var 404),
+                                                             Bop
+                                                               (809,Var 404,
+                                                                Bop
+                                                                  (269,Var 134,
+                                                                   Bop
+                                                                     (89,
+                                                                      Var 44,
+                                                                      Bop
+                                                                        (29,
+                                                                         Var
+                                                                           14,
+                                                                         Bop
+                                                                           (9,
+                                                                            Var
+                                                                              4,
+                                                                            Bop
+                                                                              (3,
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0),
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0))))))))),
+                                                       Var 4854),
+                                                    Bop
+                                                      (9709,Var 4854,Var 3236)))),
+                                           Var 174762),
+                                        Bop (349525,Var 174762,Var 116508)),
+                                     Var 699050),
+                                  Bop
+                                    (1398101,Var 699050,
+                                     Bop (466033,Var 233016,Var 155344))),
+                               Var 2796202),
+                            Bop
+                              (5592405,Var 2796202,
+                               Bop
+                                 (1864135,
+                                  Bop
+                                    (932067,Bop (466033,Var 233016,Var 155344),
+                                     Bop
+                                       (310689,Var 155344,
+                                        Bop
+                                          (103563,
+                                           Bop (51781,Var 25890,Var 17260),
+                                           Bop
+                                             (34521,Var 17260,
+                                              Bop
+                                                (11507,
+                                                 Bop
+                                                   (5753,Var 2876,
+                                                    Bop
+                                                      (1917,Var 958,
+                                                       Bop
+                                                         (639,
+                                                          Bop
+                                                            (319,
+                                                             Bop
+                                                               (159,
+                                                                Bop
+                                                                  (79,
+                                                                   Bop
+                                                                     (39,
+                                                                      Bop
+                                                                        (19,
+                                                                         Bop
+                                                                           (9,
+                                                                            Var
+                                                                              4,
+                                                                            Bop
+                                                                              (3,
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0),
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0))),
+                                                                         Var 6),
+                                                                      Bop
+                                                                        (13,
+                                                                         Var 6,
+                                                                         Var 4)),
+                                                                   Var 26),
+                                                                Bop
+                                                                  (53,Var 26,
+                                                                   Bop
+                                                                     (17,Var 8,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))))),
+                                                             Var 106),
+                                                          Bop
+                                                            (213,Var 106,
+                                                             Bop
+                                                               (71,
+                                                                Bop
+                                                                  (35,
+                                                                   Bop
+                                                                     (17,Var 8,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))),
+                                                                   Bop
+                                                                     (11,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)))),
+                                                                Bop
+                                                                  (23,
+                                                                   Bop
+                                                                     (11,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))),
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2))))))),
+                                                 Bop
+                                                   (3835,
+                                                    Bop
+                                                      (1917,Var 958,
+                                                       Bop
+                                                         (639,
+                                                          Bop
+                                                            (319,
+                                                             Bop
+                                                               (159,
+                                                                Bop
+                                                                  (79,
+                                                                   Bop
+                                                                     (39,
+                                                                      Bop
+                                                                        (19,
+                                                                         Bop
+                                                                           (9,
+                                                                            Var
+                                                                              4,
+                                                                            Bop
+                                                                              (3,
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0),
+                                                                               Bop
+                                                                                 (1,
+                                                                                  Var
+                                                                                    0,
+                                                                                  Var
+                                                                                    0))),
+                                                                         Var 6),
+                                                                      Bop
+                                                                        (13,
+                                                                         Var 6,
+                                                                         Var 4)),
+                                                                   Var 26),
+                                                                Bop
+                                                                  (53,Var 26,
+                                                                   Bop
+                                                                     (17,Var 8,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))))),
+                                                             Var 106),
+                                                          Bop
+                                                            (213,Var 106,
+                                                             Bop
+                                                               (71,
+                                                                Bop
+                                                                  (35,
+                                                                   Bop
+                                                                     (17,Var 8,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))),
+                                                                   Bop
+                                                                     (11,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)))),
+                                                                Bop
+                                                                  (23,
+                                                                   Bop
+                                                                     (11,
+                                                                      Bop
+                                                                        (5,
+                                                                         Var 2,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0))),
+                                                                   Bop
+                                                                     (7,
+                                                                      Bop
+                                                                        (3,
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0),
+                                                                         Bop
+                                                                           (1,
+                                                                            Var
+                                                                              0,
+                                                                            Var
+                                                                              0)),
+                                                                      Var 2)))))),
+                                                    Var 1278)))))),Var 621378))),
+                         Var 11184810),Bop (22369621,Var 11184810,Var 7456540)),
+                   Var 44739242),
+                Bop
+                  (89478485,Var 44739242,
+                   Bop
+                     (29826161,Var 14913080,
+                      Bop
+                        (9942053,Var 4971026,
+                         Bop (3314017,Var 1657008,Var 1104672))))),
+             Var 178956970),
+          Bop
+            (357913941,Var 178956970,
+             Bop
+               (119304647,
+                Bop
+                  (59652323,
+                   Bop
+                     (29826161,Var 14913080,
+                      Bop
+                        (9942053,Var 4971026,
+                         Bop (3314017,Var 1657008,Var 1104672))),
+                   Bop
+                     (19884107,
+                      Bop
+                        (9942053,Var 4971026,
+                         Bop (3314017,Var 1657008,Var 1104672)),
+                      Bop
+                        (6628035,Bop (3314017,Var 1657008,Var 1104672),
+                         Bop (2209345,Var 1104672,Var 736448)))),
+                Bop
+                  (39768215,
+                   Bop
+                     (19884107,
+                      Bop
+                        (9942053,Var 4971026,
+                         Bop (3314017,Var 1657008,Var 1104672)),
+                      Bop
+                        (6628035,Bop (3314017,Var 1657008,Var 1104672),
+                         Bop (2209345,Var 1104672,Var 736448))),
+                   Bop
+                     (13256071,
+                      Bop
+                        (6628035,Bop (3314017,Var 1657008,Var 1104672),
+                         Bop (2209345,Var 1104672,Var 736448)),Var 4418690))))),
+       Var 715827882)
+end
+
+> 
+type C =
+  class
+    new : x:string -> C
+    override ToString : unit -> string
+  end
+val c1 : C = <ToString exception: Trouble_A>
+val csA : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+val csB : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+val csC : C [] =
+  [|<ToString exception: Trouble_0>; <ToString exception: Trouble_1>;
+    <ToString exception: Trouble_2>; <ToString exception: Trouble_3>;
+    <ToString exception: Trouble_4>; <ToString exception: Trouble_5>;
+    <ToString exception: Trouble_6>; <ToString exception: Trouble_7>;
+    <ToString exception: Trouble_8>; <ToString exception: Trouble_9>;
+    <ToString exception: Trouble_10>; <ToString exception: Trouble_11>;
+    <ToString exception: Trouble_12>; <ToString exception: Trouble_13>;
+    <ToString exception: Trouble_14>; <ToString exception: Trouble_15>;
+    <ToString exception: Trouble_16>; <ToString exception: Trouble_17>;
+    <ToString exception: Trouble_18>; <ToString exception: Trouble_19>;
+    <ToString exception: Trouble_20>; <ToString exception: Trouble_21>;
+    <ToString exception: Trouble_22>; <ToString exception: Trouble_23>;
+    <ToString exception: Trouble_24>; <ToString exception: Trouble_25>;
+    <ToString exception: Trouble_26>; <ToString exception: Trouble_27>;
+    <ToString exception: Trouble_28>; <ToString exception: Trouble_29>;
+    <ToString exception: Trouble_30>; <ToString exception: Trouble_31>;
+    <ToString exception: Trouble_32>; <ToString exception: Trouble_33>;
+    <ToString exception: Trouble_34>; <ToString exception: Trouble_35>;
+    <ToString exception: Trouble_36>; <ToString exception: Trouble_37>;
+    <ToString exception: Trouble_38>; <ToString exception: Trouble_39>;
+    <ToString exception: Trouble_40>; <ToString exception: Trouble_41>;
+    <ToString exception: Trouble_42>; <ToString exception: Trouble_43>;
+    <ToString exception: Trouble_44>; <ToString exception: Trouble_45>;
+    <ToString exception: Trouble_46>; <ToString exception: Trouble_47>;
+    <ToString exception: Trouble_48>; <ToString exception: Trouble_49>;
+    <ToString exception: Trouble_50>; <ToString exception: Trouble_51>;
+    <ToString exception: Trouble_52>; <ToString exception: Trouble_53>;
+    <ToString exception: Trouble_54>; <ToString exception: Trouble_55>;
+    <ToString exception: Trouble_56>; <ToString exception: Trouble_57>;
+    <ToString exception: Trouble_58>; <ToString exception: Trouble_59>;
+    <ToString exception: Trouble_60>; <ToString exception: Trouble_61>;
+    <ToString exception: Trouble_62>; <ToString exception: Trouble_63>;
+    <ToString exception: Trouble_64>; <ToString exception: Trouble_65>;
+    <ToString exception: Trouble_66>; <ToString exception: Trouble_67>;
+    <ToString exception: Trouble_68>; <ToString exception: Trouble_69>;
+    <ToString exception: Trouble_70>; <ToString exception: Trouble_71>;
+    <ToString exception: Trouble_72>; <ToString exception: Trouble_73>;
+    <ToString exception: Trouble_74>; <ToString exception: Trouble_75>;
+    <ToString exception: Trouble_76>; <ToString exception: Trouble_77>;
+    <ToString exception: Trouble_78>; <ToString exception: Trouble_79>;
+    <ToString exception: Trouble_80>; <ToString exception: Trouble_81>;
+    <ToString exception: Trouble_82>; <ToString exception: Trouble_83>;
+    <ToString exception: Trouble_84>; <ToString exception: Trouble_85>;
+    <ToString exception: Trouble_86>; <ToString exception: Trouble_87>;
+    <ToString exception: Trouble_88>; <ToString exception: Trouble_89>;
+    <ToString exception: Trouble_90>; <ToString exception: Trouble_91>;
+    <ToString exception: Trouble_92>; <ToString exception: Trouble_93>;
+    <ToString exception: Trouble_94>; <ToString exception: Trouble_95>;
+    <ToString exception: Trouble_96>; <ToString exception: Trouble_97>;
+    <ToString exception: Trouble_98>; <ToString exception: Trouble_99>; ...|]
+
+> 
+exception Abc
+
+> 
+exception AbcInt of int
+
+> 
+exception AbcString of string
+
+> 
+exception AbcExn of exn list
+
+> 
+exception AbcException of System.Exception list
+
+> 
+val exA1 : exn = Abc
+val exA2 : exn = AbcInt 2
+val exA3 : exn = AbcString "3"
+val exA4 : exn = AbcExn [Abc; AbcInt 2; AbcString "3"]
+val exA5 : exn = AbcException [AbcExn [Abc; AbcInt 2; AbcString "3"]]
+exception Ex0
+exception ExUnit of unit
+exception ExUnits of unit * unit
+exception ExUnitOption of unit option
+val ex0 : exn = Ex0
+val exU : exn = ExUnit null
+val exUs : exn = ExUnits (null,null)
+val exUSome : exn = ExUnitOption (Some null)
+val exUNone : exn = ExUnitOption null
+type 'a T4063 = | AT4063 of 'a
+
+> 
+val valAT3063_12 : int T4063 = AT4063 12
+
+> 
+val valAT3063_True : bool T4063 = AT4063 true
+
+> 
+val valAT3063_text : string T4063 = AT4063 "text"
+
+> 
+val valAT3063_null : System.Object T4063 = AT4063 null
+
+> 
+type M4063<'a> =
+  class
+    new : x:'a -> M4063<'a>
+  end
+
+> 
+val v4063 : M4063<int>
+
+> 
+type Taaaaa<'a> =
+  class
+    new : unit -> Taaaaa<'a>
+  end
+
+> 
+type Taaaaa2<'a> =
+  class
+    inherit Taaaaa<'a>
+    new : unit -> Taaaaa2<'a>
+    member M : unit -> Taaaaa2<'a>
+  end
+
+> 
+type Tbbbbb<'a> =
+  class
+    new : x:'a -> Tbbbbb<'a>
+    member M : unit -> 'a
+  end
+
+> 
+type Tbbbbb2 =
+  class
+    inherit Tbbbbb<string>
+    new : x:string -> Tbbbbb2
+  end
+
+> val it : (unit -> string) = <fun:it at 198>
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte [] = [|12uy; 13uy; 14uy|]
+end
+
+> val it : string = "Check #help"
+> 
+  F# Interactive directives:
+
+    #r "file.dll";;        Reference (dynamically load) the given DLL
+    #I "path";;            Add the given search path for referenced DLLs
+    #load "file.fs" ...;;  Load the given file(s) as if compiled and referenced
+    #time ["on"|"off"];;   Toggle timing on/off
+    #help;;                Display help
+    #quit;;                Exit
+
+  F# Interactive command line options:
+
+
+
+> val it : string = "Check #time on and then off"
+> 
+--> Timing now on
+
+> 
+--> Timing now off
+
+> val it : string = "Check #unknown command"
+> Invalid directive '#blaaaaaa '
+> val it : string =
+  "Check #I with a known directory (to avoid a warning, which includes the location of this file, which is fragile...)"
+> 
+--> Added '/' to library include path
+
+> 
+type internal T1 =
+  | A
+  | B
+
+> 
+type internal T2 =
+  {x: int;}
+
+> 
+type internal T3
+
+> 
+type internal T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+type T1 =
+  internal | A
+           | B
+
+> 
+type T2 =
+  internal {x: int;}
+
+> 
+type private T1 =
+  | A
+  | B
+
+> 
+type private T2 =
+  {x: int;}
+
+> 
+type T1 =
+  private | A
+          | B
+
+> 
+type T2 =
+  private {x: int;}
+
+> 
+type internal T1 =
+  private | A
+          | B
+
+> 
+type internal T2 =
+  private {x: int;}
+
+> 
+type private T3
+
+> 
+type private T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+exception X1 of int
+
+> 
+exception private X2 of int
+
+> 
+exception internal X3 of int
+
+> 
+type T0 =
+  class
+    new : unit -> T0
+  end
+type T1Post<'a> =
+  class
+    new : unit -> T1Post<'a>
+  end
+type 'a T1Pre =
+  class
+    new : unit -> 'a T1Pre
+  end
+
+> 
+type T0 with
+  member M : unit -> T0 list
+type T0 with
+  member P : T0 * T0
+type T0 with
+  member E : IEvent<int>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type r =
+  {f0: int;
+   f1: int;
+   f2: int;
+   f3: int;
+   f4: int;
+   f5: int;
+   f6: int;
+   f7: int;
+   f8: int;
+   f9: int;}
+val r10 : r = {f0 = 0;
+               f1 = 1;
+               f2 = 2;
+               f3 = 3;
+               f4 = 4;
+               f5 = 5;
+               f6 = 6;
+               f7 = 7;
+               f8 = 8;
+               f9 = 9;}
+val r10s : r [] =
+  [|{f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}; {f0 = 0;
+                f1 = 1;
+                f2 = 2;
+                f3 = 3;
+                f4 = 4;
+                f5 = 5;
+                f6 = 6;
+                f7 = 7;
+                f8 = 8;
+                f9 = 9;}; {f0 = 0;
+                           f1 = 1;
+                           f2 = 2;
+                           f3 = 3;
+                           f4 = 4;
+                           f5 = 5;
+                           f6 = 6;
+                           f7 = 7;
+                           f8 = 8;
+                           f9 = 9;}; {f0 = 0;
+                                      f1 = 1;
+                                      f2 = 2;
+                                      f3 = 3;
+                                      f4 = 4;
+                                      f5 = 5;
+                                      f6 = 6;
+                                      f7 = 7;
+                                      f8 = 8;
+                                      f9 = 9;}; {f0 = 0;
+                                                 f1 = 1;
+                                                 f2 = 2;
+                                                 f3 = 3;
+                                                 f4 = 4;
+                                                 f5 = 5;
+                                                 f6 = 6;
+                                                 f7 = 7;
+                                                 f8 = 8;
+                                                 f9 = 9;}; {f0 = 0;
+                                                            f1 = 1;
+                                                            f2 = 2;
+                                                            f3 = 3;
+                                                            f4 = 4;
+                                                            f5 = 5;
+                                                            f6 = 6;
+                                                            f7 = 7;
+                                                            f8 = 8;
+                                                            f9 = 9;};
+    {f0 = 0;
+     f1 = 1;
+     f2 = 2;
+     f3 = 3;
+     f4 = 4;
+     f5 = 5;
+     f6 = 6;
+     f7 = 7;
+     f8 = 8;
+     f9 = 9;}|]
+val r10s' : string * r [] =
+  ("one extra node",
+   [|{f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}; {f0 = 0;
+                 f1 = 1;
+                 f2 = 2;
+                 f3 = 3;
+                 f4 = 4;
+                 f5 = 5;
+                 f6 = 6;
+                 f7 = 7;
+                 f8 = 8;
+                 f9 = 9;}; {f0 = 0;
+                            f1 = 1;
+                            f2 = 2;
+                            f3 = 3;
+                            f4 = 4;
+                            f5 = 5;
+                            f6 = 6;
+                            f7 = 7;
+                            f8 = 8;
+                            f9 = 9;}; {f0 = 0;
+                                       f1 = 1;
+                                       f2 = 2;
+                                       f3 = 3;
+                                       f4 = 4;
+                                       f5 = 5;
+                                       f6 = 6;
+                                       f7 = 7;
+                                       f8 = 8;
+                                       f9 = 9;}; {f0 = 0;
+                                                  f1 = 1;
+                                                  f2 = 2;
+                                                  f3 = 3;
+                                                  f4 = 4;
+                                                  f5 = 5;
+                                                  f6 = 6;
+                                                  f7 = 7;
+                                                  f8 = 8;
+                                                  f9 = 9;}; {f0 = 0;
+                                                             f1 = 1;
+                                                             f2 = 2;
+                                                             f3 = 3;
+                                                             f4 = 4;
+                                                             f5 = 5;
+                                                             f6 = 6;
+                                                             f7 = 7;
+                                                             f8 = 8;
+                                                             f9 = 9;};
+     {f0 = 0;
+      f1 = 1;
+      f2 = 2;
+      f3 = 3;
+      f4 = 4;
+      f5 = 5;
+      f6 = 6;
+      f7 = 7;
+      f8 = 8;
+      f9 = 9;}|])
+
+> 
+val x1564_A1 : int = 1
+
+
+--> Added '\' to library include path
+
+
+val x1564_A2 : int = 2
+
+
+--> Added '\' to library include path
+
+
+val x1564_A3 : int = 3
+
+> 
+type internal Foo2 =
+  class
+    new : unit -> Foo2
+    new : x:int -> Foo2
+    new : x:int * y:int -> Foo2
+    private new : x:int * y:int * z:int -> Foo2
+    member Prop1 : int
+    member Prop2 : int
+    member private Prop3 : int
+  end
+
+> 
+module internal InternalM = begin
+  val x : int = 1
+  type Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      private new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member private Prop3 : int
+    end
+  type private Foo3 =
+    class
+      new : unit -> Foo3
+      new : x:int -> Foo3
+      new : x:int * y:int -> Foo3
+      new : x:int * y:int * z:int -> Foo3
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+module internal PrivateM = begin
+  val private x : int = 1
+  type private Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+
+> val it : seq<int * string * int> =
+  seq
+    [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2);
+     (58, "2/10/2009", 1)]
+> 
+module Test4343a = begin
+  val mk : i:int -> string
+  val x100 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[39 chars]
+  val x90 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[29 chars]
+  val x80 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[19 chars]
+  val x75 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[14 chars]
+  val x74 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[13 chars]
+  val x73 : string =
+    "0123456789012345678901234567890123456789012345678901234567890"+[12 chars]
+  val x72 : string =
+    "012345678901234567890123456789012345678901234567890123456789012345678901"
+  val x71 : string =
+    "01234567890123456789012345678901234567890123456789012345678901234567890"
+  val x70 : string =
+    "0123456789012345678901234567890123456789012345678901234567890123456789"
+end
+module Test4343b = begin
+  val fA : x:int -> int
+  val fB : x:'a -> y:'a -> 'a list
+  val gA : (int -> int)
+  val gB : ('a -> 'a -> 'a list)
+  val gAB : (int -> int) * ('a -> 'a -> 'a list)
+  val hB : ('a -> 'a -> 'a list)
+  val hA : (int -> int)
+end
+module Test4343c = begin
+  val typename<'a> : string
+  val typename2<'a> : string * string
+end
+module Test4343d = begin
+  val xList : int list = [1; 2; 3]
+  val xArray : int [] = [|1; 2; 3|]
+  val xString : string = "abcdef"
+  val xOption : int option = Some 12
+  val xArray2 : (int * int) [,] = [[(0, 0); (0, 1)]
+                                   [(1, 0); (1, 1)]]
+  val xSeq : seq<int>
+end
+module Test4343e = begin
+  type C =
+    class
+      new : x:int -> C
+    end
+  val cA : C
+  val cB : C
+  val cAB : C * C * C list =
+    (FSI_0090+Test4343e+C, FSI_0090+Test4343e+C,
+     [FSI_0090+Test4343e+C; FSI_0090+Test4343e+C])
+  type D =
+    class
+      new : x:int -> D
+      override ToString : unit -> string
+    end
+  val dA : D = D(1)
+  val dB : D = D(2)
+  val dAB : D * D * D list = (D(1), D(2), [D(1); D(2)])
+  module Generic = begin
+    type CGeneric<'a> =
+      class
+        new : x:'a -> CGeneric<'a>
+      end
+    val cA : C
+    val cB : C
+    val cAB : C * C * C list =
+      (FSI_0090+Test4343e+C, FSI_0090+Test4343e+C,
+       [FSI_0090+Test4343e+C; FSI_0090+Test4343e+C])
+    type D<'a> =
+      class
+        new : x:'a -> D<'a>
+        override ToString : unit -> string
+      end
+    val dA : D<int> = D(1)
+    val dB : D<int> = D(2)
+    val dAB : D<int> * D<int> * D<int> list = (D(1), D(2), [D(1); D(2)])
+    val dC : D<bool> = D(True)
+    val boxed_dABC : obj list = [D(1); D(2); D(True)]
+  end
+end
+type F1 =
+  class
+    inherit System.Windows.Forms.Form
+    interface System.IDisposable
+    val x: F1
+    val x2: F1
+    abstract member MMM : bool -> bool
+    abstract member AAA : int
+    abstract member ZZZ : int
+    abstract member BBB : bool with set
+    member B : unit -> int
+    member D : unit -> int
+    member D : x:int -> int
+    member D : x:int * y:int -> int
+    override ToString : unit -> string
+    member D2 : int
+    member E : int
+    member D2 : int with set
+    member E : int with set
+    static val mutable private sx: F1
+    static val mutable private sx2: F1
+    static member A : unit -> int
+    static member C : unit -> int
+  end
+type IP =
+  struct
+    new : x:int * y:int -> IP
+    static val mutable private AA: IP
+  end
+module Regression4643 = begin
+  type RIP =
+    struct
+      new : x:int -> RIP
+      static val mutable private y: RIP
+    end
+  type arg_unused_is_RIP =
+    struct
+      new : x:RIP -> arg_unused_is_RIP
+    end
+  type arg_used_is_RIP =
+    struct
+      new : x:RIP -> arg_used_is_RIP
+      member X : RIP
+    end
+  type field_is_RIP =
+    struct
+      val x: RIP
+    end
+end
+type Either<'a,'b> =
+  | This of 'a
+  | That of 'b
+val catch : f:(unit -> 'a) -> Either<'a,(string * string)>
+val seqFindIndexFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqFindFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+val seqPickFailure : Either<int,(string * string)> =
+  That
+    ("System.Collections.Generic.KeyNotFoundException",
+     "Exception of type 'System.Collections.Generic.KeyNotFoundExce"+[18 chars])
+module Regression5218 = begin
+  val t1 : int = 1
+  val t2 : int * int = (1, 2)
+  val t3 : int * int * int = (1, 2, 3)
+  val t4 : int * int * int * int = (1, 2, 3, 4)
+  val t5 : int * int * int * int * int = (1, 2, 3, 4, 5)
+  val t6 : int * int * int * int * int * int = (1, 2, 3, 4, 5, 6)
+  val t7 : int * int * int * int * int * int * int = (1, 2, 3, 4, 5, 6, 7)
+  val t8 : int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8)
+  val t9 : int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9)
+  val t10 : int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
+  val t11 : int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
+  val t12 :
+    int * int * int * int * int * int * int * int * int * int * int * int =
+    (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
+  val t13 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
+  val t14 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
+  val t15 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int * int = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3740 = begin
+  type Writer<'a> =
+    interface
+      abstract member get_path : unit -> string
+    end
+  type MyClass =
+    class
+      interface Writer<int>
+      val path: string
+    end
+end
+
+> 
+type Regression4319_T2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> string
+  end
+
+> 
+  type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(572,42): warning FS1172: Infix operator member '+-+-+' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T0 =
+  class
+    static member ( +-+-+ ) : string
+  end
+
+> 
+  type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+  -----------------------------------------^^^^^
+
+stdin(573,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1 =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+  -----------------------------------------^^^^^
+
+stdin(574,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1b =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(575,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1c =
+  class
+    static member ( +-+-+ ) : x:('a * 'b) -> string
+  end
+
+> 
+  type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(576,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1d =
+  class
+    static member ( +-+-+ ) : x:(int * int) -> string
+  end
+
+> 
+  type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(578,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> string
+  end
+
+> 
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1 =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1b =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(581,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> moreArgs:'c -> string
+  end
+
+> 
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> moreArgs:'d -> string
+  end
+
+> 
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS1172: Infix operator member ':=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS0086: The name '(:=)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS1172: Infix operator member '&' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS0086: The name '(&)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name 'op_Amp' instead.
+
+      static member (&^)             = "AMP_AMP"
+  -------------------^^
+
+stdin(590,20): warning FS1172: Infix operator member '&^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS1172: Infix operator member '=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS0086: The name '(=)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name 'op_Equality' instead.
+
+      static member (!=)             = "INFIX_COMPARE_OP"
+  -------------------^^
+
+stdin(593,20): warning FS1172: Infix operator member '!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(597,20): warning FS1172: Infix operator member '...=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^^
+
+stdin(598,20): warning FS1172: Infix operator member '...!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(599,20): warning FS1172: Infix operator member '...<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(600,20): warning FS1172: Infix operator member '...>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ($)              = "DOLLAR"
+  -------------------^
+
+stdin(602,20): warning FS1172: Infix operator member '$' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS1172: Infix operator member '<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS0086: The name '(<)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_LessThan' instead.
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS1172: Infix operator member '>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS0086: The name '(>)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_GreaterThan' instead.
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS1172: Infix operator member '@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS0086: The name '(@)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS1172: Infix operator member '^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS0086: The name '(^)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(607,20): warning FS1172: Infix operator member '...@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(608,20): warning FS1172: Infix operator member '...^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (%)              = "PERCENT_OP"        
+  -------------------^
+
+stdin(609,20): warning FS1172: Infix operator member '%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (-)              = "MINUS"
+  -------------------^
+
+stdin(611,20): warning FS1172: Infix operator member '-' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( * )            = "STAR"
+  --------------------^
+
+stdin(612,21): warning FS1172: Infix operator member '*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+  -------------------^
+
+stdin(614,20): warning FS1172: Infix operator member '/' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(616,21): warning FS1172: Infix operator member '...*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(617,21): warning FS1172: Infix operator member '.../' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+  --------------------^^^^
+
+stdin(618,21): warning FS1172: Infix operator member '...%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ** )           = "INFIX_STAR_STAR_OP"
+  --------------------^^
+
+stdin(619,21): warning FS1172: Infix operator member '**' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_check =
+  class
+    static member ( & ) : string
+    static member ( &^ ) : string
+    static member ( @ ) : string
+    static member ( != ) : string
+    static member ( := ) : string
+    static member ( ^ ) : string
+    static member ( / ) : string
+    static member ( $ ) : string
+    static member ( ...@ ) : string
+    static member ( ...!= ) : string
+    static member ( .../ ) : string
+    static member ( ...= ) : string
+    static member ( ...> ) : string
+    static member ( ...^ ) : string
+    static member ( ...< ) : string
+    static member ( ...* ) : string
+    static member ( ...% ) : string
+    static member ( = ) : string
+    static member ( ** ) : string
+    static member ( > ) : string
+    static member ( < ) : string
+    static member ( % ) : string
+    static member ( * ) : string
+    static member ( - ) : string
+  end
+
+> 
+      member this.ToString() = "ABC"
+  ----------------^^^^^^^^
+
+stdin(624,17): warning FS0864: This new member hides the abstract member 'System.Object.ToString() : string'. Rename the member or use 'override' instead.
+Expect ABC = ABC
+
+type Regression4469 =
+  class
+    new : unit -> Regression4469
+    member ToString : unit -> string
+  end
+val r4469 : Regression4469 = FSI_0106+Regression4469
+val it : unit = ()
+
+> Expect ABC = ABC
+val it : unit = ()
+> 
+module Regression1019_short = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+module Regression1019_long = begin
+  val double_nan : float = nan
+  val double_infinity : float = infinity
+  val single_nan : float32 = nanf
+  val single_infinity : float32 = infinityf
+end
+
+> val it : int ref = {contents = 1;}
+> 
+val x : int ref = {contents = 1;}
+val f : (unit -> int)
+
+> val it : int = 1
+> val it : unit = ()
+> val it : int = 3
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : 'a list = []
+> val it : 'a list list = [[]]
+> val it : 'a option = None
+> val it : 'a list * 'b list = ([], [])
+> val it : x:'a -> 'a = <fun:clo at 757-3>
+> 
+val fff : x:'a -> 'a
+
+> val it : ('a -> 'a) = <fun:clo at 759-4>
+> 
+val note_ExpectDupMethod : string =
+  "Regression4927: Expect error due to duplicate methods in the "+[20 chars]
+
+> 
+      member this.M() = "string"
+  ----------------^
+
+stdin(765,17): error FS0438: Duplicate method. The method 'M' has the same name and signature as another method in this type.
+> 
+val note_ExpectDupProperty : string =
+  "Regression4927: Expect error due to duplicate properties in t"+[23 chars]
+
+> 
+      member this.P = "string"
+  ----------------^
+
+stdin(772,17): error FS0438: Duplicate method. The method 'get_P' has the same name and signature as another method in this type.
+> > val it : string = "NOTE: Expect IAPrivate less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(779,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBPublic' it is used in
+> val it : string = "NOTE: Expect IAPrivate less accessible IBInternal"
+> 
+      type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^^^
+
+stdin(784,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBInternal' it is used in
+> 
+module Regression5265_PriPri = begin
+  type private IAPrivate =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPrivate
+      abstract member Q : int
+    end
+end
+
+> val it : string = "NOTE: Expect IAInternal less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(793,19): error FS0410: The type 'IAInternal' is less accessible than the value, member or type 'IBPublic' it is used in
+> 
+module Regression5265_IntInt = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_IntPri = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPub = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type IBPublic =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubInt = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPri = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> val it : string =
+  "Regression4232: Expect an error about duplicate virtual methods from parent type"
+> 
+          override x.M(a:string) = 1
+  -------------------^
+
+stdin(825,20): error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member Regression4232.D.M : 'U -> int' and 'abstract member Regression4232.D.M : 'T -> int'
+> val it : string =
+  "** Expect AnAxHostSubClass to be accepted. AxHost has a newslot virtual RightToLeft property outscope RightToLeft on Control"
+> 
+type AnAxHostSubClass =
+  class
+    inherit System.Windows.Forms.AxHost
+    new : x:string -> AnAxHostSubClass
+  end
+
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables"
+> 
+  let (|A|B|) (x:int) = A x;;
+  -----^^^^^
+
+stdin(833,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (match value generic)"
+> 
+  let (|A|B|) (x:'a) = A x;;
+  -----^^^^^
+
+stdin(836,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (when active pattern also has parameters)"
+> 
+  let (|A|B|) (p:'a) (x:int) = A p;;
+  -----^^^^^
+
+stdin(839,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect OK, since error message says constraint should work!"
+> 
+val ( |A|B| ) : x:int -> Choice<int,unit>
+
+> val it : string = "** Expect error since active pattern is not a function!"
+> 
+  let (|A|B|) = failwith "" : Choice<int,int>;;
+  -----^^^^^
+
+stdin(845,6): error FS1209: Active pattern '|A|B|' is not a function
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on match val"
+> 
+val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on parameters"
+> 
+val ( |A|B| ) : aval:'a -> bval:'b -> x:bool -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is generic, but it typar from closure, so OK"
+> 
+val outer : x:'a -> (int -> 'a option)
+
+> val it : string =
+  "** Expect OK, BUG 472278: revert unintended breaking change to Active Patterns in F# 3.0"
+> 
+val ( |Check1| ) : a:int -> int * 'a option
+
+> > 
+module ReflectionEmit = begin
+  type IA =
+    interface
+      abstract member M : #IB -> int
+    end
+  and IB =
+    interface
+      abstract member M : #IA -> int
+    end
+  type IA2<'a when 'a :> IB2<'a> and 'a :> IA2<'a>> =
+    interface
+      abstract member M : int
+    end
+  and IB2<'b when 'b :> IA2<'b> and 'b :> IB2<'b>> =
+    interface
+      abstract member M : int
+    end
+end
+
+> val it : string =
+  "Regression_139182: Expect the follow code to be accepted without error"
+> 
+type S =
+  struct
+    member TheMethod : unit -> int64
+  end
+val theMethod : s:S -> int64
+type T =
+  class
+    new : unit -> T
+    member Prop5 : int64
+    static member Prop1 : int64
+    static member Prop2 : int64
+    static member Prop3 : int64
+    static member Prop4 : string
+  end
+
+> val it : System.Threading.ThreadLocal<int> list = [0 {IsValueCreated = false;
+                                                      Values = ?;}]
+> 
+type MyDU =
+  | Case1 of Val1: int * Val2: string
+  | Case2 of string * V2: bool * float
+  | Case3 of int
+  | Case4 of Item1: bool
+  | Case5 of bool * string
+  | Case6 of Val1: int * bool * string
+  | Case7 of Big Name: int
+val namedFieldVar1 : MyDU = Case1 (5,"")
+val namedFieldVar2 : MyDU = Case7 25
+
+> 
+exception MyNamedException1 of Val1: int * Val2: string
+exception MyNamedException2 of string * V2: bool * float
+exception MyNamedException3 of Data: int
+exception MyNamedException4 of bool
+exception MyNamedException5 of int * string
+exception MyNamedException6 of Val1: int * bool * string * Data8: float
+exception MyNamedException7 of Big Named Field: int
+val namedEx1 : exn = MyNamedException1 (5,"")
+val namedEx2 : exn = MyNamedException7 25
+
+> > > 
diff --git a/tests/fsharp/core/printing/z.output.test.off.bsl b/tests/fsharp/core/printing/z.output.test.off.bsl
new file mode 100644
index 0000000..2a0b5ae
--- /dev/null
+++ b/tests/fsharp/core/printing/z.output.test.off.bsl
@@ -0,0 +1,2017 @@
+
+> val it : unit = ()
+> > 
+val repeatId : string
+
+> 
+val repeatId : string
+
+
+namespace FSI_0005
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+
+namespace FSI_0006
+  val x1 : int
+  val x2 : string
+  val x3 : 'a option
+  val x4 : int option
+  val x5 : 'a list
+  val x6 : int list
+  val x7 : System.Windows.Forms.Form
+  val x8 : int [,]
+  val x9 : Lazy<string>
+
+> 
+val x1 : seq<string>
+val x2 : seq<string>
+val x3 : seq<string>
+val f1 : System.Windows.Forms.Form
+val fs : System.Windows.Forms.Form []
+val xs : string list
+val xa : string []
+val xa2 : string [,]
+val sxs0 : Set<string>
+
+> 
+val sxs1 : Set<string>
+
+> 
+val sxs2 : Set<string>
+
+> 
+val sxs3 : Set<string>
+
+> 
+val sxs4 : Set<string>
+
+> 
+val sxs200 : Set<string>
+
+> 
+val msxs0 : Map<int,string>
+
+> 
+val msxs1 : Map<int,string>
+
+> 
+val msxs2 : Map<int,string>
+
+> 
+val msxs3 : Map<int,string>
+
+> 
+val msxs4 : Map<int,string>
+
+> 
+val msxs200 : Map<int,string>
+
+> 
+module M = begin
+  val a : string
+  val b :
+    (seq<string> * seq<string> * seq<string> * System.Windows.Forms.Form) option *
+    (string list * string list * string [,]) option
+end
+type T =
+  class
+    new : a:int * b:int -> T
+    member AMethod : x:int -> int
+    member AProperty : int
+    static member StaticMethod : x:int -> int
+    static member StaticProperty : int
+  end
+val f_as_method : x:int -> int
+val f_as_thunk : (int -> int)
+val refCell : string ref
+module D1 = begin
+  val words : System.Collections.Generic.IDictionary<string,int>
+  val words2000 : System.Collections.Generic.IDictionary<int,string>
+end
+
+> > 
+module D2 = begin
+  val words : IDictionary<string,int>
+  val words2000 : IDictionary<int,string>
+end
+val opt1 : 'a option
+val opt1b : int option
+val opt4 : 'a option option option option
+val opt4b : int option option option option
+val opt5 : int list option option option option option list
+val mkStr : n:int -> string
+val strs : string []
+val str7s : string []
+val grids : string [,]
+
+> 
+type tree =
+  | L
+  | N of tree list
+val mkT : w:int -> d:int -> tree
+val tree : w:int -> d:int -> tree
+
+> [Building 2 4...done]
+
+val tree_2_4 : tree
+
+> [Building 2 6...done]
+
+val tree_2_6 : tree
+
+> [Building 2 8...done]
+
+val tree_2_8 : tree
+
+> [Building 2 10...done]
+
+val tree_2_10 : tree
+
+> [Building 2 12...done]
+
+val tree_2_12 : tree
+
+> [Building 2 14...done]
+
+val tree_2_14 : tree
+
+> [Building 3 8...done]
+
+val tree_3_8 : tree
+
+> [Building 4 8...done]
+
+val tree_4_8 : tree
+
+> [Building 5 8...done]
+
+val tree_5_8 : tree
+
+> [Building 6 8...done]
+
+val tree_6_8 : tree
+
+> [Building 5 3...done]
+
+val tree_5_3 : tree
+
+> > 
+type X =
+  | Var of int
+  | Bop of int * X * X
+val generate : x:int -> X
+
+> 
+val exps : X list
+
+> 
+module Exprs = begin
+  val x1 : X
+  val x2 : X
+  val x3 : X
+  val x4 : X
+  val x5 : X
+  val x6 : X
+  val x7 : X
+  val x8 : X
+  val x9 : X
+  val x10 : X
+  val x11 : X
+end
+
+> 
+type C =
+  class
+    new : x:string -> C
+    override ToString : unit -> string
+  end
+val c1 : C
+val csA : C []
+val csB : C []
+val csC : C []
+
+> 
+exception Abc
+
+> 
+exception AbcInt of int
+
+> 
+exception AbcString of string
+
+> 
+exception AbcExn of exn list
+
+> 
+exception AbcException of System.Exception list
+
+> 
+val exA1 : exn
+val exA2 : exn
+val exA3 : exn
+val exA4 : exn
+val exA5 : exn
+exception Ex0
+exception ExUnit of unit
+exception ExUnits of unit * unit
+exception ExUnitOption of unit option
+val ex0 : exn
+val exU : exn
+val exUs : exn
+val exUSome : exn
+val exUNone : exn
+type 'a T4063 = | AT4063 of 'a
+
+> 
+val valAT3063_12 : int T4063
+
+> 
+val valAT3063_True : bool T4063
+
+> 
+val valAT3063_text : string T4063
+
+> 
+val valAT3063_null : System.Object T4063
+
+> 
+type M4063<'a> =
+  class
+    new : x:'a -> M4063<'a>
+  end
+
+> 
+val v4063 : M4063<int>
+
+> 
+type Taaaaa<'a> =
+  class
+    new : unit -> Taaaaa<'a>
+  end
+
+> 
+type Taaaaa2<'a> =
+  class
+    inherit Taaaaa<'a>
+    new : unit -> Taaaaa2<'a>
+    member M : unit -> Taaaaa2<'a>
+  end
+
+> 
+type Tbbbbb<'a> =
+  class
+    new : x:'a -> Tbbbbb<'a>
+    member M : unit -> 'a
+  end
+
+> 
+type Tbbbbb2 =
+  class
+    inherit Tbbbbb<string>
+    new : x:string -> Tbbbbb2
+  end
+
+> val it : (unit -> string) = <fun:it at 198>
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte []
+end
+
+> 
+module RepeatedModule = begin
+  val repeatedByteLiteral : byte []
+end
+
+> val it : string = "Check #help"
+> 
+  F# Interactive directives:
+
+    #r "file.dll";;        Reference (dynamically load) the given DLL
+    #I "path";;            Add the given search path for referenced DLLs
+    #load "file.fs" ...;;  Load the given file(s) as if compiled and referenced
+    #time ["on"|"off"];;   Toggle timing on/off
+    #help;;                Display help
+    #quit;;                Exit
+
+  F# Interactive command line options:
+
+
+
+> val it : string = "Check #time on and then off"
+> 
+--> Timing now on
+
+> 
+--> Timing now off
+
+> val it : string = "Check #unknown command"
+> Invalid directive '#blaaaaaa '
+> val it : string =
+  "Check #I with a known directory (to avoid a warning, which includes the location of this file, which is fragile...)"
+> 
+--> Added '/' to library include path
+
+> 
+type internal T1 =
+  | A
+  | B
+
+> 
+type internal T2 =
+  {x: int;}
+
+> 
+type internal T3
+
+> 
+type internal T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+type T1 =
+  internal | A
+           | B
+
+> 
+type T2 =
+  internal {x: int;}
+
+> 
+type private T1 =
+  | A
+  | B
+
+> 
+type private T2 =
+  {x: int;}
+
+> 
+type T1 =
+  private | A
+          | B
+
+> 
+type T2 =
+  private {x: int;}
+
+> 
+type internal T1 =
+  private | A
+          | B
+
+> 
+type internal T2 =
+  private {x: int;}
+
+> 
+type private T3
+
+> 
+type private T4 =
+  class
+    new : unit -> T4
+  end
+
+> 
+exception X1 of int
+
+> 
+exception private X2 of int
+
+> 
+exception internal X3 of int
+
+> 
+type T0 =
+  class
+    new : unit -> T0
+  end
+type T1Post<'a> =
+  class
+    new : unit -> T1Post<'a>
+  end
+type 'a T1Pre =
+  class
+    new : unit -> 'a T1Pre
+  end
+
+> 
+type T0 with
+  member M : unit -> T0 list
+type T0 with
+  member P : T0 * T0
+type T0 with
+  member E : IEvent<int>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type T1Post<'a> with
+  member M : unit -> T1Post<'a> list
+type T1Post<'a> with
+  member P : T1Post<'a> * T1Post<'a>
+type T1Post<'a> with
+  member E : IEvent<obj>
+
+> 
+type 'a T1Pre with
+  member M : unit -> 'a T1Pre list
+type 'a T1Pre with
+  member P : 'a T1Pre * 'a T1Pre
+type 'a T1Pre with
+  member E : IEvent<obj>
+
+> 
+type r =
+  {f0: int;
+   f1: int;
+   f2: int;
+   f3: int;
+   f4: int;
+   f5: int;
+   f6: int;
+   f7: int;
+   f8: int;
+   f9: int;}
+val r10 : r
+val r10s : r []
+val r10s' : string * r []
+
+> 
+val x1564_A1 : int
+
+
+--> Added '\' to library include path
+
+
+val x1564_A2 : int
+
+
+--> Added '\' to library include path
+
+
+val x1564_A3 : int
+
+> 
+type internal Foo2 =
+  class
+    new : unit -> Foo2
+    new : x:int -> Foo2
+    new : x:int * y:int -> Foo2
+    private new : x:int * y:int * z:int -> Foo2
+    member Prop1 : int
+    member Prop2 : int
+    member private Prop3 : int
+  end
+
+> 
+module internal InternalM = begin
+  val x : int
+  type Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      private new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member private Prop3 : int
+    end
+  type private Foo3 =
+    class
+      new : unit -> Foo3
+      new : x:int -> Foo3
+      new : x:int * y:int -> Foo3
+      new : x:int * y:int * z:int -> Foo3
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+module internal PrivateM = begin
+  val private x : int
+  type private Foo2 =
+    class
+      new : unit -> Foo2
+      new : x:int -> Foo2
+      new : x:int * y:int -> Foo2
+      new : x:int * y:int * z:int -> Foo2
+      member Prop1 : int
+      member Prop2 : int
+      member Prop3 : int
+    end
+  type T1 =
+    | A
+    | B
+  type T2 =
+    {x: int;}
+  type T3
+  type T4 =
+    class
+      new : unit -> T4
+    end
+  type T5 =
+    | A
+    | B
+  type T6 =
+    {x: int;}
+  type private T7 =
+    | A
+    | B
+  type private T8 =
+    {x: int;}
+  type T9 =
+    private | A
+            | B
+  type T10 =
+    private {x: int;}
+  type T11 =
+    private | A
+            | B
+  type T12 =
+    private {x: int;}
+  type private T13
+  type private T14 =
+    class
+      new : unit -> T14
+    end
+end
+
+> val it : seq<int * string * int> =
+  seq
+    [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2);
+     (58, "2/10/2009", 1)]
+> 
+module Test4343a = begin
+  val mk : i:int -> string
+  val x100 : string
+  val x90 : string
+  val x80 : string
+  val x75 : string
+  val x74 : string
+  val x73 : string
+  val x72 : string
+  val x71 : string
+  val x70 : string
+end
+module Test4343b = begin
+  val fA : x:int -> int
+  val fB : x:'a -> y:'a -> 'a list
+  val gA : (int -> int)
+  val gB : ('a -> 'a -> 'a list)
+  val gAB : (int -> int) * ('a -> 'a -> 'a list)
+  val hB : ('a -> 'a -> 'a list)
+  val hA : (int -> int)
+end
+module Test4343c = begin
+  val typename<'a> : string
+  val typename2<'a> : string * string
+end
+module Test4343d = begin
+  val xList : int list
+  val xArray : int []
+  val xString : string
+  val xOption : int option
+  val xArray2 : (int * int) [,]
+  val xSeq : seq<int>
+end
+module Test4343e = begin
+  type C =
+    class
+      new : x:int -> C
+    end
+  val cA : C
+  val cB : C
+  val cAB : C * C * C list
+  type D =
+    class
+      new : x:int -> D
+      override ToString : unit -> string
+    end
+  val dA : D
+  val dB : D
+  val dAB : D * D * D list
+  module Generic = begin
+    type CGeneric<'a> =
+      class
+        new : x:'a -> CGeneric<'a>
+      end
+    val cA : C
+    val cB : C
+    val cAB : C * C * C list
+    type D<'a> =
+      class
+        new : x:'a -> D<'a>
+        override ToString : unit -> string
+      end
+    val dA : D<int>
+    val dB : D<int>
+    val dAB : D<int> * D<int> * D<int> list
+    val dC : D<bool>
+    val boxed_dABC : obj list
+  end
+end
+type F1 =
+  class
+    inherit System.Windows.Forms.Form
+    interface System.IDisposable
+    val x: F1
+    val x2: F1
+    abstract member MMM : bool -> bool
+    abstract member AAA : int
+    abstract member ZZZ : int
+    abstract member BBB : bool with set
+    member B : unit -> int
+    member D : unit -> int
+    member D : x:int -> int
+    member D : x:int * y:int -> int
+    override ToString : unit -> string
+    member D2 : int
+    member E : int
+    member D2 : int with set
+    member E : int with set
+    static val mutable private sx: F1
+    static val mutable private sx2: F1
+    static member A : unit -> int
+    static member C : unit -> int
+  end
+type IP =
+  struct
+    new : x:int * y:int -> IP
+    static val mutable private AA: IP
+  end
+module Regression4643 = begin
+  type RIP =
+    struct
+      new : x:int -> RIP
+      static val mutable private y: RIP
+    end
+  type arg_unused_is_RIP =
+    struct
+      new : x:RIP -> arg_unused_is_RIP
+    end
+  type arg_used_is_RIP =
+    struct
+      new : x:RIP -> arg_used_is_RIP
+      member X : RIP
+    end
+  type field_is_RIP =
+    struct
+      val x: RIP
+    end
+end
+type Either<'a,'b> =
+  | This of 'a
+  | That of 'b
+val catch : f:(unit -> 'a) -> Either<'a,(string * string)>
+val seqFindIndexFailure : Either<int,(string * string)>
+val seqFindFailure : Either<int,(string * string)>
+val seqPickFailure : Either<int,(string * string)>
+module Regression5218 = begin
+  val t1 : int
+  val t2 : int * int
+  val t3 : int * int * int
+  val t4 : int * int * int * int
+  val t5 : int * int * int * int * int
+  val t6 : int * int * int * int * int * int
+  val t7 : int * int * int * int * int * int * int
+  val t8 : int * int * int * int * int * int * int * int
+  val t9 : int * int * int * int * int * int * int * int * int
+  val t10 : int * int * int * int * int * int * int * int * int * int
+  val t11 : int * int * int * int * int * int * int * int * int * int * int
+  val t12 :
+    int * int * int * int * int * int * int * int * int * int * int * int
+  val t13 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int
+  val t14 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int
+  val t15 :
+    int * int * int * int * int * int * int * int * int * int * int * int *
+    int * int * int
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3739 = begin
+  type IB =
+    interface
+      abstract member AbstractMember : int -> int
+    end
+  type C<'a when 'a :> IB> =
+    class
+      new : unit -> C<'a>
+      static member StaticMember : x:'a -> int
+    end
+end
+
+> 
+module Regression3740 = begin
+  type Writer<'a> =
+    interface
+      abstract member get_path : unit -> string
+    end
+  type MyClass =
+    class
+      interface Writer<int>
+      val path: string
+    end
+end
+
+> 
+type Regression4319_T2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> string
+  end
+
+> 
+  type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(572,42): warning FS1172: Infix operator member '+-+-+' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T0 =
+  class
+    static member ( +-+-+ ) : string
+  end
+
+> 
+  type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+  -----------------------------------------^^^^^
+
+stdin(573,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1 =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+  -----------------------------------------^^^^^
+
+stdin(574,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1b =
+  class
+    static member ( +-+-+ ) : x:'a -> string
+  end
+
+> 
+  type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(575,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1c =
+  class
+    static member ( +-+-+ ) : x:('a * 'b) -> string
+  end
+
+> 
+  type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(576,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T1d =
+  class
+    static member ( +-+-+ ) : x:(int * int) -> string
+  end
+
+> 
+  type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(578,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_T3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> string
+  end
+
+> 
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1 =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U1b =
+  class
+    static member ( +-+-+ ) : x:'a -> moreArgs:'b -> string
+  end
+
+> 
+  type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(581,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U2 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b -> moreArgs:'c -> string
+  end
+
+> 
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_U3 =
+  class
+    static member ( +-+-+ ) : x:'a * y:'b * z:'c -> moreArgs:'d -> string
+  end
+
+> 
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS1172: Infix operator member ':=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS0086: The name '(:=)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS1172: Infix operator member '&' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS0086: The name '(&)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name 'op_Amp' instead.
+
+      static member (&^)             = "AMP_AMP"
+  -------------------^^
+
+stdin(590,20): warning FS1172: Infix operator member '&^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS1172: Infix operator member '=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS0086: The name '(=)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name 'op_Equality' instead.
+
+      static member (!=)             = "INFIX_COMPARE_OP"
+  -------------------^^
+
+stdin(593,20): warning FS1172: Infix operator member '!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(597,20): warning FS1172: Infix operator member '...=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^^
+
+stdin(598,20): warning FS1172: Infix operator member '...!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(599,20): warning FS1172: Infix operator member '...<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(600,20): warning FS1172: Infix operator member '...>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ($)              = "DOLLAR"
+  -------------------^
+
+stdin(602,20): warning FS1172: Infix operator member '$' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS1172: Infix operator member '<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS0086: The name '(<)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_LessThan' instead.
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS1172: Infix operator member '>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS0086: The name '(>)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_GreaterThan' instead.
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS1172: Infix operator member '@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS0086: The name '(@)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS1172: Infix operator member '^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS0086: The name '(^)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(607,20): warning FS1172: Infix operator member '...@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(608,20): warning FS1172: Infix operator member '...^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (%)              = "PERCENT_OP"        
+  -------------------^
+
+stdin(609,20): warning FS1172: Infix operator member '%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (-)              = "MINUS"
+  -------------------^
+
+stdin(611,20): warning FS1172: Infix operator member '-' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( * )            = "STAR"
+  --------------------^
+
+stdin(612,21): warning FS1172: Infix operator member '*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+  -------------------^
+
+stdin(614,20): warning FS1172: Infix operator member '/' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(616,21): warning FS1172: Infix operator member '...*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(617,21): warning FS1172: Infix operator member '.../' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+  --------------------^^^^
+
+stdin(618,21): warning FS1172: Infix operator member '...%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ** )           = "INFIX_STAR_STAR_OP"
+  --------------------^^
+
+stdin(619,21): warning FS1172: Infix operator member '**' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+type Regression4319_check =
+  class
+    static member ( & ) : string
+    static member ( &^ ) : string
+    static member ( @ ) : string
+    static member ( != ) : string
+    static member ( := ) : string
+    static member ( ^ ) : string
+    static member ( / ) : string
+    static member ( $ ) : string
+    static member ( ...@ ) : string
+    static member ( ...!= ) : string
+    static member ( .../ ) : string
+    static member ( ...= ) : string
+    static member ( ...> ) : string
+    static member ( ...^ ) : string
+    static member ( ...< ) : string
+    static member ( ...* ) : string
+    static member ( ...% ) : string
+    static member ( = ) : string
+    static member ( ** ) : string
+    static member ( > ) : string
+    static member ( < ) : string
+    static member ( % ) : string
+    static member ( * ) : string
+    static member ( - ) : string
+  end
+
+> 
+      member this.ToString() = "ABC"
+  ----------------^^^^^^^^
+
+stdin(624,17): warning FS0864: This new member hides the abstract member 'System.Object.ToString() : string'. Rename the member or use 'override' instead.
+Expect ABC = ABC
+
+type Regression4469 =
+  class
+    new : unit -> Regression4469
+    member ToString : unit -> string
+  end
+val r4469 : Regression4469
+val it : unit
+
+> Expect ABC = ABC
+val it : unit = ()
+> 
+module Regression1019_short = begin
+  val double_nan : float
+  val double_infinity : float
+  val single_nan : float32
+  val single_infinity : float32
+end
+module Regression1019_long = begin
+  val double_nan : float
+  val double_infinity : float
+  val single_nan : float32
+  val single_infinity : float32
+end
+
+> val it : int ref = {contents = 1;}
+> 
+val x : int ref
+val f : (unit -> int)
+
+> val it : int = 1
+> val it : unit = ()
+> val it : int = 3
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : int [] =
+  [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0;
+    ...|]
+> val it : 'a list = []
+> val it : 'a list list = [[]]
+> val it : 'a option = None
+> val it : 'a list * 'b list = ([], [])
+> val it : x:'a -> 'a = <fun:clo at 757-3>
+> 
+val fff : x:'a -> 'a
+
+> val it : ('a -> 'a) = <fun:clo at 759-4>
+> 
+val note_ExpectDupMethod : string
+
+> 
+      member this.M() = "string"
+  ----------------^
+
+stdin(765,17): error FS0438: Duplicate method. The method 'M' has the same name and signature as another method in this type.
+> 
+val note_ExpectDupProperty : string
+
+> 
+      member this.P = "string"
+  ----------------^
+
+stdin(772,17): error FS0438: Duplicate method. The method 'get_P' has the same name and signature as another method in this type.
+> > val it : string = "NOTE: Expect IAPrivate less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(779,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBPublic' it is used in
+> val it : string = "NOTE: Expect IAPrivate less accessible IBInternal"
+> 
+      type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^^^
+
+stdin(784,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBInternal' it is used in
+> 
+module Regression5265_PriPri = begin
+  type private IAPrivate =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPrivate
+      abstract member Q : int
+    end
+end
+
+> val it : string = "NOTE: Expect IAInternal less accessible IBPublic"
+> 
+      type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(793,19): error FS0410: The type 'IAInternal' is less accessible than the value, member or type 'IBPublic' it is used in
+> 
+module Regression5265_IntInt = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_IntPri = begin
+  type internal IAInternal =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAInternal
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPub = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type IBPublic =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubInt = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type internal IBInternal =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> 
+module Regression5265_PubPri = begin
+  type IAPublic =
+    interface
+      abstract member P : int
+    end
+  type private IBPrivate =
+    interface
+      inherit IAPublic
+      abstract member Q : int
+    end
+end
+
+> val it : string =
+  "Regression4232: Expect an error about duplicate virtual methods from parent type"
+> 
+          override x.M(a:string) = 1
+  -------------------^
+
+stdin(825,20): error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member Regression4232.D.M : 'U -> int' and 'abstract member Regression4232.D.M : 'T -> int'
+> val it : string =
+  "** Expect AnAxHostSubClass to be accepted. AxHost has a newslot virtual RightToLeft property outscope RightToLeft on Control"
+> 
+type AnAxHostSubClass =
+  class
+    inherit System.Windows.Forms.AxHost
+    new : x:string -> AnAxHostSubClass
+  end
+
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables"
+> 
+  let (|A|B|) (x:int) = A x;;
+  -----^^^^^
+
+stdin(833,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (match value generic)"
+> 
+  let (|A|B|) (x:'a) = A x;;
+  -----^^^^^
+
+stdin(836,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect error because the active pattern result contains free type variables (when active pattern also has parameters)"
+> 
+  let (|A|B|) (p:'a) (x:int) = A p;;
+  -----^^^^^
+
+stdin(839,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+> val it : string =
+  "** Expect OK, since error message says constraint should work!"
+> 
+val ( |A|B| ) : x:int -> Choice<int,unit>
+
+> val it : string = "** Expect error since active pattern is not a function!"
+> 
+  let (|A|B|) = failwith "" : Choice<int,int>;;
+  -----^^^^^
+
+stdin(845,6): error FS1209: Active pattern '|A|B|' is not a function
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on match val"
+> 
+val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is not too generic, typars depend on parameters"
+> 
+val ( |A|B| ) : aval:'a -> bval:'b -> x:bool -> Choice<'a,'b>
+
+> val it : string =
+  "** Expect OK since active pattern result is generic, but it typar from closure, so OK"
+> 
+val outer : x:'a -> (int -> 'a option)
+
+> val it : string =
+  "** Expect OK, BUG 472278: revert unintended breaking change to Active Patterns in F# 3.0"
+> 
+val ( |Check1| ) : a:int -> int * 'a option
+
+> > 
+module ReflectionEmit = begin
+  type IA =
+    interface
+      abstract member M : #IB -> int
+    end
+  and IB =
+    interface
+      abstract member M : #IA -> int
+    end
+  type IA2<'a when 'a :> IB2<'a> and 'a :> IA2<'a>> =
+    interface
+      abstract member M : int
+    end
+  and IB2<'b when 'b :> IA2<'b> and 'b :> IB2<'b>> =
+    interface
+      abstract member M : int
+    end
+end
+
+> val it : string =
+  "Regression_139182: Expect the follow code to be accepted without error"
+> 
+type S =
+  struct
+    member TheMethod : unit -> int64
+  end
+val theMethod : s:S -> int64
+type T =
+  class
+    new : unit -> T
+    member Prop5 : int64
+    static member Prop1 : int64
+    static member Prop2 : int64
+    static member Prop3 : int64
+    static member Prop4 : string
+  end
+
+> val it : System.Threading.ThreadLocal<int> list = [0 {IsValueCreated = false;
+                                                      Values = ?;}]
+> 
+type MyDU =
+  | Case1 of Val1: int * Val2: string
+  | Case2 of string * V2: bool * float
+  | Case3 of int
+  | Case4 of Item1: bool
+  | Case5 of bool * string
+  | Case6 of Val1: int * bool * string
+  | Case7 of Big Name: int
+val namedFieldVar1 : MyDU
+val namedFieldVar2 : MyDU
+
+> 
+exception MyNamedException1 of Val1: int * Val2: string
+exception MyNamedException2 of string * V2: bool * float
+exception MyNamedException3 of Data: int
+exception MyNamedException4 of bool
+exception MyNamedException5 of int * string
+exception MyNamedException6 of Val1: int * bool * string * Data8: float
+exception MyNamedException7 of Big Named Field: int
+val namedEx1 : exn
+val namedEx2 : exn
+
+> > > 
diff --git a/tests/fsharp/core/printing/z.output.test.quiet.bsl b/tests/fsharp/core/printing/z.output.test.quiet.bsl
new file mode 100644
index 0000000..d14a66e
--- /dev/null
+++ b/tests/fsharp/core/printing/z.output.test.quiet.bsl
@@ -0,0 +1,288 @@
+[Building 2 4...done]
+[Building 2 6...done]
+[Building 2 8...done]
+[Building 2 10...done]
+[Building 2 12...done]
+[Building 2 14...done]
+[Building 3 8...done]
+[Building 4 8...done]
+[Building 5 8...done]
+[Building 6 8...done]
+[Building 5 3...done]
+
+  type Regression4319_T0  = static member (+-+-+)             = "0 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(572,42): warning FS1172: Infix operator member '+-+-+' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_T1  = static member (+-+-+) x           = "1 argument";;
+  -----------------------------------------^^^^^
+
+stdin(573,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_T1b = static member (+-+-+) (x)         = "1 (argument) [brackets make no diff]";;
+  -----------------------------------------^^^^^
+
+stdin(574,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_T1c = static member (+-+-+) x           = let a,b = x in "1 argument, tuple typed from RHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(575,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_T1d = static member (+-+-+) (x:int*int) = "1 argument, tuple typed from LHS. Still not OK";;
+  -----------------------------------------^^^^^
+
+stdin(576,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_T3  = static member (+-+-+) (x,y,z)          = "3 arguments";;
+  -----------------------------------------^^^^^
+
+stdin(578,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1  = static member (+-+-+) x       moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(579,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1173: Infix operator member '+-+-+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U1b = static member (+-+-+) (x)     moreArgs = "1 (argument) [brackets make no diff] and further args";;
+  -----------------------------------------^^^^^
+
+stdin(580,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U2  = static member (+-+-+) (x,y)   moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(581,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1173: Infix operator member '+-+-+' has 3 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+  type Regression4319_U3  = static member (+-+-+) (x,y,z) moreArgs = "1 argument and further args";;
+  -----------------------------------------^^^^^
+
+stdin(582,42): warning FS1174: Infix operator member '+-+-+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS1172: Infix operator member ':=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (:=)             = "COLON_EQUALS"
+  -------------------^^
+
+stdin(585,20): warning FS0086: The name '(:=)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS1172: Infix operator member '&' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (&)              = "AMP"
+  -------------------^
+
+stdin(589,20): warning FS0086: The name '(&)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name 'op_Amp' instead.
+
+      static member (&^)             = "AMP_AMP"
+  -------------------^^
+
+stdin(590,20): warning FS1172: Infix operator member '&^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS1172: Infix operator member '=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (=)              = "EQUALS"
+  -------------------^
+
+stdin(591,20): warning FS0086: The name '(=)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name 'op_Equality' instead.
+
+      static member (!=)             = "INFIX_COMPARE_OP"
+  -------------------^^
+
+stdin(593,20): warning FS1172: Infix operator member '!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...=)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(597,20): warning FS1172: Infix operator member '...=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...!=)         = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^^
+
+stdin(598,20): warning FS1172: Infix operator member '...!=' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...<)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(599,20): warning FS1172: Infix operator member '...<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...>)          = "INFIX_COMPARE_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(600,20): warning FS1172: Infix operator member '...>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ($)              = "DOLLAR"
+  -------------------^
+
+stdin(602,20): warning FS1172: Infix operator member '$' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS1172: Infix operator member '<' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (<)              = "LESS"
+  -------------------^
+
+stdin(603,20): warning FS0086: The name '(<)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_LessThan' instead.
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS1172: Infix operator member '>' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (>)              = "GREATER"
+  -------------------^
+
+stdin(604,20): warning FS0086: The name '(>)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name 'op_GreaterThan' instead.
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS1172: Infix operator member '@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (@)              = "INFIX_AT_HAT_OP"
+  -------------------^
+
+stdin(605,20): warning FS0086: The name '(@)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS1172: Infix operator member '^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (^)              = "INFIX_AT_HAT_OP"        
+  -------------------^
+
+stdin(606,20): warning FS0086: The name '(^)' should not be used as a member name because it is given a standard definition in the F# library over fixed types
+
+      static member (...@)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(607,20): warning FS1172: Infix operator member '...@' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (...^)          = "INFIX_AT_HAT_OP" // with $. prefix    
+  -------------------^^^^
+
+stdin(608,20): warning FS1172: Infix operator member '...^' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (%)              = "PERCENT_OP"        
+  -------------------^
+
+stdin(609,20): warning FS1172: Infix operator member '%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (-)              = "MINUS"
+  -------------------^
+
+stdin(611,20): warning FS1172: Infix operator member '-' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( * )            = "STAR"
+  --------------------^
+
+stdin(612,21): warning FS1172: Infix operator member '*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member (/)              = "INFIX_STAR_DIV_MOD_OP"
+  -------------------^
+
+stdin(614,20): warning FS1172: Infix operator member '/' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...* )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(616,21): warning FS1172: Infix operator member '...*' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( .../ )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix    
+  --------------------^^^^
+
+stdin(617,21): warning FS1172: Infix operator member '.../' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ...% )        = "INFIX_STAR_DIV_MOD_OP" // with $. prefix
+  --------------------^^^^
+
+stdin(618,21): warning FS1172: Infix operator member '...%' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      static member ( ** )           = "INFIX_STAR_STAR_OP"
+  --------------------^^
+
+stdin(619,21): warning FS1172: Infix operator member '**' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+      member this.ToString() = "ABC"
+  ----------------^^^^^^^^
+
+stdin(624,17): warning FS0864: This new member hides the abstract member 'System.Object.ToString() : string'. Rename the member or use 'override' instead.
+Expect ABC = ABC
+Expect ABC = ABC
+
+      member this.M() = "string"
+  ----------------^
+
+stdin(765,17): error FS0438: Duplicate method. The method 'M' has the same name and signature as another method in this type.
+
+      member this.P = "string"
+  ----------------^
+
+stdin(772,17): error FS0438: Duplicate method. The method 'get_P' has the same name and signature as another method in this type.
+
+      type public   IBPublic   = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(779,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBPublic' it is used in
+
+      type internal IBInternal = interface inherit IAPrivate abstract Q : int end
+  ------------------^^^^^^^^^^
+
+stdin(784,19): error FS0410: The type 'IAPrivate' is less accessible than the value, member or type 'IBInternal' it is used in
+
+      type public   IBPublic   = interface inherit IAInternal abstract Q : int end
+  ------------------^^^^^^^^
+
+stdin(793,19): error FS0410: The type 'IAInternal' is less accessible than the value, member or type 'IBPublic' it is used in
+
+          override x.M(a:string) = 1
+  -------------------^
+
+stdin(825,20): error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member Regression4232.D.M : 'U -> int' and 'abstract member Regression4232.D.M : 'T -> int'
+
+  let (|A|B|) (x:int) = A x;;
+  -----^^^^^
+
+stdin(833,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+
+  let (|A|B|) (x:'a) = A x;;
+  -----^^^^^
+
+stdin(836,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+
+  let (|A|B|) (p:'a) (x:int) = A p;;
+  -----^^^^^
+
+stdin(839,6): error FS1210: Active pattern '|A|B|' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice<int,unit> = A x'
+
+  let (|A|B|) = failwith "" : Choice<int,int>;;
+  -----^^^^^
+
+stdin(845,6): error FS1209: Active pattern '|A|B|' is not a function
diff --git a/tests/fsharp/core/queriesCustomQueryOps/build.bat b/tests/fsharp/core/queriesCustomQueryOps/build.bat
new file mode 100644
index 0000000..d683f6b
--- /dev/null
+++ b/tests/fsharp/core/queriesCustomQueryOps/build.bat
@@ -0,0 +1,50 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    call ..\..\single-neg-test.bat negativetest
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesCustomQueryOps/negativetest.bsl b/tests/fsharp/core/queriesCustomQueryOps/negativetest.bsl
new file mode 100644
index 0000000..3f55d94
--- /dev/null
+++ b/tests/fsharp/core/queriesCustomQueryOps/negativetest.bsl
@@ -0,0 +1,14 @@
+
+negativetest.fsx(20,5,20,17): typecheck error FS3090: An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead.
+
+negativetest.fsx(28,5,28,8): typecheck error FS3146: 'try/with' expressions may not be used in queries
+
+negativetest.fsx(35,5,35,8): typecheck error FS3141: 'try/finally' expressions may not be used in queries
+
+negativetest.fsx(44,9,44,17): typecheck error FS3086: A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression
+
+negativetest.fsx(52,9,52,17): typecheck error FS3086: A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression
+
+negativetest.fsx(60,15,60,23): typecheck error FS3086: A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression
+
+negativetest.fsx(66,6,66,14): typecheck error FS3086: A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression
diff --git a/tests/fsharp/core/queriesCustomQueryOps/negativetest.fsx b/tests/fsharp/core/queriesCustomQueryOps/negativetest.fsx
new file mode 100644
index 0000000..d2103d8
--- /dev/null
+++ b/tests/fsharp/core/queriesCustomQueryOps/negativetest.fsx
@@ -0,0 +1,68 @@
+module NegativeTests
+
+type DoNothingBuilder() = 
+    member this.Yield(v) = [v]
+    member this.Delay f = f
+    member this.Run(f) = f()
+    member this.Zero() = []
+    member this.For(e, b) = List.collect b e
+    member this.TryWith(b, h) = 
+        try b()
+        with e -> h e
+    member this.TryFinally(b, c) = try b() finally c()
+    [<CustomOperation("select")>]
+    member this.Select(v, [<ProjectionParameter>]f) = List.map f v 
+         
+let builder = DoNothingBuilder()
+
+// if\then\else are not allowed in query expressions
+query {
+    if true then 
+        yield 1 
+    else 
+        yield 2
+}
+
+// try\with are not allowed in query expressions
+query {
+    try
+        yield 1
+    with _ -> yield 2
+}
+
+// try\finally are not allowed in query expressions
+query {
+    try 
+        yield 1
+    finally
+        printfn "1"
+}
+
+// custom operators are not allowed in if\then\else
+builder {
+    if true then
+        select 1
+    else
+        select 2
+}
+
+// custom operators are not allowed in try\with - 'try'
+builder {
+    try
+        select 1
+    with _ -> yield 1
+}
+
+// custom operators are not allowed in try\with - 'with'
+builder {
+    try
+        yield 1
+    with _ -> select 1
+}
+
+// custom operators are not allowed in try\finally
+builder {
+    try
+     select 1
+    finally  ()
+}
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesCustomQueryOps/run.bat b/tests/fsharp/core/queriesCustomQueryOps/run.bat
new file mode 100644
index 0000000..9cde240
--- /dev/null
+++ b/tests/fsharp/core/queriesCustomQueryOps/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesCustomQueryOps/test.fsx b/tests/fsharp/core/queriesCustomQueryOps/test.fsx
new file mode 100644
index 0000000..5bcfe4f
--- /dev/null
+++ b/tests/fsharp/core/queriesCustomQueryOps/test.fsx
@@ -0,0 +1,468 @@
+// #Quotations #Query
+#if Portable
+module Core_queriesCustomQueryOps
+#endif
+
+
+#nowarn "57"
+
+open System
+open System.Linq
+open System.Collections
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+#if NetCore
+#else
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+#endif
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected %A got %A" s v2 v1
+
+    let test s b = check s b true
+
+
+module ShapesOfQueryQuotations =
+    open Microsoft.FSharp.Quotations
+    open Microsoft.FSharp.Quotations.Patterns
+    open Microsoft.FSharp.Quotations.DerivedPatterns
+    open Microsoft.FSharp.Linq
+    /// Detect a call to query.Run
+    let (|CallQueryRunAsEnumerable|_|) = function SpecificCall <@ (fun (query:QueryBuilder,x:Expr<QuerySource<_,IEnumerable>>) -> query.Run(x)) @>(None, [_],[_;e]) -> Some e | _ -> None
+    let (|CallQueryRunAsValue|_|) = function SpecificCall <@ (fun (query:QueryBuilder,x:Expr<int>) -> query.Run(x)) @>(None, [_],[_;e]) -> Some e | _ -> None
+    let (|CallQueryRunAsQueryable|_|) = function SpecificCall <@ (fun (query:QueryBuilder,x:Expr<QuerySource<_,IQueryable>>) -> query.Run(x)) @>(Some _, [_],[e]) -> Some e | _ -> None
+    /// Detect a use of query { ... }
+    let (|QuerySyntaxForEnumerable|_|) = function Application(Lambda(_,CallQueryRunAsEnumerable e),_) -> Some e | _ -> None
+    let (|QuerySyntaxForQueryable|_|) = function Application(Lambda(_,CallQueryRunAsQueryable e),_) -> Some e | _ -> None
+    let (|QuerySyntaxForValue|_|) = function Application(Lambda(_,CallQueryRunAsValue e),_) -> Some e | _ -> None
+    /// Detect a call to query.For
+    let (|CallQueryFor|_|) = function SpecificCall <@ (fun (query:QueryBuilder) -> query.For) @>(_, [_;_;_;_],[sq;b]) -> Some (sq,b) | _ -> None
+
+
+    /// REVIEW: there is an extra 'let' inserted here. This feels unfortunate. I presume it's
+    /// there in F# 2.0 quotations for 'async' etc.
+    let (|OuterFor|_|) = function CallQueryFor(sq,Lambda(v,Let(v2,Var ev,e))) when v = ev -> Some (v2,sq,e) | _ -> None
+
+    /// Detect a use of 'yield' inside a query
+    let (|SourceEnumerable|_|) = function SpecificCall <@ (fun (query:QueryBuilder,x:seq<int>) -> query.Source x) @>(_, [_],[e]) -> Some e | _ -> None
+    let (|Yield|_|) = function SpecificCall <@ (fun (query:QueryBuilder) -> query.Yield) @>(_, [_;_],[e]) -> Some e | _ -> None
+
+    /// Detect a use of 'for .. in do yield x' inside a query
+    let (|FinalFor|_|) = function OuterFor(v,sq,Yield e) -> Some (v,sq,e) | _ -> None
+
+    let (|Empty|_|) = function SpecificCall <@ (fun (query:QueryBuilder) -> query.Zero) @>(_,_,_) -> Some () | _ -> None
+    let (|Pipe|_|) = function SpecificCall <@ (|>) @>(_,_,[x;f]) -> Some (x,f) | _ -> None
+    let (|CallDistinct|_|) = function SpecificCall <@ (fun (query:QueryBuilder) -> query.Distinct)@>(_,_,[x]) -> Some x | _ -> None
+    let (|CallSelect|_|) = function SpecificCall <@ (fun (query:QueryBuilder) -> query.Select) @>(_,_,[x;y]) -> Some (x,y) | _ -> None
+
+        // TODO: check nested .Max(), .Min(), .Distinct() etc. on IQueryable sources execute on the database. I think this will _not_
+        // be the case as the type-based resolution of these will be as IEnumerable calls.
+
+    test "vrenjkr90kj1" 
+       (match <@ query { for x in [1] -> x } @> with 
+        | QuerySyntaxForEnumerable(Quote(FinalFor(v,SourceEnumerable (Coerce(sq,_)),res))) when sq = <@@ [1] @@> && res = Expr.Var(v) -> true
+        // The following are for debugging this test in case something goes wrong....
+        | QuerySyntaxForEnumerable(Quote(FinalFor(v,SourceEnumerable sq,res))) -> printfn "SourceEnumerable found, sq = %A" sq; false
+        | QuerySyntaxForEnumerable(Quote(FinalFor(v,sq,res))) -> printfn "FinalFor found, sq = %A" sq; false
+        | QuerySyntaxForEnumerable(Quote(OuterFor(v,sq,res))) -> printfn "OuterFor found, v = %A, res = %A, sq = %A" v res sq; false
+        | QuerySyntaxForEnumerable(Quote(CallQueryFor(sq,b))) -> printfn "CallQueryFor found, sq = %A, b = %A" sq b; false
+        | QuerySyntaxForEnumerable(Quote(sq)) -> printfn "QuerySyntaxForEnumerable(_), sq = %A" sq; false 
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj2" 
+       (match <@ query { for x in [1] do yield x } @> with 
+        | QuerySyntaxForEnumerable(Quote(FinalFor(v,SourceEnumerable(Coerce(sq,_)),res))) when sq = <@@ [1] @@> && res = Expr.Var(v) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj3" 
+       (match <@ query { for x in [1] do for y in [2] do yield x } @> with 
+        | QuerySyntaxForEnumerable(Quote(OuterFor(v1,SourceEnumerable(Coerce(sq1,_)),FinalFor(v2,SourceEnumerable(Coerce(sq2,_)),res)))) when sq1 = <@@ [1] @@> && sq2 = <@@ [2] @@> && res = Expr.Var(v1) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj5" 
+       (match <@ query { if true then yield 1 } @> with 
+        | QuerySyntaxForQueryable(Quote(IfThenElse(Bool true,Yield(Int32 1),Empty))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj7" 
+       (match <@ query { for x in [1] do distinct } @> with 
+        | QuerySyntaxForEnumerable(Quote(CallDistinct(OuterFor(vx,SourceEnumerable(Coerce(sq,_)),Yield (Var res))))) when vx = res && sq = <@@ [1] @@>  && res = vx -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj8" 
+       (match <@ query { for x in [1] do select x } @> with 
+        //| QuerySyntaxForEnumerable(Quote(OuterFor(vx,SourceEnumerable(Coerce(sq,_)),Yield (Var res)))) when vx = res && sq = <@@ [1] @@>  && res = vx -> true
+        | QuerySyntaxForEnumerable(Quote(CallSelect(OuterFor(vx,SourceEnumerable(Coerce(sq,_)),Yield (Var res)), Lambda(v4,Var v4b)))) when v4 = v4b && vx = res && sq = <@@ [1] @@>  && res = vx -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+module QuerySyntaxForEnumerableForAnFSharpType = 
+
+
+    type EventBuilder() = 
+        member __.For(ev:IObservable<'T>, loop:('T -> #IObservable<'U>)) : IObservable<'U> = failwith ""
+        member __.Yield(v:'T) : IObservable<'T> = failwith ""
+        member __.Quote(v:Quotations.Expr<'T>) : Expr<'T> = v
+        member __.Run(x:Expr<'T>) = Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation x :?> 'T
+         
+        [<CustomOperation("where",MaintainsVariableSpace=true)>]
+        member __.Where (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        [<CustomOperation("select")>]
+        member __.Select (x, [<ProjectionParameter>] f) = Observable.map f x
+
+        [<CustomOperation("choose")>]
+        member __.Choose (x, [<ProjectionParameter>] f) = Observable.choose f x
+
+        [<CustomOperation("joinLikeOp",IsLikeJoin=true,JoinConditionWord="squeeze")>]
+        member __.JoinLikeOp (outerSource:IObservable<'Outer>,  innerSource:IObservable<'Inner>,  outerKeySelector:('Outer -> 'Key),  innerKeySelector:('Inner -> 'Key),  resultSelector:('Outer -> 'Inner -> 'Result)) : IObservable<'Result>
+            = failwith ""
+
+        [<CustomOperation("groupJoinLikeOp",IsLikeGroupJoin=true)>]
+        member __.GroupJoinLikeOp (outerSource:IObservable<'Outer>,  innerSource:IObservable<'Inner>,  outerKeySelector:('Outer -> 'Key),  innerKeySelector:('Inner -> 'Key),  resultSelector:('Outer -> IObservable<'Inner> -> 'Result)) : IObservable<'Result>
+            = failwith ""
+
+        [<CustomOperation("zipLikeOp",IsLikeZip=true)>]
+        member __.ZipLikeOp (outerSource:IObservable<'Outer>,  innerSource:IObservable<'Inner>,  resultSelector:('Outer -> 'Inner -> 'Result)) : IObservable<'Result>
+            = failwith ""
+
+    // intrinsic extension member
+    type EventBuilder with 
+        [<CustomOperation("action",MaintainsVariableSpace=true)>]
+        member __.Action (source:IObservable<_>, [<ProjectionParameter>] f)  = Observable.add f source; source
+
+    // extrinsic extension member
+    /// Check that a custom operator defined by an extension member works
+    [<AutoOpen>]
+    module ExtensionMembers = 
+        type EventBuilder with 
+            [<CustomOperation("scanSumBy")>]
+            member inline __.ScanSumBy (source, [<ProjectionParameter>] f : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("scanSumByWithInto",AllowIntoPattern=true) >]
+            member inline __.ScanSumByWithInto (source, [<ProjectionParameter>] f : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithTwoArgs")>]
+            member inline __.CustomOpWithTwoArgs (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithThreeArgs")>]
+            member inline __.CustomOpWithThreeArgs (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U, [<ProjectionParameter>] f3 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b + f3 b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithFourArgs")>]
+            member inline __.CustomOpWithFourArgs (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U, [<ProjectionParameter>] f3 : 'T -> 'U, [<ProjectionParameter>] f4 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b + f3 b + f4 b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithTwoArgsWithInto",AllowIntoPattern=true)>]
+            member inline __.CustomOpWithTwoArgsWithInto (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithThreeArgsWithInto",AllowIntoPattern=true)>]
+            member inline __.CustomOpWithThreeArgsWithInto (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U, [<ProjectionParameter>] f3 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b + f3 b) LanguagePrimitives.GenericZero<'U> source
+
+            [<CustomOperation("customOpWithFourArgsWithInto",AllowIntoPattern=true)>]
+            member inline __.CustomOpWithFourArgsWithInto (source, [<ProjectionParameter>] f1 : 'T -> 'U, [<ProjectionParameter>] f2 : 'T -> 'U, [<ProjectionParameter>] f3 : 'T -> 'U, [<ProjectionParameter>] f4 : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f1 b + f2 b + f3 b + f4 b) LanguagePrimitives.GenericZero<'U> source
+
+    let myquery = EventBuilder()
+    let mybuilder = EventBuilder()
+
+    //---------------------------------------------------------------
+
+    type PretendForm() = 
+    
+       let mouseClickEvent = new Event<int * int >()
+       let beepEvent = new Event<string>()
+       member x.TriggerMouseClick = mouseClickEvent.Trigger(10,10)
+       member x.MouseClick = mouseClickEvent.Publish
+
+       member x.TriggerBeep = beepEvent.Trigger "beep"
+       member x.Beep = beepEvent.Publish
+
+    //let f = new System.Windows.Forms.Form()
+    let testWhichWeDontActuallyRun() = 
+        let f = new PretendForm()
+
+        let e1 =     
+          myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      scanSumBy (snd x) }
+
+        let e2 =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      scanSumByWithInto (snd x) into clickCount
+                      action (printfn "%d clicks" clickCount)}
+
+        let e3 =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithTwoArgs (snd x) (snd x) }
+
+        let e3into =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithTwoArgsWithInto (snd x) (snd x) into clickCount
+                      action (printfn "%d clicks" clickCount)}
+
+        let e4 =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithThreeArgs (snd x) (snd x) (snd x) }
+        let e4into =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithThreeArgsWithInto (snd x) (snd x) (snd x) into clickCount
+                      action (printfn "%d clicks" clickCount)}
+
+        let e5 =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithFourArgs (snd x) (snd x) (snd x) (snd x) }
+
+        let e5into =     
+            myquery { for x in f.MouseClick do 
+                      where (fst x < 100)
+                      customOpWithFourArgsWithInto (snd x) (snd x) (snd x) (snd x) into clickCount
+                      action (printfn "%d clicks" clickCount)}
+
+
+        let join1 =     
+            myquery { for x in f.MouseClick do 
+                      joinLikeOp y in f.Beep squeeze (string (fst x) = y) 
+                      select (x,y) }
+
+        let join2 =     
+            myquery { for x in f.MouseClick do 
+                      groupJoinLikeOp y in f.Beep on (string (fst x) = y) into group
+                      select (x,group) }
+        let join3 =     
+            myquery { for x in f.MouseClick do 
+                      zipLikeOp beep in f.Beep 
+                      select (x,beep) }
+        ()
+
+module LessRestrictionsForCustomOperators_Bug475766 =
+    type DoNothingBuilder() = 
+        member this.Yield(v) = [v]
+        member this.Delay f = f
+        member this.Run(f) = f()
+        member this.Zero() = []
+        member this.For(e, b) = List.collect b e
+        member this.TryWith(b, h) = 
+            try b()
+            with e -> h e
+        member this.TryFinally(b, c) = try b() finally c()
+        [<CustomOperation("select")>]
+        member this.Select(v, [<ProjectionParameter>]f) = List.map f v 
+         
+    let builder = DoNothingBuilder()
+
+    // allow if\then\else if 'then' and 'else' branches doesn't contain custom operators
+    let q1 = 
+        builder {
+            for c in [1;2;3] do
+                if true then
+                    yield (c,1)
+                else
+                    yield (c,0)
+            }
+    check "LessRestrictionsForCustomOperators_Bug475766_1" q1 [1,1; 2,1; 3,1]
+
+    // allows try\with if nor body of 'try' neither handler contain custom operators
+    let q2 = 
+        builder {
+            try failwith "error"
+            with Failure e -> yield e
+        }
+    check "LessRestrictionsForCustomOperators_Bug475766_2" q2 ["error"]
+
+    // allows try\finally if nor body of 'try' neither compensation action contain custom operators
+    let compensation = ref false
+    let q3 = 
+        builder {
+            try
+                yield 1
+            finally
+                compensation := true
+        }
+    check "LessRestrictionsForCustomOperators_Bug475766_3" (q3, !compensation) ([1], true)
+
+module ProbabilityWorkflow = 
+    
+    type Distribution<'T when 'T : comparison> =
+        abstract Sample : 'T
+        abstract Support : Set<'T>
+        abstract Expectation: ('T -> float) -> float
+    
+    let always x =
+        { new Distribution<'T> with
+             member d.Sample = x
+             member d.Support = Set.singleton x
+             member d.Expectation(H) = H(x) }
+    
+    let rnd = System.Random()
+    
+    let coinFlip (p:float) (d1:Distribution<'T>) (d2:Distribution<'T>) =
+        if p < 0.0 || p > 1.0 then failwith "invalid probability in coinFlip"
+        { new Distribution<'T> with
+             member d.Sample =
+                 if rnd.NextDouble() < p then d1.Sample else d2.Sample
+             member d.Support = Set.union d1.Support d2.Support
+             member d.Expectation(H) =
+                 p * d1.Expectation(H) + (1.0-p) * d2.Expectation(H) }
+    
+    // ----------------------------
+    // Listing 9-8.
+    
+    let bind (dist:Distribution<'T>) (k: 'T -> Distribution<'b>) =
+        { new Distribution<'b> with
+             member d.Sample = (k(dist.Sample)).Sample
+             member d.Support = dist.Support |> Set.map (fun d -> (k d).Support) |> Set.unionMany
+             member d.Expectation(H) = dist.Expectation(fun x -> (k x).Expectation(H)) }
+    
+    type DistributionBuilder() =
+        member builder.Delay(f) = bind (always ()) f
+        member builder.Let(v,f) = bind (always v) f
+        member builder.Bind(d,f) = bind d f
+        member builder.Return(x) = always x
+        member builder.ReturnFrom(x) = x
+        [<CustomOperation("condition",MaintainsVariableSpaceUsingBind=true)>]
+        member builder.Condition(x:Distribution<_>,[<ProjectionParameter>] p) = 
+              { new Distribution<_> with
+                   member d.Sample = let rec loop() = let v = x.Sample in if p v then v else loop() in loop() 
+                   member d.Support = x.Support
+                   member d.Expectation(H) = failwith "can't compute expectation of condition" }
+    
+    let dist = new DistributionBuilder()
+    
+    // ----------------------------
+    // Listing 9-9.
+    
+    let weightedCases (inp: ('a * float) list) =
+        let rec coinFlips w l =
+            match l with
+            | []          -> failwith "no coinFlips"
+            | [(d,_)]     -> always d
+            | (d,p)::rest -> coinFlip (p/(1.0-w)) (always d) (coinFlips (w+p) rest)
+        coinFlips 0.0 inp
+    
+    let countedCases inp =
+        let total = List.sumBy (fun (_,v) -> v) inp
+        weightedCases (inp |> List.map (fun (x,v) -> (x,(float v/float total))))
+    
+    type Outcome = Even | Odd | Zero
+    let roulette = countedCases [ Even,18; Odd,18; Zero,1]
+    
+    
+    // ----------------------------
+    
+    roulette.Sample
+    
+    roulette.Sample
+    
+    roulette.Expectation (function Even -> 10.0 | Odd -> 0.0 | Zero -> 0.0)
+    
+    // ----------------------------
+    
+    type Light =
+        | Red
+        | Green
+        | Yellow
+    
+    let trafficLightD = weightedCases [ Red,0.50; Yellow,0.10; Green, 0.40 ]
+    
+    type Action = Stop | Drive
+    
+    let cautiousDriver light =
+        dist { match light with
+               | Red -> return Stop
+               | Yellow -> return! weightedCases [ Stop, 0.9; Drive, 0.1 ]
+               | Green -> return Drive }
+    
+    let aggressiveDriver light =
+        dist { match light with
+               | Red    -> return! weightedCases [ Stop, 0.9; Drive, 0.1 ]
+               | Yellow -> return! weightedCases [ Stop, 0.1; Drive, 0.9 ]
+               | Green  -> return Drive }
+    
+    let otherLight light =
+        match light with
+        | Red -> Green
+        | Yellow -> Red
+        | Green -> Red
+    
+    type CrashResult = Crash | NoCrash
+    
+    let crash(driverOneD,driverTwoD,lightD) =
+        dist { // Sample from the traffic light
+               let! light = lightD
+    
+               // Sample the first driver's behavior given the traffic light
+               let! driverOne = driverOneD light
+    
+               // Sample the second driver's behavior given the traffic light
+               let! driverTwo = driverTwoD (otherLight light)
+    
+               // Condition that the drivers make the same choice
+               condition (driverOne = driverTwo)
+               
+               return (driverOne, driverTwo) }
+    
+    let model = crash(cautiousDriver,aggressiveDriver,trafficLightD)
+    
+    // ----------------------------
+    
+    for i = 0 to 100 do 
+       let (v1,v2) = model.Sample
+       printfn "sample #%d = %A" i (v1,v2)
+       // Every sample should be identical on left and right because of the condition
+       check "cwnew0" v1 v2
+
+
+    let crash2(driverOneD,driverTwoD,lightD) =
+        dist { // Sample from the traffic light
+               let! light = lightD
+    
+               // Sample the first driver's behavior given the traffic light
+               let! driverOne = driverOneD light
+    
+               // Sample the second driver's behavior given the traffic light
+               let! driverTwo = driverTwoD (otherLight light)
+    
+               // Condition that the drivers make the same choice, twice
+               condition (driverOne = driverTwo)
+               condition (driverOne = driverTwo)
+               
+               return (driverOne, driverTwo) }
+    
+    let model2 = crash2(cautiousDriver,aggressiveDriver,trafficLightD)
+    
+    // ----------------------------
+    
+    for i = 0 to 100 do 
+       let (v1,v2) = model2.Sample
+       printfn "sample #%d = %A" i (v1,v2)
+       // Every sample should be identical on left and right because of the condition
+       check "cwnew0" v1 v2
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/build.bat b/tests/fsharp/core/queriesLeafExpressionConvert/build.bat
new file mode 100644
index 0000000..8ed3cc0
--- /dev/null
+++ b/tests/fsharp/core/queriesLeafExpressionConvert/build.bat
@@ -0,0 +1,47 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/run.bat b/tests/fsharp/core/queriesLeafExpressionConvert/run.bat
new file mode 100644
index 0000000..9cde240
--- /dev/null
+++ b/tests/fsharp/core/queriesLeafExpressionConvert/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx
new file mode 100644
index 0000000..5947fd0
--- /dev/null
+++ b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx
@@ -0,0 +1,1104 @@
+// #Query
+#if Portable
+module Core_queriesLeafExpressionConvert
+#endif
+
+#nowarn "57"
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+#if NetCore
+#else
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+#endif
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected %A got %A" s v2 v1
+
+    let test s b = check s b true
+
+module LeafExpressionEvaluationTests = 
+
+    // The following hopefully is an identity function on quotations:
+    let Id (x: Expr<'T>) : Expr<'T> = 
+        let rec conv x = 
+            match x with
+            | ShapeVar _ -> 
+                x
+            | ShapeLambda (head, body) -> 
+                Expr.Lambda (head, conv body)    
+            | ShapeCombination (head, tail) -> 
+                RebuildShapeCombination (head, List.map conv tail)
+        conv x |> Expr.Cast
+
+    let Eval (q: Expr<'T>) : 'T = 
+        LeafExpressionConverter.QuotationToExpression q |> ignore 
+        LeafExpressionConverter.EvaluateQuotation q  |> unbox
+
+    let checkText nm q s = check nm ((LeafExpressionConverter.QuotationToExpression q).ToString()) s
+
+    let checkEval nm (q : Expr<'T>) expected = 
+        check nm (Eval q) expected
+        check (nm + "(after applying Id)") (Eval (Id q)) expected
+        check (nm + "(after applying Id^2)")  (Eval (Id (Id q))) expected
+
+#if STATEMENTS_IN_EXPRESSIONS
+    let f () = () 
+
+    checkEval "cwe90wecmp" (<@ f ()  @> ) ()
+#endif
+
+    //(let rec fib x = if x <= 2 then 1 else fib (x-1) + fib (x-2) in fib 36)
+
+    //2.53/0.35
+
+    checkEval "2ver9ewv2" (<@ if true then 1 else 0  @>) 1
+    checkEval "2ver9ewv3" (<@ if false then 1 else 0  @>) 0
+    checkEval "2ver9ewv4" (<@ true && true @>) true
+    checkEval "2ver9ewv5" (<@ true && false @>) false
+    check "2ver9ewv6" (try Eval <@ failwith "fail" : int @> with Failure "fail" -> 1 | _ -> 0) 1 
+    check "2ver9ewv7" (try Eval <@ true && (failwith "fail") @> with Failure "fail" -> true | _ -> false) true
+    checkEval "2ver9ewv8" (<@ 0x001 &&& 0x100 @>) (0x001 &&& 0x100)
+    checkEval "2ver9ewv9" (<@ 0x001 ||| 0x100 @>) (0x001 ||| 0x100)
+    checkEval "2ver9ewvq" (<@ 0x011 ^^^ 0x110 @>) (0x011 ^^^ 0x110)
+    checkEval "2ver9ewvw" (<@ ~~~0x011 @>) (~~~0x011)
+
+    let _ = 1
+    checkEval "2ver9ewve" (<@ () @>) ()
+    check "2ver9ewvr" (Eval <@ (fun x -> x + 1) @> (3)) 4
+    check "2ver9ewvt" (Eval <@ (fun (x,y) -> x + 1) @> (3,4)) 4
+    check "2ver9ewvy" (Eval <@ (fun (x1,x2,x3) -> x1 + x2 + x3) @> (3,4,5)) (3+4+5)
+    check "2ver9ewvu" (Eval <@ (fun (x1,x2,x3,x4) -> x1 + x2 + x3 + x4) @> (3,4,5,6)) (3+4+5+6)
+    check "2ver9ewvi" (Eval <@ (fun (x1,x2,x3,x4,x5) -> x1 + x2 + x3 + x4 + x5) @> (3,4,5,6,7)) (3+4+5+6+7)
+    check "2ver9ewvo" (Eval <@ (fun (x1,x2,x3,x4,x5,x6) -> x1 + x2 + x3 + x4 + x5 + x6) @> (3,4,5,6,7,8)) (3+4+5+6+7+8)
+    check "2ver9ewvp" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7) -> x1 + x2 + x3 + x4 + x5 + x6 + x7) @> (3,4,5,6,7,8,9)) (3+4+5+6+7+8+9)
+    check "2ver9ewva" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8) @> (3,4,5,6,7,8,9,10)) (3+4+5+6+7+8+9+10)
+    check "2ver9ewvs" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9) @> (3,4,5,6,7,8,9,10,11)) (3+4+5+6+7+8+9+10+11)
+    check "2ver9ewvd" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) @> (3,4,5,6,7,8,9,10,11,12)) (3+4+5+6+7+8+9+10+11+12)
+    check "2ver9ewvf" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11) @> (3,4,5,6,7,8,9,10,11,12,13)) (3+4+5+6+7+8+9+10+11+12+13)
+    check "2ver9ewvg" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12) @> (3,4,5,6,7,8,9,10,11,12,13,14)) (3+4+5+6+7+8+9+10+11+12+13+14)
+
+    checkEval "vlwjvrwe90" (<@ let f (x:int) (y:int) = x + y in f 1 2  @>) 3
+
+    //debug <- true
+    
+
+#if STATEMENTS_IN_EXPRESSIONS
+    checkEval "slnvrwe90" (<@ let rec f (x:int) : int = f x in 1  @>) 1
+
+    checkEval "2ver9ewva" (<@ let rec f1 (x:int) : int = f2 x 
+                              and f2 x = f1 x 
+                              1  @>) 1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 x 
+          and f2 x = f3 x 
+          and f3 x = f1 x 
+          1  @>) 
+      1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = f6 (x-1) 
+          and f6 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = f6 (x-1) 
+          and f6 x = f7 (x-1) 
+          and f7 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+
+    checkEval "2ver9ewv1" (<@ let rec f (x:int) : int = x+x in f 2  @>) 4
+
+    Eval <@ let rec fib x = if x <= 2 then 1 else fib (x-1) + fib (x-2) in fib 36 @> 
+    checkEval "2ver9ewvh" (<@ while false do ()  @>) ()
+    checkEval "2ver9ewvj" (<@ let rec f (x:int) : int = f x in 1  @>) 1
+
+    let x = ref 0
+    let incrx () = incr x
+
+    checkEval "2ver9ewvec" (<@ !x @>) 0
+    checkEval "2ver9ewev" (<@ incrx() @>) ()
+    checkEval "2ver9eweb" (<@ !x @>) 2  // NOTE: checkEval evaluates the quotation two times :-)
+#endif
+
+    checkEval "2ver9ewvk" (<@ 1 + 1 @>) 2
+    checkEval "2ver9ewvl" (<@ 1 > 1 @>) false
+    checkEval "2ver9ewvz" (<@ 1 < 1 @>) false
+    checkEval "2ver9ewvx" (<@ 1 <= 1 @>) true
+    checkEval "2ver9ewvc" (<@ 1 >= 1 @>) true
+    Eval <@ System.DateTime.Now @>
+    checkEval "2ver9ewvv" (<@ System.Int32.MaxValue @>) System.Int32.MaxValue  // literal field!
+    checkEval "2ver9ewvb" (<@ None  : int option @>) None
+    checkEval "2ver9ewvn" (<@ Some(1)  @>) (Some(1))
+    checkEval "2ver9ewvm" (<@ [] : int list @>) []
+    checkEval "2ver9ewqq" (<@ [1] @>) [1]
+    checkEval "2ver9ewqq" (<@ ["1"] @>) ["1"]
+    checkEval "2ver9ewqq" (<@ ["1";"2"] @>) ["1";"2"]
+    check "2ver9ewww" (Eval <@ (fun x -> x + 1) @> 3) 4
+
+    let v = (1,2)
+    checkEval "2ver9ewer" (<@ v @>) (1,2)
+    checkEval "2ver9ewet" (<@ let x = 1 in x @>) 1
+    checkEval "2ver9ewed" (<@ let x = 1+1 in x+x @>) 4
+
+    let raise x = Operators.raise x
+    check "2ver9ewveq" (try Eval <@ raise (new System.Exception("hello")) : bool @> with :? System.Exception -> true | _ -> false) true
+
+    
+    check "2ver9ewrf" (let v2 = (3,4) in Eval <@ v2 @>) (3,4)
+    
+    check "2ver9ewrg" (let v2 = (3,4) in Eval <@ v2,v2 @>) ((3,4),(3,4))
+
+    checkEval "2ver9ewrt" (<@ (1,2) @>) (1,2)
+    checkEval "2ver9ewvk" (<@ (1,2,3) @>) (1,2,3)
+    checkEval "2ver9ewrh" (<@ (1,2,3,4) @>) (1,2,3,4)
+    checkEval "2ver9ewrj" (<@ (1,2,3,4,5) @>) (1,2,3,4,5)
+    checkEval "2ver9ewrk" (<@ (1,2,3,4,5,6) @>) (1,2,3,4,5,6)
+    checkEval "2ver9ewrl" (<@ (1,2,3,4,5,6,7) @>) (1,2,3,4,5,6,7)
+    checkEval "2ver9ewra" (<@ (1,2,3,4,5,6,7,8) @>) (1,2,3,4,5,6,7,8)
+    checkEval "2ver9ewrs" (<@ (1,2,3,4,5,6,7,8,9) @>) (1,2,3,4,5,6,7,8,9)
+    checkEval "2ver9ewrx" (<@ (1,2,3,4,5,6,7,8,9,10) @>) (1,2,3,4,5,6,7,8,9,10)
+    checkEval "2ver9ewrc" (<@ (1,2,3,4,5,6,7,8,9,10,11) @>) (1,2,3,4,5,6,7,8,9,10,11)
+    checkEval "2ver9ewrv" (<@ (1,2,3,4,5,6,7,8,9,10,11,12) @>) (1,2,3,4,5,6,7,8,9,10,11,12)
+    checkEval "2ver9ewrb" (<@ System.DateTime.Now.DayOfWeek @>) System.DateTime.Now.DayOfWeek
+    checkEval "2ver9ewrn" (<@ Checked.(+) 1 1 @>) 2
+    checkEval "2ver9ewrm" (<@ Checked.(-) 1 1 @>) 0
+    checkEval "2ver9ewrw" (<@ Checked.( * ) 1 1 @>) 1
+    checkEval "2ver9ewrre" (let v2 = (3,4) in <@ match v2 with (x,y) -> x + y @>) 7
+    checkEval "2ver9ewrn" (<@ "1" = "2" @>) false
+    
+    module Bug617196 =
+        type T = static member Run (e : System.Linq.Expressions.Expression<System.Action>) = ()
+        let f = ResizeArray<int>()
+        test "Bug617196" (try T.Run (fun () -> f.Clear()); true with _ -> false)
+
+    module Bug445828 =
+        open System.Linq.Expressions
+        type C = 
+            static member M(x : Expression<System.Func<obj,float>>) = x
+        test "Bug445828_1"
+            (
+                try
+                    let expr = C.M(fun x -> x :?> float)
+                    let body = expr.Body :?> UnaryExpression // Expression.Convert
+                    body.NodeType = ExpressionType.Convert && body.Type = typeof<float>
+                with _ -> false
+            )
+
+        module WeirdCases =
+            open System
+            open Microsoft.FSharp.Quotations
+            
+            type A = class end
+            type B = class inherit A end
+            // F# compiler will throw away conversion in scenarios like
+            // fun (x : B) -> x :?> B
+            // fun (x : B) -> x :?> A
+            // but you can always create such cases by hand - so we'll test them as well
+            
+            test "Bug445828_WeirdCases_1"
+                (
+                    try
+                        let expr = 
+                            let v = Var("x", typeof<B>)
+                            let q = Expr.NewDelegate(typeof<Func<B, B>>, [v], Expr.Coerce(Expr.Var(v), typeof<B>)) // fun (x : B) -> x :?> B
+                            (Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.QuotationToExpression q) :?> Expression<Func<B, B>>
+                        expr.Body :? ParameterExpression // no Convert node
+                    with _ -> false
+                )
+                
+            test "Bug445828_WeirdCases_2"
+                (
+                    try
+                        let expr = 
+                            let v = Var("x", typeof<B>)
+                            let q = Expr.NewDelegate(typeof<Func<B, A>>, [v], Expr.Coerce(Expr.Var(v), typeof<A>)) // fun (x : B) -> x :?> A
+                            (Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.QuotationToExpression q) :?> Expression<Func<B, A>>
+                        expr.Body :? ParameterExpression // no Convert node
+                    with _ -> false
+                )                
+        
+    module NonGenericRecdTests = 
+        type Customer = { mutable Name:string; Data: int }
+        let c1 = { Name="Don"; Data=6 }
+        let c2 = { Name="Peter"; Data=7 }
+        let c3 = { Name="Freddy"; Data=8 }
+        checkEval "2ver9e1rw1" (<@ c1.Name @>) "Don"
+        checkEval "2ver9e2rw2" (<@ c2.Name @>) "Peter"
+        checkEval "2ver9e3rw3" (<@ c2.Data @>) 7
+        checkEval "2ver9e7rw4" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+        checkEval "2ver9e7rw5" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+
+    module GenericRecdTests = 
+        type CustomerG<'a> = { mutable Name:string; Data: 'a }
+        let c1 : CustomerG<int> = { Name="Don"; Data=6 }
+        let c2 : CustomerG<int> = { Name="Peter"; Data=7 }
+        let c3 : CustomerG<string> = { Name="Freddy"; Data="8" }
+        checkEval "2ver9e4rw6" (<@ c1.Name @>) "Don"
+        checkEval "2ver9e5rw7" (<@ c2.Name @>) "Peter"
+        checkEval "2ver9e6rw8" (<@ c2.Data @>) 7
+        checkEval "2ver9e7rw9" (<@ c3.Data @>) "8"
+        checkEval "2ver9e7rwQ" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+#if STATEMENTS_IN_EXPRESSIONS
+        checkEval "2ver9e7rwW" (<@ c1.Name <- "Ali Baba" @>) ()
+#endif
+        checkEval "2ver9e7rwE" (<@ c1.Name  @>) "Don"
+
+    module ArrayTests = 
+        checkEval "2ver9e8rwR1" (<@ [| |]  @>) ([| |] : int array)
+        checkEval "2ver9e8rwR2" (<@ [| 0 |]  @>) ([| 0 |] : int array)
+        checkEval "2ver9e8rwR3" (<@ [| 0  |].[0]  @>) 0
+        checkEval "2ver9e8rwR4" (<@ [| 1; 2  |].[0]  @>) 1
+        checkEval "2ver9e8rwR5" (<@ [| 1; 2  |].[1]  @>) 2
+
+    module Array2DTests = 
+        checkEval "2ver9e8rwR6" (<@ (Array2D.init 3 4 (fun i j -> i + j)).[0,0] @>) 0
+        checkEval "2ver9e8rwR7" (<@ (Array2D.init 3 4 (fun i j -> i + j)).[1,2] @>) 3
+        checkEval "2ver9e8rwR8" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.base1 @>) 0
+        checkEval "2ver9e8rwR9" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.base2 @>) 0
+        checkEval "2ver9e8rwRQ" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.length1 @>) 3
+        checkEval "2ver9e8rwRW" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.length2 @>) 4
+
+
+    module Array3DTests = 
+        checkEval "2ver9e8rwRE" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)).[0,0,0] @>) 0
+        checkEval "2ver9e8rwRR" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j + k)).[1,2,3] @>) 6
+        checkEval "2ver9e8rwRT" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length1 @>) 3
+        checkEval "2ver9e8rwRY" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length2 @>) 4
+        checkEval "2ver9e8rwRU" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length3 @>) 5
+
+    module ExceptionTests = 
+        exception E0
+        exception E1 of string
+        let c1 = E0
+        let c2 = E1 "1"
+        let c3 = E1 "2"
+        checkEval "2ver9e8rwR" (<@ E0  @>) E0
+        checkEval "2ver9e8rwT" (<@ E1 "1"  @>) (E1 "1")
+        checkEval "2ver9eQrwY" (<@ match c1 with E0 -> 1 | _ -> 2  @>) 1
+        checkEval "2ver9eQrwU" (<@ match c2 with E0 -> 1 | _ -> 2  @>) 2
+        checkEval "2ver9eQrwI" (<@ match c2 with E0 -> 1 | E1 _  -> 2 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwO" (<@ match c2 with E1 _  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwP" (<@ match c2 with E1 "1"  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwA" (<@ match c2 with E1 "2"  -> 2 | E0 -> 1 | _ -> 3  @>) 3
+        checkEval "2ver9eQrwS" (<@ match c3 with E1 "2"  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+#if STATEMENTS_IN_EXPRESSIONS
+        checkEval "2ver9eQrwD1" (<@ try failwith "" with _ -> 2  @>) 2
+        checkEval "2ver9eQrwD2" (<@ let x = ref 0 in 
+                                    try 
+                                           try failwith "" 
+                                           finally incr x 
+                                    with _ -> !x @>) 1
+        checkEval "2ver9eQrwD3" (<@ let x = ref 0 in 
+                                    (try incr x; incr x
+                                     finally incr x )
+                                    x.Value @>) 3
+        checkEval "2ver9eQrwD4" (<@ try 3 finally () @>) 3
+        checkEval "2ver9eQrwD5" (<@ try () finally () @>) ()
+        checkEval "2ver9eQrwD6" (<@ try () with _ -> () @>) ()
+        checkEval "2ver9eQrwD7" (<@ try raise E0 with E0 -> 2  @>) 2
+        checkEval "2ver9eQrwF" (<@ try raise c1 with E0 -> 2  @>) 2
+        checkEval "2ver9eQrwG" (<@ try raise c2 with E0 -> 2 | E1 "1" -> 3 @>) 3
+        checkEval "2ver9eQrwH" (<@ try raise c2 with E1 "1" -> 3 | E0 -> 2  @>) 3
+#endif
+
+    module TypeTests = 
+        type C0() = 
+            member x.P = 1
+        type C1(s:string) = 
+            member x.P = s
+        let c1 = C0()
+        let c2 = C1 "1"
+        let c3 = C1 "2"
+        checkEval "2ver9e8rwJ" (<@ C0().P  @>) 1
+        checkEval "2ver9e8rwK" (<@ C1("1").P  @>)  "1"
+        checkEval "2ver9eQrwL" (<@ match box c1 with :? C0 -> 1 | _ -> 2  @>) 1
+        checkEval "2ver9eQrwZ" (<@ match box c2 with :? C0 -> 1 | _ -> 2  @>) 2
+        checkEval "2ver9eQrwX" (<@ match box c2 with :? C0 -> 1 | :? C1   -> 2 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwC" (<@ match box c2 with :? C1   -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwV" (<@ match box c2 with :? C1  -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwN" (<@ match box c3 with :? C1  as c1 when c1.P = "2"  -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+
+    module NonGenericUnionTests0 = 
+        type Animal = Cat of string | Dog
+        let c1 = Cat "meow"
+        let c2 = Dog
+        checkEval "2ver9e8rw11" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw12" (<@ Dog @>) Dog
+        checkEval "2ver9eQrw13" (<@ match c1 with Cat _ -> 2 | Dog -> 1 @>) 2
+        checkEval "2ver9eWrw14" (<@ match c1 with Cat s -> s | Dog -> "woof" @>) "meow"
+        checkEval "2ver9eErw15" (<@ match c2 with Cat s -> s | Dog -> "woof" @>) "woof"
+
+    module NonGenericUnionTests1 = 
+        type Animal = Cat of string 
+        let c1 = Cat "meow"
+        checkEval "2ver9e8rw16" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9eQrw17" (<@ match c1 with Cat _ -> 2  @>) 2
+        checkEval "2ver9eWrw18" (<@ match c1 with Cat s -> s  @>) "meow"
+
+    module NonGenericUnionTests2 = 
+        type Animal = 
+           | Cat of string 
+           | Dog of string
+        let c1 = Cat "meow"
+        let c2 = Dog "woof"
+        checkEval "2ver9e8rw19" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw20" (<@ Dog "bowwow" @>) (Dog "bowwow")
+        checkEval "2ver9eQrw21" (<@ match c1 with Cat _ -> 2 | Dog  _ -> 1 @>) 2
+        checkEval "2ver9eWrw22" (<@ match c1 with Cat s -> s | Dog s -> s @>) "meow"
+        checkEval "2ver9eErw23" (<@ match c2 with Cat s -> s | Dog s -> s @>) "woof"
+
+    module NonGenericUnionTests3 = 
+        type Animal = 
+           | Cat of string 
+           | Dog of string
+           | Dog1 of string
+           | Dog2 of string
+           | Dog3 of string
+           | Dog4 of string
+           | Dog5 of string
+           | Dog6 of string
+           | Dog7 of string
+           | Dog8 of string
+           | Dog9 of string
+           | DogQ of string
+           | DogW of string
+           | DogE of string
+           | DogR of string
+           | DogT of string
+           | DogY of string
+           | DogU of string
+           | DogI of string
+        let c1 = Cat "meow"
+        let c2 = Dog "woof"
+        checkEval "2ver9e8rw24" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw25" (<@ Dog "bowwow" @>) (Dog "bowwow")
+        checkEval "2ver9eQrw26" (<@ match c1 with Cat _ -> 2 | _ -> 1 @>) 2
+        checkEval "2ver9eWrw27" (<@ match c1 with Cat s -> s | _ -> "woof" @>) "meow"
+        checkEval "2ver9eErw28" (<@ match c2 with Cat s -> s | Dog s -> s | _ -> "bark" @>) "woof"
+
+
+    module GenericUnionTests = 
+        type Animal<'a> = Cat of 'a | Dog
+        let c1 = Cat "meow"
+        let c2 = Dog
+        checkEval "2ver9e8rw29" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw30" (<@ Dog @>) Dog
+        checkEval "2ver9eQrw31" (<@ match c1 with Cat _ -> 2 | Dog -> 1 @>) 2
+        checkEval "2ver9eWrw32" (<@ match c1 with Cat s -> s | Dog -> "woof" @>) "meow"
+        checkEval "2ver9eErw33" (<@ match c2 with Cat s -> s | Dog -> "woof" @>) "woof"
+
+    module InlinedOperationsStillDynamicallyAvailableTests = 
+
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericZero<sbyte> @>)  0y
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int16> @>)  0s
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int32> @>)  0
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int64> @>)  0L
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<nativeint> @>)  0n
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericZero<byte> @>)  0uy
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint16> @>)  0us
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint32> @>)  0u
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint64> @>)  0UL
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<unativeint> @>)  0un
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<float> @>)  0.0
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<float32> @>)  0.0f
+        checkEval "vroievr092" (<@ LanguagePrimitives.GenericZero<decimal> @>)  0M
+
+
+
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericOne<sbyte> @>)  1y
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int16> @>)  1s
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int32> @>)  1
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int64> @>)  1L
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<nativeint> @>)  1n
+        checkEval "vroievr193" (<@ LanguagePrimitives.GenericOne<byte> @>)  1uy
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint16> @>)  1us
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint32> @>)  1u
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint64> @>)  1UL
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<unativeint> @>)  1un
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<float> @>)  1.0
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<float32> @>)  1.0f
+        checkEval "vroievr192" (<@ LanguagePrimitives.GenericOne<decimal> @>)  1M
+
+        check "vroievr0971" (LanguagePrimitives.AdditionDynamic 3y 4y) 7y
+        check "vroievr0972" (LanguagePrimitives.AdditionDynamic 3s 4s) 7s
+        check "vroievr0973" (LanguagePrimitives.AdditionDynamic 3 4) 7
+        check "vroievr0974" (LanguagePrimitives.AdditionDynamic 3L 4L) 7L
+        check "vroievr0975" (LanguagePrimitives.AdditionDynamic 3n 4n) 7n
+        check "vroievr0976" (LanguagePrimitives.AdditionDynamic 3uy 4uy) 7uy
+        check "vroievr0977" (LanguagePrimitives.AdditionDynamic 3us 4us) 7us
+        check "vroievr0978" (LanguagePrimitives.AdditionDynamic 3u 4u) 7u
+        check "vroievr0979" (LanguagePrimitives.AdditionDynamic 3UL 4UL) 7UL
+        check "vroievr0970" (LanguagePrimitives.AdditionDynamic 3un 4un) 7un
+        check "vroievr097q" (LanguagePrimitives.AdditionDynamic 3.0 4.0) 7.0
+        check "vroievr097w" (LanguagePrimitives.AdditionDynamic 3.0f 4.0f) 7.0f
+        check "vroievr097e" (LanguagePrimitives.AdditionDynamic 3.0M 4.0M) 7.0M
+
+        check "vroievr097r" (LanguagePrimitives.CheckedAdditionDynamic 3y 4y) 7y
+        check "vroievr097t" (LanguagePrimitives.CheckedAdditionDynamic 3s 4s) 7s
+        check "vroievr097y" (LanguagePrimitives.CheckedAdditionDynamic 3 4) 7
+        check "vroievr097u" (LanguagePrimitives.CheckedAdditionDynamic 3L 4L) 7L
+        check "vroievr097i" (LanguagePrimitives.CheckedAdditionDynamic 3n 4n) 7n
+        check "vroievr097o" (LanguagePrimitives.CheckedAdditionDynamic 3uy 4uy) 7uy
+        check "vroievr097p" (LanguagePrimitives.CheckedAdditionDynamic 3us 4us) 7us
+        check "vroievr097a" (LanguagePrimitives.CheckedAdditionDynamic 3u 4u) 7u
+        check "vroievr097s" (LanguagePrimitives.CheckedAdditionDynamic 3UL 4UL) 7UL
+        check "vroievr097d" (LanguagePrimitives.CheckedAdditionDynamic 3un 4un) 7un
+        check "vroievr097f" (LanguagePrimitives.CheckedAdditionDynamic 3.0 4.0) 7.0
+        check "vroievr097g" (LanguagePrimitives.CheckedAdditionDynamic 3.0f 4.0f) 7.0f
+        check "vroievr097h" (LanguagePrimitives.CheckedAdditionDynamic 3.0M 4.0M) 7.0M
+
+        check "vroievr0912q" (LanguagePrimitives.MultiplyDynamic 3y 4y) 12y
+        check "vroievr0912w" (LanguagePrimitives.MultiplyDynamic 3s 4s) 12s
+        check "vroievr0912e" (LanguagePrimitives.MultiplyDynamic 3 4) 12
+        check "vroievr0912r" (LanguagePrimitives.MultiplyDynamic 3L 4L) 12L
+        check "vroievr0912t" (LanguagePrimitives.MultiplyDynamic 3n 4n) 12n
+        check "vroievr0912y" (LanguagePrimitives.MultiplyDynamic 3uy 4uy) 12uy
+        check "vroievr0912u" (LanguagePrimitives.MultiplyDynamic 3us 4us) 12us
+        check "vroievr0912i" (LanguagePrimitives.MultiplyDynamic 3u 4u) 12u
+        check "vroievr0912o" (LanguagePrimitives.MultiplyDynamic 3UL 4UL) 12UL
+        check "vroievr0912p" (LanguagePrimitives.MultiplyDynamic 3un 4un) 12un
+        check "vroievr0912a" (LanguagePrimitives.MultiplyDynamic 3.0 4.0) 12.0
+        check "vroievr0912s" (LanguagePrimitives.MultiplyDynamic 3.0f 4.0f) 12.0f
+        check "vroievr0912d" (LanguagePrimitives.MultiplyDynamic 3.0M 4.0M) 12.0M
+
+
+        check "vroievr0912f" (LanguagePrimitives.CheckedMultiplyDynamic 3y 4y) 12y
+        check "vroievr0912g" (LanguagePrimitives.CheckedMultiplyDynamic 3s 4s) 12s
+        check "vroievr0912h" (LanguagePrimitives.CheckedMultiplyDynamic 3 4) 12
+        check "vroievr0912j" (LanguagePrimitives.CheckedMultiplyDynamic 3L 4L) 12L
+        check "vroievr0912k" (LanguagePrimitives.CheckedMultiplyDynamic 3n 4n) 12n
+        check "vroievr0912l" (LanguagePrimitives.CheckedMultiplyDynamic 3uy 4uy) 12uy
+        check "vroievr0912z" (LanguagePrimitives.CheckedMultiplyDynamic 3us 4us) 12us
+        check "vroievr0912x" (LanguagePrimitives.CheckedMultiplyDynamic 3u 4u) 12u
+        check "vroievr0912c" (LanguagePrimitives.CheckedMultiplyDynamic 3UL 4UL) 12UL
+        check "vroievr0912v" (LanguagePrimitives.CheckedMultiplyDynamic 3un 4un) 12un
+        check "vroievr0912b" (LanguagePrimitives.CheckedMultiplyDynamic 3.0 4.0) 12.0
+        check "vroievr0912n" (LanguagePrimitives.CheckedMultiplyDynamic 3.0f 4.0f) 12.0f
+        check "vroievr0912m" (LanguagePrimitives.CheckedMultiplyDynamic 3.0M 4.0M) 12.0M
+
+
+        // TODO: check subtraction over user defined types.
+        // TODO: check subtraction and be complete w.r.t. "inline" functions in prim-types.fsi
+
+        let iarr = [| 0..1000 |]
+        let ilist = [ 0..1000 ]
+
+        let farr = [| 0.0 .. 1.0 .. 100.0 |]
+        let flist = [ 0.0 .. 1.0 .. 100.0 ]
+
+
+        checkEval "vrewoinrv091" (<@ farr.[0] @>) 0.0
+        checkEval "vrewoinrv092" (<@ flist.[0] @>) 0.0
+        checkEval "vrewoinrv093" (<@ iarr.[0] @>) 0
+        checkEval "vrewoinrv094" (<@ ilist.[0] @>) 0
+
+#if STATEMENTS_IN_EXPRESSIONS
+        checkEval "vrewoinrv095" (<@ farr.[0] <- 0.0 @>) ()
+        checkEval "vrewoinrv096" (<@ iarr.[0] <- 0 @>) ()
+
+        checkEval "vrewoinrv097" (<@ farr.[0] <- 1.0 @>) ()
+        checkEval "vrewoinrv098" (<@ iarr.[0] <- 1 @>) ()
+        checkEval "vrewoinrv099" (<@ farr.[0] @>) 1.0
+        checkEval "vrewoinrv09q" (<@ iarr.[0] @>) 1
+#endif
+
+
+#if STATEMENTS_IN_EXPRESSIONS
+        checkEval "vrewoinrv09w" (<@ farr.[0] <- 0.0 @>) ()
+        checkEval "vrewoinrv09e" (<@ iarr.[0] <- 0 @>) ()
+#endif
+
+
+        checkEval "vrewoinrv09r" (<@ Array.average farr @>) (Array.average farr)
+        checkEval "vrewoinrv09t" (<@ Array.sum farr @>) (Array.sum farr)
+        checkEval "vrewoinrv09y" (<@ Seq.sum farr @>) (Seq.sum farr)
+        checkEval "vrewoinrv09u" (<@ Seq.average farr @>) (Seq.average farr) 
+        checkEval "vrewoinrv09i" (<@ Seq.average flist @>) (Seq.average flist)
+        checkEval "vrewoinrv09o" (<@ Seq.averageBy (fun x -> x) farr @> ) (Seq.averageBy (fun x -> x) farr )
+        checkEval "vrewoinrv09p" (<@ Seq.averageBy (fun x -> x) flist @>) (Seq.averageBy (fun x -> x) flist )
+        checkEval "vrewoinrv09a" (<@ Seq.averageBy float ilist @>) (Seq.averageBy float ilist)
+        checkEval "vrewoinrv09s" (<@ List.sum flist @>) (List.sum flist)
+        checkEval "vrewoinrv09d" (<@ List.average flist @>) (List.average flist)
+        checkEval "vrewoinrv09f" (<@ List.averageBy float ilist @>) (List.averageBy float ilist)
+
+        checkEval "vrewoinrv09g1" (<@ compare 0 0 = 0 @>) true
+        checkEval "vrewoinrv09g2" (<@ compare 0 1 < 0 @>) true
+        checkEval "vrewoinrv09g3" (<@ compare 1 0 > 0 @>) true
+        checkEval "vrewoinrv09g4" (<@ 0 < 1 @>) true
+        checkEval "vrewoinrv09g5" (<@ 0 <= 1 @>) true
+        checkEval "vrewoinrv09g6" (<@ 1 <= 1 @>) true
+        checkEval "vrewoinrv09g7" (<@ 2 <= 1 @>) false
+        checkEval "vrewoinrv09g8" (<@ 0 > 1 @>) false
+        checkEval "vrewoinrv09g9" (<@ 0 >= 1 @>) false
+        checkEval "vrewoinrv09g0" (<@ 1 >= 1 @>) true
+        checkEval "vrewoinrv09gQ" (<@ 2 >= 1 @>) true
+
+        checkEval "vrewoinrv09gw" (<@ compare 0.0 0.0 = 0 @>) true
+        checkEval "vrewoinrv09ge" (<@ compare 0.0 1.0 < 0 @>) true
+        checkEval "vrewoinrv09gr" (<@ compare 1.0 0.0 > 0 @>) true
+        checkEval "vrewoinrv09gt" (<@ 0.0 < 1.0 @>) true
+        checkEval "vrewoinrv09gy" (<@ 0.0 <= 1.0 @>) true
+        checkEval "vrewoinrv09gu" (<@ 1.0 <= 1.0 @>) true
+        checkEval "vrewoinrv09gi" (<@ 2.0 <= 1.0 @>) false
+        checkEval "vrewoinrv09go" (<@ 0.0 > 1.0 @>) false
+        checkEval "vrewoinrv09gp" (<@ 0.0 >= 1.0 @>) false
+        checkEval "vrewoinrv09ga" (<@ 1.0 >= 1.0 @>) true
+        checkEval "vrewoinrv09gs" (<@ 2.0 >= 1.0 @>) true
+
+        checkEval "vrewoinrv09gd" (<@ compare 0.0f 0.0f = 0 @>) true
+        checkEval "vrewoinrv09gf" (<@ compare 0.0f 1.0f < 0 @>) true
+        checkEval "vrewoinrv09gg" (<@ compare 1.0f 0.0f > 0 @>) true
+        checkEval "vrewoinrv09gh" (<@ 0.0f < 1.0f @>) true
+        checkEval "vrewoinrv09gk" (<@ 0.0f <= 1.0f @>) true
+        checkEval "vrewoinrv09gl" (<@ 1.0f <= 1.0f @>) true
+        checkEval "vrewoinrv09gz" (<@ 2.0f <= 1.0f @>) false
+        checkEval "vrewoinrv09gx" (<@ 0.0f > 1.0f @>) false
+        checkEval "vrewoinrv09gc" (<@ 0.0f >= 1.0f @>) false
+        checkEval "vrewoinrv09gv" (<@ 1.0f >= 1.0f @>) true
+        checkEval "vrewoinrv09gb" (<@ 2.0f >= 1.0f @>) true
+
+        checkEval "vrewoinrv09gn" (<@ compare 0L 0L = 0 @>) true
+        checkEval "vrewoinrv09gm" (<@ compare 0L 1L < 0 @>) true
+        checkEval "vrewoinrv09g11" (<@ compare 1L 0L > 0 @>) true
+        checkEval "vrewoinrv09g12" (<@ 0L < 1L @>) true
+        checkEval "vrewoinrv09g13" (<@ 0L <= 1L @>) true
+        checkEval "vrewoinrv09g14" (<@ 1L <= 1L @>) true
+        checkEval "vrewoinrv09g15" (<@ 2L <= 1L @>) false
+        checkEval "vrewoinrv09g16" (<@ 0L > 1L @>) false
+        checkEval "vrewoinrv09g17" (<@ 0L >= 1L @>) false
+        checkEval "vrewoinrv09g18" (<@ 1L >= 1L @>) true
+        checkEval "vrewoinrv09g19" (<@ 2L >= 1L @>) true
+
+        checkEval "vrewoinrv09g21" (<@ compare 0y 0y = 0 @>) true
+        checkEval "vrewoinrv09g22" (<@ compare 0y 1y < 0 @>) true
+        checkEval "vrewoinrv09g23" (<@ compare 1y 0y > 0 @>) true
+        checkEval "vrewoinrv09g24" (<@ 0y < 1y @>) true
+        checkEval "vrewoinrv09g25" (<@ 0y <= 1y @>) true
+        checkEval "vrewoinrv09g26" (<@ 1y <= 1y @>) true
+        checkEval "vrewoinrv09g27" (<@ 2y <= 1y @>) false
+        checkEval "vrewoinrv09g28" (<@ 0y > 1y @>) false
+        checkEval "vrewoinrv09g29" (<@ 0y >= 1y @>) false
+        checkEval "vrewoinrv09g30" (<@ 1y >= 1y @>) true
+        checkEval "vrewoinrv09g31" (<@ 2y >= 1y @>) true
+
+        checkEval "vrewoinrv09g32" (<@ compare 0M 0M = 0 @>) true
+        checkEval "vrewoinrv09g33" (<@ compare 0M 1M < 0 @>) true
+        checkEval "vrewoinrv09g34" (<@ compare 1M 0M > 0 @>) true
+        checkEval "vrewoinrv09g35" (<@ 0M < 1M @>) true
+        checkEval "vrewoinrv09g36" (<@ 0M <= 1M @>) true
+        checkEval "vrewoinrv09g37" (<@ 1M <= 1M @>) true
+        checkEval "vrewoinrv09g38" (<@ 2M <= 1M @>) false
+        checkEval "vrewoinrv09g39" (<@ 0M > 1M @>) false
+        checkEval "vrewoinrv09g40" (<@ 0M >= 1M @>) false
+        checkEval "vrewoinrv09g41" (<@ 1M >= 1M @>) true
+        checkEval "vrewoinrv09g42" (<@ 2M >= 1M @>) true
+
+        checkEval "vrewoinrv09g43" (<@ compare 0I 0I = 0 @>) true
+        checkEval "vrewoinrv09g44" (<@ compare 0I 1I < 0 @>) true
+        checkEval "vrewoinrv09g45" (<@ compare 1I 0I > 0 @>) true
+        checkEval "vrewoinrv09g46" (<@ 0I < 1I @>) true
+        checkEval "vrewoinrv09g47" (<@ 0I <= 1I @>) true
+        checkEval "vrewoinrv09g48" (<@ 1I <= 1I @>) true
+        checkEval "vrewoinrv09g49" (<@ 2I <= 1I @>) false
+        checkEval "vrewoinrv09g50" (<@ 0I > 1I @>) false
+        checkEval "vrewoinrv09g51" (<@ 0I >= 1I @>) false
+        checkEval "vrewoinrv09g52" (<@ 1I >= 1I @>) true
+        checkEval "vrewoinrv09g53" (<@ 2I >= 1I @>) true
+
+
+        checkEval "vrewoinrv09g" (<@ sin 0.0 @>) (sin 0.0)
+        checkEval "vrewoinrv09h" (<@ sinh 0.0 @>) (sinh 0.0)
+        checkEval "vrewoinrv09j" (<@ cos 0.0 @>) (cos 0.0)
+        checkEval "vrewoinrv09k" (<@ cosh 0.0 @>) (cosh 0.0)
+        checkEval "vrewoinrv09l" (<@ tan 1.0 @>) (tan 1.0)
+        checkEval "vrewoinrv09z" (<@ tanh 1.0 @>) (tanh 1.0)
+        checkEval "vrewoinrv09x" (<@ abs -2.0 @>) (abs -2.0)
+        checkEval "vrewoinrv09c" (<@ ceil 2.0 @>) (ceil 2.0)
+        checkEval "vrewoinrv09v" (<@ sqrt 2.0 @>) (sqrt 2.0)
+        checkEval "vrewoinrv09b" (<@ sign 2.0 @>) (sign 2.0)
+#if Portable
+#else
+        checkEval "vrewoinrv09n" (<@ truncate 2.3 @>) (truncate 2.3)
+#endif
+        checkEval "vrewoinrv09m" (<@ floor 2.3 @>) (floor 2.3)
+        checkEval "vrewoinrv09Q" (<@ round 2.3 @>) (round 2.3)
+        checkEval "vrewoinrv09W" (<@ log 2.3 @>) (log 2.3)
+        checkEval "vrewoinrv09E" (<@ log10 2.3 @>) (log10 2.3)
+        checkEval "vrewoinrv09R" (<@ exp 2.3 @>) (exp 2.3)
+        checkEval "vrewoinrv09T" (<@ 2.3 ** 2.4 @>) (2.3 ** 2.4)
+
+        checkEval "vrewoinrv09Y" (<@ sin 0.0f @>) (sin 0.0f)
+        checkEval "vrewoinrv09U" (<@ sinh 0.0f @>) (sinh 0.0f)
+        checkEval "vrewoinrv09I" (<@ cos 0.0f @>) (cos 0.0f)
+        checkEval "vrewoinrv09O" (<@ cosh 0.0f @>) (cosh 0.0f)
+        checkEval "vrewoinrv09P" (<@ tan 1.0f @>) (tan 1.0f)
+        checkEval "vrewoinrv09A" (<@ tanh 1.0f @>) (tanh 1.0f)
+        checkEval "vrewoinrv09S" (<@ abs -2.0f @>) (abs -2.0f)
+        checkEval "vrewoinrv09D" (<@ ceil 2.0f @>) (ceil 2.0f)
+        checkEval "vrewoinrv09F" (<@ sqrt 2.0f @>) (sqrt 2.0f)
+        checkEval "vrewoinrv09G" (<@ sign 2.0f @>) (sign 2.0f)
+#if Portable
+#else
+        checkEval "vrewoinrv09H" (<@ truncate 2.3f @>) (truncate 2.3f)
+#endif
+        checkEval "vrewoinrv09J" (<@ floor 2.3f @>) (floor 2.3f)
+        checkEval "vrewoinrv09K" (<@ round 2.3f @>) (round 2.3f)
+        checkEval "vrewoinrv09L" (<@ log 2.3f @>) (log 2.3f)
+        checkEval "vrewoinrv09Z" (<@ log10 2.3f @>) (log10 2.3f)
+        checkEval "vrewoinrv09X" (<@ exp 2.3f @>) (exp 2.3f)
+        checkEval "vrewoinrv09C" (<@ 2.3f ** 2.4f @>) (2.3f ** 2.4f)
+
+        checkEval "vrewoinrv09V" (<@ ceil 2.0M @>) (ceil 2.0M)
+        checkEval "vrewoinrv09B" (<@ sign 2.0M @>) (sign 2.0M)
+#if Portable
+#else
+        checkEval "vrewoinrv09N" (<@ truncate 2.3M @>) (truncate 2.3M)
+#endif
+        checkEval "vrewoinrv09M" (<@ floor 2.3M @>) (floor 2.3M)
+
+        checkEval "vrewoinrv09QQ" (<@ sign -2 @>) (sign -2)
+        checkEval "vrewoinrv09WW" (<@ sign -2y @>) (sign -2y)
+        checkEval "vrewoinrv09EE" (<@ sign -2s @>) (sign -2s)
+        checkEval "vrewoinrv09RR" (<@ sign -2L @>) (sign -2L)
+
+        checkEval "vrewoinrv09TT" (<@ [ 0 .. 10 ] @>) [ 0 .. 10 ]
+        checkEval "vrewoinrv09YY" (<@ [ 0y .. 10y ] @>) [ 0y .. 10y ]
+        checkEval "vrewoinrv09UU" (<@ [ 0s .. 10s ] @>) [ 0s .. 10s ]
+        checkEval "vrewoinrv09II" (<@ [ 0L .. 10L ] @>) [ 0L .. 10L ]
+        checkEval "vrewoinrv09OO" (<@ [ 0u .. 10u ] @>) [ 0u .. 10u ]
+        checkEval "vrewoinrv09PP" (<@ [ 0uy .. 10uy ] @>) [ 0uy .. 10uy ]
+        checkEval "vrewoinrv09AA" (<@ [ 0us .. 10us ] @>) [ 0us .. 10us ]
+        checkEval "vrewoinrv09SS" (<@ [ 0UL .. 10UL ] @>) [ 0UL .. 10UL ]
+        
+        //Comment this testcase under portable due to bug 500323:[FSharp] portable library can't run "round" function
+#if Portable
+#else        
+        // Round dynamic dispatch on Decimal
+        checkEval "vrewoinrv09FF" (<@ round 2.3M @>) (round 2.3M)
+#endif
+
+        // Measure stuff:
+        checkEval "vrewoinrv09GG" (<@ atan2 3.0 4.0 @>) (atan2 3.0 4.0 )
+        
+        [<Measure>]
+        type kg
+        checkEval "vrewoinrv09HH" (<@ 1.0<kg> @>) (1.0<kg>)
+
+        // Measure stuff:
+        checkEval "vrewoinrv09JJ" (<@ 1.0<kg> + 2.0<kg> @>) (3.0<kg>)
+
+
+        Eval <@ Array.average [| 0.0 .. 1.0 .. 10000.0 |] @> 
+
+    module LanguagePrimitiveCastingUnitsOfMeasure = 
+        [<Measure>]
+        type m
+
+        checkEval "castingunits1" (<@ 2.5 |> LanguagePrimitives.FloatWithMeasure<m> |> float @>) 2.5
+        checkEval "castingunits2" (<@ 2.5f |> LanguagePrimitives.Float32WithMeasure<m> |> float32 @>) 2.5f
+        checkEval "castingunits3" (<@ 2.0m |> LanguagePrimitives.DecimalWithMeasure<m> |> decimal @>) 2.0M
+        checkEval "castingunits4" (<@ 2 |> LanguagePrimitives.Int32WithMeasure<m> |> int @>) 2
+        checkEval "castingunits5" (<@ 2L |> LanguagePrimitives.Int64WithMeasure<m> |> int64 @>) 2L
+        checkEval "castingunits6" (<@ 2s |> LanguagePrimitives.Int16WithMeasure<m> |> int16 @>) 2s
+        checkEval "castingunits7" (<@ 2y |> LanguagePrimitives.SByteWithMeasure<m> |> sbyte @>) 2y
+
+
+
+    module LargerAutomaticDiferentiationTest_FSharp_1_0_Bug_3498 = 
+
+        let q = 
+            <@ (fun (x1:double) -> 
+                   let fwd6 = 
+                       let y3 = x1 * x1
+                       (y3, (fun yb4 -> yb4 * 2.0 * x1))
+                   let rev5 = snd fwd6
+                   let w0 = fst fwd6
+
+                   let fwd14 = 
+                       let y11 = w0 + 1.0
+                       (y11, (fun yb12 -> yb12 * 1.0))
+                   let rev13 = snd fwd14
+                   let y8 = fst fwd14
+                   (y8, (fun y8b10 -> 
+                              let w0b2 = 0.0 
+                              let x1b1 = 0.0 
+                              let dxs15 = rev13 y8b10 
+                              let w0b2 = w0b2 + dxs15 
+                              let dxs7 = rev5 w0b2 
+                              let x1b1 = x1b1 + dxs7 
+                              x1b1))) @>
+
+        checkEval "!cwjkwwecew0" <@ fst ((%q) 4.0) @> 17.0
+        checkEval "!cwjkwwecew0" <@ snd ((%q) 4.0) 0.1 @> 0.8
+
+    module FunkyMethodRepresentations = 
+        // The IsSome and IsNone properties are represented as static methods because
+        // option uses 'null' as a representation
+        checkEval "clkedw0" (<@ let x : int option = None in x.IsSome @>) false
+        checkEval "clkedw1" (<@ let x : int option = None in x.IsNone @>) true
+        checkEval "clkedw2" (<@ let x : int option = Some 1 in x.Value @>) 1
+        checkEval "clkedw3" (<@ let x : int option = Some 1 in x.ToString() @>) "Some(1)"
+
+    module Extensions = 
+        type System.Object with 
+            member x.ExtensionMethod0()  = 3
+            member x.ExtensionMethod1()  = ()
+            member x.ExtensionMethod2(y:int)  = y
+            member x.ExtensionMethod3(y:int)  = ()
+            member x.ExtensionMethod4(y:int,z:int)  = y + z
+            member x.ExtensionMethod5(y:(int*int))  = y 
+            member x.ExtensionProperty1 = 3
+            member x.ExtensionProperty2 with get() = 3
+            member x.ExtensionProperty3 with set(v:int) = ()
+            member x.ExtensionIndexer1 with get(idx:int) = idx
+            member x.ExtensionIndexer2 with set(idx:int) (v:int) = ()
+
+        type System.Int32 with 
+            member x.Int32ExtensionMethod0()  = 3
+            member x.Int32ExtensionMethod1()  = ()
+            member x.Int32ExtensionMethod2(y:int)  = y
+            member x.Int32ExtensionMethod3(y:int)  = ()
+            member x.Int32ExtensionMethod4(y:int,z:int)  = y + z
+            member x.Int32ExtensionMethod5(y:(int*int))  = y 
+            member x.Int32ExtensionProperty1 = 3
+            member x.Int32ExtensionProperty2 with get() = 3
+            member x.Int32ExtensionProperty3 with set(v:int) = ()
+            member x.Int32ExtensionIndexer1 with get(idx:int) = idx
+            member x.Int32ExtensionIndexer2 with set(idx:int) (v:int) = ()
+
+        let v = new obj()
+        checkEval "ecnowe0" (<@ v.ExtensionMethod0() @>)  3
+#if STATEMENTS_IN_EXPRESSIONS
+        checkEval "ecnowe1" (<@ v.ExtensionMethod1() @>)  ()
+        checkEval "ecnowe3" (<@ v.ExtensionMethod3(3) @>)  ()
+        checkEval "ecnowe8" (<@ v.ExtensionProperty3 <- 4 @>)  ()
+        checkEval "ecnowea" (<@ v.ExtensionIndexer2(3) <- 4 @>)  ()
+        check "ecnowec" (Eval (<@ v.ExtensionMethod1 @>) ()) ()
+        check "ecnowee" (Eval (<@ v.ExtensionMethod3 @>) 3) ()
+        checkEval "ecnweh8" (<@ v2b.ExtensionProperty3 <- 4 @>)  ()
+        checkEval "ecnweh1" (<@ v2.ExtensionMethod1() @>) ()
+        checkEval "ecnweh3" (<@ v2.ExtensionMethod3(3) @>) ()
+        checkEval "ecnweha" (<@ v2b.ExtensionIndexer2(3) <- 4 @>)  ()
+#endif
+        checkEval "ecnowe2" (<@ v.ExtensionMethod2(3) @>) 3
+        checkEval "ecnowe4" (<@ v.ExtensionMethod4(3,4) @>)  7
+        checkEval "ecnowe5" (<@ v.ExtensionMethod5(3,4) @>)  (3,4)
+        checkEval "ecnowe6" (<@ v.ExtensionProperty1 @>) 3
+        checkEval "ecnowe7" (<@ v.ExtensionProperty2 @>) 3
+        checkEval "ecnowe9" (<@ v.ExtensionIndexer1(3) @>) 3
+
+        check "ecnoweb" (Eval (<@ v.ExtensionMethod0 @>) ()) 3 
+        check "ecnowed" (Eval (<@ v.ExtensionMethod2 @>) 3) 3
+        check "ecnowef" (Eval (<@ v.ExtensionMethod4 @>) (3,4)) 7
+        check "ecnoweg" (Eval (<@ v.ExtensionMethod5 @>) (3,4)) (3,4)
+
+        let v2 = 3
+        let mutable v2b = 3
+        checkEval "ecnweh0" (<@ v2.ExtensionMethod0() @>) 3
+        checkEval "ecnweh2" (<@ v2.ExtensionMethod2(3) @>) 3
+        checkEval "ecnweh4" (<@ v2.ExtensionMethod4(3,4) @>) 7
+        checkEval "ecnweh5" (<@ v2.ExtensionMethod5(3,4) @>) (3,4)
+        checkEval "ecnweh6" (<@ v2.ExtensionProperty1 @>) 3
+        checkEval "ecnweh7" (<@ v2.ExtensionProperty2 @>) 3
+        checkEval "ecnweh9" (<@ v2.ExtensionIndexer1(3) @>) 3
+
+
+
+    module NullableAddInt = 
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "addip2oin209v304" <@ 2 +? Nullable 3 @> (Nullable 5)
+        checkEval "addip2oin209v315" <@ 3 +? Nullable 3 @> (Nullable 6)
+        checkEval "addip2oin209v316" <@ 4 +? Nullable 3 @> (Nullable 7)
+        checkEval "addip2oin209v337" <@ 3 +? Nullable() @> (Nullable ())
+
+        checkEval "addip2oin209v304" <@ Nullable 2 ?+ 3 @> (Nullable 5)
+        checkEval "addip2oin209v315" <@ Nullable 3 ?+ 3 @> (Nullable 6)
+        checkEval "addip2oin209v316" <@ Nullable 4 ?+ 3 @> (Nullable 7)
+        checkEval "addip2oin209v337" <@ Nullable () ?+ 3 @> (Nullable ())
+
+        checkEval "addip2oin209v30a" <@ Nullable 2 ?+? Nullable 3 @> (Nullable 5)
+        checkEval "addip2oin209v31s" <@ Nullable 3 ?+? Nullable 3 @> (Nullable 6)
+        checkEval "addip2oin209v31d" <@ Nullable 4 ?+? Nullable 3 @> (Nullable 7)
+        checkEval "addip2oin209v33f" <@ Nullable () ?+? Nullable 3 @> (Nullable ())
+
+        checkEval "addip2oin209v30k" <@ Nullable 2 ?+? Nullable () @> (Nullable ())
+        checkEval "addip2oin209v31l" <@ Nullable 3 ?+? Nullable () @> (Nullable ())
+        checkEval "addip2oin209v31z" <@ Nullable 4 ?+? Nullable () @> (Nullable ())
+        checkEval "addip2oin209v33x" <@ Nullable () ?+? Nullable () @> (Nullable ())
+
+        // Some tests to checkEval the type inference when the left and right types are not identical
+        let now = System.DateTime.Now
+        checkEval "addip2oin209v304dt" <@ Nullable now ?+ System.TimeSpan.Zero @> (Nullable now)
+        checkEval "addip2oin209v304dt" <@ now +? Nullable System.TimeSpan.Zero @> (Nullable now)
+        checkEval "addip2oin209v304dt" <@ now +? Nullable () @> (Nullable ())
+        checkEval "addip2oin209v30adt" <@ Nullable now ?+? Nullable System.TimeSpan.Zero @> (Nullable now)
+        checkEval "addip2oin209v30kdt" <@ Nullable now ?+? Nullable () @> (Nullable ())
+
+    module NullableAddIntMeasure = 
+        open Microsoft.FSharp.Linq.NullableOperators
+        open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols
+
+        checkEval "addip2oin209v304" <@ 2<kg> +? Nullable 3<kg> @> (Nullable 5<kg>)
+        checkEval "addip2oin209v304" <@ Nullable 2<m> ?+ 3<m> @> (Nullable 5<m>)
+
+    module NullableAddDouble = 
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "adddp2oin209v304" <@ 2.0 +? Nullable 3.0 @> (Nullable 5.0)
+        checkEval "adddp2oin209v315" <@ 3.0 +? Nullable 3.0 @> (Nullable 6.0)
+        checkEval "adddp2oin209v316" <@ 4.0 +? Nullable 3.0 @> (Nullable 7.0)
+        checkEval "adddp2oin209v337" <@ 3.0 +? Nullable() @> (Nullable ())
+
+        checkEval "adddp2oin209v304" <@ Nullable 2.0 ?+ 3.0 @> (Nullable 5.0)
+        checkEval "adddp2oin209v315" <@ Nullable 3.0 ?+ 3.0 @> (Nullable 6.0)
+        checkEval "adddp2oin209v316" <@ Nullable 4.0 ?+ 3.0 @> (Nullable 7.0)
+        checkEval "adddp2oin209v337" <@ Nullable () ?+ 3.0 @> (Nullable ())
+
+        checkEval "adddp2oin209v30a" <@ Nullable 2.0 ?+? Nullable 3.0 @> (Nullable 5.0)
+        checkEval "adddp2oin209v31s" <@ Nullable 3.0 ?+? Nullable 3.0 @> (Nullable 6.0)
+        checkEval "adddp2oin209v31d" <@ Nullable 4.0 ?+? Nullable 3.0 @> (Nullable 7.0)
+        checkEval "adddp2oin209v33f" <@ Nullable () ?+? Nullable 3.0 @> (Nullable ())
+
+        checkEval "adddp2oin209v30k" <@ Nullable 2.0 ?+? Nullable () @> (Nullable ())
+        checkEval "adddp2oin209v31l" <@ Nullable 3.0 ?+? Nullable () @> (Nullable ())
+        checkEval "adddp2oin209v31z" <@ Nullable 4.0 ?+? Nullable () @> (Nullable ())
+        checkEval "adddp2oin209v33x" <@ Nullable () ?+? Nullable () @> (Nullable ())
+
+        checkText "p2oin209v33x" <@ Nullable 2 ?+? Nullable () @> "(Convert(2) + new Nullable`1())"
+        checkText "p2oin209v33x" <@ Nullable 2 ?+ 3 @> "(Convert(2) + Convert(3))"
+        checkText "p2oin209v33x" <@ 2 +? Nullable 3 @> "(Convert(2) + Convert(3))"
+
+    module NullableAddDoubleMeasure = 
+        open Microsoft.FSharp.Linq.NullableOperators
+        open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols
+
+        checkEval "adddp2oin209v304" <@ 2.0<kg> +? Nullable 3.0<kg> @> (Nullable 5.0<kg>)
+        checkEval "adddp2oin209v304" <@ Nullable 2.0<m> ?+ 3.0<m> @> (Nullable 5.0<m>)
+        checkEval "adddp2oin209v31z" <@ Nullable 4.0<s> ?+? Nullable () @> (Nullable ())
+
+    module NullableConversions = 
+        open Microsoft.FSharp.Linq
+        open Microsoft.FSharp.Linq.NullableOperators
+        open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols
+
+        checkEval "opp2oin209v3041" <@ Nullable.byte (Nullable 2) @> (Nullable 2uy)
+        checkEval "opp2oin209v3042" <@ Nullable.sbyte (Nullable 2) @> (Nullable 2y)
+        checkEval "opp2oin209v3043" <@ Nullable.uint16(Nullable 2 )@> (Nullable 2us)
+        checkEval "opp2oin209v3044" <@ Nullable.int16(Nullable 2 )@> (Nullable 2s)
+        checkEval "opp2oin209v3045" <@ Nullable.uint32 (Nullable 2s) @> (Nullable 2u)
+        checkEval "opp2oin209v3046" <@ Nullable.int32 (Nullable 2s) @> (Nullable 2)
+        checkEval "opp2oin209v3047" <@ Nullable.uint64(Nullable 2 )@> (Nullable 2UL)
+        checkEval "opp2oin209v3048" <@ Nullable.int64(Nullable 2 )@> (Nullable 2L)
+        checkEval "opp2oin209v3049" <@ Nullable.decimal(Nullable 2 )@> (Nullable 2M)
+        checkEval "opp2oin209v304q" <@ Nullable.char(Nullable (int '2') )@> (Nullable '2')
+        checkEval "opp2oin209v304w" <@ Nullable.enum(Nullable 2 ): System.Nullable<System.DayOfWeek> @> (Nullable System.DayOfWeek.Tuesday )
+
+        checkEval "opp2oin209v304e" <@ Nullable.sbyte (Nullable 2<kg>) @> (Nullable 2y)
+        checkEval "opp2oin209v304r" <@ Nullable.int16 (Nullable 2<kg>) @> (Nullable 2s)
+        checkEval "opp2oin209v304t" <@ Nullable.int32 (Nullable 2s<kg>) @> (Nullable 2)
+        checkEval "opp2oin209v304y" <@ Nullable.int64 (Nullable 2<kg>) @> (Nullable 2L)
+        checkEval "opp2oin209v304u" <@ Nullable.float (Nullable 2<kg>) @> (Nullable 2.0)
+        checkEval "opp2oin209v304i" <@ Nullable.float32 (Nullable 2<kg>) @> (Nullable 2.0f)
+
+
+
+    module NullableMinus = 
+
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "minusp2oin209v304" <@ 2 -? Nullable 3 @> (Nullable -1)
+        checkEval "minusp2oin209v315" <@ 3 -? Nullable 3 @> (Nullable 0)
+        checkEval "minusp2oin209v316" <@ 4 -? Nullable 3 @> (Nullable 1)
+        checkEval "minusp2oin209v337" <@ 3 -? Nullable() @> (Nullable ())
+
+        checkEval "minusp2oin209v304" <@ Nullable 2 ?- 3 @> (Nullable -1)
+        checkEval "minusp2oin209v315" <@ Nullable 3 ?- 3 @> (Nullable 0)
+        checkEval "minusp2oin209v316" <@ Nullable 4 ?- 3 @> (Nullable 1)
+        checkEval "minusp2oin209v337" <@ Nullable () ?- 3 @> (Nullable ())
+
+        checkEval "minusp2oin209v30a" <@ Nullable 2 ?-? Nullable 3 @> (Nullable -1)
+        checkEval "minusp2oin209v31s" <@ Nullable 3 ?-? Nullable 3 @> (Nullable 0)
+        checkEval "minusp2oin209v31d" <@ Nullable 4 ?-? Nullable 3 @> (Nullable 1)
+        checkEval "minusp2oin209v33f" <@ Nullable () ?-? Nullable 3 @> (Nullable ())
+
+        checkEval "minusp2oin209v30k" <@ Nullable 2 ?-? Nullable () @> (Nullable ())
+        checkEval "minusp2oin209v31l" <@ Nullable 3 ?-? Nullable () @> (Nullable ())
+        checkEval "minusp2oin209v31z" <@ Nullable 4 ?-? Nullable () @> (Nullable ())
+        checkEval "minusp2oin209v33x" <@ Nullable () ?-? Nullable () @> (Nullable ())
+
+        // Some tests to checkEval the type inference when the left and right types are not identical
+        let now = System.DateTime.Now
+        checkEval "minusp2oin209v304dt" <@ Nullable now ?- System.TimeSpan.Zero @> (Nullable now)
+        checkEval "minusp2oin209v304dt" <@ now -? Nullable System.TimeSpan.Zero @> (Nullable now)
+        checkEval "minusp2oin209v304dt" <@ now -? Nullable<System.TimeSpan> () @> (Nullable ())
+        checkEval "minusp2oin209v30adt" <@ Nullable now ?-? Nullable System.TimeSpan.Zero @> (Nullable now)
+        checkEval "minusp2oin209v30kdt" <@ Nullable now ?-? Nullable<System.TimeSpan> () @> (Nullable ())
+
+        checkText "p2oin209v33x" <@ Nullable 2 ?-? Nullable () @> "(Convert(2) - new Nullable`1())"
+        checkText "p2oin209v33x" <@ Nullable 2 ?- 3 @> "(Convert(2) - Convert(3))"
+        checkText "p2oin209v33x" <@ 2 -? Nullable 3 @> "(Convert(2) - Convert(3))"
+
+    module NullableMultiply = 
+
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "multp2oin209v304" <@ 2 *? Nullable 3 @> (Nullable 6)
+        checkEval "multp2oin209v315" <@ 3 *? Nullable 3 @> (Nullable 9)
+        checkEval "multp2oin209v316" <@ 4 *? Nullable 3 @> (Nullable 12)
+        checkEval "multp2oin209v337" <@ 3 *? Nullable() @> (Nullable ())
+
+        checkEval "multp2oin209v304" <@ Nullable 2 ?* 3 @> (Nullable 6)
+        checkEval "multp2oin209v315" <@ Nullable 3 ?* 3 @> (Nullable 9)
+        checkEval "multp2oin209v316" <@ Nullable 4 ?* 3 @> (Nullable 12)
+        checkEval "multp2oin209v337" <@ Nullable () ?* 3 @> (Nullable ())
+
+        checkEval "multp2oin209v30a" <@ Nullable 2 ?*? Nullable 3 @> (Nullable 6)
+        checkEval "multp2oin209v31s" <@ Nullable 3 ?*? Nullable 3 @> (Nullable 9)
+        checkEval "multp2oin209v31d" <@ Nullable 4 ?*? Nullable 3 @> (Nullable 12)
+        checkEval "multp2oin209v33f" <@ Nullable () ?*? Nullable 3 @> (Nullable ())
+
+        checkEval "multp2oin209v30k" <@ Nullable 2 ?*? Nullable () @> (Nullable ())
+        checkEval "multp2oin209v31l" <@ Nullable 3 ?*? Nullable () @> (Nullable ())
+        checkEval "multp2oin209v31z" <@ Nullable 4 ?*? Nullable () @> (Nullable ())
+        checkEval "multp2oin209v33x" <@ Nullable () ?*? Nullable () @> (Nullable ())
+
+        checkText "p2oin209v33x" <@ Nullable 2 ?*? Nullable () @> "(Convert(2) * new Nullable`1())"
+        checkText "p2oin209v33x" <@ Nullable 2 ?* 3 @> "(Convert(2) * Convert(3))"
+        checkText "p2oin209v33x" <@ 2 *? Nullable 3 @> "(Convert(2) * Convert(3))"
+
+
+    module NullableDivide = 
+
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "divp2oin209v304" <@ 2 /? Nullable 3 @> (Nullable 0)
+        checkEval "divp2oin209v315" <@ 3 /? Nullable 3 @> (Nullable 1)
+        checkEval "divp2oin209v316" <@ 4 /? Nullable 3 @> (Nullable 1)
+        checkEval "divp2oin209v337" <@ 3 /? Nullable() @> (Nullable ())
+
+        checkEval "divp2oin209v304" <@ Nullable 2 ?/ 3 @> (Nullable 0)
+        checkEval "divp2oin209v315" <@ Nullable 3 ?/ 3 @> (Nullable 1)
+        checkEval "divp2oin209v316" <@ Nullable 4 ?/ 3 @> (Nullable 1)
+        checkEval "divp2oin209v337" <@ Nullable () ?/ 3 @> (Nullable ())
+
+        checkEval "divp2oin209v30a" <@ Nullable 2 ?/? Nullable 3 @> (Nullable 0)
+        checkEval "divp2oin209v31s" <@ Nullable 3 ?/? Nullable 3 @> (Nullable 1)
+        checkEval "divp2oin209v31d" <@ Nullable 4 ?/? Nullable 3 @> (Nullable 1)
+        checkEval "divp2oin209v33f" <@ Nullable () ?/? Nullable 3 @> (Nullable ())
+
+        checkEval "divp2oin209v30k" <@ Nullable 2 ?/? Nullable () @> (Nullable ())
+        checkEval "divp2oin209v31l" <@ Nullable 3 ?/? Nullable () @> (Nullable ())
+        checkEval "divp2oin209v31z" <@ Nullable 4 ?/? Nullable () @> (Nullable ())
+        checkEval "divp2oin209v33x" <@ Nullable () ?/? Nullable () @> (Nullable ())
+
+        checkText "p2oin209v33x" <@ Nullable 2 ?/? Nullable () @> "(Convert(2) / new Nullable`1())"
+        checkText "p2oin209v33x" <@ Nullable 2 ?/ 3 @> "(Convert(2) / Convert(3))"
+        checkText "p2oin209v33x" <@ 2 /? Nullable 3 @> "(Convert(2) / Convert(3))"
+
+    module NullableModulo = 
+
+        open Microsoft.FSharp.Linq.NullableOperators
+
+        checkEval "modp2oin209v304" <@ 2 %? Nullable 3 @> (Nullable 2)
+        checkEval "modp2oin209v315" <@ 3 %? Nullable 3 @> (Nullable 0)
+        checkEval "modp2oin209v316" <@ 4 %? Nullable 3 @> (Nullable 1)
+        checkEval "modp2oin209v337" <@ 3 %? Nullable() @> (Nullable ())
+
+        checkEval "modp2oin209v304" <@ Nullable 2 ?% 3 @> (Nullable 2)
+        checkEval "modp2oin209v315" <@ Nullable 3 ?% 3 @> (Nullable 0)
+        checkEval "modp2oin209v316" <@ Nullable 4 ?% 3 @> (Nullable 1)
+        checkEval "modp2oin209v337" <@ Nullable () ?% 3 @> (Nullable ())
+
+        checkEval "modp2oin209v30a" <@ Nullable 2 ?%? Nullable 3 @> (Nullable 2)
+        checkEval "modp2oin209v31s" <@ Nullable 3 ?%? Nullable 3 @> (Nullable 0)
+        checkEval "modp2oin209v31d" <@ Nullable 4 ?%? Nullable 3 @> (Nullable 1)
+        checkEval "modp2oin209v33f" <@ Nullable () ?%? Nullable 3 @> (Nullable ())
+
+        checkEval "modp2oin209v30k" <@ Nullable 2 ?%? Nullable () @> (Nullable ())
+        checkEval "modp2oin209v31l" <@ Nullable 3 ?%? Nullable () @> (Nullable ())
+        checkEval "modp2oin209v31z" <@ Nullable 4 ?%? Nullable () @> (Nullable ())
+        checkEval "modp2oin209v33x" <@ Nullable () ?%? Nullable () @> (Nullable ())
+
+
+        checkText "p2oin209v33x" <@ Nullable 2 ?%? Nullable () @> "(Convert(2) % new Nullable`1())"
+        checkText "p2oin209v33x" <@ Nullable 2 ?% 3 @> "(Convert(2) % Convert(3))"
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesNullableOperators/build.bat b/tests/fsharp/core/queriesNullableOperators/build.bat
new file mode 100644
index 0000000..8ed3cc0
--- /dev/null
+++ b/tests/fsharp/core/queriesNullableOperators/build.bat
@@ -0,0 +1,47 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesNullableOperators/run.bat b/tests/fsharp/core/queriesNullableOperators/run.bat
new file mode 100644
index 0000000..9cde240
--- /dev/null
+++ b/tests/fsharp/core/queriesNullableOperators/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesNullableOperators/test.fsx b/tests/fsharp/core/queriesNullableOperators/test.fsx
new file mode 100644
index 0000000..48ee277
--- /dev/null
+++ b/tests/fsharp/core/queriesNullableOperators/test.fsx
@@ -0,0 +1,316 @@
+// #Query
+#if Portable
+module Core_queriesNullableOperators
+#endif
+
+
+#nowarn "57"
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+#if NetCore
+#else
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+#endif
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected %A got %A" s v2 v1
+
+    let test s b = check s b true
+
+module NullableOperatorTests = 
+
+    open Microsoft.FSharp.Linq.NullableOperators
+    check "op2oin209v20" (Nullable 2 ?=? Nullable 3) false
+    check "op2oin209v21" (Nullable 3 ?=? Nullable 3) true
+    check "op2oin209v22" (Nullable 3 ?=? Nullable()) false
+    check "op2oin209v23" (Nullable () ?=? Nullable 3) false
+    check "op2oin209v24" (Nullable () ?=? Nullable ()) true
+
+    check "op2oin209v11" (2 =? Nullable 3) false
+    check "op2oin209v12" (3 =? Nullable 3) true
+    check "op2oin209v13" (3 =? Nullable()) false
+
+    check "op2oin209v30" (Nullable 2 ?= 3) false
+    check "op2oin209v31" (Nullable 3 ?= 3) true
+    check "op2oin209v33" (Nullable () ?= 3) false
+
+    check "op2oin209v301" (Nullable 2 ?> 3) false
+    check "op2oin209v312" (Nullable 3 ?> 3) false
+    check "op2oin209v313" (Nullable 4 ?> 3) true
+    check "op2oin209v334" (Nullable () ?> 3) false
+
+    check "op2oin209v304" (Nullable 2 ?>= 3) false
+    check "op2oin209v315" (Nullable 3 ?>= 3) true
+    check "op2oin209v316" (Nullable 4 ?>= 3) true
+    check "op2oin209v337" (Nullable () ?>= 3) false
+
+    check "op2oin209v308" (Nullable 2 ?< 3) true
+    check "op2oin209v319" (Nullable 3 ?< 3) false
+    check "op2oin209v31q" (Nullable 4 ?< 3) false
+    check "op2oin209v33w" (Nullable () ?< 3) false
+
+    check "op2oin209v30e" (Nullable 2 ?<= 3) true
+    check "op2oin209v31r" (Nullable 3 ?<= 3) true
+    check "op2oin209v31t" (Nullable 4 ?<= 3) false
+    check "op2oin209v33y" (Nullable () ?<= 3) false
+
+
+    check "op2oin209v30u" (Nullable 2 ?>? Nullable 3) false
+    check "op2oin209v31i" (Nullable 3 ?>? Nullable 3) false
+    check "op2oin209v31o" (Nullable 4 ?>? Nullable 3) true
+    check "op2oin209v33p" (Nullable () ?>? Nullable 3) false
+
+    check "op2oin209v30a" (Nullable 2 ?>=? Nullable 3) false
+    check "op2oin209v31s" (Nullable 3 ?>=? Nullable 3) true
+    check "op2oin209v31d" (Nullable 4 ?>=? Nullable 3) true
+    check "op2oin209v33f" (Nullable () ?>=? Nullable 3) false
+
+    check "op2oin209v30g" (Nullable 2 ?<? Nullable 3) true
+    check "op2oin209v31h" (Nullable 3 ?<? Nullable 3) false
+    check "op2oin209v31j" (Nullable 4 ?<? Nullable 3) false
+    check "op2oin209v33k" (Nullable () ?<? Nullable 3) false
+
+    check "op2oin209v30l" (Nullable 2 ?<=? Nullable 3) true
+    check "op2oin209v31a" (Nullable 3 ?<=? Nullable 3) true
+    check "op2oin209v31s" (Nullable 4 ?<=? Nullable 3) false
+    check "op2oin209v33d" (Nullable () ?<=? Nullable 3) false
+
+
+
+    check "op2oin209v30f" (Nullable 2 ?>? Nullable ()) false
+    check "op2oin209v31g" (Nullable 3 ?>? Nullable ()) false
+    check "op2oin209v31h" (Nullable 4 ?>? Nullable ()) false
+    check "op2oin209v33j" (Nullable () ?>? Nullable ()) false
+
+    check "op2oin209v30k" (Nullable 2 ?>=? Nullable ()) false
+    check "op2oin209v31l" (Nullable 3 ?>=? Nullable ()) false
+    check "op2oin209v31z" (Nullable 4 ?>=? Nullable ()) false
+    check "op2oin209v33x" (Nullable () ?>=? Nullable ()) false
+
+    check "op2oin209v30c" (Nullable 2 ?<? Nullable ()) false
+    check "op2oin209v31v" (Nullable 3 ?<? Nullable ()) false
+    check "op2oin209v31b" (Nullable 4 ?<? Nullable ()) false
+    check "op2oin209v33n" (Nullable () ?<? Nullable ()) false
+
+    check "op2oin209v30m" (Nullable 2 ?<=? Nullable ()) false
+    check "op2oin209v31Q" (Nullable 3 ?<=? Nullable ()) false
+    check "op2oin209v31W" (Nullable 4 ?<=? Nullable ()) false
+    check "op2oin209v33E" (Nullable () ?<=? Nullable ()) false
+
+
+
+module NullableAddInt = 
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2 +? Nullable 3) (Nullable 5)
+    check "p2oin209v315" (3 +? Nullable 3) (Nullable 6)
+    check "p2oin209v316" (4 +? Nullable 3) (Nullable 7)
+    check "p2oin209v337" (3 +? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2 ?+ 3) (Nullable 5)
+    check "p2oin209v315" (Nullable 3 ?+ 3) (Nullable 6)
+    check "p2oin209v316" (Nullable 4 ?+ 3) (Nullable 7)
+    check "p2oin209v337" (Nullable () ?+ 3) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2 ?+? Nullable 3) (Nullable 5)
+    check "p2oin209v31s" (Nullable 3 ?+? Nullable 3) (Nullable 6)
+    check "p2oin209v31d" (Nullable 4 ?+? Nullable 3) (Nullable 7)
+    check "p2oin209v33f" (Nullable () ?+? Nullable 3) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?+? Nullable ()) (Nullable ())
+
+    // Some tests to check the type inference when the left and right types are not identical
+    let now = System.DateTime.Now
+    check "p2oin209v304dt" (Nullable now ?+ System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v304dt" (now +? Nullable System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v304dt" (now +? Nullable ()) (Nullable ())
+    check "p2oin209v30adt" (Nullable now ?+? Nullable System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v30kdt" (Nullable now ?+? Nullable ()) (Nullable ())
+
+
+module NullableAddDouble = 
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2.0 +? Nullable 3.0) (Nullable 5.0)
+    check "p2oin209v315" (3.0 +? Nullable 3.0) (Nullable 6.0)
+    check "p2oin209v316" (4.0 +? Nullable 3.0) (Nullable 7.0)
+    check "p2oin209v337" (3.0 +? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2.0 ?+ 3.0) (Nullable 5.0)
+    check "p2oin209v315" (Nullable 3.0 ?+ 3.0) (Nullable 6.0)
+    check "p2oin209v316" (Nullable 4.0 ?+ 3.0) (Nullable 7.0)
+    check "p2oin209v337" (Nullable () ?+ 3.0) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2.0 ?+? Nullable 3.0) (Nullable 5.0)
+    check "p2oin209v31s" (Nullable 3.0 ?+? Nullable 3.0) (Nullable 6.0)
+    check "p2oin209v31d" (Nullable 4.0 ?+? Nullable 3.0) (Nullable 7.0)
+    check "p2oin209v33f" (Nullable () ?+? Nullable 3.0) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2.0 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3.0 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4.0 ?+? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?+? Nullable ()) (Nullable ())
+
+
+
+module NullableMinus = 
+
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2 -? Nullable 3) (Nullable -1)
+    check "p2oin209v315" (3 -? Nullable 3) (Nullable 0)
+    check "p2oin209v316" (4 -? Nullable 3) (Nullable 1)
+    check "p2oin209v337" (3 -? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2 ?- 3) (Nullable -1)
+    check "p2oin209v315" (Nullable 3 ?- 3) (Nullable 0)
+    check "p2oin209v316" (Nullable 4 ?- 3) (Nullable 1)
+    check "p2oin209v337" (Nullable () ?- 3) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2 ?-? Nullable 3) (Nullable -1)
+    check "p2oin209v31s" (Nullable 3 ?-? Nullable 3) (Nullable 0)
+    check "p2oin209v31d" (Nullable 4 ?-? Nullable 3) (Nullable 1)
+    check "p2oin209v33f" (Nullable () ?-? Nullable 3) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2 ?-? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3 ?-? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4 ?-? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?-? Nullable ()) (Nullable ())
+
+    // Some tests to check the type inference when the left and right types are not identical
+    let now = System.DateTime.Now
+    check "p2oin209v304dt" (Nullable now ?- System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v304dt" (now -? Nullable System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v304dt" (now -? Nullable<System.TimeSpan> ()) (Nullable ())
+    check "p2oin209v30adt" (Nullable now ?-? Nullable System.TimeSpan.Zero) (Nullable now)
+    check "p2oin209v30kdt" (Nullable now ?-? Nullable<System.TimeSpan> ()) (Nullable ())
+
+module NullableMultiply = 
+
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2 *? Nullable 3) (Nullable 6)
+    check "p2oin209v315" (3 *? Nullable 3) (Nullable 9)
+    check "p2oin209v316" (4 *? Nullable 3) (Nullable 12)
+    check "p2oin209v337" (3 *? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2 ?* 3) (Nullable 6)
+    check "p2oin209v315" (Nullable 3 ?* 3) (Nullable 9)
+    check "p2oin209v316" (Nullable 4 ?* 3) (Nullable 12)
+    check "p2oin209v337" (Nullable () ?* 3) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2 ?*? Nullable 3) (Nullable 6)
+    check "p2oin209v31s" (Nullable 3 ?*? Nullable 3) (Nullable 9)
+    check "p2oin209v31d" (Nullable 4 ?*? Nullable 3) (Nullable 12)
+    check "p2oin209v33f" (Nullable () ?*? Nullable 3) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2 ?*? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3 ?*? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4 ?*? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?*? Nullable ()) (Nullable ())
+
+
+
+module NullableDivide = 
+
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2 /? Nullable 3) (Nullable 0)
+    check "p2oin209v315" (3 /? Nullable 3) (Nullable 1)
+    check "p2oin209v316" (4 /? Nullable 3) (Nullable 1)
+    check "p2oin209v337" (3 /? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2 ?/ 3) (Nullable 0)
+    check "p2oin209v315" (Nullable 3 ?/ 3) (Nullable 1)
+    check "p2oin209v316" (Nullable 4 ?/ 3) (Nullable 1)
+    check "p2oin209v337" (Nullable () ?/ 3) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2 ?/? Nullable 3) (Nullable 0)
+    check "p2oin209v31s" (Nullable 3 ?/? Nullable 3) (Nullable 1)
+    check "p2oin209v31d" (Nullable 4 ?/? Nullable 3) (Nullable 1)
+    check "p2oin209v33f" (Nullable () ?/? Nullable 3) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2 ?/? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3 ?/? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4 ?/? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?/? Nullable ()) (Nullable ())
+
+
+module NullableModulo = 
+
+    open Microsoft.FSharp.Linq.NullableOperators
+
+    check "p2oin209v304" (2 %? Nullable 3) (Nullable 2)
+    check "p2oin209v315" (3 %? Nullable 3) (Nullable 0)
+    check "p2oin209v316" (4 %? Nullable 3) (Nullable 1)
+    check "p2oin209v337" (3 %? Nullable()) (Nullable ())
+
+    check "p2oin209v304" (Nullable 2 ?% 3) (Nullable 2)
+    check "p2oin209v315" (Nullable 3 ?% 3) (Nullable 0)
+    check "p2oin209v316" (Nullable 4 ?% 3) (Nullable 1)
+    check "p2oin209v337" (Nullable () ?% 3) (Nullable ())
+
+    check "p2oin209v30a" (Nullable 2 ?%? Nullable 3) (Nullable 2)
+    check "p2oin209v31s" (Nullable 3 ?%? Nullable 3) (Nullable 0)
+    check "p2oin209v31d" (Nullable 4 ?%? Nullable 3) (Nullable 1)
+    check "p2oin209v33f" (Nullable () ?%? Nullable 3) (Nullable ())
+
+    check "p2oin209v30k" (Nullable 2 ?%? Nullable ()) (Nullable ())
+    check "p2oin209v31l" (Nullable 3 ?%? Nullable ()) (Nullable ())
+    check "p2oin209v31z" (Nullable 4 ?%? Nullable ()) (Nullable ())
+    check "p2oin209v33x" (Nullable () ?%? Nullable ()) (Nullable ())
+
+module NullableConversions = 
+    open Microsoft.FSharp.Linq
+    open Microsoft.FSharp.Linq.NullableOperators
+    open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols
+
+    check "opp2oin209v3041" (Nullable.byte (Nullable 2)) (Nullable 2uy)
+    check "opp2oin209v3042" (Nullable.sbyte (Nullable 2)) (Nullable 2y)
+    check "opp2oin209v3043" (Nullable.uint16(Nullable 2 )) (Nullable 2us)
+    check "opp2oin209v3044" (Nullable.int16(Nullable 2 )) (Nullable 2s)
+    check "opp2oin209v3045" (Nullable.uint32 (Nullable 2s)) (Nullable 2u)
+    check "opp2oin209v3046" (Nullable.int32 (Nullable 2s)) (Nullable 2)
+    check "opp2oin209v3047" (Nullable.uint64(Nullable 2 )) (Nullable 2UL)
+    check "opp2oin209v3048" (Nullable.int64(Nullable 2 )) (Nullable 2L)
+    check "opp2oin209v3049" (Nullable.decimal(Nullable 2 )) (Nullable 2M)
+    check "opp2oin209v304q" (Nullable.char(Nullable (int '2') )) (Nullable '2')
+    check "opp2oin209v304w" (Nullable.enum(Nullable 2 ): System.Nullable<System.DayOfWeek>) (Nullable System.DayOfWeek.Tuesday )
+
+    check "opp2oin209v304e" (Nullable.sbyte (Nullable 2<kg>)) (Nullable 2y)
+    check "opp2oin209v304r" (Nullable.int16 (Nullable 2<kg>)) (Nullable 2s)
+    check "opp2oin209v304t" (Nullable.int32 (Nullable 2s<kg>)) (Nullable 2)
+    check "opp2oin209v304y" (Nullable.int64 (Nullable 2<kg>)) (Nullable 2L)
+    check "opp2oin209v304u" (Nullable.float (Nullable 2<kg>)) (Nullable 2.0)
+    check "opp2oin209v304i" (Nullable.float32 (Nullable 2<kg>)) (Nullable 2.0f)
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesOverIEnumerable/build.bat b/tests/fsharp/core/queriesOverIEnumerable/build.bat
new file mode 100644
index 0000000..8ed3cc0
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIEnumerable/build.bat
@@ -0,0 +1,47 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesOverIEnumerable/run.bat b/tests/fsharp/core/queriesOverIEnumerable/run.bat
new file mode 100644
index 0000000..9cde240
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIEnumerable/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesOverIEnumerable/test.fsx b/tests/fsharp/core/queriesOverIEnumerable/test.fsx
new file mode 100644
index 0000000..877ccbc
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIEnumerable/test.fsx
@@ -0,0 +1,1011 @@
+// #Quotations #Query
+#if Portable
+module Core_queriesOverIEnumerable
+#endif
+#nowarn "57"
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+#if NetCore
+#else
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+#endif
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected %A got %A" s v2 v1
+
+    let test s b = check s b true
+
+module QueryExecutionOverIEnumerable =
+    open System
+    open Microsoft.FSharp.Linq    
+    type Customer(name:string, data: int, cost:float, sizes: int list, quantity:Nullable<int>) = 
+        member x.Name = name
+        member x.Data = data
+        member x.Cost = cost
+        member x.Sizes = sizes
+        member x.Quantity = quantity
+        member x.AlwaysNull = Nullable<int>()
+    let c1 = Customer( name="Don", data=6, cost=6.2, sizes=[1;2;3;4], quantity=Nullable())
+    let c2 = Customer( name="Peter", data=7, cost=4.2, sizes=[10;20;30;40], quantity=Nullable(10))
+    let c3 = Customer( name="Freddy", data=8, cost=9.2, sizes=[11;12;13;14], quantity=Nullable())
+    let c4 = Customer( name="Freddi", data=10, cost=1.0, sizes=[21;22;23;24], quantity=Nullable(32))
+    let c5 = Customer( name="Don", data=9, cost=1.0, sizes=[21;22;23;24], quantity=Nullable())
+    // Not in the database
+    let c6 = Customer( name="Bob", data=9, cost=1.0, sizes=[21;22;23;24],quantity=Nullable())
+    
+    let data = [c1;c2;c3;c4;c5]
+    let db = (data |> List.toSeq)
+
+    let dbEmpty : seq<int> = ([] |> List.toSeq)
+    let dbOne = ([1] |> List.toSeq)
+
+    let checkCommuteSeq s q1 q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+    checkCommuteSeq "cnewnc01" 
+        (query { yield! db }) 
+        db
+
+    checkCommuteSeq "cnewnc02" 
+        (query { for i in db -> i }) 
+        db
+
+    checkCommuteSeq "cnewnc03" 
+        (query { for i in db -> i.Name }) 
+        (seq { for i in db -> i.Name })
+
+    checkCommuteSeq "cnewnc06y" 
+        (query { for i in db do for j in db do yield (i.Name,j.Name)  })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "cnewnc06b" 
+        (query { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06w" 
+        (query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    // TODO: ERROR: System.ArgumentException: Type mismatch when building 'cond': types of true and false branches differ. Expected 'System.Linq.IQueryable`1[Microsoft.FSharp.Linq.RuntimeHelpers.MutableTuple`3[System.Int32,System.String,System.String]]', but received type 'System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Linq.RuntimeHelpers.MutableTuple`3[System.Int32,System.String,System.String]]'.
+    (*
+    checkCommuteSeq "cnewnc08q" 
+         (query { for i in db do 
+                    match i.Data with 
+                    | 8 -> 
+                        for j in db do 
+                            if i.Data = j.Data then 
+                               yield (i.Data,i.Name,j.Name) 
+                    | _ -> () })
+         (seq   { for i in db do 
+                    match i.Data with 
+                    | 8 -> 
+                        for j in db do 
+                            if i.Data = j.Data then 
+                                yield (i.Data,i.Name,j.Name) 
+                    | _ -> () })
+
+                    *)
+
+    let t() = 
+        checkCommuteSeq "cnewnc06z" 
+            (query { for i in db do take 3 }) 
+            (seq   { for i in db do yield i } |> Seq.take 3)
+
+    t()
+
+    checkCommuteSeq "cnewnc06x" 
+        (query { for i in db do where true; take 3 }) 
+        (seq   { for i in db do yield i } |> Seq.take 3)
+
+    checkCommuteSeq "cnewnc06xb" 
+        (query { for i in db do for j in db do where true; take 3 }) 
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.take 3)
+
+    checkCommuteSeq "cnewnc06ya" 
+        (query { for i in db do select i }) 
+        (seq   { for i in db do yield i })
+
+    checkCommuteSeq "cnewnc06yab" 
+        (query { for i in db do for j in db do select i }) 
+        (seq   { for i in db do for j in db do yield i })
+
+    checkCommuteSeq "cnewnc06ya3" 
+        (query { for i in db do 
+                 select i.Name into n 
+                 distinct } |> Seq.toList) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+#if ZIP
+    checkCommuteSeq "cnewnc06ya3" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2;1] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2); (4, 1)]
+
+    checkCommuteSeq "cnewnc06y43" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2;1;0] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2); (4, 1)]
+
+    checkCommuteSeq "cnewnc06y43b" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2)]
+
+    checkCommuteSeq "cnewnc06y43c" 
+        (query { for i in db do 
+                 zip db into j
+                 yield (i.Name,j.Name.Length) } |> Seq.toList) 
+        [("Don", 3); ("Peter", 5); ("Freddy", 6); ("Freddi", 6); ("Don", 3)]
+
+#endif
+
+    checkCommuteSeq "cnewnc06yb" 
+        (query { for i in db do groupBy i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06ybx" 
+        (query { for i in db do groupValBy i i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06yb2" 
+        (query { for i in db do for j in db do groupBy i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06yb2x" 
+        (query { for i in db do for j in db do groupValBy (i,j) i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06yc" 
+        (query { for i in db do sortBy i.Name } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yd" 
+        (query { for i in db do sortBy i.Name; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq" 
+        (query { for i in db do sortByDescending i.Data; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq3" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq4" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq5" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq6" 
+        (query { for i in db do sortBy i.Name; thenByDescending i.Data; yield i } |> Seq.toList)
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield i } |> Seq.map (fun x -> x.Name ) |> Seq.toList)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6c1" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name ) |> Seq.toList)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6c2" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name ) |> Seq.toList)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6c3" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name ) |> Seq.toList)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    check "cnewnc06ye"  
+        (query { for i in db do contains c1 }) 
+        true
+
+    check "cnewnc06ye"  
+        (query { for i in dbEmpty do contains 1 }) 
+        false
+
+    check "cnewnc06yeg"  
+        (query { for i in dbOne do contains 1 }) 
+        true
+
+    check "cnewnc06yf" 
+        (query { for i in db do contains c6 }) 
+        false
+
+    check "cnewnc06yg" 
+        (query { for i in db do count }) 
+        5
+
+    check "cnewnc06yh" 
+        (query { for i in db do last }) 
+        c5
+
+    check "cnewnc06yh2a" 
+        (query { for i in db do lastOrDefault }) 
+        c5
+
+    check "cnewnc06yh2b" 
+        (query { for i in db do headOrDefault }) 
+        c1
+
+    check "cnewnc06yh3a" 
+        (query { for i in dbEmpty do lastOrDefault }) 
+        0
+
+    check "cnewnc06yh3b" 
+        (query { for i in dbEmpty do headOrDefault }) 
+        0
+
+    check "cnewnc06yh4" 
+        (query { for i in dbOne do exactlyOne }) 
+        1
+
+    check "cnewnc06yh5" 
+        (query { for i in dbOne do exactlyOneOrDefault }) 
+        1
+
+    
+    check "cnewnc06yh6" 
+        (try 
+            query { for i in dbEmpty do exactlyOne } |> ignore; false 
+         with :? System.InvalidOperationException -> true) 
+        true
+
+    check "cnewnc06yh7" 
+        (query { for i in dbEmpty do exactlyOneOrDefault }) 
+        0
+
+    check "cnewnc06yh8" 
+        (query { for i in dbOne do minBy i }) 
+        1
+
+    check "cnewnc06yh9" 
+        (query { for i in db do minBy i.Data }) 
+        c1.Data
+
+    
+    check "cnewnc06yh9" 
+        (try query { for i in dbEmpty do minBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "cnewnc06yh9xff" 
+        (try query { for i in dbEmpty do nth 3 } with :? System.ArgumentOutOfRangeException -> -10) 
+        -10
+
+    check "cnewnc06yh9xx" 
+        (query { for i in dbEmpty do skip 1 } |> Seq.length |> ignore; 10)
+        10
+
+
+    check "cnewnc06yh10" 
+        (query { for i in dbOne do maxBy i }) 
+        1
+
+    check "cnewnc06yh11" 
+        (query { for i in db do maxBy i.Data }) 
+        c4.Data
+    
+    check "cnewnc06yh12" 
+        (try query { for i in dbEmpty do maxBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "cnewnc06yh81" 
+        (query { for i in dbOne do sumBy i }) 
+        1
+
+    check "cnewnc06yh82" 
+        (query { for i in dbEmpty do sumBy i }) 
+        0
+
+    check "cnewnc06yh81b" 
+        (query { for i in dbOne do averageBy (float i) }) 
+        1.0
+    
+
+    check "cnewnc06yh81c" 
+        (query { for i in dbOne do averageBy (float32 i) }) 
+        1.0f
+
+
+    check "cnewnc06yh81d" 
+        (query { for i in dbOne do averageBy (decimal i) }) 
+        1.0M
+
+    check "cnewnc06yh81e" 
+        (query { for i in dbOne do sumBy (int64 i) }) 
+        1L
+
+    check "cnewnc06yh81f" 
+        (query { for i in dbOne do sumBy (decimal i) }) 
+        1.0M
+
+    check "cnewnc06yh81g" 
+        (query { for i in dbOne do sumBy (int32 i) }) 
+        1
+
+    check "cnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float i) }) 
+        1.0
+
+    check "cnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float32 i) }) 
+        1.0f
+
+    check "cnewnc06yh9" 
+        (try query { for i in dbEmpty do averageBy (float i) } with :? System.InvalidOperationException -> -10.0) 
+        -10.0
+
+    check "cnewnc06yh92" 
+        (query { for i in db do averageByNullable (Nullable(10.0)) }) 
+        (Nullable 10.0)
+
+    check "cnewnc06yh92b" 
+        (query { for i in db do averageByNullable (Nullable(10.0M)) }) 
+        (Nullable 10.0M)
+
+    check "cnewnc06yh92c" 
+        (query { for i in db do averageByNullable (Nullable(10.0f)) }) 
+        (Nullable 10.0f)
+
+    check "cnewnc06yh95" 
+        (query { for i in dbEmpty do averageByNullable (Nullable(float i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh92d" 
+        (query { for i in db do maxByNullable i.Quantity }) 
+        (Nullable 32)
+
+    check "cnewnc06yh93" 
+        (query { for i in db do minByNullable i.Quantity }) 
+        (Nullable 10)
+
+    check "cnewnc06yh91" 
+        (query { for i in db do sumByNullable i.Quantity }) 
+        (Nullable 42)
+
+    check "cnewnc06yh94" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(i)) }) 
+        (Nullable 0)
+
+    check "cnewnc06yh94b" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float32 i)) }) 
+        (Nullable 0.0f)
+
+    check "cnewnc06yh94c" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(decimal i)) }) 
+        (Nullable 0.0M)
+
+    check "cnewnc06yh94d" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(int64 i)) }) 
+        (Nullable 0L)
+
+    check "cnewnc06yh94e" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float i)) }) 
+        (Nullable 0.0)
+
+
+    check "cnewnc06yh96" 
+        (query { for i in dbEmpty do maxByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "cnewnc06yh96b" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96c" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (decimal i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96d" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float32 i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96e" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (int64 i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh97" 
+        (query { for i in dbEmpty do minByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "cnewnc06yh98" 
+        (query { for i in db do sumByNullable i.AlwaysNull }) 
+        (Nullable(0))
+
+    check "cnewnc06yh991" 
+        (query { for i in db do maxByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "cnewnc06yh9Q" 
+        (query { for i in db do minByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "cnewnc06yh992" 
+        (query { for i in db do all (i.Name = "Don") }) 
+        false
+
+    check "cnewnc06yh993" 
+        (query { for i in db do exists (i.Name = "Don") }) 
+        true
+
+    check "cnewnc06yh994" 
+        (query { for i in dbEmpty do all (i = 1) }) 
+        true
+
+    check "cnewnc06yh995" 
+        (query { for i in dbEmpty do exists (i = 1) }) 
+        false
+
+    check "cnewnc06yh996" 
+        (query { for i in db do find (i.Name = "Peter") }) 
+        c2
+
+    check "cnewnc06yh997" 
+        (query { for i in db do skip 1; select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "cnewnc06yh998" 
+        (query { for i in db do skipWhile (i.Name = "Don"); select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "cnewnc06yh999" 
+        (query { for i in db do take 2; select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "cnewnc06yh99q" 
+        (query { for i in db do takeWhile (i.Name = "Don" || i.Name = "Peter"); select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "cnewnc06yh99w" 
+        (query { for i in db do nth 0 }) 
+        c1
+
+    check "cnewnc06yh9Q1" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+
+    check "cnewnc06yh9Q2" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q3" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault())
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q4" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?=? j.Quantity)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q5" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "cnewnc06yh9Q6" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault()) into group
+                 yield (group |> Seq.map (fun x -> x.Name) |> Seq.toList) } 
+            |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "cnewnc06yh9Q7" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity.GetValueOrDefault() =? j.Quantity) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "cnewnc06yh9Q8" 
+        (query { for i in db do groupJoin j in db on (i.Quantity ?=? j.Quantity) into group; yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+
+    check "cnewnc06yh9Q5left1" 
+        (query { for i in db do 
+                 leftOuterJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "cnewnc06yh9Q5left2" 
+        (query { for i in ["1";"2"] do 
+                 leftOuterJoin j in ["1";"12"] on (i.[0] = j.[0]) into group
+                 yield (i, group |> Seq.toList) } |> Seq.toList) 
+        [("1", ["1";"12"]); ("2", [null]) ]
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc01" 
+        (query { yield (1,1) } |> Seq.toList) 
+        (seq { yield (1,1) } |> Seq.toList)
+
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "smcnewnc01nested" 
+        (query { yield (1,(2,3)) } |> Seq.toList) 
+        [ (1,(2,3)) ]
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "smcnewnc07" 
+        (query { yield (1,2,3,4,5,6,7) } |> Seq.toList) 
+        [ (1,2,3,4,5,6,7) ]
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "smcnewnc08" 
+        (query { yield (1,2,3,4,5,6,7,8) } |> Seq.toList) 
+        [ (1,2,3,4,5,6,7,8) ]
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "smcnewnc09c" 
+        (query { yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList) 
+        (seq { yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList)
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "smcnewnc09f" 
+        (query { yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } |> Seq.toList) 
+        [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ]
+
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield (1,1) } |> Seq.toList) 
+        (seq { for x in db do yield (1,1) } |> Seq.toList)
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "smcnewnc01nestedx" 
+        (query { for x in db do yield (1,(2,3)) } |> Seq.toList) 
+        (seq { for x in db do yield (1,(2,3)) } |> Seq.toList) 
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "smcnewnc07x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7) } |> Seq.toList) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7) } |> Seq.toList) 
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "smcnewnc08x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8) } |> Seq.toList) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8) } |> Seq.toList) 
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "smcnewnc09x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList)
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "smcnewnc09xd" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } |> Seq.toList) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } |> Seq.toList) 
+
+
+
+
+    // Smoke test for returning a tuple, nested for loops
+    checkCommuteSeq "smcnewnc01xx" 
+        (query { for x in db do for y in db do yield (1,1) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,1) } |> Seq.toList)
+
+    // Smoke test for returning a nested tuple, nested for loops
+    checkCommuteSeq "smcnewnc01nestedxx" 
+        (query { for x in db do for y in db do yield (1,(2,3)) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,(2,3)) } |> Seq.toList) 
+
+    // Smoke test for returnng a tuple, size = 7, nested for loops
+    checkCommuteSeq "smcnewnc07xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7) } |> Seq.toList) 
+
+    // Smoke test for returning a tuple, size = 8, nested for loops
+    checkCommuteSeq "smcnewnc08xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) } |> Seq.toList) 
+
+    // Smoke test for returning a tuple, size = 9, nested for loops
+    checkCommuteSeq "smcnewnc09xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList)
+
+    // Smoke test for returning a tuple, size = 16, nested for loops
+    checkCommuteSeq "smcnewnc09xxf" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } |> Seq.toList) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } |> Seq.toList) 
+
+
+
+
+    type R1 =  { V1 : int }
+    type R7 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type R8 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rsmcnewnc01" 
+        (query { yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        [1;]
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rsmcnewnc07" 
+        (query { yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+    // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rsmcnewnc08" 
+        (query { yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+
+
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rsmcnewnc01x" 
+        (query { for x in db do yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        (seq { for x in db do yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rsmcnewnc07x" 
+        (query { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+    // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rsmcnewnc08x" 
+        (query { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+
+
+
+    type MR1 =  { mutable V1 : int }
+    type PMR7 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type PMR8 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+    type MR7 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int }
+    type MR8 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int; mutable V8 : int }
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "mrsmcnewnc01" 
+        (query { yield { MR1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        [1;]
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "pmrsmcnewnc07" 
+        (query { yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "mrsmcnewnc07" 
+        (query { yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "pmrsmcnewnc08" 
+        (query { yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "mrsmcnewnc08" 
+        (query { yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "mrsmcnewnc01x" 
+        (query { for x in db do yield { MR1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        (seq   { for x in db do yield { MR1.V1=1 } } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "pmrsmcnewnc07x" 
+        (query { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq   { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "mrsmcnewnc07x" 
+        (query { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq   { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "pmrsmcnewnc08x" 
+        (query { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq   { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "mrsmcnewnc08x" 
+        (query { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq   { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+
+
+    // Smoke test for returning an object using property-set notation for member init, size = 1
+    type C1() = 
+        let mutable v1 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+
+    checkCommuteSeq "smcnewnc0122" 
+        (query { yield C1(V1=1) } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        [1;]
+
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield C1(V1=1) } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+        (seq { for x in db do yield C1(V1=1) } |> Seq.map (fun r -> r.V1) |> Seq.toList) 
+
+
+
+
+    // Smoke test for returning an object using property-set notation for member init, size = 2
+    type C2() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+
+    checkCommuteSeq "smcnewnc0199" 
+        (query { yield C2(V1=1, V2=2) } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        [1,2;]
+
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield C2(V1=1, V2=2) } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+        (seq  { for x in db do yield C2(V1=1, V2=2) } |> Seq.map (fun r -> r.V1, r.V2) |> Seq.toList) 
+
+
+
+    // Smoke test for returning an object using property-set notation for member init, size = 8
+    type C8() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        let mutable v3 = 0
+        let mutable v4 = 0
+        let mutable v5 = 0
+        let mutable v6 = 0
+        let mutable v7 = 0
+        let mutable v8 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+        member __.V3 with get() = v3 and set v = v3 <- v
+        member __.V4 with get() = v4 and set v = v4 <- v
+        member __.V5 with get() = v5 and set v = v5 <- v
+        member __.V6 with get() = v6 and set v = v6 <- v
+        member __.V7 with get() = v7 and set v = v7 <- v
+        member __.V8 with get() = v8 and set v = v8 <- v
+
+    checkCommuteSeq "smcnewnc08" 
+        (query { yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> Seq.map (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) |> Seq.toList) 
+        [(1,2,3,4,5,6,7,8)]
+
+    checkCommuteSeq "smcnewnc08x" 
+        (query { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> Seq.map (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) |> Seq.toList) 
+        (seq   { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> Seq.map (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) |> Seq.toList) 
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc02" 
+        (query { for i in db -> (i, i) } |> Seq.toList) 
+        (seq { for i in db -> (i,i) } |> Seq.toList)
+
+
+/// Check some of the conversions of leaf expressions when calling the API directly
+module LeafExpressionConversionTests = 
+    open Microsoft.FSharp.Linq.RuntimeHelpers
+    open System.Linq.Expressions
+
+    module ExpressionPatterns = 
+        let (|Constant|_|) (c:Expression) = match c with :? ConstantExpression as c -> Some (c.Value, c.Type) | _ -> None
+        let (|BinExpr|_|) (c:Expression) = match c with :? BinaryExpression as c -> Some (c.Left, c.NodeType, c.Right) | _ -> None
+        let (|Int32Obj|_|) (c:obj) = match c with :? int32 as c -> Some c | _ -> None
+        let (|Int32|_|) = function Constant(Int32Obj n, _) -> Some n | _ -> None
+        let (|Add|_|) = function BinExpr(l,ExpressionType.Add,r) -> Some (l,r) | _ -> None
+        let (|Modulo|_|) = function BinExpr(l,ExpressionType.Modulo,r) -> Some (l,r) | _ -> None
+        let (|GreaterThan|_|) = function BinExpr(l,ExpressionType.GreaterThan,r) -> Some (l,r) | _ -> None
+        let (|AddChecked|_|) = function BinExpr(l,ExpressionType.AddChecked,r) -> Some (l,r) | _ -> None
+
+    let E x = LeafExpressionConverter.QuotationToExpression x
+    open ExpressionPatterns
+    check "ckjwnew" (match E <@ 1 @> with | Int32 1 -> true | _ -> false) true
+    check "ckjwnew" (match E <@ 1 + 1 @> with | Add(Int32 1, Int32 1) -> true | _ -> false) true
+    check "ckjwnew" (match E <@ Operators.Checked.(+) 1 1 @> with | AddChecked(Int32 1, Int32 1) -> true | _ -> false) true
+    check "ckjwnew" (match E <@ 1 % 1 @> with | Modulo(Int32 1, Int32 1) -> true | _ -> false) true
+
+
+/// Some smoke tests that implicit expression conversions compile correctly
+module MiscTestsForImplicitExpressionConversion = 
+    open Microsoft.FSharp.Linq
+
+    module QueryOperators = 
+        let mapReduce ([<ProjectionParameter>] mapper: 'T -> seq<'U>) (keySelector: 'U -> 'Key) (reducer: 'Key -> seq<'U> -> 'Result) (source: System.Linq.IQueryable<_>) =
+            query { for v in source do
+                    for x in mapper v do
+                    groupValBy x (keySelector x) into group
+                    yield reducer group.Key group }
+
+    module TechnicalReportExamplesOption1 = 
+        open System.Linq
+        open System.Linq.Expressions
+
+        module Histogram = 
+            let histogram k (input: System.Linq.IQueryable<string>) =
+                // Problem - type annotation requried on input variable 
+                // Problem - upcast required of return result of function (no covariance for functions)
+                let words = input.SelectMany(fun x -> x.Split(' ') :> seq<_>)
+                let groups = words.GroupBy(fun x -> x)
+                let counts = groups.Select(fun x -> x.Key, x.Count())
+                let ordered = counts.OrderByDescending(fun (key,count) -> count)
+                let top = ordered.Take k
+                top 
+
+        check "cwnwe09" 
+            (Histogram.histogram 3 (Queryable.AsQueryable ["Hello world"; "world hello"]) |> Seq.toList)
+            [("world", 2); ("Hello", 1); ("hello", 1)]
+
+        module PageRank1 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                  edges.Join(ranks, 
+                             (fun edge -> edge.source), 
+                             (fun rank -> rank.source), 
+                             (fun edge rank -> { source = edge.target; value = rank.value }))
+                       . GroupBy(fun rank -> rank.source)
+                       . Select(fun group -> { source = group.Key; value = group.Select(fun rank -> rank.value).Sum() })
+
+            let results = 
+              pageRank 
+                ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 } ], 
+                  Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 } ]) |> Seq.toList |> List.map (fun c -> c.value)
+
+            check "lceknwe90" results [2235; 2250; 2265; 2079; 2093; 2107; 2121]
+
+
+
+    module TechnicalReportExamplesOption2 = 
+        open System.Linq
+        open System.Linq.Expressions
+
+        type QSeq = 
+            static member collect (f:Expression<System.Func<_,_>>)  = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.SelectMany(source,f))
+            static member groupBy (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.GroupBy(source,f))
+            // Problem: no Expression conversion on curried members, reduces fluency w.r.t. F# combinator style
+            static member join (source2, keySelector1:Expression<System.Func<_,_>>, keySelector2:Expression<System.Func<_,_>>, resultSelector:Expression<System.Func<_,_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Join(source,source2,keySelector1,keySelector2,resultSelector))
+            static member map (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Select(source,f))
+            static member orderBy (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.OrderBy(source,f))
+            static member orderByDescending (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.OrderByDescending(source,f))
+            static member take n = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Take(source,n))
+
+
+        module Histogram = 
+            let histogram k (input: System.Linq.IQueryable<string>) =
+                input 
+                 |> QSeq.collect (fun x -> x.Split(' ') :> seq<_>)
+                 |> QSeq.groupBy (fun x -> x)
+                 |> QSeq.map (fun x -> x.Key, x.Count())
+                 |> QSeq.orderByDescending (fun (key,count) -> count)
+                 |> QSeq.take k
+
+        module PageRank1 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                  edges
+                  // Note, in this model join is neither pleasant (less pleasant than C#) nor curried (though no expectation it would be)
+                  |> QSeq.join (ranks, (fun edge -> edge.source), (fun rank -> rank.source), (fun edge rank -> { source = edge.target; value = rank.value }))
+                  |> QSeq.groupBy(fun rank -> rank.source)
+                  // Note, in this model nested queries use 'Seq' combinators. Very non-fluent
+                  |> QSeq.map (fun group -> { source = group.Key; value = group |> Seq.sumBy (fun rank -> rank.value) })
+
+            let results = 
+
+                pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> ({ source = i; target = i % 7 } : Edge) ], 
+                           Queryable.AsQueryable [ for i in 0 .. 100 -> ({ source = i; value = i+100 } : Rank) ])
+                |> Seq.toList |> List.map (fun c -> c.value)
+
+            check "lceknwe91" results [2235; 2250; 2265; 2079; 2093; 2107; 2121]
+
+
+
+        module PageRank2 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in  ranks on (edge.source = rank.source)
+                        let newRank = { source = edge.target; value = rank.value }
+                        groupValBy newRank newRank.source into group
+                        yield    { source = group.Key; value = query { for rank in group do sumBy rank.value } } }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 }  : Edge], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 }  : Rank ])
+
+
+        module PageRank1b = 
+            open System.Linq
+            open System.Linq.Expressions
+            type Edge = { mutable source:int; mutable target:int }
+            type Rank = { mutable source:int; mutable value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in  ranks on (edge.source = rank.source)
+                        let newRank = { source = edge.target; value = rank.value }
+
+                        groupValBy newRank newRank.source into group
+
+                        select { source = group.Key; value = query { for rank in group do sumBy rank.value } } }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 } : Edge ], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 } : Rank ])
+
+
+        module PageRank1b2 = 
+            open System.Linq
+            open System.Linq.Expressions
+            type Edge = { mutable source:int; mutable target:int }
+            type Rank = { mutable source:int; mutable value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in  ranks on (edge.source = rank.source)
+                        let newRank = { source = edge.target; value = rank.value }
+
+                        groupValBy newRank newRank.source into group
+
+                        select { source = group.Key; value = group.Sum(fun rank -> rank.value) } } 
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 } : Edge ], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 } : Rank ])
+
+        module PageRank1c = 
+            type Edge(source:int, target:int) = 
+                member x.Source = source 
+                member x.Target = target
+            type Rank(source:int, value:int) = 
+                member x.Source = source 
+                member x.Value = value
+
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in  ranks on (edge.Source = rank.Source)
+                        let newRank = Rank(source = edge.Target, value = rank.Value)
+                        groupValBy newRank newRank.Source into group
+                        yield (Rank(source = group.Key, value = query { for rank in group do sumBy rank.Value } )) }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> Edge(source = i, target = i % 7) ], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> Rank(source = i, value = i+100) ])
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesOverIQueryable/build.bat b/tests/fsharp/core/queriesOverIQueryable/build.bat
new file mode 100644
index 0000000..8ed3cc0
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryable/build.bat
@@ -0,0 +1,47 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesOverIQueryable/run.bat b/tests/fsharp/core/queriesOverIQueryable/run.bat
new file mode 100644
index 0000000..9cde240
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryable/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesOverIQueryable/test.fsx b/tests/fsharp/core/queriesOverIQueryable/test.fsx
new file mode 100644
index 0000000..3d3c054
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryable/test.fsx
@@ -0,0 +1,2477 @@
+// #Quotations #Query
+#if Portable
+module Core_queriesOverIQueryable
+#endif
+
+#nowarn "57"
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+#if NetCore
+#else
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+#endif
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+module QueryExecutionOverIQueryable =
+    open System
+    open Microsoft.FSharp.Linq    
+    type Customer(name:string, data: int, cost:float, sizes: int list, quantity:Nullable<int>) = 
+        member x.Name = name
+        member x.Data = data
+        member x.Cost = cost
+        member x.Sizes = sizes
+        member x.Quantity = quantity
+        member x.SomeInt16Value = int16 (quantity.GetValueOrDefault())
+        member x.SomeNullableInt16Value = Nullable<int16>(int16 (quantity.GetValueOrDefault()))
+        member x.AlwaysNull = Nullable<int>()
+    let c1 = Customer( name="Don", data=6, cost=6.2, sizes=[1;2;3;4], quantity=Nullable())
+    let c2 = Customer( name="Peter", data=7, cost=4.2, sizes=[10;20;30;40], quantity=Nullable(10))
+    let c3 = Customer( name="Freddy", data=8, cost=9.2, sizes=[11;12;13;14], quantity=Nullable())
+    let c4 = Customer( name="Freddi", data=10, cost=1.0, sizes=[21;22;23;24], quantity=Nullable(32))
+    let c5 = Customer( name="Don", data=9, cost=1.0, sizes=[21;22;23;24], quantity=Nullable())
+    // Not in the database
+    let c6 = Customer( name="Bob", data=9, cost=1.0, sizes=[21;22;23;24],quantity=Nullable())
+    
+    let data = [c1;c2;c3;c4;c5]
+    let db = System.Linq.Queryable.AsQueryable<Customer>(data |> List.toSeq)
+
+    let dbEmpty = System.Linq.Queryable.AsQueryable<int>([] |> List.toSeq)
+    let dbOne = System.Linq.Queryable.AsQueryable<int>([1] |> List.toSeq)
+
+    let checkLinqQueryText s (q1: System.Linq.IQueryable<'T>) text =
+        check s (try q1.Expression.ToString().Replace(db.ToString(),"db").Replace("QueryExecutionOverIQueryable.db","db") with e -> "Unexpected error: " + e.ToString()) text
+
+
+    checkCommuteSeq "cnewnc01" 
+        (query { yield! db }) 
+        db
+
+    checkCommuteSeq "cnewnc01nested" 
+        (query { for v in query { yield! db } do yield v }) 
+        db
+
+
+    checkCommuteSeq "cnewnc02" 
+        (query { for i in db -> i }) 
+        db
+
+    checkCommuteSeq "cnewnc02nested" 
+        (query { for v in query { for i in db -> i } do yield v }) 
+        db
+
+    checkCommuteSeq "cnewnc02nested2" 
+        (query { let q = query { for i in db -> i } in for v in q do yield v }) 
+        db
+
+    checkCommuteSeq "cnewnc03" 
+        (query { for i in db -> i.Name }) 
+        (seq { for i in db -> i.Name })
+
+    checkLinqQueryText "ltcjhnwec2" 
+        (query { for i in db -> i })  
+        "db.Select(_arg1 => _arg1)"
+
+    checkLinqQueryText "ltcjhnwec5" 
+        (query { for i in db -> i.Name })  
+        "db.Select(_arg1 => _arg1.Name)"
+
+    checkLinqQueryText "ltcjhnwec7" 
+        (query { for i in db do for j in db do yield i.Name  })   
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => _arg1.Name)"
+
+    checkLinqQueryText "ltcjhnwec0" 
+        (query { for i in db do for j in db do if i.Data = j.Data then yield i.Name })  
+        "db.SelectMany(_arg1 => db.Where(_arg2 => (_arg1.Data == _arg2.Data)), (_arg1, _arg2) => _arg1.Name)"
+
+    checkLinqQueryText "ltcjhnwecq"  
+        (query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield i.Name })  
+        "db.Where(_arg1 => (_arg1.Data == 8)).SelectMany(_arg1 => db.Where(_arg2 => (_arg1.Data == _arg2.Data)), (_arg1, _arg2) => _arg1.Name)"
+         
+
+
+
+
+    type QB2() = 
+        inherit Microsoft.FSharp.Linq.QueryBuilder()
+        member x.Run(e:Expr<'T>) = e
+   
+        
+    checkLinqQueryText "ltcjhnwecw" 
+        (query { let q = query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield i.Name } in for v in q do yield v })  
+        "db.Where(_arg1 => (_arg1.Data == 8)).SelectMany(_arg1 => db.Where(_arg2 => (_arg1.Data == _arg2.Data)), (_arg1, _arg2) => _arg1.Name).Select(_arg3 => _arg3)"
+
+    checkLinqQueryText "ltcjhnwec8" 
+        (query { let q = query { for i in db do for j in db do yield i.Name } in for v in q do yield v })   
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => _arg1.Name).Select(_arg3 => _arg3)"
+
+    checkLinqQueryText "ltcjhnwec9" 
+        (query { let q = query { for i in db do for j in db do if i.Data = j.Data then yield i.Name } in for v in q do yield v })  
+        "db.SelectMany(_arg1 => db.Where(_arg2 => (_arg1.Data == _arg2.Data)), (_arg1, _arg2) => _arg1.Name).Select(_arg3 => _arg3)"
+
+    checkLinqQueryText "ltcjhnwec3" 
+        (query { for v in query { for i in db -> i } do yield v })  
+        "db.Select(_arg1 => _arg1).Select(_arg2 => _arg2)"
+
+    checkLinqQueryText "ltcjhnwec4" 
+        (query { let q = query { for i in db -> i } in for v in q do yield v })  
+        "db.Select(_arg1 => _arg1).Select(_arg2 => _arg2)"
+
+    checkLinqQueryText "ltcjhnwec6" 
+        (query { let q = query { for i in db -> i.Name } in for v in q do yield v } )  
+        "db.Select(_arg1 => _arg1.Name).Select(_arg2 => _arg2)"
+
+    checkCommuteSeq "cnewnc03nested" 
+        (query { let q = query { for i in db -> i.Name } in for v in q do yield v } ) 
+        (seq { for i in db -> i.Name })
+
+    //type R = { A : int; B : int }
+    //let db2 = [ { A = 1; B = 2 } ]
+    //let results = query { for (i: MutTup<int,int>) in db2 -> (i,i) }
+
+    //System.Linq.Queryable.GroupBy(
+    checkCommuteSeq "cnewnc06y" 
+        (query { for i in db do for j in db do yield (i.Name,j.Name)  })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "cnewnc06ynested" 
+        (query { let q = query { for i in db do for j in db do yield (i.Name,j.Name) } in for v in q do yield v })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "cnewnc06bnested" 
+        (query { let q = query { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) } in for v in q do yield v }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06b" 
+        (query { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06w" 
+        (query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06wnested2" 
+        (query { let q = query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) } in for v in q do yield v }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06ys" 
+        (query { for i in db do for j in db do select (i.Name,j.Name)  })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "cnewnc06ynesteds" 
+        (query { let q = query { for i in db do for j in db do select (i.Name,j.Name) } in for v in q do select v })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "cnewnc06bnesteds" 
+        (query { let q = query { for i in db do for j in db do if i.Data = j.Data then select (i.Data,i.Name,j.Name) } in for v in q do select v }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06bs" 
+        (query { for i in db do for j in db do if i.Data = j.Data then select (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06ws" 
+        (query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then select (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "cnewnc06wnested2s" 
+        (query { let q = query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then select (i.Data,i.Name,j.Name) } in for v in q do select v }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkLinqQueryText "ltcjhnwecs" 
+        (query { for i in db do take 3 })  
+        "db.Take(3)"
+
+    checkLinqQueryText "ltcjhnwecd" 
+        (query { for i in db do where true; take 3 })  
+        "db.Where(i => True).Take(3)"
+
+    checkLinqQueryText "ltcjhnwecf" 
+        (query { for i in db do for j in db do where true; take 3; select i })  
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg2)).Where(tupledArg => True).Take(3).Select(tupledArg => tupledArg.Item1)"
+
+    checkLinqQueryText "ltcjhnwecg" 
+        (query { let q = query { for i in db do for j in db do where true; take 3; select i } in for v in q do yield v } )  
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg2)).Where(tupledArg => True).Take(3).Select(tupledArg => tupledArg.Item1).Select(_arg3 => _arg3)"
+
+
+
+    checkCommuteSeq "cnewnc06z" 
+        (query { for i in db do take 3 }) 
+        (seq   { for i in db do yield i } |> Seq.take 3)
+
+    checkCommuteSeq "cnewnc06x" 
+        (query { for i in db do where true; take 3 }) 
+        (seq   { for i in db do yield i } |> Seq.take 3)
+
+    
+    checkCommuteSeq "cnewnc06xb" 
+        (query { for i in db do for j in db do where true; take 3 }) 
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.take 3)
+
+    checkCommuteSeq "cnewnc06xbnested" 
+        (query { let q = query { for i in db do for j in db do where true; take 3 } in for v in q do yield v } ) 
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.take 3)
+
+    checkLinqQueryText "ltcjhnwech" 
+        (query { for i in db do select i })  
+        "db.Select(i => i)"
+
+    checkLinqQueryText "ltcjhnweck" 
+        (query { for i in db do for j in db do select i })  
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg2)).Select(tupledArg => tupledArg.Item1)"
+
+    checkLinqQueryText "ltcjhnwecl" 
+        (query { for i in db do select i.Name into n; distinct }) 
+        "db.Select(i => i.Name).Distinct()"
+
+    checkLinqQueryText "ltcjhnwecz" 
+        (query { let q = query { for i in db do select i.Name into n; distinct } in for v in q do yield v }) 
+        "db.Select(i => i.Name).Distinct().Select(_arg3 => _arg3)"
+
+    checkCommuteSeq "cnewnc06ya" 
+        (query { for i in db do select i }) 
+
+        (seq   { for i in db do yield i })
+
+    checkCommuteSeq "cnewnc06yab" 
+        (query { for i in db do for j in db do select i }) 
+        (seq   { for i in db do for j in db do yield i })
+
+    checkCommuteSeq "cnewnc06ya3" 
+        (query { for i in db do 
+                 select i.Name into n 
+                 distinct }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+
+    checkCommuteSeq "cnewnc06ya3nested" 
+        (query { let q = query { for i in db do 
+                                 select i.Name into n 
+                                 distinct } 
+                 for v in q do yield v }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06ya3b" 
+        (query { for i in db do 
+                  select i.Name
+                  distinct }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06ya3b" 
+        (query { for i in db do 
+                  select i.Name
+                  distinct 
+                  take 2 }) 
+        ["Don"; "Peter"]
+
+    (*
+    checkCommuteSeq "cnewnc06ya3b" 
+        (query { for i in db do 
+                  yield i.Name
+                  distinct } |> Seq.toList) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+    *)
+
+#if ZIP
+    checkCommuteSeq "cnewnc06ya3c" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2;1] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2); (4, 1)]
+
+    checkCommuteSeq "cnewnc06y43" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2;1;0] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2); (4, 1)]
+
+    checkCommuteSeq "cnewnc06y43b" 
+        (query { for i in [1;2;3;4] do 
+                 zip  [4;3;2] into j
+                 yield (i,j) } |> Seq.toList) 
+        [(1, 4); (2, 3); (3, 2)]
+
+    checkCommuteSeq "cnewnc06y43c" 
+        (query { for i in db do 
+                 zip db into j
+                 yield (i.Name,j.Name.Length) } |> Seq.toList) 
+        [("Don", 3); ("Peter", 5); ("Freddy", 6); ("Freddi", 6); ("Don", 3)]
+
+#endif
+
+    checkLinqQueryText "ltcjhnwecd" 
+        (query { for i in db do where true; take 3 })  
+        "db.Where(i => True).Take(3)"
+    checkCommuteSeq "cnewnc06yb" 
+        (query { for i in db do groupBy i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)) |> System.Linq.Queryable.AsQueryable)
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+
+    checkCommuteSeq "cnewnc06ybx" 
+        (query { for i in db do groupValBy i i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)) |> System.Linq.Queryable.AsQueryable)
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06yb2" 
+        (query { for i in db do for j in db do groupBy i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)) |> System.Linq.Queryable.AsQueryable)
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+    checkCommuteSeq "cnewnc06yb2xff" 
+        (query { for i in db do groupValBy (i,i) i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)) |> System.Linq.Queryable.AsQueryable)
+        (seq   { for i in db do yield (i,i) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+
+    checkCommuteSeq "cnewnc06yb2x" 
+        (query { for i in db do for j in db do groupValBy (i,j) i.Name } |> Seq.map (fun g -> (g.Key,Seq.toList g)) |> System.Linq.Queryable.AsQueryable)
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "cnewnc06yc" 
+        (query { for i in db do sortBy i.Name } )
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yd" 
+        (query { for i in db do sortBy i.Name; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yds" 
+        (query { for i in db do sortBy i.Name; select i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.map (fun i -> i) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06ydx" 
+        (query { for i in db do sortBy i.Name; yield (i,i) } )
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.map (fun i -> i,i) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06ydxs" 
+        (query { for i in db do sortBy i.Name; select (i,i) } )
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.map (fun i -> i,i) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq" 
+        (query { for i in db do sortByDescending i.Data; yield i } )
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yqs" 
+        (query { for i in db do sortByDescending i.Data; select i } )
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.toList |> List.rev)
+                
+    checkCommuteSeq "cnewnc06yqx" 
+        (query { for i in db do sortByDescending i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yqxs" 
+        (query { for i in db do sortByDescending i.Data; select (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq3" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq3s" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; select i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq3x" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq3xs" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; select (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq4" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq4s" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; select i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq4x" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.map (fun i-> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq4xs" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; select (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.map (fun i-> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq5" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq5s" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; select i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq5x" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq5xs" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; select (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "cnewnc06yq6" 
+        (query { for i in db do sortBy i.Name; thenByDescending i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq6s" 
+        (query { for i in db do sortBy i.Name; thenByDescending i.Data; select i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "cnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6bs" 
+        (query { for i in db do sortByNullable i.Quantity; select i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6bs" 
+        (query { for i in db do sortByNullable i.Quantity; select (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6c" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6cs" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; select i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6cx" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6cxs" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; select (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "cnewnc06yq6c" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cs" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; select i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cx" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cxs" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; select (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6c" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cs" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; select i } |> Seq.map (fun x -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cx" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "cnewnc06yq6cxs" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; select (i,i) } |> Seq.map (fun (x,_) -> x.Name )|> System.Linq.Queryable.AsQueryable)
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    check "cnewnc06ye"  
+        (query { for i in db do contains c1 }) 
+        true
+
+    check "cnewnc06yex"  
+        (query { for i in db do for j in db do contains (c1,c1) }) 
+        true
+
+    check "cnewnc06ye"  
+        (query { for i in dbEmpty do contains 1 }) 
+        false
+
+    check "cnewnc06yeg"  
+        (query { for i in dbOne do contains 1 }) 
+        true
+
+    check "cnewnc06yf" 
+        (query { for i in db do contains c6 }) 
+        false
+
+    check "cnewnc06yg" 
+        (query { for i in db do count }) 
+        5
+
+    check "cnewnc06yh" 
+        (query { for i in db do last }) 
+        c5
+
+    check "cnewnc06yh" 
+        (query { for i in db do for j in db do last }) 
+        (c5,c5)
+
+    check "cnewnc06yh2a" 
+        (query { for i in db do lastOrDefault }) 
+        c5
+
+    check "cnewnc06yh2a" 
+        (query { for i in db do for j in db do lastOrDefault }) 
+        (c5,c5)
+
+    check "cnewnc06yh2b" 
+        (query { for i in db do headOrDefault }) 
+        c1
+
+    check "cnewnc06yh2bx" 
+        (query { for i in db do for j in db do headOrDefault }) 
+        (c1,c1)
+
+    check "cnewnc06yh3a" 
+        (query { for i in dbEmpty do lastOrDefault }) 
+        0
+
+    check "cnewnc06yh3b" 
+        (query { for i in dbEmpty do headOrDefault }) 
+        0
+
+    check "cnewnc06yh4" 
+        (query { for i in dbOne do exactlyOne }) 
+        1
+
+    check "cnewnc06yh4x" 
+        (query { for i in dbOne do for j in dbOne do exactlyOne }) 
+        (1,1)
+
+    check "cnewnc06yh5" 
+        (query { for i in dbOne do exactlyOneOrDefault }) 
+        1
+
+    check "cnewnc06yh5x" 
+        (query { for i in dbOne do for j in dbOne do exactlyOneOrDefault }) 
+        (1,1)
+
+    
+    check "cnewnc06yh6" 
+        (try 
+            query { for i in dbEmpty do exactlyOne } |> ignore; false 
+         with :? System.InvalidOperationException -> true) 
+        true
+
+    check "cnewnc06yh7" 
+        (query { for i in dbEmpty do exactlyOneOrDefault }) 
+        0
+
+    check "cnewnc06yh8" 
+        (query { for i in dbOne do minBy i }) 
+        1
+
+    check "cnewnc06yh8x" 
+        (query { for i in dbOne do for j in dbOne do minBy i }) 
+        1
+
+    check "cnewnc06yh9" 
+        (query { for i in db do minBy i.Data }) 
+        c1.Data
+
+
+    check "cnewnc06yh9x" 
+        (query { for i in db do for j in db do minBy i.Data }) 
+        c1.Data
+
+    
+    check "cnewnc06yh9" 
+        (try query { for i in dbEmpty do minBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "cnewnc06yh9xff" 
+        (try query { for i in dbEmpty do nth 3 } with :? System.ArgumentOutOfRangeException -> -10) 
+        -10
+
+    check "cnewnc06yh9xx" 
+        (query { for i in dbEmpty do skip 1 } |> Seq.length |> ignore; 10)
+        10
+
+
+    check "cnewnc06yh10" 
+        (query { for i in dbOne do maxBy i }) 
+        1
+
+    check "cnewnc06yh11" 
+        (query { for i in db do maxBy i.Data }) 
+        c4.Data
+    
+    check "cnewnc06yh11" 
+        (query { for i in db do for j in db do maxBy i.Data }) 
+        c4.Data
+    
+    check "cnewnc06yh12" 
+        (try query { for i in dbEmpty do maxBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "cnewnc06yh81" 
+        (query { for i in dbOne do sumBy i }) 
+        1
+
+    check "cnewnc06yh81x" 
+        (query { for i in dbOne do for j in dbOne do sumBy i }) 
+        1
+
+    check "cnewnc06yh82" 
+        (query { for i in dbEmpty do sumBy i }) 
+        0
+
+    check "cnewnc06yh82x" 
+        (query { for i in dbEmpty do for j in dbEmpty do sumBy i }) 
+        0
+
+    check "cnewnc06yh81b" 
+        (query { for i in dbOne do averageBy (float i) }) 
+        1.0
+    
+    check "cnewnc06yh81bx" 
+        (query { for i in dbOne do for j in dbOne do averageBy (float i) }) 
+        1.0
+    
+
+    check "cnewnc06yh81c" 
+        (query { for i in dbOne do averageBy (float32 i) }) 
+        1.0f
+
+
+    check "cnewnc06yh81cx" 
+        (query { for i in dbOne do for j in dbOne do averageBy (float32 i) }) 
+        1.0f
+
+    check "cnewnc06yh81d" 
+        (query { for i in dbOne do averageBy (decimal i) }) 
+        1.0M
+
+    check "cnewnc06yh81e" 
+        (query { for i in dbOne do sumBy (int64 i) }) 
+        1L
+
+    check "cnewnc06yh81f" 
+        (query { for i in dbOne do sumBy (decimal i) }) 
+        1.0M
+
+    check "cnewnc06yh81g" 
+        (query { for i in dbOne do sumBy (int32 i) }) 
+        1
+
+    check "cnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float i) }) 
+        1.0
+
+    check "cnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float32 i) }) 
+        1.0f
+
+    
+    check "cnewnc06yh9" 
+        (try query { for i in dbEmpty do averageBy (float i) } with :? System.InvalidOperationException -> -10.0) 
+        -10.0
+
+    check "cnewnc06yh91" 
+        (query { for i in db do sumByNullable i.Quantity }) 
+        (Nullable 42)
+
+    check "cnewnc06yh92" 
+        (query { for i in db do averageByNullable (Nullable(10.0)) }) 
+        (Nullable 10.0)
+
+    check "cnewnc06yh92" 
+        (query { for i in db do maxByNullable i.Quantity }) 
+        (Nullable 32)
+
+    check "cnewnc06yh93" 
+        (query { for i in db do minByNullable i.Quantity }) 
+        (Nullable 10)
+
+    check "cnewnc06yh94" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(i)) }) 
+        (Nullable 0)
+
+    check "cnewnc06yh95" 
+        (query { for i in dbEmpty do averageByNullable (Nullable(float i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96" 
+        (query { for i in dbEmpty do maxByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "cnewnc06yh97" 
+        (query { for i in dbEmpty do minByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "cnewnc06yh91" 
+        (query { for i in db do sumByNullable i.Quantity }) 
+        (Nullable 42)
+
+    check "cnewnc06yh94" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(i)) }) 
+        (Nullable 0)
+
+    check "cnewnc06yh94b" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float32 i)) }) 
+        (Nullable 0.0f)
+
+    check "cnewnc06yh94c" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(decimal i)) }) 
+        (Nullable 0.0M)
+
+    check "cnewnc06yh94d" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(int64 i)) }) 
+        (Nullable 0L)
+
+    check "cnewnc06yh94e" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float i)) }) 
+        (Nullable 0.0)
+
+    check "cnewnc06yh98" 
+        (query { for i in db do sumByNullable i.AlwaysNull }) 
+        (Nullable(0))
+
+    check "cnewnc06yh96" 
+        (query { for i in dbEmpty do maxByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "cnewnc06yh96b" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96c" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (decimal i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96d" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float32 i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh96e" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (int64 i)) }) 
+        (Nullable())
+
+    check "cnewnc06yh991" 
+        (query { for i in db do maxByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "cnewnc06yh9Q" 
+        (query { for i in db do minByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "cnewnc06yh992" 
+        (query { for i in db do all (i.Name = "Don") }) 
+        false
+
+    check "cnewnc06yh993" 
+        (query { for i in db do exists (i.Name = "Don") }) 
+        true
+
+    check "cnewnc06yh994" 
+        (query { for i in dbEmpty do all (i = 1) }) 
+        true
+
+    check "cnewnc06yh995" 
+        (query { for i in dbEmpty do exists (i = 1) }) 
+        false
+
+    check "cnewnc06yh996" 
+        (query { for i in db do find (i.Name = "Peter") }) 
+        c2
+
+    check "cnewnc06yh997" 
+        (query { for i in db do skip 1; select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "cnewnc06yh998" 
+        (query { for i in db do skipWhile (i.Name = "Don"); select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "cnewnc06yh999" 
+        (query { for i in db do take 2; select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "cnewnc06yh990" 
+        (query { for i in db do takeWhile (i.Name = "Don" || i.Name = "Peter"); select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "cnewnc06yh99q" 
+        (query { for i in db do nth 0 }) 
+        c1
+
+    check "cnewnc06yh9Q1" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+
+    check "cnewnc06yh9Q1b" 
+        (query { for i in db do 
+                 let icost = i.Cost + 1.0 - 1.0
+                 join j in db on (i.Name = j.Name)
+                 select (icost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q1c" 
+        (query { for i in db do 
+                 let icost1 = i.Cost + 1.0 
+                 let icost = icost1 - 1.0
+                 join j in db on (i.Name = j.Name)
+                 select (icost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q2" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q2s" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q3" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault())
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q3s" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault())
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q4" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?=? j.Quantity)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "cnewnc06yh9Q4" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?=? j.Quantity)
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+
+
+    checkLinqQueryText "ltcjhnwecd23" 
+        (query { for i in db do where true; take 3 })  
+        "db.Where(i => True).Take(3)"
+
+    checkLinqQueryText "ltcnewnc06yb" 
+        (query { for i in db do groupBy i.Name })
+        "db.GroupBy(i => i.Name)"
+
+    checkLinqQueryText "ltcnewnc06ybx" 
+        (query { for i in db do groupValBy i i.Name })
+        "db.GroupBy(i => i.Name, i => i)"
+
+
+
+    checkLinqQueryText "ltcnewnc06yb2x" 
+        (query { for i in db do for j in db do groupValBy j i.Name })
+        "db.SelectMany(_arg1 => db, (_arg1, _arg2) => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg2)).GroupBy(tupledArg => tupledArg.Item1.Name, tupledArg => tupledArg.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yc" 
+        (query { for i in db do sortBy i.Name })
+        "db.OrderBy(i => i.Name)"
+
+    checkLinqQueryText "ltcnewnc06yd" 
+        (query { for i in db do sortBy i.Name; yield i })
+        "db.OrderBy(i => i.Name)"
+
+    checkLinqQueryText "ltcnewnc06yq" 
+        (query { for i in db do sortByDescending i.Data; yield i })
+        "db.OrderByDescending(i => i.Data)"
+
+    checkLinqQueryText "ltcnewnc06yq3" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield i })
+        "db.OrderBy(i => i.Name).ThenBy(i => i.Data)"
+
+    checkLinqQueryText "ltcnewnc06yq4" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield i })
+        "db.OrderByDescending(i => i.Name).ThenBy(i => i.Data)"
+
+    checkLinqQueryText "ltcnewnc06yq5" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield i })
+        "db.OrderByDescending(i => i.Name).ThenByDescending(i => i.Data)"
+
+    checkLinqQueryText "ltcnewnc06yq6" 
+        (query { for i in db do sortBy i.Name; thenByDescending i.Data; yield i })
+        "db.OrderBy(i => i.Name).ThenByDescending(i => i.Data)"
+
+    checkLinqQueryText "ltcnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield i })
+        "db.OrderBy(i => i.Quantity)"
+
+    checkLinqQueryText "ltcnewnc06yq6c" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield i })
+        "db.OrderBy(i => i.Quantity).ThenBy(i => i.AlwaysNull)"
+
+    checkLinqQueryText "ltcnewnc06yq6c" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield i })
+        "db.OrderByDescending(i => i.Quantity).ThenBy(i => i.AlwaysNull)"
+
+    checkLinqQueryText "ltcnewnc06yq6c2" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield i })
+        "db.OrderByDescending(i => i.Quantity).ThenByDescending(i => i.AlwaysNull)"
+
+
+    checkLinqQueryText "lqtcnewnc06yh9Q1" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 select (i.Cost + j.Cost) }) 
+        "db.Join(db, i => i.Name, j => j.Name, (i, j) => new AnonymousObject`2(Item1 = i, Item2 = j)).Select(_arg1 => new AnonymousObject`2(Item1 = _arg1.Item1, Item2 = _arg1.Item2)).Select(tupledArg => (tupledArg.Item1.Cost + tupledArg.Item2.Cost))"
+
+
+    checkLinqQueryText "lqtcnewnc06yh9Q1b" 
+        (query { for i in db do 
+                 let icost = i.Cost
+                 join j in db on (i.Name = j.Name)
+                 select (icost + j.Cost) }) 
+          "db.Select(_arg1 => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg1.Cost)).Join(db, tupledArg => tupledArg.Item1.Name, j => j.Name, (tupledArg, j) => new AnonymousObject`3(Item1 = tupledArg.Item1, Item2 = tupledArg.Item2, Item3 = j)).Select(_arg2 => new AnonymousObject`3(Item1 = _arg2.Item1, Item2 = _arg2.Item2, Item3 = _arg2.Item3)).Select(tupledArg => (tupledArg.Item2 + tupledArg.Item3.Cost))",
+  
+//"db.Join(db, i => i.Name, j => j.Name, (i, j) => new MutableTuple`2() {Item1 = i, Item2 = j}).Select(_arg => new MutableTuple`2() {Item1 = _arg.Item1, Item2 = _arg.Item2}).Select(tupledArg => (tupledArg.Item1.Cost + tupledArg.Item2.Cost))"
+
+
+    checkLinqQueryText "lqtcnewnc06yh9Q2" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 yield (i.Cost + j.Cost) }) 
+        "db.Join(db, i => i.Name, j => j.Name, (i, j) => new AnonymousObject`2(Item1 = i, Item2 = j)).Select(_arg3 => (_arg3.Item1.Cost + _arg3.Item2.Cost))"
+
+    checkLinqQueryText "lqtcnewnc06yh9Q3" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault())
+                 yield (i.Cost + j.Cost) }) 
+        "db.Join(db, i => i.Quantity, j => Convert(j.Quantity.GetValueOrDefault()), (i, j) => new AnonymousObject`2(Item1 = i, Item2 = j)).Select(_arg1 => (_arg1.Item1.Cost + _arg1.Item2.Cost))"
+
+    checkLinqQueryText "lqtcnewnc06yh9Q4" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?=? j.Quantity)
+                 yield (i.Cost + j.Cost) }) 
+        "db.Join(db, i => i.Quantity, j => j.Quantity, (i, j) => new AnonymousObject`2(Item1 = i, Item2 = j)).Select(_arg1 => (_arg1.Item1.Cost + _arg1.Item2.Cost))"
+
+
+
+
+    checkLinqQueryText "ltcnewnc06yh9Q5" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Name = j.Name) into group
+                 yield group } ) 
+        "db.GroupJoin(db, i => i.Name, j => j.Name, (i, group) => new AnonymousObject`2(Item1 = i, Item2 = group)).Select(_arg1 => _arg1.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yh9Q5b" 
+        (query { for i in db do 
+                 let iname = i.Name
+                 groupJoin j in db on (iname = j.Name) into group
+                 yield group } ) 
+          "db.Select(_arg1 => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg1.Name)).GroupJoin(db, tupledArg => tupledArg.Item2, j => j.Name, (tupledArg, group) => new AnonymousObject`3(Item1 = tupledArg.Item1, Item2 = tupledArg.Item2, Item3 = group)).Select(_arg2 => _arg2.Item3)"
+
+
+
+    checkLinqQueryText "ltcnewnc06yh9Q6" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault()) into group
+                 yield group  } ) 
+        "db.GroupJoin(db, i => i.Quantity, j => Convert(j.Quantity.GetValueOrDefault()), (i, group) => new AnonymousObject`2(Item1 = i, Item2 = group)).Select(_arg1 => _arg1.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yh9Q7" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity.GetValueOrDefault() =? j.Quantity) into group
+                 yield group} ) 
+        "db.GroupJoin(db, i => Convert(i.Quantity.GetValueOrDefault()), j => j.Quantity, (i, group) => new AnonymousObject`2(Item1 = i, Item2 = group)).Select(_arg1 => _arg1.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yh9Q8" 
+        (query { for i in db do groupJoin j in db on (i.Quantity ?=? j.Quantity) into group; yield group } ) 
+        "db.GroupJoin(db, i => i.Quantity, j => j.Quantity, (i, group) => new AnonymousObject`2(Item1 = i, Item2 = group)).Select(_arg1 => _arg1.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yh9Q5left1" 
+        (query { for i in db do 
+                 leftOuterJoin j in db on (i.Name = j.Name) into group
+                 yield group } ) 
+        "db.GroupJoin(db, i => i.Name, j => j.Name, (i, group) => new AnonymousObject`2(Item1 = i, Item2 = group.DefaultIfEmpty())).Select(_arg1 => _arg1.Item2)"
+
+    checkLinqQueryText "ltcnewnc06yh9Q5left1b" 
+        (query { for i in db do 
+                 let iname = i.Name
+                 leftOuterJoin j in db on (iname = j.Name) into group
+                 yield group } ) 
+        "db.Select(_arg1 => new AnonymousObject`2(Item1 = _arg1, Item2 = _arg1.Name)).GroupJoin(db, tupledArg => tupledArg.Item2, j => j.Name, (tupledArg, group) => new AnonymousObject`3(Item1 = tupledArg.Item1, Item2 = tupledArg.Item2, Item3 = group.DefaultIfEmpty())).Select(_arg2 => _arg2.Item3)"
+
+
+
+    check "cnewnc06yh9Q5" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "cnewnc06yh9Q6" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault()) into group
+                 yield (group |> Seq.map (fun x -> x.Name) |> Seq.toList) } 
+            |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "cnewnc06yh9Q7" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity.GetValueOrDefault() =? j.Quantity) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "cnewnc06yh9Q8" 
+        (query { for i in db do groupJoin j in db on (i.Quantity ?=? j.Quantity) into group; yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+
+
+
+
+    check "cnewnc06yh9Q5left1" 
+        (query { for i in db do 
+                 leftOuterJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "cnewnc06yh9Q5left2" 
+        (query { for i in ["1";"2"] do 
+                 leftOuterJoin j in ["1";"12"] on (i.[0] = j.[0]) into group
+                 yield (i, group |> Seq.toList) } |> Seq.toList) 
+        [("1", ["1";"12"]); ("2", [null]) ]
+
+
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc01a" 
+        (query { yield (1,1) } ) 
+        (seq { yield (1,1) } |> Seq.toList)
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "smcnewnc01nested" 
+        (query { yield (1,(2,3)) } ) 
+        [ (1,(2,3)) ]
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "smcnewnc07" 
+        (query { yield (1,2,3,4,5,6,7) }) 
+        [ (1,2,3,4,5,6,7) ]
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "smcnewnc08" 
+        (query { yield (1,2,3,4,5,6,7,8) }) 
+        [ (1,2,3,4,5,6,7,8) ]
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "smcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9) }) 
+        (seq { yield (1,2,3,4,5,6,7,8,9) } |> Seq.toList)
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "smcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+        [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ]
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc01f" 
+        (query { yield (1,1) }) 
+        (seq { yield (1,1) })
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "smcnewnc01nested" 
+        (query { yield (1,(2,3)) }) 
+        [ (1,(2,3)) ]
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "smcnewnc07" 
+        (query { yield (1,2,3,4,5,6,7) }) 
+        [ (1,2,3,4,5,6,7) ]
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "smcnewnc08" 
+        (query { yield (1,2,3,4,5,6,7,8) }) 
+        [ (1,2,3,4,5,6,7,8) ]
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "smcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9) }) 
+        (seq { yield (1,2,3,4,5,6,7,8,9) })
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "smcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+        [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ]
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield (1,1) }) 
+        (seq { for x in db do yield (1,1) })
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "smcnewnc01nestedx" 
+        (query { for x in db do yield (1,(2,3)) }) 
+        (seq { for x in db do yield (1,(2,3)) }) 
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "smcnewnc07x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7) }) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7) }) 
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "smcnewnc08x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8) }) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8) }) 
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "smcnewnc09x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9) }) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9) })
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "smcnewnc09x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+
+
+
+    // Smoke test for returning a tuple, nested for loops
+    checkCommuteSeq "smcnewnc01xx" 
+        (query { for x in db do for y in db do yield (1,1) }) 
+        (seq { for x in db do for y in db do yield (1,1) })
+
+    // Smoke test for returning a nested tuple, nested for loops
+    checkCommuteSeq "smcnewnc01nestedxx" 
+        (query { for x in db do for y in db do yield (1,(2,3)) }) 
+        (seq { for x in db do for y in db do yield (1,(2,3)) }) 
+
+    // Smoke test for returnng a tuple, size = 7, nested for loops
+    checkCommuteSeq "smcnewnc07xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7) }) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7) }) 
+
+    // Smoke test for returning a tuple, size = 8, nested for loops
+    checkCommuteSeq "smcnewnc08xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) }) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) }) 
+
+    // Smoke test for returning a tuple, size = 9, nested for loops
+    checkCommuteSeq "smcnewnc09xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) }) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) })
+
+    // Smoke test for returning a tuple, size = 16, nested for loops
+    checkCommuteSeq "smcnewnc09xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) }) 
+
+
+    type R1 =  { V1 : int }
+    type R7 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type R8 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rsmcnewnc01" 
+        (query { yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1) |> System.Linq.Queryable.AsQueryable) 
+        [1;]
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rsmcnewnc07" 
+        (query { yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) |> System.Linq.Queryable.AsQueryable) 
+        [1,2;]
+
+   // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rsmcnewnc08" 
+        (query { yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) |> System.Linq.Queryable.AsQueryable) 
+        [1,2;]
+
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rsmcnewnc01x" 
+        (query { for x in db do yield { R1.V1=1 } } |> qmap (fun r -> r.V1)) 
+        (seq { for x in db do yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1)) 
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rsmcnewnc07x" 
+        (query { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) |> System.Linq.Queryable.AsQueryable) 
+        (seq { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rsmcnewnc08x" 
+        (query { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    type MR1 =  { mutable V1 : int }
+    type PMR7 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type PMR8 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+    type MR7 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int }
+    type MR8 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int; mutable V8 : int }
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "mrsmcnewnc01" 
+        (query { yield { MR1.V1=1 } } |> qmap (fun r -> r.V1)) 
+        [1;]
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "pmrsmcnewnc07" 
+        (query { yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2)) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "mrsmcnewnc07" 
+        (query { yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2)) 
+        [1,2;]
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "pmrsmcnewnc08" 
+        (query { yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2)) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "mrsmcnewnc08" 
+        (query { yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2)) 
+        [1,2;]
+
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "mrsmcnewnc01x" 
+        (query { for x in db do yield { MR1.V1=1 } } |> qmap (fun r -> r.V1)) 
+        (seq   { for x in db do yield { MR1.V1=1 } } |> Seq.map (fun r -> r.V1)) 
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "pmrsmcnewnc07x" 
+        (query { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq   { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "mrsmcnewnc07x" 
+        (query { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq   { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "pmrsmcnewnc08x" 
+        (query { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq   { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "mrsmcnewnc08x" 
+        (query { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq   { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+
+    // Smoke test for returning an object using property-set notation for member init, size = 8
+    type C1() = 
+        let mutable v1 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+
+    checkCommuteSeq "smcnewnc01v" 
+        (query { yield C1(V1=1) } |> qmap (fun r -> r.V1)) 
+        [1;]
+
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield C1(V1=1) } |> qmap (fun r -> r.V1)) 
+        (seq { for x in db do yield C1(V1=1) } |> Seq.map (fun r -> r.V1)) 
+
+        //<@ C1(V1=1) @>
+
+    // Smoke test for returning an object using property-set notation for member init
+    type C2() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+
+    checkCommuteSeq "smcnewnc01b" 
+        (query { yield C2(V1=1, V2=2) } |> qmap (fun r -> r.V1, r.V2)) 
+        [1,2;]
+
+    checkCommuteSeq "smcnewnc01x" 
+        (query { for x in db do yield C2(V1=1, V2=2) } |> qmap (fun r -> r.V1, r.V2)) 
+        (seq  { for x in db do yield C2(V1=1, V2=2) } |> Seq.map (fun r -> r.V1, r.V2)) 
+
+    // Smoke test for returning an object using property-set notation for member init
+    type C8() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        let mutable v3 = 0
+        let mutable v4 = 0
+        let mutable v5 = 0
+        let mutable v6 = 0
+        let mutable v7 = 0
+        let mutable v8 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+        member __.V3 with get() = v3 and set v = v3 <- v
+        member __.V4 with get() = v4 and set v = v4 <- v
+        member __.V5 with get() = v5 and set v = v5 <- v
+        member __.V6 with get() = v6 and set v = v6 <- v
+        member __.V7 with get() = v7 and set v = v7 <- v
+        member __.V8 with get() = v8 and set v = v8 <- v
+
+    checkCommuteSeq "smcnewnc08" 
+        (query { yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> qmap (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8)) 
+        [(1,2,3,4,5,6,7,8)]
+
+    checkCommuteSeq "smcnewnc08x" 
+        (query { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> qmap (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8)) 
+        (seq   { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> Seq.map (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8)) 
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "smcnewnc02" 
+        (query { for i in db -> (i, i) }) 
+        (seq { for i in db -> (i,i) })
+
+
+
+    checkCommuteSeq "smcnewnc022df1" 
+       (query { for p in db do
+                groupBy p.Name into g
+                let s = query { for a in g do sumByNullable a.SomeNullableInt16Value }
+                select (g.Key, s) })
+        [("Don", System.Nullable 0s); ("Peter", System.Nullable 10s); ("Freddy", System.Nullable 0s); ("Freddi", System.Nullable 32s)]
+
+    checkCommuteSeq "smcnewnc022df1" 
+       (query { for p in db do
+                groupBy p.Name into g
+                let s = query { for a in g do sumBy a.SomeInt16Value }
+                select (g.Key, s) })
+        [("Don", 0s); ("Peter", 10s); ("Freddy", 0s); ("Freddi", 32s)]
+
+
+
+
+module QueryExecutionOverIQueryableWhereDataIsRecord =
+    open System
+    open Microsoft.FSharp.Linq    
+    type Customer = 
+       { Name:string; Data: int; Cost:float; Sizes: int list; Quantity:Nullable<int> }
+       member x.AlwaysNull = Nullable<int>()
+    let c1 = { Name="Don"; Data=6; Cost=6.2; Sizes=[1;2;3;4]; Quantity=Nullable() }
+    let c2 = { Name="Peter"; Data=7; Cost=4.2; Sizes=[10;20;30;40]; Quantity=Nullable(10) }
+    let c3 = { Name="Freddy"; Data=8; Cost=9.2; Sizes=[11;12;13;14]; Quantity=Nullable() }
+    let c4 = { Name="Freddi"; Data=10; Cost=1.0; Sizes=[21;22;23;24]; Quantity=Nullable(32) }
+    let c5 = { Name="Don"; Data=9; Cost=1.0; Sizes=[21;22;23;24]; Quantity=Nullable() }
+    // Not in the database
+    let c6 = { Name="Bob"; Data=9; Cost=1.0; Sizes=[21;22;23;24]; Quantity=Nullable() }
+    
+    let data = [c1;c2;c3;c4;c5]
+    let db = System.Linq.Queryable.AsQueryable<Customer>(data |> List.toSeq)
+
+    let dbEmpty = System.Linq.Queryable.AsQueryable<int>([] |> List.toSeq)
+    let dbOne = System.Linq.Queryable.AsQueryable<int>([1] |> List.toSeq)
+
+
+    checkCommuteSeq "rrcnewnc01" 
+        (query { yield! db }) 
+        db
+
+    checkCommuteSeq "rrcnewnc01nested" 
+        (query { for v in query { yield! db } do yield v }) 
+        db
+
+    checkCommuteSeq "rrcnewnc02" 
+        (query { for i in db -> i }) 
+        db
+
+    checkCommuteSeq "rrcnewnc02nested" 
+        (query { for v in query { for i in db -> i } do yield v }) 
+        db
+
+    checkCommuteSeq "rrcnewnc02nested2" 
+        (query { let q = query { for i in db -> i } in for v in q do yield v }) 
+        db
+
+    checkCommuteSeq "rrcnewnc03" 
+        (query { for i in db -> i.Name }) 
+        (seq { for i in db -> i.Name })
+
+    checkCommuteSeq "rrcnewnc03nested" 
+        (query { let q = query { for i in db -> i.Name } in for v in q do yield v } ) 
+        (seq { for i in db -> i.Name })
+
+    checkCommuteSeq "rrcnewnc06y" 
+        (query { for i in db do for j in db do yield (i.Name,j.Name)  })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "rrcnewnc06ynested" 
+        (query { let q = query { for i in db do for j in db do yield (i.Name,j.Name) } in for v in q do yield v })  
+        (seq   { for i in db do for j in db do yield (i.Name,j.Name)  })
+
+    checkCommuteSeq "rrcnewnc06bnested" 
+        (query { let q = query { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) } in for v in q do yield v }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "rrcnewnc06b" 
+        (query { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "rrcnewnc06w" 
+        (query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "rrcnewnc06wnested2" 
+        (query { let q = query { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) } in for v in q do yield v }) 
+        (seq   { for i in db do if i.Data = 8 then for j in db do if i.Data = j.Data then yield (i.Data,i.Name,j.Name) })
+
+    checkCommuteSeq "rrcnewnc06z" 
+        (query { for i in db do take 3 }) 
+        (seq   { for i in db do yield i } |> Seq.take 3)
+
+    checkCommuteSeq "rrcnewnc06x" 
+        (query { for i in db do where true; take 3 }) 
+        (seq   { for i in db do yield i } |> Seq.take 3)
+
+    
+    checkCommuteSeq "rrcnewnc06xb" 
+        (query { for i in db do for j in db do where true; take 3 }) 
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.take 3)
+
+    checkCommuteSeq "rrcnewnc06xbnested" 
+        (query { let q = query { for i in db do for j in db do where true; take 3 } in for v in q do yield v } ) 
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.take 3)
+
+    checkCommuteSeq "rrcnewnc06ya" 
+        (query { for i in db do select i }) 
+        (seq   { for i in db do yield i })
+
+    checkCommuteSeq "rrcnewnc06yab" 
+        (query { for i in db do for j in db do select i }) 
+        (seq   { for i in db do for j in db do yield i })
+
+    checkCommuteSeq "rrcnewnc06ya3" 
+        (query { for i in db do 
+                 select i.Name into n 
+                 distinct }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06ya3nested" 
+        (query { let q = query { for i in db do 
+                                 select i.Name into n 
+                                 distinct } 
+                 for v in q do yield v }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06ya3b" 
+        (query { for i in db do 
+                  select i.Name
+                  distinct }) 
+        ["Don"; "Peter"; "Freddy"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06ya3b" 
+        (query { for i in db do 
+                  select i.Name
+                  distinct 
+                  take 2 }) 
+        ["Don"; "Peter"]
+
+    checkCommuteSeq "rrcnewnc06yb" 
+        (query { for i in db do groupBy i.Name } |> qmap (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "rrcnewnc06ybx" 
+        (query { for i in db do groupValBy i i.Name } |> qmap (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do yield i } |> Seq.groupBy (fun i -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "rrcnewnc06yb2" 
+        (query { for i in db do for j in db do groupBy i.Name } |> qmap (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "rrcnewnc06yb2x" 
+        (query { for i in db do for j in db do groupValBy (i,j) i.Name } |> qmap (fun g -> (g.Key,Seq.toList g)))
+        (seq   { for i in db do for j in db do yield (i,j) } |> Seq.groupBy (fun (i,j) -> i.Name) |> Seq.map (fun (key,g) -> (key, Seq.toList g)))
+
+    checkCommuteSeq "rrcnewnc06yc" 
+        (query { for i in db do sortBy i.Name })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06yd" 
+        (query { for i in db do sortBy i.Name; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06ydx" 
+        (query { for i in db do sortBy i.Name; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Name) |> Seq.map (fun i -> i,i) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06yq" 
+        (query { for i in db do sortByDescending i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yqx" 
+        (query { for i in db do sortByDescending i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> i.Data) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yq3" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06yq3x" 
+        (query { for i in db do sortBy i.Name; thenBy i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06yq4" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yq4x" 
+        (query { for i in db do sortByDescending i.Name; thenBy i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.map (fun i-> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yq5" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yq5x" 
+        (query { for i in db do sortByDescending i.Name; thenByDescending i.Data; yield (i,i) })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, i.Data)) |> Seq.map (fun i -> (i,i)) |> Seq.toList |> List.rev)
+
+    checkCommuteSeq "rrcnewnc06yq6" 
+        (query { for i in db do sortBy i.Name; thenByDescending i.Data; yield i })
+        (seq   { for i in db do yield i } |> Seq.sortBy (fun i -> (i.Name, -i.Data)) |> Seq.toList)
+
+    checkCommuteSeq "rrcnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield i } |> qmap (fun x -> x.Name ))
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06yq6b" 
+        (query { for i in db do sortByNullable i.Quantity; yield (i,i) } |> qmap (fun (x,_) -> x.Name ))
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06yq6c" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield i } |> qmap (fun x -> x.Name ))
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06yq6cx" 
+        (query { for i in db do sortByNullable i.Quantity; thenByNullable i.AlwaysNull; yield (i,i) } |> qmap (fun (x,_) -> x.Name ))
+        ["Don"; "Freddy"; "Don"; "Peter"; "Freddi"]
+
+    checkCommuteSeq "rrcnewnc06yq6c" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield i } |> qmap (fun x -> x.Name ))
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "rrcnewnc06yq6cx" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullable i.AlwaysNull; yield (i,i) } |> qmap (fun (x,_) -> x.Name ))
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    checkCommuteSeq "rrcnewnc06yq6c" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield i } |> qmap (fun x -> x.Name ))
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+
+    checkCommuteSeq "rrcnewnc06yq6cx" 
+        (query { for i in db do sortByNullableDescending i.Quantity; thenByNullableDescending i.AlwaysNull; yield (i,i) } |> qmap (fun (x,_) -> x.Name ) )
+        ["Freddi"; "Peter"; "Don"; "Freddy"; "Don"]
+
+    check "rrcnewnc06ye"  
+        (query { for i in db do contains c1 }) 
+        true
+
+    check "rrcnewnc06yex"  
+        (query { for i in db do for j in db do contains (c1,c1) }) 
+        true
+
+    check "rrcnewnc06ye"  
+        (query { for i in dbEmpty do contains 1 }) 
+        false
+
+    check "rrcnewnc06yeg"  
+        (query { for i in dbOne do contains 1 }) 
+        true
+
+    check "rrcnewnc06yf" 
+        (query { for i in db do contains c6 }) 
+        false
+
+    check "rrcnewnc06yg" 
+        (query { for i in db do count }) 
+        5
+
+    check "rrcnewnc06yh" 
+        (query { for i in db do last }) 
+        c5
+
+    check "rrcnewnc06yh" 
+        (query { for i in db do for j in db do last }) 
+        (c5,c5)
+
+    check "rrcnewnc06yh2a" 
+        (query { for i in db do lastOrDefault }) 
+        c5
+
+    check "rrcnewnc06yh2a" 
+        (query { for i in db do for j in db do lastOrDefault }) 
+        (c5,c5)
+
+    check "rrcnewnc06yh2b" 
+        (query { for i in db do headOrDefault }) 
+        c1
+
+    check "rrcnewnc06yh2bx" 
+        (query { for i in db do for j in db do headOrDefault }) 
+        (c1,c1)
+
+    check "rrcnewnc06yh3a" 
+        (query { for i in dbEmpty do lastOrDefault }) 
+        0
+
+    check "rrcnewnc06yh3b" 
+        (query { for i in dbEmpty do headOrDefault }) 
+        0
+
+    check "rrcnewnc06yh4" 
+        (query { for i in dbOne do exactlyOne }) 
+        1
+
+    check "rrcnewnc06yh4x" 
+        (query { for i in dbOne do for j in dbOne do exactlyOne }) 
+        (1,1)
+
+    check "rrcnewnc06yh5" 
+        (query { for i in dbOne do exactlyOneOrDefault }) 
+        1
+
+    check "rrcnewnc06yh5x" 
+        (query { for i in dbOne do for j in dbOne do exactlyOneOrDefault }) 
+        (1,1)
+
+    
+    check "rrcnewnc06yh6" 
+        (try 
+            query { for i in dbEmpty do exactlyOne } |> ignore; false 
+         with :? System.InvalidOperationException -> true) 
+        true
+
+    check "rrcnewnc06yh7" 
+        (query { for i in dbEmpty do exactlyOneOrDefault }) 
+        0
+
+    check "rrcnewnc06yh8" 
+        (query { for i in dbOne do minBy i }) 
+        1
+
+    check "rrcnewnc06yh8x" 
+        (query { for i in dbOne do for j in dbOne do minBy i }) 
+        1
+
+    check "rrcnewnc06yh9" 
+        (query { for i in db do minBy i.Data }) 
+        c1.Data
+
+
+    check "rrcnewnc06yh9x" 
+        (query { for i in db do for j in db do minBy i.Data }) 
+        c1.Data
+
+    
+    check "rrcnewnc06yh9" 
+        (try query { for i in dbEmpty do minBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "rrcnewnc06yh9xff" 
+        (try query { for i in dbEmpty do nth 3 } with :? System.ArgumentOutOfRangeException -> -10) 
+        -10
+
+    check "rrcnewnc06yh9xx" 
+        (query { for i in dbEmpty do skip 1 } |> Seq.length |> ignore; 10)
+        10
+
+
+    check "rrcnewnc06yh10" 
+        (query { for i in dbOne do maxBy i }) 
+        1
+
+    check "rrcnewnc06yh11" 
+        (query { for i in db do maxBy i.Data }) 
+        c4.Data
+    
+    check "rrcnewnc06yh11" 
+        (query { for i in db do for j in db do maxBy i.Data }) 
+        c4.Data
+    
+    check "rrcnewnc06yh12" 
+        (try query { for i in dbEmpty do maxBy i } with :? System.InvalidOperationException -> -10) 
+        -10
+
+    check "rrcnewnc06yh81" 
+        (query { for i in dbOne do sumBy i }) 
+        1
+
+    check "rrcnewnc06yh81x" 
+        (query { for i in dbOne do for j in dbOne do sumBy i }) 
+        1
+
+    check "rrcnewnc06yh82" 
+        (query { for i in dbEmpty do sumBy i }) 
+        0
+
+    check "rrcnewnc06yh82x" 
+        (query { for i in dbEmpty do for j in dbEmpty do sumBy i }) 
+        0
+
+    check "rrcnewnc06yh81b" 
+        (query { for i in dbOne do averageBy (float i) }) 
+        1.0
+    
+    check "rrcnewnc06yh81bx" 
+        (query { for i in dbOne do for j in dbOne do averageBy (float i) }) 
+        1.0
+    
+
+    check "rrcnewnc06yh81c" 
+        (query { for i in dbOne do averageBy (float32 i) }) 
+        1.0f
+
+
+    check "rrcnewnc06yh81cx" 
+        (query { for i in dbOne do for j in dbOne do averageBy (float32 i) }) 
+        1.0f
+
+    check "rrcnewnc06yh81d" 
+        (query { for i in dbOne do averageBy (decimal i) }) 
+        1.0M
+
+    check "rrcnewnc06yh81e" 
+        (query { for i in dbOne do sumBy (int64 i) }) 
+        1L
+
+    check "rrcnewnc06yh81f" 
+        (query { for i in dbOne do sumBy (decimal i) }) 
+        1.0M
+
+    check "rrcnewnc06yh81g" 
+        (query { for i in dbOne do sumBy (int32 i) }) 
+        1
+
+    check "rrcnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float i) }) 
+        1.0
+
+    check "rrcnewnc06yh81h" 
+        (query { for i in dbOne do sumBy (float32 i) }) 
+        1.0f
+
+    
+    check "rrcnewnc06yh9" 
+        (try query { for i in dbEmpty do averageBy (float i) } with :? System.InvalidOperationException -> -10.0) 
+        -10.0
+
+    check "rrcnewnc06yh91" 
+        (query { for i in db do sumByNullable i.Quantity }) 
+        (Nullable 42)
+
+    check "rrcnewnc06yh92" 
+        (query { for i in db do averageByNullable (Nullable(10.0)) }) 
+        (Nullable 10.0)
+
+    check "rrcnewnc06yh92" 
+        (query { for i in db do maxByNullable i.Quantity }) 
+        (Nullable 32)
+
+    check "rrcnewnc06yh93" 
+        (query { for i in db do minByNullable i.Quantity }) 
+        (Nullable 10)
+
+    check "rrcnewnc06yh94" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(i)) }) 
+        (Nullable 0)
+
+    check "rrcnewnc06yh95" 
+        (query { for i in dbEmpty do averageByNullable (Nullable(float i)) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh96" 
+        (query { for i in dbEmpty do maxByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh97" 
+        (query { for i in dbEmpty do minByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh91" 
+        (query { for i in db do sumByNullable i.Quantity }) 
+        (Nullable 42)
+
+    check "rrcnewnc06yh94" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(i)) }) 
+        (Nullable 0)
+
+    check "rrcnewnc06yh94b" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float32 i)) }) 
+        (Nullable 0.0f)
+
+    check "rrcnewnc06yh94c" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(decimal i)) }) 
+        (Nullable 0.0M)
+
+    check "rrcnewnc06yh94d" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(int64 i)) }) 
+        (Nullable 0L)
+
+    check "rrcnewnc06yh94e" 
+        (query { for i in dbEmpty do sumByNullable (Nullable(float i)) }) 
+        (Nullable 0.0)
+
+    check "rrcnewnc06yh98" 
+        (query { for i in db do sumByNullable i.AlwaysNull }) 
+        (Nullable(0))
+
+    check "rrcnewnc06yh96" 
+        (query { for i in dbEmpty do maxByNullable (Nullable i) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh96b" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float i)) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh96c" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (decimal i)) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh96d" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (float32 i)) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh96e" 
+        (query { for i in dbEmpty do maxByNullable (Nullable (int64 i)) }) 
+        (Nullable())
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do maxByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "rrcnewnc06yh9Q" 
+        (query { for i in db do minByNullable i.AlwaysNull }) 
+        (Nullable())
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do all (i.Name = "Don") }) 
+        false
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do exists (i.Name = "Don") }) 
+        true
+
+    check "rrcnewnc06yh99" 
+        (query { for i in dbEmpty do all (i = 1) }) 
+        true
+
+    check "rrcnewnc06yh99" 
+        (query { for i in dbEmpty do exists (i = 1) }) 
+        false
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do find (i.Name = "Peter") }) 
+        c2
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do skip 1; select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do skipWhile (i.Name = "Don"); select i.Name} |> Seq.toList) 
+        ["Peter"; "Freddy"; "Freddi"; "Don"]
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do take 2; select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do takeWhile (i.Name = "Don" || i.Name = "Peter"); select i.Name} |> Seq.toList) 
+        ["Don"; "Peter"]
+
+    check "rrcnewnc06yh99" 
+        (query { for i in db do nth 0 }) 
+        c1
+
+    check "rrcnewnc06yh9Q1" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 select (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+
+    check "rrcnewnc06yh9Q2" 
+        (query { for i in db do 
+                 join j in db on (i.Name = j.Name)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(6.2, 6.2); (6.2, 1.0); (4.2, 4.2); (9.2, 9.2); (1.0, 1.0); (1.0, 6.2); (1.0, 1.0)]
+
+    check "rrcnewnc06yh9Q3" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault())
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "rrcnewnc06yh9Q4" 
+        (query { for i in db do 
+                 join j in db on (i.Quantity ?=? j.Quantity)
+                 yield (i.Cost, j.Cost) } |> Seq.toList) 
+        [(4.2, 4.2); (1.0, 1.0)]
+
+    check "rrcnewnc06yh9Q5" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "rrcnewnc06yh9Q6" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity ?= j.Quantity.GetValueOrDefault()) into group
+                 yield (group |> Seq.map (fun x -> x.Name) |> Seq.toList) } 
+            |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "rrcnewnc06yh9Q7" 
+        (query { for i in db do 
+                 groupJoin j in db on (i.Quantity.GetValueOrDefault() =? j.Quantity) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+    check "rrcnewnc06yh9Q8" 
+        (query { for i in db do groupJoin j in db on (i.Quantity ?=? j.Quantity) into group; yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [[]; ["Peter"]; []; ["Freddi"]; []]
+
+
+
+
+
+    check "rrcnewnc06yh9Q5left1" 
+        (query { for i in db do 
+                 leftOuterJoin j in db on (i.Name = j.Name) into group
+                 yield group |> Seq.map (fun x -> x.Name) |> Seq.toList } |> Seq.toList) 
+        [["Don"; "Don"]; ["Peter"]; ["Freddy"]; ["Freddi"]; ["Don"; "Don"]]
+
+    check "rrcnewnc06yh9Q5left2" 
+        (query { for i in ["1";"2"] do 
+                 leftOuterJoin j in ["1";"12"] on (i.[0] = j.[0]) into group
+                 yield (i, group |> Seq.toList) } |> Seq.toList) 
+        [("1", ["1";"12"]); ("2", [null]) ]
+
+
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "rrsmcnewnc01a" 
+        (query { yield (1,1) } ) 
+        (seq { yield (1,1) } |> Seq.toList)
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "rrsmcnewnc01nested" 
+        (query { yield (1,(2,3)) } ) 
+        [ (1,(2,3)) ]
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "rrsmcnewnc07" 
+        (query { yield (1,2,3,4,5,6,7) } ) 
+        [ (1,2,3,4,5,6,7) ]
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "rrsmcnewnc08" 
+        (query { yield (1,2,3,4,5,6,7,8) } ) 
+        [ (1,2,3,4,5,6,7,8) ]
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "rrsmcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9) } ) 
+        (seq { yield (1,2,3,4,5,6,7,8,9) } )
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "rrsmcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+        [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ]
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "rrsmcnewnc01f" 
+        (query { yield (1,1) } ) 
+        (seq { yield (1,1) } )
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "rrsmcnewnc01nested" 
+        (query { yield (1,(2,3)) } ) 
+        [ (1,(2,3)) ]
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "rrsmcnewnc07" 
+        (query { yield (1,2,3,4,5,6,7) } ) 
+        [ (1,2,3,4,5,6,7) ]
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "rrsmcnewnc08" 
+        (query { yield (1,2,3,4,5,6,7,8) } ) 
+        [ (1,2,3,4,5,6,7,8) ]
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "rrsmcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9) } ) 
+        (seq { yield (1,2,3,4,5,6,7,8,9) } )
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "rrsmcnewnc09" 
+        (query { yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+        [ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ]
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "rrsmcnewnc01x" 
+        (query { for x in db do yield (1,1) } ) 
+        (seq { for x in db do yield (1,1) } )
+
+    // Smoke test for returning a nested tuple
+    checkCommuteSeq "rrsmcnewnc01nestedx" 
+        (query { for x in db do yield (1,(2,3)) } ) 
+        (seq { for x in db do yield (1,(2,3)) } ) 
+
+    // Smoke test for returnng a tuple, size = 7
+    checkCommuteSeq "rrsmcnewnc07x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7) } ) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7) } ) 
+
+    // Smoke test for returning a tuple, size = 8
+    checkCommuteSeq "rrsmcnewnc08x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8) } ) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8) } ) 
+
+    // Smoke test for returning a tuple, size = 9
+    checkCommuteSeq "rrsmcnewnc09x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9) } ) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9) } )
+
+    // Smoke test for returning a tuple, size = 16
+    checkCommuteSeq "rrsmcnewnc09x" 
+        (query { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+        (seq { for x in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+
+
+
+    // Smoke test for returning a tuple, nested for loops
+    checkCommuteSeq "rrsmcnewnc01xx" 
+        (query { for x in db do for y in db do yield (1,1) } ) 
+        (seq { for x in db do for y in db do yield (1,1) } )
+
+    // Smoke test for returning a nested tuple, nested for loops
+    checkCommuteSeq "rrsmcnewnc01nestedxx" 
+        (query { for x in db do for y in db do yield (1,(2,3)) } ) 
+        (seq { for x in db do for y in db do yield (1,(2,3)) } ) 
+
+    // Smoke test for returnng a tuple, size = 7, nested for loops
+    checkCommuteSeq "rrsmcnewnc07xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7) } ) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7) } ) 
+
+    // Smoke test for returning a tuple, size = 8, nested for loops
+    checkCommuteSeq "rrsmcnewnc08xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) } ) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8) } ) 
+
+    // Smoke test for returning a tuple, size = 9, nested for loops
+    checkCommuteSeq "rrsmcnewnc09xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) } ) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9) } )
+
+    // Smoke test for returning a tuple, size = 16, nested for loops
+    checkCommuteSeq "rrsmcnewnc09xx" 
+        (query { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+        (seq { for x in db do for y in db do yield (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) } ) 
+
+
+    type R1 =  { V1 : int }
+    type R7 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type R8 =  { V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rrrsmcnewnc01" 
+        (query { yield { R1.V1=1 } } |> qmap (fun r -> r.V1) ) 
+        [1;]
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rrrsmcnewnc07" 
+        (query { yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+   // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rrrsmcnewnc08" 
+        (query { yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+    // Smoke test for returning an immutable record object, size = 1
+    checkCommuteSeq "rrrsmcnewnc01x" 
+        (query { for x in db do yield { R1.V1=1 } } |> qmap (fun r -> r.V1) ) 
+        (seq { for x in db do yield { R1.V1=1 } } |> Seq.map (fun r -> r.V1) ) 
+
+    // Smoke test for returning an immutable record object, size = 7
+    checkCommuteSeq "rrrsmcnewnc07x" 
+        (query { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq { for x in db do yield { R7.V1=1; R7.V2=2; R7.V3=3; R7.V4=4; R7.V5=5; R7.V6=6; R7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    // Smoke test for returning an immutable record object, size = 8
+    checkCommuteSeq "rrrsmcnewnc08x" 
+        (query { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq { for x in db do yield { R8.V1=1; R8.V2=2; R8.V3=3; R8.V4=4; R8.V5=5; R8.V6=6; R8.V7=7; R8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    type MR1 =  { mutable V1 : int }
+    type PMR7 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int }
+    type PMR8 =  { mutable V1 : int; V2 : int; V3 : int; V4 : int; V5 : int; V6 : int; V7 : int; V8 : int }
+    type MR7 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int }
+    type MR8 =  { mutable V1 : int; mutable V2 : int; mutable V3 : int; mutable V4 : int; mutable V5 : int; mutable V6 : int; mutable V7 : int; mutable V8 : int }
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "rrmrsmcnewnc01" 
+        (query { yield { MR1.V1=1 } } |> qmap (fun r -> r.V1) ) 
+        [1;]
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "rrpmrsmcnewnc07" 
+        (query { yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "rrmrsmcnewnc07" 
+        (query { yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "rrpmrsmcnewnc08" 
+        (query { yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "rrmrsmcnewnc08" 
+        (query { yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+
+    // Smoke test for returning a mutable record object, size = 1
+    checkCommuteSeq "rrmrsmcnewnc01x" 
+        (query { for x in db do yield { MR1.V1=1 } } |> qmap (fun r -> r.V1) ) 
+        (seq   { for x in db do yield { MR1.V1=1 } } |> Seq.map (fun r -> r.V1) ) 
+
+    // Smoke test for returning a partially immutable record object, size = 7
+    checkCommuteSeq "rrpmrsmcnewnc07x" 
+        (query { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq   { for x in db do yield { PMR7.V1=1; PMR7.V2=2; PMR7.V3=3; PMR7.V4=4; PMR7.V5=5; PMR7.V6=6; PMR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    // Smoke test for returning a mutable record object, size = 7
+    checkCommuteSeq "rrmrsmcnewnc07x" 
+        (query { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq   { for x in db do yield { MR7.V1=1; MR7.V2=2; MR7.V3=3; MR7.V4=4; MR7.V5=5; MR7.V6=6; MR7.V7=7 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    // Smoke test for returning a partially immutable record object, size = 8
+    checkCommuteSeq "rrpmrsmcnewnc08x" 
+        (query { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq   { for x in db do yield { PMR8.V1=1; PMR8.V2=2; PMR8.V3=3; PMR8.V4=4; PMR8.V5=5; PMR8.V6=6; PMR8.V7=7; PMR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    // Smoke test for returning a mutable record object, size = 8
+    checkCommuteSeq "rrmrsmcnewnc08x" 
+        (query { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq   { for x in db do yield { MR8.V1=1; MR8.V2=2; MR8.V3=3; MR8.V4=4; MR8.V5=5; MR8.V6=6; MR8.V7=7; MR8.V8=8 } } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+
+    // Smoke test for returning an object using property-set notation for member init, size = 8
+    type C1() = 
+        let mutable v1 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+
+    checkCommuteSeq "rrsmcnewnc01v" 
+        (query { yield C1(V1=1) } |> qmap (fun r -> r.V1) ) 
+        [1;]
+
+    checkCommuteSeq "rrsmcnewnc01x" 
+        (query { for x in db do yield C1(V1=1) } |> qmap (fun r -> r.V1) ) 
+        (seq { for x in db do yield C1(V1=1) } |> Seq.map (fun r -> r.V1) ) 
+
+        //<@ C1(V1=1) @>
+
+    // Smoke test for returning an object using property-set notation for member init
+    type C2() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+
+    checkCommuteSeq "rrsmcnewnc01b" 
+        (query { yield C2(V1=1, V2=2) } |> qmap (fun r -> r.V1, r.V2) ) 
+        [1,2;]
+
+    checkCommuteSeq "rrsmcnewnc01x" 
+        (query { for x in db do yield C2(V1=1, V2=2) } |> qmap (fun r -> r.V1, r.V2) ) 
+        (seq  { for x in db do yield C2(V1=1, V2=2) } |> Seq.map (fun r -> r.V1, r.V2) ) 
+
+    // Smoke test for returning an object using property-set notation for member init
+    type C8() = 
+        let mutable v1 = 0
+        let mutable v2 = 0
+        let mutable v3 = 0
+        let mutable v4 = 0
+        let mutable v5 = 0
+        let mutable v6 = 0
+        let mutable v7 = 0
+        let mutable v8 = 0
+        member __.V1 with get() = v1 and set v = v1 <- v
+        member __.V2 with get() = v2 and set v = v2 <- v
+        member __.V3 with get() = v3 and set v = v3 <- v
+        member __.V4 with get() = v4 and set v = v4 <- v
+        member __.V5 with get() = v5 and set v = v5 <- v
+        member __.V6 with get() = v6 and set v = v6 <- v
+        member __.V7 with get() = v7 and set v = v7 <- v
+        member __.V8 with get() = v8 and set v = v8 <- v
+
+    checkCommuteSeq "rrsmcnewnc08" 
+        (query { yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> qmap (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) ) 
+        [(1,2,3,4,5,6,7,8)]
+
+    checkCommuteSeq "rrsmcnewnc08x" 
+        (query { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> qmap (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) ) 
+        (seq   { for x in db do yield C8(V1=1, V2=2, V3=3,V4=4, V5=5, V6=6, V7=7, V8=8) } |> Seq.map (fun r -> r.V1, r.V2, r.V3, r.V4, r.V5, r.V6, r.V7, r.V8) ) 
+
+    // Smoke test for returning a tuple
+    checkCommuteSeq "rrsmcnewnc02" 
+        (query { for i in db -> (i, i) } ) 
+        (seq { for i in db -> (i,i) } )
+
+
+/// Check some of the conversions of leaf expressions when calling the API directly
+module LeafExpressionConversionTests = 
+    open Microsoft.FSharp.Linq.RuntimeHelpers
+    open System.Linq.Expressions
+
+    module ExpressionPatterns = 
+        let (|Constant|_|) (c:Expression) = match c with :? ConstantExpression as c -> Some (c.Value, c.Type) | _ -> None
+        let (|BinExpr|_|) (c:Expression) = match c with :? BinaryExpression as c -> Some (c.Left, c.NodeType, c.Right) | _ -> None
+        let (|Int32Obj|_|) (c:obj) = match c with :? int32 as c -> Some c | _ -> None
+        let (|Int32|_|) = function Constant(Int32Obj n, _) -> Some n | _ -> None
+        let (|Add|_|) = function BinExpr(l,ExpressionType.Add,r) -> Some (l,r) | _ -> None
+        let (|Modulo|_|) = function BinExpr(l,ExpressionType.Modulo,r) -> Some (l,r) | _ -> None
+        let (|GreaterThan|_|) = function BinExpr(l,ExpressionType.GreaterThan,r) -> Some (l,r) | _ -> None
+        let (|AddChecked|_|) = function BinExpr(l,ExpressionType.AddChecked,r) -> Some (l,r) | _ -> None
+
+    let E x = LeafExpressionConverter.QuotationToExpression x
+    open ExpressionPatterns
+    check "rrckjwnew" (match E <@ 1 @> with | Int32 1 -> true | _ -> false) true
+    check "rrckjwnew" (match E <@ 1 + 1 @> with | Add(Int32 1, Int32 1) -> true | _ -> false) true
+    check "rrckjwnew" (match E <@ Operators.Checked.(+) 1 1 @> with | AddChecked(Int32 1, Int32 1) -> true | _ -> false) true
+    check "rrckjwnew" (match E <@ 1 % 1 @> with | Modulo(Int32 1, Int32 1) -> true | _ -> false) true
+
+module QueryConversionIssue = 
+    check "QueryConversionIssue"
+        (
+            try
+                let a = System.Linq.Queryable.AsQueryable [| 1 |]
+                let r = 
+                    query {
+                    for v in a do
+                    for (x, y) in (query { for z in [ 1 ] do select(z, z)}) do
+                    select x
+                }
+                ignore(r.Expression);
+                true
+            with _ -> false
+        ) true
+    
+/// Some smoke tests that implicit expression conversions compile correctly
+module MiscTestsForImplicitExpressionConversion = 
+    open Microsoft.FSharp.Linq
+
+    module QueryOperators = 
+        let mapReduce ([<ProjectionParameter>] mapper: 'T -> seq<'U>) (keySelector: 'U -> 'Key) (reducer: 'Key -> seq<'U> -> 'Result) (source: System.Linq.IQueryable<_>) =
+            query { for v in source do
+                    for x in mapper v do
+                    groupValBy x (keySelector x) into group
+                    yield reducer group.Key group }
+
+    module TechnicalReportExamplesOption1 = 
+        open System.Linq
+        open System.Linq.Expressions
+
+        module Histogram = 
+            let histogram k (input: System.Linq.IQueryable<string>) =
+                // Problem - type annotation requried on input variable 
+                // Problem - upcast required of return result of function (no covariance for functions)
+                let words = input.SelectMany(fun x -> x.Split(' ') :> seq<_>)
+                let groups = words.GroupBy(fun x -> x)
+                let counts = groups.Select(fun x -> x.Key, x.Count())
+                let ordered = counts.OrderByDescending(fun (key,count) -> count)
+                let top = ordered.Take k
+                top 
+
+        check "cwnwe09" 
+            (Histogram.histogram 3 (Queryable.AsQueryable ["Hello world"; "world hello"]) |> Seq.toList)
+            [("world", 2); ("Hello", 1); ("hello", 1)]
+
+        module PageRank1 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                  edges.Join(ranks, 
+                             (fun edge -> edge.source), 
+                             (fun rank -> rank.source), 
+                             (fun edge rank -> { source = edge.target; value = rank.value }))
+                       . GroupBy(fun rank -> rank.source)
+                       . Select(fun group -> { source = group.Key; value = group.Select(fun rank -> rank.value).Sum() })
+
+            let results = 
+              pageRank 
+                ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 } ], 
+                  Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 } ]) |> Seq.toList |> List.map (fun c -> c.value)
+
+            check "lceknwe90" results [2235; 2250; 2265; 2079; 2093; 2107; 2121]
+
+
+
+    module TechnicalReportExamplesOption2 = 
+        open System.Linq
+        open System.Linq.Expressions
+
+        type QSeq = 
+            static member collect (f:Expression<System.Func<_,_>>)  = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.SelectMany(source,f))
+            static member groupBy (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.GroupBy(source,f))
+            // Note: no Expression conversion on curried members, reduces fluency w.r.t. F# combinator style
+            static member join (source2, keySelector1:Expression<System.Func<_,_>>, keySelector2:Expression<System.Func<_,_>>, resultSelector:Expression<System.Func<_,_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Join(source,source2,keySelector1,keySelector2,resultSelector))
+            static member map (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Select(source,f))
+            static member orderBy (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.OrderBy(source,f))
+            static member orderByDescending (f:Expression<System.Func<_,_>>) = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.OrderByDescending(source,f))
+            static member take n = (fun (source:#IQueryable<_>) -> System.Linq.Queryable.Take(source,n))
+
+
+        module Histogram = 
+            let histogram k (input: System.Linq.IQueryable<string>) =
+                input 
+                 |> QSeq.collect (fun x -> x.Split(' ') :> seq<_>)
+                 |> QSeq.groupBy (fun x -> x)
+                 |> QSeq.map (fun x -> x.Key, x.Count())
+                 |> QSeq.orderByDescending (fun (key,count) -> count)
+                 |> QSeq.take k
+
+        module PageRank1 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                  edges
+                  // Note, in this model join is neither pleasant (less pleasant than C#) nor curried (though no expectation it would be)
+                  |> QSeq.join (ranks, (fun edge -> edge.source), (fun rank -> rank.source), (fun edge rank -> { source = edge.target; value = rank.value }))
+                  |> QSeq.groupBy(fun rank -> rank.source)
+                  // Note: in this model, nested queries use 'Seq' combinators. Very non-fluent
+                  |> QSeq.map (fun group -> { source = group.Key; value = group |> Seq.sumBy (fun rank -> rank.value) })
+
+            let results = 
+
+                pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> ({ source = i; target = i % 7 } : Edge) ], 
+                           Queryable.AsQueryable [ for i in 0 .. 100 -> ({ source = i; value = i+100 } : Rank) ])
+                |> Seq.toList |> List.map (fun c -> c.value)
+
+            check "lceknwe91" results [2235; 2250; 2265; 2079; 2093; 2107; 2121]
+
+
+
+        module PageRank2 = 
+            type Edge = { source:int; target:int }
+            type Rank = { source:int; value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in ranks on (edge.source = rank.source)
+                        let newRank = { source = edge.target; value = rank.value }
+                        groupValBy newRank newRank.source into group
+                        yield    { source = group.Key; value = query { for rank in group do sumBy rank.value } } }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 }  : Edge], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 }  : Rank ])
+
+
+        module PageRank1b = 
+            type Edge = { mutable source:int; mutable target:int }
+            type Rank = { mutable source:int; mutable value:int }
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in ranks on (edge.source = rank.source)
+                        let newRank = { source = edge.target; value = rank.value }
+
+                        groupValBy newRank newRank.source into group
+
+                        select { source = group.Key; value = query { for rank in group do sumBy rank.value } } }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; target = i % 7 } : Edge ], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> { source = i; value = i+100 } : Rank ])
+
+        module PageRank1c = 
+            type Edge(source:int, target:int) = 
+                member x.Source = source 
+                member x.Target = target
+            type Rank(source:int, value:int) = 
+                member x.Source = source 
+                member x.Value = value
+
+            let pageRank(edges: IQueryable<Edge>, ranks: IQueryable<Rank>) = 
+                query { for edge in edges do
+                        join rank in ranks on (edge.Source = rank.Source)
+                        let newRank = Rank(source = edge.Target, value = rank.Value)
+                        groupValBy newRank newRank.Source into group
+                        yield (Rank(source = group.Key, value = query { for rank in group do sumBy rank.Value } )) }
+
+            pageRank ( Queryable.AsQueryable [ for i in 0 .. 100 -> Edge(source = i, target = i % 7) ], 
+                       Queryable.AsQueryable [ for i in 0 .. 100 -> Rank(source = i, value = i+100) ])
+
+
+
+module Problem2 = 
+    open System.Linq
+
+    type Item = { Name : string } with override x.ToString() = x.Name
+    let item = {Name = "1"}
+    let l = [box item]
+    let items = l.AsQueryable()
+
+    QueryExecutionOverIQueryable.checkLinqQueryText "ltcjhnwec7eweww2" 
+       (query { for item in items do
+                where (item :? Item)
+                select (item :?> Item) })
+       "[1].Where(item => (item Is Item)).Select(item => Convert(item))"
+
+    checkCommuteSeq "ltcjhnwec7eweww2b" 
+       (query { for item in items do
+                where (item :? Item)
+                select (item :?> Item) })
+       [item]
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToEntities/build.bat b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/build.bat
new file mode 100644
index 0000000..4ca06b8
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/build.bat
@@ -0,0 +1,75 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+
+    "%FSC%" %fsc_flags% -a -o:testlib.dll -r:System.Data.Entity.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs
+    REM NOTE!!! We expect an error here, because entity framework types can't be used across assembly boundaries
+    @if %ERRORLEVEL% EQU 0 goto Error
+
+    ECHO good, got an error.
+
+    REM Disabled because cross-assembly entity framework doesn't yet work, 
+	REM "%FSC%" %fsc_flags% -r:testlib.dll -o:testapp.exe -r:System.Data.Entity.dll -g test-part2.fs 
+    REM @if ERRORLEVEL 1 goto Error
+
+    REM "%PEVERIFY%" testapp.exe 
+    REM @if ERRORLEVEL 1 goto Error
+
+
+    "%FSC%" %fsc_flags% -o:testtwoparts.exe -r:System.Data.Entity.dll --define:INTERNAL -r:FSharp.Data.TypeProviders.dll -g test-part1.fs test-part2.fs 
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" testtwoparts.exe 
+    @if ERRORLEVEL 1 goto Error
+
+
+    "%FSC%" %fsc_flags% -o:testtwoparts-not-internal.exe -r:System.Data.Entity.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs test-part2.fs 
+    REM NOTE!!! We expect an error here, because entity framework types can't be used across assembly boundaries
+    @if %ERRORLEVEL% EQU 0 goto Error
+
+    ECHO good, got an error.
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToEntities/run.bat b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/run.bat
new file mode 100644
index 0000000..5098c99
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/run.bat
@@ -0,0 +1,65 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    REM Disabled because cross-assembly entity framework doesn't yet work, 
+	REM if exist test.ok (del /f /q test.ok)
+    REM %CLIX% testapp.exe
+    REM @if ERRORLEVEL 1 goto Error
+    REM if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% testtwoparts.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part1.fs b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part1.fs
new file mode 100644
index 0000000..415d30e
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part1.fs
@@ -0,0 +1,67 @@
+// #Quotations
+
+module Foo.TestPart1
+
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Data.TypeProviders
+
+
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+#if INTERNAL
+type internal NorthwndDb = 
+#else
+type NorthwndDb = 
+#endif
+#if USESQLEXPRESS
+    SqlEntityConnection<ConnectionString = @" Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true,ForceUpdate=false,LocalSchemaFile="schema1.ssdl">
+#else
+#endif
+
+
+(*
+module DuplicateTypes = 
+    type NorthwndDb = 
+        SqlEntityConnection<ConnectionString = @" Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true,ForceUpdate=false,LocalSchemaFile="schema2.ssdl">
+
+
+type NorthwndDb2 = 
+    SqlEntityConnection<ConnectionString = @" Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true,ForceUpdate=false,LocalSchemaFile="schema3.ssdl">
+ 
+ *)
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part2.fs b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part2.fs
new file mode 100644
index 0000000..03d8b06
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test-part2.fs
@@ -0,0 +1,563 @@
+// #Quotations
+
+module internal Foo.TestPart2
+
+
+open Foo.TestPart1
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+module Queryable = 
+
+    let db = NorthwndDb.GetDataContext()
+
+
+    let checkLinqQueryText s (q1: System.Linq.IQueryable<'T>) text =
+        //db.DataContext.Log <- System.Console.Out
+        check s (try q1.Expression.ToString() with e -> "Unexpected error: " + e.ToString()) text
+
+    let checkLinqSqlText s (q1: System.Linq.IQueryable<'T>) (text:string) =
+        //db.DataContext.Log <- new System.IO.StringWriter()
+        q1 |> Seq.length |> ignore
+       // For now we don't actually test the query text, since I don't know how to log the SQL used by EF
+        //check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+    let checkLinqSqlTextForValue s (q1: unit -> 'T) (text:string) =
+        //db.DataContext.Log <- new System.IO.StringWriter()
+        q1() |> ignore
+       // For now we don't actually test the query text, since I don't know how to log the SQL used by EF
+       //check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+
+    let customers = 
+        checkLinqSqlText "vwe4yuwe091"
+            (query { for c in db.Customers do select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]"""
+
+    let customerWithNamesStartingWithB = 
+        checkLinqSqlText "vwe4yuwe092"
+            (query { for c in db.Customers do where (c.CompanyName.StartsWith "A"); select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[CompanyName] LIKE @p0"""
+
+
+    let customerNames = 
+        checkLinqSqlText "vwe4yuwe093"
+            (query { for c in db.Customers do select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+    let customersAverageOrders = 
+        checkLinqSqlTextForValue "vwe4yuwe094"
+            (fun () -> query { for c in db.Customers do averageBy (float c.Orders.Count) })
+            """SELECT AVG([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]"""
+
+    let customersSorted = 
+        checkLinqSqlText "vwe4yuwe095"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]"""
+
+
+    let joinCustomersAndEmployeesByName = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do join e in db.Employees on (c.Country = e.Country); select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+
+    let customersSortedDescending = 
+        checkLinqSqlText "vwe4yuwe097"
+            (query { for c in db.Customers do sortByDescending c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC""" 
+
+    let customersSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe098"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customersSortedTwoColumnsAscendingDescending = 
+        checkLinqSqlText "vwe4yuwe099"
+            (query { for c in db.Customers do sortBy c.Country; thenByDescending c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region] DESC""" 
+
+
+    let sumOfAllOrdersForCustomers = 
+        checkLinqSqlTextForValue "vwe4yuwe09q"
+            (fun () -> query { for c in db.Customers do sumBy (float c.Orders.Count) })
+            """SELECT SUM([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]""" 
+
+    let customersSortedTwoColumnsDescendingAscending = 
+        checkLinqSqlText "vwe4yuwe09w"
+            (query { for c in db.Customers do sortByDescending c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC, [t0].[Region]""" 
+
+    let customerSpecificsSorted = 
+        checkLinqSqlText "vwe4yuwe09e"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]""" 
+
+    let customerSpecificsSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe09r"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customerLongestNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe09t"
+            (fun () -> query { for c in db.Customers do maxBy c.ContactName.Length })
+            """SELECT MAX(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]"""  
+
+
+    let sumOfLengthsOfCustomerNames = 
+        checkLinqSqlTextForValue "vwe4yuwe09y7"
+            (fun () -> query { for c in db.Customers do sumBy c.ContactName.Length })
+            """SELECT SUM(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let customersAtSpecificAddress = 
+        checkLinqSqlText "vwe4yuwe09u"
+            (query { for c in db.Customers do where (c.Address.Contains("Jardim das rosas")); select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    let customersAtSpecificAddressUsingIf = 
+        checkLinqSqlText "vwe4yuwe09i"
+            (query { for c in db.Customers do if (c.Address.Contains("Jardim das rosas")) then select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    checkLinqSqlText "vwe4yuwe09p"
+        (query { for p in db.Products do groupBy p.ProductName into g; select g.Key })
+        """SELECT [t0].[ProductName]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqSqlText "vwe4yuwe09a"
+        (query { for p in db.Products do groupBy p.ProductName into g; select (g.Count()) })
+        """SELECT COUNT(*) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqQueryText "vwe4yuwe09s"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """Convert(value(System.Data.Objects.ObjectSet`1[SqlEntityConnection1.Product])).MergeAs(AppendOnly).GroupBy(p => p.ProductName, p => p.UnitPrice).Select(g => g.Average(x => x))"""
+
+    checkLinqSqlText "vwe4yuwe09d"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """SELECT [t3].[value]
+FROM (
+    SELECT [t0].[ProductName]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[ProductName]
+    ) AS [t1]
+OUTER APPLY (
+    SELECT AVG([t2].[UnitPrice]) AS [value]
+    FROM [dbo].[Products] AS [t2]
+    WHERE [t1].[ProductName] = [t2].[ProductName]
+    ) AS [t3]""" 
+
+
+    let countOfAllUnitsInStockForAllProducts = 
+        checkLinqSqlTextForValue "vwe4yuwe09f"
+            (fun () -> query { for p in db.Products do sumBy  (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let sumByUsingValue = 
+        // .Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..
+        checkLinqSqlTextForValue "vwe4yuwe09g"
+            (fun () -> query { for p in db.Employees do sumBy p.ReportsTo.Value })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+    let sumByNullableExample = 
+        checkLinqSqlTextForValue "vwe4yuwe09h"
+            (fun () -> query { for p in db.Employees do sumByNullable p.ReportsTo })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+
+
+    let namesAndIdsOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09j"
+            (query { for p in db.Products do groupBy p.Category.CategoryName into group; for p in group do select (group.Key, p.ProductName) })
+            """SELECT [t2].[CategoryName] AS [Item1], [t3].[ProductName] AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]
+CROSS JOIN ([dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID])
+WHERE [t2].[CategoryName] = [t4].[CategoryName]""" 
+
+    let productsGroupedByNameAndCountedTest1 =
+        checkLinqSqlText "vwe4yuwe09k"
+            (query { for p in db.Products do
+                     groupBy p.Category.CategoryName into group
+                     let sum = 
+                       query { for p in group do
+                                sumBy (int p.UnitsInStock.Value) }
+                     select (group.Key, sum) })
+            """SELECT [t2].[CategoryName] AS [Item1], (
+    SELECT SUM(CONVERT(Int,[t3].[UnitsInStock]))
+    FROM [dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID]
+    WHERE [t2].[CategoryName] = [t4].[CategoryName]
+    ) AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]""" 
+
+    let sumOfUnitsInStock = 
+        checkLinqSqlTextForValue "vwe4yuwe09l"
+            (fun () -> query { for p in db.Products do sumBy (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let namesAndIdsOfProductsGroupdByID = 
+        checkLinqSqlText "vwe4yuwe09z"
+            (query { for p in db.Products do
+                     groupBy p.CategoryID into group
+                     for p in group do
+                     select (group.Key, p.ProductName, p.ProductID) })
+            """SELECT [t1].[CategoryID] AS [Item1], [t2].[ProductName] AS [Item2], [t2].[ProductID] AS [Item3]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+CROSS JOIN [dbo].[Products] AS [t2]
+WHERE (([t1].[CategoryID] IS NULL) AND ([t2].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t2].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t2].[CategoryID]))""" 
+
+(*
+    let minUnitPriceOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09x"
+            (query { for p in db.Products do
+                     groupBy p.Category into group
+                     let minOfGroup = 
+                          query { for p in group do 
+                                    minByNullable p.UnitPrice }
+                     select (group.Key.CategoryName, minOfGroup) })
+            """SELECT [t2].[CategoryName] AS [Item1], (
+    SELECT MIN([t3].[UnitPrice])
+    FROM [dbo].[Products] AS [t3]
+    WHERE (([t1].[CategoryID] IS NULL) AND ([t3].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t3].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t3].[CategoryID]))
+    ) AS [Item2]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+LEFT OUTER JOIN [dbo].[Categories] AS [t2] ON [t2].[CategoryID] = [t1].[CategoryID]""" 
+*)
+    let db2 = (db.DataContext :?> NorthwndDb.ServiceTypes.EntityContainer)
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetForDb = 
+        checkLinqSqlText "vwe4yuwe09c"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+    let crossJoinOfCustomersAndEmployeesWithParam (db2: NorthwndDb.ServiceTypes.EntityContainer) = 
+        checkLinqSqlText "vwe4yuwe09v"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParam db2
+
+    let crossJoinOfCustomersAndEmployeesWithParamUnerased (db: NorthwndDb.ServiceTypes.SimpleDataContextTypes.EntityContainer) = 
+        checkLinqSqlText "vwe4yuwe09b"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParamUnerased db
+
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetOfErasedTypeWithCoercionForDb = 
+        checkLinqSqlText "vwe4yuwe09n"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+
+    let innerJoinQuery = 
+        checkLinqSqlText "vwe4yuwe09m"
+            (query { for c in db.Categories do
+                     join p in db.Products on (c.CategoryID =? p.CategoryID) 
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+INNER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let joinCustomersAndEmployeesByNameUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0911"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     where (c.Country = e.Country)
+                     select (c.ContactName + " " + e.LastName) })
+            """SELECT ([t0].[ContactName] + @p0) + [t1].[LastName] AS [value]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]
+WHERE [t0].[Country] = [t1].[Country]"""  
+
+    let innerJoinQueryUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0922"
+            (query { for c in db.Categories do
+                     for p in db.Products do
+                     where (c.CategoryID =? p.CategoryID)
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let innerGroupJoinQuery =
+        checkLinqSqlText "vwe4yuwe0933"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     select (c.CategoryName, prodGroup) })
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued], (
+    SELECT COUNT(*)
+    FROM [dbo].[Products] AS [t2]
+    WHERE ([t0].[CategoryID]) = [t2].[CategoryID]
+    ) AS [value]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]
+ORDER BY [t0].[CategoryID], [t1].[ProductID]""" 
+
+
+    let innerGroupJoinQueryWithAggregation =
+        checkLinqSqlText "vwe4yuwe0955"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let groupMax = query { for p in prodGroup do maxByNullable p.UnitsOnOrder }
+                     select (c.CategoryName, groupMax) })
+            """SELECT [t0].[CategoryName] AS [Item1], (
+    SELECT MAX([t1].[UnitsOnOrder])
+    FROM [dbo].[Products] AS [t1]
+    WHERE ([t0].[CategoryID]) = [t1].[CategoryID]
+    ) AS [Item2]
+FROM [dbo].[Categories] AS [t0]""" 
+
+    let innerGroupJoinQueryWithFollowingLoop =
+        checkLinqSqlText "vwe4yuwe0966"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     for prod2 in prodGroup do 
+                     where (prod2.UnitPrice ?> 2.50M)
+                     select (c.CategoryName, prod2) }    )
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t1].[UnitPrice] > @p0) AND (([t0].[CategoryID]) = [t1].[CategoryID])""" 
+
+    let leftOuterJoinQuery =
+        checkLinqSqlText "vwe4yuwe0977"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let prodGroup = System.Linq.Enumerable.DefaultIfEmpty prodGroup
+                     for item in prodGroup do
+                        select (c.CategoryName, (match item with null -> "" | _ -> item.ProductName)) })
+            """SELECT [t0].[CategoryName] AS [Item1], 
+    (CASE 
+        WHEN [t2].[test] IS NULL THEN CONVERT(NVarChar(40), at p0)
+        ELSE [t2].[ProductName]
+     END) AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN (
+    SELECT 1 AS [test], [t1].[ProductName], [t1].[CategoryID]
+    FROM [dbo].[Products] AS [t1]
+    ) AS [t2] ON ([t0].[CategoryID]) = [t2].[CategoryID]""" 
+
+    let checkForLongCustomerNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe0988"
+            (fun () -> query { for c in db.Customers do 
+                               exists (c.Address.Length > 10) })
+            """SELECT 
+    (CASE 
+        WHEN EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t0]
+            WHERE LEN([t0].[Address]) > @p0
+            ) THEN 1
+        ELSE 0
+     END) AS [value]""" 
+
+    let checkCustomerNameLengthsAreNotAllShort = 
+        checkLinqSqlTextForValue "vwe4yuwe0999"
+            (fun () -> query { for c in db.Customers do all (c.Address.Length < 10) })
+            """SELECT 
+    (CASE 
+        WHEN NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 1
+        WHEN NOT NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 0
+        ELSE NULL
+     END) AS [value]""" 
+
+
+
+    let queryWithOrderByInStrangePosition = 
+        checkLinqSqlText "vwe4yuwe09qq"
+            (query { for c in db.Customers do
+                     sortBy c.City
+                     where (c.Country = "UK")
+                     select c.CompanyName })
+            """SELECT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Country] = @p0
+ORDER BY [t0].[City]""" 
+
+    let queryWithNestedQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ww"
+            (query { for c in db.Customers do
+                     let orders = query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+(*
+    let queryWithExplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ee"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithImplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09rr"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+*)
+
+    let queryWithNestedQueryInFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09tt"
+            (query { for c in db.Customers do
+                     select (c.ContactName, query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    // The following example demonstrates how to use a composite key to join data from three tables:
+    let compositeKeyQuery = 
+        checkLinqSqlText "vwe4yuwe09yy"
+            (query { for o in db.Orders do
+                     for p in db.Products do
+                     groupJoin d in db.Order_Details on ( (o.OrderID, p.ProductID) = (d.OrderID, d.ProductID)) into details
+                     for d in details do
+                     select (o.OrderID, p.ProductID, d.UnitPrice) })
+            """SELECT [t0].[OrderID] AS [Item1], [t1].[ProductID] AS [Item2], [t2].[UnitPrice] AS [Item3]
+FROM [dbo].[Orders] AS [t0], [dbo].[Products] AS [t1], [dbo].[Order Details] AS [t2]
+WHERE ([t0].[OrderID] = [t2].[OrderID]) AND ([t1].[ProductID] = [t2].[ProductID])""" 
+
+    let firstCustomerWithNamesStartingWithB = 
+        checkLinqSqlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Customers do where (c.ContactName.StartsWith "B"); headOrDefault })
+            """SELECT TOP (1) [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[ContactName] LIKE @p0""" 
+
+    let distinctCompanyNames = 
+        checkLinqSqlText "vwe4yuwe09"
+            (query { for c in db.Customers do 
+                     select c.CompanyName
+                     distinct } )
+            """SELECT DISTINCT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]""" 
+
+
+#if COMPILED
+    [<System.STAThread>]
+    do()
+#endif
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test.fsx b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test.fsx
new file mode 100644
index 0000000..3767a4d
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToEntities/test.fsx
@@ -0,0 +1,664 @@
+// #Quotations
+#nowarn "57"
+#r "System.Data.Entity.dll"
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Data.TypeProviders
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+type NorthwndDb = 
+#if USESQLEXPRESS
+    SqlEntityConnection<ConnectionString = @"  Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true>
+#else
+#endif
+(*
+module DuplicateTypes = 
+    type NorthwndDb = 
+        SqlEntityConnection<ConnectionString = @" Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true,ForceUpdate=false,LocalSchemaFile="schema2.ssdl">
+
+
+type NorthwndDb2 = 
+    SqlEntityConnection<ConnectionString = @" Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI;AttachDBFileName = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf'",Pluralize=true,ForceUpdate=false,LocalSchemaFile="schema3.ssdl">
+*)
+
+ 
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+module Queryable = 
+
+    let db = NorthwndDb.GetDataContext()
+
+    let checkLinqQueryText s (q1: System.Linq.IQueryable<'T>) text =
+        check s (try q1.Expression.ToString() with e -> "Unexpected error: " + e.ToString()) text
+
+    let checkLinqSqlText s (q1: System.Linq.IQueryable<'T>) (text:string) =
+        //db.DataContext.Log <- new System.IO.StringWriter()
+        q1 |> Seq.length |> ignore
+        printfn "Test '%s' passed" s
+       // For now we don't actually test the query text, since I don't know how to log the SQL used by EF
+        //check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+    let checkLinqSqlTextForValue s (q1: unit -> 'T) (text:string) =
+        //db.DataContext.Log <- new System.IO.StringWriter()
+        q1() |> ignore
+        printfn "Test '%s' passed" s
+       // For now we don't actually test the query text, since I don't know how to log the SQL used by EF
+        //check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+
+    let customers = 
+        checkLinqSqlText "vwe4yuwe091"
+            (query { for c in db.Customers do select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]"""
+
+    let customerWithNamesStartingWithB = 
+        checkLinqSqlText "vwe4yuwe092"
+            (query { for c in db.Customers do where (c.CompanyName.StartsWith "A"); select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[CompanyName] LIKE @p0"""
+
+
+    let customerNames = 
+        checkLinqSqlText "vwe4yuwe093"
+            (query { for c in db.Customers do select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+    let customersAverageOrders = 
+        checkLinqSqlTextForValue "vwe4yuwe094"
+            (fun () -> query { for c in db.Customers do averageBy (float c.Orders.Count) })
+            """SELECT AVG([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]"""
+
+    let customersSorted = 
+        checkLinqSqlText "vwe4yuwe095"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]"""
+
+
+    let joinCustomersAndEmployeesByName = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do join e in db.Employees on (c.Country = e.Country); select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+    let joinCustomersAndEmployeesByNameWithLet = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do let country = c.Country in join e in db.Employees on (country = e.Country); select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+
+    let customersSortedDescending = 
+        checkLinqSqlText "vwe4yuwe097"
+            (query { for c in db.Customers do sortByDescending c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC""" 
+
+    let customersSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe098"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customersSortedTwoColumnsAscendingDescending = 
+        checkLinqSqlText "vwe4yuwe099"
+            (query { for c in db.Customers do sortBy c.Country; thenByDescending c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region] DESC""" 
+
+
+    let sumOfAllOrdersForCustomers = 
+        checkLinqSqlTextForValue "vwe4yuwe09q"
+            (fun () -> query { for c in db.Customers do sumBy (float c.Orders.Count) })
+            """SELECT SUM([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]""" 
+
+    let customersSortedTwoColumnsDescendingAscending = 
+        checkLinqSqlText "vwe4yuwe09w"
+            (query { for c in db.Customers do sortByDescending c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC, [t0].[Region]""" 
+
+    let customerSpecificsSorted = 
+        checkLinqSqlText "vwe4yuwe09e"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]""" 
+
+    let customerSpecificsSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe09r"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customerLongestNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe09t"
+            (fun () -> query { for c in db.Customers do maxBy c.ContactName.Length })
+            """SELECT MAX(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]"""  
+
+
+    let sumOfLengthsOfCustomerNames = 
+        checkLinqSqlTextForValue "vwe4yuwe09y7"
+            (fun () -> query { for c in db.Customers do sumBy c.ContactName.Length })
+            """SELECT SUM(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let customersAtSpecificAddress = 
+        checkLinqSqlText "vwe4yuwe09u"
+            (query { for c in db.Customers do where (c.Address.Contains("Jardim das rosas")); select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    let customersAtSpecificAddressUsingIf = 
+        checkLinqSqlText "vwe4yuwe09i"
+            (query { for c in db.Customers do if (c.Address.Contains("Jardim das rosas")) then select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    checkLinqSqlText "vwe4yuwe09p"
+        (query { for p in db.Products do groupBy p.ProductName into g; select g.Key })
+        """SELECT [t0].[ProductName]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqSqlText "vwe4yuwe09a"
+        (query { for p in db.Products do groupBy p.ProductName into g; select (g.Count()) })
+        """SELECT COUNT(*) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqQueryText "vwe4yuwe09s"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """Convert(value(System.Data.Objects.ObjectSet`1[SqlEntityConnection1.Product])).MergeAs(AppendOnly).GroupBy(p => p.ProductName, p => p.UnitPrice).Select(g => g.Average(x => x))"""
+
+    checkLinqSqlText "vwe4yuwe09d"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """SELECT AVG([t0].[UnitPrice]) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]
+SELECT [t3].[value]
+FROM (
+    SELECT [t0].[ProductName]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[ProductName]
+    ) AS [t1]
+OUTER APPLY (
+    SELECT AVG([t2].[UnitPrice]) AS [value]
+    FROM [dbo].[Products] AS [t2]
+    WHERE [t1].[ProductName] = [t2].[ProductName]
+    ) AS [t3]""" 
+
+
+    let countOfAllUnitsInStockForAllProducts = 
+        checkLinqSqlTextForValue "vwe4yuwe09f"
+            (fun () -> query { for p in db.Products do sumBy  (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let sumByUsingValue = 
+        // .Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..
+        checkLinqSqlTextForValue "vwe4yuwe09g"
+            (fun () -> query { for p in db.Employees do sumBy p.ReportsTo.Value })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+    let sumByNullableExample = 
+        checkLinqSqlTextForValue "vwe4yuwe09h"
+            (fun () -> query { for p in db.Employees do sumByNullable p.ReportsTo })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+
+
+    let namesAndIdsOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09j"
+            (query { for p in db.Products do groupBy p.Category.CategoryName into group; for p in group do select (group.Key, p.ProductName) })
+            """SELECT [t2].[CategoryName] AS [Item1], [t3].[ProductName] AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]
+CROSS JOIN ([dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID])
+WHERE [t2].[CategoryName] = [t4].[CategoryName]""" 
+
+    let productsGroupedByNameAndCountedTest1 =
+        checkLinqSqlText "vwe4yuwe09k"
+            (query { for p in db.Products do
+                     groupBy p.Category.CategoryName into group
+                     let sum = 
+                       query { for p in group do
+                                sumBy (int p.UnitsInStock.Value) }
+                     select (group.Key, sum) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [Item2], [t1].[CategoryName] AS [Item1]
+FROM [dbo].[Products] AS [t0]
+LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+GROUP BY [t1].[CategoryName]""" 
+
+    let sumOfUnitsInStock = 
+        checkLinqSqlTextForValue "vwe4yuwe09l"
+            (fun () -> query { for p in db.Products do sumBy (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let namesAndIdsOfProductsGroupdByID = 
+        checkLinqSqlText "vwe4yuwe09z"
+            (query { for p in db.Products do
+                     groupBy p.CategoryID into group
+                     for p in group do
+                     select (group.Key, p.ProductName, p.ProductID) })
+            """SELECT [t1].[CategoryID] AS [Item1], [t2].[ProductName] AS [Item2], [t2].[ProductID] AS [Item3]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+CROSS JOIN [dbo].[Products] AS [t2]
+WHERE (([t1].[CategoryID] IS NULL) AND ([t2].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t2].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t2].[CategoryID]))""" 
+
+(*
+    let minUnitPriceOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09x"
+            (query { for p in db.Products do
+                     groupBy p.Category into group
+                     let minOfGroup = 
+                          query { for p in group do 
+                                    minByNullable p.UnitPrice }
+                     select (group.Key.CategoryName, minOfGroup) })
+            """SELECT [t2].[CategoryName] AS [Item1], (
+    SELECT MIN([t3].[UnitPrice])
+    FROM [dbo].[Products] AS [t3]
+    WHERE (([t1].[CategoryID] IS NULL) AND ([t3].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t3].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t3].[CategoryID]))
+    ) AS [Item2]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+LEFT OUTER JOIN [dbo].[Categories] AS [t2] ON [t2].[CategoryID] = [t1].[CategoryID]""" 
+*)
+    let db2 = (db.DataContext :?> NorthwndDb.ServiceTypes.EntityContainer)
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetForDb = 
+        checkLinqSqlText "vwe4yuwe09c"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+    let crossJoinOfCustomersAndEmployeesWithParam (db2: NorthwndDb.ServiceTypes.EntityContainer) = 
+        checkLinqSqlText "vwe4yuwe09v"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParam db2
+
+    let crossJoinOfCustomersAndEmployeesWithParamUnerased (db: NorthwndDb.ServiceTypes.SimpleDataContextTypes.EntityContainer) = 
+        checkLinqSqlText "vwe4yuwe09b"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParamUnerased db
+
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetOfErasedTypeWithCoercionForDb = 
+        checkLinqSqlText "vwe4yuwe09n"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+
+    let innerJoinQuery = 
+        checkLinqSqlText "vwe4yuwe09m"
+            (query { for c in db.Categories do
+                     join p in db.Products on  (c.CategoryID =? p.CategoryID) 
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+INNER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let joinCustomersAndEmployeesByNameUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0911"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     where (c.Country = e.Country)
+                     select (c.ContactName + " " + e.LastName) })
+            """SELECT ([t0].[ContactName] + @p0) + [t1].[LastName] AS [value]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]
+WHERE [t0].[Country] = [t1].[Country]"""  
+
+    let innerJoinQueryUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0922"
+            (query { for c in db.Categories do
+                     for p in db.Products do
+                     where (c.CategoryID =? p.CategoryID)
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let innerGroupJoinQuery =
+        checkLinqSqlText "vwe4yuwe0933"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     select (c.CategoryName, prodGroup) })
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued], (
+    SELECT COUNT(*)
+    FROM [dbo].[Products] AS [t2]
+    WHERE ([t0].[CategoryID]) = [t2].[CategoryID]
+    ) AS [value]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]
+ORDER BY [t0].[CategoryID], [t1].[ProductID]""" 
+
+
+    let innerGroupJoinQueryWithAggregation =
+        checkLinqSqlText "vwe4yuwe0955"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let groupMax = query { for p in prodGroup do maxByNullable p.UnitsOnOrder }
+                     select (c.CategoryName, groupMax) })
+            """SELECT [t0].[CategoryName] AS [Item1], (
+    SELECT MAX([t1].[UnitsOnOrder])
+    FROM [dbo].[Products] AS [t1]
+    WHERE ([t0].[CategoryID]) = [t1].[CategoryID]
+    ) AS [Item2]
+FROM [dbo].[Categories] AS [t0]""" 
+
+    let innerGroupJoinQueryWithFollowingLoop =
+        checkLinqSqlText "vwe4yuwe0966"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     for prod2 in prodGroup do 
+                     where (prod2.UnitPrice ?> 2.50M)
+                     select (c.CategoryName, prod2) }    )
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t1].[UnitPrice] > @p0) AND (([t0].[CategoryID]) = [t1].[CategoryID])""" 
+
+    let leftOuterJoinQuery =
+        checkLinqSqlText "vwe4yuwe0977"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let prodGroup = System.Linq.Enumerable.DefaultIfEmpty prodGroup
+                     for item in prodGroup do
+                        select (c.CategoryName, (match item with null -> "" | _ -> item.ProductName)) })
+            """SELECT [t0].[CategoryName] AS [Item1], 
+    (CASE 
+        WHEN [t2].[test] IS NULL THEN CONVERT(NVarChar(40), at p0)
+        ELSE [t2].[ProductName]
+     END) AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN (
+    SELECT 1 AS [test], [t1].[ProductName], [t1].[CategoryID]
+    FROM [dbo].[Products] AS [t1]
+    ) AS [t2] ON ([t0].[CategoryID]) = [t2].[CategoryID]""" 
+
+    let checkForLongCustomerNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe0988"
+            (fun () -> query { for c in db.Customers do 
+                               exists (c.Address.Length > 10) })
+            """SELECT 
+    (CASE 
+        WHEN EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t0]
+            WHERE LEN([t0].[Address]) > @p0
+            ) THEN 1
+        ELSE 0
+     END) AS [value]""" 
+
+    let checkCustomerNameLengthsAreNotAllShort = 
+        checkLinqSqlTextForValue "vwe4yuwe0999"
+            (fun () -> query { for c in db.Customers do all (c.Address.Length < 10) })
+            """SELECT 
+    (CASE 
+        WHEN NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 1
+        WHEN NOT NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 0
+        ELSE NULL
+     END) AS [value]""" 
+
+
+
+    let queryWithOrderByInStrangePosition = 
+        checkLinqSqlText "vwe4yuwe09qq"
+            (query { for c in db.Customers do
+                     sortBy c.City
+                     where (c.Country = "UK")
+                     select c.CompanyName })
+            """SELECT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Country] = @p0
+ORDER BY [t0].[City]""" 
+
+    let queryWithNestedQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ww"
+            (query { for c in db.Customers do
+                     let orders = query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+(*
+    let queryWithExplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ee"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithImplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09rr"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+*)
+    let queryWithNestedQueryInFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09tt"
+            (query { for c in db.Customers do
+                     select (c.ContactName, query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    // The following example demonstrates how to use a composite key to join data from three tables:
+    let compositeKeyQuery = 
+        checkLinqSqlText "vwe4yuwe09yy"
+            (query { for o in db.Orders do
+                     for p in db.Products do
+                     groupJoin d in db.Order_Details on ( (o.OrderID, p.ProductID) = (d.OrderID, d.ProductID)) into details
+                     for d in details do
+                     select (o.OrderID, p.ProductID, d.UnitPrice) })
+            """SELECT [t0].[OrderID] AS [Item1], [t1].[ProductID] AS [Item2], [t2].[UnitPrice] AS [Item3]
+FROM [dbo].[Orders] AS [t0], [dbo].[Products] AS [t1], [dbo].[Order Details] AS [t2]
+WHERE ([t0].[OrderID] = [t2].[OrderID]) AND ([t1].[ProductID] = [t2].[ProductID])""" 
+
+    let firstCustomerWithNamesStartingWithB = 
+        checkLinqSqlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Customers do where (c.ContactName.StartsWith "B"); headOrDefault })
+            """SELECT TOP (1) [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[ContactName] LIKE @p0""" 
+
+    let distinctCompanyNames = 
+        checkLinqSqlText "vwe4yuwe09"
+            (query { for c in db.Customers do 
+                     select c.CompanyName
+                     distinct } )
+            """SELECT DISTINCT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let testIDisposable() = 
+       use db = NorthwndDb.GetDataContext()
+       query { for c in db.Customers do where (c.CompanyName.StartsWith "A"); select c.ContactName } |> Seq.length |> ignore
+
+
+    testIDisposable()
+
+
+    module UsingYield = 
+        let customers1 = 
+            checkLinqSqlText "vwe4yuwe091a"
+                (query { for c in db.Customers do 
+                         yield (c.CompanyName, query { for o in c.Orders do  yield (o.CustomerID, o.EmployeeID) }) })
+                "Not yet testing SQL text for LINQ to Entities"
+
+        let customers2 = 
+            checkLinqSqlText "vwe4yuwe091b"
+                (query { for c in db.Customers do 
+                         yield (c.CompanyName, query { for o in c.Orders do  maxByNullable o.Freight }) })
+                "Not yet testing SQL text for LINQ to Entities"
+
+
+        let customers3 = 
+            checkLinqSqlText "vwe4yuwe091c"
+                (query { for c in db.Customers do 
+                         let q = query { for o in c.Orders do  yield (o.CustomerID, o.EmployeeID) }
+                         yield (c.CompanyName, q) })
+                "Not yet testing SQL text for LINQ to Entities"
+
+
+
+    module UsingSelect = 
+        let customers1 = 
+            checkLinqSqlText "vwe4yuwe091e"
+                (query { for c in db.Customers do 
+                         select (c.CompanyName, query { for o in c.Orders do  select (o.CustomerID, o.EmployeeID) }) })
+                "Not yet testing SQL text for LINQ to Entities"
+
+        let customers2 = 
+            checkLinqSqlText "vwe4yuwe091f"
+                (query { for c in db.Customers do 
+                         select (c.CompanyName, query { for o in c.Orders do  maxByNullable o.Freight }) })
+                "Not yet testing SQL text for LINQ to Entities"
+
+#if COMPILED
+    [<System.STAThread>]
+    do()
+#endif
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToSql/build.bat b/tests/fsharp/core/queriesOverIQueryableLinqToSql/build.bat
new file mode 100644
index 0000000..a9843c4
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToSql/build.bat
@@ -0,0 +1,71 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+REM
+REM These files are there now, but they have stuff that are on tin the product yet.
+REM I need to review them after the [<Generate>] and new query syntax for joins is in.
+REM
+REM    "%FSC%" %fsc_flags% -a -o:testlib.dll -r:System.Data.Linq.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs
+REM    @if ERRORLEVEL 1 goto Error
+REM
+REM    "%PEVERIFY%" testlib.dll
+REM    @if ERRORLEVEL 1 goto Error
+REM
+REM    "%FSC%" %fsc_flags% -r:testlib.dll -o:testapp.exe -r:System.Data.Linq.dll -g test-part2.fs 
+REM    @if ERRORLEVEL 1 goto Error
+REM
+REM    "%PEVERIFY%" testapp.exe 
+REM    @if ERRORLEVEL 1 goto Error
+REM
+REM
+REM    "%FSC%" %fsc_flags% -o:testtwoparts.exe -r:System.Data.Linq.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs test-part2.fs 
+REM    @if ERRORLEVEL 1 goto Error
+REM
+REM    "%PEVERIFY%" testtwoparts.exe 
+REM    @if ERRORLEVEL 1 goto Error
+REM
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToSql/run.bat b/tests/fsharp/core/queriesOverIQueryableLinqToSql/run.bat
new file mode 100644
index 0000000..a5dcb60
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToSql/run.bat
@@ -0,0 +1,67 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+REM == NEED TO FIX THESE TESTS ONCE DON CHECKS in the work around:
+REM == - [<Generate>] and new join syntax.
+REM ==
+REM ==    if exist test.ok (del /f /q test.ok)
+REM ==    %CLIX% testapp.exe
+REM ==    @if ERRORLEVEL 1 goto Error
+REM ==    if NOT EXIST test.ok goto SetError
+REM ==
+REM ==    if exist test.ok (del /f /q test.ok)
+REM ==    %CLIX% testtwoparts.exe
+REM ==    @if ERRORLEVEL 1 goto Error
+REM ==    if NOT EXIST test.ok goto SetError
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part1.fs b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part1.fs
new file mode 100644
index 0000000..03883ee
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part1.fs
@@ -0,0 +1,59 @@
+// #Quotations
+
+module TestPart1
+
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Data.TypeProviders
+
+
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+ 
+type NorthwndDb = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema1.dbml">
+
+module Test = begin end
+
+module DuplicateTypes = 
+     
+    type NorthwndDb = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'c:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema2.dbml">
+
+
+ 
+type NorthwndDb2 = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'c:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema3.dbml">
+ 
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part2.fs b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part2.fs
new file mode 100644
index 0000000..e3d2e75
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test-part2.fs
@@ -0,0 +1,558 @@
+// #Quotations
+
+module TestPart2
+
+
+open TestPart1
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+module Queryable = 
+
+    let db = NorthwndDb.GetDataContext()
+
+
+    let checkLinqQueryText s (q1: System.Linq.IQueryable<'T>) text =
+        db.DataContext.Log <- System.Console.Out
+        check s (try q1.Expression.ToString().Replace(db.ToString(),"db").Replace("QueryExecutionOverIQueryable.db","db") with e -> "Unexpected error: " + e.ToString()) text
+
+    let checkLinqSqlText s (q1: System.Linq.IQueryable<'T>) (text:string) =
+        db.DataContext.Log <- new System.IO.StringWriter()
+        q1 |> Seq.length |> ignore
+        check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+    let checkLinqSqlTextForValue s (q1: unit -> 'T) (text:string) =
+        db.DataContext.Log <- new System.IO.StringWriter()
+        q1() |> ignore
+        check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+
+    let customers = 
+        checkLinqSqlText "vwe4yuwe091"
+            (query { for c in db.Customers do select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]"""
+
+    let customerWithNamesStartingWithB = 
+        checkLinqSqlText "vwe4yuwe092"
+            (query { for c in db.Customers do where (c.CompanyName.StartsWith "A"); select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[CompanyName] LIKE @p0"""
+
+
+    let customerNames = 
+        checkLinqSqlText "vwe4yuwe093"
+            (query { for c in db.Customers do select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+    let customersAverageOrders = 
+        checkLinqSqlTextForValue "vwe4yuwe094"
+            (fun () -> query { for c in db.Customers do averageBy (float c.Orders.Count) })
+            """SELECT AVG([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]"""
+
+    let customersSorted = 
+        checkLinqSqlText "vwe4yuwe095"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]"""
+
+
+    let joinCustomersAndEmployeesByName = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do join e in db.Employees on (c.Country = e.Country); select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+
+    let customersSortedDescending = 
+        checkLinqSqlText "vwe4yuwe097"
+            (query { for c in db.Customers do sortByDescending c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC""" 
+
+    let customersSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe098"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customersSortedTwoColumnsAscendingDescending = 
+        checkLinqSqlText "vwe4yuwe099"
+            (query { for c in db.Customers do sortBy c.Country; thenByDescending c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region] DESC""" 
+
+
+    let sumOfAllOrdersForCustomers = 
+        checkLinqSqlTextForValue "vwe4yuwe09q"
+            (fun () -> query { for c in db.Customers do sumBy (float c.Orders.Count) })
+            """SELECT SUM([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]""" 
+
+    let customersSortedTwoColumnsDescendingAscending = 
+        checkLinqSqlText "vwe4yuwe09w"
+            (query { for c in db.Customers do sortByDescending c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC, [t0].[Region]""" 
+
+    let customerSpecificsSorted = 
+        checkLinqSqlText "vwe4yuwe09e"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]""" 
+
+    let customerSpecificsSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe09r"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customerLongestNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe09t"
+            (fun () -> query { for c in db.Customers do maxBy c.ContactName.Length })
+            """SELECT MAX(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]"""  
+
+
+    let sumOfLengthsOfCustomerNames = 
+        checkLinqSqlTextForValue "vwe4yuwe09y7"
+            (fun () -> query { for c in db.Customers do sumBy c.ContactName.Length })
+            """SELECT SUM(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let customersAtSpecificAddress = 
+        checkLinqSqlText "vwe4yuwe09u"
+            (query { for c in db.Customers do where (c.Address.Contains("Jardim das rosas")); select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    let customersAtSpecificAddressUsingIf = 
+        checkLinqSqlText "vwe4yuwe09i"
+            (query { for c in db.Customers do if (c.Address.Contains("Jardim das rosas")) then select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    checkLinqSqlText "vwe4yuwe09p"
+        (query { for p in db.Products do groupBy p.ProductName into g; select g.Key })
+        """SELECT [t0].[ProductName]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqSqlText "vwe4yuwe09a"
+        (query { for p in db.Products do groupBy p.ProductName into g; select (g.Count()) })
+        """SELECT COUNT(*) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqQueryText "vwe4yuwe09s"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """Table(Product).Select(_arg => _arg).GroupBy(p => p.ProductName, p => p.UnitPrice).Select(_arg => _arg).Select(g => g.Select(_arg => _arg).Average(x => x))""" 
+
+    checkLinqSqlText "vwe4yuwe09d"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """SELECT [t3].[value]
+FROM (
+    SELECT [t0].[ProductName]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[ProductName]
+    ) AS [t1]
+OUTER APPLY (
+    SELECT AVG([t2].[UnitPrice]) AS [value]
+    FROM [dbo].[Products] AS [t2]
+    WHERE [t1].[ProductName] = [t2].[ProductName]
+    ) AS [t3]""" 
+
+
+    let countOfAllUnitsInStockForAllProducts = 
+        checkLinqSqlTextForValue "vwe4yuwe09f"
+            (fun () -> query { for p in db.Products do sumBy  (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let sumByUsingValue = 
+        // .Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..
+        checkLinqSqlTextForValue "vwe4yuwe09g"
+            (fun () -> query { for p in db.Employees do sumBy p.ReportsTo.Value })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+    let sumByNullableExample = 
+        checkLinqSqlTextForValue "vwe4yuwe09h"
+            (fun () -> query { for p in db.Employees do sumByNullable p.ReportsTo })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]
+.Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..""" 
+
+
+
+    let namesAndIdsOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09j"
+            (query { for p in db.Products do groupBy p.Category.CategoryName into group; for p in group do select (group.Key, p.ProductName) })
+            """SELECT [t2].[CategoryName] AS [Item1], [t3].[ProductName] AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]
+CROSS JOIN ([dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID])
+WHERE [t2].[CategoryName] = [t4].[CategoryName]""" 
+
+    let productsGroupedByNameAndCountedTest1 =
+        checkLinqSqlText "vwe4yuwe09k"
+            (query { for p in db.Products do
+                     groupBy p.Category.CategoryName into group
+                     let sum = 
+                       query { for p in group do
+                                sumBy (int p.UnitsInStock.Value) }
+                     select (group.Key, sum) })
+            """SELECT [t2].[CategoryName] AS [Item1], (
+    SELECT SUM(CONVERT(Int,[t3].[UnitsInStock]))
+    FROM [dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID]
+    WHERE [t2].[CategoryName] = [t4].[CategoryName]
+    ) AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]""" 
+
+    let sumOfUnitsInStock = 
+        checkLinqSqlTextForValue "vwe4yuwe09l"
+            (fun () -> query { for p in db.Products do sumBy (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let namesAndIdsOfProductsGroupdByID = 
+        checkLinqSqlText "vwe4yuwe09z"
+            (query { for p in db.Products do
+                     groupBy p.CategoryID into group
+                     for p in group do
+                     select (group.Key, p.ProductName, p.ProductID) })
+            """SELECT [t1].[CategoryID] AS [Item1], [t2].[ProductName] AS [Item2], [t2].[ProductID] AS [Item3]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+CROSS JOIN [dbo].[Products] AS [t2]
+WHERE (([t1].[CategoryID] IS NULL) AND ([t2].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t2].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t2].[CategoryID]))""" 
+
+    let minUnitPriceOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09x"
+            (query { for p in db.Products do
+                     groupBy p.Category into group
+                     let minOfGroup = 
+                          query { for p in group do 
+                                    minByNullable p.UnitPrice }
+                     select (group.Key.CategoryName, minOfGroup) })
+            """SELECT [t2].[CategoryName] AS [Item1], (
+    SELECT MIN([t3].[UnitPrice])
+    FROM [dbo].[Products] AS [t3]
+    WHERE (([t1].[CategoryID] IS NULL) AND ([t3].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t3].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t3].[CategoryID]))
+    ) AS [Item2]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+LEFT OUTER JOIN [dbo].[Categories] AS [t2] ON [t2].[CategoryID] = [t1].[CategoryID]""" 
+
+    let db2 = (db.DataContext :?> NorthwndDb.ServiceTypes.Northwnd)
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetForDb = 
+        checkLinqSqlText "vwe4yuwe09c"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+    let crossJoinOfCustomersAndEmployeesWithParam (db2: NorthwndDb.ServiceTypes.Northwnd) = 
+        checkLinqSqlText "vwe4yuwe09v"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParam db2
+
+    let crossJoinOfCustomersAndEmployeesWithParamUnerased (db: NorthwndDb.ServiceTypes.SimpleDataContextTypes.Northwnd) = 
+        checkLinqSqlText "vwe4yuwe09b"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParamUnerased db
+
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetOfErasedTypeWithCoercionForDb = 
+        checkLinqSqlText "vwe4yuwe09n"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+
+    let innerJoinQuery = 
+        checkLinqSqlText "vwe4yuwe09m"
+            (query { for c in db.Categories do
+                     join p in db.Products on (c.CategoryID =? p.CategoryID) 
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+INNER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let joinCustomersAndEmployeesByNameUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0911"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     where (c.Country = e.Country)
+                     select (c.ContactName + " " + e.LastName) })
+            """SELECT ([t0].[ContactName] + @p0) + [t1].[LastName] AS [value]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]
+WHERE [t0].[Country] = [t1].[Country]"""  
+
+    let innerJoinQueryUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0922"
+            (query { for c in db.Categories do
+                     for p in db.Products do
+                     where (c.CategoryID =? p.CategoryID)
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let innerGroupJoinQuery =
+        checkLinqSqlText "vwe4yuwe0933"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     select (c.CategoryName, prodGroup) })
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued], (
+    SELECT COUNT(*)
+    FROM [dbo].[Products] AS [t2]
+    WHERE ([t0].[CategoryID]) = [t2].[CategoryID]
+    ) AS [value]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]
+ORDER BY [t0].[CategoryID], [t1].[ProductID]""" 
+
+
+    let innerGroupJoinQueryWithAggregation =
+        checkLinqSqlText "vwe4yuwe0955"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let groupMax = query { for p in prodGroup do maxByNullable p.UnitsOnOrder }
+                     select (c.CategoryName, groupMax) })
+            """SELECT [t0].[CategoryName] AS [Item1], (
+    SELECT MAX([t1].[UnitsOnOrder])
+    FROM [dbo].[Products] AS [t1]
+    WHERE ([t0].[CategoryID]) = [t1].[CategoryID]
+    ) AS [Item2]
+FROM [dbo].[Categories] AS [t0]""" 
+
+    let innerGroupJoinQueryWithFollowingLoop =
+        checkLinqSqlText "vwe4yuwe0966"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     for prod2 in prodGroup do 
+                     where (prod2.UnitPrice ?> 2.50M)
+                     select (c.CategoryName, prod2) }    )
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t1].[UnitPrice] > @p0) AND (([t0].[CategoryID]) = [t1].[CategoryID])""" 
+
+    let leftOuterJoinQuery =
+        checkLinqSqlText "vwe4yuwe0977"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let prodGroup = System.Linq.Enumerable.DefaultIfEmpty prodGroup
+                     for item in prodGroup do
+                        select (c.CategoryName, (match item with null -> "" | _ -> item.ProductName)) })
+            """SELECT [t0].[CategoryName] AS [Item1], 
+    (CASE 
+        WHEN [t2].[test] IS NULL THEN CONVERT(NVarChar(40), at p0)
+        ELSE [t2].[ProductName]
+     END) AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN (
+    SELECT 1 AS [test], [t1].[ProductName], [t1].[CategoryID]
+    FROM [dbo].[Products] AS [t1]
+    ) AS [t2] ON ([t0].[CategoryID]) = [t2].[CategoryID]""" 
+
+    let checkForLongCustomerNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe0988"
+            (fun () -> query { for c in db.Customers do 
+                               exists (c.Address.Length > 10) })
+            """SELECT 
+    (CASE 
+        WHEN EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t0]
+            WHERE LEN([t0].[Address]) > @p0
+            ) THEN 1
+        ELSE 0
+     END) AS [value]""" 
+
+    let checkCustomerNameLengthsAreNotAllShort = 
+        checkLinqSqlTextForValue "vwe4yuwe0999"
+            (fun () -> query { for c in db.Customers do all (c.Address.Length < 10) })
+            """SELECT 
+    (CASE 
+        WHEN NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 1
+        WHEN NOT NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 0
+        ELSE NULL
+     END) AS [value]""" 
+
+
+
+    let queryWithOrderByInStrangePosition = 
+        checkLinqSqlText "vwe4yuwe09qq"
+            (query { for c in db.Customers do
+                     sortBy c.City
+                     where (c.Country = "UK")
+                     select c.CompanyName })
+            """SELECT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Country] = @p0
+ORDER BY [t0].[City]""" 
+
+    let queryWithNestedQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ww"
+            (query { for c in db.Customers do
+                     let orders = query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    let queryWithExplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ee"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithImplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09rr"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithNestedQueryInFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09tt"
+            (query { for c in db.Customers do
+                     select (c.ContactName, query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    // The following example demonstrates how to use a composite key to join data from three tables:
+    let compositeKeyQuery = 
+        checkLinqSqlText "vwe4yuwe09yy"
+            (query { for o in db.Orders do
+                     for p in db.Products do
+                     groupJoin d in db.OrderDetails on ( (o.OrderID, p.ProductID) = (d.OrderID, d.ProductID)) into details
+                     for d in details do
+                     select (o.OrderID, p.ProductID, d.UnitPrice) })
+            """SELECT [t0].[OrderID] AS [Item1], [t1].[ProductID] AS [Item2], [t2].[UnitPrice] AS [Item3]
+FROM [dbo].[Orders] AS [t0], [dbo].[Products] AS [t1], [dbo].[Order Details] AS [t2]
+WHERE ([t0].[OrderID] = [t2].[OrderID]) AND ([t1].[ProductID] = [t2].[ProductID])""" 
+
+    let firstCustomerWithNamesStartingWithB = 
+        checkLinqSqlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Customers do where (c.ContactName.StartsWith "B"); headOrDefault })
+            """SELECT TOP (1) [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[ContactName] LIKE @p0""" 
+
+    let distinctCompanyNames = 
+        checkLinqSqlText "vwe4yuwe09"
+            (query { for c in db.Customers do 
+                     select c.CompanyName
+                     distinct } )
+            """SELECT DISTINCT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]""" 
+
+
+#if COMPILED
+    [<System.STAThread>]
+    do()
+#endif
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/queriesOverIQueryableLinqToSql/test.fsx b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test.fsx
new file mode 100644
index 0000000..15304e5
--- /dev/null
+++ b/tests/fsharp/core/queriesOverIQueryableLinqToSql/test.fsx
@@ -0,0 +1,751 @@
+// #Quotations
+#nowarn "57"
+#r "System.Data.Linq.dll"
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Data.TypeProviders
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+#if USESQLEXPRESS
+type NorthwndDb = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'C:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema1.dbml">
+#else
+#endif
+
+module DuplicateTypes = 
+#if USESQLEXPRESS
+    type NorthwndDb = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'c:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema2.dbml">
+#else
+#endif
+
+#if USESQLEXPRESS
+type NorthwndDb2 = SqlDataConnection<ConnectionString = @"AttachDBFileName  = 'c:\fsharp\vspro\devdiv\extras\extenders\docs\tutorial\northwnd.mdf';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI",ForceUpdate=false,Pluralize=true,ContextTypeName = "Northwnd",LocalSchemaFile="schema3.dbml">
+#else
+#endif
+ 
+open System
+open System.Linq
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+module Queryable = 
+
+    let db = NorthwndDb.GetDataContext()
+
+
+    let checkLinqQueryText s (q1: System.Linq.IQueryable<'T>) text =
+        db.DataContext.Log <- System.Console.Out
+        check s (try q1.Expression.ToString().Replace(db.ToString(),"db").Replace("QueryExecutionOverIQueryable.db","db") with e -> "Unexpected error: " + e.ToString()) text
+
+    let checkLinqSqlText s (q1: System.Linq.IQueryable<'T>) (text:string) =
+        db.DataContext.Log <- new System.IO.StringWriter()
+        q1 |> Seq.length |> ignore
+        check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+    let checkLinqSqlTextForValue s (q1: unit -> 'T) (text:string) =
+        db.DataContext.Log <- new System.IO.StringWriter()
+        q1() |> ignore
+        check s (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s)) |> String.concat "\n") (text.Replace("\r",""))
+
+    let checkLinqSqlTextForValueWithNullValueWarning s (q1: unit -> 'T) (text:string) =
+        db.DataContext.Log <- new System.IO.StringWriter()
+        q1() |> ignore
+        // Note: SQL is ENU, so this is not localized
+        let warningmessage = "Null value is eliminated by an aggregate or other SET operation"
+        let hasWarning = db.DataContext.Log.ToString().Contains(warningmessage)
+        let cookedtext = (db.DataContext.Log.ToString().Split('\r','\n') |> Seq.filter (fun s -> not (s.StartsWith("--")) && not (String.IsNullOrWhiteSpace s) && not (s.Contains(warningmessage))) |> String.concat "\n")
+        // If the warning is missing => error
+        if hasWarning then check s cookedtext (text.Replace("\r","")) else test s false
+        
+
+
+    let customers = 
+        checkLinqSqlText "vwe4yuwe091"
+            (query { for c in db.Customers do select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]"""
+
+    let customerWithNamesStartingWithB = 
+        checkLinqSqlText "vwe4yuwe092"
+            (query { for c in db.Customers do where (c.CompanyName.StartsWith "A"); select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[CompanyName] LIKE @p0"""
+
+
+    let customerNames = 
+        checkLinqSqlText "vwe4yuwe093"
+            (query { for c in db.Customers do select c.ContactName })
+            """SELECT [t0].[ContactName]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+    let customersAverageOrders = 
+        checkLinqSqlTextForValue "vwe4yuwe094"
+            (fun () -> query { for c in db.Customers do averageBy (float c.Orders.Count) })
+            """SELECT AVG([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]"""
+
+    let customersSorted = 
+        checkLinqSqlText "vwe4yuwe095"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]"""
+
+
+    let joinCustomersAndEmployeesByName = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do join e in db.Employees on (c.Country = e.Country); select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+    let joinCustomersAndEmployeesByNameWithLet = 
+        checkLinqSqlText "vwe4yuwe096"
+            (query { for c in db.Customers do 
+                     let country = c.Country 
+                     join e in db.Employees on (country = e.Country); 
+                     select (c.ContactName, e.LastName) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+INNER JOIN [dbo].[Employees] AS [t1] ON [t0].[Country] = [t1].[Country]""" 
+
+
+
+    let customersSortedDescending = 
+        checkLinqSqlText "vwe4yuwe097"
+            (query { for c in db.Customers do sortByDescending c.Country; select (c.Country, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[CompanyName] AS [Item2]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC""" 
+
+    let customersSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe098"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customersSortedTwoColumnsAscendingDescending = 
+        checkLinqSqlText "vwe4yuwe099"
+            (query { for c in db.Customers do sortBy c.Country; thenByDescending c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region] DESC""" 
+
+
+    let sumOfAllOrdersForCustomers = 
+        checkLinqSqlTextForValue "vwe4yuwe09q"
+            (fun () -> query { for c in db.Customers do sumBy (float c.Orders.Count) })
+            """SELECT SUM([t2].[value]) AS [value]
+FROM (
+    SELECT CONVERT(Float,(
+        SELECT COUNT(*)
+        FROM [dbo].[Orders] AS [t1]
+        WHERE [t1].[CustomerID] = [t0].[CustomerID]
+        )) AS [value]
+    FROM [dbo].[Customers] AS [t0]
+    ) AS [t2]""" 
+
+    let customersSortedTwoColumnsDescendingAscending = 
+        checkLinqSqlText "vwe4yuwe09w"
+            (query { for c in db.Customers do sortByDescending c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country] DESC, [t0].[Region]""" 
+
+    let customerSpecificsSorted = 
+        checkLinqSqlText "vwe4yuwe09e"
+            (query { for c in db.Customers do sortBy c.Country; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country]""" 
+
+    let customerSpecificsSortedTwoColumns = 
+        checkLinqSqlText "vwe4yuwe09r"
+            (query { for c in db.Customers do sortBy c.Country; thenBy c.Region; select (c.Country, c.Region, c.CompanyName) })
+            """SELECT [t0].[Country] AS [Item1], [t0].[Region] AS [Item2], [t0].[CompanyName] AS [Item3]
+FROM [dbo].[Customers] AS [t0]
+ORDER BY [t0].[Country], [t0].[Region]""" 
+
+    let customerLongestNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe09t"
+            (fun () -> query { for c in db.Customers do maxBy c.ContactName.Length })
+            """SELECT MAX(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]"""  
+
+
+    let sumOfLengthsOfCustomerNames = 
+        checkLinqSqlTextForValue "vwe4yuwe09y7"
+            (fun () -> query { for c in db.Customers do sumBy c.ContactName.Length })
+            """SELECT SUM(LEN([t0].[ContactName])) AS [value]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let customersAtSpecificAddress = 
+        checkLinqSqlText "vwe4yuwe09u"
+            (query { for c in db.Customers do where (c.Address.Contains("Jardim das rosas")); select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    let customersAtSpecificAddressUsingIf = 
+        checkLinqSqlText "vwe4yuwe09i"
+            (query { for c in db.Customers do if (c.Address.Contains("Jardim das rosas")) then select c })
+            """SELECT [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Address] LIKE @p0""" 
+
+    checkLinqSqlText "vwe4yuwe09p"
+        (query { for p in db.Products do groupBy p.ProductName into g; select g.Key })
+        """SELECT [t0].[ProductName]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqSqlText "vwe4yuwe09a"
+        (query { for p in db.Products do groupBy p.ProductName into g; select (g.Count()) })
+        """SELECT COUNT(*) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+    checkLinqQueryText "vwe4yuwe09s"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """Table(Product).GroupBy(p => p.ProductName, p => p.UnitPrice).Select(g => g.Average(x => x))""" 
+
+    checkLinqSqlText "vwe4yuwe09d"
+        (query { for p in db.Products do groupValBy p.UnitPrice p.ProductName into g; select (query { for x in g do averageByNullable x }) })
+        """SELECT AVG([t0].[UnitPrice]) AS [value]
+FROM [dbo].[Products] AS [t0]
+GROUP BY [t0].[ProductName]""" 
+
+
+    let countOfAllUnitsInStockForAllProducts = 
+        checkLinqSqlTextForValue "vwe4yuwe09f"
+            (fun () -> query { for p in db.Products do sumBy  (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let sumByUsingValue = 
+        // Note: the SQL Data Provider will emit a warning like:
+        //   .Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..
+        // The warning is not really interesting to us - and it could be disabled on SQL with a SET ANSI_WARNINGS OFF
+        checkLinqSqlTextForValueWithNullValueWarning "vwe4yuwe09g"
+            (fun () -> query { for p in db.Employees do sumBy p.ReportsTo.Value })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]""" 
+
+    let sumByNullableExample = 
+        // Note: the SQL Data Provider will emit a warning like:
+        //   .Net SqlClient Data Provider: Warning: Null value is eliminated by an aggregate or other SET operation..
+        // The warning is not really interesting to us - and it could be disabled on SQL with a SET ANSI_WARNINGS OFF
+        checkLinqSqlTextForValueWithNullValueWarning "vwe4yuwe09h"
+            (fun () -> query { for p in db.Employees do sumByNullable p.ReportsTo })
+            """SELECT SUM([t0].[ReportsTo]) AS [value]
+FROM [dbo].[Employees] AS [t0]""" 
+
+    let namesAndIdsOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09j"
+            (query { for p in db.Products do groupBy p.Category.CategoryName into group; for p in group do select (group.Key, p.ProductName) })
+            """SELECT [t2].[CategoryName] AS [Item1], [t3].[ProductName] AS [Item2]
+FROM (
+    SELECT [t1].[CategoryName]
+    FROM [dbo].[Products] AS [t0]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+    GROUP BY [t1].[CategoryName]
+    ) AS [t2]
+CROSS JOIN ([dbo].[Products] AS [t3]
+    LEFT OUTER JOIN [dbo].[Categories] AS [t4] ON [t4].[CategoryID] = [t3].[CategoryID])
+WHERE [t2].[CategoryName] = [t4].[CategoryName]""" 
+
+    let productsGroupedByNameAndCountedTest1 =
+        checkLinqSqlText "vwe4yuwe09k"
+            (query { for p in db.Products do
+                     groupBy p.Category.CategoryName into group
+                     let sum = 
+                       query { for p in group do
+                                sumBy (int p.UnitsInStock.Value) }
+                     select (group.Key, sum) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [Item2], [t1].[CategoryName] AS [Item1]
+FROM [dbo].[Products] AS [t0]
+LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]
+GROUP BY [t1].[CategoryName]""" 
+
+    let sumOfUnitsInStock = 
+        checkLinqSqlTextForValue "vwe4yuwe09l"
+            (fun () -> query { for p in db.Products do sumBy (int p.UnitsInStock.Value) })
+            """SELECT SUM(CONVERT(Int,[t0].[UnitsInStock])) AS [value]
+FROM [dbo].[Products] AS [t0]""" 
+
+    let namesAndIdsOfProductsGroupdByID = 
+        checkLinqSqlText "vwe4yuwe09z"
+            (query { for p in db.Products do
+                     groupBy p.CategoryID into group
+                     for p in group do
+                     select (group.Key, p.ProductName, p.ProductID) })
+            """SELECT [t1].[CategoryID] AS [Item1], [t2].[ProductName] AS [Item2], [t2].[ProductID] AS [Item3]
+FROM (
+    SELECT [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+CROSS JOIN [dbo].[Products] AS [t2]
+WHERE (([t1].[CategoryID] IS NULL) AND ([t2].[CategoryID] IS NULL)) OR (([t1].[CategoryID] IS NOT NULL) AND ([t2].[CategoryID] IS NOT NULL) AND ([t1].[CategoryID] = [t2].[CategoryID]))""" 
+
+    let minUnitPriceOfProductsGroupedByName = 
+        checkLinqSqlText "vwe4yuwe09x"
+            (query { for p in db.Products do
+                     groupBy p.Category into group
+                     let minOfGroup = 
+                          query { for p in group do 
+                                    minByNullable p.UnitPrice }
+                     select (group.Key.CategoryName, minOfGroup) })
+            """SELECT [t2].[CategoryName] AS [Item1], [t1].[value] AS [Item2]
+FROM (
+    SELECT MIN([t0].[UnitPrice]) AS [value], [t0].[CategoryID]
+    FROM [dbo].[Products] AS [t0]
+    GROUP BY [t0].[CategoryID]
+    ) AS [t1]
+LEFT OUTER JOIN [dbo].[Categories] AS [t2] ON [t2].[CategoryID] = [t1].[CategoryID]""" 
+
+    let db2 = (db.DataContext :?> NorthwndDb.ServiceTypes.Northwnd)
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetForDb = 
+        checkLinqSqlText "vwe4yuwe09c"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+    let crossJoinOfCustomersAndEmployeesWithParam (db2: NorthwndDb.ServiceTypes.Northwnd) = 
+        checkLinqSqlText "vwe4yuwe09v"
+            (query { for c in db2.Customers do 
+                     for e in db2.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParam db2
+
+    let crossJoinOfCustomersAndEmployeesWithParamUnerased (db: NorthwndDb.ServiceTypes.SimpleDataContextTypes.Northwnd) = 
+        checkLinqSqlText "vwe4yuwe09b"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+    crossJoinOfCustomersAndEmployeesWithParamUnerased db
+
+    let crossJoinOfCustomersAndEmployeesUsingPropertyGetOfErasedTypeWithCoercionForDb = 
+        checkLinqSqlText "vwe4yuwe09n"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     select (c.CompanyName, e.LastName) })
+            """SELECT [t0].[CompanyName] AS [Item1], [t1].[LastName] AS [Item2]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]""" 
+
+
+
+    let innerJoinQuery = 
+        checkLinqSqlText "vwe4yuwe09m"
+            (query { for c in db.Categories do
+                     join p in db.Products on (c.CategoryID =? p.CategoryID) 
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+INNER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let joinCustomersAndEmployeesByNameUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0911"
+            (query { for c in db.Customers do 
+                     for e in db.Employees do 
+                     where (c.Country = e.Country)
+                     select (c.ContactName + " " + e.LastName) })
+            """SELECT ([t0].[ContactName] + @p0) + [t1].[LastName] AS [value]
+FROM [dbo].[Customers] AS [t0], [dbo].[Employees] AS [t1]
+WHERE [t0].[Country] = [t1].[Country]"""  
+
+    let innerJoinQueryUsingLoopAndConstraint = 
+        checkLinqSqlText "vwe4yuwe0922"
+            (query { for c in db.Categories do
+                     for p in db.Products do
+                     where (c.CategoryID =? p.CategoryID)
+                     select (p.ProductName, c.CategoryName) })
+            """SELECT [t1].[ProductName] AS [Item1], [t0].[CategoryName] AS [Item2]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t0].[CategoryID]) = [t1].[CategoryID]""" 
+
+    let innerGroupJoinQuery =
+        checkLinqSqlText "vwe4yuwe0933"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     select (c.CategoryName, prodGroup) })
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued], (
+    SELECT COUNT(*)
+    FROM [dbo].[Products] AS [t2]
+    WHERE ([t0].[CategoryID]) = [t2].[CategoryID]
+    ) AS [value]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN [dbo].[Products] AS [t1] ON ([t0].[CategoryID]) = [t1].[CategoryID]
+ORDER BY [t0].[CategoryID], [t1].[ProductID]""" 
+
+
+    let innerGroupJoinQueryWithAggregation =
+        checkLinqSqlText "vwe4yuwe0955"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let groupMax = query { for p in prodGroup do maxByNullable p.UnitsOnOrder }
+                     select (c.CategoryName, groupMax) })
+            """SELECT [t0].[CategoryName] AS [Item1], (
+    SELECT MAX([t1].[UnitsOnOrder])
+    FROM [dbo].[Products] AS [t1]
+    WHERE ([t0].[CategoryID]) = [t1].[CategoryID]
+    ) AS [Item2]
+FROM [dbo].[Categories] AS [t0]""" 
+
+    let innerGroupJoinQueryWithFollowingLoop =
+        checkLinqSqlText "vwe4yuwe0966"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     for prod2 in prodGroup do 
+                     where (prod2.UnitPrice ?> 2.50M)
+                     select (c.CategoryName, prod2) }    )
+            """SELECT [t0].[CategoryName] AS [Item1], [t1].[ProductID], [t1].[ProductName], [t1].[SupplierID], [t1].[CategoryID], [t1].[QuantityPerUnit], [t1].[UnitPrice], [t1].[UnitsInStock], [t1].[UnitsOnOrder], [t1].[ReorderLevel], [t1].[Discontinued]
+FROM [dbo].[Categories] AS [t0], [dbo].[Products] AS [t1]
+WHERE ([t1].[UnitPrice] > @p0) AND (([t0].[CategoryID]) = [t1].[CategoryID])""" 
+
+    let leftOuterJoinQuery =
+        checkLinqSqlText "vwe4yuwe0977"
+            (query { for c in db.Categories do
+                     groupJoin p in db.Products on ( c.CategoryID =? p.CategoryID) into prodGroup
+                     let prodGroup = System.Linq.Enumerable.DefaultIfEmpty prodGroup
+                     for item in prodGroup do
+                        select (c.CategoryName, (match item with null -> "" | _ -> item.ProductName)) })
+            """SELECT [t0].[CategoryName] AS [Item1], 
+    (CASE 
+        WHEN [t2].[test] IS NULL THEN CONVERT(NVarChar(40), at p0)
+        ELSE [t2].[ProductName]
+     END) AS [Item2]
+FROM [dbo].[Categories] AS [t0]
+LEFT OUTER JOIN (
+    SELECT 1 AS [test], [t1].[ProductName], [t1].[CategoryID]
+    FROM [dbo].[Products] AS [t1]
+    ) AS [t2] ON ([t0].[CategoryID]) = [t2].[CategoryID]""" 
+
+    let checkForLongCustomerNameLength = 
+        checkLinqSqlTextForValue "vwe4yuwe0988"
+            (fun () -> query { for c in db.Customers do 
+                               exists (c.Address.Length > 10) })
+            """SELECT 
+    (CASE 
+        WHEN EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t0]
+            WHERE LEN([t0].[Address]) > @p0
+            ) THEN 1
+        ELSE 0
+     END) AS [value]""" 
+
+    let checkCustomerNameLengthsAreNotAllShort = 
+        checkLinqSqlTextForValue "vwe4yuwe0999"
+            (fun () -> query { for c in db.Customers do all (c.Address.Length < 10) })
+            """SELECT 
+    (CASE 
+        WHEN NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 1
+        WHEN NOT NOT (EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Customers] AS [t1]
+            WHERE (
+                (CASE 
+                    WHEN LEN([t1].[Address]) < @p0 THEN 1
+                    ELSE 0
+                 END)) = 0
+            )) THEN 0
+        ELSE NULL
+     END) AS [value]""" 
+
+
+
+    let queryWithOrderByInStrangePosition = 
+        checkLinqSqlText "vwe4yuwe09qq"
+            (query { for c in db.Customers do
+                     sortBy c.City
+                     where (c.Country = "UK")
+                     select c.CompanyName })
+            """SELECT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[Country] = @p0
+ORDER BY [t0].[City]""" 
+
+    let queryWithNestedQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ww"
+            (query { for c in db.Customers do
+                     let orders = query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    let queryWithExplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09ee"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithImplicitNestedEnumerableQueryInLetBeforeFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09rr"
+            (query { for c in db.Customers do
+                     let orders = query { for o in 0 .. 100 do select (o+1) }
+                     select (c.ContactName,orders) })
+            """SELECT [t0].[ContactName] AS [Item1]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let queryWithNestedQueryInFinalSelect = 
+        checkLinqSqlText "vwe4yuwe09tt"
+            (query { for c in db.Customers do
+                     select (c.ContactName, query { for o in db.Orders do where (o.CustomerID = c.CustomerID); select o }) })
+            """SELECT [t0].[ContactName] AS [Item1], [t1].[OrderID], [t1].[CustomerID], [t1].[EmployeeID], [t1].[OrderDate], [t1].[RequiredDate], [t1].[ShippedDate], [t1].[ShipVia], [t1].[Freight], [t1].[ShipName], [t1].[ShipAddress], [t1].[ShipCity], [t1].[ShipRegion], [t1].[ShipPostalCode], [t1].[ShipCountry], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]""" 
+
+    // The following example demonstrates how to use a composite key to join data from three tables:
+    let compositeKeyQuery = 
+        checkLinqSqlText "vwe4yuwe09yy"
+            (query { for o in db.Orders do
+                     for p in db.Products do
+                     groupJoin d in db.OrderDetails on ( (o.OrderID, p.ProductID) = (d.OrderID, d.ProductID)) into details
+                     for d in details do
+                     select (o.OrderID, p.ProductID, d.UnitPrice) })
+            """SELECT [t0].[OrderID] AS [Item1], [t1].[ProductID] AS [Item2], [t2].[UnitPrice] AS [Item3]
+FROM [dbo].[Orders] AS [t0], [dbo].[Products] AS [t1], [dbo].[Order Details] AS [t2]
+WHERE ([t0].[OrderID] = [t2].[OrderID]) AND ([t1].[ProductID] = [t2].[ProductID])""" 
+
+    // The following example demonstrates how to use a composite key to join data from three tables:
+    let compositeKeyQuery2 = 
+        checkLinqSqlText "vwe4yuwe09yy2"
+            (query { for o in db.Orders do
+                     for p in db.Products do
+                     join d in db.OrderDetails on ((o.OrderID, p.ProductID) = (d.OrderID, d.ProductID)) 
+                     select (o.OrderID, p.ProductID) })
+            """SELECT [t0].[OrderID] AS [Item1], [t1].[ProductID] AS [Item2]
+FROM [dbo].[Orders] AS [t0]
+CROSS APPLY ([dbo].[Products] AS [t1]
+    INNER JOIN [dbo].[Order Details] AS [t2] ON ([t0].[OrderID] = [t2].[OrderID]) AND ([t1].[ProductID] = [t2].[ProductID]))"""
+
+    let firstCustomerWithNamesStartingWithB = 
+        checkLinqSqlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Customers do where (c.ContactName.StartsWith "B"); headOrDefault })
+            """SELECT TOP (1) [t0].[CustomerID], [t0].[CompanyName], [t0].[ContactName], [t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region], [t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax]
+FROM [dbo].[Customers] AS [t0]
+WHERE [t0].[ContactName] LIKE @p0""" 
+
+    let distinctCompanyNames = 
+        checkLinqSqlText "vwe4yuwe09"
+            (query { for c in db.Customers do 
+                     select c.CompanyName
+                     distinct } )
+            """SELECT DISTINCT [t0].[CompanyName]
+FROM [dbo].[Customers] AS [t0]""" 
+
+    let testIDisposable() = 
+        use db = NorthwndDb.GetDataContext()
+        query { for c in db.Customers do select c } |> Seq.length |> ignore
+
+    testIDisposable()
+    testIDisposable()
+    testIDisposable()
+
+    let testIDisposable2() = 
+        let db = NorthwndDb.GetDataContext()
+        query { for c in db.Customers do select c } |> Seq.length |> ignore
+        (db :> System.IDisposable).Dispose()
+        test "ckencew"
+            (try 
+               query { for c in db.Customers do select c } |> Seq.length |> ignore
+               false
+             with :? System.ObjectDisposedException -> 
+               true)
+
+    testIDisposable2()
+    testIDisposable2()
+    testIDisposable2()
+
+
+    module UsingYield = 
+        let customers1 = 
+            checkLinqSqlText "vwe4yuwe091a"
+                (query { for c in db.Customers do 
+                         yield (c.CompanyName, query { for o in c.Orders do  yield (o.CustomerID, o.EmployeeID) }) })
+                """SELECT [t0].[CompanyName] AS [Item1], [t1].[CustomerID] AS [Item12], [t1].[EmployeeID] AS [Item2], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]"""
+
+        let customers2 = 
+            checkLinqSqlText "vwe4yuwe091b"
+                (query { for c in db.Customers do 
+                         yield (c.CompanyName, query { for o in c.Orders do  maxByNullable o.Freight }) })
+                """SELECT [t0].[CompanyName] AS [Item1], (
+    SELECT MAX([t1].[Freight])
+    FROM [dbo].[Orders] AS [t1]
+    WHERE [t1].[CustomerID] = [t0].[CustomerID]
+    ) AS [Item2]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+        let customers3 = 
+            checkLinqSqlText "vwe4yuwe091c"
+                (query { for c in db.Customers do 
+                         let q = query { for o in c.Orders do  yield (o.CustomerID, o.EmployeeID) }
+                         yield (c.CompanyName, q) })
+                """SELECT [t0].[CompanyName] AS [Item1], [t1].[CustomerID] AS [Item12], [t1].[EmployeeID] AS [Item2], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]"""
+
+        let customers4 = 
+            checkLinqSqlText "vwe4yuwe091d"
+                (query { for c in db.Customers do 
+                         let q = query { for o in c.Orders do  select o.Freight; contains (Nullable 3.0M) }
+                         yield (c.CompanyName, q) })
+                """SELECT [t0].[CompanyName] AS [Item1], 
+    (CASE 
+        WHEN EXISTS(
+            SELECT NULL AS [EMPTY]
+            FROM [dbo].[Orders] AS [t1]
+            WHERE ([t1].[Freight] = @p0) AND ([t1].[CustomerID] = [t0].[CustomerID])
+            ) THEN 1
+        ELSE 0
+     END) AS [Item2]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+                
+    module UsingSelect = 
+        let customers1 = 
+            checkLinqSqlText "vwe4yuwe091e"
+                (query { for c in db.Customers do 
+                         select (c.CompanyName, query { for o in c.Orders do  select (o.CustomerID, o.EmployeeID) }) })
+                """SELECT [t0].[CompanyName] AS [Item1], [t1].[CustomerID] AS [Item12], [t1].[EmployeeID] AS [Item2], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]"""
+
+        let customers2 = 
+            checkLinqSqlText "vwe4yuwe091f"
+                (query { for c in db.Customers do 
+                         select (c.CompanyName, query { for o in c.Orders do  maxByNullable o.Freight }) })
+                """SELECT [t0].[CompanyName] AS [Item1], (
+    SELECT MAX([t1].[Freight])
+    FROM [dbo].[Orders] AS [t1]
+    WHERE [t1].[CustomerID] = [t0].[CustomerID]
+    ) AS [Item2]
+FROM [dbo].[Customers] AS [t0]"""
+
+
+        let customers3 = 
+            checkLinqSqlText "vwe4yuwe091g"
+                (query { for c in db.Customers do 
+                         let q = query { for o in c.Orders do  select (o.CustomerID, o.EmployeeID) }
+                         select (c.CompanyName, q) })
+                """SELECT [t0].[CompanyName] AS [Item1], [t1].[CustomerID] AS [item12], [t1].[EmployeeID] AS [item2], (
+    SELECT COUNT(*)
+    FROM [dbo].[Orders] AS [t2]
+    WHERE [t2].[CustomerID] = [t0].[CustomerID]
+    ) AS [value]
+FROM [dbo].[Customers] AS [t0]
+LEFT OUTER JOIN [dbo].[Orders] AS [t1] ON [t1].[CustomerID] = [t0].[CustomerID]
+ORDER BY [t0].[CustomerID], [t1].[OrderID]"""
+
+
+#if COMPILED
+    [<System.STAThread>]
+    do()
+#endif
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/queriesOverOData/build.bat b/tests/fsharp/core/queriesOverOData/build.bat
new file mode 100644
index 0000000..5a42f78
--- /dev/null
+++ b/tests/fsharp/core/queriesOverOData/build.bat
@@ -0,0 +1,70 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+REM == 
+REM == Disabled until Don checks in the missing files
+REM == 
+GOTO :SkipMultiPartTests
+    "%FSC%" %fsc_flags% -a -o:testlib.dll  -r:System.Data.Services.Client.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" testlib.dll
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% -r:testlib.dll -o:testapp.exe  -r:System.Data.Services.Client.dll -g test-part2.fs
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" testapp.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% -o:testtwoparts.exe -r:System.Data.Services.Client.dll -r:FSharp.Data.TypeProviders.dll -g test-part1.fs test-part2.fs 
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" testtwoparts.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:SkipMultiPartTests
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/queriesOverOData/run.bat b/tests/fsharp/core/queriesOverOData/run.bat
new file mode 100644
index 0000000..d4f67a9
--- /dev/null
+++ b/tests/fsharp/core/queriesOverOData/run.bat
@@ -0,0 +1,79 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+REM == 
+REM == Disabled until Don checks in the missing files
+REM == 
+GOTO :SkipMultiPartTests
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% testapp.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% testtwoparts.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% testapp.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% testtwoparts.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+:SkipMultiPartTests
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/queriesOverOData/test.fsx b/tests/fsharp/core/queriesOverOData/test.fsx
new file mode 100644
index 0000000..1ac866c
--- /dev/null
+++ b/tests/fsharp/core/queriesOverOData/test.fsx
@@ -0,0 +1,145 @@
+// #Quotations
+#nowarn "57"
+#r "System.Data.Services.Client.dll"
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Data.TypeProviders
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+[<AutoOpen>]
+module Infrastructure =
+    let mutable failures = []
+    let reportFailure s = 
+        stderr.WriteLine " NO"; failures <- s :: failures
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+        if argv.Length > 2 && argv.[1] = "--culture" then  
+            let cultureString = argv.[2] 
+            let culture = new System.Globalization.CultureInfo(cultureString) 
+            stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+            System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+    do SetCulture()    
+
+    let check  s v1 v2 = 
+       if v1 = v2 then 
+           printfn "test %s...passed " s 
+       else 
+           failures <- failures @ [(s, box v1, box v2)]
+           printfn "test %s...failed, expected \n\t%A\ngot\n\t%A" s v2 v1
+
+    let test s b = check s b true
+    let qmap f (x:System.Linq.IQueryable<_>) = x |> Seq.map f |> System.Linq.Queryable.AsQueryable
+
+    let checkCommuteSeq s (q1: System.Linq.IQueryable<'T>) q2 =
+        check s (q1 |> Seq.toList) (q2 |> Seq.toList)
+
+    let checkCommuteVal s q1 q2 =
+        check s q1 q2
+
+ 
+type Northwest = ODataService< "http://services.odata.org/Northwind/Northwind.svc/",LocalSchemaFile="schema1.csdl",ForceUpdate=false  >
+
+module Test = begin end
+
+module DuplicateTypes = 
+     
+    type Northwest = ODataService< "http://services.odata.org/Northwind/Northwind.svc/",LocalSchemaFile="schema2.csdl",ForceUpdate=false >
+
+
+ 
+type Northwest2 = ODataService< "http://services.odata.org/Northwind/Northwind.svc/",LocalSchemaFile="schema3.csdl",ForceUpdate=false  >
+ 
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.ExprShape
+open Microsoft.FSharp.Linq
+open Microsoft.FSharp.Linq.RuntimeHelpers
+
+module Queryable = 
+
+    let db = Northwest.GetDataContext()
+    let urlCapture = new System.Text.StringBuilder()
+    db.DataContext.SendingRequest.Add (fun x -> printfn "yurl = %A" x.Request.RequestUri; urlCapture.Append x.Request.RequestUri |> ignore)
+
+    let checkODataUrlTextForValue s (q1: unit -> 'T) (text:string) =
+        urlCapture.Clear() |> ignore
+        q1() |> ignore
+        let url = urlCapture.ToString()
+        check s url text
+
+
+
+    let allCustomersQuery = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Customers do select c } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Customers()"
+        
+
+    let allEmployeesQuery = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Employees do select c } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Employees()"
+
+    let allProductsQuery = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Products do select c } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Products()"
+        
+
+    let allOrdersQuery = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Orders do select c } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()"
+        
+
+    let firstFiveOrders = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for c in db.Orders do take 5; select c } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()?$top=5"
+        
+
+
+    let ordersSortedByShipDateLatestFirst = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for o in db.Orders do sortByNullableDescending o.ShippedDate; select (o.OrderID, o.ShippedDate) } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()?$orderby=ShippedDate desc&$select=OrderID,ShippedDate"
+        
+
+    let ordersSortedByShipDateEarliestFirst = 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for o in db.Orders do sortByNullable o.ShippedDate; select (o.OrderID, o.ShippedDate) } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()?$orderby=ShippedDate&$select=OrderID,ShippedDate"
+        
+
+    let ordersSortedByCustomerIDAndShipDateLatestFirst= 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for o in db.Orders do sortBy o.CustomerID; thenByNullableDescending o.ShippedDate; select (o.CustomerID, o.OrderID, o.ShippedDate) } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()?$orderby=CustomerID,ShippedDate desc&$select=CustomerID,OrderID,ShippedDate"
+
+        
+
+
+    let ordersSortedByCustomerIDAndShipDateEarliestFirst= 
+        checkODataUrlTextForValue "vwe4yuwe09uu"
+            (fun () -> query { for o in db.Orders do sortBy o.CustomerID; thenByNullable o.ShippedDate; select (o.CustomerID, o.OrderID, o.ShippedDate) } |> Seq.length)
+            "http://services.odata.org/Northwind/Northwind.svc/Orders()?$orderby=CustomerID,ShippedDate&$select=CustomerID,OrderID,ShippedDate"
+    
+#if COMPILED
+    [<System.STAThread>]
+    do()
+#endif
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/quotes/build.bat b/tests/fsharp/core/quotes/build.bat
new file mode 100644
index 0000000..e1aeff0
--- /dev/null
+++ b/tests/fsharp/core/quotes/build.bat
@@ -0,0 +1,47 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:test.exe -r cslib.dll -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -r cslib.dll -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/quotes/cslib.cs b/tests/fsharp/core/quotes/cslib.cs
new file mode 100644
index 0000000..a0a7373
--- /dev/null
+++ b/tests/fsharp/core/quotes/cslib.cs
@@ -0,0 +1,4 @@
+
+public struct S {
+    public int x;
+}
diff --git a/tests/fsharp/core/quotes/cslib.dll b/tests/fsharp/core/quotes/cslib.dll
new file mode 100644
index 0000000..5d79f17
Binary files /dev/null and b/tests/fsharp/core/quotes/cslib.dll differ
diff --git a/tests/fsharp/core/quotes/dont.use.empty.signature b/tests/fsharp/core/quotes/dont.use.empty.signature
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/fsharp/core/quotes/dont.use.empty.signature
@@ -0,0 +1 @@
+
diff --git a/tests/fsharp/core/quotes/run.bat b/tests/fsharp/core/quotes/run.bat
new file mode 100644
index 0000000..b066d63
--- /dev/null
+++ b/tests/fsharp/core/quotes/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% -r cslib.dll test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx
new file mode 100644
index 0000000..322dabe
--- /dev/null
+++ b/tests/fsharp/core/quotes/test.fsx
@@ -0,0 +1,2415 @@
+// #Conformance #Quotations #Interop #Classes #ObjectConstructors #Attributes #Reflection 
+#if Portable
+module Core_quotes
+#endif
+#light
+
+#if Portable
+#else
+#r "cslib.dll"
+#endif
+
+
+#nowarn "57"
+let mutable failures = []
+let report_failure s = 
+    stderr.WriteLine " NO"; failures <- s :: failures
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s
+let check s v1 v2 = 
+   stderr.Write(s:string);  
+   if (v1 = v2) then 
+       stderr.WriteLine " OK" 
+   else
+       eprintf " FAILED: got %A, expected %A" v1 v2 
+       report_failure s
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+    if argv.Length > 2 && argv.[1] = "--culture" then  
+        let cultureString = argv.[2] 
+        let culture = new System.Globalization.CultureInfo(cultureString) 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  
+do SetCulture()    
+#endif
+
+
+open System
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+
+let (|TypedValue|_|) (v : 'T) value = 
+    match value with 
+    | Patterns.Value(:? 'T as v1, ty) when ty = typeof<'T> && v = v1-> Some ()
+    | _ -> None
+
+let (|ObjTy|_|) ty = if ty = typeof<obj> then Some() else None
+let (|IntTy|_|) ty = if ty = typeof<int> then Some() else None
+let (|StringTy|_|) ty = if ty = typeof<string> then Some() else None
+
+let (|TupleTy|_|) ty = 
+    if Microsoft.FSharp.Reflection.FSharpType.IsTuple ty then
+        let [| t1; t2 |] = Microsoft.FSharp.Reflection.FSharpType.GetTupleElements ty
+        Some (t1, t2)
+    else None
+
+#if Portable
+[<Struct>]
+type S = 
+    val mutable x : int
+#endif
+
+module TypedTest = begin 
+
+    let x = <@ 1 @>
+
+    test "check SByte"   ((<@  1y   @> |> (function SByte 1y -> true | _ -> false))) 
+    test "check Int16"   ((<@  1s   @> |> (function Int16 1s -> true | _ -> false))) 
+    test "check Int32"   ((<@  1   @> |> (function Int32 1 -> true | _ -> false))) 
+    test "check Int64"   ((<@  1L   @> |> (function Int64 1L -> true | _ -> false))) 
+    test "check Byte"     ((<@  1uy   @> |> (function Byte 1uy -> true | _ -> false))) 
+    test "check UInt16"   ((<@  1us   @> |> (function UInt16 1us -> true | _ -> false))) 
+    test "check UInt32"   ((<@  1u   @> |> (function UInt32 1u -> true | _ -> false))) 
+    test "check UInt64"   ((<@  1UL   @> |> (function UInt64 1UL -> true | _ -> false))) 
+    test "check String"  ((<@  "1" @> |> (function String "1" -> true | _ -> false))) 
+
+    test "check ~SByte"   ((<@  "1"   @> |> (function SByte _ -> false | _ -> true))) 
+    test "check ~Int16"   ((<@  "1"   @> |> (function Int16 _ -> false | _ -> true))) 
+    test "check ~Int32"   ((<@  "1"   @> |> (function Int32 _ -> false | _ -> true))) 
+    test "check ~Int64"   ((<@  "1"   @> |> (function Int64 _ -> false | _ -> true))) 
+    test "check ~Byte"   ((<@  "1"   @> |> (function Byte _ -> false | _ -> true))) 
+    test "check ~UInt16"   ((<@  "1"   @> |> (function UInt16 _ -> false | _ -> true))) 
+    test "check ~UInt32"   ((<@  "1"   @> |> (function UInt32 _ -> false | _ -> true))) 
+    test "check ~UInt64"   ((<@  "1"   @> |> (function UInt64 _ -> false | _ -> true))) 
+    test "check ~String" ((<@  1   @> |> (function String "1" -> false | _ -> true))) 
+
+    test "check AndAlso" ((<@ true && true  @> |> (function AndAlso(Bool(true),Bool(true)) -> true | _ -> false))) 
+    test "check OrElse"  ((<@ true || true  @> |> (function OrElse(Bool(true),Bool(true)) -> true | _ -> false))) 
+    test "check AndAlso" ((<@ true && true  @> |> (function AndAlso(Bool(true),Bool(true)) -> true | _ -> false))) 
+    test "check OrElse"  ((<@ true || true  @> |> (function OrElse(Bool(true),Bool(true)) -> true | _ -> false))) 
+    test "check AndAlso" ((<@ false && false @> |> (function AndAlso(Bool(false),Bool(false)) -> true | _ -> false))) 
+    test "check OrElse"  ((<@ false || false @> |> (function OrElse(Bool(false),Bool(false)) -> true | _ -> false))) 
+    test "check AndAlso - encoded" ((<@ true && false @> |> (function IfThenElse(Bool(true),Bool(false),Bool(false)) -> true | _ -> false))) 
+    test "check OrElse - encoded" ((<@ true || false @> |> (function IfThenElse(Bool(true),Bool(true),Bool(false)) -> true | _ -> false))) 
+
+
+    test "check ForIntegerRangeLoop"   (<@ for i = 1 to 10 do printf "hello" @> |> (function ForIntegerRangeLoop(v,Int32(1),Int32(10),b) -> true | _ -> false))
+    test "check ForIntegerRangeLoop"   (<@ for i in 1 .. 10 do printf "hello" @> |> (function ForIntegerRangeLoop(v,Int32(1),Int32(10),b) -> true | _ -> false))
+    // In this example, the types of the start and end points are not known at the point the loop
+    // is typechecked. There was a bug (6064) where the transformation to a ForIntegerRangeLoop was only happening
+    // when types were known
+    test "check ForIntegerRangeLoop"   (<@ for i in failwith "" .. failwith "" do printf "hello" @> |> (function ForIntegerRangeLoop(v,_,_,b) -> true | _ -> false))
+    // A slight non orthogonality is that all other 'for' loops go to (quite complex) the desugared form
+    test "check Other Loop"   (<@ for i in 1 .. 2 .. 10 do printf "hello" @> |> (function Let(v,_,b) -> true | _ -> false))
+    test "check Other Loop"   (<@ for i in 1L .. 10L do printf "hello" @> |> (function Let(v,_,b) -> true | _ -> false))
+
+    let mutable mutableX = 1
+    test "check mutableX top level set"   ((<@  mutableX  <- 10 @> |> (function PropertySet(None,pinfo,[],Int32 10) when pinfo.Name = "mutableX" -> true | _ -> false))) 
+    test "check mutableX top level get"   ((<@  mutableX   @> |> (function PropertyGet(None,pinfo,[]) when pinfo.Name = "mutableX" -> true | _ -> false))) 
+
+
+    let structFieldSetFromArray () = 
+        <@ let mutable arr = [| S() |]
+           arr.[0].x <- 3 @>
+
+    let structFieldGetFromArray () = 
+        <@ let mutable arr = [| S() |]
+           arr.[0].x  @>
+
+    test "check struct field set from array"   
+     ((structFieldSetFromArray() |> 
+        (function 
+          | Let (varr, NewArray (_, [ DefaultValue _ ]),FieldSet (Some (Call (None, getter, [arr; Int32 0])), field, Int32 3)) -> true 
+          | _ -> false))) 
+
+    test "check struct field get from array"   
+     ((structFieldGetFromArray() |> 
+        (function 
+          | Let (varr, NewArray (_, [ DefaultValue _ ]),FieldGet (Some (Call (None, getter, [arr; Int32 0])), field)) -> true 
+          | _ -> false))) 
+
+
+    test "checkIsMutable1" 
+        (let e = <@@ let mutable x = 1 in if x = 1 then x <- 2 @@>
+
+         match e with
+                  |Let(v,e1,e2) -> v.IsMutable
+                  |_ -> failwith "unexpected shape") 
+
+    test "checkIsMutable2" 
+        (let e = <@@ let x = 1 in if x = 1 then 2 else 3 @@>
+
+         match e with
+                  |Let(v,e1,e2) -> not v.IsMutable
+                  |_ -> failwith "unexpected shape") 
+
+    test "checkIsMutable3" 
+        (let e = <@@ let f (x:int) = 1 in f 3 @@>
+
+         match e with
+                  |Let(v,e1,e2) -> not v.IsMutable
+                  |_ -> failwith "unexpected shape") 
+
+    test "checkType" 
+        (let e = <@@ let mutable x = 1 in if x = 1 then x <- 2 @@>
+
+         match e with
+                  |Let(v,e1,e2) -> v.Type = typeof<int>
+                  |_ -> failwith "unexpected shape") 
+
+
+    type MyEnum = Foo = 0 | Bar = 1
+    test "klnwce-0" 
+        (match <@@ MyEnum.Foo @@> with  | Value(x,ty) when ty = typeof<MyEnum> && (x:?>MyEnum)=MyEnum.Foo -> true | _ -> false)
+    test "klnwce-1" 
+        (match <@@ MyEnum.Bar @@> with  | Value(x,ty) when ty = typeof<MyEnum> && (x:?>MyEnum)=MyEnum.Bar  -> true | _ -> false)
+    test "klnwce-2" 
+        (match <@@ System.DayOfWeek.Monday @@> with  | Value(x,ty) when ty = typeof<System.DayOfWeek> && (x:?>System.DayOfWeek)=System.DayOfWeek.Monday -> true | _ -> false)
+    test "klnwce-3" 
+        (<@@ System.DayOfWeek.Monday @@>.Type = typeof<System.DayOfWeek >)
+    test "klnwce-4" 
+        (match <@@ (fun () -> MyEnum.Bar) @@> with  | Lambda(_,Value(x,ty)) when ty = typeof<MyEnum> && (x:?>MyEnum)=MyEnum.Bar -> true | _ -> false)
+        
+    test "check NewArray"   (<@ [| |] :int[] @> |> (function NewArray(typ,[]) when typ = typeof<int32> -> true | _ -> false))
+    test "check NewArray"   (<@ [| 1;2;3 |] @> |> (function NewArray(typ,[Int32(1);Int32(2);Int32(3)]) when typ = typeof<int32> -> true | _ -> false))
+    test "check NewRecord"   (<@ { contents = 3 } @> |> (function NewRecord(typ,args) -> true | _ -> false))
+    test "check NewUnion"   (<@ [] @> |> (function NewUnionCase(unionCase,args) -> true | _ -> false))
+    test "check NewUnion"   (<@ [1] @> |> (function NewUnionCase(unionCase,args) -> true | _ -> false))
+    test "check NewUnion"   (<@ None @> |> (function NewUnionCase(unionCase,args) -> true | _ -> false))
+    test "check NewUnion"   (<@ Some(1) @> |> (function NewUnionCase(unionCase,args) -> true | _ -> false))
+
+    test "check NewDelegate"   (<@ new System.EventHandler<System.EventArgs>(fun sender evArgs -> ()) @> |> (function NewDelegate(ty,[v1;v2],_) when v1.Name = "sender" && v2.Name = "evArgs" -> true | _ -> false))
+
+    test "check NewTuple (2)"   (<@ (1,2) @>           |> (function NewTuple([Int32(1);Int32(2)]) -> true | _ -> false))
+    test "check NewTuple (3)"   (<@ (1,2,3) @>         |> (function NewTuple([Int32(1);Int32(2);Int32(3)]) -> true | _ -> false))
+    test "check NewTuple (4)"   (<@ (1,2,3,4) @>       |> (function NewTuple([Int32(1);Int32(2);Int32(3);Int32(4)]) -> true | _ -> false))
+    test "check NewTuple (5)"   (<@ (1,2,3,4,5) @>     |> (function NewTuple([Int32(1);Int32(2);Int32(3);Int32(4);Int32(5)]) -> true | _ -> false))
+    test "check NewTuple (6)"   (<@ (1,2,3,4,5,6) @>   |> (function NewTuple([Int32(1);Int32(2);Int32(3);Int32(4);Int32(5);Int32(6)]) -> true | _ -> false))
+    test "check NewTuple (6)"   (<@ (1,2,3,4,5,6,7) @> |> (function NewTuple([Int32(1);Int32(2);Int32(3);Int32(4);Int32(5);Int32(6);Int32(7)]) -> true | _ -> false))
+
+    test "check  Lambda"  ((<@ (fun (x:int) -> x) @>               |> (function Lambda(v,_) -> true | _ -> false))) 
+    test "check  Lambda"  ((<@ (fun (x:int,y:int) -> x) @>         |> (function Lambda(v,_) -> true | _ -> false))) 
+    test "check  Lambda"  ((<@ (fun (p:int*int) -> p) @>           |> (function Lambda(v,_) -> true | _ -> false))) 
+    test "check  Lambda"  ((<@ (fun () -> 1) @>           |> (function Lambda(v,_) -> true | _ -> false))) 
+
+    test "check  Lambdas" ((<@ (fun (x:int) -> x) @>               |> (function Lambdas([[v]],_) -> true | _ -> false))) 
+    test "check  Lambdas" ((<@ (fun (x:int,y:int) -> x) @>         |> (function Lambdas([[v1;v2]],_) -> true | _ -> false))) 
+    test "check ~Lambdas" ((<@ (fun (x:int) (y:int) -> x) @>       |> (function Lambdas([[v1;v2]],_) -> false | _ -> true))) 
+    test "check  Lambdas" ((<@ (fun (x:int,y:int) (z:int) -> z) @> |> (function Lambdas([[v1;v2];[v3]],_) -> true | _ -> false))) 
+    test "check  Lambdas" ((<@ (fun ((x:int,y:int),(z:int)) -> z) @> |> (function Lambdas([[v1;v2]],_) -> true | _ -> false))) 
+    test "check  Lambdas" ((<@ (fun ((x:int),(y:int,z:int)) -> z) @> |> (function Lambdas([[v1;v2]],_) -> true | _ -> false))) 
+    //
+    //test "check  Lambdas" ((<@ (fun [(x:int)] -> x) @> |> (function Lambdas([[v1]],_) -> true | _ -> false))) 
+    test "check  Lambdas" ((<@ (fun () -> 1) @> |> (function Lambdas([[v1]],_) -> true | _ -> false))) 
+
+    test "check  Let" ((<@ let x = 1 in x @> |> (function Let(v,Int32(1),Var(v2)) when v = v2 -> true | _ -> false))) 
+    test "check  Let" ((<@ let x = 1 
+                           let y = 2 
+                           x,y @> |> (function Let(vx,Int32(1),Let(vy,Int32(2),NewTuple([Var(vx2);Var(vy2)]))) when vx.Name = "x" && vx = vx2 && vy = vy2 -> true | _ -> false))) 
+
+    test "check  Let" ((<@ let x = 1 
+                           let x = 2 
+                           x,x @> |> (function Let(vx,Int32(1),Let(vy,Int32(2),NewTuple([Var(vx2);Var(vy2)]))) when vx.Name = "x" && vy.Name = "x" && vy = vx2 && vy = vy2 -> true | _ -> false))) 
+
+    test "check  Let" ((<@ let f () = 1 in f @> |> (function Let(v,Lambda(_,Int32(1)),Var(v2)) when v = v2 -> true | _ -> false))) 
+
+    test "check  LetRecursive" ((<@ let rec f (x:int) : int = 1 in f @> |> (function LetRecursive([vf,Lambda(vx,Int32(1))],Var(vf2)) when vf = vf2 -> true | _ -> false))) 
+
+    test "check  LetRecursive" ((<@ let rec f (x:int) : int = 1 
+                                    and     g (x:int) = 2 
+                                    (f,g) @> |> (function LetRecursive([(vf,Lambda(vx,Int32(1)));(vg,Lambda(vx2,Int32(2)))],NewTuple[Var(vf2);Var(vg2)]) when (vf = vf2 && vg = vg2)-> true | _ -> false))) 
+
+    test "check  Application" ((<@ let f () = 1 in f () @> |> (function Let(fv1,Lambda(_,Int32(1)),Application(Var(fv2),Unit)) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Application" ((<@ let f (x:int) = 1 in f 1 @> |> (function Let(fv1,Lambda(_,Int32(1)),Application(Var(fv2),Int32(1))) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Application" ((<@ let f (x:int) (y:int) = 1 in f 1 2 @> |> (function Let(fv1,Lambda(_,Lambda(_,Int32(1))),Application(Application(Var(fv2),Int32(1)),Int32(2))) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Application" ((<@ let f (x:int,y:int) = 1 in f (1,2) @> |> (function Let(fv1,Lambdas(_,Int32(1)),Application(Var(fv2),NewTuple[Int32(1);Int32(2)])) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Applications" ((<@ let f (x:int) (y:int) = 1 in f 1 2 @> |> (function Let(fv1,Lambdas(_,Int32(1)),Applications(Var(fv2),[[Int32(1)];[Int32(2)]])) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Applications" ((<@ let f (x:int,y:int) = 1 in f (1,2) @> |> (function Let(fv1,Lambdas(_,Int32(1)),Applications(Var(fv2),[[Int32(1);Int32(2)]])) when fv1 = fv2 -> true | _ -> false))) 
+    test "check  Applications" ((<@ let f () = 1 in f () @> |> (function Let(fv1,Lambdas(_,Int32(1)),Applications(Var(fv2),[[]])) when fv1 = fv2 -> true | _ -> false))) 
+
+    test "check  pattern matching 1" 
+        ((<@ function (x:int) -> x  @> 
+             |> (function Lambda(argv1,Let(xv1,Var(argv2),Var(xv2))) when xv1 = xv2 && argv1 = argv2 -> true | _ -> false))) 
+
+    test "check  incomplete pattern matching 1" 
+        ((<@ function (None : int option) -> 1  @> 
+             // Pipe the quotation into a matcher that checks its form
+             |> (function Lambda(argv1,IfThenElse(UnionCaseTest(Var(argv2),ucase1),Int32(1),Call(None,minfo,[_])))  when argv1 = argv2 && minfo.Name = "Raise" && ucase1.Name = "None" -> true 
+                        | _ -> false))) 
+             
+    test "check  pattern matching 2" 
+        ((<@ function { contents = (x:int) } -> x  @> 
+             // Pipe the quotation into a matcher that checks its form
+             |> (function Lambda(argv1,Let(xv1,PropertyGet(Some(Var(argv2)),finfo,[]),Var(xv2))) when xv1 = xv2 && argv1 = argv2 -> true 
+                        | _ -> false))) 
+
+    test "check  pattern matching 3" 
+        ((<@ function ([]:int list) -> 1 | _ -> 2  @> 
+             // Pipe the quotation into a matcher that checks its form
+             |> (function Lambda(argv1,IfThenElse(UnionCaseTest(Var(argv2),ucase),Int32(1),Int32(2))) when argv1 = argv2 -> true | _ -> false))) 
+
+    test "check  pattern matching 4" 
+        ((<@ function ([]:int list) -> 1 | h::t -> 2  @> 
+             // Pipe the quotation into a matcher that checks its form
+             |> (function Lambda(argv1,IfThenElse(UnionCaseTest(Var(argv2),ucaseCons),
+                                                  Let(tv1,PropertyGet(Some(Var(argv3)),pinfoTail,[]),
+                                                    Let(hv1,PropertyGet(Some(Var(argv4)),pinfoHead,[]),
+                                                         Int32(2))),
+                                                  Int32(1))) when (argv1 = argv2 && 
+                                                                   argv1 = argv3 && 
+                                                                   argv1 = argv4 && 
+                                                                   ucaseCons.Name = "Cons" && 
+                                                                   pinfoTail.Name = "Tail" && 
+                                                                   pinfoTail.Name = "Tail") -> true 
+                        | _ -> false))) 
+
+    test "check  pattern matching 5" 
+        ((<@ function h::t -> 2  | ([]:int list) -> 1 @> 
+             |> (function Lambda(argv1,IfThenElse(UnionCaseTest(Var(argv2),ucaseEmpty),
+                                                  Int32(1),
+                                                  Let(tv1,PropertyGet(Some(Var(argv3)),pinfoTail,[]),
+                                                    Let(hv1,PropertyGet(Some(Var(argv4)),pinfoHead,[]),
+                                                         Int32(2))))) when (argv1 = argv2 && 
+                                                                            argv1 = argv3 && 
+                                                                            argv1 = argv4 && 
+                                                                            ucaseEmpty.Name = "Empty" && 
+                                                                            pinfoTail.Name = "Tail" && 
+                                                                            pinfoTail.Name = "Tail") -> true 
+                        | _ -> false))) 
+
+    test "check  pattern matching 6" 
+        ((<@ function [h1;(h2:int)] -> 2 | _ -> 0 @> 
+             |> (function Lambda(argv1,
+                                 IfThenElse(UnionCaseTest(Var(argv2),ucaseCons),
+                                            IfThenElse(UnionCaseTest(PropertyGet(Some(Var(argv3)),pinfoTail,[]),ucaseCons2),
+                                                       IfThenElse(UnionCaseTest(PropertyGet(Some(PropertyGet(Some(Var(argv4)),pinfoTail2,[])),pinfoTail3,[]),ucaseEmpty),
+                                                                  Let(h1v1,PropertyGet(Some(Var(argv5)),pinfoHead,[]),
+                                                                    Let(h2v1,PropertyGet(Some(PropertyGet(Some(Var(argv6)),pinfoTail4,[])),pinfoHead2,[]),
+                                                                         Int32(2))),
+                                                                  Int32(0)),
+                                                       Int32(0)),
+                                            Int32(0))) 
+                                when (argv1 = argv2 && 
+                                      argv1 = argv3 && 
+                                      argv1 = argv4 && 
+                                      argv1 = argv5 && 
+                                      argv1 = argv6 && 
+                                      h1v1.Name = "h1" && 
+                                      h2v1.Name = "h2" && 
+                                      ucaseEmpty.Name = "Empty" && 
+                                      pinfoTail.Name = "Tail" && 
+                                      pinfoTail2.Name = "Tail" && 
+                                      pinfoTail3.Name = "Tail" && 
+                                      pinfoTail4.Name = "Tail" && 
+                                      pinfoHead.Name = "Head" && 
+                                      pinfoHead2.Name = "Head") -> true
+                        | _ -> false))) 
+
+    // Check the elaborated form of a pattern match that uses an active pattern 
+    let (|RefCell|) (x : int ref) = x.Value
+    test "check  pattern matching 7" 
+        ((<@ function RefCell(x) -> x @> 
+             |> (function Lambda(argv1,
+                                 Let(apv1, Call(None,minfo,[Var(argv2)]),
+                                     Let(xv1, Var(apv2),
+                                         Var(xv2))))
+                                when (argv1 = argv2 && 
+                                      xv1 = xv2  && 
+                                      apv1 = apv2  && 
+                                      minfo.Name = "|RefCell|") -> true
+                        | _ -> false))) 
+
+    // Check calling .NET things
+    test "check  NewObject" ((<@ new System.Object() @> |> (function NewObject(_,[]) -> true | _ -> false))) 
+    test "check  NewObject" ((<@ new System.String('c',3) @> |> (function NewObject(_,[Char('c');Int32(3)]) -> true | _ -> false))) 
+    
+    test "check  Call (static)" ((<@ System.Object.Equals("1","2") @> |> (function Call(None,_,[Coerce(String("1"),_);Coerce(String("2"),_)]) -> true | _ -> false))) 
+    test "check  Call (instance)" ((<@ ("1").Equals("2") @> |> (function Call(Some(String("1")),_,[String("2")]) -> true | _ -> false))) 
+    test "check  Call (instance)" ((<@ ("1").GetHashCode() @> |> (function Call(Some(String("1")),_,[]) -> true | _ -> false))) 
+    test "check  PropertyGet (static)" ((<@ System.DateTime.Now @> |> (function PropertyGet(None,_,[]) -> true | _ -> false))) 
+    test "check  PropertyGet (instance)" ((<@ ("1").Length @> |> (function PropertyGet(Some(String("1")),_,[]) -> true | _ -> false))) 
+
+    test "check  PropertySet (static)" ((<@ System.Environment.ExitCode <- 1 @> |> (function PropertySet(None,_,[],Int32(1)) -> true | _ -> false))) 
+    test "check  PropertySet (instance)" ((<@ ("1").Length @> |> (function PropertyGet(Some(String("1")),_,[]) -> true | _ -> false))) 
+
+    test "check null (string)"   (<@ (null:string) @> |> (function Value(null,ty) when ty = typeof<string> -> true | _ -> false))
+
+    let v = Expr.GlobalVar<int>("IntVar")
+    test "check var (GlobalVar)"   (v |> (function Var(v2) when v2.Name = "IntVar" -> true | _ -> false))
+
+    test "check Var"   (<@ %v @> |> (function Var(v2) when v2.Name = "IntVar"  -> true | _ -> false))
+    test "check Coerce"   (<@ 3 :> obj @> |> (function Coerce(x,ty) when ty = typeof<obj> -> true | _ -> false))
+    test "check Sequential"   (<@ (); () @> |> (function Sequential(Unit,Unit) -> true | _ -> false))
+    test "check Sequential"   (<@ ""; () @> |> (function Sequential(Sequential(String(""),Unit),Unit) -> true | _ -> false)) (* changed for bug 3628 fix *)
+    test "check Sequential"   (<@ (); "" @> |> (function Sequential(Unit,String("")) -> true | _ -> false))
+    test "check Sequential"   (<@ (); (); () @> |> (function Sequential(Unit,Sequential(Unit,Unit)) -> true | _ -> false))
+    test "check WhileLoop"   (<@ while true do () done @> |> (function WhileLoop(Bool(true),Unit) -> true | _ -> false))
+    test "check TryFinally"   (<@ try 1 finally () @> |> (function TryFinally(Int32(1),Unit) -> true | _ -> false))
+
+    <@ new obj() :?> int @>
+
+    [<ReflectedDefinition>]
+    let f (x:int) = 1
+
+    [<ReflectedDefinition>]
+    module M = 
+        let f (x:int) = 1
+
+    test "clewlkjncew" 
+        ((<@ f 1 @> |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false))) 
+
+
+
+    test "clewlkjncewb" 
+        ((<@ M.f 1 @> |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false))) 
+
+    // check failure of TryGetReflectedDefinition on non-ReflectedDefinition for locally-defined f3
+
+    //[<ReflectedDefinition>]
+    let f3 (x:int) = 1
+    test "ejnwe98" 
+        ((<@ f3 1 @> |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsNone | _ -> false)))
+
+    [<ReflectedDefinition>]
+    let rec f2 (x:int) = not (f2 x)
+
+    // check success of TryGetReflectedDefinition on local recursive f2
+    test "cwuic9en" 
+              ((<@ f2 1 @> 
+               
+               |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false))) 
+
+
+    // test GetFreeVars
+    
+    test "check lambda closed"       (Seq.length ((<@ (fun (x:int)  -> 1) @>).GetFreeVars()   ) = 0)
+    test "check for loop closed"         (Seq.length ((<@ for i = 1 to 10 do () done @>).GetFreeVars()) = 0)
+    test "check while loop closed"       (Seq.length ((<@ while true do () done @>).GetFreeVars()) = 0)
+    test "check let rec closed"          (Seq.length ((<@ let rec f (x:int) = f (f x) in f @>).GetFreeVars()) = 0)
+
+    module AddressOfTests = 
+        [<Struct>]
+        type S(z : int) =
+            [<DefaultValue>] val mutable x : int
+
+        [<Struct>]
+        type S2(z : int) =
+            [<DefaultValue>] val mutable s : S
+
+        test "check Struct 1"   (<@ S(1).x  @> |> (function Let(_,NewObject _, FieldGet (Some (Var _), _)) -> true | _ -> false))
+        test "check Struct 2a"  (<@ (fun (s2: S2) -> s2.s.x)  @> |> (function Lambda(_,FieldGet(Some(FieldGet(Some(Var _),_)),_)) -> true | _ -> false))
+        test "check Struct 2"   (<@ (fun (arr: S[]) -> arr.[0])  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "GetArray" -> true | _ -> false))
+        test "check Struct 3"   (<@ (fun (arr: S[,]) -> arr.[0,0])  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "GetArray2D" -> true | _ -> false))
+        test "check Struct 4"   (<@ (fun (arr: S[,,]) -> arr.[0,0,0])  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "GetArray3D" -> true | _ -> false))
+        test "check Struct 5"   (<@ (fun (arr: S[,,,]) -> arr.[0,0,0,0])  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "GetArray4D" -> true | _ -> false))
+        test "check Struct 2 arr"   (<@ (fun (arr: S[]) -> arr.[0].x)  @> |> (function Lambda(_,FieldGet(Some(Call(None, minfo, _)),_)) when minfo.Name = "GetArray" -> true | _ -> false))
+        test "check Struct 3 arr"   (<@ (fun (arr: S[,]) -> arr.[0,0].x)  @> |> (function Lambda(_,FieldGet(Some(Call(None, minfo, _)),_)) when minfo.Name = "GetArray2D" -> true | _ -> false))
+        test "check Struct 4 arr"   (<@ (fun (arr: S[,,]) -> arr.[0,0,0].x)  @> |> (function Lambda(_,FieldGet(Some(Call(None, minfo, _)),_)) when minfo.Name = "GetArray3D" -> true | _ -> false))
+        test "check Struct 5 arr"   (<@ (fun (arr: S[,,,]) -> arr.[0,0,0,0].x)  @> |> (function Lambda(_,FieldGet(Some(Call(None, minfo, _)),_)) when minfo.Name = "GetArray4D" -> true | _ -> false))
+        test "check Struct 6"   (<@ (fun (arr: int[]) -> arr.[0] <- 0)  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "SetArray" -> true | _ -> false))
+        test "check Struct 7"   (<@ (fun (arr: int[,]) -> arr.[0,0] <- 0)  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "SetArray2D" -> true | _ -> false))
+        test "check Struct 8"   (<@ (fun (arr: int[,,]) -> arr.[0,0,0] <- 0)  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "SetArray3D" -> true | _ -> false))
+        test "check Struct 9"   (<@ (fun (arr: int[,,,]) -> arr.[0,0,0,0] <- 0)  @> |> (function Lambda(_,Call(None, minfo, _)) when minfo.Name = "SetArray4D" -> true | _ -> false))
+        test "check Struct C"   (<@ S()  @> |> (function DefaultValue _ -> true | _ -> false))
+        test "check Mutate 1"   (<@ let mutable x = 0 in x <- 1 @> |> (function Let(v,Int32 0, VarSet(v2,Int32 1)) when v = v2 -> true | _ -> false))
+
+        let q = <@ let mutable x = 0 in x <- 1 @>
+
+    // Test basic expression splicing
+    let f8383 (x:int) (y:string) = 0
+    let test2 =   
+        let v = 1 in 
+        let s = "2" in   
+        <@ f8383 v s @>
+
+    let f8384 (x:'a) (y:string) = 0
+    let test3a =   
+        let v = 1 in 
+        let s = "2" in   
+        <@ f8384 v s @>
+
+    let test3b() =   
+        let v = 1 in 
+        let s = "2" in   
+        <@ f8384 v s @>
+    
+    check "value splice 1" test2 <@ f8383 1 "2" @>
+    check "value splice 2" test3a <@ f8384 1 "2" @>
+    check "value splice 3" (test3b()) <@ f8384 1 "2" @>
+
+    test "value splice 4"  (let v1 = 3 in let v2 = 1+2 in  <@ 1 + v1 @> = <@ 1 + v2 @>)
+    test "expr splice 1"  (<@ %(<@ 1 @>) @> = <@ 1 @>)
+    
+    // Test basic type splicing
+
+    let f8385 (x:'a) (y:string) = <@ (x,y) @>
+    check "type splice 1" (f8385 1 "a") <@ (1,"a") @>
+    check "type splice 2" (f8385 "b" "a") <@ ("b","a") @>
+
+    test "check TryGetReflectedDefinition (local f)" ((<@ f 1 @> |> (function  Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false)))
+
+    test "check TryGetReflectedDefinition (local recursive f2)" 
+        ((<@ f2 1 @> |> (function Call(None,minfo,args)  -> Quotations.Expr.TryGetReflectedDefinition(minfo) <> None | _ -> false))) 
+
+
+    test "check lambda closed"       (Seq.length ((<@ (fun (x:int)  -> 1) @>).GetFreeVars()) = 0)
+    test "check for loop closed"         (Seq.length ((<@ for i = 1 to 10 do () done @>).GetFreeVars()) = 0)
+    test "check while loop closed"       (Seq.length ((<@ while true do () done @>).GetFreeVars()) = 0)
+    test "check let rec closed"          (Seq.length ((<@ let rec f (x:int) = f (f x) in f @>).GetFreeVars()) = 0)
+
+    // Check we can use ReflectedDefinition on a floating point pattern match
+    type T = | A of float
+
+    
+    test "check NewUnionCase"   (<@ A(1.0) @> |> (function NewUnionCase(unionCase,args) -> true | _ -> false))
+    
+
+    [<ReflectedDefinition>]
+    let foo v = match v with  | A(1.0) -> 0 | _ -> 1
+      
+    test "check TryGetReflectedDefinition (local f)" 
+        ((<@ foo (A(1.0)) @> |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false))) 
+
+    [<ReflectedDefinition>]
+    let test3297327 v = match v with  | A(1.0) -> 0 | _ -> 1
+      
+    test "check TryGetReflectedDefinition (local f)" 
+        ((<@ foo (A(1.0)) @> |> (function Call(None,minfo,args) -> Quotations.Expr.TryGetReflectedDefinition(minfo).IsSome | _ -> false))) 
+
+    type Foo() =
+       let source = [1;2;3]
+       [<ReflectedDefinition>]
+       let foo() = source
+       let bar() =
+            let b = <@ source @>
+            b
+       member __.Bar = bar()
+       [<ReflectedDefinition>]
+       member x.Z() = source
+
+
+    test "check accesses to implicit fields in ReflectedDefinitions" 
+        begin
+            let foo = Foo()
+            match foo.Bar with
+            |   FieldGet(Some (Value (v,t)), _) -> Object.ReferenceEquals(v, foo)
+            |   _ -> false
+        end
+
+end
+
+(*
+module SubstiutionTest = begin
+  let tm = (<@ (fun x y -> x + y + y) @>)
+  // TEST INVALID - this match fails because a variable is escaping.
+  let Some(x,y,y') = Template <@. (fun x y -> _ + _ + _) .@> tm
+  let Some(xyy) = Template <@. (fun (x:int) (y:int) -> _) .@> tm
+  test "check free vars (tm)" (List.length (freeInExpr tm.Raw) = 0)
+  test "check free vars (x)" (List.length (freeInExpr x.Raw) = 1)
+  test "check free vars (y)" (List.length (freeInExpr y.Raw) = 1)
+  test "check free vars (xyy)" (List.length (freeInExpr xyy.Raw) = 2)
+  
+
+  let Some xv = Var.Query(x.Raw)
+  let Some body = Template <@. (fun x -> _) .@> tm
+  test "check free vars (body)" (List.length (freeInExpr body.Raw) = 1)
+  let body2 = substitute (fun _ -> None) (fun v -> if v = xv then (printf "Yes!\n"; Some((<@ 1 @>).Raw)) else None) body
+  test "check free vars (body2)" (List.length (freeInExpr body2.Raw) = 0)
+  let body3 = substitute (fun _ -> None) (fun v -> if v = xv then Some y.Raw else None) body
+  test "check free vars (body3)" (List.length (freeInExpr body3.Raw) = 1)
+
+end
+*)
+
+(*
+
+module TomasP = begin
+    open Microsoft.FSharp.Quotations
+    open Microsoft.FSharp.Quotations.Patterns
+
+    let ex1 = <@ 1 + 2 @>
+    let ex2 = <@ 1 + 10/5 @>
+
+    type simple_expr =
+      | Int of int
+      | Add of simple_expr * simple_expr
+      | Sub of simple_expr * simple_expr
+      | Mul of simple_expr * simple_expr
+      | Div of simple_expr * simple_expr
+
+
+    let what_is x =
+      match x with  
+        | Int32 (_) -> "number";
+        | _ -> 
+        match x with  
+          | Application(_) -> "application";
+          | _ -> 
+            "something else..."
+        
+    // Prints "number"      
+    do print_string (what_is <@ 1 @>)
+
+    // Prints "application"         
+    do print_string (what_is <@ 1 + 2 @>)
+
+    let rec parse x =
+      match x with  
+        // x contains the number so we can simply return Int(x)
+        | Int32 (x) -> Int(x); 
+        | Applications (GenericTopDnUse <@ (+) @> tyargs,[a1;a2]) -> Add(parse a1, parse a2)
+        | Applications (GenericTopDnUse <@ (-) @> tyargs,[a1;a2]) -> Sub(parse a1, parse a2)
+        | Applications (GenericTopDnUse <@ ( * ) @> tyargs,[a1;a2]) -> Mul(parse a1, parse a2)
+        | Applications (GenericTopDnUse <@ ( / ) @> tyargs,[a1;a2]) -> Div(parse a1, parse a2)
+        | _ -> failwith "parse"
+
+    let a = 1
+    let q = <@ if (a = 0) then 1 else 2 @>
+    let ex4 = 
+     match q with
+      | IfThenElse (cond,trueBranch,falseBranch) ->
+          // cond        - 'expr' that represents condition
+          // trueBranch  - 'expr' that represents the true branch
+          // falseBranch - 'expr' that represents the false branch
+          print_string "If-then-else statement"
+          
+      | _ -> 
+          print_string "Something else"
+
+    type a = | B of string
+    [<ReflectedDefinition>]
+    let processStuff sequence = Seq.iter (function B packet -> ()) sequence
+
+end
+
+module ErrorEstimateTest = 
+    open Quotations
+    open Quotations.Expr
+
+    //let f x = x + 2.0*x*x
+    //let t = <@ fun x -> x + 2*x*x @>
+
+    type Error = Err of float
+
+    let rec errorEstimateAux t (env : Map<_,_>) = 
+        match t with 
+        | GenericTopDnApp <@ (+) @> (tyargs,[xt;yt]) -> 
+            let x,Err(xerr) = errorEstimateAux xt env
+            let y,Err(yerr) = errorEstimateAux yt env
+            (x+y,Err(xerr+yerr))
+        | GenericTopDnApp <@ (-) @> (tyargs,[xt;yt]) -> 
+            let x,Err(xerr) = errorEstimateAux xt env
+            let y,Err(yerr) = errorEstimateAux yt env
+            (x-y,Err(xerr+yerr))
+        | GenericTopDnApp <@ ( * ) @> (tyargs,[xt;yt]) -> 
+            let x,Err(xerr) = errorEstimateAux xt env
+            let y,Err(yerr) = errorEstimateAux yt env
+            
+            (x*y,Err(xerr*abs(y)+yerr*abs(x)+xerr*yerr))
+
+        // TBD...        
+        | GenericTopDnApp <@ ( / ) @> (tyargs,[xt;yt]) ->
+            let x,Err(xerr) = errorEstimateAux xt env
+            let y,Err(yerr) = errorEstimateAux yt env
+            // check:
+            (x/y,Err(abs((y*xerr - yerr*x)/(y+yerr))))
+            
+        | GenericTopDnApp <@ abs @> (tyargs,[xt]) -> 
+            let x,Err(xerr) = errorEstimateAux xt env
+            (abs(x),Err(xerr))
+        | Let((var,vet), bodyt) -> 
+            let varv,verr = errorEstimateAux vet env
+            errorEstimateAux bodyt (env.Add(var.Name,(varv,verr)))
+
+        | App(ResolvedTopDnUse(info,Lambda(v,body)),arg) -> 
+            errorEstimateAux  (MkLet((v,arg),body)) env
+        | Var(x) -> env.[x]
+        | Double(n) -> (n,Err(0.0))       
+        | _ -> failwithf "unrecognized term: %A" t
+
+
+    let rec errorEstimateFun (t : Expr) = 
+        match t with 
+        | Lambda(x,t) ->
+            (fun xv -> errorEstimateAux t (Map.ofSeq [(x.Name,xv)]))
+        | ResolvedTopDnUse(info,body) -> 
+            errorEstimateFun body 
+        | _ -> failwithf "unrecognized term: %A - expected a lambda" t
+
+
+
+    let errorEstimate (t : Expr<float -> float>) = errorEstimateFun t.Raw 
+
+    let rec errorEstimate2 (t : Expr<float -> float -> float>) = 
+        match t.Raw with 
+        | Lambdas([x;y],t) ->
+            (fun xv yv -> errorEstimateAux t (Map.ofSeq [(x.Name,xv); (y.Name,yv)]))
+        | _ -> failwithf "unrecognized term: %A - expected a lambda of two args" t
+
+    let (±) x = Err(x)
+    //fsi.AddPrinter (fun (x,Err(v)) -> sprintf "%g±%g" x v)
+
+    errorEstimate <@ fun x -> x @> (1.0,±0.1)
+    errorEstimate <@ fun x -> 2.0*x @> (1.0,±0.1)
+    errorEstimate <@ fun x -> x*x @> (1.0,±0.1)
+    errorEstimate <@ fun x -> 1.0/x @> (0.5,±0.1)
+
+    errorEstimate <@ fun x -> let y = x + x 
+                              y*y + 2.0 @> (1.0,±0.1)
+
+    errorEstimate <@ fun x -> x+2.0*x+3.0*x*x @> (1.0,±0.1)
+
+    errorEstimate <@ fun x -> x+2.0*x+3.0/(x*x) @> (0.3,±0.1)
+
+    [<ReflectedDefinition>]
+    let poly x = x+2.0*x+3.0/(x*x)
+
+    errorEstimate <@ poly @> (0.3,±0.1)
+    errorEstimate <@ poly @> (30271.3,±0.0001)
+*)
+module Test72594 =
+    let effect (i:int) = ()
+    let foo () = ()
+    let foo1 () =         
+        let i = 1 // prevent uncurring of foo1
+        fun () -> ()    
+    let foo2 () () = ()
+
+    type C() =
+        member this.CFoo() () = ()
+    let c = C()
+
+    test "test72594-effect"
+        (<@ foo (effect 1) @> 
+            |> function (Sequential
+                            ((Call(None,mi1,[Value(v, t)])), 
+                             (Call(None,mi2,[])))) when mi1.Name = "effect" && t = typeof<int> && v = box 1 && mi2.Name = "foo" -> true 
+                      | _ -> false)
+
+    test "test72594-no-effect"
+        (<@ foo () @> |> function (Call(None,mi2,[])) when mi2.Name = "foo"-> true | _ -> false)
+
+    test "test72594-curried"
+       (<@ foo1 (effect 1) () @> 
+        |> function Application(Sequential( 
+                                    (Call (None, effect, [Value(v1,tInt)])),
+                                    (Call (None, foo1,[]))), Value (vUnit,tUnit)) 
+                                        when effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && vUnit = box () && tUnit = typeof<unit> && foo1.Name = "foo1" -> true
+                    | _ -> false)
+
+
+    test "test72594-curried-2nd-arg"
+       (<@ foo1 () (effect 1) @> 
+        |> function Application(Call(None, foo1,[]),Call (None, effect, [Value(v1,tInt)]))
+
+                                        when effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && foo1.Name = "foo1" -> true
+                    | x -> 
+                        printfn "%A" x
+                        false)
+
+
+    test "test72594-uncurried" 
+       (<@ foo2 (effect 1) () @> 
+        |> function (Call(None, foo2, [Call(None,effect,[Value(v1,tInt)]);Value(vUnit,tUnit)])) 
+                        when effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && vUnit = box () && tUnit = typeof<unit> && foo2.Name = "foo2" -> true
+                    | _ -> false)
+
+    test "test72594-uncurried-2nd-arg" 
+       (<@ foo2 () (effect 1) @> 
+        |> function (Call(None, foo2, [Value(vUnit,tUnit);Call(None,effect,[Value(v1,tInt)])])) 
+                        when effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && vUnit = box () && tUnit = typeof<unit> && foo2.Name = "foo2" -> true
+                    | _ -> false)
+
+    test "test72594-member-curried"
+       (<@ c.CFoo (effect 1) () @> 
+        |> function Application (Application (Lambda (_,
+                                                Lambda (_,
+                                                    Call (Some _, cFoo, [_; _]))),
+                                                Call (None, effect, [Value (v1,tInt)])), Value (vUnit,tUnit)) 
+                        when cFoo.Name="CFoo" && effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && vUnit = box () && tUnit = typeof<unit> -> true
+                    | _ -> false)
+    test "test72594-member-curried-2nd-arg"
+       (<@ c.CFoo () (effect 1) @> 
+        |> function Application (Application (Lambda (_,
+                                                Lambda (_,
+                                                    Call (Some _, cFoo, [_; _]))),
+                                                    Value (vUnit,tUnit)),
+                                                Call (None, effect, [Value (v1,tInt)]))
+                        when cFoo.Name="CFoo" && effect.Name = "effect" && v1 = box 1 && tInt = typeof<int> && vUnit = box () && tUnit = typeof<unit> -> true
+                    | _ -> false)
+
+module Test414894 = 
+
+    let effect(a : int) = ()
+    
+    let foo() = ()
+
+    let f () () = ()
+    let f1 (x:int) () =  ()
+    let f2 () (x:int) =  ()
+
+
+    type X() =
+        static member f1 () = ()
+        static member f2 () () = () 
+        static member f3 (x:int) () =  ()
+        static member f4 () (x:int) = ()
+        member x.f5 () = ()
+        member x.f6 () () = ()
+        member x.f7 (a:int) () = ()
+        member x.f8 () (a:int) = ()
+    
+    let x = X()
+
+    let (|IntVal|_|) expected = 
+        function
+        | Value(v, ty) when ty = typeof<int> && expected = unbox<int> v  -> Some() 
+        | _ -> None
+
+    let (|UnitVal|_|) = 
+        function
+        | Value(v, ty) when v = box () && ty = typeof<unit> -> Some() 
+        | _ -> None
+
+    let (|EffectCall|_|) = 
+        function
+        | Call(_, m, _) when m.Name = "effect" -> Some()
+        | _ -> None
+
+    test "test414894"
+        (
+            <@ foo @>
+            |> function 
+                | Lambda(_, Call(None, mFoo, [])) when mFoo.Name = "foo" -> true
+                | _ -> false
+        )
+    test "Test414894-2curried-unit-args-1-1"
+        (
+            <@ f @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f" -> true 
+                | _ -> false
+        )
+    test "Test414894-2curried-args-1-2"
+        (
+            <@ f () @>
+            |> function 
+                | Let(_, UnitVal, Lambda(_, Call(_, mi, args))) when mi.Name = "f" -> true
+                | _ -> false
+        )
+    test "Test414894-2curried-args-1-3"
+        (
+            <@ f (effect 1) @>
+            |> function 
+                | Let(_, EffectCall, Lambda(_, Call(_, mi, args))) when mi.Name = "f" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-2-1"
+        (
+            <@ f1 @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f1" -> true 
+                | _ -> false
+        )
+    test "Test414894-2curried-args-2-2"
+        (
+            <@ f1 1 @>
+            |> function 
+                | Let(_, IntVal 1, Lambda(_, Call(_, mi, args))) when mi.Name = "f1" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-3-1"
+        (
+            <@ f2 @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f2" -> true 
+                | _ -> false
+        )
+    test "Test414894-2curried-args-3-2"
+        (
+            <@ f2 () @>
+            |> function 
+                | Let(_, UnitVal, Lambda(_, Call(_, mi, args))) when mi.Name = "f2" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-3-3"
+        (
+            <@ f2 (effect 1) @>
+            |> function 
+                | Let(_, EffectCall, Lambda(_, Call(_, mi, args))) when mi.Name = "f2" -> true
+                | _ -> false
+        )
+    
+    test "Test414894-2curried-args-static-member-1-1"
+        (
+            <@ X.f1 @>
+            |> function 
+                | Lambda(_, Call(None, mFoo, [])) when mFoo.Name = "f1" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-2-1"
+        (
+            <@ X.f2  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f2" -> true 
+                | _ -> false
+        )
+    test "Test414894-2curried-args-static-member-2-2"
+        (
+            <@ X.f2 ()  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(None, mi, _))), UnitVal) when mi.Name = "f2" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-2-3"
+        (
+            <@ X.f2 (effect 1)  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(None, mi, _))), EffectCall) when mi.Name = "f2" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-3-1"
+        (
+            <@ X.f3  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f3" -> true 
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-3-2"
+        (
+            <@ X.f3 5  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(None, mi, _))), IntVal 5) when mi.Name = "f3" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-4-1"
+        (
+            <@ X.f4  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(_, mi, args))) when mi.Name = "f4" -> true 
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-4-2"
+        (
+            <@ X.f4 ()  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(None, mi, _))), UnitVal) when mi.Name = "f4" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-static-member-4-3"
+        (
+            <@ X.f4 (effect 1)  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(None, mi, _))), EffectCall) when mi.Name = "f4" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-5-1"
+        (
+            <@ x.f5 @>
+            |> function 
+                | Lambda(_, Call(Some _, mFoo, [])) when mFoo.Name = "f5" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-6-1"
+        (
+            <@ x.f6  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(Some _, mi, args))) when mi.Name = "f6" -> true 
+                | _ -> false
+        )
+    test "Test414894-2curried-args-instance-member-6-2"
+        (
+            <@ x.f6 ()  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(Some _, mi, _))), UnitVal) when mi.Name = "f6" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-6-3"
+        (
+            <@ x.f6 (effect 1)  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(Some _, mi, _))), EffectCall) when mi.Name = "f6" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-7-1"
+        (
+            <@ x.f7  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(Some _, mi, args))) when mi.Name = "f7" -> true 
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-7-2"
+        (
+            <@ x.f7 5  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(Some _, mi, _))), IntVal 5) when mi.Name = "f7" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-8-1"
+        (
+            <@ x.f8  @>
+            |> function 
+                | Lambda(_, Lambda(_, Call(Some _, mi, args))) when mi.Name = "f8" -> true 
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-8-2"
+        (
+            <@ x.f8 ()  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(Some _, mi, _))), UnitVal) when mi.Name = "f8" -> true
+                | _ -> false
+        )
+
+    test "Test414894-2curried-args-instance-member-8-3"
+        (
+            <@ x.f8 (effect 1)  @>
+            |> function 
+                | Application(Lambda(_, Lambda(_, Call(Some _, mi, _))), EffectCall) when mi.Name = "f8" -> true
+                | _ -> false
+        )
+
+module MoreTests = 
+
+
+    open Microsoft.FSharp.Quotations
+
+    module OneModule =
+        let ModuleFunctionNoArgs() = 1
+        let ModuleFunctionOneArg(x:int) = 1
+        let ModuleFunctionOneUnitArg(x:unit) = 1
+        let ModuleFunctionOneTupledArg(x:int*int) = 1
+        let ModuleFunctionTwoArgs(x:int,y:int) = 1
+    
+    
+    type ClassOneArg(a:int) = 
+        static member TestStaticMethodOneTupledArg(x:int*int) = 1
+        static member TestStaticMethodOneArg(x:int) = x
+        static member TestStaticMethodNoArgs() = 1
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        static member TestStaticProp = 3
+        member c.TestInstanceProp = 3
+        member c.TestInstanceIndexProp with get(idx:int) = 3
+        member c.TestInstanceSettableIndexProp with set (idx:int) (v:int) = ()
+        member c.TestInstanceSettableIndexProp2 with set (idx1:int, idx2:int) (v:int) = ()
+        member c.TestInstanceMethodNoArgs() = 1
+        member c.TestInstanceMethodOneArg(x:int) = x
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+        member this.GetterIndexer
+            with get (x:int) = 1
+
+        member this.TupleGetterIndexer
+            with get (x:int*int) = 1
+
+        member this.Item
+            with get (x:int) = 1
+                
+        member this.TupleSetterIndexer
+            with get (x : int*int) = 1
+
+        member this.SetterIndexer
+            with set (x:int) (y:int) = ()
+
+        member this.Item
+            with set (x:int) (y:int) = ()
+            
+        member this.Setter
+            with set (x : int) = ()
+                
+        member this.TupleSetter
+            with set (x : int*int) = ()
+
+
+    type ClassNoArg() = 
+        static member TestStaticMethodOneTupledArg(x:int*int) = x
+        static member TestStaticMethodOneArg(x:int) = x
+        static member TestStaticMethodNoArgs() = 1
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        static member TestStaticProp = 3
+        static member TestStaticSettableProp with set (v:int) = ()
+        static member TestStaticSettableIndexProp with set (idx:int) (v:int) = ()
+        member c.TestInstanceProp = 3
+        member c.TestInstanceIndexProp with get(idx:int) = 3
+        member c.TestInstanceSettableIndexProp with set (idx:int) (v:int) = ()
+        member c.TestInstanceMethodNoArgs() = 1
+        member c.TestInstanceMethodOneArg(x:int) = x
+        member c.TestInstanceMethodOneTupledArg(x:int*int) = 1
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+    type GenericClassNoArg<'a>() = 
+        static member TestStaticMethodOneTupledArg(x:int*int) = x
+        static member TestStaticMethodOneArg(x:int) = x
+        static member TestStaticMethodNoArgs() = 1
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        static member TestStaticProp = 3
+        member c.TestInstanceProp = 3
+        member c.TestInstanceIndexProp with get(idx:int) = 3
+        member c.TestInstanceSettableIndexProp with set (idx:int) (v:int) = ()
+        member c.TestInstanceMethodNoArgs() = 1
+        member c.TestInstanceMethodOneArg(x:int) = x
+        member c.TestInstanceMethodOneTupledArg(x:int*int) = 1
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+
+    let isMeth (inp : Expr<_>) = match inp with Call _ -> true | _ -> false
+    let isPropGet (inp : Expr<_>) = match inp with PropertyGet _ -> true | _ -> false
+    let isPropSet (inp : Expr<_>) = match inp with PropertySet _ -> true | _ -> false
+
+    //printfn "res = %b" (isPropGet <@ ClassOneArg.TestStaticProp @>)
+    test "test3931a" (isMeth <@ OneModule.ModuleFunctionNoArgs() @>)
+    test "test3931a" (isMeth <@ OneModule.ModuleFunctionOneArg(1) @>)
+    test "test3931a" (isMeth <@ OneModule.ModuleFunctionOneUnitArg() @>)
+    test "test3931a" (isMeth <@ OneModule.ModuleFunctionTwoArgs(1,2) @>)
+    test "test3931a" (isMeth <@ OneModule.ModuleFunctionOneTupledArg(1,2) @>)
+    let p = (1,2)
+    // This case doesn't match because F# performs type-base arity analysis for module 'let' bindings
+    // and we see this untupling here.
+    // Thus this is elaborated into 'let v = p in let v1 = p#1 in let v2 = p#2 in f(v1,v2)'
+    // test "test3931a" (isMeth <@ OneModule.ModuleFunctionOneTupledArg(p) @>)
+         
+    //printfn "res = %b" (isPropGet <@ ClassOneArg.TestStaticProp @>)
+    test "test3932a" (isMeth <@ ClassOneArg.TestStaticMethodOneArg(3) @>)
+    test "test3932f" (isMeth <@ ClassOneArg.TestStaticMethodNoArgs() @>)
+    test "test3932g" (isMeth <@ ClassOneArg.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "test3932qA" (isPropGet <@ ClassOneArg(3).TestInstanceProp @>)
+    test "test3932qB" (isPropGet <@ ClassOneArg(3).TestInstanceIndexProp(4) @>)
+    test "test3932qC" (isPropSet <@ ClassOneArg(3).TestInstanceSettableIndexProp(4) <- 5 @>)
+    test "test3932qD" (isPropSet <@ ClassOneArg(3).TestInstanceSettableIndexProp2(4,5) <- 6 @>)
+    test "test3932q77" (match <@ ClassOneArg(3).TestInstanceSettableIndexProp2(4,5) <- 6 @> with 
+                        | PropertySet(Some _, _, [Int32(4); Int32(5)], Int32(6)) -> true 
+                        | _ -> false)
+
+    test "test3932wA" (isMeth <@ ClassOneArg(3).TestInstanceMethodNoArgs() @>)
+    test "test3932wB" (isMeth <@ ClassOneArg(3).TestInstanceMethodOneArg(3) @>)
+    test "test3932e" (isMeth <@ ClassOneArg(3).TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "test3932q1" (isPropSet <@ ClassOneArg(3).Setter <- 3 @>)
+    test "test3932q2" (isPropGet <@ ClassOneArg(3).GetterIndexer(3) @>)
+    test "test3932q3" (isPropGet <@ ClassOneArg(3).[3] @>)
+    test "test3932q4" (isPropGet <@ ClassOneArg(3).TupleGetterIndexer((3,4)) @>)
+    test "test3932q5" (isPropSet <@ ClassOneArg(3).SetterIndexer(3) <- 3 @>)
+    test "test3932q61" (isPropSet <@ ClassOneArg(3).[3] <- 3 @>)
+    test "test3932q62" (match <@ ClassOneArg(3).[4] <- 5 @> with PropertySet(Some _,_, [Int32(4)], Int32(5)) -> true | _ -> false)
+    test "test3932q7" (isPropSet <@ ClassOneArg(3).TupleSetter <- (3,4) @>)
+
+
+    test "test3932" (isPropGet <@ ClassNoArg.TestStaticProp @>)
+    test "test3932" (isPropSet <@ ClassNoArg.TestStaticSettableProp <- 3 @>)
+    
+    printfn "res = %A" <@ ClassNoArg.TestStaticSettableProp <- 5 @> 
+    test "test3932q63" (match <@ ClassNoArg.TestStaticSettableProp <- 5 @> with PropertySet(None, _, [], Int32(5)) -> true | _ -> false)
+    test "test3932q64" (match <@ ClassNoArg.TestStaticSettableIndexProp(4) <- 5 @> with PropertySet(None, _, [Int32(4)], Int32(5)) -> true | _ -> false)
+    test "test3932r" (isMeth <@ ClassNoArg.TestStaticMethodOneArg(3) @>)
+    test "test3932r" (isMeth <@ ClassNoArg.TestStaticMethodOneTupledArg((3,2)) @>)
+    test "test3932r" (isMeth <@ ClassNoArg.TestStaticMethodOneTupledArg(p) @>)
+    test "test3932t" (isMeth <@ ClassNoArg.TestStaticMethodNoArgs() @>)
+    test "test3932y" (isMeth <@ ClassNoArg.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "test3932u" (isPropGet <@ ClassNoArg().TestInstanceProp @>)
+    test "test3932u" (isPropGet <@ ClassNoArg().TestInstanceIndexProp(4) @>)
+    test "test3932q65" (match <@ ClassNoArg().TestInstanceIndexProp(4) @> with PropertyGet(Some _, _, [(Int32(4))]) -> true | _ -> false)
+    test "test3932u" (isPropSet <@ ClassNoArg().TestInstanceSettableIndexProp(4) <- 5 @>)
+    test "test3932q66" (match <@ ClassNoArg().TestInstanceSettableIndexProp(4) <- 5 @> with PropertySet(Some _, _, [(Int32(4))], Int32(5)) -> true | _ -> false)
+    test "test3932i" (isMeth <@ ClassNoArg().TestInstanceMethodNoArgs() @>)
+    test "test3932i" (isMeth <@ ClassNoArg().TestInstanceMethodOneArg(3) @>)
+    test "test3932i" (isMeth <@ ClassNoArg().TestInstanceMethodOneTupledArg((3,4)) @>)
+    test "test3932i" (isMeth <@ ClassNoArg().TestInstanceMethodOneTupledArg(p) @>)
+    test "test3932o" (isMeth <@ ClassNoArg().TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "test3932" (isPropGet <@ ClassNoArg.TestStaticProp @>)
+    test "test3932rg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodOneArg(3) @>)
+    test "test3932rg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodOneTupledArg((3,4)) @>)
+    test "test3932rg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodOneTupledArg(p) @>)
+    test "test3932tg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodNoArgs() @>)
+    test "test3932yg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "test3932ug" (isPropGet <@ (GenericClassNoArg<int>()).TestInstanceProp @>)
+    test "test3932ug" (isPropGet <@ (GenericClassNoArg<int>()).TestInstanceIndexProp(4) @>)
+    test "test3932ug" (match <@ (GenericClassNoArg<int>()).TestInstanceIndexProp(4) @> with PropertyGet(Some _, _, [Int32(4)]) -> true | _ -> false)
+
+    test "test3932ig" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodNoArgs() @>)
+    test "test3932ig" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodOneArg(3) @>)
+    test "test3932ig" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodOneTupledArg((3,4)) @>)
+    test "test3932ig" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodOneTupledArg(p) @>)
+    test "test3932og" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodTwoArgs(3,4) @>)
+
+// Checks we can use ResolveMethodDn on methods marked with ReflectedDefinition attribute
+module CheckRlectedMembers = 
+    
+
+
+    open Microsoft.FSharp.Quotations
+
+    type ClassOneArg(a:int) = 
+        [<ReflectedDefinition>]
+        new () = ClassOneArg(3)
+        [<ReflectedDefinition>]
+        static member TestStaticMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        static member TestStaticMethodNoArgs() = 1
+        [<ReflectedDefinition>]
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        [<ReflectedDefinition>]
+        static member TestStaticProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+
+        [<ReflectedDefinition>]
+        member this.GetterIndexer
+            with get (x:int) = 1
+
+        [<ReflectedDefinition>]
+        member this.TupleGetterIndexer
+            with get (x:int*int) = 1
+
+        [<ReflectedDefinition>]
+        member this.Item
+            with get (x:int) = 1
+                
+        [<ReflectedDefinition>]
+        member this.TupleSetterIndexer
+            with get (x : int*int) = 1
+
+        [<ReflectedDefinition>]
+        member this.SetterIndexer
+            with set (x:int) (y:int) = ()
+
+        [<ReflectedDefinition>]
+        member this.Item
+            with set (x:int) (y:int) = ()
+            
+        [<ReflectedDefinition>]
+        member this.Setter
+            with set (x : int) = ()
+                
+        [<ReflectedDefinition>]
+        member this.TupleSetter
+            with set (x : int*int) = ()
+
+
+    [<ReflectedDefinition>]
+    type ClassOneArgOuterAttribute(a:int) = 
+        new () = ClassOneArgOuterAttribute(3)
+        static member TestStaticMethodOneArg(x:int) = x
+        static member TestStaticMethodNoArgs() = 1
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        static member TestStaticProp = 3
+        member c.TestInstanceProp = 3
+        member c.TestInstanceMethodOneArg(x:int) = x
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+
+        member this.GetterIndexer
+            with get (x:int) = 1
+
+        member this.TupleGetterIndexer
+            with get (x:int*int) = 1
+
+        member this.Item
+            with get (x:int) = 1
+                
+        member this.TupleSetterIndexer
+            with get (x : int*int) = 1
+
+        member this.SetterIndexer
+            with set (x:int) (y:int) = ()
+
+        member this.Item
+            with set (x:int) (y:int) = ()
+            
+        member this.Setter
+            with set (x : int) = ()
+                
+        member this.TupleSetter
+            with set (x : int*int) = ()
+
+    type ClassNoArg() = 
+        [<ReflectedDefinition>]
+        static member TestStaticMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        static member TestStaticMethodNoArgs() = 1
+        [<ReflectedDefinition>]
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        [<ReflectedDefinition>]
+        static member TestStaticProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+    type GenericClassNoArg<'a>() = 
+        [<ReflectedDefinition>]
+        new (x:'a) = GenericClassNoArg<_>()
+        [<ReflectedDefinition>]
+        static member TestStaticMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        static member TestStaticMethodNoArgs() = 1
+        [<ReflectedDefinition>]
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        [<ReflectedDefinition>]
+        static member TestStaticProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceProp = 3
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodOneArg(x:int) = x
+        [<ReflectedDefinition>]
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+    type ClassOneArgWithOverrideID(a:int) = 
+        [<ReflectedDefinition; >]
+        static member TestStaticMethodOneArg(x:int) = x
+        [<ReflectedDefinition; >]
+        static member TestStaticMethodNoArgs() = 1
+        [<ReflectedDefinition; >]
+        static member TestStaticMethodTwoArgs(x:int,y:int) = x+y
+        [<ReflectedDefinition; >]
+        static member TestStaticProp = 3
+        [<ReflectedDefinition; >]
+        member c.TestInstanceProp = 3
+        [<ReflectedDefinition; >]
+        member c.TestInstanceMethodOneArg(x:int) = x
+        [<ReflectedDefinition; >]
+        member c.TestInstanceMethodTwoArgs(x:int,y:int) = x + y
+
+
+    let isNewObj (inp : Expr<_>) = match inp with NewObject (ci,_) -> Expr.TryGetReflectedDefinition(ci).IsSome | _ -> false
+    let isMeth (inp : Expr<_>) = match inp with Call (_,mi,_) -> Expr.TryGetReflectedDefinition(mi).IsSome | _ -> false
+    let isPropGet (inp : Expr<_>) = match inp with PropertyGet (_,mi,_) -> Expr.TryGetReflectedDefinition(mi.GetGetMethod(true)).IsSome | _ -> false
+    let isPropSet (inp : Expr<_>) = match inp with PropertySet (_,mi,_,_) -> Expr.TryGetReflectedDefinition(mi.GetSetMethod(true)).IsSome | _ -> false
+         
+    //printfn "res = %b" (isPropGet <@ ClassOneArg.TestStaticProp @>)
+    // Note: there is a ReflectedDefinition on this constructor
+    test "testReflect39320a" (isNewObj <@ new ClassOneArg() @>)
+    test "testReflect39320ax" (isNewObj <@ new ClassOneArgOuterAttribute() @>)
+    // Note: no ReflectedDefinition on this constructor
+    test "testReflect39320b" (not (isNewObj <@ new ClassOneArg(3) @>))
+    // Note: no ReflectedDefinition on this constructor
+    test "testReflect39320c" (not (isNewObj <@ new GenericClassNoArg<int>() @>))
+    // Note: there is a ReflectedDefinition on this constructor
+    test "testReflect39320d" (isNewObj <@ new GenericClassNoArg<_>(3) @>)
+    test "testReflect3932a" (isMeth <@ ClassOneArg.TestStaticMethodOneArg(3) @>)
+    test "testReflect3932f" (isMeth <@ ClassOneArg.TestStaticMethodNoArgs() @>)
+    test "testReflect3932g" (isMeth <@ ClassOneArg.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932q" (isPropGet <@ ClassOneArg(3).TestInstanceProp @>)
+    test "testReflect3932w" (isMeth <@ ClassOneArg(3).TestInstanceMethodOneArg(3) @>)
+    test "testReflect3932e" (isMeth <@ ClassOneArg(3).TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932ax" (isMeth <@ ClassOneArgOuterAttribute.TestStaticMethodOneArg(3) @>)
+    test "testReflect3932fx" (isMeth <@ ClassOneArgOuterAttribute.TestStaticMethodNoArgs() @>)
+    test "testReflect3932gx" (isMeth <@ ClassOneArgOuterAttribute.TestStaticMethodTwoArgs(3,4) @>)
+    test "testReflect3932qx" (isPropGet <@ ClassOneArgOuterAttribute(3).TestInstanceProp @>)
+    test "testReflect3932wx" (isMeth <@ ClassOneArgOuterAttribute(3).TestInstanceMethodOneArg(3) @>)
+    test "testReflect3932ex" (isMeth <@ ClassOneArgOuterAttribute(3).TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932" (isPropGet <@ ClassNoArg.TestStaticProp @>)
+    test "testReflect3932r" (isMeth <@ ClassNoArg.TestStaticMethodOneArg(3) @>)
+    test "testReflect3932t" (isMeth <@ ClassNoArg.TestStaticMethodNoArgs() @>)
+    test "testReflect3932y" (isMeth <@ ClassNoArg.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932u" (isPropGet <@ ClassNoArg().TestInstanceProp @>)
+    test "testReflect3932i" (isMeth <@ ClassNoArg().TestInstanceMethodOneArg(3) @>)
+    test "testReflect3932o" (isMeth <@ ClassNoArg().TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932q1" (isPropSet <@ ClassOneArg(3).Setter <- 3 @>)
+    test "testReflect3932q2" (isPropGet <@ ClassOneArg(3).GetterIndexer(3) @>)
+    test "testReflect3932q3" (isPropGet <@ ClassOneArg(3).[3] @>)
+    test "testReflect3932q4" (isPropGet <@ ClassOneArg(3).TupleGetterIndexer((3,4)) @>)
+    test "testReflect3932q5" (isPropSet <@ ClassOneArg(3).SetterIndexer(3) <- 3 @>)
+    test "testReflect3932q6" (isPropSet <@ ClassOneArg(3).[3] <- 3 @>)
+    test "testReflect3932q7" (isPropSet <@ ClassOneArg(3).TupleSetter <- (3,4) @>)
+
+    test "testReflect3932q1x" (isPropSet <@ ClassOneArgOuterAttribute(3).Setter <- 3 @>)
+    test "testReflect3932q2x" (isPropGet <@ ClassOneArgOuterAttribute(3).GetterIndexer(3) @>)
+    test "testReflect3932q3x" (isPropGet <@ ClassOneArgOuterAttribute(3).[3] @>)
+    test "testReflect3932q4x" (isPropGet <@ ClassOneArgOuterAttribute(3).TupleGetterIndexer((3,4)) @>)
+    test "testReflect3932q5x" (isPropSet <@ ClassOneArgOuterAttribute(3).SetterIndexer(3) <- 3 @>)
+    test "testReflect3932q6x" (isPropSet <@ ClassOneArgOuterAttribute(3).[3] <- 3 @>)
+    test "testReflect3932q7x" (isPropSet <@ ClassOneArgOuterAttribute(3).TupleSetter <- (3,4) @>)
+
+    test "testReflect3932rg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodOneArg(3) @>)
+    test "testReflect3932tg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodNoArgs() @>)
+    test "testReflect3932yg" (isMeth <@ GenericClassNoArg<int>.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932ug" (isPropGet <@ (GenericClassNoArg<int>()).TestInstanceProp @>)
+    test "testReflect3932ig" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodOneArg(3) @>)
+    test "testReflect3932og" (isMeth <@ (GenericClassNoArg<int>()).TestInstanceMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932a" (isMeth <@ ClassOneArgWithOverrideID.TestStaticMethodOneArg(3) @>)
+    test "testReflect3932f" (isMeth <@ ClassOneArgWithOverrideID.TestStaticMethodNoArgs() @>)
+    test "testReflect3932g" (isMeth <@ ClassOneArgWithOverrideID.TestStaticMethodTwoArgs(3,4) @>)
+
+    test "testReflect3932q" (isPropGet <@ ClassOneArgWithOverrideID(3).TestInstanceProp @>)
+    test "testReflect3932w" (isMeth <@ ClassOneArgWithOverrideID(3).TestInstanceMethodOneArg(3) @>)
+    test "testReflect3932e" (isMeth <@ ClassOneArgWithOverrideID(3).TestInstanceMethodTwoArgs(3,4) @>)
+
+
+module Bug959_Regression = begin
+    open Microsoft.FSharp
+    open Microsoft.FSharp
+
+    //let f x  = <@ _ @> (lift x)
+
+    <@
+      match 1.0,"b" with
+      | 1.0, "a" ->
+        ""
+      | 2.0, "b" ->
+        ""
+      | _ -> "nada" @>
+end
+
+module MoreQuotationsTests = 
+
+    let t1 = <@@ try 1 with e when true -> 2 | e -> 3 @@>
+    printfn "t1 = %A" t1
+    check "vwjnkwve0-vwnio" 
+        (sprintf "%A" t1) 
+    "TryWith (Value (1), matchValue,
+            IfThenElse (Let (e, matchValue, Value (true)),
+                        Let (e, matchValue, Value (1)),
+                        Let (e, matchValue, Value (1))), matchValue,
+            IfThenElse (Let (e, matchValue, Value (true)),
+                        Let (e, matchValue, Value (2)),
+                        Let (e, matchValue, Value (3))))"
+
+    [<ReflectedDefinition>]
+    let k (x:int) =
+       try 1 with _ when true -> 2 | e -> 3
+
+    let t2 = <@@ Map.empty.[0] @@>
+    printfn "t2 = %A" t2
+    check "vwjnkwve0-vwnio1" 
+       (sprintf "%A" t2) 
+       "PropertyGet (Some (Call (None, Empty, [])), Item, [Value (0)])"
+
+
+    let t4 = <@@ use a = new System.IO.StreamWriter(System.IO.Stream.Null) in a @@>
+    printfn "t4 = %A" t4
+    check "vwjnkwve0-vwnio3" 
+        (sprintf "%A" t4) 
+    "Let (a, NewObject (StreamWriter, FieldGet (None, Null)),
+        TryFinally (a,
+                    IfThenElse (TypeTest (IDisposable, Coerce (a, Object)),
+                                Call (Some (Call (None, UnboxGeneric,
+                                                [Coerce (a, Object)])), Dispose,
+                                    []), Value (<null>))))"
+
+    check "vwjnkwve0-vwnio3fuull" 
+        (t4.ToString(true))
+    "Let (a,
+        NewObject (Void .ctor(System.IO.Stream),
+                FieldGet (None, System.IO.Stream Null)),
+        TryFinally (a,
+                    IfThenElse (TypeTest (System.IDisposable,
+                                        Coerce (a, System.Object)),
+                                Call (Some (Call (None,
+                                                System.IDisposable UnboxGeneric[IDisposable](System.Object),
+                                                [Coerce (a, System.Object)])),
+                                    Void Dispose(), []), Value (<null>))))"
+
+
+    let t5 = <@@ try failwith "test" with _ when true -> 0 @@>
+    printfn "t5 = %A" t5
+    
+    let t6 = <@@ let mutable a = 0 in a <- 2 @@>
+
+    printfn "t6 = %A" t6
+
+    let f (x: _ byref) = x
+
+    let t7 = <@@ let mutable a = 0 in f (&a) @@>
+    printfn "t7 = %A" t7
+    
+    let t8 = <@@ for i in 1s .. 10s do printfn "%A" i @@>
+    printfn "t8 = %A" t8
+
+    let t9 = <@@ try failwith "test" with Failure _ -> 0  @@>
+    printfn "t9 = %A" t9
+
+    let t9b = <@@ Failure "fil" @@>
+    printfn "t9b = %A" t9b
+    let t9c = <@@ match Failure "fil" with Failure msg -> msg |  _ -> "no" @@>
+    printfn "t9c = %A" t9c
+
+    let t10 = <@@ try failwith "test" with Failure _ -> 0 |  _ -> 1 @@>
+    printfn "t10 = %A" t10
+
+    let t11 = <@@ try failwith "test" with :? System.NullReferenceException -> 0 @@>
+    printfn "t11 = %A" t11
+
+    let t12 = <@@ try failwith "test" with :? System.NullReferenceException as n -> 0 @@>
+    printfn "t12 = %A" t12
+
+    let t13 = <@@ try failwith "test" with Failure _ -> 1 | :? System.NullReferenceException as n -> 0 @@>
+    printfn "t13 = %A" t13
+
+    let t14 = <@@ try failwith "test" with _ when true -> 0 @@>
+    printfn "t14 = %A" t14
+
+    let _ = <@@ let x : int option = None in x.IsSome @@> |> printfn "quote = %A" 
+    let _ = <@@ let x : int option = None in x.IsNone @@> |> printfn "quote = %A" 
+    let _ = <@@ let x : int option = None in x.Value @@> |> printfn "quote = %A" 
+    let _ = <@@ let x : int option = None in x.ToString() @@> |> printfn "quote = %A" 
+
+    module Extensions = 
+        type System.Object with 
+            member x.ExtensionMethod0()  = 3
+            member x.ExtensionMethod1()  = ()
+            member x.ExtensionMethod2(y:int)  = y
+            member x.ExtensionMethod3(y:int)  = ()
+            member x.ExtensionMethod4(y:int,z:int)  = y + z
+            member x.ExtensionMethod5(y:(int*int))  = y 
+            member x.ExtensionProperty1 = 3
+            member x.ExtensionProperty2 with get() = 3
+            member x.ExtensionProperty3 with set(v:int) = ()
+            member x.ExtensionIndexer1 with get(idx:int) = idx
+            member x.ExtensionIndexer2 with set(idx:int) (v:int) = ()
+
+        type System.Int32 with 
+            member x.Int32ExtensionMethod0()  = 3
+            member x.Int32ExtensionMethod1()  = ()
+            member x.Int32ExtensionMethod2(y:int)  = y
+            member x.Int32ExtensionMethod3(y:int)  = ()
+            member x.Int32ExtensionMethod4(y:int,z:int)  = y + z
+            member x.Int32ExtensionMethod5(y:(int*int))  = y 
+            member x.Int32ExtensionProperty1 = 3
+            member x.Int32ExtensionProperty2 with get() = 3
+            member x.Int32ExtensionProperty3 with set(v:int) = ()
+            member x.Int32ExtensionIndexer1 with get(idx:int) = idx
+            member x.Int32ExtensionIndexer2 with set(idx:int) (v:int) = ()
+ 
+        let v = new obj()
+        let _ = <@@ v.ExtensionMethod0() @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod1() @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod2(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod3(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod4(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod5(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionProperty1 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionProperty2 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionProperty3 <- 4 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionIndexer1(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionIndexer2(3) <- 4 @@> |> printfn "quote = %A"
+
+        let _ = <@@ v.ExtensionMethod0 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod1 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod2 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod3 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod4 @@> |> printfn "quote = %A"
+        let _ = <@@ v.ExtensionMethod5 @@> |> printfn "quote = %A"
+
+        let v2 = 3
+        let _ = <@@ v2.ExtensionMethod0() @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod1() @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod2(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod3(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod4(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod5(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionProperty1 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionProperty2 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionProperty3 <- 4 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionIndexer1(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionIndexer2(3) <- 4 @@> |> printfn "quote = %A"
+
+        let _ = <@@ v2.ExtensionMethod0 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod1 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod2 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod3 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod4 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.ExtensionMethod5 @@> |> printfn "quote = %A"
+
+        let _ = <@@ v2.Int32ExtensionMethod0() @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod1() @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod2(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod3(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod4(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod5(3,4) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionProperty1 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionProperty2 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionProperty3 <- 4 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionIndexer1(3) @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionIndexer2(3) <- 4 @@> |> printfn "quote = %A"
+
+        let _ = <@@ v2.Int32ExtensionMethod0 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod1 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod2 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod3 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod4 @@> |> printfn "quote = %A"
+        let _ = <@@ v2.Int32ExtensionMethod5 @@> |> printfn "quote = %A"
+
+
+module QuotationConstructionTests = 
+    let arr = [| 1;2;3;4;5 |]
+    let f : int -> int = printfn "hello"; (fun x -> x)
+    let f2 : int * int -> int -> int = printfn "hello"; (fun (x,y) z -> x + y + z)
+    let F (x:int) = x
+    let F2 (x:int,y:int) (z:int) = x + y + z
+
+    type Foo () =
+        member t.Item with get (index:int) = 1
+                      and set (index:int) (value:int) = ()
+
+    let ctorof q = match q with Patterns.NewObject(cinfo,_) -> cinfo | _ -> failwith "ctorof"
+    let methodof q = match q with DerivedPatterns.Lambdas(_,Patterns.Call(_,minfo,_)) -> minfo | _ -> failwith "methodof"
+    let fieldof q = match q with Patterns.FieldGet(_,finfo) -> finfo | _ -> failwith "fieldof"
+    let ucaseof q = match q with Patterns.NewUnionCase(ucinfo,_) -> ucinfo | _ -> failwith "ucaseof"
+    let getof q = match q with Patterns.PropertyGet(_,pinfo,_) -> pinfo | _ -> failwith "getof"
+    let setof q = match q with Patterns.PropertySet(_,pinfo,_,_) -> pinfo | _ -> failwith "setof"
+    check "vcknwwe01" (match Expr.AddressOf <@@ arr.[3] @@> with AddressOf(expr) -> expr = <@@ arr.[3] @@> | _ -> false) true
+    check "vcknwwe02" (match Expr.AddressSet (Expr.AddressOf <@@ arr.[3] @@>, <@@ 4 @@>) with AddressSet(AddressOf(expr),v) -> expr = <@@ arr.[3] @@> && v = <@@ 4 @@> | _ -> false) true
+    check "vcknwwe03" (match Expr.Application(<@@ f @@>,<@@ 5 @@>) with Application(f1,x) -> f1 = <@@ f @@> && x = <@@ 5 @@> | _ -> false) true
+    check "vcknwwe04" (match Expr.Applications(<@@ f @@>,[[ <@@ 5 @@> ]]) with Applications(f1,[[x]]) -> f1 = <@@ f @@> && x = <@@ 5 @@> | _ -> false) true
+    check "vcknwwe05" (match Expr.Applications(<@@ f2 @@>,[[ <@@ 5 @@>;<@@ 6 @@> ]; [ <@@ 7 @@> ]]) with Applications(f1,[[x;y];[z]]) -> f1 = <@@ f2 @@> && x = <@@ 5 @@> && y = <@@ 6 @@> && z = <@@ 7 @@>  | _ -> false) true
+    check "vcknwwe06" (match Expr.Call(methodof <@@ F2 @@>,[ <@@ 5 @@>;<@@ 6 @@>; <@@ 7 @@> ]) with Call(None,minfo,[x;y;z]) -> minfo = methodof <@@ F2 @@> && x = <@@ 5 @@> && y = <@@ 6 @@> && z = <@@ 7 @@>  | _ -> false) true
+    check "vcknwwe07" (Expr.Cast(<@@ 5 @@>) : Expr<int>) (<@ 5 @>)
+    check "vcknwwe08" (try let _ = Expr.Cast(<@@ 5 @@>) : Expr<string> in false with :? System.ArgumentException -> true) true
+    check "vcknwwe09" (match Expr.Coerce(<@@ 5 @@>, typeof<obj>) with Coerce(q,ty) -> ty = typeof<obj> && q = <@@ 5 @@> | _ -> false) true
+    check "vcknwwe0q" (match Expr.DefaultValue(typeof<obj>) with DefaultValue(ty) -> ty = typeof<obj> | _ -> false) true
+    check "vcknwwe0w" (match Expr.FieldGet(typeof<int>.GetField("MaxValue")) with FieldGet(None,finfo) -> finfo = typeof<int>.GetField("MaxValue") | _ -> false) true
+    check "vcknwwe0e" (match Expr.FieldSet(typeof<int>.GetField("MaxValue"),<@@ 1 @@>) with FieldSet(None,finfo,v) -> finfo = typeof<int>.GetField("MaxValue") && v = <@@ 1 @@> | _ -> false) true
+    check "vcknwwe0r" (match Expr.ForIntegerRangeLoop(Var.Global("i",typeof<int>),<@@ 1 @@>,<@@ 10 @@>,<@@ () @@>) with ForIntegerRangeLoop(v,start,finish,body) -> v = Var.Global("i",typeof<int>) && start = <@@ 1 @@> && finish = <@@ 10 @@> && body = <@@ () @@>  | _ -> false) true
+    check "vcknwwe0t" (match Expr.GlobalVar("i") : Expr<int> with Var(v) -> v = Var.Global("i",typeof<int>)   | _ -> false) true
+    check "vcknwwe0y" (match Expr.IfThenElse(<@@ true @@>,<@@ 1 @@>,<@@ 2 @@>) with IfThenElse(gd,t,e) -> gd = <@@ true @@> && t = <@@ 1 @@> && e = <@@ 2 @@>   | _ -> false) true
+    check "vcknwwe0u" (match Expr.Lambda(Var.Global("i",typeof<int>), <@@ 2 @@>) with Lambda(v,b) -> v = Var.Global("i",typeof<int>) && b = <@@ 2 @@>   | _ -> false) true
+    check "vcknwwe0i" (match Expr.Let(Var.Global("i",typeof<int>), <@@ 2 @@>, <@@ 3 @@>) with Let(v,e,b) -> v = Var.Global("i",typeof<int>) && e = <@@ 2 @@> && b = <@@ 3 @@>   | _ -> false) true
+    check "vcknwwe0o" (match Expr.LetRecursive([(Var.Global("i",typeof<int>), <@@ 2 @@>)], <@@ 3 @@>) with LetRecursive([(v,e)],b) -> v = Var.Global("i",typeof<int>) && e = <@@ 2 @@> && b = <@@ 3 @@>   | _ -> false) true
+    check "vcknwwe0p" (match Expr.LetRecursive([(Var.Global("i",typeof<int>), <@@ 2 @@>);(Var.Global("j",typeof<int>), <@@ 3 @@>)], <@@ 3 @@>) with LetRecursive([(v1,e1);(v2,e2)],b) -> v1 = Var.Global("i",typeof<int>) && v2 = Var.Global("j",typeof<int>) && e1 = <@@ 2 @@> && e2 = <@@ 3 @@> && b = <@@ 3 @@>   | _ -> false) true
+    check "vcknwwe0a" (Expr.NewArray(typeof<int>,[ <@@ 1 @@>; <@@ 2 @@> ])) <@@ [| 1;2 |] @@>
+    check "vcknwwe0s" (match Expr.NewDelegate(typeof<Action<int>>,[ Var.Global("i",typeof<int>) ], <@@ () @@>) with NewDelegate(ty,[v],e) -> ty = typeof<Action<int>> && v = Var.Global("i",typeof<int>) && e = <@@ () @@> | _ -> false) true
+    check "vcknwwe0d" (match Expr.NewObject(ctorof <@@ new obj() @@> ,[ ]) with NewObject(ty,[]) -> ty = ctorof <@@ new obj() @@> | _ -> false) true
+    check "vcknwwe0f" (match Expr.NewObject(ctorof <@@ new System.String('a',3) @@> ,[ <@@ 'b' @@>; <@@ 4 @@>]) with NewObject(ty,[x;y]) -> ty = ctorof <@@ new string('a',3) @@> && x = <@@ 'b' @@> && y = <@@ 4 @@> | _ -> false) true
+    check "vcknwwe0g" (Expr.NewRecord(typeof<int ref> ,[ <@@ 4 @@> ])) <@@ { contents = 4 } @@>
+    check "vcknwwe0h" (try let _ = Expr.NewTuple([]) in false with :? System.ArgumentException -> true) true
+    check "vcknwwe0j" (try let _ = Expr.NewTuple([ <@@ 1 @@> ]) in true with :? System.ArgumentException -> false) true
+    check "vcknwwe0k" (match Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>]) with NewTuple([x;y]) -> x = <@@ 'b' @@> && y = <@@ 4 @@> | _ -> false) true
+    check "vcknwwe0l" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>])) <@@ ('b',4) @@>
+    check "vcknwwe0z" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>])) <@@ ('b',4,5) @@>
+    check "vcknwwe0x" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>])) <@@ ('b',4,5,6) @@>
+    check "vcknwwe0c" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>; <@@ 7 @@>])) <@@ ('b',4,5,6,7) @@>
+    check "vcknwwe0v" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>; <@@ 7 @@>; <@@ 8 @@>])) <@@ ('b',4,5,6,7,8) @@>
+    check "vcknwwe0b" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>; <@@ 7 @@>; <@@ 8 @@>; <@@ 9 @@>])) <@@ ('b',4,5,6,7,8,9) @@>
+    check "vcknwwe0n" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>; <@@ 7 @@>; <@@ 8 @@>; <@@ 9 @@>; <@@ 10 @@>])) <@@ ('b',4,5,6,7,8,9,10) @@>
+    check "vcknwwe0m" (Expr.NewTuple([ <@@ 'b' @@>; <@@ 4 @@>; <@@ 5 @@>; <@@ 6 @@>; <@@ 7 @@>; <@@ 8 @@>; <@@ 9 @@>; <@@ 10 @@>])) <@@ ('b',4,5,6,7,8,9,10) @@>
+    check "vcknwwe011" (Expr.NewUnionCase(ucaseof <@@ Some(3) @@>,[ <@@ 4 @@> ])) <@@ Some(4) @@>
+    check "vcknwwe022" (Expr.NewUnionCase(ucaseof <@@ None @@>,[  ])) <@@ None @@>
+    check "vcknwwe033" (try let _ = Expr.NewUnionCase(ucaseof <@@ Some(3) @@>,[  ]) in false with :? ArgumentException -> true) true
+    check "vcknwwe044" (try let _ = Expr.NewUnionCase(ucaseof <@@ None @@>,[ <@@ 1 @@> ]) in false with :? ArgumentException -> true) true
+    check "vcknwwe055" (Expr.PropertyGet(getof <@@ System.DateTime.Now @@>,[  ])) <@@ System.DateTime.Now @@>
+    check "vcknwwe066" (try let _ = Expr.PropertyGet(getof <@@ System.DateTime.Now @@>,[ <@@ 1 @@> ]) in false with :? ArgumentException -> true) true
+    check "vcknwwe077" (Expr.PropertyGet(<@@ "3" @@>, getof <@@ "1".Length @@>)) <@@ "3".Length @@>
+    check "vcknwwe088" (Expr.PropertyGet(<@@ "3" @@>, getof <@@ "1".Length @@>,[  ])) <@@ "3".Length @@>
+    #if Portable
+    #else
+    check "vcknwwe099" (Expr.PropertySet(<@@ (new System.Windows.Forms.Form()) @@>, setof <@@ (new System.Windows.Forms.Form()).Text <- "2" @@>, <@@ "3" @@> )) <@@ (new System.Windows.Forms.Form()).Text <- "3" @@>
+    #endif
+    check "vcknwwe099" (Expr.PropertySet(<@@ (new Foo()) @@>, setof <@@ (new Foo()).[3] <- 1 @@>, <@@ 2 @@> , [ <@@ 3 @@> ] )) <@@ (new Foo()).[3] <- 2 @@>
+    check "vcknwwe0qq" (Expr.Quote(<@@ "1" @@>)) <@@ <@@ "1" @@> @@>
+    check "vcknwwe0ww" (Expr.Sequential(<@@ () @@>, <@@ 1 @@>)) <@@ (); 1 @@>
+    check "vcknwwe0ee" (Expr.TryFinally(<@@ 1 @@>, <@@ () @@>)) <@@ try 1 finally () @@>
+    check "vcknwwe0rr" (match Expr.TryWith(<@@ 1 @@>, Var.Global("e1",typeof<exn>), <@@ 1 @@>, Var.Global("e2",typeof<exn>), <@@ 2 @@>) with TryWith(b,v1,ef,v2,eh) -> b = <@@ 1 @@> && eh = <@@ 2 @@> && ef = <@@ 1 @@> && v1 = Var.Global("e1",typeof<exn>) && v2 = Var.Global("e2",typeof<exn>)| _ -> false) true 
+    check "vcknwwe0tt" (match Expr.TupleGet(<@@ (1,2) @@>, 0) with TupleGet(b,n) -> b = <@@ (1,2) @@> && n = 0 | _ -> false) true 
+    check "vcknwwe0yy" (match Expr.TupleGet(<@@ (1,2) @@>, 1) with TupleGet(b,n) -> b = <@@ (1,2) @@> && n = 1 | _ -> false) true 
+    check "vcknwwe0uu" (try let _ = Expr.TupleGet(<@@ (1,2) @@>, 2) in false with :? ArgumentException -> true) true
+    check "vcknwwe0ii" (try let _ = Expr.TupleGet(<@@ (1,2) @@>, -1) in false with :? ArgumentException -> true) true
+    for i = 0 to 7 do 
+        check "vcknwwe0oo" (match Expr.TupleGet(<@@ (1,2,3,4,5,6,7,8) @@>, i) with TupleGet(b,n) -> b = <@@ (1,2,3,4,5,6,7,8) @@> && n = i | _ -> false) true 
+    check "vcknwwe0pp" (match Expr.TypeTest(<@@ new obj() @@>, typeof<string>) with TypeTest(e,ty) -> e = <@@ new obj() @@> && ty = typeof<string> | _ -> false) true
+    check "vcknwwe0aa" (match Expr.UnionCaseTest(<@@ [] : int list @@>, ucaseof <@@ [] : int list @@> ) with UnionCaseTest(e,uc) -> e = <@@ [] : int list @@> && uc = ucaseof <@@ [] : int list @@>  | _ -> false) true
+    check "vcknwwe0ss" (Expr.Value(3)) <@@ 3 @@>
+    check "vcknwwe0dd" (match Expr.Var(Var.Global("i",typeof<int>)) with Var(v) -> v = Var.Global("i",typeof<int>) | _ -> false) true
+    check "vcknwwe0ff" (match Expr.VarSet(Var.Global("i",typeof<int>), <@@ 4 @@>) with VarSet(v,q) -> v = Var.Global("i",typeof<int>) && q = <@@ 4 @@>  | _ -> false) true
+    check "vcknwwe0gg" (match Expr.WhileLoop(<@@ true @@>, <@@ () @@>) with WhileLoop(g,b) -> g = <@@ true @@> && b = <@@ () @@>  | _ -> false) true
+
+module EqualityOnExprDoesntFail = 
+    let q = <@ 1 @>
+    check "we09ceo" (q.Equals(1)) false
+    check "we09ceo" (q.Equals(q)) true
+    check "we09ceo" (q.Equals(<@ 1 @>)) true
+    check "we09ceo" (q.Equals(<@ 2 @>)) false
+    check "we09ceo" (q.Equals(null)) false
+    
+module EqualityOnVarDoesntFail = 
+    let v = Var.Global("c",typeof<int>)
+    let v2 = Var.Global("c",typeof<int>)
+    let v3 = Var.Global("d",typeof<int>)
+    check "we09ceo2" (v.Equals(1)) false
+    check "we09ceo2" (v.Equals(v)) true
+    check "we09ceo2" (v.Equals(v2)) true
+    check "we09ceo2" (v.Equals(v3)) false
+    check "we09ceo2" (v.Equals(null)) false
+    
+module RelatedChange3628 =
+    // Fix for 3628 translates "do x" into "do (x;())" when x is not unit typed.
+    // This regression checks the quotated form.
+
+    open System
+    open Microsoft.FSharp.Quotations
+    open Microsoft.FSharp.Quotations.Patterns
+    open Microsoft.FSharp.Quotations.DerivedPatterns
+
+    [<ReflectedDefinition>] 
+    let f (x:int) = do x
+    let (Call(None,minfo,args)) = <@ f 1 @>
+    let (Some lamexp) = Quotations.Expr.TryGetReflectedDefinition(minfo)
+    let (Lambda(v,body)) = lamexp
+    let (Sequential (a,b)) = body
+    let (Var v2) = a
+    check "RelatedChange3628.a" v v2
+    check "RelatedChange3628.b" b <@@ () @@>
+
+module Check3628 =
+  let inline fA (x:int) = (do x) 
+  let        fB (x:int) = (do x)
+  let resA = fA 12
+  let resB = fB 13
+  let mutable (z:unit) = ()
+  z <- fA 14
+  z <- fB 15
+
+module ReflectedDefinitionForPatternInputTest = 
+
+   [<ReflectedDefinition>] 
+   let [x] = [1];;
+
+module Test920236 =
+    open System.Collections
+    type Arr(a : int[]) =
+      interface IEnumerable with
+          member this.GetEnumerator() = 
+              let i = ref -1
+              { new IEnumerator with
+                  member this.Reset() = failwith "not supported"
+                  member this.MoveNext() = incr i; !i < a.Length
+                  member this.Current = box (a.[!i]) 
+              }
+    let arr = Arr([||])
+
+    let q = 
+      let a = arr
+      <@ for i in a do ignore i @>
+
+    test "Test920236"
+        (match q with
+         |    Let(e,Call(Some (Coerce(Value a, typ)), mi, []), 
+                  (TryFinally 
+                    (WhileLoop((Call (Some e1, moveNext, [])),
+                         Let(i,
+                             PropertyGet ((Some e2),piCurrent,[]),
+                             Call(None,_,[_]) // ignore
+                         )
+                    ),
+                    IfThenElse(TypeTest(Coerce(_,typObj), typDisposable),
+                               Call(Some(Call(None, unboxGeneric, [Coerce(e3,typObj2)])),disposeMI, []), Value _)
+                  ))
+                 )               
+                 when typ.FullName = "System.Collections.IEnumerable" &&
+                      mi.Name = "GetEnumerator" &&
+                      moveNext.Name = "MoveNext" && 
+                      piCurrent.Name = "Current" &&
+                      typDisposable.FullName = "System.IDisposable" &&
+                      unboxGeneric.Name = "UnboxGeneric"
+                 -> true
+         |    _ -> false)
+        
+
+module TestQuotationOfCOnstructors = 
+
+    type MyClassWithNoFields [<ReflectedDefinition>] () = 
+        member this.Bar z = ()
+
+    [<ReflectedDefinition>] 
+    type MyClassWithNoFieldsOuter () = 
+        member this.Bar z = ()
+
+    [<ReflectedDefinition>] 
+    module M = 
+        type MyClassWithNoFieldsNestedInModule () = 
+            member this.Bar z = ()
+
+        module Inner = 
+            type MyClassWithNoFieldsNestedInInnerModule () = 
+                member this.Bar z = ()
+
+            module Inner = 
+                type MyClassWithNoFieldsNestedInInnerModule () = 
+                    member this.Bar z = ()
+
+
+    type MyClassWithFields [<ReflectedDefinition>]() = 
+        let x = 12
+        let y = x
+        let w = x // note this variable is not used in any method and becomes local to the constructor
+
+        [<ReflectedDefinition>]
+        member this.Bar z = x + z + y
+
+    type MyGenericClassWithArgs<'T> [<ReflectedDefinition>](inp:'T) = 
+        let x = inp
+        let y = x
+        let w = x // note this variable is not used in any method and becomes local to the constructor
+
+        [<ReflectedDefinition>]
+        member this.Bar z = (x,y,z)
+
+    type MyGenericClassWithTwoArgs<'T> [<ReflectedDefinition>](inpA:'T, inpB:'T) = // note, inpB is captured 
+        let x = inpA
+        let y = x
+        let w = x // note this variable is not used in any method and becomes local to the constructor
+
+        [<ReflectedDefinition>]
+        member this.Bar z = (x,y,z,inpB)
+
+    type MyClassWithAsLetMethod () = 
+        [<ReflectedDefinition>]
+        let f() = 1
+
+        [<ReflectedDefinition>]
+        member this.Bar z = f()
+
+
+    [<ReflectedDefinition>]
+    type MyClassWithAsLetMethodOuter () = 
+        let f() = 1
+
+        member this.Bar z = f()
+
+
+
+    Expr.TryGetReflectedDefinition (typeof<MyClassWithNoFields>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<MyClassWithNoFieldsOuter>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<M.MyClassWithNoFieldsNestedInModule>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<M.Inner.MyClassWithNoFieldsNestedInInnerModule>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<M.Inner.Inner.MyClassWithNoFieldsNestedInInnerModule>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<MyClassWithFields>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<MyGenericClassWithArgs<int>>.GetConstructors().[0]) |> printfn "%A"
+    Expr.TryGetReflectedDefinition (typeof<MyGenericClassWithTwoArgs<int>>.GetConstructors().[0]) |> printfn "%A"
+
+
+
+    test "vkjnkvrw2"
+       (match Expr.TryGetReflectedDefinition (typeof<MyClassWithFields>.GetConstructors().[0]) with 
+        | Some 
+           (Lambda 
+              (_,Sequential 
+                   (NewObject objCtor,
+                    Sequential 
+                       (FieldSet (Some (Var thisVar0), xField1, Int32 12),
+                        Sequential 
+                           (FieldSet (Some (Var thisVar1), yField,FieldGet (Some (Var thisVar2),xField2)),
+                            Let (wVar,FieldGet (Some (Var thisVar3), xField3), Unit))))))
+            -> 
+                thisVar0 = thisVar1 && 
+                thisVar1 = thisVar2 && 
+                thisVar2 = thisVar3 && 
+                thisVar1.Name = "this" && 
+                thisVar1.Type = typeof<MyClassWithFields> && 
+                thisVar1 = Var.Global("this", typeof<MyClassWithFields>) && 
+                xField1.Name = "x" &&
+                xField2.Name = "x" &&
+                xField3.Name = "x" &&
+                yField.Name = "y" &&
+                wVar.Name = "w" &&
+                wVar.Type = typeof<int>  
+                
+        | _ -> false)
+
+
+
+    test "vkjnkvrw3"
+       (match Expr.TryGetReflectedDefinition (typeof<MyGenericClassWithArgs<int>>.GetConstructors().[0]) with 
+        | Some 
+           (Lambda
+              (inpVar,Sequential 
+                   (NewObject objCtor,
+                    Sequential 
+                       (FieldSet (Some (Var thisVar0), xField1, Var inpVar1),
+                        Sequential 
+                           (FieldSet (Some (Var thisVar1), yField,FieldGet (Some (Var thisVar2),xField2)),
+                            Let (wVar,FieldGet (Some (Var thisVar3), xField3), Unit))))))
+            -> 
+                inpVar.Name = "inp" &&
+                inpVar.Type = typeof<int> &&
+                thisVar0 = thisVar1 && 
+                thisVar1 = thisVar2 && 
+                thisVar2 = thisVar3 && 
+                thisVar1.Name = "this" && 
+                thisVar1.Type = typeof<MyGenericClassWithArgs<int>> && 
+                thisVar1 = Var.Global("this", typeof<MyGenericClassWithArgs<int>>) && 
+                xField1.Name = "x" &&
+                xField2.Name = "x" &&
+                xField3.Name = "x" &&
+                yField.Name = "y" &&
+                wVar.Name = "w" &&
+                wVar.Type = typeof<int>  
+                
+        | _ -> false)
+
+
+    test "vkjnkvrw4"
+       (match Expr.TryGetReflectedDefinition (typeof<MyGenericClassWithTwoArgs<int>>.GetConstructors().[0]) with 
+        | Some 
+           (Lambdas
+              ([[inpAVar1; inpBVar1]],
+               Sequential 
+                   (NewObject objCtor,
+                    Sequential 
+                       (FieldSet (Some (Var thisVar0), inpBField, Var inpBVar2),
+                        Sequential 
+                           (FieldSet (Some (Var thisVar1), xField1, Var inpAVar2),
+                            Sequential 
+                               (FieldSet (Some (Var thisVar2), yField,FieldGet (Some (Var thisVar3),xField2)),
+                                Let (wVar,FieldGet (Some (Var thisVar4), xField3), Unit)))))))
+            -> true ||
+                inpAVar1 = inpAVar2 &&
+                inpAVar1.Name = "inpA" &&
+                inpAVar2.Type = typeof<int> &&
+                inpBVar1 = inpBVar2 &&
+                inpBVar1.Name = "inpB" &&
+                inpBVar1.Type = typeof<int> &&
+                thisVar0 = thisVar1 && 
+                thisVar1 = thisVar2 && 
+                thisVar2 = thisVar3 && 
+                thisVar3 = thisVar4 && 
+                thisVar1.Name = "this" && 
+                thisVar1 = Var.Global("this", typeof<MyGenericClassWithTwoArgs<int>>) && 
+                thisVar1.Type = typeof<MyGenericClassWithTwoArgs<int>> && 
+                inpBField.Name = "inpB" &&
+                xField1.Name = "x" &&
+                xField2.Name = "x" &&
+                xField3.Name = "x" &&
+                yField.Name = "y" &&
+                wVar.Name = "w" &&
+                wVar.Type = typeof<int>  
+                
+        | _ -> false)
+
+#if NetCore
+#else
+    // Also test getting the reflected definition for private members implied by "let f() = ..." bindings
+    let fMethod = (typeof<MyClassWithAsLetMethod>.GetMethod("f", Reflection.BindingFlags.Instance ||| Reflection.BindingFlags.Public ||| Reflection.BindingFlags.NonPublic))
+
+    // Also test getting the reflected definition for private members implied by "let f() = ..." bindings
+    let fMethodOuter = (typeof<MyClassWithAsLetMethodOuter>.GetMethod("f", Reflection.BindingFlags.Instance ||| Reflection.BindingFlags.Public ||| Reflection.BindingFlags.NonPublic))
+
+    test "vkjnkvrw1"
+       (match Expr.TryGetReflectedDefinition fMethod with 
+        | Some (Lambdas ([[thisVar];[unitVar]], Int32 1))
+            -> unitVar.Type = typeof<unit>
+        | _ -> false)
+
+    
+    Expr.TryGetReflectedDefinition fMethod |> printfn "%A"
+#endif
+
+    test "vkjnkvrw0"
+       (match Expr.TryGetReflectedDefinition (typeof<MyClassWithNoFields>.GetConstructors().[0]) with 
+        | Some (Lambda (unitVar,Sequential (NewObject objCtor,Unit)))
+            -> unitVar.Type = typeof<unit>
+        | _ -> false)
+
+    test "vkjnkvrw0b"
+       (match Expr.TryGetReflectedDefinition (typeof<MyClassWithNoFieldsOuter>.GetConstructors().[0]) with 
+        | Some (Lambda (unitVar,Sequential (NewObject objCtor,Unit)))
+            -> unitVar.Type = typeof<unit>
+        | _ -> false)
+
+    test "vkjnkvrw0c"
+       (match Expr.TryGetReflectedDefinition (typeof<M.MyClassWithNoFieldsNestedInModule>.GetConstructors().[0]) with 
+        | Some (Lambda (unitVar,Sequential (NewObject objCtor,Unit)))
+            -> unitVar.Type = typeof<unit>
+        | _ -> false)
+
+
+module IndexedPropertySetTest = 
+    open System
+    open Microsoft.FSharp.Quotations
+    open Microsoft.FSharp.Quotations.Patterns
+
+    // Having int[] will allow us to swap es and l in PropertySet builder for testing.
+    type Foo (array:int[]) =
+        member t.Item with get (index:int) = array.[index]
+                      and set (index:int) (value:int) = do array.[index] <- value
+
+                      
+    let testExprPropertySet () =
+        let foo = new Foo([|0..4|])
+        let expr = <@do foo.[2] <- 0@>
+
+        //printfn "%A" expr
+
+        // let's rebuild expr ourself and bind it to bexpr.
+        let bexpr =
+            match expr with
+            | PropertySet (inst, pi, l, es) ->
+                match inst with
+                | Some(e) ->
+                    Expr.PropertySet(e, pi, es, l) // swaping params 2 and 3 e.g. (e, pi, l.[0], [es]) yield to OK
+                | _ -> failwith ""
+            | _ -> failwith ""   
+
+        //printfn "%A" bexpr
+
+        let result = bexpr.Equals(expr)
+        if result then printfn "Test OK."
+        else printfn "Test KO."
+
+    do testExprPropertySet ()
+
+
+
+module QuotationsOfLocalFunctions_FSharp_1_0_6403 =
+
+    type C() = 
+        let f1 (x:int) = 1
+        let f2 (x:'T) = 1
+        let f3 (x:byref<int>) = 1
+
+        [<ReflectedDefinition>]
+        let rd1 x = f1 x 
+
+        [<ReflectedDefinition>]
+        let rd2 x = f2 x 
+
+        // not allowed - byrefs in quotations: 
+        // [<ReflectedDefinition>]
+        //let rd3 (x:byref<int>) = f3 (&x) 
+
+        let q1 x = <@ f1 x  @>
+        let q2 x = <@ f2 x  @>
+        // not allowed - byrefs in quotations: 
+        // let q3 (x:byref<int>) = <@ f3 (&x)  @>
+
+        static let sf1 (x:int) = 1
+        static let sf2 (x:'T) = 1
+        static let sf3 (x:byref<int>) = 1
+
+        [<ReflectedDefinition>]
+        static let srd1 x = sf1 x 
+
+        [<ReflectedDefinition>]
+        static let srd2 x = sf2 x 
+
+        // not allowed - byrefs in quotations: 
+        // [<ReflectedDefinition>]
+        //let rd3 (x:byref<int>) = f3 (&x) 
+
+        static let sq1 x = <@ sf1 x  @>
+        static let sq2 x = <@ sf2 x  @>
+
+        static let mutable sfield1 = 1
+
+        static member SQ1 = sq1 1
+        static member SQ2 = sq2 1
+
+        static member SQ3 v = <@ sf1 v @>
+        static member SQ4 v = <@ sf2 v @>
+
+        static member SQ5 = <@ sf1 1 @>
+        static member SQ6 = <@ sf2 2 @>
+
+        static member SQ7 v = <@ srd1 v @>
+        static member SQ8 v = <@ srd2 v @>
+
+        // not allowed - byrefs in quotations: 
+        //static member SQ3 = q3 (&field1)
+
+        static member SRD1 = Quotations.Expr.TryGetReflectedDefinition (match C.SQ7 3 with Quotations.Patterns.Call(_,mi,args) -> mi | _ -> failwith "method info not found")
+        static member SRD2 = Quotations.Expr.TryGetReflectedDefinition (match C.SQ8 4 with Quotations.Patterns.Call(_,mi,args) -> mi | _ -> failwith "method info not found")
+
+        member self.Q1 = q1 1
+        member self.Q2 = q2 1
+
+        member self.Q3 v = <@ f1 v @>
+        member self.Q4 v = <@ f2 v @>
+
+        member self.Q5 = <@ f1 1 @>
+        member self.Q6 = <@ f2 2 @>
+
+        member self.Q7 v = <@ rd1 v @>
+        member self.Q8 v = <@ rd2 v @>
+
+        // not allowed - byrefs in quotations: 
+        //member self.Q3 = q3 (&field1)
+
+        member self.RD1 = Quotations.Expr.TryGetReflectedDefinition (match self.Q7 3 with Quotations.Patterns.Call(_,mi,args) -> mi | _ -> failwith "method info not found")
+        member self.RD2 = Quotations.Expr.TryGetReflectedDefinition (match self.Q8 4 with Quotations.Patterns.Call(_,mi,args) -> mi | _ -> failwith "method info not found")
+
+    let test() =
+        let c = C()
+        printfn "c.Q1 = %A" c.Q1
+        printfn "c.Q2 = %A" c.Q2
+        printfn "c.Q3 = %A" (c.Q3 3)
+        printfn "c.Q4 = %A" (c.Q4 4)
+        printfn "c.Q5 = %A" c.Q5
+        printfn "c.Q6 = %A" c.Q6
+        printfn "c.Q7 = %A" (c.Q7 7)
+        printfn "c.Q8 = %A" (c.Q8 8)
+        printfn "c.RD1 = %A" c.RD1
+        printfn "c.RD2 = %A" c.RD2
+
+        printfn "C.SQ1 = %A" C.SQ1
+        printfn "C.SQ2 = %A" C.SQ2
+        printfn "C.SQ3 = %A" (C.SQ3 3)
+        printfn "C.SQ4 = %A" (C.SQ4 4)
+        printfn "C.SQ5 = %A" C.SQ5
+        printfn "C.SQ6 = %A" C.SQ6
+        printfn "C.SQ7 = %A" (C.SQ7 7)
+        printfn "C.SQ8 = %A" (C.SQ8 8)
+        printfn "C.SRD1 = %A" C.SRD1
+        printfn "C.SRD2 = %A" C.SRD2
+
+        test "cejnewoui1" (match c.Q1 with Call (Some (Value _),_, [(Int32 1)]) -> true | _ -> false)
+        test "cejnewoui2" (match c.Q2 with Call (Some (Value _),_, [(Int32 1)]) -> true | _ -> false)
+        test "cejnewoui3" (match (c.Q3 3) with Call (Some (Value _),_, [(Int32 3)]) -> true | _ -> false)
+        test "cejnewoui4" (match (c.Q4 4) with Call (Some (Value _),_, [(Int32 4)]) -> true | _ -> false)
+
+        // Note for the cases below: We still get temporaries introduced in some quotations, 
+        // e.g. Q5 and Q6. The introduction of temporaries is OK according to our V2.0 specification, 
+        // where compilation of some calls, pattern matching etc. may introduce temporaries. It’s not 
+        // totally ideal: we would prefer if Q5 and Q6 reported “call”  quotations, and would be willing 
+        // to make that breaking change at a later date.
+        test "cejnewoui5" (match c.Q5 with Let(_, (Int32 1), Call (Some (Value _),_, [_])) -> true | _ -> false)
+        test "cejnewoui6" (match c.Q6 with Let(_, (Int32 2), Call (Some (Value _),_, [_])) -> true | _ -> false)
+
+        test "cejnewoui7" (match c.Q7 7 with Call (Some (Value _),_, [(Int32 7)]) -> true | _ -> false)
+        test "cejnewoui8" (match c.Q8 8 with Call (Some (Value _),_, [(Int32 8)]) -> true | _ -> false)
+        test "cejnewouiRD1" (match c.RD1 with Some(Lambda(_, Lambda(_, Call (Some _,_, [_])))) -> true | _ -> false)
+        test "cejnewouiRD2" (match c.RD2 with Some(Lambda(_, Lambda(_, Call (Some _,_, [_])))) -> true | _ -> false)
+
+        test "scejnewoui1" (match C.SQ1 with Call (None,_, [(Int32 1)]) -> true | _ -> false)
+        test "scejnewoui2" (match C.SQ2 with Call (None,_, [(Int32 1)]) -> true | _ -> false)
+        test "scejnewoui3" (match C.SQ3 3 with Call (None,_, [(Int32 3)]) -> true | _ -> false)
+        test "scejnewoui4" (match C.SQ4 4 with Call (None,_, [(Int32 4)]) -> true | _ -> false)
+
+        // Note for the cases below: We still get temporaries introduced in some quotations, 
+        // e.g. Q5 and Q6. The introduction of temporaries is OK according to our V2.0 specification, 
+        // where compilation of some calls, pattern matching etc. may introduce temporaries. It’s not 
+        // totally ideal: we would prefer if Q5 and Q6 reported “call”  quotations, and would be willing 
+        // to make that breaking change at a later date.
+        test "scejnewoui5" (match C.SQ5 with Let(_, (Int32 1), Call (None,_, [_])) -> true | _ -> false)
+        test "scejnewoui6" (match C.SQ6 with Let(_, (Int32 2), Call (None,_, [_])) -> true | _ -> false)
+
+        test "scejnewoui7" (match C.SQ7 7 with Call (None,_, [(Int32 7)]) -> true | _ -> false)
+        test "scejnewoui8" (match C.SQ8 8 with Call (None,_, [(Int32 8)]) -> true | _ -> false)
+        test "scejnewouiRD1" (match C.SRD1 with Some(Lambda(_, Call (None,_, [_]))) -> true | _ -> false)
+        test "scejnewouiRD2" (match C.SRD2 with Some(Lambda(_, Call (None,_, [_]))) -> true | _ -> false)
+    test()
+
+    (*
+        printfn "c.Q1 = %A" c.Q1
+        printfn "c.Q2 = %A" c.Q2
+        printfn "c.Q3 = %A" (c.Q3 3)
+        printfn "c.Q4 = %A" (c.Q4 4)
+        printfn "c.Q5 = %A" c.Q5
+        printfn "c.Q6 = %A" c.Q6
+        printfn "c.Q7 = %A" c.Q7
+        printfn "c.Q8 = %A" c.Q8
+        printfn "c.RD1 = %A" c.RD1
+        printfn "c.RD2 = %A" c.RD2
+
+        printfn "C.SQ1 = %A" C.SQ1
+        printfn "C.SQ2 = %A" C.SQ2
+        printfn "C.SQ3 = %A" (C.SQ3 3)
+        printfn "C.SQ4 = %A" (C.SQ4 4)
+        printfn "C.SQ5 = %A" C.SQ5
+        printfn "C.SQ6 = %A" C.SQ6
+        printfn "C.SQ7 = %A" C.SQ7
+        printfn "C.SQ8 = %A" C.SQ8
+        printfn "C.SRD1 = %A" C.SRD1
+        printfn "C.SRD2 = %A" C.SRD2
+    *)
+
+module OverloadsInTypeExtensions =
+    module A = 
+        type X = X
+
+    module P = Microsoft.FSharp.Quotations.Patterns
+
+    let test caption (q : Microsoft.FSharp.Quotations.Expr<'a>) (expected : 'a) =
+        let (P.Call(None, mi, args)) = q
+        let args = 
+            [| 
+                for arg in args do
+                    match arg with
+                    | P.Value(v, _) -> yield v
+                    | P.Coerce(P.Value(v, _), toTy) -> yield System.Convert.ChangeType(v, toTy, null)
+            |]
+        let actual = mi.Invoke(null, args) :?> 'a
+        check caption actual expected
+
+    module Overloads =
+        type A.X with
+            member private this.F(_ : 'a) = 1 
+            member private this.F(_ : string) = 2
+
+            member this.F2(_ : 'a, _ : bool) = 3
+            member this.F2(_ : obj, _ : string) = 4
+
+            member this.F3(_ : string, _ : int) = 5
+            member this.F3(_ : int, _ : obj) = 6 
+
+            member this.TestOverloads() = 
+                test "Overloads_1" <@ this.F(5)@> 1
+                test "Overloads_2" <@ this.F("")@> 2
+                test "Overloads_3" <@ this.F2(2, true) @> 3
+                test "Overloads_4" <@ this.F2(2, "2") @> 4
+                test "Overloads_5" <@ this.F3(2, true) @> 6
+                test "Overloads_6" <@ this.F3(2, "2") @> 6
+                test "Overloads_7" <@ this.F3("2", 2) @> 5
+                true
+    
+    open Overloads
+
+    check "OverloadsInTypeExtensions" (try A.X.TestOverloads() with _ -> false) true
+
+module ArrayQuoteTests = 
+    check "cenwkjen" (match <@ [| 2.0;3.0;4.0 |] @> with NewArray (ty, [Double 2.0; Double 3.0; Double 4.0]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2;3;4 |] @> with NewArray (ty, [Int32 2; Int32 3; Int32 4]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2u;3u;4u |] @> with NewArray (ty, [UInt32 2u; UInt32 3u; UInt32 4u]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2s;3s;4s |] @> with NewArray (ty, [Int16 2s; Int16 3s; Int16 4s]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2UL;3UL;4UL |] @> with NewArray (ty, [UInt64 2UL; UInt64 3UL; UInt64 4UL]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2L;3L;4L |] @> with NewArray (ty, [Int64 2L; Int64 3L; Int64 4L]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2us;3us;4us |] @> with NewArray (ty, [UInt16 2us; UInt16 3us; UInt16 4us]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2y;3y;4y |] @> with NewArray (ty, [SByte 2y; SByte 3y; SByte 4y]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ [| 2uy;3uy;4uy |] @> with NewArray (ty, [Byte 2uy; Byte 3uy; Byte 4uy]) -> true  | _ -> false) true
+    check "cenwkjen" (match <@ "abc"B @> with NewArray (ty, [Byte 97uy; Byte 98uy; Byte 99uy]) -> true  | _ -> false) true
+
+module ReflectedDefinitionOnTypesWithImplicitCodeGen = 
+    
+   [<ReflectedDefinition>]
+   module M = 
+      // This type has an implicit IComparable implementation, it is not accessible as a reflected definition
+      type R = { x:int; y:string; z:System.DateTime }
+#if NetCore
+      for m in typeof<R>.GetMethods() do 
+#else
+      for m in typeof<R>.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do 
+#endif
+          check "celnwer32" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true
+
+      // This type has an implicit IComparable implementation, it is not accessible as a reflected definition
+      type U = A of int | B of string | C of System.DateTime 
+#if NetCore
+      for m in typeof<R>.GetMethods() do 
+#else
+      for m in typeof<U>.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do 
+#endif
+          check "celnwer33" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true
+
+      // This type has some implicit codegen
+      exception X of string * int
+#if NetCore
+      for m in typeof<R>.GetMethods() do 
+#else
+      for m in typeof<X>.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do 
+#endif
+          check "celnwer34" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true
+
+
+#if Portable
+#else
+module BasicUsingTEsts = 
+    let q1() = 
+      let a = ResizeArray<_>()
+      for i in a do ignore i 
+    let q2() = 
+      use a = new System.Drawing.Bitmap(10,10) in 10 
+    let q3() = 
+      use a:  System.Drawing.Bitmap = null in 10
+    let q4(x : #System.IDisposable) = 
+      use a = x in 10
+    let q5(x : ('T :> System.IDisposable)) = 
+      use a : 'T = null in 10
+ 
+    q1()
+    q2()
+    q3()
+    q4 (new System.Drawing.Bitmap(10,10))
+    q4 (ResizeArray<_>().GetEnumerator())
+    q4 (null)
+
+    q5 (new System.Drawing.Bitmap(10,10))
+    q5 (null)
+
+module QuotationOfBitmapDIsposal = 
+    // Quotation of something which does a "use" on a sealed type
+    let q = 
+      <@ use a = new System.Drawing.Bitmap(10,10) in 10 @>
+
+    test "Test920236a"
+        (match q with
+         |    Let(e,NewObject _, 
+                  (TryFinally 
+                    (Value _,
+                     IfThenElse(TypeTest(Coerce(_,typObj), typDisposable),
+                                Call(Some(Call(None, unboxGeneric, [Coerce(e3,typObj2)])),disposeMI, []), Value _)
+                  ))
+                 )               
+                 when typDisposable.FullName = "System.IDisposable" &&
+                      unboxGeneric.Name = "UnboxGeneric"
+                 -> true
+         |    _ -> false)
+#endif
+
+module ReflectedDefinitionAndSelfIdentifier = 
+    [<ReflectedDefinition>]
+    type T() as _selfReference = 
+        member this.Property = 1
+
+    test "ReflectedDefinitionAndSelfIdentifier"
+        (
+            let m = typeof<T>.GetMethod("get_Property")
+            match Expr.TryGetReflectedDefinition m with
+            | None -> false
+            | Some e -> 
+                match e with
+                | Patterns.Lambda
+                    (
+                        thisVar,
+                        Patterns.Lambda
+                            (
+                                unitVar,
+                                TypedValue 1
+                            )
+                    )  -> thisVar.Type = typeof<T> && unitVar.Type = typeof<unit>
+                | _ -> false
+        )
+
+module LoopsOverArraysInQuotations =
+
+    test "LoopsOverArraysInQuotations1"
+        (
+            <@ for x in [|1;2|] do ignore () @>
+            |> 
+            function
+            | Patterns.Let
+              (
+                    arr, 
+                    Patterns.NewArray(IntTy, [TypedValue 1; TypedValue 2]), 
+                    Patterns.ForIntegerRangeLoop(
+                        idx, 
+                        TypedValue 0, 
+                        SpecificCall <@ (-) @> (None, [IntTy; IntTy; IntTy], [ SpecificCall <@ Array.length @>(None, [IntTy], _); TypedValue 1]), 
+                        Patterns.Let(
+                            forLoopVar,
+                            SpecificCall <@ LanguagePrimitives.IntrinsicFunctions.GetArray @>(None, _, _),
+                            SpecificCall <@ ignore @>(None, _, _)
+                        )
+                    )
+                ) -> true
+            | _ -> false
+        )
+    test "LoopsOverArraysInQuotations2"
+        (
+            <@ for (x,y) in [|1, ""|] do ignore x @>
+            |> 
+            function
+            | Patterns.Let
+                (
+                    arr, 
+                    Patterns.NewArray(TupleTy(IntTy, StringTy), [Patterns.NewTuple([TypedValue 1; TypedValue ""])]), 
+                    Patterns.ForIntegerRangeLoop(
+                        idx1, 
+                        TypedValue 0,
+                        SpecificCall <@ (-) @> (None, [IntTy; IntTy; IntTy], [ SpecificCall <@ Array.length @>(None, [TupleTy(IntTy, StringTy)], _); TypedValue 1]), 
+                        Patterns.Let(
+                            forLoopVar,
+                            SpecificCall <@ LanguagePrimitives.IntrinsicFunctions.GetArray @>(None, _, [Patterns.Var(arr2); Patterns.Var idx2]),
+                            Patterns.Let(
+                                y,
+                                Patterns.TupleGet(_, 1),
+                                Patterns.Let(
+                                    x,
+                                    Patterns.TupleGet(_, 0),
+                                    SpecificCall <@ ignore : 'T -> unit @>(None, _, [Patterns.Var(x2)])
+                                )
+                            )
+                        )
+                    )
+                ) -> arr = arr2 && idx1 = idx2 && x = x2
+            | _ -> false        
+        )
+    test "LoopsOverArraysInQuotations3"
+        (
+            <@ for (x,y) in [||] do () @>
+            |> 
+            function
+            | Patterns.Let
+                (
+                    arr, 
+                    Patterns.NewArray(TupleTy(ObjTy, ObjTy), []), 
+                    Patterns.ForIntegerRangeLoop(
+                        idx1, 
+                        TypedValue 0,
+                        SpecificCall <@ (-) @> (None, [IntTy; IntTy; IntTy], [ SpecificCall <@ Array.length @>(None, [TupleTy(ObjTy, ObjTy)], _); TypedValue 1]), 
+                        Patterns.Let(
+                            forLoopVar,
+                            SpecificCall <@ LanguagePrimitives.IntrinsicFunctions.GetArray @>(None, _, [Patterns.Var(arr2); Patterns.Var idx2]),
+                            _
+                        )
+                    )
+                ) -> arr = arr2 && idx1 = idx2
+            | _ -> false        
+        )
+
+module QuotationOfResizeArrayIteration = 
+    // Quotation of an iteration which implictly does a "use" on a value of struct type
+    let q = 
+      let a = ResizeArray<_>()
+      <@ for i in a do ignore i @>
+
+    test "Test920236b"
+        (match q with
+         |    Let(e,Call(Some (Value a), mi, []), 
+                  (TryFinally 
+                    (WhileLoop((Call (Some e1, moveNext, [])),
+                         Let(i,
+                             PropertyGet ((Some e2),piCurrent,[]),
+                             Call(None,_,[_]) // ignore
+                         )
+                    ),
+                    Call(Some(e3),disposeMI, []))
+                  ))
+                 when mi.Name = "GetEnumerator" &&
+                      moveNext.Name = "MoveNext" && 
+                      piCurrent.Name = "Current" &&
+                      disposeMI.Name = "Dispose"
+                 -> true
+         |    _ -> false)
+        
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/quotesDebugInfo/build.bat b/tests/fsharp/core/quotesDebugInfo/build.bat
new file mode 100644
index 0000000..a78e0a6
--- /dev/null
+++ b/tests/fsharp/core/quotesDebugInfo/build.bat
@@ -0,0 +1,45 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+    "%FSC%" %fsc_flags% --quotations-debug+ --optimize -o:test.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test.exe 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% --quotations-debug+ --optimize -o:test--optimize.exe -g test.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" test--optimize.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/quotesDebugInfo/run.bat b/tests/fsharp/core/quotesDebugInfo/run.bat
new file mode 100644
index 0000000..633619d
--- /dev/null
+++ b/tests/fsharp/core/quotesDebugInfo/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --quotations-debug+ test.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/quotesDebugInfo/test.fsx b/tests/fsharp/core/quotesDebugInfo/test.fsx
new file mode 100644
index 0000000..4f61d45
--- /dev/null
+++ b/tests/fsharp/core/quotesDebugInfo/test.fsx
@@ -0,0 +1,647 @@
+type E = Microsoft.FSharp.Quotations.Expr
+type V = Microsoft.FSharp.Quotations.Var
+type FST = Microsoft.FSharp.Reflection.FSharpType
+
+module P = Microsoft.FSharp.Quotations.Patterns
+module DP = Microsoft.FSharp.Quotations.DerivedPatterns
+module Shape = Microsoft.FSharp.Quotations.ExprShape
+
+open System.CodeDom.Compiler
+
+let toString (e : E) = 
+    let sw = new System.IO.StringWriter()
+    let w = new IndentedTextWriter(sw)
+    
+    let tab() = w.Indent <- w.Indent + 1
+    let newline() = w.WriteLine()
+    let untab(newLine) = 
+        w.Indent <- w.Indent - 1
+        if newLine then newline()
+
+    let print fmt = Printf.fprintf w fmt
+    let println fmt = Printf.fprintfn w fmt
+
+    let rec go (e : E, newLineAfterAttr) = 
+        let isWrapped =
+            match e.CustomAttributes with
+            | [P.NewTuple([_; P.NewTuple([file; P.Value(sl, _); P.Value(sc, _); P.Value(el, _); P.Value(ec, _)])])] -> 
+                print "[DebugRange(%O:%O - %O:%O)] <{ " sl sc el ec
+                if newLineAfterAttr then newline()
+                true                
+            | _ -> false
+
+        match e with
+        | P.Var(v) -> print "%s" v.Name
+        | P.Value(v, _) -> print "%A" v
+        | P.NewRecord(ty, args) ->
+            let fields = FST.GetRecordFields(ty)
+            print "new %s {" ty.Name
+            tab()
+            (fields, args) 
+            ||> Seq.zip 
+            |> Seq.iteri (fun i (f, v) ->
+                if i <> 0 then
+                    println "," 
+                print "%s = ( " f.Name
+                go(v, false)
+                print ")"            )            
+            untab(true)
+            println "}"
+        | DP.SpecificCall <@ (=) @>(_, _, [a; b]) ->
+            go(a, false)
+            print " = "
+            go(b, false)
+        | DP.SpecificCall <@ (-) @> (_, _, [a; b]) ->
+            go(a, false)
+            print " - "
+            go(b, false)
+        | DP.SpecificCall <@ (*) @> (_, _, [a; b]) ->
+            go(a, false)
+            print " * "
+            go(b, false)
+        | DP.SpecificCall <@ (+) @> (_, _, [a; b]) ->
+            go(a, false)
+            print " + "
+            go(b, false)
+        | DP.SpecificCall <@ ignore @>(_, _, [a]) -> 
+            print "ignore"
+            go(a, false)
+            print ")"
+        | P.Let(var, value, body) -> 
+            println "let %s : %s = " var.Name var.Type.Name
+            tab()
+            go(value, true)
+            newline()
+            println "in"
+            go(body, true)
+            untab(false)
+        | P.LetRecursive([var, value], body) -> 
+            println "let rec %s : %s = " var.Name var.Type.Name
+            tab()
+            go(value, true)
+            newline()
+            println "in"
+            go(body, true)
+            untab(false)
+        | P.PropertyGet(Some inst, pi, _) -> 
+            go(inst, false)
+            print ".%s" pi.Name
+        | P.NewObject(ci, args) ->
+            print "new %s (" ci.DeclaringType.Name
+            if List.length args > 0 then
+                tab()
+                newline()
+                args
+                |> Seq.iteri (fun i v ->
+                    if i <> 0 then
+                        println "," 
+                    go(v, false)
+                )            
+                untab(true)
+            println ")"
+        | P.NewArray(ty, args) ->
+            println "new %s [" ty.Name
+            if List.length args > 0 then
+                tab()
+                args |> Seq.iteri (fun i arg ->
+                    if i <> 0 then
+                        println "," 
+                    go(arg, true)
+                )
+                untab(true)
+            println "]"
+        | P.Call(_, mi, args) -> 
+            println "%s (" mi.Name
+            if List.length args > 0 then
+                tab()
+                args |> Seq.iteri (fun i arg ->
+                    if i <> 0 then
+                        println "," 
+                    go(arg, true)
+                )
+                untab(true)
+            println ")"
+        | P.Application(app, arg) ->
+            go(app, false)
+            println "("
+            tab()
+            go(arg, false)
+            untab(true)
+            println ")"
+        | P.WhileLoop(cond, body) ->
+            println "while("
+            go(cond, false)
+            println ") {"
+            tab()
+            go(body, true)
+            untab(true)
+            println "}"
+        | P.ForIntegerRangeLoop(var, s, e, body) -> 
+            print "for("
+            go (E.Var var, false)
+            print " in "
+            go(s, false)
+            print ".."
+            go(e, false)
+            println " {"
+            tab()
+            go(body, true)
+            untab(true)
+            println "}"
+        | P.Lambda(var, body) ->
+            println "(fun %s : %s -> " var.Name var.Type.Name
+            tab()
+            go(body, true)
+            untab(true)
+            println ")"
+        | P.IfThenElse(cond, ifTrue, ifFalse) ->
+            println "if ("
+            go(cond, false)
+            println ") {"
+            tab()
+            go(ifTrue, true)
+            untab(true)
+            println "} else {"
+            tab()
+            go(ifFalse, true)
+            untab(true)
+            println "}"
+        | P.UnionCaseTest(e, ucase) -> 
+            print "UnionCaseTest ("
+            go(e, false)
+            print ") is %s" ucase.Name
+        | P.NewUnionCase(ucase, args) ->
+            print "%s" ucase.Name
+            if List.length args > 0 then
+                tab()
+                newline()
+                args
+                |> Seq.iteri (fun i v ->
+                    if i <> 0 then
+                        println "," 
+                    go(v, false)
+                )            
+                untab(true)
+            println ")"
+        | P.Sequential(a, b) ->
+            go(a, false)
+            newline()
+            go(b, false)
+        | P.PropertySet(Some inst, pi, _, value) ->
+            go(inst, false)
+            print ".%s <-" pi.Name
+            go(value, false)
+        | P.FieldGet(Some inst, fi) ->
+            go(inst, false)
+            print ".%s" fi.Name
+        | P.FieldSet(Some inst, fi, value) ->
+            go(inst, false)
+            print ".%s <-" fi.Name
+            go(value, false)
+        | x -> failwithf "unexpected %A" x
+        if isWrapped then print " }>"
+        
+    go(e, true)
+    sw.ToString()
+
+let normalize (s : string) = 
+    s.Replace("\r", "")
+     .Split([|'\n'|], System.StringSplitOptions.RemoveEmptyEntries) 
+     |> Array.map (fun s -> s.Trim()) |> String.concat "\n"
+
+let foo a b c = ignore(); fun d -> a + b + c + d
+type A = {x : int}
+type B(x : int) = 
+    member this.X = x
+
+let mutable failures = ref 0
+let test caption (baseLine : string) e = 
+    let got = toString e
+    let expected = normalize baseLine
+    if expected <> (normalize got) then
+        printf "%s failed, normalized baseline %s, normalized result %s" caption expected got
+        // save non-normalized result with tabs for better readability
+        System.IO.File.WriteAllText(System.IO.Path.Combine(__SOURCE_DIRECTORY__, caption) + ".actual", got)
+        incr failures
+do
+    let q = 
+        <@ 
+            1 + 2
+        @>
+    let baseLine = """
+[DebugRange(229:12 - 229:17)] <{ 
+[DebugRange(229:12 - 229:13)] <{ 1 }> + [DebugRange(229:16 - 229:17)] <{ 2 }> }>"""    
+    test "test1" baseLine q
+
+do
+    let q = 
+        <@ 
+            let y = fun a -> a + 1
+            for x in 1..10 do
+                ignore (y x)
+        @>
+    let baseLine = """
+[DebugRange(239:16 - 239:17)] <{ 
+let y : FSharpFunc`2 = 
+    [DebugRange(239:20 - 239:34)] <{ 
+    (fun a : Int32 -> 
+        [DebugRange(239:29 - 239:34)] <{ 
+        [DebugRange(239:29 - 239:30)] <{ a }> + [DebugRange(239:33 - 239:34)] <{ 1 }> }>
+    )
+     }>
+    in
+    [DebugRange(240:12 - 241:28)] <{ 
+    for(x in [DebugRange(240:21 - 240:22)] <{ 1 }>..[DebugRange(240:24 - 240:26)] <{ 10 }> {
+        [DebugRange(241:16 - 241:28)] <{ 
+        ignore[DebugRange(241:24 - 241:27)] <{ [DebugRange(241:24 - 241:25)] <{ y }>(
+            [DebugRange(241:26 - 241:27)] <{ x }>
+        )
+         }>) }>
+    }
+     }> }>"""
+    test "test2" baseLine q
+
+do
+    let q =
+         <@
+            [| {x = 5}; {x = 1} |]
+         @>
+
+    let baseLine = """
+[DebugRange(267:12 - 267:34)] <{ 
+new A [
+    [DebugRange(267:15 - 267:22)] <{ 
+    new A {x = ( [DebugRange(267:20 - 267:21)] <{ 5 }>)
+    }
+     }>,
+    [DebugRange(267:24 - 267:31)] <{ 
+    new A {x = ( [DebugRange(267:29 - 267:30)] <{ 1 }>)
+    }
+     }>
+]
+ }>"""    
+    test "test3" baseLine q
+
+do
+    let q =
+         <@
+            [| B(5); B(10) |]
+         @>
+    let baseLine = """
+[DebugRange(288:12 - 288:29)] <{ 
+new B [
+    [DebugRange(288:15 - 288:19)] <{ 
+    new B (
+        [DebugRange(288:17 - 288:18)] <{ 5 }>
+    )
+     }>,
+    [DebugRange(288:21 - 288:26)] <{ 
+    new B (
+        [DebugRange(288:23 - 288:25)] <{ 10 }>
+    )
+     }>
+]
+ }>"""
+    test "test4" baseLine q
+do
+    let q =
+        <@
+            let x = 5
+            match x with
+            | 10 -> "a"
+            | 15 -> "b"
+            | _ -> "c"
+        @>
+    let baseLine = """
+[DebugRange(309:16 - 309:17)] <{ 
+let x : Int32 = 
+    [DebugRange(309:20 - 309:21)] <{ 
+    5 }>
+    in
+    [DebugRange(310:18 - 310:19)] <{ 
+    if (
+    [DebugRange(310:18 - 310:19)] <{ [DebugRange(310:18 - 310:19)] <{ x }> = [DebugRange(310:18 - 310:19)] <{ 10 }> }>) {
+        [DebugRange(311:20 - 311:23)] <{ 
+        "a" }>
+    } else {
+        [DebugRange(310:18 - 310:19)] <{ 
+        if (
+        [DebugRange(310:18 - 310:19)] <{ [DebugRange(310:18 - 310:19)] <{ x }> = [DebugRange(310:18 - 310:19)] <{ 15 }> }>) {
+            [DebugRange(312:20 - 312:23)] <{ 
+            "b" }>
+        } else {
+            [DebugRange(313:19 - 313:22)] <{ 
+            "c" }>
+        }
+         }>
+    }
+     }> }>"""    
+    test "test5" baseLine q
+
+do
+    let q =
+        <@
+            let foo x = 
+                match x with
+                | Some v -> v + 10
+                | None -> 100
+            foo (Some 5)
+        @>
+    let baseLine = """
+[DebugRange(344:16 - 344:21)] <{ 
+let foo : FSharpFunc`2 = 
+    [DebugRange(345:16 - 347:29)] <{ 
+    (fun x : FSharpOption`1 -> 
+        [DebugRange(345:22 - 345:23)] <{ 
+        if (
+        UnionCaseTest ([DebugRange(345:22 - 345:23)] <{ x }>) is None) {
+            [DebugRange(347:26 - 347:29)] <{ 
+            100 }>
+        } else {
+            [DebugRange(346:28 - 346:34)] <{ 
+            let v : Int32 = 
+                [DebugRange(346:28 - 346:34)] <{ 
+                [DebugRange(345:22 - 345:23)] <{ x }>.Value }>
+                in
+                [DebugRange(346:28 - 346:34)] <{ 
+                [DebugRange(346:28 - 346:29)] <{ v }> + [DebugRange(346:32 - 346:34)] <{ 10 }> }> }>
+        }
+         }>
+    )
+     }>
+    in
+    [DebugRange(348:12 - 348:24)] <{ 
+    [DebugRange(348:12 - 348:15)] <{ foo }>(
+        [DebugRange(348:17 - 348:23)] <{ Some
+            [DebugRange(348:22 - 348:23)] <{ 5 }>
+        )
+         }>
+    )
+     }> }>"""
+    
+    test "test6" baseLine q
+
+
+do
+    let q =
+        <@
+            let a = 5
+            for x in a..10 do
+                ignore (a + 5)
+                ignore ("v")
+        @>
+    let baseLine = """
+[DebugRange(388:16 - 388:17)] <{ 
+let a : Int32 = 
+    [DebugRange(388:20 - 388:21)] <{ 
+    5 }>
+    in
+    [DebugRange(389:12 - 391:28)] <{ 
+    for(x in [DebugRange(389:21 - 389:22)] <{ a }>..[DebugRange(389:24 - 389:26)] <{ 10 }> {
+        [DebugRange(390:16 - 391:28)] <{ 
+        [DebugRange(390:16 - 390:30)] <{ ignore[DebugRange(390:24 - 390:29)] <{ [DebugRange(390:24 - 390:25)] <{ a }> + [DebugRange(390:28 - 390:29)] <{ 5 }> }>) }>
+        [DebugRange(391:16 - 391:28)] <{ ignore[DebugRange(391:24 - 391:27)] <{ "v" }>) }> }>
+    }
+     }> }>"""    
+    test "test7" baseLine q
+
+do
+    let q =
+        <@
+            let rec fact i = if i < 2 then 1 else i * fact(i - 1)
+            fact 5
+        @>
+    let baseLine = """
+[DebugRange(411:12 - 412:18)] <{ 
+let rec fact : FSharpFunc`2 = 
+    [DebugRange(411:29 - 411:65)] <{ 
+    (fun i : Int32 -> 
+        [DebugRange(411:29 - 411:65)] <{ 
+        if (
+        [DebugRange(411:32 - 411:37)] <{ op_LessThan (
+            [DebugRange(411:32 - 411:33)] <{ 
+            i }>,
+            [DebugRange(411:36 - 411:37)] <{ 
+            2 }>
+        )
+         }>) {
+            [DebugRange(411:43 - 411:44)] <{ 
+            1 }>
+        } else {
+            [DebugRange(411:50 - 411:65)] <{ 
+            [DebugRange(411:50 - 411:51)] <{ i }> * [DebugRange(411:54 - 411:65)] <{ [DebugRange(411:54 - 411:58)] <{ fact }>(
+                [DebugRange(411:59 - 411:64)] <{ [DebugRange(411:59 - 411:60)] <{ i }> - [DebugRange(411:63 - 411:64)] <{ 1 }> }>
+            )
+             }> }>
+        }
+         }>
+    )
+     }>
+    in
+    [DebugRange(412:12 - 412:18)] <{ 
+    [DebugRange(412:12 - 412:16)] <{ fact }>(
+        [DebugRange(412:17 - 412:18)] <{ 5 }>
+    )
+     }> }>"""
+    test "test8" baseLine q
+
+do
+    let q =
+        <@
+            let f (x : A) = x.x
+            f Unchecked.defaultof<_>
+        @>
+    let baseLine = """
+[DebugRange(451:16 - 451:25)] <{ 
+let f : FSharpFunc`2 = 
+    [DebugRange(451:28 - 451:31)] <{ 
+    (fun x : A -> 
+        [DebugRange(451:28 - 451:31)] <{ 
+        [DebugRange(451:28 - 451:29)] <{ x }>.x }>
+    )
+     }>
+    in
+    [DebugRange(452:12 - 452:36)] <{ 
+    [DebugRange(452:12 - 452:13)] <{ f }>(
+        [DebugRange(452:14 - 452:33)] <{ DefaultOf (
+        )
+         }>
+    )
+     }> }>"""
+    test "test9" baseLine q
+
+do    
+    let q =
+        <@
+            let x = ref 5
+            x.contents
+        @>
+    let baseLine = """
+[DebugRange(476:16 - 476:17)] <{ 
+let x : FSharpRef`1 = 
+    [DebugRange(476:20 - 476:25)] <{ 
+    Ref (
+        [DebugRange(476:24 - 476:25)] <{ 
+        5 }>
+    )
+     }>
+    in
+    [DebugRange(477:12 - 477:22)] <{ 
+    [DebugRange(477:12 - 477:13)] <{ x }>.contents }> }>"""
+    test "test10" baseLine q
+
+module M =    
+    [<ReflectedDefinition>]
+    let Func (x : B) = x.X + 1
+
+do
+    let q =
+        let(P.Call(_, mi, _)) = <@ M.Func(Unchecked.defaultof<_>) @>
+        Option.get (E.TryGetReflectedDefinition mi)
+        
+    let baseLine = """
+[DebugRange(495:23 - 495:30)] <{ 
+(fun x : B -> 
+    [DebugRange(495:23 - 495:30)] <{ 
+    [DebugRange(495:23 - 495:26)] <{ [DebugRange(495:23 - 495:24)] <{ x }>.X }> + [DebugRange(495:29 - 495:30)] <{ 1 }> }>
+)
+ }>"""
+    test "test11" baseLine q
+
+
+type R1 = { mutable f : int}
+do
+    let q = 
+        <@
+            let x = {f = 5}
+            x.f <- 10
+        @>
+    let baseLine = """
+[DebugRange(516:16 - 516:17)] <{ 
+let x : R1 = 
+    [DebugRange(516:20 - 516:27)] <{ 
+    new R1 {f = ( [DebugRange(516:25 - 516:26)] <{ 5 }>)
+    }
+     }>
+    in
+    [DebugRange(517:12 - 517:21)] <{ 
+    [DebugRange(517:12 - 517:13)] <{ x }>.f <-[DebugRange(517:19 - 517:21)] <{ 10 }> }> }>"""
+    test "test12" baseLine q
+
+type T1 = 
+    val mutable x : int
+    new(x) = {x = x}
+
+do 
+    let q = 
+        <@
+            let x = T1(100)
+            x.x <- x.x - 50
+        @>
+    let baseLine = """
+[DebugRange(538:16 - 538:17)] <{ 
+let x : T1 = 
+    [DebugRange(538:20 - 538:27)] <{ 
+    new T1 (
+        [DebugRange(538:23 - 538:26)] <{ 100 }>
+    )
+     }>
+    in
+    [DebugRange(539:12 - 539:27)] <{ 
+    [DebugRange(539:12 - 539:13)] <{ x }>.x <-[DebugRange(539:19 - 539:27)] <{ [DebugRange(539:19 - 539:22)] <{ [DebugRange(539:19 - 539:20)] <{ x }>.x }> - [DebugRange(539:25 - 539:27)] <{ 50 }> }> }> }>"""
+    test "test13" baseLine q
+
+
+[<ReflectedDefinition>]
+module ModuleWithReflectedDefinitions =
+    let f1 a b = a.x + b
+    
+    let f2 (a : T1) b c = a.x - b + c
+
+do
+    let q = 
+        let(P.Lambda(_, P.Lambda(_, P.Call(_, mi, _)))) = <@ ModuleWithReflectedDefinitions.f1 @>
+        Option.get (E.TryGetReflectedDefinition mi)
+    let baseLine = """
+[DebugRange(557:17 - 557:24)] <{ 
+(fun a : A -> 
+    [DebugRange(557:17 - 557:24)] <{ 
+    (fun b : Int32 -> 
+        [DebugRange(557:17 - 557:24)] <{ 
+        [DebugRange(557:17 - 557:20)] <{ [DebugRange(557:17 - 557:18)] <{ a }>.x }> + [DebugRange(557:23 - 557:24)] <{ b }> }>
+    )
+     }>
+)
+ }>"""
+    test "test14" baseLine q
+
+do
+    let q = 
+        let(P.Lambda(_, P.Lambda(_, P.Lambda(_, P.Call(_, mi, _))))) = <@ ModuleWithReflectedDefinitions.f2 @>
+        Option.get (E.TryGetReflectedDefinition mi)
+    let baseLine = """
+[DebugRange(559:26 - 559:37)] <{ 
+(fun a : T1 -> 
+    [DebugRange(559:26 - 559:37)] <{ 
+    (fun b : Int32 -> 
+        [DebugRange(559:26 - 559:37)] <{ 
+        (fun c : Int32 -> 
+            [DebugRange(559:26 - 559:37)] <{ 
+            [DebugRange(559:26 - 559:33)] <{ [DebugRange(559:26 - 559:29)] <{ [DebugRange(559:26 - 559:27)] <{ a }>.x }> - [DebugRange(559:32 - 559:33)] <{ b }> }> + [DebugRange(559:36 - 559:37)] <{ c }> }>
+        )
+         }>
+    )
+     }>
+)
+ }>"""
+    test "test15" baseLine q
+
+[<ReflectedDefinition>]
+type TypeWithReflectedDefinitions (a : int) =
+    let x = string a
+    override this.ToString() = x
+
+do
+    let q = 
+        let ci = typeof<TypeWithReflectedDefinitions>.GetConstructors() |> Seq.exactlyOne
+        Option.get (E.TryGetReflectedDefinition ci)
+    let baseLine = """
+[DebugRange(600:5 - 600:33)] <{ 
+(fun a : Int32 -> 
+    [DebugRange(600:5 - 600:33)] <{ 
+    [DebugRange(600:5 - 600:33)] <{ new Object ()
+     }>
+    [DebugRange(601:4 - 601:20)] <{ [DebugRange(601:4 - 601:20)] <{ [DebugRange(601:4 - 601:20)] <{ this }>.x <-[DebugRange(601:12 - 601:20)] <{ ToString (
+        [DebugRange(601:19 - 601:20)] <{ 
+        a }>
+    )
+     }> }>
+    [DebugRange(600:5 - 600:33)] <{ <null> }> }> }>
+)
+ }>"""
+    test "test16" baseLine q
+        
+do
+    let q = 
+        let mi = typeof<TypeWithReflectedDefinitions>.GetMethod("ToString")
+        Option.get (E.TryGetReflectedDefinition mi)
+    let baseLine = """
+[DebugRange(602:31 - 602:32)] <{ 
+(fun this : TypeWithReflectedDefinitions -> 
+    [DebugRange(602:31 - 602:32)] <{ 
+    (fun unitVar1 : Unit -> 
+        [DebugRange(602:31 - 602:32)] <{ 
+        [DebugRange(602:31 - 602:32)] <{ this }>.x }>
+    )
+     }>
+)
+ }>"""
+    test "test17" baseLine q
+    
+if !failures > 0 then 
+    printfn "Test Failed" 
+    exit 1
+else 
+    printfn "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0
\ No newline at end of file
diff --git a/tests/fsharp/core/quotesInMultipleModules/build.bat b/tests/fsharp/core/quotesInMultipleModules/build.bat
new file mode 100644
index 0000000..dcd56f4
--- /dev/null
+++ b/tests/fsharp/core/quotesInMultipleModules/build.bat
@@ -0,0 +1,60 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+rem fsc.exe building
+
+
+    "%FSC%" %fsc_flags% -o:module1.dll --target:library module1.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" module1.dll 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% -o:module2.exe -r:module1.dll module2.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" module2.exe 
+    @if ERRORLEVEL 1 goto Error
+    
+
+    "%FSC%" %fsc_flags% -o:module1-opt.dll --target:library --optimize module1.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" module1-opt.dll 
+    @if ERRORLEVEL 1 goto Error
+
+    "%FSC%" %fsc_flags% -o:module2-opt.exe -r:module1-opt.dll --optimize module2.fsx
+    @if ERRORLEVEL 1 goto Error
+
+    "%PEVERIFY%" module2-opt.exe 
+    @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/quotesInMultipleModules/module1.fsx b/tests/fsharp/core/quotesInMultipleModules/module1.fsx
new file mode 100644
index 0000000..8382f4a
--- /dev/null
+++ b/tests/fsharp/core/quotesInMultipleModules/module1.fsx
@@ -0,0 +1,11 @@
+module Test =
+    let inline run() = 
+       <@ fun (output:'T[]) (input:'T[]) (length:int) ->
+          let start = 0
+          let mutable i = start
+          while i < length do
+             output.[i] <- input.[i]
+             i <- i + 1 @>
+
+    let bar() = 
+        sprintf "%A" (run())
diff --git a/tests/fsharp/core/quotesInMultipleModules/module2.fsx b/tests/fsharp/core/quotesInMultipleModules/module2.fsx
new file mode 100644
index 0000000..aea75fb
--- /dev/null
+++ b/tests/fsharp/core/quotesInMultipleModules/module2.fsx
@@ -0,0 +1,9 @@
+let a = Module1.Test.bar()
+let b = sprintf "%A" (Module1.Test.run())
+if a = b then
+    stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0
+else
+    eprintf "FAILED, in-module result %s is different from out-module call %s" a b
+    exit 1
diff --git a/tests/fsharp/core/quotesInMultipleModules/run.bat b/tests/fsharp/core/quotesInMultipleModules/run.bat
new file mode 100644
index 0000000..d2faac8
--- /dev/null
+++ b/tests/fsharp/core/quotesInMultipleModules/run.bat
@@ -0,0 +1,53 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM fsi.exe testing
+
+
+echo TestC
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% -r module1.dll module2.fsx
+  if NOT EXIST test.ok goto SetError
+
+REM fsc.exe testing
+
+echo TestD
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% module2.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% module2-opt.exe
+    @if ERRORLEVEL 1 goto Error
+    if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat 1 %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/core/reflect/build.bat b/tests/fsharp/core/reflect/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/reflect/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/reflect/dont.pipe.to.stdin b/tests/fsharp/core/reflect/dont.pipe.to.stdin
new file mode 100644
index 0000000..2c74d24
--- /dev/null
+++ b/tests/fsharp/core/reflect/dont.pipe.to.stdin
@@ -0,0 +1,4 @@
+
+
+
+This test contains a leading 'namespace' declaration, and these can't be piped into FSI.EXE
\ No newline at end of file
diff --git a/tests/fsharp/core/reflect/dont.use.empty.signature b/tests/fsharp/core/reflect/dont.use.empty.signature
new file mode 100644
index 0000000..c1301f0
--- /dev/null
+++ b/tests/fsharp/core/reflect/dont.use.empty.signature
@@ -0,0 +1 @@
+foo  
diff --git a/tests/fsharp/core/reflect/dont.use.generated.signature b/tests/fsharp/core/reflect/dont.use.generated.signature
new file mode 100644
index 0000000..3da5c25
--- /dev/null
+++ b/tests/fsharp/core/reflect/dont.use.generated.signature
@@ -0,0 +1,2 @@
+
+Accessiblities are not printed in signatures
diff --git a/tests/fsharp/core/reflect/run.bat b/tests/fsharp/core/reflect/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/reflect/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/reflect/test.fs b/tests/fsharp/core/reflect/test.fs
new file mode 100644
index 0000000..c072562
--- /dev/null
+++ b/tests/fsharp/core/reflect/test.fs
@@ -0,0 +1,19 @@
+// #Conformance #Reflection #Unions #Tuples 
+module Test
+
+#nowarn "44"
+
+type PublicUnionType1 = X of string | XX of string * string
+type PublicUnionType2 = X2 | XX2 of string
+type PublicUnionType3<'T> = X3 | XX3 of 'T
+type PublicRecordType1 = { r1a : int }
+type PublicRecordType2<'T> = { r2b : 'T; r2a : int }
+[<CLIMutable>]
+type PublicRecordType3WithCLIMutable<'T> = { r3b : 'T; r3a : int }
+
+
+type internal InternalUnionType1 = InternalX of string | InternalXX of string * string
+type internal InternalUnionType2 = InternalX2 | InternalXX2 of string
+type internal InternalUnionType3<'T> = InternalX3 | InternalXX3 of 'T
+type internal InternalRecordType1 = { internal_r1a : int }
+type internal InternalRecordType2<'T> = { internal_r2b : 'T; internal_r2a : int }
diff --git a/tests/fsharp/core/reflect/test2.fs b/tests/fsharp/core/reflect/test2.fs
new file mode 100644
index 0000000..d0d3b13
--- /dev/null
+++ b/tests/fsharp/core/reflect/test2.fs
@@ -0,0 +1,315 @@
+// #Conformance #Reflection #Unions #Tuples 
+module Test2
+#nowarn "44"
+
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+
+
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+(* TEST SUITE FOR Microsoft.FSharp.Reflection *)
+
+open Test
+
+open Microsoft.FSharp.Reflection
+
+
+module NewTests = 
+    
+    let (|C|) (c:UnionCaseInfo) = c.Name, c.GetFields()
+    let (|M|) (c:System.Reflection.MethodInfo) = c.Name, c.MemberType
+    let (|P|) (c:System.Reflection.PropertyInfo) = c.Name, c.MemberType
+    let (|String|_|) (v:obj) = match v with :? string as s -> Some(s) | _ -> None
+    let (|Int|_|) (v:obj) = match v with :? int as s -> Some(s) | _ -> None
+    let showAll = System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.NonPublic 
+
+    do test "ncwowe932aq" (FSharpType.IsUnion (typeof<PublicUnionType1>)) 
+    do test "ncwowe932aw" (FSharpType.IsUnion (XX("1","2").GetType())) 
+    do test "ncwowe932ae" (FSharpType.IsUnion ((XX2 "1").GetType()))
+    do test "ncwowe932ar" (FSharpType.IsRecord (typeof<PublicRecordType1>)) 
+    do test "ncwowe932at" (FSharpType.IsRecord (typeof<PublicRecordType2<int>>)) 
+    do test "ncwowe932at" (FSharpType.IsRecord (typeof<PublicRecordType3WithCLIMutable<int>>)) 
+    do test "ncwowe932at" (not (FSharpType.IsFunction (typeof<PublicRecordType3WithCLIMutable<int>>)) )
+    do test "ncwowe932at" (not (FSharpType.IsExceptionRepresentation (typeof<PublicRecordType3WithCLIMutable<int>>)) )
+    do test "ncwowe932at" (not (FSharpType.IsUnion (typeof<PublicRecordType3WithCLIMutable<int>>)) )
+
+    
+    do test "ncwowe932ay" (FSharpType.IsFunction (typeof<(int -> int)>)) 
+    do test "ncwowe932au" (FSharpType.IsFunction ( (fun x -> x).GetType()))
+    do test "ncwowe932ai" (FSharpType.IsExceptionRepresentation (typeof< MatchFailureException>))
+
+    do test "ncwowe932a1" (not (FSharpType.IsExceptionRepresentation (typeof<int * int>))) 
+    do test "ncwowe932a2" (not (FSharpType.IsFunction (typeof<int * int>))) 
+    do test "ncwowe932a3" (not (FSharpType.IsUnion (typeof<int * int>))) 
+    do test "ncwowe932a4" (not (FSharpType.IsUnion (typeof<PublicRecordType1>))) 
+    do test "ncwowe932a5" (not (FSharpType.IsRecord (typeof<PublicUnionType1>))) 
+    do test "ncwowe932a6" (not (FSharpType.IsRecord (typeof<int * int>))) 
+    do test "ncwowe932a7" (not (FSharpType.IsFunction (typeof<int * int>))) 
+    do test "ncwowe932a8" (not (FSharpType.IsUnion (typeof<int * int>))) 
+    
+
+    do test "ncwowe932a" (match FSharpType.GetUnionCases (typeof<PublicUnionType1>) with [| C("X",[| _ |]); C("XX",[|_; _|]) |] -> true | _ -> false)
+    do test "ncwowe932gb" (match FSharpType.GetUnionCases (typeof<PublicUnionType2>) with [| C("X2",[||]); C("XX2",[|_|]) |]-> true | _ -> false)
+    do test "ncwowe932f" (match FSharpType.GetUnionCases (typeof<int option>) with [| C("None",[||]); C("Some", [| _ |]) |] -> true | _ -> false)
+    do test "ncwowe932e" (match FSharpType.GetUnionCases (typeof<int list>) with [| C("Empty",[||]); C("Cons", [|_;_|]) |] -> true | _ -> false)
+    do test "ncwowe932w" (match FSharpType.GetUnionCases (typeof<PublicUnionType3<int>>) with [| C("X3",[||]); C("XX3", [|_|]) |] -> true | _ -> false)
+    do test "ncwowe932ew" (match FSharpType.GetRecordFields (typeof<PublicRecordType1>) with [| P("r1a",_) |] -> true | _ -> false)
+    do test "ncwowe932q" (match FSharpType.GetRecordFields (typeof<PublicRecordType2<int>>) with  [| P("r2b",_); P("r2a",_) |] -> true | _ -> false)
+    do test "ncwowe932q" (match FSharpType.GetRecordFields (typeof<PublicRecordType3WithCLIMutable<int>>) with  [| P("r3b",_); P("r3a",_) |] -> true | _ -> false)
+    //do test "ncwowe932" (match Value.GetTypeInfo( () ) with UnitType _ -> true | _ -> false)
+    do test "ncqmkee32al1" (match FSharpValue.GetUnionFields(XX ("1","2"),null) with C("XX", [|_;_|]), [| String("1"); String("2") |] -> true | _ -> false)
+    do test "ncqmkee32al2" (match FSharpValue.GetUnionFields(XX2 "1",null) with C("XX2", [|_|]), [| String("1") |] -> true | _ -> false)
+    do test "ncqmkee32al3" (match FSharpValue.GetUnionFields([1],null) with C("Cons", [|_;_|]), [| Int(1); _ |] -> true | _ -> false)
+    do test "ncqmkee32al4" (match FSharpValue.GetUnionFields([1],typeof<list<int>>) with C("Cons", [|_;_|]), [| Int(1); _ |] -> true | _ -> false)
+    do test "ncqmkee32al5" (match FSharpValue.GetUnionFields([],null) with C("Empty", [||]), [| |] -> true | _ -> false)
+    do test "ncqmkee32al6" (match FSharpValue.GetUnionFields(([]:list<int>),typeof<list<int>>) with C("Empty", [||]), [| |] -> true | _ -> false)
+
+    do test "ncqmkee32al7" (match FSharpValue.GetUnionFields(Some(1),null) with C("Some", [|_|]), [| Int(1) |] -> true | _ -> false)
+    do test "ncqmkee32al8" (match FSharpValue.GetUnionFields(Some(1),typeof<option<int>>) with C("Some", [|_|]), [| Int(1) |] -> true | _ -> false)
+    do test "ncqmkee32al9" (match FSharpValue.GetUnionFields(None,typeof<option<int>>) with C("None", [||]), [| |] -> true | _ -> false)
+
+    do test "ncqmkee32ala" (match FSharpValue.GetUnionFields(Some(Some(1)),null) with C("Some", [|_|]), [| _ |] -> true | _ -> false)
+    do test "ncqmkee32alb" (match FSharpValue.GetUnionFields(Some("abc"),null) with C("Some", [|_|]), [| String("abc") |] -> true | _ -> false)
+
+    do test "ncqmkee32alc" (match FSharpValue.GetRecordFields(ref 1) with [| Int(1) |] -> true | _ -> false)
+
+    do test "ncqmkee32g1" (try ignore(FSharpValue.GetRecordFields(1)); false with :? System.ArgumentException -> true)
+    do test "ncqmkee32g2" (try ignore(FSharpValue.GetRecordFields([1])); false with :? System.ArgumentException -> true)
+    do test "ncqmkee32g3" (try ignore(FSharpValue.GetRecordFields(None)); false with :? System.ArgumentException -> true)
+    do test "ncqmkee32g4" (try ignore(FSharpValue.GetRecordFields(Some(1))); false with :? System.ArgumentException -> true)
+    do test "ncqmkee32g5" (try ignore(FSharpValue.GetRecordFields(1M)); false with :? System.ArgumentException -> true)
+
+    do test "ncqmkee32j" (match FSharpValue.GetTupleFields((1,2)) with  [|Int(1);Int(2)|] -> true | _ -> false)
+    do test "ncqmkee32k" (match FSharpValue.GetTupleFields((1,2,3)) with [|Int(1);Int(2);Int(3)|] -> true | _ -> false)
+    do test "ncqmkee32l" (match FSharpValue.GetTupleFields((1,2,3,4)) with [|Int(1);Int(2);Int(3);Int(4)|] -> true | _ -> false)
+    do test "ncqmkee32m" (match FSharpValue.GetTupleFields((1,2,3,4,5)) with [|Int(1);Int(2);Int(3);Int(4);Int(5)|] -> true | _ -> false)
+    do test "ncqmkee32n" (match FSharpValue.GetTupleFields((1,2,3,4,5,6)) with [|Int(1);Int(2);Int(3);Int(4);Int(5);Int(6)|] -> true | _ -> false)
+    do test "ncqmkee32o" (match FSharpValue.GetTupleFields((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)) with [|Int(1);Int(2);Int(3);Int(4);Int(5);Int(6);Int(7);Int(8);Int(9);Int(10);Int(11);Int(12);Int(13);Int(14);Int(15);Int(16)|] -> true | _ -> false)
+
+    do test "ncqmkee32ao" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType1>).[1]) (box (XX ("1","2"))) with [| String("1");String("2") |] -> true | _ -> false)
+    do test "ncqmkee32ap" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType1>).[0]) (box (X "1")) with [| String("1") |] -> true | _ -> false)
+    do test "ncqmkee32aq" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType2>).[1]) (box (XX2 "1")) with [| String("1") |] -> true | _ -> false)
+    do test "ncqmkee32ar" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType2>).[0]) (box X2) with [| |] -> true | _ -> false)
+    do test "ncqmkee32bs" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<list<int>>).[1]) (box [100]) with [| Int(100);_ |] -> true | _ -> false)
+    do test "ncqmkee32bt" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<list<int>>).[0]) (box ([]:list<int>)) with [| |] -> true | _ -> false)
+    do test "ncqmkee32bu" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<option<int>>).[1]) (box (Some(1))) with [| Int(1) |] -> true | _ -> false)
+    do test "ncqmkee32bu" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<option<int>>).[0]) (box (None:int option)) with [| |] -> true | _ -> false)
+    do test "ncqmkee32f" (match FSharpValue.PreComputeRecordReader (typeof<int ref>) (box (ref 1)) with [| Int(1) |] -> true | _ -> false)
+    do test "ncqmkee33h" (match  FSharpValue.PreComputeTupleReader (typeof<int * int>) (box (1,2)) with [| Int(1);Int(2) |] -> true | _ -> false)
+    do test "ncqmkee33h" (match  FSharpValue.PreComputeTupleReader (typeof<int * int * int>) (box (1,2,3)) with [| Int(1);Int(2);Int(3) |] -> true | _ -> false)
+    do test "ncqmkee33h" (match  FSharpValue.PreComputeTupleReader (typeof<int * int * int * int>) (box (1,2,3,4)) with [| Int(1);Int(2);Int(3);Int(4) |] -> true | _ -> false)
+    do test "ncqmkee33h" (match  FSharpValue.PreComputeTupleReader (typeof<int * int * int * int * int>) (box (1,2,3,4,5)) with [| Int(1);Int(2);Int(3);Int(4);Int(5) |] -> true | _ -> false)
+    do test "ncqmkee33h" (match  FSharpValue.PreComputeTupleReader (typeof<int * int * int * int * int * int>) (box (1,2,3,4,5,6)) with [| Int(1);Int(2);Int(3);Int(4);Int(5);Int(6) |] -> true | _ -> false)
+    do test "ncqmkee33i" (match  FSharpValue.PreComputeTupleReader (typeof<int * int * int * int * int * int * int * int * int * int * int * int * int * int * int * int>) (box (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)) with [|Int(1);Int(2);Int(3);Int(4);Int(5);Int(6);Int(7);Int(8);Int(9);Int(10);Int(11);Int(12);Int(13);Int(14);Int(15);Int(16)|] -> true | _ -> false)
+
+
+    let UCI (ty,i) = FSharpType.GetUnionCases(ty).[i]
+    
+    do test "ncqmkee32ao1" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType1>, 0)) [| box "1" |] = box (X "1"))
+    do test "ncqmkee32ao2" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType1>, 1)) [| box "1"; box "2" |] = box (XX ("1","2")))
+    do test "ncqmkee32ao3" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType2>, 0)) [|  |] = box X2)
+    do test "ncqmkee32ao4" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType2>, 1)) [| box "1"; |] = box (XX2 "1"))
+    do test "ncqmkee32ao5" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<int PublicUnionType3>, 0)) [|  |] = box (X3 : int PublicUnionType3))
+    do test "ncqmkee32ao6" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<string PublicUnionType3>, 1)) [| box "1"; |] = box (XX3 "1"))
+    do test "ncqmkee32ao7" (FSharpValue.PreComputeRecordConstructor(typeof<PublicRecordType1>) [| box 1; |] = box {r1a = 1 })
+    do test "ncqmkee32ao8" (FSharpValue.PreComputeRecordConstructor(typeof<PublicRecordType2<string>>) [| box "1"; box 1 |] = box {r2b = "1"; r2a = 1 })
+    do test "ncqmkee32ao8" (FSharpValue.PreComputeRecordConstructor(typeof<PublicRecordType3WithCLIMutable<string>>) [| box "1"; box 1 |] = box {r3b = "1"; r3a = 1 })
+
+    do test "ncqmkee33h1" (FSharpValue.PreComputeTupleConstructor(typeof<int * int>) [| box 1; box 2 |] = box (1,2))
+    do test "ncqmkee33h2" (FSharpValue.PreComputeTupleConstructor(typeof<int * int * int>) [| box 1; box 2; box 3 |] = box (1,2,3))
+    do test "ncqmkee33h3" (FSharpValue.PreComputeTupleConstructor(typeof<int * int * int * int>) [| box 1; box 2; box 3; box 4 |] = box (1,2,3,4))
+    do test "ncqmkee33h4" (FSharpValue.PreComputeTupleConstructor(typeof<int * int * int * int * int>) [| box 1; box 2; box 3; box 4; box 5 |] = box (1,2,3,4,5))
+    do test "ncqmkee33h5" (FSharpValue.PreComputeTupleConstructor(typeof<int * int * int * int * int * int>) [| box 1; box 2; box 3; box 4; box 5; box 6 |] = box (1,2,3,4,5,6))
+
+    do test "ncqmkee33h6" (FSharpValue.PreComputeTupleConstructor(typeof<string * string>) [| box "1"; box "2" |] = box ("1","2"))
+    do test "ncqmkee33h7" (FSharpValue.PreComputeTupleConstructor(typeof<string * string * string>) [| box "1"; box "2"; box "3" |] = box ("1","2","3"))
+    do test "ncqmkee33h8" (FSharpValue.PreComputeTupleConstructor(typeof<string * string * string * string>) [| box "1"; box "2"; box "3"; box "4" |] = box ("1","2","3","4"))
+    do test "ncqmkee33h9" (FSharpValue.PreComputeTupleConstructor(typeof<string * string * string * string * string * string * string * string * string * string * string * string * string * string * string * string>) [| box "1"; box "2"; box "3"; box "4"; box "5"; box "6"; box "7"; box "8"; box "9"; box "10"; box "11"; box "12"; box "13"; box "14"; box "15"; box "16"|] = box ("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"))
+
+    let badarg f = try ignore(f()); false with :? System.ArgumentException -> true
+    
+    do test "mcwowe932a" (badarg (fun () -> FSharpType.GetUnionCases (typeof<InternalUnionType1>)))
+    do test "mcwowe932gb" (badarg (fun () -> FSharpType.GetUnionCases (typeof<InternalUnionType2>)))
+    do test "mcwowe932w" (badarg (fun () -> FSharpType.GetUnionCases (typeof<InternalUnionType3<int>>)))
+    do test "mcwowe932ew" (badarg (fun () -> FSharpType.GetRecordFields (typeof<InternalRecordType1>)))
+    do test "mcwowe932q" (badarg (fun () -> FSharpType.GetRecordFields (typeof<InternalRecordType2<int>>)))
+    do test "mcqmkee32al1" (badarg (fun () -> FSharpValue.GetUnionFields(InternalXX ("1","2"),null)))
+    do test "mcqmkee32al2" (badarg (fun () -> FSharpValue.GetUnionFields(InternalXX2 "1",null)))
+
+
+    do test "mcqmkee32ao" (badarg (fun () -> FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<InternalUnionType1>).[1])))
+    do test "mcqmkee32ap" (badarg (fun () ->  FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<InternalUnionType1>).[0])))
+    do test "mcqmkee32aq" (badarg (fun () ->  FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<InternalUnionType2>).[1])))
+    do test "mcqmkee32ar" (badarg (fun () ->  FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<InternalUnionType2>).[0])))
+    
+    do test "mcqmkee32ao1" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<InternalUnionType1>, 0))))
+    do test "mcqmkee32ao2" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<InternalUnionType1>, 1))))
+    do test "mcqmkee32ao3" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<InternalUnionType2>, 0))))
+    do test "mcqmkee32ao4" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<InternalUnionType2>, 1))))
+    do test "mcqmkee32ao5" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<int InternalUnionType3>, 0))))
+    do test "mcqmkee32ao6" (badarg (fun () -> FSharpValue.PreComputeUnionReader(UCI(typeof<string InternalUnionType3>, 1))))
+    do test "mcqmkee32ao7" (badarg (fun () -> FSharpValue.PreComputeRecordReader(typeof<InternalRecordType1>)))
+    do test "ncqmkee32ao8" (badarg (fun () -> FSharpValue.PreComputeRecordReader(typeof<string InternalRecordType2>)))
+
+    module RepeatTestsWithShowAll  =
+        do test "ncwowe932a" (match FSharpType.GetUnionCases (typeof<PublicUnionType1>,showAll) with [| C("X",[| _ |]); C("XX",[|_; _|]) |] -> true | _ -> false)
+        do test "ncwowe932gb" (match FSharpType.GetUnionCases (typeof<PublicUnionType2>,showAll) with [| C("X2",[||]); C("XX2",[|_|]) |]-> true | _ -> false)
+        do test "ncwowe932f" (match FSharpType.GetUnionCases (typeof<int option>,showAll) with [| C("None",[||]); C("Some", [| _ |]) |] -> true | _ -> false)
+        do test "ncwowe932e" (match FSharpType.GetUnionCases (typeof<int list>,showAll) with [| C("Empty",[||]); C("Cons", [|_;_|]) |] -> true | _ -> false)
+        do test "ncwowe932w" (match FSharpType.GetUnionCases (typeof<PublicUnionType3<int>>,showAll) with [| C("X3",[||]); C("XX3", [|_|]) |] -> true | _ -> false)
+        do test "ncwowe932ew" (match FSharpType.GetRecordFields (typeof<PublicRecordType1>,showAll) with [| P("r1a",_) |] -> true | _ -> false)
+        do test "ncwowe932q" (match FSharpType.GetRecordFields (typeof<PublicRecordType2<int>>,showAll) with  [| P("r2b",_); P("r2a",_) |] -> true | _ -> false)
+        do test "ncwowe932q" (match FSharpType.GetRecordFields (typeof<PublicRecordType3WithCLIMutable<int>>,showAll) with  [| (P("r3b",_) as p1); (P("r3a",_) as p2) |] -> p1.CanWrite && p2.CanWrite | _ -> false)
+        do test "ncqmkee32al1" (match FSharpValue.GetUnionFields(XX ("1","2"),null,showAll) with C("XX", [|_;_|]), [| String("1"); String("2") |] -> true | _ -> false)
+        do test "ncqmkee32al2" (match FSharpValue.GetUnionFields(XX2 "1",null,showAll) with C("XX2", [|_|]), [| String("1") |] -> true | _ -> false)
+        do test "ncqmkee32al3" (match FSharpValue.GetUnionFields([1],null,showAll) with C("Cons", [|_;_|]), [| Int(1); _ |] -> true | _ -> false)
+        do test "ncqmkee32al4" (match FSharpValue.GetUnionFields([1],typeof<list<int>>,showAll) with C("Cons", [|_;_|]), [| Int(1); _ |] -> true | _ -> false)
+        do test "ncqmkee32al5" (match FSharpValue.GetUnionFields([],null,showAll) with C("Empty", [||]), [| |] -> true | _ -> false)
+        do test "ncqmkee32al6" (match FSharpValue.GetUnionFields(([]:list<int>),typeof<list<int>>,showAll) with C("Empty", [||]), [| |] -> true | _ -> false)
+
+        do test "ncqmkee32al7" (match FSharpValue.GetUnionFields(Some(1),null,showAll) with C("Some", [|_|]), [| Int(1) |] -> true | _ -> false)
+        do test "ncqmkee32al8" (match FSharpValue.GetUnionFields(Some(1),typeof<option<int>>,showAll) with C("Some", [|_|]), [| Int(1) |] -> true | _ -> false)
+        do test "ncqmkee32al9" (match FSharpValue.GetUnionFields(None,typeof<option<int>>,showAll) with C("None", [||]), [| |] -> true | _ -> false)
+
+        do test "ncqmkee32ala" (match FSharpValue.GetUnionFields(Some(Some(1)),null,showAll) with C("Some", [|_|]), [| _ |] -> true | _ -> false)
+        do test "ncqmkee32alb" (match FSharpValue.GetUnionFields(Some("abc"),null,showAll) with C("Some", [|_|]), [| String("abc") |] -> true | _ -> false)
+
+        do test "ncqmkee32alc" (match FSharpValue.GetRecordFields(ref 1,showAll) with [| Int(1) |] -> true | _ -> false)
+
+        do test "ncqmkee32g1" (try ignore(FSharpValue.GetRecordFields(1,showAll)); false with :? System.ArgumentException -> true)
+        do test "ncqmkee32g2" (try ignore(FSharpValue.GetRecordFields([1],showAll)); false with :? System.ArgumentException -> true)
+        do test "ncqmkee32g3" (try ignore(FSharpValue.GetRecordFields(None,showAll)); false with :? System.ArgumentException -> true)
+        do test "ncqmkee32g4" (try ignore(FSharpValue.GetRecordFields(Some(1),showAll)); false with :? System.ArgumentException -> true)
+        do test "ncqmkee32g5" (try ignore(FSharpValue.GetRecordFields(1M,showAll)); false with :? System.ArgumentException -> true)
+
+        do test "ncqmkee32ao" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType1>,showAll).[1]) (box (XX ("1","2"))) with [| String("1");String("2") |] -> true | _ -> false)
+        do test "ncqmkee32ap" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType1>,showAll).[0]) (box (X "1")) with [| String("1") |] -> true | _ -> false)
+        do test "ncqmkee32aq" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType2>,showAll).[1]) (box (XX2 "1")) with [| String("1") |] -> true | _ -> false)
+        do test "ncqmkee32ar" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<PublicUnionType2>,showAll).[0]) (box X2) with [| |] -> true | _ -> false)
+        do test "ncqmkee32bs" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<list<int>>,showAll).[1]) (box [100]) with [| Int(100);_ |] -> true | _ -> false)
+        do test "ncqmkee32bt" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<list<int>>,showAll).[0]) (box ([]:list<int>)) with [| |] -> true | _ -> false)
+        do test "ncqmkee32bu" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<option<int>>,showAll).[1]) (box (Some(1))) with [| Int(1) |] -> true | _ -> false)
+        do test "ncqmkee32bu" (match FSharpValue.PreComputeUnionReader (FSharpType.GetUnionCases(typeof<option<int>>,showAll).[0]) (box (None:int option)) with [| |] -> true | _ -> false)
+        do test "ncqmkee32f" (match FSharpValue.PreComputeRecordReader (typeof<int ref>,showAll) (box (ref 1)) with [| Int(1) |] -> true | _ -> false)
+
+
+        let UCI (ty,i) = FSharpType.GetUnionCases(ty).[i]
+        
+        do test "ncqmkee32ao1" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType1>, 0),showAll) [| box "1" |] = box (X "1"))
+        do test "ncqmkee32ao2" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType1>, 1),showAll) [| box "1"; box "2" |] = box (XX ("1","2")))
+        do test "ncqmkee32ao3" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType2>, 0),showAll) [|  |] = box X2)
+        do test "ncqmkee32ao4" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<PublicUnionType2>, 1),showAll) [| box "1"; |] = box (XX2 "1"))
+        do test "ncqmkee32ao5" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<int PublicUnionType3>, 0),showAll) [|  |] = box (X3 : int PublicUnionType3))
+        do test "ncqmkee32ao6" (FSharpValue.PreComputeUnionConstructor(UCI(typeof<string PublicUnionType3>, 1),showAll) [| box "1"; |] = box (XX3 "1"))
+        do test "ncqmkee32ao7" (FSharpValue.PreComputeRecordConstructor(typeof<PublicRecordType1>,showAll) [| box 1; |] = box {r1a = 1 })
+        do test "ncqmkee32ao8a" (FSharpValue.PreComputeRecordConstructor(typeof<string PublicRecordType2>,showAll) [| box "1"; box 1 |] = box {r2b = "1"; r2a = 1 })
+        do test "ncqmkee32ao8b" (FSharpValue.PreComputeRecordConstructor(typeof<PublicRecordType3WithCLIMutable<string>>,showAll) [| box "1"; box 1 |] = box {r3b = "1"; r3a = 1 })
+        do test "ncqmkee32ao8c" (typeof<PublicRecordType3WithCLIMutable<string>>.GetConstructor([| |]) <> null) 
+
+        
+    
+    open System.Reflection
+    do printfn "%A" (FSharpType.GetUnionCases (typeof<InternalUnionType1>, showAll))
+    do test "qcwowe932a" (match FSharpType.GetUnionCases (typeof<InternalUnionType1>, showAll) with [| C("InternalX",[| _ |]); C("InternalXX",[|_; _|]) |] -> true | _ -> false)
+    do test "qcwowe932gb" (match FSharpType.GetUnionCases (typeof<InternalUnionType2>, showAll) with [| C("InternalX2",[||]); C("InternalXX2",[|_|]) |]-> true | _ -> false)
+    do test "qcwowe932w" (match FSharpType.GetUnionCases (typeof<InternalUnionType3<int>>, showAll) with [| C("InternalX3",[||]); C("InternalXX3", [|_|]) |] -> true | _ -> false)
+    do test "qcwowe932ew" (match FSharpType.GetRecordFields (typeof<InternalRecordType1>, showAll) with [| P("internal_r1a",_) |] -> true | _ -> false)
+    do printfn "%A" (FSharpType.GetRecordFields (typeof<InternalRecordType2<int>>, showAll))
+    do test "qcwowe932q" (match FSharpType.GetRecordFields (typeof<InternalRecordType2<int>>, showAll) with  [| P("internal_r2b",_); P("internal_r2a",_) |] -> true | _ -> false)
+    do test "qcqmkee32al1" (match FSharpValue.GetUnionFields(InternalXX ("1","2"),null, showAll) with C("InternalXX", [|_;_|]), [| String("1"); String("2") |] -> true | _ -> false)
+    do test "qcqmkee32al2" (match FSharpValue.GetUnionFields(InternalXX2 "1",null, showAll) with C("InternalXX2", [|_|]), [| String("1") |] -> true | _ -> false)
+
+
+    let UCI2 (ty,i) = FSharpType.GetUnionCases(ty, showAll).[i]
+    
+    do test "qcqmkee32ao" (match FSharpValue.PreComputeUnionReader (UCI2(typeof<InternalUnionType1>, 1),showAll) (box (InternalXX ("1","2"))) with [| String("1");String("2") |] -> true | _ -> false)
+    do test "qcqmkee32ap" (match FSharpValue.PreComputeUnionReader (UCI2(typeof<InternalUnionType1>, 0),showAll) (box (InternalX "1")) with [| String("1") |] -> true | _ -> false)
+    do test "qcqmkee32aq" (match FSharpValue.PreComputeUnionReader (UCI2(typeof<InternalUnionType2>, 1),showAll) (box (InternalXX2 "1")) with [| String("1") |] -> true | _ -> false)
+    do test "qcqmkee32ar" (match FSharpValue.PreComputeUnionReader (UCI2(typeof<InternalUnionType2>, 0),showAll) (box InternalX2) with [| |] -> true | _ -> false)
+
+    do test "qcqmkee32ao1" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<InternalUnionType1>, 0), showAll) [| box "1" |] = box (InternalX "1"))
+    do test "qcqmkee32ao2" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<InternalUnionType1>, 1), showAll) [| box "1"; box "2" |] = box (InternalXX ("1","2")))
+    do test "qcqmkee32ao3" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<InternalUnionType2>, 0), showAll) [|  |] = box InternalX2)
+    do test "qcqmkee32ao4" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<InternalUnionType2>, 1), showAll) [| box "1"; |] = box (InternalXX2 "1"))
+    do test "qcqmkee32ao5" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<int InternalUnionType3>, 0), showAll) [|  |] = box (InternalX3 : int InternalUnionType3))
+    do test "qcqmkee32ao6" (FSharpValue.PreComputeUnionConstructor(UCI2(typeof<string InternalUnionType3>, 1), showAll) [| box "1"; |] = box (InternalXX3 "1"))
+    do test "qcqmkee32ao7" (FSharpValue.PreComputeRecordConstructor(typeof<InternalRecordType1>, showAll) [| box 1; |] = box {internal_r1a = 1 })
+    do test "qcqmkee32ao8" (FSharpValue.PreComputeRecordConstructor(typeof<string InternalRecordType2>, showAll) [| box "1"; box 1 |] = box {internal_r2b = "1"; internal_r2a = 1 })
+
+module TwoCasedUnionWithNullAsTrueValueAnnotation =
+    [<Core.CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type T =
+        | A
+        | B of string * bool
+    let result =
+        try
+            let cases = Reflection.FSharpType.GetUnionCases(typeof<T>)
+            let mkA = Reflection.FSharpValue.PreComputeUnionConstructor(cases.[0])
+            let mkB = Reflection.FSharpValue.PreComputeUnionConstructor(cases.[1])
+            (mkA [||] :?> _ = A) && (mkB [|"a"; true|] :?> _ = B("a", true))
+        with _ -> false
+    test "TwoCasedUnionWithNullAsTrueValueAnnotation" result
+
+module TEst = begin
+
+  type token = 
+   | X
+   | DOUBLELITERAL  of (System.Double)
+   | DECIMALLITERAL of (System.Decimal)
+   | Y              of (int)
+   | INTEGERLITERAL
+   | VARNAME       
+   | QNAME          of (string)   
+  let tok2 = (X:token)
+  let _   = printfn "%A" tok2
+
+
+  let printany x = (printf "%A" x;stderr.Write "\n")
+    
+  let _ = printany (1    : int)
+  let _ = printany (true : bool)
+  let _ = printany (27.3 : float)
+  let _ = printany "IAmAString with some spaces and quotes \"'"
+
+  type rr = { rr_int : int; rr_strs : string list; rr_thunk : unit -> unit}
+  let rrv =  {rr_int = 99;
+      rr_strs = ["skdf";"kshkshfskhf"];
+      rr_thunk = fun () -> ()}
+  let _ = printany rrv
+    
+  let _ = printany ["Lists";"have";"special";"treatment";"hence";"this";"test";"case"]
+  let _ = printany []
+  let _ = printany (Some "options likewise")
+  let _ = printany None
+
+  let poly (x:'a) = printany (None : 'a option)
+  let _ = poly 12
+  let _ = poly true
+
+  let _ = printany (1,true,2.4,"a tuple",("nested",(fun () -> ()),[2;3],rrv))
+  let _ = printany printany (* =) *)
+
+end
+
+
+let _ = 
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
+
+
diff --git a/tests/fsharp/core/resources/Icon1.ico b/tests/fsharp/core/resources/Icon1.ico
new file mode 100644
index 0000000..1e45291
Binary files /dev/null and b/tests/fsharp/core/resources/Icon1.ico differ
diff --git a/tests/fsharp/core/resources/Image1.bmp b/tests/fsharp/core/resources/Image1.bmp
new file mode 100644
index 0000000..6c54218
Binary files /dev/null and b/tests/fsharp/core/resources/Image1.bmp differ
diff --git a/tests/fsharp/core/resources/Resources.resx b/tests/fsharp/core/resources/Resources.resx
new file mode 100644
index 0000000..3f899a9
--- /dev/null
+++ b/tests/fsharp/core/resources/Resources.resx
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+  <data name="chimes" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>chimes.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="Icon1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>Icon1.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="Image1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>Image1.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="String1">
+    <value xml:space="preserve">Hello</value>
+    <comment xml:space="preserve">Commen</comment>
+  </data>
+  <data name="TextFile1" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>TextFile1.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1</value>
+  </data>
+</root>
\ No newline at end of file
diff --git a/tests/fsharp/core/resources/TextFile1.txt b/tests/fsharp/core/resources/TextFile1.txt
new file mode 100644
index 0000000..7f807a3
--- /dev/null
+++ b/tests/fsharp/core/resources/TextFile1.txt
@@ -0,0 +1,3 @@
+
+Hello.  THis is a Text File.
+
diff --git a/tests/fsharp/core/resources/build.bat b/tests/fsharp/core/resources/build.bat
new file mode 100644
index 0000000..29cae10
--- /dev/null
+++ b/tests/fsharp/core/resources/build.bat
@@ -0,0 +1,63 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+  REM Note that you have a VS SDK dependence here.
+  "%RESGEN%" /compile Resources.resx
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags%  --resource:Resources.resources -o:test-embed.exe -g test.fs      
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-embed.exe 
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags%  --linkresource:Resources.resources -o:test-link.exe -g test.fs      
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-link.exe
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags%  --resource:Resources.resources,ResourceName.resources -o:test-embed-named.exe -g test.fs      
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-embed-named.exe
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags%  --linkresource:Resources.resources,ResourceName.resources -o:test-link-named.exe -g test.fs      
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" test-link-named.exe
+  @if ERRORLEVEL 1 goto Error
+
+
+
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/resources/chimes.wav b/tests/fsharp/core/resources/chimes.wav
new file mode 100644
index 0000000..265a37f
Binary files /dev/null and b/tests/fsharp/core/resources/chimes.wav differ
diff --git a/tests/fsharp/core/resources/run.bat b/tests/fsharp/core/resources/run.bat
new file mode 100644
index 0000000..6f89e03
--- /dev/null
+++ b/tests/fsharp/core/resources/run.bat
@@ -0,0 +1,42 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+REM **************************
+
+  %CLIX% .\test-embed.exe
+  if ERRORLEVEL 1 goto Error
+
+
+  %CLIX% .\test-link.exe
+  if ERRORLEVEL 1 goto Error
+
+  %CLIX% .\test-link-named.exe ResourceName
+  if ERRORLEVEL 1 goto Error
+
+  %CLIX% .\test-embed-named.exe ResourceName
+  if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/resources/test.fs b/tests/fsharp/core/resources/test.fs
new file mode 100644
index 0000000..b41d71d
--- /dev/null
+++ b/tests/fsharp/core/resources/test.fs
@@ -0,0 +1,32 @@
+// #Conformance 
+#indent "off"
+
+
+open System.Resources
+
+type Resources = A
+
+let foreachE (e : System.Collections.IEnumerator) (f : 'a -> unit) = 
+  while (e.MoveNext()) do
+    f (unbox e.Current);
+  done
+
+
+let main() = 
+  let ass = (typeof<Resources>).Assembly in 
+  Printf.printf "ass = %s\n" (ass.ToString());
+  let args = System.Environment.GetCommandLineArgs() in
+  let rname = if Array.length args > 1 then args.[1] else "Resources" in 
+  let resourceMan = new System.Resources.ResourceManager(rname, (typeof<Resources>).Assembly) in 
+  let resourceCulture = (null : System.Globalization.CultureInfo) in 
+  let image1 : System.Drawing.Bitmap = resourceMan.GetObject("Image1", resourceCulture) :?> System.Drawing.Bitmap in 
+  let chimes : System.IO.UnmanagedMemoryStream = resourceMan.GetStream("chimes", resourceCulture) in 
+  let icon1 : System.Drawing.Icon = resourceMan.GetObject("Icon1", resourceCulture) :?> System.Drawing.Icon in
+  Printf.printf "chimes = %s\n" (chimes.ToString());
+  Printf.printf "icon1 = %s\n" (icon1.ToString());
+  Printf.printf "image1 = %s\n" (image1.ToString())
+
+
+
+do main()
+
diff --git a/tests/fsharp/core/seq/build.bat b/tests/fsharp/core/seq/build.bat
new file mode 100644
index 0000000..f352dbd
--- /dev/null
+++ b/tests/fsharp/core/seq/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+ 
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/seq/run.bat b/tests/fsharp/core/seq/run.bat
new file mode 100644
index 0000000..604aecc
--- /dev/null
+++ b/tests/fsharp/core/seq/run.bat
@@ -0,0 +1,13 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
diff --git a/tests/fsharp/core/seq/test.fsx b/tests/fsharp/core/seq/test.fsx
new file mode 100644
index 0000000..e245263
--- /dev/null
+++ b/tests/fsharp/core/seq/test.fsx
@@ -0,0 +1,500 @@
+// #Regression #Conformance #Sequences 
+#if Portable
+module Core_seq
+#endif
+
+#nowarn "62"
+#nowarn "44"
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+(* TEST SUITE FOR STANDARD LIBRARY *)
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s^": YES") 
+  else (stdout.WriteLine ("\n***** "^s^": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+
+  
+check "rwfsjkla"
+   (let results = ref []
+    let ys =
+        seq {
+            try
+                try
+                    failwith "foo"
+                finally
+                    results := 1::!results
+                    failwith "bar"
+            finally
+                results := 2::!results
+        }        
+    try
+        for _ in ys do ()
+    with
+        Failure "bar" -> results := 3::!results
+    !results)
+    [3;2;1]
+    
+check "fgyeyrkerkl"
+   (let results = ref []
+    let xs = 
+        seq {
+            try
+                try
+                    failwith "foo"
+                finally
+                    results := "a"::!results
+                    failwith "bar"
+            finally
+              results := "c"::!results
+              failwith "bar1"
+        }
+
+    let ys =
+        seq {
+            yield 1
+            yield! xs
+        }
+    try
+        for _ in ys do ()
+    with
+        Failure "bar1" -> results := "with"::!results
+    !results)
+    ["with";"c";"a"]
+
+
+check "rwfsfsdgba"
+   (let results = ref []
+    let ys =
+        seq {
+            try
+                try
+                    do ()
+                finally
+                    results := 1::!results
+                    failwith "bar"
+            finally
+                results := 2::!results
+                failwith "bar2"
+        }        
+    try
+        for _ in ys do ()
+    with
+        Failure "bar2" -> results := 3::!results
+    !results)
+    [3;2;1]
+
+check "fgwehyr1"
+   (let results = ref []
+    let outerFinallyCalled = ref false
+    let innerFinallyCalled = ref false
+    let ys =
+       seq {
+          try 
+             try
+                yield 1
+                failwith "kaboom"
+                yield 2
+             finally
+                innerFinallyCalled := true
+          finally
+             outerFinallyCalled := true
+       }
+    // Capturing precisely when what happens
+    let yIter = ys.GetEnumerator()
+    yIter.MoveNext() |> ignore
+    try
+        yIter.MoveNext() |> ignore
+    with
+        Failure "kaboom" ->
+            results := "kaboom"::!results
+            
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   false,false -> 
+            results := "beforeFinallyOk"::!results
+    |   _ -> ()            
+    yIter.Dispose()
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   true,true -> 
+            results := "afterFinallyOk"::!results
+    |   _ -> ()
+    !results)
+    ["afterFinallyOk";"beforeFinallyOk";"kaboom"]
+
+check "fgwehyr2"
+   (let results = ref []
+    let outerFinallyCalled = ref false
+    let innerFinallyCalled = ref false
+    let ys =
+       seq {
+          try 
+             try
+                yield 1
+                yield 2
+             finally
+                innerFinallyCalled := true
+          finally
+             outerFinallyCalled := true
+       }
+    // Capturing precisely when what happens
+    let yIter = ys.GetEnumerator()
+    yIter.MoveNext() |> ignore
+    yIter.MoveNext() |> ignore
+    yIter.MoveNext() |> ignore            
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   true,true -> 
+            results := "finallyOk"::!results
+    |   _ -> ()            
+    innerFinallyCalled := false
+    outerFinallyCalled := false
+    yIter.Dispose()
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   false,false -> 
+            results := "disposeOk"::!results
+    |   _ -> ()            
+    
+    !results)
+    ["disposeOk";"finallyOk"]
+
+check "fgwehyr3"
+   (let results = ref []
+    let outerFinallyCalled = ref false
+    let innerFinallyCalled = ref false
+    let ys =
+       seq {
+          try 
+             try
+                yield 1
+                yield 2
+             finally
+                innerFinallyCalled := true
+                failwith "Kaboom"
+          finally
+             outerFinallyCalled := true
+       }
+    // Capturing precisely when what happens
+    let yIter = ys.GetEnumerator()
+    yIter.MoveNext() |> ignore
+    yIter.MoveNext() |> ignore
+    try
+        yIter.MoveNext() |> ignore            
+    with
+        Failure "Kaboom" ->
+            match !innerFinallyCalled, !outerFinallyCalled with
+            |   true,false -> 
+                    results := "innerFinally at lastMoveNext"::!results
+            |   _ -> ()            
+    innerFinallyCalled := false
+    outerFinallyCalled := false
+    yIter.Dispose()        
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   false,true -> 
+            results := "outerFinally at Dispose"::!results
+    |   _ -> ()            
+    
+    !results)
+    ["outerFinally at Dispose";"innerFinally at lastMoveNext"]
+
+check "fgryerwfre"
+   (let results = ref []
+    let outerFinallyCalled = ref false
+    let innerFinallyCalled = ref false
+    let ys i =
+        seq {
+            match i with
+            |   1 ->
+                    try
+                        try 
+                            failwith "foo"
+                        finally
+                            innerFinallyCalled := true
+                    finally
+                        outerFinallyCalled := true
+            |   _ ->
+                    do ()
+        }
+    try
+        for _ in ys 1 do ()
+    with
+        Failure "foo" -> 
+            match !innerFinallyCalled, !outerFinallyCalled with
+            |   true, true -> results := "ok1"::!results
+            |   _ -> ()
+
+    innerFinallyCalled := false
+    outerFinallyCalled := false
+    for _ in ys 2 do ()
+    match !innerFinallyCalled, !outerFinallyCalled with
+    |   false, false -> results := "ok2"::!results
+    |   _ -> ()
+    !results)
+    ["ok2";"ok1"]          
+                        
+check "rt6we56qera"
+   (let results = ref []
+    let innerFinallyCalled = ref false
+    let middleFinallyCalled = ref false
+    let outerFinallyCalled = ref false
+    let ys =
+        seq {
+            try
+                try
+                    try
+                        yield 0
+                        failwith "inner"
+                        yield 1
+                    finally
+                        innerFinallyCalled := true
+                        failwith "middle"
+                    yield 2
+                finally
+                    middleFinallyCalled := true
+                    failwith "outer"
+                yield 3
+            finally 
+                outerFinallyCalled := true
+                failwith "outermost"
+        }
+    let l = ref []
+    try
+        for y in ys do l := y::!l
+    with
+        Failure "outermost" ->
+            results := "expected failure"::!results
+    match !l,!innerFinallyCalled,!middleFinallyCalled,!outerFinallyCalled with
+    |   [0],true,true,true -> results := "ok"::!results
+    |   _ -> ()
+    !results)
+    ["ok";"expected failure"]  
+    
+check "dg676rd44t"
+   (let results = ref []    
+    let f1 = ref false
+    let f2 = ref false 
+    let ys xs =
+        seq {
+            try
+            match xs with
+            | 1,h
+            | h,1 -> 
+                try
+                    yield h
+                    failwith "1"
+                finally
+                    f1 := true
+                    failwith "2"
+            | _ -> ()
+            finally
+                f2 := true
+        }
+    try
+        for _ in ys (1,1) do ()
+    with
+        Failure "2" -> 
+            match !f1,!f2 with
+            |   true,true -> results := "ok"::!results
+            |   _ -> ()
+    !results)
+    ["ok"]
+type t =
+|   A of int
+|   B of int
+|   C of string
+
+check "rt7we6djksagd"
+   (let results = ref []
+    let ys x = 
+       seq {
+         try
+           try
+              match x with
+              | A y | B y -> 
+                     yield y
+                     failwith "1"
+              | _ -> 
+                     yield 27
+                     failwith "2"
+           finally
+              results := "A"::!results
+              failwith "3"
+         finally
+           results := "B"::!results
+       }
+
+    try
+        for _ in ys (A 0) do ()
+    with
+        Failure "3" -> results := "catch"::!results
+    !results)
+    ["catch";"B";"A"]
+
+check "f6er76r23784"
+   (let results = ref []
+    let ys xs =
+       seq {
+            match xs with
+            | 1,h
+            | h,1 ->
+                try 
+                  try
+                    yield h
+                    failwith "1"
+                  finally
+                    results := "inner"::!results
+                    failwith "2"
+                finally
+                  results := "outer"::!results
+                  failwith "3"
+            | _ -> ()
+       }
+
+    try
+        for _ in ys (1,1) do ()
+    with
+        Failure "3" -> results := "catch"::!results
+    !results)
+    ["catch";"outer";"inner"]
+
+check "hdweuiyrfiwe"
+   (let results = ref []
+    let ys xs =
+        seq {
+            match xs with
+            | 1,h
+            | h,1 ->
+                use a = { new System.IDisposable with member this.Dispose() = results :=  "A"::!results }
+                use b = { new System.IDisposable with member this.Dispose() = results :=  "B"::!results }
+                while true do
+                        failwith "boom"
+            | _ -> ()
+        }
+    try
+        for _ in ys (1,1) do ()
+    with
+        Failure "boom" -> results := "boom"::!results
+    !results)
+    ["boom";"A";"B"]
+
+check "hdweuiyrfiwe1"
+   (let results = ref []
+    let ys xs =
+        seq {
+            use a = { new System.IDisposable with member this.Dispose() = results :=  "A"::!results }
+            use b = { new System.IDisposable with member this.Dispose() = results :=  "B"::!results }
+            while true do
+                    failwith "boom"
+        }
+    try
+        for _ in ys (1,1) do ()
+    with
+        Failure "boom" -> results := "boom"::!results
+    !results)
+    ["boom";"A";"B"]
+
+check "fhduweyf"
+   (let s : seq<int> = 
+        seq { 
+            for i in 0..3 do
+                failwith "74"
+                ()
+            }
+    let e = s.GetEnumerator()
+
+    e.Dispose()
+    try
+        if e.MoveNext() then "fail" else "ok"
+    with
+        _ -> "exn")
+    "ok"
+
+
+check "fderuy" 
+   (let f1 = ref false
+    let f2 = ref false
+    let s f s =
+        seq {
+            try                
+                yield s
+            finally
+                f := true
+                failwith ("foo" + s)
+        }
+    let result =
+        try
+            for _ in Seq.map2 (fun x y -> ()) (s f1 "1") (s f2 "2") do ()
+            "exception didnt propagate"
+        with
+            _ -> 
+                match !f1,!f2 with
+                |   true,true -> "ok"
+                |   _ -> "not all finallies run"
+    result)
+    "ok"
+                
+check "hfhdfsjkfur34"
+   (let results = ref []
+    let e =
+        let enum () = 
+            {   new System.Collections.Generic.IEnumerator<int> with
+                    member this.Current = invalidOp "current"
+                interface System.IDisposable with
+                    member this.Dispose() =
+                        results := "eDispose"::!results
+                        failwith "e!!!"
+                interface System.Collections.IEnumerator with
+                    member this.Current = invalidOp "current"
+                    member this.MoveNext() = false
+                    member this.Reset() = invalidOp "reset"
+            }
+
+        {   new System.Collections.Generic.IEnumerable<int> with
+                member this.GetEnumerator() = enum ()
+            interface System.Collections.IEnumerable with
+                member this.GetEnumerator() = enum () :> System.Collections.IEnumerator
+        }
+    let ss = 
+        seq {
+            try
+                yield! e
+            finally
+                results := "ssDispose"::!results
+                failwith "ss!!!"
+        }
+    try
+        for _ in ss do ()
+    with
+        Failure "ss!!!" -> results := "caught"::!results
+    !results)
+    ["caught";"ssDispose";"eDispose"]
+    
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/subtype/build.bat b/tests/fsharp/core/subtype/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/subtype/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/subtype/run.bat b/tests/fsharp/core/subtype/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/subtype/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx
new file mode 100644
index 0000000..fc8959f
--- /dev/null
+++ b/tests/fsharp/core/subtype/test.fsx
@@ -0,0 +1,1704 @@
+// #Conformance #TypeInference #TypeConstraints #UnitsOfMeasure #Regression #Operators #Mutable 
+#if Portable
+module Core_subtype
+#endif
+#light
+
+let mutable failures = []
+let report_failure s = 
+  stderr.WriteLine " NO"; failures <- s :: failures
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure s
+let check s v1 v2 = test s (v1 = v2)
+
+(* TEST SUITE FOR SUBTYPE CONSTRAINTS *)
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+
+do SetCulture()    
+#endif
+
+open System
+open System.IO
+
+open System.Collections.Generic
+
+(* 'a[] :> ICollection<'a> *)
+let f1 (x: 'a[]) = (x :> ICollection<'a>) 
+do let x = f1 [| 3;4; |] in test "test239809" (x.Contains(3))
+
+#if Portable
+#else
+(* 'a[] :> IReadOnlyCollection<'a> *)
+let f1ReadOnly (x: 'a[]) = (x :> IReadOnlyCollection<'a>) 
+do let x = f1ReadOnly [| 3;4; |] in test "test239809ReadOnly" (x.Count = 2)
+#endif
+
+(* 'a[] :> IList<'a> *)
+let f2 (x: 'a[]) = (x :> IList<'a>) 
+do let x = f2 [| 3;4; |] in test "test239810" (x.Item(1) = 4)
+
+#if Portable
+#else
+(* 'a[] :> IReadOnlyList<'a> *)
+let f2ReadOnly (x: 'a[]) = (x :> IReadOnlyList<'a>) 
+do let x = f2ReadOnly [| 3;4; |] in test "test239810ReadOnly" (x.Item(1) = 4)
+#endif
+
+(* 'a[] :> IEnumerable<'a> *)
+let f3 (x: 'a[]) = (x :> IEnumerable<'a>) 
+do let x = f3 [| 3;4; |] in for x in x do (Printf.printf "val %d\n" x) done
+
+(* Call 'foreachG' using an IList<int> (solved to IEnumerable<int>) *)
+let f4 (x: 'a[]) = (x :> IList<'a>) 
+do let x = f4 [| 31;42; |] in for x in x do (Printf.printf "val %d\n" x) done
+
+#if Portable
+#else
+(* Call 'foreachG' using an IReadOnlyList<int> (solved to IEnumerable<int>) *)
+let f4ReadOnly (x: 'a[]) = (x :> IReadOnlyList<'a>) 
+do let x = f4ReadOnly [| 31;42; |] in for x in x do (Printf.printf "val %d\n" x) done
+#endif
+
+(* Call 'foreachG' using an ICollection<int> (solved to IEnumerable<int>) *)
+let f5 (x: 'a[]) = (x :> ICollection<'a>) 
+do let x = f5 [| 31;42; |] in for x in x do (Printf.printf "val %d\n" x) done
+
+#if Portable
+#else
+(* Call 'foreachG' using an IReadOnlyCollection<int> (solved to IEnumerable<int>) *)
+let f5ReadOnly (x: 'a[]) = (x :> IReadOnlyCollection<'a>) 
+do let x = f5ReadOnly [| 31;42; |] in for x in x do (Printf.printf "val %d\n" x) done
+#endif
+
+[<Measure>] type kg
+
+let testUpcastToArray1 (x: 'a[]) = (x :> System.Array) 
+let testUpcastToArray2 (x: 'a[,]) = (x :> System.Array) 
+let testUpcastToArray3 (x: 'a array) = (x :> System.Array) 
+let testUpcastToArray4 (x: 'a array  array) = (x :> System.Array) 
+
+let testUpcastToIEnumerable1 (x: 'a[]) = (x :> System.Collections.IEnumerable) 
+let testUpcastToIEnumerable2 (x: 'a[,]) = (x :> System.Collections.IEnumerable) 
+let testUpcastToIEnumerable3 (x: 'a array) = (x :> System.Collections.IEnumerable) 
+let testUpcastToIEnumerable4 (x: 'a array  array) = (x :> System.Collections.IEnumerable) 
+
+let testUpcastToICollection1 (x: 'a[]) = (x :> System.Collections.ICollection) 
+let testUpcastToICollection2 (x: 'a[,]) = (x :> System.Collections.ICollection) 
+let testUpcastToICollection3 (x: 'a array) = (x :> System.Collections.ICollection) 
+let testUpcastToICollection4 (x: 'a array  array) = (x :> System.Collections.ICollection) 
+
+
+let testUpcastToIList1 (x: 'a[]) = (x :> System.Collections.IList) 
+let testUpcastToIList2 (x: 'a[,]) = (x :> System.Collections.IList) 
+let testUpcastToIList3 (x: 'a array) = (x :> System.Collections.IList) 
+let testUpcastToIList4 (x: 'a array  array) = (x :> System.Collections.IList) 
+
+let testUpcastToValueType1 (x: int) = (x :> System.ValueType) 
+let testUpcastToValueType2 (x: bool) = (x :> System.ValueType) 
+let testUpcastToValueType3 (x: char) = (x :> System.ValueType) 
+let testUpcastToValueType4 (x: uint32) = (x :> System.ValueType) 
+let testUpcastToValueType5 (x: System.DateTime) = (x :> System.ValueType) 
+let testUpcastToValueType6 (x: System.ValueType) = (x :> System.ValueType) 
+let testUpcastToValueType7 (x: float<kg>) = (x :> System.ValueType)
+
+let testUpcastToEnum1 (x: System.AttributeTargets) = (x :> System.Enum) 
+let testUpcastToEnum6 (x: System.Enum) = (x :> System.Enum) 
+
+// these delegates don't exist in portable
+#if Portable
+#else
+let testUpcastToDelegate1 (x: System.Threading.ThreadStart) = (x :> System.Delegate) 
+
+let testUpcastToMulticastDelegate1 (x: System.Threading.ThreadStart) = (x :> System.MulticastDelegate) 
+#endif
+
+do for name in Directory.GetFiles("c:\\") do stdout.WriteLine name done
+
+let f (x : #System.IComparable<'a>) = 1
+
+
+module RandomGregChapmanTest = begin
+    open System.Collections.Generic
+    open Microsoft.FSharp.Collections
+
+    type Range = {Dummy: int}
+    type Worksheet = {Name: string; UsedRange: Range}
+    type Track = {Album: string; Track: string; Artist: string}
+
+    type 
+        Workbook  = class
+            new() = {}
+        
+            member x.Sheets: System.Collections.IEnumerable =
+                upcast Seq.unfold (
+                    fun index -> 
+                        if index >= 4 then None
+                        else Some({Name="Sheet"+(index.ToString()); UsedRange={Dummy=index}}, index+1)
+                ) 1
+        end
+        
+    let rangeContains _ _ = true
+
+    let rowstr s (i1:int) (i2:int) = s + ( i1.ToString()) + ( i2.ToString())
+
+    let rangeRowIter range =
+        Seq.unfold (
+            fun index ->
+                if index >= 4 then None
+                else begin
+                    let row = 
+                       Map.ofList [
+                        "ALBUM", (rowstr "Album" range.Dummy index);
+                        "TRACK", (rowstr "Track" range.Dummy index);
+                        "LEADER", (rowstr "Leader" range.Dummy index) ]
+                    in
+                    Some(row, index+1)
+                end
+        ) 1
+
+    let Run (matchtext: string) =
+        let GetMatchingRanges() =
+            let workbook = new Workbook() in
+            Seq.map (fun (sheet: Worksheet) -> (sheet.Name, sheet.UsedRange)) (
+                Seq.filter (fun sheet -> rangeContains sheet.UsedRange matchtext) 
+                  (Seq.cast workbook.Sheets : IEnumerable<Worksheet>)
+            )
+        in
+        let ParseRanges ranges =
+            ranges |> Seq.map (
+                fun (name, range) ->
+                    let items = List.ofSeq ((rangeRowIter range) |> Seq.map (fun row -> {Album=row.["ALBUM"]; Track=row.["TRACK"]; Artist=row.["LEADER"]})) in
+                    (name, items)
+            )
+        in
+        GetMatchingRanges() |> ParseRanges
+      
+end
+
+
+let iobj = (3 :> obj)
+let iobj2 = (iobj :?> int)
+let iobj3 = (iobj :? int)
+let iobj4 = 
+    match iobj with 
+    | :? int as i -> i 
+    | :? int64 as i -> int i
+    | _ -> 0
+
+
+
+(* BUG 858: function types in constraints of the genparams of either a method or a type *)
+let seq_to_array  (ss : #seq<'a>) = Seq.toArray ss
+let seq_to_array2 (ss : #seq<'a>) = seq_to_array ss
+let badCode (actions : 'b when 'b :> (unit -> unit) seq) = seq_to_array actions
+
+(* BUG 858: function types in constraints of the genparams of either a method or a type *)
+type 'a MyClass when 'a :> seq<(unit -> unit)> =
+ class
+   static member MyMeth(x:'a) = (x :> #(unit -> unit) seq)
+ end
+
+
+(*FAILING: logged as bug 872 *)
+(*fsi says error: buildGenParam: multiple base types*)
+#if COMPILED
+module PositiveTestsForConstraintNormalization = begin
+
+    type I1<'a> = interface end
+    type I2<'a> = interface inherit I1<'a> end
+    type I3<'a> = interface inherit I1<'a list> end
+    type I4<'a> = interface inherit I2<'a list> inherit I3<'a> end
+    type I5<'a> = interface inherit I2<'a list> inherit I3<'a> end
+    type C1<'a when 'a : comparison> = class interface I4<'a Set> end
+    type C2<'a> = class interface I5<'a array> end
+    type C3<'a> = class interface I4<'a array> interface I5<'a array> end
+    let f1 (x : #I4<'a>) = ()
+    let f2 (x : #I5<'a>) = ()
+    let f3 x = f1 x; f2 x
+    let f4 x = f1 x; f2 x; f3 x
+    let f5 (x : C3<int>) = f1 x; f2 x; f3 x
+    
+    
+
+end
+#endif
+    
+module SomeRandomOperatorConstraints = begin
+    open System
+    open System.Numerics
+    
+    let f x = abs(x*x)
+
+
+    let f2 x : float = x * x 
+    let f3 x (y:float) = x * y
+    //let neg4 x (y:System.DateTime) = x + y
+    let f5 (x:DateTime) y = x + y
+    let f6 (x:int64) y = x + y
+    let f7 x y : int64 = x + y
+    let f8 x = Seq.reduce (+) x
+    let sum seq : float = Seq.reduce (+) seq
+    let inline sumg seq = Seq.reduce (+) seq
+    let sumgi seq : int = sumg seq 
+    let sumgf seq : float32 = sumg seq 
+
+    let sum64 seq : int64 = Seq.reduce (+) seq
+    let sum32 seq : int64 = Seq.reduce (+) seq
+    let sumBigInt seq : BigInteger = Seq.reduce (+) seq
+    let sumDateTime (dt : DateTime) (seq : #seq<TimeSpan>) : DateTime = Seq.fold (+) dt seq
+end
+
+(* This test is funky because the type constraint on the variable associated with parameter 'x' *)
+(* invloves the type variable from the enclosing class.  This exposed a bug with fixing up type *)
+(* constraints correctly. *)
+module NestedGenericMethodWithSubtypeConstraint = begin
+    type I<'a> =
+        interface
+            abstract Post : unit -> unit
+        end
+
+    type A<'b>  = 
+        class 
+            member this.M(x : #I<'b> ) = ()
+            new() = {}
+        end
+
+    let B() = 
+        { new I<string> with  member this.Post() = () end }
+
+    let main() =
+          let d = new A<string>() in
+          let a = B() in
+          d.M(a)
+
+    do main()
+  
+    do System.Array.FindIndex<int>([| 1;2;3 |], (fun x -> x % 2 = 0)) |> ignore
+
+end
+
+(* Test that generic inheritance through units-of-measure parameters works correctly *)
+(* See bug 6167 *)
+module SubsumptionAndUnitsOfMeasure = begin
+
+  [<Measure>] type kg
+  [<Measure>] type s
+
+  type SC< [<Measure>] 'u>(arg : float<'u>) = 
+    member this.Value = arg
+
+  type TC< [<Measure>] 'u>(arg) =
+    inherit SC<'u>(arg)
+
+  type WC< [<Measure>] 'v>(arg : float<'v^2>) =
+    inherit SC<'v^2>(arg)
+
+  type GC(arg : float<kg>) =
+    inherit SC<kg>(arg)
+
+  type GC2(arg : float<kg^2>) =
+    inherit SC<kg^2>(arg)
+
+  let ff (x:SC<'u>) = x.Value
+  let gg (x:TC<'v>, f:float<_>) = ff x + f
+  let hh (x:WC<'w>, f:float<'w^2>) = ff x + f
+  let hh2 (x:WC<kg>, f:float<kg^2>) = ff x + f
+  let hh3 (x:WC<kg>, f:float<kg^2>) = hh (x,f)
+
+  let ii (x:GC) = ff x + 3.0<kg>
+  let jj (x:GC2) = ff x + 3.0<kg^2>
+end
+
+module CheckExceptionsCanBeUsedAsTypes = begin
+    exception MyEException of string with member x.M() = 4  end
+
+    let e = (MyEException("test") :?> MyEException)
+
+    let x = e.M()
+end
+
+
+
+module SimpleDatatypeInModuleThatFailedToLoad = begin
+    module FooMod = begin
+        type 'a foo = Foo of 'a 
+        let makeFoo v = Foo v
+    end
+
+    module FooMod2 = begin
+        let makeFoo2 = FooMod.makeFoo 
+    end
+end
+    
+    
+module AttrbuteArgTest = 
+    [<System.AttributeUsage (System.AttributeTargets.Class,AllowMultiple=false)>]  
+    [<Sealed>]
+    type RowAttribute(values: obj[]) = 
+        inherit System.Attribute()
+        member x.Values = values
+
+    [<Row([| |])>]
+    type fixture = { x:int }
+
+    [<Row([| (1 :> obj) |])>]
+    type fixture2 = { x:int }
+
+
+    [<Row([| ("1" :> obj) |])>]
+    type fixture3 = { x:int }
+
+type A() = 
+    member x.P = 1
+
+type B() = 
+    inherit A()
+    member x.P = 1
+
+type B1() = 
+    inherit A()
+    member x.P = 1
+
+type B2() = 
+    inherit A()
+    member x.P = 1
+    
+    
+type C() = 
+    inherit B()
+    member x.P = 1
+
+
+module FunctionsTakingSubsumableArgsTestValueTypes = 
+    let TakesOneSubsumableArg (x:System.ValueType) = ()
+    let TakesTwoCurriedSubsumableArgs (x:System.ValueType) (y:System.ValueType) = ()
+    let TakesTwoTupledSubsumableArgs (x:System.ValueType, y:System.ValueType) = ()
+    let TakesTwoGroupsOfTupledSubsumableArgs (x:System.ValueType, y:System.ValueType) (x2:System.ValueType, y2:System.ValueType) = ()
+    let TakesTwoCurriedObjArgs (x:obj) (x2:obj) = ()
+
+    let a1 = (1 :> System.ValueType) //(new B())
+    let a2 = (2 :> System.ValueType) //(new B())
+    let b1 = 1 //(new B())
+    let b2 = 2 //(new B())
+    let pAA = (a1,a1) //(new B())
+    let pAB = (a1,b1) //(new B())
+    let pBA = (b1,a1) //(new B())
+    let pBB = (b1,b1) //(new B())
+
+
+    let v1 =  <@ TakesOneSubsumableArg a1 @>
+    let v2 =  <@ TakesOneSubsumableArg b1 @>
+    let _ =  <@ TakesOneSubsumableArg @>
+
+    let v4 =  <@ TakesTwoCurriedSubsumableArgs a1 a2 @>
+    let v5 =  <@ TakesTwoCurriedSubsumableArgs a1 b2 @>
+    let v6 =  <@ TakesTwoCurriedSubsumableArgs b1 a2 @>
+    let v7 =  <@ TakesTwoCurriedSubsumableArgs b1 b2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs @>
+
+    let vw =  <@ TakesTwoTupledSubsumableArgs (a1,a2) @>
+    let ve =  <@ TakesTwoTupledSubsumableArgs (a1,b2) @>
+    let vr =  <@ TakesTwoTupledSubsumableArgs (b1,a2) @>
+    let vt =  <@ TakesTwoTupledSubsumableArgs (b1,b2) @>
+    let vW =  <@ TakesTwoTupledSubsumableArgs pAA @>
+    let vX =  <@ TakesTwoTupledSubsumableArgs pAB @>
+    let vY =  <@ TakesTwoTupledSubsumableArgs pBA @>
+    let vZ =  <@ TakesTwoTupledSubsumableArgs pBB @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs @>
+
+    let Qvw =  <@ TakesTwoGroupsOfTupledSubsumableArgs (a1,a2) (a1,a2) @>
+    let Qve =  <@ TakesTwoGroupsOfTupledSubsumableArgs (a1,b2) (a1,a2) @>
+    let Qvr =  <@ TakesTwoGroupsOfTupledSubsumableArgs (b1,a2) (a1,a2) @>
+    let Qvt =  <@ TakesTwoGroupsOfTupledSubsumableArgs (b1,b2) (a1,a2) @>
+    let QvW =  <@ TakesTwoGroupsOfTupledSubsumableArgs pAA     (a1,a2) @>
+    let QvX =  <@ TakesTwoGroupsOfTupledSubsumableArgs pAB     (a1,a2) @>
+    let QvY =  <@ TakesTwoGroupsOfTupledSubsumableArgs pBA     (a1,a2) @>
+    let QvZ =  <@ TakesTwoGroupsOfTupledSubsumableArgs pBB     (a1,a2) @>
+
+    let Wvw =  <@ TakesTwoGroupsOfTupledSubsumableArgs (a1,a2) (a1,b2) @>
+    let Wve =  <@ TakesTwoGroupsOfTupledSubsumableArgs (a1,b2) (a1,b2) @>
+    let Wvr =  <@ TakesTwoGroupsOfTupledSubsumableArgs (b1,a2) (a1,b2) @>
+    let Wvt =  <@ TakesTwoGroupsOfTupledSubsumableArgs (b1,b2) (a1,b2) @>
+    let WvW =  <@ TakesTwoGroupsOfTupledSubsumableArgs pAA     (a1,b2) @>
+    let WvX =  <@ TakesTwoGroupsOfTupledSubsumableArgs pAB     (a1,b2) @>
+    let WvY =  <@ TakesTwoGroupsOfTupledSubsumableArgs pBA     (a1,b2) @>
+    let WvZ =  <@ TakesTwoGroupsOfTupledSubsumableArgs pBB     (a1,b2) @>
+
+    let _ =  <@ TakesTwoGroupsOfTupledSubsumableArgs @>
+
+    let fq() = TakesOneSubsumableArg a1
+    let fw() = TakesOneSubsumableArg b1
+    let fe() = TakesOneSubsumableArg
+    let fr() = TakesTwoCurriedSubsumableArgs a1 a2
+    let ft() = TakesTwoCurriedSubsumableArgs a1 b2
+    let fy() = TakesTwoCurriedSubsumableArgs b1 a2
+    let fu() = TakesTwoCurriedSubsumableArgs b1 b2
+    let fi() = TakesTwoCurriedSubsumableArgs a1
+    let fo() = TakesTwoCurriedSubsumableArgs b1
+    let fp() = TakesTwoCurriedSubsumableArgs
+    let fa() = TakesTwoTupledSubsumableArgs (a1,a2)
+    let fs() = TakesTwoTupledSubsumableArgs (a1,b2)
+    let fd() = TakesTwoTupledSubsumableArgs (b1,a2)
+    let ff() = TakesTwoTupledSubsumableArgs (b1,b2)
+    let fQ() = TakesTwoTupledSubsumableArgs pAA
+    let fW() = TakesTwoTupledSubsumableArgs pAB
+    let fX() = TakesTwoTupledSubsumableArgs pBA
+    let fY() = TakesTwoTupledSubsumableArgs pBB
+
+
+    let Dfa() = TakesTwoGroupsOfTupledSubsumableArgs (a1,a2)
+    let Dfs() = TakesTwoGroupsOfTupledSubsumableArgs (a1,b2)
+    let Dfd() = TakesTwoGroupsOfTupledSubsumableArgs (b1,a2)
+    let Dff() = TakesTwoGroupsOfTupledSubsumableArgs (b1,b2)
+    let DfQ() = TakesTwoGroupsOfTupledSubsumableArgs pAA
+    let DfW() = TakesTwoGroupsOfTupledSubsumableArgs pAB
+    let DfX() = TakesTwoGroupsOfTupledSubsumableArgs pBA
+    let DfY() = TakesTwoGroupsOfTupledSubsumableArgs pBB
+
+    let Cfa() = TakesTwoGroupsOfTupledSubsumableArgs : System.ValueType * System.ValueType -> System.ValueType * System.ValueType -> unit
+    let Cfb() = TakesTwoGroupsOfTupledSubsumableArgs : System.ValueType * int -> System.ValueType * System.ValueType -> unit
+    let Cfc() = TakesTwoGroupsOfTupledSubsumableArgs : int * System.ValueType -> System.ValueType * System.ValueType -> unit
+    let Cfd() = TakesTwoGroupsOfTupledSubsumableArgs : int * int -> System.ValueType * System.ValueType -> unit
+    let Cfe() = TakesTwoGroupsOfTupledSubsumableArgs : System.ValueType * System.ValueType -> int * System.ValueType -> unit
+    let Cfr() = TakesTwoGroupsOfTupledSubsumableArgs : System.ValueType * System.ValueType -> System.ValueType * int -> unit
+
+
+    let Xfa() = TakesTwoCurriedObjArgs : System.ValueType * System.ValueType -> System.ValueType * System.ValueType -> unit
+    let Xfb() = TakesTwoCurriedObjArgs : System.ValueType * int -> System.ValueType * System.ValueType -> unit
+    let Xfc() = TakesTwoCurriedObjArgs : int * System.ValueType -> System.ValueType * System.ValueType -> unit
+    let Xfd() = TakesTwoCurriedObjArgs : int * int -> System.ValueType * System.ValueType -> unit
+    let Xfe() = TakesTwoCurriedObjArgs : System.ValueType * System.ValueType -> int * System.ValueType -> unit
+    let Xfr() = TakesTwoCurriedObjArgs : System.ValueType * System.ValueType -> System.ValueType * int -> unit
+
+    let Rfa() = TakesTwoGroupsOfTupledSubsumableArgs (a1,a2) pAA
+    let Rfs() = TakesTwoGroupsOfTupledSubsumableArgs (a1,b2) pAB
+    let Rfd() = TakesTwoGroupsOfTupledSubsumableArgs (b1,a2) pBA
+    let Rff() = TakesTwoGroupsOfTupledSubsumableArgs (b1,b2) pBB
+    let RfQ() = TakesTwoGroupsOfTupledSubsumableArgs pAA pAA
+    let RfW() = TakesTwoGroupsOfTupledSubsumableArgs pAB pAB
+    let RfX() = TakesTwoGroupsOfTupledSubsumableArgs pBA pBA
+    let RfY() = TakesTwoGroupsOfTupledSubsumableArgs pBB pBB
+
+    let fg() = TakesTwoGroupsOfTupledSubsumableArgs
+    let fRR() = TakesTwoCurriedSubsumableArgs
+
+
+module FunctionsTakingSubsumableArgsTestReferenceTypes = 
+    let TakesOneSubsumableArg (x:A) = ()
+    let TakesTwoCurriedSubsumableArgs (x:A) (y:A) = ()
+    let TakesTwoTupledSubsumableArgs (x:A, y:A) = ()
+
+    let a1 = (new B() :> A) //(new B())
+    let a2 = (new B() :> A) //(new B())
+    let b1 = new B() //(new B())
+    let b2 = new B() //(new B())
+
+
+    let v1 =  <@ TakesOneSubsumableArg a1 @>
+    let v2 =  <@ TakesOneSubsumableArg b1 @>
+    let _ =  <@ TakesOneSubsumableArg @>
+    let v4 =  <@ TakesTwoCurriedSubsumableArgs a1 a2 @>
+    let v5 =  <@ TakesTwoCurriedSubsumableArgs a1 b2 @>
+    let v6 =  <@ TakesTwoCurriedSubsumableArgs b1 a2 @>
+    let v7 =  <@ TakesTwoCurriedSubsumableArgs b1 b2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs @>
+    let vw =  <@ TakesTwoTupledSubsumableArgs (a1,a2) @>
+    let ve =  <@ TakesTwoTupledSubsumableArgs (a1,b2) @>
+    let vr =  <@ TakesTwoTupledSubsumableArgs (b1,a2) @>
+    let vt =  <@ TakesTwoTupledSubsumableArgs (b1,b2) @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs @>
+
+    let fq() = TakesOneSubsumableArg a1
+    let fw() = TakesOneSubsumableArg b1
+    let fe() = TakesOneSubsumableArg
+    let fr() = TakesTwoCurriedSubsumableArgs a1 a2
+    let ft() = TakesTwoCurriedSubsumableArgs a1 b2
+    let fy() = TakesTwoCurriedSubsumableArgs b1 a2
+    let fu() = TakesTwoCurriedSubsumableArgs b1 b2
+    let fi() = TakesTwoCurriedSubsumableArgs a1
+    let fo() = TakesTwoCurriedSubsumableArgs b1
+    let fp() = TakesTwoCurriedSubsumableArgs
+    let fa() = TakesTwoTupledSubsumableArgs (a1,a2)
+    let fs() = TakesTwoTupledSubsumableArgs (a1,b2)
+    let fd() = TakesTwoTupledSubsumableArgs (b1,a2)
+    let ff() = TakesTwoTupledSubsumableArgs (b1,b2)
+    let fg() = TakesTwoCurriedSubsumableArgs
+
+
+module FunctionsTakingSubsumableArgsTestWithExtraApplication = 
+    let TakesOneSubsumableArg (x:A) = failwith ""
+    let TakesTwoCurriedSubsumableArgs (x:A) (y:A) = failwith ""
+    let TakesTwoTupledSubsumableArgs (x:A, y:A) = failwith ""
+
+    let a1 = (new B() :> A) //(new B())
+    let a2 = (new B() :> A) //(new B())
+    let b1 = new B() //(new B())
+    let b2 = new B() //(new B())
+
+
+    let _ =  <@ TakesOneSubsumableArg a1 @>
+    let _ =  <@ TakesOneSubsumableArg b1 @>
+    let _ =  <@ TakesOneSubsumableArg @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 a2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 b2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 a2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 b2 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,a2) @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,b2) @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,a2) @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,b2) @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs @>
+
+
+    let _ =  <@ TakesOneSubsumableArg a1 () @>
+    let _ =  <@ TakesOneSubsumableArg b1 ()  @>
+
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 a2 () @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 b2 () @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 a2 () @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 b2 () @>
+
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,a2) () @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,b2) () @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,a2) () @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,b2) () @>
+
+
+    let _ =  <@ TakesOneSubsumableArg a1 b1 @>
+    let _ =  <@ TakesOneSubsumableArg b1 b1  @>
+
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 a2 b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs a1 b2 b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 a2 b1 @>
+    let _ =  <@ TakesTwoCurriedSubsumableArgs b1 b2 b1 @>
+
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,a2) b1 @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (a1,b2) b1 @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,a2) b1 @>
+    let _ =  <@ TakesTwoTupledSubsumableArgs (b1,b2) b1 @>
+
+    let fq() = TakesOneSubsumableArg a1 b1
+    let fw() = TakesOneSubsumableArg b1 b1
+    let fe() = TakesOneSubsumableArg b1
+    let fr() = TakesTwoCurriedSubsumableArgs a1 a2 b1
+    let ft() = TakesTwoCurriedSubsumableArgs a1 b2 b1
+    let fy() = TakesTwoCurriedSubsumableArgs b1 a2 b1
+    let fu() = TakesTwoCurriedSubsumableArgs b1 b2 b1
+    let fi() = TakesTwoCurriedSubsumableArgs a1 b1
+    let fo() = TakesTwoCurriedSubsumableArgs b1 b1
+    let fp() = TakesTwoCurriedSubsumableArgs b1
+    let fa() = TakesTwoTupledSubsumableArgs (a1,a2) b1
+    let fs() = TakesTwoTupledSubsumableArgs (a1,b2) b1
+    let fd() = TakesTwoTupledSubsumableArgs (b1,a2) b1
+    let ff() = TakesTwoTupledSubsumableArgs (b1,b2) b1
+    let fg() = TakesTwoCurriedSubsumableArgs b1
+
+module BiGenericStaticMemberTests =
+    type StaticClass1() = 
+        static member M<'b>(c:'b, d:'b) = 1
+
+    let obj = new obj()
+    let str = ""
+
+    StaticClass1.M<obj>(obj,str)  
+    StaticClass1.M<obj>(str,obj)
+    StaticClass1.M<obj>(obj,obj)
+    StaticClass1.M<obj>(str,str)
+
+    StaticClass1.M<string>(str,str)
+
+    StaticClass1.M(obj,obj)
+    StaticClass1.M(str,str)
+
+module BiGenericFunctionTests =
+    let M<'b>(c:'b, d:'b) = 1
+
+    let obj = new obj()
+    let str = ""
+
+    M<obj>(obj,str)  
+    M<obj>(str,obj)
+    M<obj>(obj,obj)
+    M<obj>(str,str)
+
+    M<string>(str,str)
+
+    M(obj,obj)
+    M(str,str)
+
+//-----------------------------------------------
+
+module MoreSubsumptionPositiveTests = 
+    let ex1a (x: A) = ()  
+    let ex1b (x: #A) = ()  
+    let ex1c (x: 'a when 'a :> A) = ()  
+
+    let ex2a x = ex1a x
+    let ex3a () x = ex1a x
+    let ex3b <'a>  (x:A) = ex1a x
+
+    ex1a (new B())  // 1.9.4 gives error 
+
+    type StaticClass() = 
+        static member Ex1A(x: A) = ()
+
+    StaticClass.Ex1A(new B()) // 1.9.4 does not give error, "subsumption on member calls"
+    new B() |> StaticClass.Ex1A // 1.9.4 does not give error, "subsumption on member calls"
+    [new B()] |> List.map StaticClass.Ex1A // 1.9.4 does not give error, "subsumption on member calls"
+
+    ex1a(new B()) 
+    new B() |> ex1a 
+    [new B()] |> List.map ex1a 
+
+    ex2a(new B()) 
+    new B() |> ex2a 
+    [new B()] |> List.map ex2a 
+
+    ex3a () (new B()) 
+    new B() |> ex3a () 
+    [new B()] |> List.map (ex3a ()) 
+
+    ex3b<int> (new B()) 
+    new B() |> ex3b<int> 
+    [new B()] |> List.map (ex3b<int>) 
+
+    ex3b<int> (new B2()) 
+    new B2() |> ex3b<int> 
+    [new B2()] |> List.map (ex3b<int>) 
+
+    type ClassWithConstructorThatIsTooGenericWithoutCondensation =
+        class
+            val x : A
+            new (x) = { x= x  }
+        end
+
+    type ClassWithSetterPropertyThatIsTooGenericWithoutCondensation() = 
+        let mutable p = new A()
+        member x.P 
+            with get() = p 
+            and set(v) = p <- v
+
+
+
+
+module StillMoreSubsumptiontests = 
+    type StaticClass2() = 
+        static member DisplayControls(controls: A list) = ()
+        
+    let v = [ new A() ]
+    //let v2 = [ new A(); new B() ]
+    //let v2b = [ new B(); new C() ]
+    //let v2c : A list = [ (new B() :> A); new C() ]
+
+
+    //StaticClass2.DisplayControls [ (new B() :> A); new C() ]
+    //StaticClass2.DisplayControls [ (new B1() :> A); new B2() ]
+
+    //-----
+
+    let f100 (x:A) = 1
+
+    let g100 x = f100 x
+
+    let g101 = f100  // Note: if a value restriction triggers on this test then the is-generalizeable-value check is not succeeding on the encoded form of the subsumable "f100"
+
+    let p = (new B(), new B())
+
+    let q = p
+
+    let h100 x = 1
+
+
+    let f71 (x : _) = x
+
+
+    let f72 (x : list<_>) = x.Length
+
+    let f73 (x:A) = x.P
+    let f73b (x:_) = f73 x
+
+    let f74 (x:list<#A>) = ()
+    let f75 (x:list<'a> when 'a :> A) = ()
+
+    //let v3 : A list = [ (new B() :> A); new B(); new B() ]
+    //let v4 : A array = [| (new B() :> A); new B(); new B() |]
+
+    let f1 (x:A) = ()    
+    let f2 (x:A) (y:A) = ()    
+    let f2b (x:A, y:A) = ()    
+    let f2c (p : A*A) = 1+1
+
+    f1 (new A())
+    f1 (new B())
+
+    f2 (new A()) (new A())
+    f2 (new B()) (new B())
+    f2 (new A()) (new B())
+    f2 (new B()) (new A())
+
+    f2b (new A(),new A())
+    f2b (new B(),new B())
+    f2b (new A(),new B())
+    f2b (new B(),new A())
+
+    f2c (new A(),new A())
+    f2c (new B(),new B())
+    f2c (new A(),new B())
+    f2c (new B(),new A())
+
+    let g x = f1 x
+
+    let rec f3 (x:A)  = if false then () else f3 (new B())
+
+    type r = { mutable f1 : A } 
+
+    let r1 = { f1 = new A() } 
+    r1.f1 <- new B()
+    let r2 = { f1 = new B() } 
+
+    type Data = Data of A * A
+
+    Data (new A(),new A())
+    Data (new B(),new B())
+    Data (new A(),new B())
+    Data (new B(),new A())
+
+    let pAA = (new A(),new A()) 
+    let pBB = (new B(),new B())
+    let pAB = (new A(),new B())
+    let pBA = (new B(),new A())
+    pAA |> Data 
+
+module BiGenericMethodsInGenericClassTests = 
+    type C<'a>() =
+        static member M(x:'a) = 1
+        static member M2<'b>(x:'b) = 1
+        static member M3<'b>(x:'b,y:'b) = 1
+        static member OM3<'b>(x:'b,y:'b) = 1
+        static member OM3<'b>(x:'b,y:int) = 1
+
+    let obj = new obj()
+    let str = ""
+
+
+    C<obj>.M("a")
+    C<obj>.M2<obj>("a")
+    C<obj>.M2("a")
+    C<obj>.M3<obj>(obj,obj)
+    C<obj>.M3<obj>("a",obj)
+    C<obj>.M3<obj>(obj,"a")
+    C<obj>.M3<string>("b","a")
+
+    C<obj>.M3(obj,obj)  
+    C<obj>.M3("a","a")  
+
+    C<obj>.OM3(obj,obj)  
+    C<obj>.OM3<obj>(obj,obj)  
+    C<obj>.OM3("a","a")  
+    C<obj>.OM3<string>("a","a")  
+
+    C<obj>.OM3(obj,"a")  
+
+
+
+module TestSideEffectOrderForLambdasIntroducedBySubsumption1 = 
+    type A() = 
+       member x.P = 1
+
+    type B() = 
+       inherit A()
+       member x.P = 1
+
+    let vA = A()
+    let vB = B()
+
+    let x = ref 0
+
+    let f (a:A) = 
+        x := 1
+        fun (b:A,c:A) ->
+            x := 2
+            fun (c:int) ->
+                x := 3
+                99
+
+    module Test1 = 
+
+        check "nckew9" !x 0
+        let f1  :      A * A -> int -> int = f   vA
+        check "nckew9" !x 1
+        let f1b :               int -> int = f1  (vA,vA)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f1b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test2 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 1
+        let f2b :               int -> int = f2 (vB,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+    module Test3 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 1
+        let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test4 = 
+        let TEST (f:A -> A * A -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * A -> int -> int = f  vB
+            check "nckew9" !x 1
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 2
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f
+        
+
+    module Test5 = 
+        let TEST (f:A -> A * B -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * B -> int -> int = f  vB
+            check "nckew9" !x 1
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 2
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f    
+
+
+    
+module TestSideEffectOrderForLambdasIntroducedBySubsumption2 = 
+    type A() = 
+       member x.P = 1
+
+    type B() = 
+       inherit A()
+       member x.P = 1
+
+    let vA = A()
+    let vB = B()
+
+    let x = ref 0
+
+    let f (a:A) (b:A,c:A) (d:int) =
+        x := 3
+        99
+
+    let check s x1 x2 = if x1 = x2 then printfn "%s: ok" s else printfn "%s FAILED, expected %A, got %A  <<-----" s x2 x1
+
+    module Test1 = 
+
+        check "nckew9" !x 0
+        let f1  :      A * A -> int -> int = f   vA
+        check "nckew9" !x 0
+        let f1b :               int -> int = f1  (vA,vA)  // no precomputation here when T is class type
+        check "nckew9" !x 0
+        let f1c :                      int = f1b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test2 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 0
+        let f2b :               int -> int = f2 (vB,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 0
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+    module Test3 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 0
+        let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 0
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test4 = 
+        let TEST (f:A -> A * A -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * A -> int -> int = f  vB
+            check "nckew9" !x 0
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 0
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f
+        
+
+    module Test5 = 
+        let TEST (f:A -> A * B -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * B -> int -> int = f  vB
+            check "nckew9" !x 0
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 0
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f    
+
+
+// This variation has an argument pair "p:A*A"
+module TestSideEffectOrderForLambdasIntroducedBySubsumption3 = 
+    type A() = 
+       member x.P = 1
+
+    type B() = 
+       inherit A()
+       member x.P = 1
+
+    let vA = A()
+    let vB = B()
+
+    let x = ref 0
+
+    let f (a:A) = 
+        x := 1
+        fun (p: A*A) ->
+            let (b:A,c:A) = p
+            x := 2
+            fun (c:int) ->
+                x := 3
+                99
+
+    let check s x1 x2 = if x1 = x2 then printfn "%s: ok" s else printfn "%s FAILED, expected %A, got %A  <<-----" s x2 x1
+
+    module Test1 = 
+
+        check "nckew9" !x 0
+        let f1  :      A * A -> int -> int = f   vA
+        check "nckew9" !x 1
+        let f1b :               int -> int = f1  (vA,vA)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f1b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test2 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 1
+        let f2b :               int -> int = f2 (vB,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+    module Test3 = 
+        x := 0
+        check "nckew9" !x 0
+        let f2  :      A * A -> int -> int = f  vB
+        check "nckew9" !x 1
+        let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+        check "nckew9" !x 2
+        let f1c :                      int = f2b 3       // no precomputation here when T is class type
+        check "nckew9" !x 3
+
+
+    module Test4 = 
+        let TEST (f:A -> A * A -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * A -> int -> int = f  vB
+            check "nckew9" !x 1
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 2
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f
+        
+
+    module Test5 = 
+        let TEST (f:A -> A * B -> int -> int) = 
+            x := 0
+            check "nckew9" !x 0
+            let f2  :      A * B -> int -> int = f  vB
+            check "nckew9" !x 1
+            let f2b :               int -> int = f2 (vA,vB)  // no precomputation here when T is class type
+            check "nckew9" !x 2
+            let f1c :                      int = f2b 3       // no precomputation here when T is class type
+            check "nckew9" !x 3
+
+        TEST f    
+
+
+
+/// Test the code generation for local type functions
+module InnerConstrainedClosureTests = 
+    let Example1 (y:'a,z:'b) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(x: #System.IComparable,y:'a) = 
+            printfn "hello, %A" z
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h() = g(3,y)
+        /// This just returnes the closure to make sure we don't optimize it all away
+        h
+
+
+
+    let Example2 (y:'a,z:'b) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(x: #System.IComparable) = 
+            printfn "hello, %A" z
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h() = g(3)
+        /// This just returnes the closure to make sure we don't optimize it all away
+        h
+            
+    let Example3 (y:'b,z:'a) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(x: #System.IComparable,y:'b) = 
+            printfn "hello, %A" z
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h() = g(3,y)
+        /// This just returnes the closure to make sure we don't optimize it all away
+        h
+
+    let Example4 (y:'b,z:'a) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(x1: #System.IComparable,x2: #System.IComparable,y:'b) = 
+            printfn "hello, %A" z
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h1() = g(3,4,y)
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h2() = g("3","4",y)
+        /// This just returnes the closure to make sure we don't optimize it all away
+        h1,h2
+
+
+    let Example5 (y:'b,z:'a) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(x1: #System.IComparable,x2: #System.IComparable,y:'b) = 
+            printfn "hello, %A" y
+            printfn "hello, %A" z
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h1() = g(3,4,y)
+        /// This uses the local type function in another closure that also captures one of the outer arguments
+        let h2() = g("3","4",y)
+        /// This just returnes the closure to make sure we don't optimize it all away
+        h1,h2
+
+    let Example6 (y:'b,z:'a) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g() = 
+            printfn "hello, %A" y
+            printfn "hello, %A" z
+        g
+
+
+    let Example7 (y:'b,z:'a) = 
+        /// This gets compiled as a local type function because it is both generic and constrained
+        let g(onp:#System.IComparable) = 
+            printfn "hello, %A" y
+            printfn "hello, %A" z
+        g 3
+        g "3"
+
+
+module HashEqualityCOmpareOnNull =
+/// As of Dev11, we now emit callvirt rather than call in these situations, so the tests below
+/// will throw a System.NullReferenceException
+
+    type R1 = { x : int }
+    type R2 = { x1 : int; x2 : int  }
+
+    type R4 = { x1 : int ; x2 : int ; x3 : int ; x4 : int }
+
+    type U1 = | A
+    type U2 = | A | B
+    type U4 = | A | B | C | D 
+
+        
+
+    let hash_u1() = 
+        (try hash (Unchecked.defaultof<U1>) with :? System.NullReferenceException -> 99) |> check "erw90re1" 99
+
+    let hash_u2() = 
+        (try hash (Unchecked.defaultof<U2>) with :? System.NullReferenceException -> 99) |> check "erw90re2" 99
+
+    let hash_u4() = 
+        (try hash (Unchecked.defaultof<U4>) with :? System.NullReferenceException -> 99) |> check "erw90re3" 99
+
+    let hash_r1() = 
+        (try hash (Unchecked.defaultof<R1>) with :? System.NullReferenceException -> 99) |> check "erw90re4" 99
+
+    let hash_r2() = 
+        (try hash (Unchecked.defaultof<R2>) with :? System.NullReferenceException -> 99) |> check "erw90re5" 99
+
+    let hash_r4() = 
+        (try hash (Unchecked.defaultof<R4>) with :? System.NullReferenceException -> 99) |> check "erw90re6" 99
+
+    let equal_u1() = 
+        (try ignore(Unchecked.defaultof<U1> = Unchecked.defaultof<U1>) ; false with :? System.NullReferenceException -> true) |> check "erw90re7" true
+        (U1.A = Unchecked.defaultof<U1>) |> check "erw90re7" false
+        (try ignore(Unchecked.defaultof<U1> = U1.A) ; false with :? System.NullReferenceException -> true)  |> check "erw90re7" true
+
+    let equal_u2() = 
+        (try ignore(Unchecked.defaultof<U2> = Unchecked.defaultof<U2>) ; false with :? System.NullReferenceException -> true)  |> check "erw90re8" true
+        (U2.A = Unchecked.defaultof<U2>) |> check "erw90re7" false
+        (try ignore(Unchecked.defaultof<U2> = U2.A) ; false with :? System.NullReferenceException -> true) |> check "erw90re7" true
+        (U2.B = Unchecked.defaultof<U2>) |> check "erw90re7" false
+        (try ignore(Unchecked.defaultof<U2> = U2.B) ; false with :? System.NullReferenceException -> true) |> check "erw90re7" true
+
+    let equal_u4() = 
+        (try ignore(Unchecked.defaultof<U4> = Unchecked.defaultof<U4>) ; false with :? System.NullReferenceException -> true)  |> check "erw90re9" true
+        (U4.A = Unchecked.defaultof<U4>) |> check "erw90re7" false
+        (try ignore(Unchecked.defaultof<U4> = U4.A) ; false with :? System.NullReferenceException -> true)  |> check "erw90re7" true
+        (U4.B = Unchecked.defaultof<U4>) |> check "erw90re7" false
+        (try ignore(Unchecked.defaultof<U4> = U4.B) ; false with :? System.NullReferenceException -> true)  |> check "erw90re7" true
+
+    let equal_r1() = 
+        (try ignore(Unchecked.defaultof<R1> = Unchecked.defaultof<R1>) ; false with :? System.NullReferenceException -> true)  |> check "erw90reQ" true
+        ( { R1.x = 1 } = Unchecked.defaultof<R1>) |> check "erw90re7" false
+        (try ignore( Unchecked.defaultof<R1> = { R1.x = 1 }) ; false with :? System.NullReferenceException -> true) |> check "erw90re7" true
+
+    let equal_r2() = 
+        (try ignore(Unchecked.defaultof<R2> = Unchecked.defaultof<R2>) ; false with :? System.NullReferenceException -> true)  |> check "erw90reW" true
+        ( { R2.x1 = 1; R2.x2 = 3 } = Unchecked.defaultof<R2>) |> check "erw90re7" false
+        (try ignore( Unchecked.defaultof<R2> = { R2.x1 = 1; R2.x2 = 3 } ) ; false with :? System.NullReferenceException -> true)  |> check "erw90re7" true
+
+    let equal_r4() = 
+        (try ignore(Unchecked.defaultof<R4> = Unchecked.defaultof<R4>) ; false with :? System.NullReferenceException -> true)  |> check "erw90reE" true
+
+    let compare_u1() = 
+        (try ignore(compare Unchecked.defaultof<U1> Unchecked.defaultof<U1>) ; 99 with :? System.NullReferenceException -> 99)  |> check "erw90reR" 99
+
+    let compare_u2() = 
+        (try ignore(compare Unchecked.defaultof<U2> Unchecked.defaultof<U2>) ; 99 with :? System.NullReferenceException -> 99)   |> check "erw90reT" 99
+
+    let compare_u4() = 
+        (try ignore(compare Unchecked.defaultof<U4> Unchecked.defaultof<U4>) ; 99 with :? System.NullReferenceException -> 99)   |> check "erw90reY" 99
+
+    let compare_r1() = 
+        (try ignore(compare Unchecked.defaultof<R1> Unchecked.defaultof<R1>) ; 99 with :? System.NullReferenceException -> 99)   |> check "erw90reU" 99
+
+    let compare_r2() = 
+        (try ignore(compare Unchecked.defaultof<R2> Unchecked.defaultof<R2>) ; 99 with :? System.NullReferenceException -> 99)   |> check "erw90reI" 99
+
+    let compare_r4() = 
+        (try ignore(compare Unchecked.defaultof<R4> Unchecked.defaultof<R4>) ; 99 with :? System.NullReferenceException -> 99)   |> check "erw90reO" 99
+
+
+
+    hash_u1()
+    hash_u2()
+    hash_u4()
+    hash_r1()
+    hash_r2()
+    hash_r4()
+    equal_u1()
+    equal_u2()
+    equal_u4()
+    equal_r1()
+    equal_r2()
+    equal_r4()
+    compare_u1()
+    compare_u2()
+    compare_u4()
+    compare_r1()
+    compare_r2()
+    compare_r4()
+
+    let hash_g<'T when 'T : equality>() = 
+        // random code to prevent inlining
+        let v1 = ref 0 
+        let v2 = ref 0 
+        let v3 = ref 0 
+        let nm = (sprintf "erw90re1h, %A" (typeof<'T>).Name)
+        (try ignore(hash (Unchecked.defaultof<'T>)) ; 99 with :? System.NullReferenceException -> 99)   |> check nm 99
+        v1 := 0
+        v2 := 0
+        v3 := 0
+
+    let compare_g<'T when 'T : comparison>(v) = 
+        // random code to prevent inlining
+        let v1 = ref 0 
+        let v2 = ref 0 
+        let v3 = ref 0 
+        let nm = (sprintf "erw90re1c, %A" (typeof<'T>).Name)
+        (try ignore(compare Unchecked.defaultof<'T> Unchecked.defaultof<'T>) ; 99 with :? System.NullReferenceException -> 99)   |> check nm 99
+        (try ignore(compare Unchecked.defaultof<'T> v) ; 99 with :? System.NullReferenceException -> 99 )  |> check nm 99
+        compare v Unchecked.defaultof<'T> |> check nm 1
+        v1 := 0
+        v2 := 0
+        v3 := 0
+
+    let equals_g<'T when 'T : equality>(v) = 
+        // random code to prevent inlining
+        let v1 = ref 0 
+        let v2 = ref 0 
+        let v3 = ref 0 
+        let nm = (sprintf "erw90re1e, %A" (typeof<'T>).Name)
+        (Unchecked.defaultof<'T> = Unchecked.defaultof<'T>) |> check nm true
+        (Unchecked.defaultof<'T> = v) |> check nm false
+        //(try ignore(Unchecked.defaultof<'T> = Unchecked.defaultof<'T>) ; false with :? System.NullReferenceException -> true)   |> check nm true
+        //(try ignore(Unchecked.defaultof<'T> = v) ; false with :? System.NullReferenceException -> true)   |> check nm true
+        (v = Unchecked.defaultof<'T>) |> check nm false
+        v1 := 0
+        v2 := 0
+        v3 := 0
+
+    hash_g<U1>() 
+    hash_g<U2>() 
+    hash_g<U4>() 
+    hash_g<R1>() 
+    hash_g<R2>() 
+    hash_g<R4>() 
+
+    compare_g<U1>(U1.A) 
+    compare_g<U2>(U2.A) 
+    compare_g<U4>(U4.A) 
+    compare_g<R1>( { R1.x = 1 } ) 
+    compare_g<R2>( { R2.x1 = 1; R2.x2 = 2 } ) 
+    compare_g<R4>( { x1 = 1; x2 = 2; x3 = 2; x4 = 2 }  ) 
+
+    equals_g<U1>(U1.A) 
+    equals_g<U2>(U2.A) 
+    equals_g<U4>(U4.A) 
+    equals_g<R1>( { R1.x = 1 } ) 
+    equals_g<R2>( { R2.x1 = 1; R2.x2 = 2 } ) 
+    equals_g<R4>( { x1 = 1; x2 = 2; x3 = 2; x4 = 2 }  ) 
+
+
+module CoercivePipingTest = 
+    let f1 (x:obj) = 
+        x |> id :?> int  |> id :> obj |> id
+
+    let f2 (x:obj) = 
+        x |> id 
+          :?> int  |> id :> obj |> id
+
+    let f3 (x:obj) = 
+        x |> id 
+          :?> int  
+          |> id :> obj |> id
+               
+    let f4 (x:obj) = 
+        x |> id 
+          :?> int  
+          |> id 
+          :> obj |> id
+
+    let f5 (x:obj) = 
+        x |> id 
+          :?> int  
+          |> id 
+          :> obj 
+          |> id
+               
+    let f6 (x:obj) = 
+        x 
+        |> id 
+          :?> int  
+          |> id 
+          :> obj 
+          |> id
+               
+    let f7 (x:obj) = 
+        x 
+        |> id 
+        :?> int  
+          |> id 
+          :> obj 
+          |> id
+               
+
+    let f8 (x:obj) = 
+        x 
+        |> id 
+        :?> int  
+        |> id 
+        :> obj 
+          |> id
+
+    let f9 (x:obj) = 
+        x 
+        |> id 
+        :?> int  
+        |> id 
+        :> obj 
+          |> id
+
+    check "clwcweki" (f1 3) (box 3)
+    check "clwcweki" (f2 3) (box 3)
+    check "clwcweki" (f3 3) (box 3)
+    check "clwcweki" (f4 3) (box 3)
+    check "clwcweki" (f5 3) (box 3)
+    check "clwcweki" (f6 3) (box 3)
+    check "clwcweki" (f7 3) (box 3)
+    check "clwcweki" (f8 3) (box 3)
+    check "clwcweki" (f9 3) (box 3)
+
+#if NetCore
+#else
+    // this was the actual repro
+    let f (info: System.Reflection.MethodInfo) = 
+      System.Attribute.GetCustomAttribute(info, typeof<ReflectedDefinitionAttribute>)
+      :?> ReflectedDefinitionAttribute
+#endif
+
+module Test_Dev10_Bug_917383 = 
+
+    // This code did not verify
+    let testCode inp = 
+       let lf s v = List.ofSeq s |> List.findIndex (fun y -> y = v)
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+       match inp with 
+       | 0 -> 1
+       | _ -> 
+           lf [1;inp] inp
+    check "elcvewerv" (testCode 5) 1
+
+/// This gave  a peverify error due to bad codegen
+module DevDiv_Bug_918202 = 
+    type sideffect = (unit -> unit) 
+    type 'a refopt = 'a ref option 
+    type FwdRev<'x,'xb>(rev) = 
+         let rev : 'xb refopt       = rev 
+         member this.Rev with get() = rev 
+    type FwdRevArray<'x,'xb> = FwdRev<'x[], 'xb ref[]> 
+    let blit_b  (arr1 : FwdRevArray<'x,'xb>) start1 
+                (arr2 : FwdRevArray<'x,'xb>) start2 len = 
+        let reset =                                                                        
+            let arr2b = !arr2.Rev.Value 
+            let zeros = arr2b.[start2 .. start2+len-1] 
+            let geti  = 
+                let temp = !arr1.Rev.Value 
+                fun i -> temp.[i] 
+            for j in start2 .. start2+len-1 do                    
+                arr2b.[j] <- geti (j-start2+start1)       
+            fun () -> for j in start2 .. start2+len-1 do 
+                            arr2b.[j] <- zeros.[j-start2] 
+        (), reset 
+
+
+module TestTwoConversionsOK = 
+
+    let test1 i =     
+       let v = uint32 i 
+       int64 i  // previously gave: error: type 'int64' does not match 'uint32'
+
+// See FSharp 1.0 6477
+//The problem is related to the rule that  type variable sets may not have two 
+// trait constraints with the same name (similarly, may not be constrained by 
+// different instantiations of the same interface type), and if two constraints 
+// with the same name are given then the argument types and return types are 
+// asserted to be equal.
+//
+//This rule is a deliberate artificial limitation to reduce the complexity 
+// of type inference in the common case, at the cost of making �inline� code 
+// less generic. However, the rule should not apply to op_Explicit and op_Implicit constraints. These are special constraint names, known to the language, and we already have special rules around these operators to ensure that the return type 
+// is effectively considered to be part of the �name� of the constraint
+//  (i.t. op_Explicit -->  int64 is effectively a different constraint to op_Explicit --> int32). 
+//
+//So the solution is thus to not apply the rule for these constraints. 
+module TestTwoConversionsOK_FSharp_6477 = 
+
+
+    let test() =
+         let test1 i =
+             uint32 i |> ignore
+
+         let test2 i =
+             test1 i
+             int64 (min i 10) // previously gave: error: type 'int64' does not match 'uint32'
+
+         test2 10
+
+
+// See bug dev11 129910.
+// The common thing here is that the type definitions include members or fields
+// whose type is a type variable ?X constrained to a type IFoo<'T> involving the 
+// enclosing class type variable T. ?X should be solved at the point where we generalize
+// T. In F# 2.0 some of these gave invalid code generation ("undefined type variable" errors
+// during code generation). In F# 3.0 they compile OK.
+//
+// Some mutually recursive cases have been included for completeness, though there's nothing 
+// particularly specific being tested in those cases.
+module TestPartiallyConstrainedInferenceProblems = 
+
+    type C1<'T>(v) = 
+        member x.M() = (v :> IEvent<'T> |> ignore)
+
+    type C2<'T> = 
+        member x.P with get v = (v :> IEvent<'T> |> ignore)
+
+    type C3<'T>() = 
+        member x.P with get v = (v :> IEvent<'T> |> ignore)
+
+    type C4<'T> = 
+        new () = { } 
+        new v = (v :> IEvent<'T> |> ignore); C4<'T>()
+
+    type C5<'T>() = 
+        member x.P with get v = (v + v |> ignore)
+
+    type C6<'T>() = 
+        member x.P with get v = (match v with null -> ()  | _ -> ())
+
+    type C7<'T>(v) = 
+        member x.M() = (match v with null -> ()  | _ -> ())
+
+    type C8<'T>(v) = 
+        member x.M() = (sprintf "%d" v |> ignore)
+
+    type C9<'T>(v) = 
+        member x.M() = (sprintf "%f" v |> ignore)
+
+
+
+
+
+    type MutualC1a<'T>(v) = 
+        member x.M() = (v :> IEvent<'T> |> ignore)
+    and MutualC1b<'T>(v) = 
+        member x.M() = (v :> System.IComparable<'T> |> ignore)
+
+    type MutualC2a<'T> = 
+        member x.P with get v = (v :> IEvent<'T> |> ignore)
+    and MutualC2b<'T> = 
+        member x.P with get v = (v :> System.IComparable<'T> |> ignore)
+
+    type MutualC3a<'T>() = 
+        member x.P with get v = (v :> IEvent<'T> |> ignore)
+    and MutualC3b<'T>() = 
+        member x.P with get v = (v :> System.IComparable<'T> |> ignore)
+
+    type MutualC4a<'T> = 
+        new () = { } 
+        new v = (v :> IEvent<'T> |> ignore); MutualC4a<'T>()
+
+    and MutualC4b<'T> = 
+        new () = { } 
+        new v = (v :> System.IComparable<'T> |> ignore); MutualC4b<'T>()
+
+module RecordPropertyConstraints = 
+
+    type A1 = { Age: int;    Name: string; LifeTime: System.TimeSpan }
+    type A2 = { mutable Age: int;    mutable Name: string ; mutable LifeTime: System.TimeSpan }
+    type B = { name: string } with member this.Name = this.name
+
+    [<Struct>]
+    type ImmutableStructImplicit(age:int,name:string, lifeTime:System.TimeSpan) = 
+        member x.Age = age
+        member x.Name = name
+        member x.LifeTime = lifeTime
+
+    type ImmutableClassImplicit(age:int,name:string, lifeTime:System.TimeSpan) = 
+        member val Age = age with get
+        member val Name = name with get
+        member val LifeTime = lifeTime with get
+
+    type MutableClassImplicit(age:int,name:string, lifeTime:System.TimeSpan) = 
+        member val Age = age with get,set
+        member val Name = name with get,set
+        member val LifeTime = lifeTime with get,set
+
+    // This form of struct definition does not satisfy property constraints
+    [<Struct>]
+    type ImmutableStructExplicit = 
+        val Age: int
+        val Name: string
+        val LifeTime: System.TimeSpan
+
+    [<Struct>]
+    type MutableStructExplicit =
+        val mutable Age: int
+        val mutable Name: string 
+        val mutable LifeTime: System.TimeSpan 
+
+    type ImmutableClassExplicit = 
+        val Age: int
+        val Name: string
+        val LifeTime: System.TimeSpan
+        new(age,name,lifeTime) = { Age=age; Name=name; LifeTime = lifeTime }
+
+    type MutableClassExplicit =
+        val mutable Age: int
+        val mutable Name: string 
+        val mutable LifeTime: System.TimeSpan 
+        new(age,name,lifeTime) = { Age=age; Name=name; LifeTime = lifeTime }
+
+    let inline name (x:^T) = (^T : (member Name : string) x)
+    let inline setName (x:^T) (y:string) = (^T : (member set_Name : string -> unit) (x,y))
+    let inline setName2 (x:^T) (y:string) = (^T : (member Name : string with set) (x,y))
+    let inline age (x:^T) = (^T : (member Age : int) x)
+    let inline setAge (x:^T) (y:int) = (^T : (member set_Age : int -> unit) (x,y))
+    let inline lifetime (x:^T) = (^T : (member LifeTime : System.TimeSpan) x)
+    let inline setLifetime (x:^T) (y:System.TimeSpan) = (^T : (member set_LifeTime : System.TimeSpan -> unit) (x,y))
+
+    let a1 : A1 = { Age = 29; Name = "Harry" ; LifeTime=System.TimeSpan.Zero}
+    let a2 : A2 = { Age = 29; Name = "Sally" ; LifeTime=System.TimeSpan.Zero}
+    let b = { name = "Gary" }
+    let s1 : ImmutableStructImplicit = ImmutableStructImplicit()
+    let s1e  = ImmutableStructExplicit()
+    let s2e  = MutableStructExplicit()
+    let c1 : ImmutableClassImplicit = ImmutableClassImplicit(29,"HarryJ",System.TimeSpan.Zero)
+    let c2 : MutableClassImplicit = MutableClassImplicit(29,"HarryK",System.TimeSpan.Zero)
+    let c1e : ImmutableClassExplicit = ImmutableClassExplicit(29,"HarryL",System.TimeSpan.Zero)
+    let c2e : MutableClassExplicit = MutableClassExplicit(29,"HarryM",System.TimeSpan.Zero)
+
+    let f1() = name a1 // now works
+    let f1s1() = name s1 // always worked
+    let f1s1e() = name s1e // always worked
+    let f1s2e() = name s2e // always worked
+    let f1c1() = name c1 // always worked
+    let f1c2() = name c2 // always worked
+    let f1c1e() = name c1e // always worked
+    let f1c2e() = name c2e // always worked
+    let f1a2() = name a2 // now works
+    let f3a2() = setName a2 "HarrySally" // now works
+    let f3c2() = setName c2 "HarrySallyDally" // now works
+    let f3c2e() = setName c2e "HarrySallyDallyMally" // now works
+    let f3a2x() = setName2 a2 "HarrySallyX" // now works
+    let f3c2x() = setName2 c2 "HarrySallyDallyX" // now works
+    let f3c2ex() = setName2 c2e "HarrySallyDallyMallyX" // now works
+    let f4() = age a1 // now works
+    let f5 () = age a2 // now works
+    let f6() = setAge a2 3 // now works
+    let f7() = lifetime a1 // now works
+    let f8 () = lifetime a2 // now works
+    let f9() = setLifetime a2 (System.TimeSpan.FromSeconds 2.0) // now works
+    let f10() = name b // always worked
+
+module RecordPropertyConstraintTests =  
+   
+    open RecordPropertyConstraints 
+
+    check "ckjwnewk" (f1()) "Harry"
+    check "ckjwnewk" (f1s1()) null
+    check "ckjwnewk" (f1s1e()) null
+    check "ckjwnewk" (f1s2e()) null
+    check "ckjwnewk" (f1c1()) "HarryJ"
+    check "ckjwnewk" (f1c2()) "HarryK"
+    check "ckjwnewk" (f1c1e()) "HarryL"
+    check "ckjwnewk" (f1c2e()) "HarryM"
+    
+    check "ckjwnewk" (f1a2()) "Sally"
+    check "ckjwnewk" (f3a2()) ()
+    check "ckjwnewk" (f1a2()) "HarrySally"  // after mutation
+    check "ckjwnewk" (f3a2x()) ()
+    check "ckjwnewk" (f1a2()) "HarrySallyX"  // after mutation
+    check "ckjwnewk" (f3c2()) ()
+    check "ckjwnewk" (f1c2()) "HarrySallyDally"  // after mutation
+    check "ckjwnewk" (f3c2x()) ()
+    check "ckjwnewk" (f1c2()) "HarrySallyDallyX"  // after mutation
+    check "ckjwnewk" (f3c2e()) ()
+    check "ckjwnewk" (f1c2e()) "HarrySallyDallyMally"  // after mutation
+    check "ckjwnewk" (f3c2ex()) ()
+    check "ckjwnewk" (f1c2e()) "HarrySallyDallyMallyX"  // after mutation
+
+    check "ckjwnewk" (f4()) 29
+    check "ckjwnewk" (f5()) 29
+    check "ckjwnewk" (f6()) ()
+    check "ckjwnewk" (f5()) 3  // after mutation
+    check "ckjwnewk" (f7()) System.TimeSpan.Zero
+    check "ckjwnewk" (f8()) System.TimeSpan.Zero
+    check "ckjwnewk" (f9()) ()
+    check "ckjwnewk" (f8()) (System.TimeSpan.FromSeconds 2.0) // after mutation
+    check "ckjwnewk" (f10()) "Gary"
+
+let aa =
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/syntax/build.bat b/tests/fsharp/core/syntax/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/syntax/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/syntax/dont.use.generated.signature b/tests/fsharp/core/syntax/dont.use.generated.signature
new file mode 100644
index 0000000..bbf0e7e
--- /dev/null
+++ b/tests/fsharp/core/syntax/dont.use.generated.signature
@@ -0,0 +1 @@
+See bug #4364
\ No newline at end of file
diff --git a/tests/fsharp/core/syntax/dont.use.wrapper.namespace b/tests/fsharp/core/syntax/dont.use.wrapper.namespace
new file mode 100644
index 0000000..69dd3d3
--- /dev/null
+++ b/tests/fsharp/core/syntax/dont.use.wrapper.namespace
@@ -0,0 +1 @@
+"uses ;;" 
diff --git a/tests/fsharp/core/syntax/run.bat b/tests/fsharp/core/syntax/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/core/syntax/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/core/syntax/test.fsx b/tests/fsharp/core/syntax/test.fsx
new file mode 100644
index 0000000..09ffbc4
--- /dev/null
+++ b/tests/fsharp/core/syntax/test.fsx
@@ -0,0 +1,1802 @@
+// #Regression #Conformance #Operators #SyntacticSugar #Exceptions #ControlFlow #Arrays #Tuples #Lists #Classes #Constants #Records 
+#if Portable
+module Core_syntax
+#endif
+#light
+let failures = ref false
+let report_failure () = 
+  stderr.WriteLine " NO"; failures := true
+let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else report_failure() 
+
+// Test the __LINE__ directive
+test "line number test" (__LINE__ = "12")
+#line 100
+test "line number test" (__LINE__ = "100")
+
+#line 102 "file.fs"
+test "line number test" (__LINE__ = "102")
+test "line number test" (__SOURCE_FILE__ = "file.fs")
+
+#line 18 "original-test-file.fs"
+test "line number test" (__LINE__ = "18")
+test "line number test" (__SOURCE_FILE__ = "original-test-file.fs")
+
+# 100
+test "line number test" (__LINE__ = "100")
+
+# 102 "file.fs"
+test "line number test" (__LINE__ = "102")
+test "line number test" (__SOURCE_FILE__ = "file.fs")
+
+# 29 "original-test-file.fs"
+test "line number test" (__LINE__ = "29")
+test "line number test" (__SOURCE_FILE__ = "original-test-file.fs")
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  
+    let cultureString = argv.[2] 
+    let culture = new System.Globalization.CultureInfo(cultureString) 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+ 
+
+do SetCulture();;
+#endif
+  
+let SimpleArithmetic( )
+    = let x = 10 + 12 - 3
+       in let y = x * 2 + 1 in
+          let r1,r2 = x/3, x%3
+           in printf "x = %d, y = %d, x/3 = %d, x%%3 = %d\n"
+                           x       y        r1         r2;;
+
+module CheckDynamicOperatorsOnTypes = 
+    type Foo =
+         val s : string
+         new(s) = { s = s }
+         static member (?) (foo : Foo, name : string) = foo.s + name
+         static member (?<-) (foo : Foo, name : string, v : string) = ()
+
+    let foo = Foo("hello, ")
+    let hw  : string = foo ? world
+    let hw2  : unit = foo ? world <- "3"
+        
+
+// Copyright (c) Microsoft Corporation 2005-2006.  .
+
+
+open System
+
+//--------------------------------------------------------
+
+let _ = stdout.WriteLine "Test Starting"
+
+let SampleArithmetic1() =
+    let x = 10 + 12 - 3 
+    let y = x * 2 + 1 
+    let r1,r2 = x/3, x%3
+    printf "x = %d, y = %d, r1 = %d, r2 = %d\n" x y r1 r2
+  
+
+let SampleArithmetic2() =
+    let x = 10.0 + 12.0 - 3.0 
+    let y = x * 2.0 + 1.0 
+    let r1 = x/3.0
+    printf "x = %g, y = %g, r1 = %g\n" x y r1
+
+  
+let SampleArithmetic3() =
+    // Manipulating double-precision (64-bit) floating point numbers
+    let pi1 = float   3 + 0.1415 
+    let pi2 = float 3 + 0.1415   // identical - int32 and int are the same
+    let pi3 = float 3 + 0.1415   // identical - A.to_B and B.of_A often both exist
+    let pi4 = float 3          + 0.1415   // identical - 'float' is an addiitonal ahortcuts
+    printf "pi1 = %f, pi2 = %f, pi3 = %f\n" pi1 pi2 pi3;
+  
+    let i1 = int   3.1415 
+    let i2 = int32 3.1415   // identical - int32 and int are the same
+    let i3 = int32 3.1415   // identical - A.to_B and B.of_A often both exist
+    let i4 = float 3.1415         // identical 
+    printf "pi1 = %f, pi2 = %f, pi3 = %f\n" pi1 pi2 pi3;
+  
+    // Manipulating single-precision (32-bit) floating point numbers
+    let f32a = 2.1415f + 1.0f             // float32 (System.Single)
+    let f32b = 2.1415f + float32 1 // float32 - identical 
+    printf "f32a = %f, f32b = %G\n" (float f32a) (float f32b)
+  
+    // Manipulating bytes
+    let byteA = byte (3+4)         // byte 
+    let byteB = byte 0xFF          // byte 
+    printf "byteA = %d, byteB = %d\n" (int byteA) (int byteB)
+  
+
+let Sample4() =
+    // Operators over integers:
+    let x1 = 0xAB7F3456 &&& 0xFFFF0000 
+    let x2 = 0xAB7F3456 ||| 0xFFFF0000 
+    let x3 = 0x12343456 ^^^ 0xFFFF0000 
+    let x4 = 0x1234ABCD <<< 1 
+    let x5 = 0x1234ABCD >>> 16 
+    // Also over other integral types, e.g. Int64:
+    let x6 = 0x0A0A0A0A012343456L &&& 0x00000000FFFF0000L 
+    // Also over other integral types, e.g. unsigned Int64:
+    let x6u = 0x0A0A0A0A012343456UL &&& 0x0000FFFF00000000UL 
+    // And bytes:
+    let x7 = 0x13uy &&& 0x11uy 
+    // Now print the results:
+    printf "x1 = 0x%08x\n" x1;
+    printf "x2 = 0x%08x\n" x2;
+    printf "x3 = 0x%08x\n" x3;
+    printf "x4 = 0x%08x\n" x4;
+    printf "x5 = 0x%08x\n" x5;
+    printf "x6 = 0x%016x\n" x6;
+    printf "x6u = 0x%016u\n" x6u;
+    printf "x7 = 0x%02x\n" (int x7)
+  
+  
+  
+//--------------------------------------------------------
+
+
+let FunctionSample1() =
+    let twice x = x + x 
+    printf "twice 2 = %d\n" (twice 2);
+    printf "twice 4 = %d\n" (twice 4);
+    printf "twice (twice 2) = %d\n" (twice (twice 2))
+
+let FunctionSample2() =
+    let even n = (n%2 = 0) 
+    let tick x = printf "tick %d\n" x 
+    let tock x = printf "tock %d\n" x 
+    let choose f g h x = if f x then g x else h x 
+    let ticktock = choose even tick tock  // ticktock is a function built out of other functions using 'choose'
+    for i = 0 to 10 do
+        ticktock i
+    
+
+let FunctionSample3() =
+    let tick x = printf "tick %d\n" x 
+    let tock x = printf "tock %d\n" x 
+    let choose f g h x = if f x then g x else h x 
+    for i = 0 to 10 do
+        // This is like the previous sample, but uses an anonymous lambda expression for 
+        // the function that decides whether to tick or tock.
+        choose (fun n -> n%2 = 0) tick tock i 
+    
+
+//--------------------------------------------------------
+
+let ExceptionSample1() : unit =
+    failwith "Here's how to raise a simple 'Failure' exception"
+  
+
+let ExceptionSample2() =
+    try 
+        printf "About to raise a simple 'Failure' exception...\n"
+        failwith "Whoa!"
+    with 
+        Failure msg -> 
+            printf "Caught a simple 'Failure' exception, msg = '%s'\n" msg
+  
+let ExceptionSample3() =
+    try 
+        printf "About to raise an exception...\n"
+        match DateTime.Now.DayOfWeek with 
+        | DayOfWeek.Monday -> raise (System.Collections.Generic.KeyNotFoundException())
+        | _                -> raise (Failure "it's not Monday")
+    with 
+        | :? System.Collections.Generic.KeyNotFoundException -> 
+            printf "Caught a 'Not_found' exception, it must be Monday\n"
+        | Failure msg -> 
+            printf "Caught a 'Failure' exception: %s\n" msg
+
+let ExceptionSample4() =
+    try 
+        printf "About to raise an ArgumentException exception...\n"
+        if DateTime.Now.DayOfWeek = DayOfWeek.Tuesday then 
+            raise (new System.ArgumentException("Not today, it's Tuesday"))
+        else
+            raise (new System.InvalidOperationException("Hey, it's not Tuesday..."))
+    with 
+        | :? System.ArgumentException as e -> 
+            printf "Caught an ArgumentException, e.Message = %s\n" e.Message
+        | :? System.InvalidOperationException as e -> 
+            printf "Caught an InvalidOperationException, e.Message = %s\n" e.Message
+        | _ -> 
+            printf "Some other exception was caught\n"
+  
+//--------------------------------------------------------
+
+  
+let SampleForLoop1() =
+    for i = 1 to 10 do 
+        printf "In a for-loop, i = %d\n" i
+    
+  
+let SampleForLoop2() =
+    for i = 0 to 9 do 
+        for j = 0 to i-1 do 
+            printf " "
+        for j = i to 9 do 
+            printf "%d" j
+        printf "\n"
+    
+  
+
+let SampleWhileLoop1() =
+    let count = ref 0
+    while (!count < 10) do 
+        printf "Counting, skipping by 2, count = %d...\n" !count;
+        count := !count + 2
+    printf "Done counting!\n"
+  
+
+
+let SampleWhileLoop2() =
+    let start = DateTime.Now 
+    let duration = System.TimeSpan.FromMilliseconds(8.0)
+    let diff (a:DateTime) (b:DateTime) = System.DateTime.op_Subtraction(System.DateTime.Now,b) 
+    printf "Waiting...\n"
+    // Here's the loop
+    while diff DateTime.Now start < duration do
+        printf "."
+    // OK, we're ...
+    let span = diff DateTime.Now start 
+    printf "\nAttempted to busy-wait 8ms, actually waited %dms\n" span.Milliseconds
+  
+
+//--------------------------------------------------------
+
+
+let SampleRec1() =
+    let rec fib n = if n < 2 then 1 else fib (n-1) + fib (n-2) 
+    for i = 1 to 10 do
+        printf "fib %d = %d\n" i (fib i)
+
+//--------------------------------------------------------
+
+
+
+let SampleArray1() =
+    let size = 1000 
+    let arr = Array.create size 0 
+    for i = 1 to size - 1 do 
+        arr.[i] <- i + arr.[i-1]
+    for i = 1 to size - 1 do 
+        printf "arr.[%4d] = %d\n" i arr.[i]
+    
+  
+
+
+let SampleArray2() =
+    let numLetters = 26 
+    let results = Array.create numLetters 0 
+    let data = "The quick brown fox jumps over the lazy dog" 
+    for i = 0 to data.Length - 1 do 
+        let c = data.Chars(i) 
+        let c = Char.ToUpper(c)  
+        if c >= 'A' && c <= 'Z' then 
+            let i = int c - int 'A' 
+            results.[i] <- results.[i] + 1
+    for i = 0 to numLetters - 1 do 
+        printf "Number of '%c' characters = %d\n" (char (i + int 'A')) results.[i]
+    
+  
+
+
+let SampleHashtbl3() =
+    let tab = new System.Collections.Generic.Dictionary<char,int>(30) 
+    let data = "The quick brown fox jumps over the lazy dog" 
+    for i = 0 to data.Length - 1 do 
+        let c = data.Chars(i) 
+        if tab.ContainsKey(c) then 
+            let v = tab.[c] 
+            let _ = tab.Remove(c) 
+            tab.Add(c,v+1)
+        else 
+            tab.Add(c,1)
+    ;
+    tab |> Seq.iter (fun kvp -> printf "Number of '%c' characters = %d\n" kvp.Key kvp.Value ) 
+
+  
+
+//--------------------------------------------------------
+
+
+let TupleSample1() =
+    let data = 1,2,3
+    printf "data = %A\n" data;
+    let f (a,b,c) = (a+b,b+c,c+a) 
+    let res = f(f(f(data))) 
+    printf "res = %A\n" res;
+    let r1,r2,r3 = res 
+    printf "r1 = %d, r2 = %d, r3 = %d\n" r1 r2 r3;
+    let r4,r5,r6 = f(res) 
+    printf "r4 = %d, r5 = %d, r6 = %d\n" r4 r5 r6
+  
+
+
+let ListSample1() =
+    let data = [1;2;3;4]
+    printf "data = %A\n" data;
+    printf "head data = %d\n" (List.head data);
+    printf "tail data = %A\n" (List.tail data);
+    printf "length data = %d\n" (List.length data);
+    printf "nonempty data = %b\n" (List.isEmpty data);
+    let consume data = 
+        match data with 
+        | 1::rest    -> printf "matched a 1\n";       rest
+        | 2::3::rest -> printf "matched a 2 and 3\n"; rest 
+        | [4]        -> printf "matched a 4\n";       []
+        | _          -> printf "unexpected!";         [] 
+    let data = consume data 
+    let data = consume data 
+    let data = consume data 
+    printf "At end of list? %b\n" (data = [])
+  
+
+let ListSample2() =
+    let data = [1;2;3;4]
+    let r1 = List.map (fun x -> x + 1) data 
+    printf "Adding '1' using map = %A\n" r1
+    let r2 = List.map string data 
+    printf "Converting to strings using map = %A\n" r2
+    let r3 = List.map (fun x -> (x,x)) data 
+    printf "Tupling up using map = %A\n" r3
+ 
+
+let ListSample3() =
+    let data = ["Cats";"Dogs";"Mice";"Elephants"]
+    data |> List.iter (fun x -> printf "item: %s\n" x)
+ 
+
+let ListSample4() =
+    let data = ["Cats";"Dogs";"Mice";"Elephants"]
+    data |> List.iteri (fun i x -> printf "item %d: %s\n" i x)
+ 
+
+
+let ListSample5() =
+    let data = [("Cats",4);
+                ("Dogs",5);
+                ("Mice",3);
+                ("Elephants",2)]
+    let count = List.fold (fun acc (nm,x) -> acc+x) 0 data
+    printf "Total number of animals: %d\n" count
+ 
+
+let ListSample6() =
+    let data = [("Cats",4);
+                ("Dogs",5);
+                ("Mice",3);
+                ("Elephants",2)]
+    let res = List.filter (fun (nm,x) -> String.length nm <= 4) data
+    printf "Animals with short names: %A\n" res
+ 
+
+
+let ListSample7() =
+    let data = [("Cats",4);
+                ("Dogs",5);
+                ("Mice",3);
+                ("Elephants",2)]
+    let res = List.choose (fun (nm,x) -> if String.length nm <= 4 then Some(x) else None) data
+    printf "Counts of animals with short names: %A\n" res
+ 
+  
+
+let OptionsSample2() =
+    let data = Some(1,3)
+    printf "data = %A\n" data;
+    printf "Option.isSome data = %b\n" (Option.isSome data);
+    printf "Option.isNone data = %b\n" (Option.isNone data);
+    //printf "Option.length data = %d\n"  (Option.length data);
+    printf "Option.get data = %A\n" (Option.get data);
+    let data2 = None
+    printf "Option.isSome data = %b\n" (Option.isSome data2);
+    printf "Option.isNone data = %b\n" (Option.isNone data2);
+    //printf "Option.length data = %d\n"  (Option.length data2)
+
+
+let OptionsSample3() =
+    let openingHours day = 
+        match day with 
+        | DayOfWeek.Monday 
+        | DayOfWeek.Tuesday 
+        | DayOfWeek.Thursday 
+        | DayOfWeek.Friday    -> Some(9,17)
+        | DayOfWeek.Wednesday -> Some(9,19) // extended hours on Wednesday
+        | _ -> None 
+    let today = DateTime.Now.DayOfWeek 
+    match openingHours today with 
+    | None -> printf "The shop's not open today\n"
+    | Some(s,f) -> printf "The shop's open today from %02d:00-%d:00\n" s f
+
+//--------------------------------------------------------
+
+  
+
+let ComparisonSample1() =
+    let show a b = 
+        printf "%A < %A: %b\n" a b (a < b)
+        printf "%A = %A: %b\n" a b (a = b)
+        printf "%A > %A: %b\n" a b (a > b)
+    
+    show 1 2;
+    show 2 2;
+    show "1" "2"
+    show "abb" "abc" 
+    show "aBc" "ABB" // case-sensitive
+    show None (Some 1);
+    show None None;
+    show (Some 0) (Some 1);
+    show (Some 1) (Some 1);
+    show [1;2;3] [1;2;2];
+    show [] [1;2;2]
+  
+
+let HashingSample2() =
+    let show a = printf "hash(%A) : %d\n" a (hash a) 
+    show 1;
+    show 2;
+    show "1"
+    show "2"
+    show "abb" 
+    show "aBc" // case-sensitive
+    show None;
+    show (Some 1);
+    show (Some 0);
+    show [1;2;3];
+    show [1;2;3;4;5;6;7;8];
+    show [1;2;3;4;5;6;7;8;9;10;11];
+    show [1;2;3;4;5;6;7;8;9;10;11;12;13;14;15]
+
+  
+//--------------------------------------------------------  
+
+
+let dummy() = ()
+type wheel = Wheel of float  // radius of wheel, inches
+type cycle = 
+    | Unicycle of wheel
+    | Bicycle of wheel * wheel 
+
+let veryBigWheel = Wheel(26.0)
+let bigWheel     = Wheel(13.0)
+let smallWheel   = Wheel(6.0)
+
+let pennyFarthing = Bicycle(veryBigWheel,smallWheel)
+let racer         = Bicycle(bigWheel    ,bigWheel)
+let kidsBike      = Bicycle(smallWheel  ,smallWheel)
+
+let UnionSample1() =
+    let show bike = 
+        match bike with 
+        | Unicycle (Wheel r) -> printf "Unicycle, one wheel, radius = %f\n" r
+        | Bicycle (Wheel r1,Wheel r2) -> printf "Bicycle, two wheels, front = %f, back = %f\n" r1 r2 
+    show pennyFarthing;
+    show racer;
+    show kidsBike
+
+
+
+let dummy2() = ()
+type point = { x: float; y: float}
+type triangle = { p1: point; p2: point; p3: point }
+type vector = { dx: float; dy: float}
+
+let origin = { x = 0.0; y = 0.0 }
+let onex = { x = 1.0; y = 0.0 }
+let oney = { x = 0.0; y = 1.0 }
+let diff p1 p2 = { dx = p2.x - p1.x; dy = p2.y - p1.y }
+let sides tri = 
+    diff tri.p2 tri.p1, 
+    diff tri.p3 tri.p2, 
+    diff tri.p1 tri.p3
+
+
+let RecordSample1() =
+    let triangle1 = { p1=origin;p2=onex;p3=oney } 
+    printf "triangle1 = %A\n" triangle1;
+    printf "sides(triangle1) = %A\n" (sides triangle1)
+  
+  
+
+let dummy3() = ()
+type Point = { x: float; y: float}
+    with 
+        member p.VectorFromOrigin = { dx = p.x; dy = p.y }
+        static member Origin = { x = 0.0; y = 0.0 }
+        static member (+) ((p:Point),(v:Vector)) = { x = p.x + v.dx; y = p.y + v.dy }
+    end
+ 
+and Vector = { dx: float; dy: float}
+    with 
+        static member Zero = { dx = 0.0; dy = 0.0 }
+        static member OneX = { dx = 1.0; dy = 0.0 }
+        static member OneY = { dx = 0.0; dy = 1.0 }
+        static member (+) ((v1:Vector),(v2:Vector)) = { dx = v1.dx + v2.dx; dy = v1.dy + v2.dy }
+    end
+
+
+
+let MemberSample1() =
+    printf "Point.Origin = %A\n" Point.Origin;
+    printf "Point.Origin + Vector.OneX = %A\n" (Point.Origin + Vector.OneX);
+    printf "Vector.OneX + Vector.OneY = %A\n" (Vector.OneX + Vector.OneY)
+
+  
+
+
+let InterfaceSample1() =
+    let disposableObject1 = 
+        { new IDisposable  with 
+              member __.Dispose() = printf "disposed!\n" } 
+    let disposableObject2 = 
+        let disposed = ref false 
+        { new IDisposable with 
+            member __.Dispose() = if not !disposed then (disposed := true; printf "disposed!\n") } 
+    disposableObject1.Dispose();
+    disposableObject1.Dispose();
+    disposableObject2.Dispose();
+    disposableObject2.Dispose()
+
+let dummy5() = ()
+type WrapOneStream = 
+    // some owned objects that need to be disposed
+    { myManagedResource: IO.MemoryStream; }
+    with 
+        // Here is the standard machinery to implement disposability.
+        // This tends to be replicated each type that must support the
+        // disposal paradigm.
+        interface IDisposable with
+            member x.Dispose() = 
+                 x.Dispose(true); 
+                 GC.SuppressFinalize(x)
+        end
+        // We override Finalize the case this class has native resources of its own.
+        // In this sample it doesn't, but we have included the full pattern 
+        // here for completeness.
+        override x.Finalize() = x.Dispose(false)
+        member x.Dispose(deep: bool) =  
+            printf "disposing, deep = %b!\n" deep;
+            if deep then x.myManagedResource.Close()
+  end 
+
+let dummy4() = ()
+type IPoint = 
+    interface
+        abstract X : float
+        abstract Y : float
+    end
+
+/// This interface is really just a function, but we give it a name
+/// here as an example. It represents a function from some variable to (X,Y)
+type ILine = 
+    interface
+        abstract GetY : float -> IPoint
+    end
+
+/// A function representing a line, where the parameter governing the line is the
+/// X coordinate itself
+type Line = 
+    class
+        val a: float
+        val c: float
+        new (a,c) = { a=a;c=c}
+        interface ILine with 
+            member l.GetY(x) = { new IPoint with 
+                                    member __.X=x 
+                                    member __.Y= l.a * x + l.c }
+        end
+end
+
+let InterfaceSample3() =
+    let line = new Line(2.0,1.5) :> ILine 
+    let origin =  { new IPoint with 
+                         member __.X=0.0 
+                         member __.Y= 0.0 }
+    let point1 = line.GetY(-1.0)
+    let point2 = line.GetY(0.0)
+    let point3 = line.GetY(1.0)
+    let output_point os (p:IPoint) = fprintf os "(%f,%f)" p.X p.Y 
+    printf "origin = %a\n" output_point origin;
+    printf "point1 = %a\n" output_point point1;
+    printf "point2 = %a\n" output_point point2;
+    printf "point3 = %a\n" output_point point3
+  
+let LineDirectedInputSample1() = 
+    
+    // Write a test file
+    let outputChannel = System.IO.File.CreateText @"test.txt" 
+    outputChannel.Write "This is a test file.\r\nIt is easy to read.";
+    outputChannel.Close();
+    
+    // Now read the test file.
+    let inputChannel = System.IO.File.OpenText @"test.txt" 
+    let line1 = inputChannel.ReadLine() 
+    let line2 = inputChannel.ReadLine() 
+    // Don't forget to close the channel
+    inputChannel.Close();
+    printf "line1=%s\nline2=%s\n" line1 line2
+
+module InfixTokenIndentationExamples = begin
+
+
+    let f x =
+       let y = 1
+       -1
+
+end
+
+let LineDirectedInputSample2() = 
+    // Write a test file
+    System.IO.File.WriteAllLines(@"test.txt", [| "This is a test file."; 
+                                                 "It is easy to read." |]);
+
+    // Now read it.  We use using to ensure the file is closed even if an exception occurs
+    // during reading.  
+    let line1,line2 = 
+        using (System.IO.File.OpenText @"test.txt") (fun sr -> 
+            let line1 = sr.ReadLine() 
+            let line2 = sr.ReadLine() 
+            (line1,line2))  
+    printf "line1=%s\nline2=%s\n" line1 line2
+
+let LineDirectedInputSample3() = 
+    // Write a test file
+    System.IO.File.WriteAllLines(@"test.txt", [| "This is a test file."; 
+                                                 "It is easy to read." |]);
+    // Now read it 
+    let lines = System.IO.File.ReadAllLines @"test.txt"  
+    printf "%s" (sprintf "%A" lines)
+
+let EntireFileInputSample2() = 
+    // Write a test file
+    System.IO.File.WriteAllLines(@"test.txt", [| "This is a test file."; 
+                                                 "It is easy to read." |]);
+    // Now read it 
+    let res = System.IO.File.ReadAllText(@"test.txt")  
+    printf "%s" res
+
+module String = 
+    let split (c : char list) =
+        let ca = Array.ofList c 
+        fun (s:string) ->
+            Array.toList(s.Split(ca, System.StringSplitOptions.RemoveEmptyEntries))
+
+let ReadCSVFile1() = 
+    // Write a test file
+    System.IO.File.WriteAllLines(@"test.csv", [| "Desmond, Barrow, Market Place, 2"; 
+                                                 "Molly, Singer, Band, 12" |]);
+    // Now read it 
+    let linesSplitIntoWords = 
+        System.IO.File.ReadAllLines(@"test.csv")
+        |> Array.map (String.split [',';' ';'\t'])
+        |> Array.map List.toArray  
+    printf "%A"  linesSplitIntoWords
+        
+let EnumerateCSVFile1() = 
+
+    // Write a test file
+    System.IO.File.WriteAllLines(@"test.csv", [| "Desmond, Barrow, Market Place, 2"; 
+                                                 "Molly, Singer, Band, 12" |]);
+
+    /// This function builds an IEnumerable<string list> object that enumerates the CSV-split
+    /// lines of the given file on-demand 
+    let CSVFileEnumerator(fileName) = 
+        // The function is implemented using RuntimeHelpers.GenerateUsing, which is the standard
+        // function for building enumerators for sources such as files and database
+        // connections.  This function takes two function parameters: one function to generate 
+        // a handle to the resource, and one to incrementally read new results from the handle.  
+        // The function guarantees to cleanup the resources associated with the handle when 
+        // each individual enumeration is complete. Multiple concurrent enumerations can be 
+        // in progress since each will use a different stream handle and/or database connection.
+        seq { use sr = System.IO.File.OpenText(fileName)
+              while not sr.EndOfStream  do
+                yield sr.ReadLine() |> String.split [',';' ';'\t'] }
+
+    // Now test this out on our test file, iterating the entire file
+    let test = CSVFileEnumerator(@"test.csv")  
+    printf "-------Enumeration 1------\n";
+    test |> Seq.iter (sprintf "%A" >> printf "line %s\n");
+    // Now do it again, this time determining the numer of entries on each line.
+    // Note how the file is read from the start again, since each enumeration is 
+    // independent.
+    printf "-------Enumeration 2------\n";
+    test |> Seq.iter (List.length >> printf "line has %d entries\n");
+    // Now do it again, this time determining the numer of entries on each line.
+    // Note how the file is read from the start again, since each enumeration is 
+    // independent.
+    printf "-------Enumeration 3------\n";
+    test |> Seq.iter (List.map String.length >> sprintf "%A" >> printf "lengths of entries: %s\n")
+
+let test27832() = 
+    if true then
+      3
+    else 
+      if true then 
+        4
+      else 
+        if true then
+          5
+        else 
+          6
+
+let test27834() = 
+    if true then
+      3
+    else 
+      if true then printf "hello";
+      4 
+
+let test278343() = 
+    if true then
+      3
+    else if true then 
+      4
+    else if true then
+      5
+    else 
+      6
+ 
+let test273343() = 
+    if true then
+      3
+    else 
+      if true then printf "hello";
+      4
+ 
+let test278342() = 
+    if true then
+      3
+    elif true then 
+      4
+    elif true then
+      5
+    else 
+      6
+
+open System.IO
+let findDLLs (dir:string) =
+    if (Directory.Exists dir) then
+        let files = Directory.GetFiles(dir, "*.dll") 
+        Array.toList files
+    else
+        if true then 
+            eprintf "Directory %s does not exist!\n" dir
+        []
+ 
+do SimpleArithmetic( );;
+
+type recd = {x : int; y:int; z:int }
+let r = { x = 3; y = 4;z=6 }
+let r2 = { r with 
+             x = 4 }
+
+let r3 = { r with 
+             x = 4;
+             y = 6 }
+let r4 = { r with 
+            x = 4;
+            y = 6 }
+let r4b = { r with x = 4;
+                   y = 6 }
+let r4c = { r with   x = 4;
+                     y = 6 }
+let r5 = { new recd 
+             with x = 4 
+             and  y = 5
+             and  z = 6}
+
+let testTryFinallySyntaxOnOneLine () = 
+    try () finally ()
+
+
+type SampleForm = 
+  class
+  #if Portable
+    inherit System.Object
+  #else
+    inherit System.Windows.Forms.Form
+  #endif
+    new () as this =
+       { }
+       
+       then 
+        ()
+  end
+
+(* check do introduces a #light block *)
+begin 
+   [ for x in [1;2;3] do
+       let z = x + 1 
+       let y = x + 1 
+       yield y ]
+end
+
+(* check do introduces a #light block *)
+begin 
+   [ for x in [1;2;3] do
+       let z = x + 1 
+       let y = x + 1 
+       yield (let x = 3 
+              x+x) ]
+end 
+
+
+begin 
+   [ for x in [1;2;3] do 
+        let z = x + 1 
+        let y = x + 1 
+        yield y ]
+end
+
+begin 
+   [ for x in [1;2;3] do 
+        let z = x + 1 in 
+        let y = x + 1 in 
+        yield! [y] ]
+end
+
+begin 
+   [ for x in [1;2;3] do
+       let z = x + 1  
+       let y = x + 1 
+       yield y ]
+end
+
+(* check do introduces a #light block *)
+begin 
+   [ for x in [1;2;3] do
+       let z = x + 1 in 
+       let y = x + 1 
+       yield y ]
+end
+
+(* check do introduces a #light block *)
+begin 
+   [ for x in [1;2;3] do
+       if (x > x + 1) then
+         let y = x + 1 
+         yield y ]
+end
+
+(* check d introduces a #light block *)
+begin 
+   [ for x in [1;2;3] do
+       if (x > x + 1) then
+         yield (let y = x + 1 
+                y) ]
+end
+
+begin 
+   [ for x in [1;2;3]  
+       -> let y = x + 1 
+          y ]
+end
+begin 
+   [ for x in [1;2;3]  
+       -> let y = x + 1 
+          y ]
+end
+begin 
+   [ while false  do
+       yield (let y = 2 + 1 
+              y) ]
+end
+begin 
+   [ while false  do
+       yield 3 ]
+end
+begin 
+   [ while false  do
+       if false then
+         yield 4 ]
+end
+begin 
+   [ while false  do
+       if false then
+         do printfn "hello"
+         yield 5 ]
+end
+begin 
+   [ while false  do
+       let x = 1
+       if false then
+         do printfn "hello"
+         yield 5 ]
+end
+begin 
+   [ let x = 1
+     while false  do
+       let x = 1
+       if false then
+         do printfn "hello"
+         yield 5 ]
+end
+begin 
+   [ let x = 1
+     while false  do
+       let x = 1
+       while false  do
+         if false then
+           do printfn "hello"
+           yield 5 ]
+end
+begin 
+   [ for x in [1;2;3] 
+       -> 1 ]
+end
+
+begin 
+   [ for x in [1;2;3] do 
+      if (x > x + 1) then
+       let z = x + 1 in 
+       let y = x + 1 
+       yield y ]
+end
+
+begin 
+   [ for x in [1;2;3] do 
+        if (x > x + 1) then
+         let z = x + 1 in 
+         let y = x + 1 
+         yield y ]
+end
+begin 
+   [ for x in [1;2;3] do 
+       if (x > x + 1) then
+         let z = x + 1 
+         let y = x + 1 
+         yield y ]
+end
+
+let rand = new Random()
+
+type EasyOptionInt =
+| None
+| Some of int
+with
+    member x.ToNullableInt =
+        match x with
+        | EasyOptionInt.None -> new Nullable<int>(-1) 
+        | EasyOptionInt.Some x -> new Nullable<int>(x)
+end
+
+let getPoistiveInt2() = 
+    let i = rand.Next(10)
+    match i with
+    | 0 -> EasyOptionInt.None
+    | i -> EasyOptionInt.Some(i)
+
+do test "vliwe9a" (-1-2 = -3)
+do test "vliwe9a" (2 - -5 = 7)
+do test "vliwe9a" (2- - 5 = 7)
+do test "vliwe9a" (2 - - 5 = 7)
+do test "vliwe9a" (2- -5 = 7)
+do test "vliwe9s" (let n = -1 in let m = -2 in -n-m = 3)
+do test "vliwe9s" (let n = -1 in let m = -2 in -n-m = +3)
+do test "vliwe9s" (let n = -1 in let m = -2 in -n - m = +3)
+
+do test "vliwe9d" ((1)-2 = -1)
+
+do test "vliwe9f" ((match 1,1 with -1,-1 -> 1 | _ -> 2) = 2)
+do test "vliwe9g" ((match -1,-1 with -1,-1 -> 1 | _ -> 2) = 1)
+
+let f x = x
+
+do test "vliwe91"   (f -2y = - 2y)
+do test "vliwe92"   (f -2s = - 2s)
+do test "vliwe93"   (f -2 = - 2)
+do test "vliwe94"   (f -2L = - 2L)
+do test "vliwe95"   (f -2n = - 2n)
+do test "vliwe96"   (f -2.0 = - 2.0)
+do test "vliwe97"   (f -2.0f = - 2.0f)
+do test "vliwe99"   (f -2I = - 2I)
+
+do test "vliwe9q"   ((function -2y -> true | _ -> false) (- 2y))
+do test "vliwe9w"   ((function -2s -> true | _ -> false) (- 2s))
+do test "vliwe9e"   ((function -2 -> true | _ -> false) (- 2))
+do test "vliwe9r"   ((function -2L -> true | _ -> false) (- 2L))
+do test "vliwe9t"   ((function -2n -> true | _ -> false) (- 2n))
+do test "vliwe9y"   ((function -2.0 -> true | _ -> false) (- 2.0))
+do test "vliwe9u"   ((function -2.0f -> true | _ -> false) (- 2.0f))
+//do test "vliwe9i"   ((function -2I -> true | _ -> false) (- 2I))
+//do test "vliwe9o"   ((function -2N -> true | _ -> false) (- 2N))
+
+module NegativePrecedence = begin
+    let x = 1
+    let R x = x
+    let R2 x y = x
+    let v1 = R 3
+    let v2 = -x
+    let v3 = R -x
+    let v3b = R2 -x -x
+    let v3c = R2 x -x
+    let v3d = R2 -(R x) -x
+    let v3e = R2 -(R -x) -x
+    let v4 = -R(3)
+    let v5 = -R (3)
+    let v6 = -R 3
+end
+
+module UnicodeChars = begin
+
+    let some_unicode_char = '\u00D6' 
+
+    let another_unicode_char = '\U000007FF'
+end
+
+
+
+module EscapeChars = begin
+    do test "cwjnecew90" ("\a" = "\007")
+    do test "cwjnecew91" ('\a' = '\007')
+    do test "cwjnecew91b" ('\a'B = '\007'B)
+    do test "cwjnecew92" ("\f" = "\012")
+    do test "cwjnecew93b" ('\f' = '\012')
+    do test "cwjnecew93" ('\f'B = '\012'B)
+    do test "cwjnecew94" ("\v" = "\011")
+    do test "cwjnecew95" ('\v' = '\011')
+    do test "cwjnecew95b" ('\v'B = '\011'B)
+end
+
+module NoParensNeededForHighPrecedenceTypeApplications = begin
+
+    let f x = x
+
+    let ty = f typeof<int>
+end
+
+module TypeArgsCanContainRightArrow = begin
+    let (f_ok : unit -> int) = Unchecked.defaultof<(unit->int)>
+    let (f : unit -> int) = Unchecked.defaultof<unit->int>
+    let (g : unit -> int) = if true then Unchecked.defaultof<unit->int> else fun() -> 0
+
+end
+
+module QuoteDotParsing = begin
+  let _ = <@ 1 @>.Raw 
+  let _ = <@@ 1 @@>.ToString() 
+end
+  
+module MappableNumericLiteralsG = begin
+    module NumericLiteralG =
+        let inline FromZero() =  LanguagePrimitives.GenericZero<_>
+        let inline FromOne() = LanguagePrimitives.GenericOne<_>
+    do test "Gvrer90a" (0G + 1G + 1G = 2)
+    do test "Gvrer90b" (0G + 1G + 1G = 2.0)
+    do test "Gvrer90c" (0G + 1G + 1G = 2.0f)
+    do test "Gvrer90d" (0G + 1G + 1G = 2uy)
+end
+module MappableNumericLiteralsN = begin
+
+    module NumericLiteralN =
+        let FromZero() =  0
+        let FromOne() = 1
+        let FromInt32(x:int32) =  x
+        let FromInt64(x:int64) =  int32 x
+        let FromString(s:string) =  -2
+
+    do test "Nvrer90e" (0N = 0)
+    do test "Nvrer90f" (1N = 1)
+    do test "Nvrer90g" (-1N = -1)
+    do test "Nvrer90h" (2N = 2)
+    do test "Nvrer90i" (2147483647N = System.Int32.MaxValue)
+    do test "Nvrer90j" (-2147483648N = System.Int32.MinValue)
+    do test "Nvrer90k" (2147483648N = int32 2147483648L)
+    do test "Nvrer90m" (-2147483649N = int32 -2147483649L)
+    do test "Nvrer90m" (9223372036854775807N = int32 9223372036854775807L)
+    do test "Nvrer90m" (-9223372036854775808N = int32 -9223372036854775808L)
+    do test "Nvrer90m" (9223372036854775808N = -2)
+    do test "Nvrer90m" (-9223372036854775809N = -2)
+    do test "Nvrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000N = -2)
+
+end
+
+module MappableNumericLiteralsNToString = begin
+
+    module NumericLiteralN =
+        let FromZero() =  "0"
+        let FromOne() = "1"
+        let FromInt32(x:int32) =  string x
+        let FromInt64(x:int64) =  string x
+        let FromString(s:string) =  s
+
+    do test "N2vrer90e" (0N = "0")
+    do test "N2vrer90f" (1N = "1")
+    do test "N2vrer90g" (-1N = "-1")
+    do test "N2vrer90h" (2N = "2")
+    do test "N2vrer90i" (2147483647N = "2147483647")
+    do test "N2vrer90j" (-2147483648N = "-2147483648")
+    do test "N2vrer90k" (2147483648N = "2147483648")
+    do test "N2vrer90m" (-2147483649N = "-2147483649")
+    do test "N2vrer90m" (9223372036854775807N = "9223372036854775807")
+    do test "N2vrer90m" (-9223372036854775808N = "-9223372036854775808")
+    do test "N2vrer90m" (9223372036854775808N = "9223372036854775808")
+    do test "N2vrer90m" (-9223372036854775809N = "-9223372036854775809")
+    do test "N2vrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000N = "10000000000000000000000000000000000000000000000000000000000000000000000")
+
+end
+
+module MappableNumericLiteralsZToString = begin
+
+    module NumericLiteralZ =
+        let FromZero() =  "0"
+        let FromOne() = "1"
+        let FromInt32(x:int32) =  string x
+        let FromInt64(x:int64) =  string x
+        let FromString(s:string) =  s
+
+    do test "Zvrer90e" (0Z = "0")
+    do test "Zvrer90f" (1Z = "1")
+    do test "Zvrer90g" (-1Z = "-1")
+    do test "Zvrer90h" (2Z = "2")
+    do test "Zvrer90i" (2147483647Z = "2147483647")
+    do test "Zvrer90j" (-2147483648Z = "-2147483648")
+    do test "Zvrer90k" (2147483648Z = "2147483648")
+    do test "Zvrer90m" (-2147483649Z = "-2147483649")
+    do test "Zvrer90m" (9223372036854775807Z = "9223372036854775807")
+    do test "Zvrer90m" (-9223372036854775808Z = "-9223372036854775808")
+    do test "Zvrer90m" (9223372036854775808Z = "9223372036854775808")
+    do test "Zvrer90m" (-9223372036854775809Z = "-9223372036854775809")
+    do test "Zvrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000Z = "10000000000000000000000000000000000000000000000000000000000000000000000")
+
+end
+
+module MappableNumericLiteralsQToString = begin
+
+    module NumericLiteralQ =
+        let FromZero() =  "0"
+        let FromOne() = "1"
+        let FromInt32(x:int32) =  string x
+        let FromInt64(x:int64) =  string x
+        let FromString(s:string) =  s
+
+    do test "Qvrer90e" (0Q = "0")
+    do test "Qvrer90f" (1Q = "1")
+    do test "Qvrer90g" (-1Q = "-1")
+    do test "Qvrer90h" (2Q = "2")
+    do test "Qvrer90i" (2147483647Q = "2147483647")
+    do test "Qvrer90j" (-2147483648Q = "-2147483648")
+    do test "Qvrer90k" (2147483648Q = "2147483648")
+    do test "Qvrer90m" (-2147483649Q = "-2147483649")
+    do test "Qvrer90m" (9223372036854775807Q = "9223372036854775807")
+    do test "Qvrer90m" (-9223372036854775808Q = "-9223372036854775808")
+    do test "Qvrer90m" (9223372036854775808Q = "9223372036854775808")
+    do test "Qvrer90m" (-9223372036854775809Q = "-9223372036854775809")
+    do test "Qvrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000Q = "10000000000000000000000000000000000000000000000000000000000000000000000")
+
+end
+
+module MappableNumericLiteralsRToString = begin
+
+    module NumericLiteralR =
+        let FromZero() =  "0"
+        let FromOne() = "1"
+        let FromInt32(x:int32) =  string x
+        let FromInt64(x:int64) =  string x
+        let FromString(s:string) =  s
+
+    do test "Rvrer90e" (0R = "0")
+    do test "Rvrer90f" (1R = "1")
+    do test "Rvrer90g" (-1R = "-1")
+    do test "Rvrer90h" (2R = "2")
+    do test "Rvrer90i" (2147483647R = "2147483647")
+    do test "Rvrer90j" (-2147483648R = "-2147483648")
+    do test "Rvrer90k" (2147483648R = "2147483648")
+    do test "Rvrer90m" (-2147483649R = "-2147483649")
+    do test "Rvrer90m" (9223372036854775807R = "9223372036854775807")
+    do test "Rvrer90m" (-9223372036854775808R = "-9223372036854775808")
+    do test "Rvrer90m" (9223372036854775808R = "9223372036854775808")
+    do test "Rvrer90m" (-9223372036854775809R = "-9223372036854775809")
+    do test "Rvrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000R = "10000000000000000000000000000000000000000000000000000000000000000000000")
+
+end
+
+module MappableNumericLiteralsIToString = begin
+
+    module NumericLiteralI =
+        let FromZero() =  "0"
+        let FromOne() = "1"
+        let FromInt32(x:int32) =  string x
+        let FromInt64(x:int64) =  string x
+        let FromString(s:string) =  s
+
+    do test "Ivrer90e" (0I = "0")
+    do test "Ivrer90f" (1I = "1")
+    do test "Ivrer90g" (-1I = "-1")
+    do test "Ivrer90h" (2I = "2")
+    do test "Ivrer90i" (2147483647I = "2147483647")
+    do test "Ivrer90j" (-2147483648I = "-2147483648")
+    do test "Ivrer90k" (2147483648I = "2147483648")
+    do test "Ivrer90m" (-2147483649I = "-2147483649")
+    do test "Ivrer90m" (9223372036854775807I = "9223372036854775807")
+    do test "Ivrer90m" (-9223372036854775808I = "-9223372036854775808")
+    do test "Ivrer90m" (9223372036854775808I = "9223372036854775808")
+    do test "Ivrer90m" (-9223372036854775809I = "-9223372036854775809")
+    do test "Ivrer90m" (10000000000000000000000000000000000000000000000000000000000000000000000I = "10000000000000000000000000000000000000000000000000000000000000000000000")
+
+end
+
+module OperatorNamesAddressOf = begin
+
+    let op_AddressOf (x:int) = string x
+    do test "vrnoe09" (&3 = "3")
+
+end
+
+module OperatorNamesIntegerAddressOf = begin
+
+    let op_IntegerAddressOf (x:int) = string x
+    do test "vrnoe09" (&&3 = "3")
+
+end
+    
+module OperatorBooleanAnd = begin
+
+    let op_BooleanAnd (x:string) (y:string) = string x + string y
+    do test "vrnoe09" ( ("3" && "4") =  "34")
+
+end
+    
+module OperatorBooleanOr = begin
+
+    let op_BooleanOr (x:string) (y:string) = string x + string y
+    do test "vrnoe09" ( ("3" || "4") =  "34")
+
+end
+
+
+module StartInCOmments = begin
+    //This works
+    (*
+    let a1 = ( * )
+    *)
+    let b1 = ()
+
+
+    //This should work
+    (*
+    let a3 = (*)
+    *)
+    let b3 = ()
+end
+
+
+module PrecedenceOfTypeOperators = begin
+    // Check :> operator has precedence lower than '|>'
+    let _ : obj  = ([1] |> List.map id) :> obj // this is how it should parse
+    let _ : obj = [1] |> List.map id :> obj
+    // Check :?> operator has precedence lower than '|>'
+    let _ : list<int> = ([1] |> box) :?> list<int>  // this is how it should parse
+    let _ : list<int> = [1] |> box :?> list<int>   // this is the real test
+    let _ : list<int> = [1] |> box :?> int list  // this is the real test
+
+    // Check :> operator has LEFT precedence 
+    let _ : obj  = (([1] |> List.map id) :> System.IComparable) :> obj // this is how it should parse
+    let _ : obj = [1] |> List.map id :> System.IComparable :> obj  // this is the real test
+
+
+    // Check :?> operator has LEFT precedence 
+    let _ : list<int> = ([1] |> box) :?> System.IComparable :?> list<int>  // this is how it should parse
+    let _ : list<int> = [1] |> box :?> System.IComparable :?> list<int>  // this is the real test
+    let _ : list<int> = [1] |> box :?> System.IComparable :?> int list  // this is the real test
+
+    // Check :> operator has precedence greater than ','
+    let _, _ = (([1] |> List.map id) :> obj), (([1] |> List.map id) :> obj) // this is how it should parse
+    let _, _ = [1] |> List.map id :> obj, [1] |> List.map id :> obj  // this is the real test
+    // Check :?> operator has precedence greater than ','
+    let _, _ = (([1] |> box) :?> list<int>), (([1] |> box) :?> list<int>) // this is how it should parse
+    let _, _ = [1] |> box :?> list<int>, [1] |> box :?> list<int>  // this is the real test
+
+
+    // Check :? operator has precedence lower than '++'
+    let _ = 
+       let (++) a b = box (List.length (a @ b))
+       let (_ : bool)  = ([1] ++ [1]) :? int  // this is how it should parse
+       let (_ : bool)  = [1] ++ [1] :? int  // this is the real test
+       1
+
+    // Check :? operator has precedence greater than '|>'
+    let _ = 
+       let (|>) a b = (a,b)
+       let b1 = box 1
+       let (_ : int list), (_ : bool) = [1] |> (b1 :? int) // this is how it should parse
+       let (_ : int list), (_ : bool) = [1] |> b1 :? int  // this is the real test
+       1
+
+
+
+end
+
+
+module MultiLineTypeParameterTests = 
+
+    type C<'T,
+           'U>() = 
+         static let x =  1
+
+    type C2<[<System.CLSCompliantAttribute(true)>] 'T,
+            [<System.CLSCompliantAttribute(true)>] 'U>() = 
+         static let x =  1
+
+    type C3<[<System.CLSCompliantAttribute(true)>] 'T,
+               [<System.CLSCompliantAttribute(true)>] 'U>() = 
+         static let x =  1
+
+    type C4<[<System.CLSCompliantAttribute(true)>] 'T1,
+            [<System.CLSCompliantAttribute(true)>] 'T2,
+            [<System.CLSCompliantAttribute(true)>] 'T3,
+            [<System.CLSCompliantAttribute(true)>] 'T4,
+            [<System.CLSCompliantAttribute(true)>] 'T5,
+               [<System.CLSCompliantAttribute(true)>] 'U>() = 
+         static let x =  1
+
+    type C5<[<System.CLSCompliantAttribute(true)>] 'T1,
+              [<System.CLSCompliantAttribute(true)>] 'T2,
+                [<System.CLSCompliantAttribute(true)>] 'T3,
+                  [<System.CLSCompliantAttribute(true)>] 'T4,
+                      [<System.CLSCompliantAttribute(true)>] 'T5,
+                      [<System.CLSCompliantAttribute(true)>] 'U>() = 
+         static let x =  1
+
+module AdhocIndentationTests = 
+
+    let fffffffffffffffff x = 3
+    let mutable z = 3
+    let f0 = 
+        z <- fffffffffffffffff (3,
+                         3
+                      )
+
+    let f1() = 
+         fffffffffffffffff (false &&
+           true && 
+           false)
+
+    let f2() = 
+         fffffffffffffffff (
+           printf "hello"
+           printf "hello"
+           printf "hello"
+           true)
+
+
+
+module TypeApplicationDisambiguation = 
+    let (||) a b = 1 // this gives a warning - ignore
+    let (&&) a b = 1 // this gives a warning - ignore
+    let (<) a b = 1 // this gives a warning - ignore
+    let (>) a b = 1 // this gives a warning - ignore
+    let (@) a b = 1
+    let (@@) a b = 1
+    let (^^) a b = 1
+    let ( ** ) a b = 1
+    let ( *** ) a b = 1
+    let ( % ) a b = 1
+    let ( %%% ) a b = 1
+    let ( <<< ) a b = 1
+    let ( >>> ) a b = 1
+    let ( &&& ) a b = 1
+    let ( => ) a b = 1
+    let ( ? ) a b = 1
+    
+    let f0 x = id<int> // this is considered a type application
+    
+    // Check that the following expressions are NOT considered type applications
+    let f1 x = x<x ||| x>x
+    let f2 x = x<x &&& x>x
+    let f3 x = x<x @ x>x
+    let f3b x = x<x @@ x>x
+    let f4 x = x<x ^^ x>x
+ //   let f5 x = x<x = x>x
+    let f6 x = x<x ** x>x
+    let f7 x = x<x *** x>x
+    let f8 x = x<x % x>x
+    let f9 x = x<x %%% x>x
+    let f10 x = x<x <<< x>x
+    let f13 x = x<x ? x, x>x
+    let f14 x = x<x &&& x>x
+    let f16 x = x<x => x>x
+    let f17 x = x<x || x>x
+    let f18 x = x<x && x>x
+    // We explicitly DO consider these to be type applications 
+    //      f<x >>> x>x
+    //      f<int>x
+    //      f<x * x>x
+    //      f<x , x>x
+    //      f<x ^ x>x
+    //      f<x ^- x>x
+    //      f<x / x>x
+    //      f<x -> x>x
+    //      f<x # x>x
+    //      f<x ' x>x
+
+module MultiLineWhenInPatternMatchSyntaxTests = 
+    let test1 x =
+        match x with
+        | _ when true &&
+                 false -> 
+                 let x = 1 
+                 x
+
+
+    let test2 x =
+        match x with
+        | _ when true &&
+                 false ->    
+         let x = 1 
+         x
+
+
+
+    let test3 x =
+        match x with
+        | _ when true &&
+                 false ->    
+                    1
+        | _ when (false &&
+                  true) ->   
+             0
+        | _ -> failwith "Shouldn't get here."
+
+     
+    type IntType = Negative | Zero | Positive
+
+    let test x =
+        match x with
+        | _ when x = 0 -> 
+         Zero
+        | _ when x < 0 &&
+                 x < 0 -> 
+         Negative
+        | _ when (x > 0 &&
+                  x > 0) ->
+             Positive
+        | _ -> failwith "Shouldn't get here."
+
+
+module PostiveWithWithoutSemicolonTests =
+
+    type r = { a : int; b : int } 
+    let r = { a = 1; b = 2 }
+
+    let v1 = { r with a = 1
+                      b = 3 } 
+                     
+    let v1b = { r with 
+                    a = 1
+                    b = 3 } 
+                     
+                     
+                     
+    let v2 = { r with a = 
+                        let x = 1
+                        x + x;
+                      } 
+    let v3 = {v1 with a=30
+                      r.b=40}
+
+    let v4 = {v1 with r.a=30
+                      b=0}
+
+
+module LeftAssignmentWithStructuredRightHandSide =
+
+    let mutable x = 1
+
+    let f1() = 
+      x <- 
+          let y = 1
+          y + y
+
+      x <- let y = 1
+           y + y
+
+
+      x <- while false do
+             ()
+           1 + 1
+
+      x <- try 
+             3
+           with _ -> 2
+
+      x <- try 
+             3
+           finally 
+             ()
+
+      x <- use x = { new System.IDisposable with member __.Dispose() = () }
+           3
+
+      x <- if true then () else ()
+           4
+
+      x <- 
+          printfn "hello"
+          2 + 2
+
+module RecordExpressionsWithStructuredRightHandSide =
+    let f3a() = 
+      { contents = 
+          printfn "hello"
+          1 + 1 }
+
+    let f3b() = 
+      { contents = let y = 1
+                   y + y }
+
+    let f3c() = 
+      { contents = while false do
+                     ()
+                   1 + 1 }
+
+    let f3d() = 
+      { contents = try 
+                     3
+                   with _ -> 
+                     2 }
+
+    let f3e() = 
+      { contents = try 
+                     3
+                   finally () }
+
+    let f3f() = 
+      { contents = use x = { new System.IDisposable with member __.Dispose() = () }
+                   3 }
+
+    let f3g() = 
+      { contents = if true then () else ()
+                   3 }
+
+module RecordExpressionsWithStructuredRightHandSide2 =
+
+    type r = { contents : int; name : string }
+    let f3a() = 
+      { name = "1" 
+        contents = 
+          printfn "hello"
+          1 + 1 }
+
+    let f3b() = 
+      { name = "1" 
+        contents = let y = 1
+                   y + y }
+
+    let f3c() = 
+      { name = "1" 
+        contents = while false do
+                     ()
+                   1 + 1 }
+
+    let f3d() = 
+      { name = "1" 
+        contents = try 
+                     3
+                   with _ -> 
+                     2 }
+
+    let f3e() = 
+      { name = "1" 
+        contents = try 
+                     3
+                   finally () }
+
+    let f3f() = 
+      { name = "1" 
+        contents = use x = { new System.IDisposable with member __.Dispose() = () }
+                   3 }
+
+    let f3g() = 
+      { name = "1" 
+        contents = if true then () else ()
+                   3 }
+
+module RecordExpressionsWithStructuredRightHandSide3 =
+
+    type r = { contents : int; name : string }
+    let f3a() = 
+      { contents = 
+          printfn "hello"
+          1 + 1
+        name = "1" }
+
+    let f3b() = 
+      { contents = let y = 1
+                   y + y
+        name = "1" }
+
+    let f3c() = 
+      { contents = while false do
+                     ()
+                   1 + 1 
+        name = "1"}
+
+    let f3d() = 
+      { contents = try 
+                     3
+                   with _ -> 
+                     2
+        name = "1" }
+
+    let f3e() = 
+      { contents = try 
+                     3
+                   finally ()
+        name = "1" }
+
+    let f3f() = 
+      { contents = use x = { new System.IDisposable with member __.Dispose() = () }
+                   3
+        name = "1" }
+
+    let f3g() = 
+      { contents = if true then () else ()
+                   3 
+        name = "1" }
+  
+module ActualReproAndVariations = 
+     // problem?? See feat binding...
+
+    type fields = { docId  : int64;
+                    rating : int;
+                    qid:     int;
+                    feat:    float[];
+                  }
+
+    let mkFields1 (cols:string[]) =
+      {
+        docId  = cols.[0] |> int64;
+        rating = cols.[1] |> int32;
+        qid    = cols.[2] |> int32;
+        feat   = let arr = Array.create 25 0.0
+                 for i = 0 to 25 do
+                   arr.[i] <- (cols.[i+3] |> float)
+                 arr                          
+      }
+
+    let mkFields2 (cols:string[]) =
+      {
+        docId  = cols.[0] |> int64;
+        rating = cols.[1] |> int32;
+        feat   = let arr = Array.create 25 0.0
+                 for i = 0 to 25 do
+                   arr.[i] <- (cols.[i+3] |> float)
+                 arr                          
+        qid    = cols.[2] |> int32;
+      }
+
+    let mkFields3 (cols:string[]) =
+      {
+        docId  = cols.[0] |> int64;
+        rating = cols.[1] |> int32;
+        feat   = 
+           let arr = Array.create 25 0.0
+           for i = 0 to 25 do
+             arr.[i] <- (cols.[i+3] |> float)
+           arr                          
+        qid    = cols.[2] |> int32;
+      }
+
+    let mkFields4 (cols:string[]) =
+      {
+        docId  = 
+          cols.[0] 
+          |> int64;
+        rating = 
+          cols.[1] 
+          |> int32;
+        feat   
+         = 
+           let arr = Array.create 25 0.0
+           for i = 0 to 25 do
+             arr.[i] <- (cols.[i+3] |> float)
+           arr                          
+        qid    = 
+          cols.[2] 
+          |> int32;
+      }
+
+module MiscRecordTEsts = 
+    let _ = 
+        { contents = 
+            printfn "hello"
+            1 + 1 }
+
+    let rrrrrr = ref 1
+    let _ = 
+        { rrrrrr with 
+           contents = 
+            let x = 1
+            x + x }
+
+module AdHocTests = 
+    let f4() = 
+      { contents = fun _ ->
+          printfn "hello"
+          1 + 1 }
+
+
+    let f6() = 
+        let fffffffffffffffffffffffff x = x
+        let g1 () = fffffffffffffffffffffffff (
+                     3)
+        let g1 () = async { 
+            let x = 2 + 1
+            return x
+        }
+        ()
+        
+    let f7() = 
+        let r1 = ref 1
+        { r1 with contents = match 1 with 1 -> 2 | _ -> 3 }
+
+
+
+    let f9 = function
+      | [] -> 0
+      | _ -> 1 
+    let f10() = 
+        let y = ref 0
+        y :=
+            let (b, _, _) = (1,2,3)
+            b      
+
+    let f12() = 
+        let y = 0
+        y ::
+            let (b, _, _) = (1,2,3)
+            [b]      
+
+    let f12b() = 
+        let y = ref [0]
+        y := 
+            1 ::
+                let (b, _, _) = (1,2,3)
+                [b]      
+
+    let f13() = 
+        let y = ref [0]
+        y := 
+            1 ::
+             let (b, _, _) = (1,2,3)
+             [b]      
+
+    let f14() = 
+        let y = ref [0]
+        y := 
+         1 ::
+          let (b, _, _) = (1,2,3)
+          [b]      
+    
+    let f15() = 
+        let y = ref [0]
+        y 
+         := 
+           1 ::
+            let (b, _, _) = (1,2,3)
+            [b]      
+
+    let f16() = 
+        let y = ref [0]
+        y 
+         := 
+           1 
+            ::
+              let (b, _, _) = (1,2,3)
+              [b]      
+    
+let _ = stdout.WriteLine "Test FInishing"
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+  else (stdout.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok","ok"); 
+        exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/tdirs b/tests/fsharp/core/tdirs
new file mode 100644
index 0000000..11e3c1d
--- /dev/null
+++ b/tests/fsharp/core/tdirs
@@ -0,0 +1,64 @@
+access
+apporder
+array
+attributes
+comprehensions
+control
+controlChamenos
+controlMailbox
+controlStackOverflow
+controlWebExt
+controlWpf
+csext
+csfromfs
+events
+forwarders
+fsfromcs
+fsfromfsviacs
+fsiAndModifiers
+fsi-reload
+genericmeasures
+hiding
+innerpoly
+int32
+internalsvisible
+lazy
+letrec
+libtest
+lift
+load-script
+longnames
+map
+math
+measures
+members
+mscorlib
+namespaces
+nested
+netcore
+parsing
+patterns
+pinvoke
+portable
+printf
+printing
+queriesCustomQueryOps
+queriesLeafExpressionConvert
+queriesNullableOperators
+queriesOverIEnumerable
+queriesOverIQueryable
+queriesOverIQueryableLinqToEntities
+queriesOverIQueryableLinqToSql
+queriesOverOData
+quotes
+quotesDebugInfo
+quotesInMultipleModules
+reflect
+resources
+seq
+subtype
+syntax
+tlr
+topinit
+unicode
+verify
\ No newline at end of file
diff --git a/tests/fsharp/core/tlr/build.bat b/tests/fsharp/core/tlr/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/core/tlr/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/tlr/run.bat b/tests/fsharp/core/tlr/run.bat
new file mode 100644
index 0000000..7b0b526
--- /dev/null
+++ b/tests/fsharp/core/tlr/run.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/tlr/test.fsx b/tests/fsharp/core/tlr/test.fsx
new file mode 100644
index 0000000..5d21f1f
--- /dev/null
+++ b/tests/fsharp/core/tlr/test.fsx
@@ -0,0 +1,400 @@
+// #Conformance #Regression #Recursion #LetBindings 
+(*----------------------------------------------------------------------------
+CONTENTS-START-LINE: HERE=1 SEP=2
+ 23.    tlr constants
+ 58.    tlr lambdas
+ 97.    tlr polymorphic constants?
+ 111.   env tests
+ 138.   mixed recursion (inner recursing with outer)
+ 188.   arity 0 tests
+ 211.   value recursion
+ 252.   inner constant
+ 264.   lifting tests
+ 335.   lifting
+ 348.   wrap up
+CONTENTS-END-LINE:
+----------------------------------------------------------------------------*)
+#if Portable
+module Core_tlr
+#endif
+let failures = ref false
+let report_failure s  = 
+  stderr.WriteLine ("NO: test "+s+" failed"); failures := true
+
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+(*-------------------------------------------------------------------------
+ *INDEX: tlr constants
+ *-------------------------------------------------------------------------*)
+
+(* mainly compile tests *)
+
+module CompilationTests = begin 
+    let (+)   x y = (x:int)+y
+    let (-)   x y = (x:int)-y    
+    let ( * ) x y = (x:int)*y    
+
+    (* test cases for TLR code *)
+    let consume x = x
+    let (|>) x f = f x    
+
+    (* not TLR - constant - trivial expr *)  
+    let notSinceTrival1 = 1
+    let notSinceTrival2 = 1.2
+    let notSinceTrival3 = true
+
+    (* TLR constants - non-trivial (e.g. allocating) *)
+    type ('a,'b) xy = {x:'a;y:'b}    
+    let tlrValList   = [1;2;3;4]  
+    let tlrValTuple  = (1,2,3,4)
+    let tlrValRecord = {x=1;y=2}
+
+    (* TLR constants - transitively *)
+    let tlrValTransitiveList   = [ tlrValList; tlrValList ]
+    let tlrValTransitiveTuple  = ("transitively a TLR constant",tlrValList)
+    let tlrValTransitiveRecord = { x = "transitively a TLR constant"; y = tlrValList}
+
+    (* TLR constants - polymorphic *)
+    type 'a node = INT of int | ALPHA of 'a
+    (*let tlrValPolymorphic : 'a node = INT 4*)
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: tlr lambdas
+     *-------------------------------------------------------------------------*)
+
+    let tlrLambdaTests () =
+      (* TLR lambdas? - non rec *)  
+      let     tlrNonRecAppliedAll3Args (x:int) (y:int) (z:int) = x+y+z
+      in
+      let _ = tlrNonRecAppliedAll3Args 1 2 3
+      in
+        
+      let     tlrNonRecApplied2of3Args (x:int) (y:int) (z:int) = x+y+z
+      in
+      let _ = tlrNonRecApplied2of3Args 1 2
+      in
+
+      let     rejectNonRecApplied0of3Args (x:int) (y:int) (z:int) = x+y+z
+      in
+      let _ = rejectNonRecApplied0of3Args
+      in
+
+      (* TLR lambdas? - rec *)
+      let rec tlrRecAppliedAll3Args (x:bool) (y:int) (z:int) = if x then tlrRecAppliedAll3Args false y z else y+z
+      in
+      let _ = tlrRecAppliedAll3Args true 2 3
+      in
+
+      let rec tlrRecApplied2of3Args (x:bool) (y:int) (z:int) = if x then let f = tlrRecApplied2of3Args false y in f z else y+z
+      in
+      let _ = tlrRecApplied2of3Args true 2
+      in
+
+      let rec rejectRecApplied0of3Args (x:bool) (y:int) (z:int) = if x then let f = rejectRecApplied0of3Args in f false y z else y+z
+      in
+      let _ = rejectRecApplied0of3Args
+      in
+      ()
+
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: tlr polymorphic constants?
+     *-------------------------------------------------------------------------*)    
+
+    (* Concerned about polymorphic constants. Arity 0, but infact type-functions. *)
+    let enclosing1 (a:int) =
+      let tlrInnerFreePolymorphicConstant = None in
+      if  tlrInnerFreePolymorphicConstant = None then 0 else 1
+
+    let enclosing2 (a:'a) =
+      let tlrInnerPolymorphicConstant = (None : 'a option) in
+      if  tlrInnerPolymorphicConstant = None then 0 else 1
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: env tests
+     *-------------------------------------------------------------------------*)    
+        
+    (* env tests *)
+
+    let xC = 1,2,3
+    let yC = 3,2,1
+
+    let envTestFreesUnitArg ()      = xC,yC
+    let envTestFreesNArg    (n:int) = xC,yC,n
+    let uses            = envTestFreesUnitArg (),envTestFreesNArg 1
+
+    let dependent1 id (xa:'alpha) =
+      let envTestFreesUnitArgOpen ()      = id xC,yC   in
+      let envTestFreesNArgOpen    (n:int) = id xC,yC,n in
+      let envPolymorphicSelf arg = if arg=xa then 1 else 2 in  (* has freetypars *)
+      let envPolymorphicViaCall () = envPolymorphicSelf xa in  (* the envPolymorphicSelf call will contribute typar to closure *)
+      let uses =
+        envTestFreesUnitArgOpen (),
+        envTestFreesNArgOpen 1,
+        envPolymorphicSelf xa,
+        envPolymorphicViaCall ()
+      in
+      12
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: mixed recursion (inner recursing with outer)
+     *-------------------------------------------------------------------------*)    
+
+    (* test closure determination for inner functions recursing with outer functions *)
+    let mixedRecursionTest (z:int) =
+      (* What are the env closures?
+       *   env(g2) = {x2,z} and envForDirectCallTo(g1)
+       *   env(g1) = {z}
+       * Note,
+       *   env(g1) does not require the envForDirectCallTo(g2) since
+       *   g2 is defined inside g1, and it's actual env will be defined at that binding point,
+       *   so at any direct calls to g2, it's actual env will be available.
+       * In general,
+       *   Where-ever "h" is available to be called (for h chosen TLR),
+       *   Then the actual-environment needed to pass to "h" will be available.
+       *------
+       * SUMMARY:
+       * For g1 being made TLR, require sub-envs for direct calls only to the freevars of the g1 defn.
+       *)
+      let rec mixed_g1 (x1:int) (x2:int) =
+        let rec mixed_g2 (y2:int) = let r1,r2 = mixed_g1 x2 y2 in
+                                    r1 + mixed_g2 z in
+        let res1 = mixed_g2 (x1+x2) in
+        let res2 = mixed_g2         in
+        res1,res2
+      in
+      mixed_g1 1 2
+
+    (* test:
+     * inner definition (g2) has direct call to g,
+     * so etps(g2) must include etps(g),
+     * but etps(g) are still being determined,
+     * because later includesBeta causes beta to be included in etps(g),
+     * since it follows from the etps(freeBeta).
+     *)
+    let innerOuterCallBeforeETpsKnown (xx1:'alpha) (y:'beta) =
+       let freeBeta() = let (uses:'beta) = y in ()
+       in
+       let rec innerOuter_g (x1:'alpha) =
+         let innerOuter_g2 (x2:'alpha2) =
+           innerOuter_g x1                     (* direct call to g, so etps(g2) need etps(g) *)
+         in 
+         let (includesBeta:unit) = freeBeta () (* direct call, etps(g) includes etps(freeBeta) = {beta} *)
+         in
+         (innerOuter_g2 12 : int)
+       in
+       innerOuter_g 
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: arity 0 tests
+     *-------------------------------------------------------------------------*)    
+
+    (* concerned about arity 0 test cases, esp if they have a type closure *)
+    let arityZeroTests (xalpha:'alpha) (xbeta:'beta) =
+      let arityZeroMono      = (1,2,true) in
+      let arityZeroAlpha     = (1,2,(None : 'alpha option)) in
+      let arityZeroAlphaBeta = (1,2,(None : 'alpha option),(None : 'beta option)) in
+      arityZeroMono,arityZeroAlpha,arityZeroAlphaBeta
+
+    (* free occurance, but at a type instance *)
+    let freeOccuranceAtInstaceTest (u:unit) (b:'beta) =
+      let freeOccuranceTestPolyFun (x:'alpha) = x in 
+      let useAtInt      = freeOccuranceTestPolyFun 3 in
+      let useAtIntList  = freeOccuranceTestPolyFun [3] in
+      let useAtBool     = freeOccuranceTestPolyFun true in
+      let instAtInt     = (freeOccuranceTestPolyFun : int -> int) in
+      let instAtIntList = (freeOccuranceTestPolyFun : int list -> int list) in
+      let instAtBeta    = (freeOccuranceTestPolyFun : 'beta -> 'beta) in
+      ()
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: value recursion
+     *-------------------------------------------------------------------------*)    
+
+    (* Hit problems in letrec's with value recursions,
+       because packing a recursive value into an environment failed,
+       since uses to valrecs are requried to be delayed.
+
+       Solutions?
+       (a) skip TLR if fclass has a valrec? (they are not common case)
+       (b) if a valrec item needs to be carried for a closure,
+           use it directly (no packing) carried by itself,
+           so avoiding rebinding it into the environment.
+     *)
+
+    type func = {f:(bool -> int)}
+
+    let inner1 () =
+      let rec nextFun = {f=(fun x -> if x then 0 else next x)}
+      and next x = nextFun.f x
+      in
+      ()
+
+    let inner2 () =
+      let rec nextFun next = {f=(fun x -> if x then 0 else next x)}
+      and next x = (nextFun next).f x
+      in
+      ()
+
+    let inner3 () =
+      let rec env = (*pack*) next
+      and nextFun env = let next = (*unpack*) env in
+                        {f=(fun x -> if x then 0 else next x)}
+      and next x = (nextFun env).f x
+      in
+      ()
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: inner constant
+     *-------------------------------------------------------------------------*)    
+
+    (* Creates cctor if needed *)
+    let innerConst () =
+      let localconst = ("cctor",0) in 
+      let capture tag = if tag then localconst else "a3",3
+      in
+      capture true
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: lifting tests
+     *-------------------------------------------------------------------------*)    
+        
+
+    (* Test cases for explicit lifting of inner TLR bindings to top-level *)
+    let add (x:int) (y:int) = (x+y:int)
+
+    (* lifting over a lambda *)  
+    let liftOverLambda =
+      fun (x:int) ->
+        let liftOverLambdaExpectConst  = Some (1,2,3,4) in    
+        let liftOverLambdaExpectFunc y = add x y,liftOverLambdaExpectConst in
+        let res =
+          liftOverLambdaExpectConst,
+          liftOverLambdaExpectFunc 1
+        in
+        res
+
+    (* lifting over a tlambda *)
+    let overTLambda (* forall a' *) () =
+      let xJustAnIntNotExpectedToBeTLR = 12 in
+      let x = xJustAnIntNotExpectedToBeTLR in
+      let overTLambda_ExpectConst  = Some (5,6) in    
+      let overTLambda_ExpectFunc y = add y x,overTLambda_ExpectConst in
+      let res =
+        overTLambda_ExpectConst,
+        overTLambda_ExpectFunc 3
+      in
+        ((raise (Failure "alpha return type")) : 'alpha)
+
+    (* lifting over letrec *)
+    let overLetrec (b:bool) = 
+      let rec overLetrec_f1 x = overLetrec_f2 x
+      and overLetrec_f2 x = overLetrec_f3 x
+      and overLetrec_f3 x = 
+          let overLetrec_expectConst = (7,8) in
+          let overLetrec_expectFunc a = add a x,overLetrec_expectConst in
+            overLetrec_expectConst,overLetrec_expectFunc x
+          in
+        overLetrec_f1 9
+
+    (* lifting over let *)
+    let overLet (b:bool) = 
+      let overlet_x1 = 11 in
+      let overlet_x2 = let overLet_expectConst2 = (2,2,2) in
+                       12 in
+      let overlet_x3 = 13 in
+      let overlet_x4 = 14 in
+      let overLet_expectFunc a = add a (overlet_x1)
+      in
+        overlet_x2,overlet_x1
+          
+
+    (* let test *)
+    let letTest2 =
+      let a = 1 in
+      let b = 2 in
+      (* swap *)
+      let a = b in
+      let b = a in
+      a,b (* expect 2,1 *)
+
+    let letTest3 =
+      let rec v = fun n -> 1 + w (n-1) 
+      and w = fun n -> if n=0 then 0 else v (n-1)
+      in
+      v,w
+
+
+    (*-------------------------------------------------------------------------
+     *INDEX: lifting
+     *-------------------------------------------------------------------------*)
+
+    let _ =
+      fun x -> let liftOverTopLambda = [(1,2,3)] in 12
+
+    let _ =
+      match [] with
+          []    -> let liftOverNilMatchNil  = [902] in 12
+        | x::xs -> let liftOverNilMatchCons = [x]   in 12
+end
+
+
+module MiscDetupleTestFromAndyRay = begin
+
+  type LutInitAst =
+   | LutInput of int
+   | LutAnd of LutInitAst * LutInitAst
+
+  let i0, i1 = LutInput(0), LutInput(1)
+
+  let rec eval n (s : LutInitAst) =
+    match s with
+    | LutInput(a) -> ((n >>> a) &&& 1)
+    | LutAnd(a,b) -> (eval n a) &&& (eval n b)
+
+  let eval_lut lut_n (ops : LutInitAst) =
+    let rec eval_n n : string =
+      if n = (1 <<< lut_n) then ""
+      else (eval_n (n + 1)) + (if (eval n ops) = 1 then "1" else "0")
+    in
+    eval_n 0
+
+  let test() =
+      let g = eval_lut 2 (LutAnd (i0,i1)) in
+      printf "%s\n" g
+
+  do test()
+end
+
+
+(*-------------------------------------------------------------------------
+ *INDEX: wrap up
+ *-------------------------------------------------------------------------*)    
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/topinit/app69514.fs b/tests/fsharp/core/topinit/app69514.fs
new file mode 100644
index 0000000..9b81db4
--- /dev/null
+++ b/tests/fsharp/core/topinit/app69514.fs
@@ -0,0 +1,5 @@
+
+module X
+let v = global.Lib.File1.discState.Second
+
+let v2 = global.Lib.File2.discState.Rep
diff --git a/tests/fsharp/core/topinit/build.bat b/tests/fsharp/core/topinit/build.bat
new file mode 100644
index 0000000..1932821
--- /dev/null
+++ b/tests/fsharp/core/topinit/build.bat
@@ -0,0 +1,195 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+"%FSC%" %fsc_flags% --optimize -o both69514.exe -g lib69514.fs app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" both69514.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize- -o both69514-noopt.exe -g lib69514.fs app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" both69514-noopt.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize -a -g lib69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib69514.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -r:lib69514.dll -g app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" app69514.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize- -o:lib69514-noopt.dll -a -g lib69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib69514-noopt.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize- -r:lib69514-noopt.dll -o:app69514-noopt.exe -g app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" app69514-noopt.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+
+"%FSC%" %fsc_flags% --optimize- -o:lib69514-noopt-withsig.dll -a -g lib69514.fsi lib69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib69514-noopt-withsig.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize- -r:lib69514-noopt-withsig.dll -o:app69514-noopt-withsig.exe -g app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" app69514-noopt-withsig.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -o:lib69514-withsig.dll -a -g lib69514.fsi lib69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib69514-withsig.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:lib69514-withsig.dll -o:app69514-withsig.exe -g app69514.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" app69514-withsig.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -o:lib.dll -a -g lib.ml
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib.dll
+ at if ERRORLEVEL 1 goto Error
+
+%CSC% /nologo /r:"%FSCOREDLLPATH%" /r:lib.dll /out:test.exe test.cs 
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -o:lib--optimize.dll -a -g lib.ml
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" lib--optimize.dll
+ at if ERRORLEVEL 1 goto Error
+
+%CSC% /nologo /r:"%FSCOREDLLPATH%" /r:lib--optimize.dll /out:test--optimize.exe test.cs 
+if ERRORLEVEL 1 goto Error
+
+set dicases= flag_deterministic_init1.fs lib_deterministic_init1.fs flag_deterministic_init2.fs lib_deterministic_init2.fs flag_deterministic_init3.fs lib_deterministic_init3.fs flag_deterministic_init4.fs lib_deterministic_init4.fs flag_deterministic_init5.fs lib_deterministic_init5.fs flag_deterministic_init6.fs lib_deterministic_init6.fs flag_deterministic_init7.fs lib_deterministic_init7.fs flag_deterministic_init8.fs lib_deterministic_init8.fs flag_deterministic_init9.fs lib_determi [...]
+
+"%FSC%" %fsc_flags% --optimize- -o test_deterministic_init.exe %dicases% test_deterministic_init.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -o test_deterministic_init--optimize.exe %dicases% test_deterministic_init.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init--optimize.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize- -a -o test_deterministic_init_lib.dll %dicases% 
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init_lib.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize- -r test_deterministic_init_lib.dll -o test_deterministic_init_exe.exe test_deterministic_init.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init_exe.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -a -o test_deterministic_init_lib--optimize.dll %dicases% 
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init_lib--optimize.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -r test_deterministic_init_lib--optimize.dll -o test_deterministic_init_exe--optimize.exe test_deterministic_init.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_deterministic_init_exe--optimize.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+
+set static_init_cases= test0.fs test1.fs test2.fs test3.fs test4.fs test5.fs test6.fs
+
+"%FSC%" %fsc_flags% --optimize- -o test_static_init.exe %static_init_cases% static-main.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -o test_static_init--optimize.exe %static_init_cases% static-main.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init--optimize.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize- -a -o test_static_init_lib.dll %static_init_cases% 
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init_lib.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize- -r test_static_init_lib.dll -o test_static_init_exe.exe static-main.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init_exe.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -a -o test_static_init_lib--optimize.dll %static_init_cases% 
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init_lib--optimize.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -r test_static_init_lib--optimize.dll -o test_static_init_exe--optimize.exe static-main.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test_static_init_exe--optimize.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init1.fs b/tests/fsharp/core/topinit/flag_deterministic_init1.fs
new file mode 100644
index 0000000..06912ea
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init1.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag1
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init10.fs b/tests/fsharp/core/topinit/flag_deterministic_init10.fs
new file mode 100644
index 0000000..9925eee
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init10.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag10
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init11.fs b/tests/fsharp/core/topinit/flag_deterministic_init11.fs
new file mode 100644
index 0000000..2ee8c50
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init11.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag11
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init12.fs b/tests/fsharp/core/topinit/flag_deterministic_init12.fs
new file mode 100644
index 0000000..026f6a5
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init12.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag12
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init13.fs b/tests/fsharp/core/topinit/flag_deterministic_init13.fs
new file mode 100644
index 0000000..1a9e0cf
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init13.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag13
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init14.fs b/tests/fsharp/core/topinit/flag_deterministic_init14.fs
new file mode 100644
index 0000000..ca4810d
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init14.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag14
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init15.fs b/tests/fsharp/core/topinit/flag_deterministic_init15.fs
new file mode 100644
index 0000000..997ad76
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init15.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag15
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init16.fs b/tests/fsharp/core/topinit/flag_deterministic_init16.fs
new file mode 100644
index 0000000..bdc37f6
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init16.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag16
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init17.fs b/tests/fsharp/core/topinit/flag_deterministic_init17.fs
new file mode 100644
index 0000000..e33b823
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init17.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag17
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init18.fs b/tests/fsharp/core/topinit/flag_deterministic_init18.fs
new file mode 100644
index 0000000..98d5002
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init18.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag18
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init19.fs b/tests/fsharp/core/topinit/flag_deterministic_init19.fs
new file mode 100644
index 0000000..31c1a20
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init19.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag19
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init2.fs b/tests/fsharp/core/topinit/flag_deterministic_init2.fs
new file mode 100644
index 0000000..c14d69e
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init2.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag2
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init20.fs b/tests/fsharp/core/topinit/flag_deterministic_init20.fs
new file mode 100644
index 0000000..2a728bd
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init20.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag20
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init21.fs b/tests/fsharp/core/topinit/flag_deterministic_init21.fs
new file mode 100644
index 0000000..f6d3fb6
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init21.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag21
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init22.fs b/tests/fsharp/core/topinit/flag_deterministic_init22.fs
new file mode 100644
index 0000000..1ee8385
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init22.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag22
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init23.fs b/tests/fsharp/core/topinit/flag_deterministic_init23.fs
new file mode 100644
index 0000000..15972ab
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init23.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag23
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init24.fs b/tests/fsharp/core/topinit/flag_deterministic_init24.fs
new file mode 100644
index 0000000..9f2085c
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init24.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag24
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init25.fs b/tests/fsharp/core/topinit/flag_deterministic_init25.fs
new file mode 100644
index 0000000..7df34cf
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init25.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag25
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init26.fs b/tests/fsharp/core/topinit/flag_deterministic_init26.fs
new file mode 100644
index 0000000..fabf989
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init26.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag26
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init27.fs b/tests/fsharp/core/topinit/flag_deterministic_init27.fs
new file mode 100644
index 0000000..bcadda8
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init27.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag27
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init28.fs b/tests/fsharp/core/topinit/flag_deterministic_init28.fs
new file mode 100644
index 0000000..7abc0dc
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init28.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag28
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init29.fs b/tests/fsharp/core/topinit/flag_deterministic_init29.fs
new file mode 100644
index 0000000..56ae7d5
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init29.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag29
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init3.fs b/tests/fsharp/core/topinit/flag_deterministic_init3.fs
new file mode 100644
index 0000000..41de447
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init3.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag3
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init30.fs b/tests/fsharp/core/topinit/flag_deterministic_init30.fs
new file mode 100644
index 0000000..0fede1a
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init30.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag30
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init31.fs b/tests/fsharp/core/topinit/flag_deterministic_init31.fs
new file mode 100644
index 0000000..4d491d9
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init31.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag31
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init32.fs b/tests/fsharp/core/topinit/flag_deterministic_init32.fs
new file mode 100644
index 0000000..83fe8db
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init32.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag32
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init33.fs b/tests/fsharp/core/topinit/flag_deterministic_init33.fs
new file mode 100644
index 0000000..69a21e9
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init33.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag33
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init34.fs b/tests/fsharp/core/topinit/flag_deterministic_init34.fs
new file mode 100644
index 0000000..9adfee6
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init34.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag34
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init35.fs b/tests/fsharp/core/topinit/flag_deterministic_init35.fs
new file mode 100644
index 0000000..69e1dfb
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init35.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag35
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init36.fs b/tests/fsharp/core/topinit/flag_deterministic_init36.fs
new file mode 100644
index 0000000..88f3c19
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init36.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag36
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init37.fs b/tests/fsharp/core/topinit/flag_deterministic_init37.fs
new file mode 100644
index 0000000..3fc9ca6
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init37.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag37
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init38.fs b/tests/fsharp/core/topinit/flag_deterministic_init38.fs
new file mode 100644
index 0000000..95b2dc3
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init38.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag38
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init39.fs b/tests/fsharp/core/topinit/flag_deterministic_init39.fs
new file mode 100644
index 0000000..47534e3
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init39.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag39
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init4.fs b/tests/fsharp/core/topinit/flag_deterministic_init4.fs
new file mode 100644
index 0000000..be136ad
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init4.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag4
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init40.fs b/tests/fsharp/core/topinit/flag_deterministic_init40.fs
new file mode 100644
index 0000000..1a27ce5
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init40.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag40
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init41.fs b/tests/fsharp/core/topinit/flag_deterministic_init41.fs
new file mode 100644
index 0000000..ca087f3
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init41.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag41
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init42.fs b/tests/fsharp/core/topinit/flag_deterministic_init42.fs
new file mode 100644
index 0000000..d692b3c
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init42.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag42
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init43.fs b/tests/fsharp/core/topinit/flag_deterministic_init43.fs
new file mode 100644
index 0000000..1c45113
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init43.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag43
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init44.fs b/tests/fsharp/core/topinit/flag_deterministic_init44.fs
new file mode 100644
index 0000000..e5e4dfa
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init44.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag44
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init45.fs b/tests/fsharp/core/topinit/flag_deterministic_init45.fs
new file mode 100644
index 0000000..d59c990
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init45.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag45
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init46.fs b/tests/fsharp/core/topinit/flag_deterministic_init46.fs
new file mode 100644
index 0000000..cb514b3
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init46.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag46
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init47.fs b/tests/fsharp/core/topinit/flag_deterministic_init47.fs
new file mode 100644
index 0000000..6261b44
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init47.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag47
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init48.fs b/tests/fsharp/core/topinit/flag_deterministic_init48.fs
new file mode 100644
index 0000000..8661b05
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init48.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag48
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init49.fs b/tests/fsharp/core/topinit/flag_deterministic_init49.fs
new file mode 100644
index 0000000..b9e41bb
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init49.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag49
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init5.fs b/tests/fsharp/core/topinit/flag_deterministic_init5.fs
new file mode 100644
index 0000000..36ddcdf
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init5.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag5
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init50.fs b/tests/fsharp/core/topinit/flag_deterministic_init50.fs
new file mode 100644
index 0000000..0e49c32
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init50.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag50
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init51.fs b/tests/fsharp/core/topinit/flag_deterministic_init51.fs
new file mode 100644
index 0000000..93811e2
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init51.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag51
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init52.fs b/tests/fsharp/core/topinit/flag_deterministic_init52.fs
new file mode 100644
index 0000000..e5123cd
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init52.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag52
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init53.fs b/tests/fsharp/core/topinit/flag_deterministic_init53.fs
new file mode 100644
index 0000000..af62adb
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init53.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag53
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init54.fs b/tests/fsharp/core/topinit/flag_deterministic_init54.fs
new file mode 100644
index 0000000..320f519
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init54.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag54
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init55.fs b/tests/fsharp/core/topinit/flag_deterministic_init55.fs
new file mode 100644
index 0000000..b7bbd4d
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init55.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag55
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init56.fs b/tests/fsharp/core/topinit/flag_deterministic_init56.fs
new file mode 100644
index 0000000..0f82abd
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init56.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag56
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init57.fs b/tests/fsharp/core/topinit/flag_deterministic_init57.fs
new file mode 100644
index 0000000..faca572
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init57.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag57
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init58.fs b/tests/fsharp/core/topinit/flag_deterministic_init58.fs
new file mode 100644
index 0000000..bd41925
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init58.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag58
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init59.fs b/tests/fsharp/core/topinit/flag_deterministic_init59.fs
new file mode 100644
index 0000000..5957d7b
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init59.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag59
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init6.fs b/tests/fsharp/core/topinit/flag_deterministic_init6.fs
new file mode 100644
index 0000000..341d432
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init6.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag6
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init60.fs b/tests/fsharp/core/topinit/flag_deterministic_init60.fs
new file mode 100644
index 0000000..48414ea
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init60.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag60
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init61.fs b/tests/fsharp/core/topinit/flag_deterministic_init61.fs
new file mode 100644
index 0000000..3a33d64
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init61.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag61
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init62.fs b/tests/fsharp/core/topinit/flag_deterministic_init62.fs
new file mode 100644
index 0000000..a7f6d22
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init62.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag62
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init63.fs b/tests/fsharp/core/topinit/flag_deterministic_init63.fs
new file mode 100644
index 0000000..f637aa7
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init63.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag63
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init64.fs b/tests/fsharp/core/topinit/flag_deterministic_init64.fs
new file mode 100644
index 0000000..702bc64
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init64.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag64
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init65.fs b/tests/fsharp/core/topinit/flag_deterministic_init65.fs
new file mode 100644
index 0000000..563e334
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init65.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag65
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init66.fs b/tests/fsharp/core/topinit/flag_deterministic_init66.fs
new file mode 100644
index 0000000..f373f9b
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init66.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag66
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init67.fs b/tests/fsharp/core/topinit/flag_deterministic_init67.fs
new file mode 100644
index 0000000..967d04f
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init67.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag67
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init68.fs b/tests/fsharp/core/topinit/flag_deterministic_init68.fs
new file mode 100644
index 0000000..9159958
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init68.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag68
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init69.fs b/tests/fsharp/core/topinit/flag_deterministic_init69.fs
new file mode 100644
index 0000000..da258f1
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init69.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag69
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init7.fs b/tests/fsharp/core/topinit/flag_deterministic_init7.fs
new file mode 100644
index 0000000..7366b1f
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init7.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag7
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init70.fs b/tests/fsharp/core/topinit/flag_deterministic_init70.fs
new file mode 100644
index 0000000..d248867
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init70.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag70
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init71.fs b/tests/fsharp/core/topinit/flag_deterministic_init71.fs
new file mode 100644
index 0000000..d38ba8a
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init71.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag71
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init72.fs b/tests/fsharp/core/topinit/flag_deterministic_init72.fs
new file mode 100644
index 0000000..b0b5c0b
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init72.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag72
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init73.fs b/tests/fsharp/core/topinit/flag_deterministic_init73.fs
new file mode 100644
index 0000000..23076bf
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init73.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag73
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init74.fs b/tests/fsharp/core/topinit/flag_deterministic_init74.fs
new file mode 100644
index 0000000..34c32dd
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init74.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag74
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init75.fs b/tests/fsharp/core/topinit/flag_deterministic_init75.fs
new file mode 100644
index 0000000..69fce34
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init75.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag75
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init76.fs b/tests/fsharp/core/topinit/flag_deterministic_init76.fs
new file mode 100644
index 0000000..888d393
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init76.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag76
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init77.fs b/tests/fsharp/core/topinit/flag_deterministic_init77.fs
new file mode 100644
index 0000000..72cd79b
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init77.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag77
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init78.fs b/tests/fsharp/core/topinit/flag_deterministic_init78.fs
new file mode 100644
index 0000000..52adb3f
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init78.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag78
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init79.fs b/tests/fsharp/core/topinit/flag_deterministic_init79.fs
new file mode 100644
index 0000000..f5a384a
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init79.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag79
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init8.fs b/tests/fsharp/core/topinit/flag_deterministic_init8.fs
new file mode 100644
index 0000000..691fc76
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init8.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag8
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init80.fs b/tests/fsharp/core/topinit/flag_deterministic_init80.fs
new file mode 100644
index 0000000..230e076
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init80.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag80
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init81.fs b/tests/fsharp/core/topinit/flag_deterministic_init81.fs
new file mode 100644
index 0000000..0d3f4da
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init81.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag81
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init82.fs b/tests/fsharp/core/topinit/flag_deterministic_init82.fs
new file mode 100644
index 0000000..7fcc1ff
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init82.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag82
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init83.fs b/tests/fsharp/core/topinit/flag_deterministic_init83.fs
new file mode 100644
index 0000000..b003d7e
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init83.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag83
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init84.fs b/tests/fsharp/core/topinit/flag_deterministic_init84.fs
new file mode 100644
index 0000000..5ebf5ee
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init84.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag84
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init85.fs b/tests/fsharp/core/topinit/flag_deterministic_init85.fs
new file mode 100644
index 0000000..420d464
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init85.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag85
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/flag_deterministic_init9.fs b/tests/fsharp/core/topinit/flag_deterministic_init9.fs
new file mode 100644
index 0000000..e8c2afa
--- /dev/null
+++ b/tests/fsharp/core/topinit/flag_deterministic_init9.fs
@@ -0,0 +1,3 @@
+// This file was autogenerated by running the script in this directory
+module InitFlag9
+let mutable init = false
diff --git a/tests/fsharp/core/topinit/generate.fsx b/tests/fsharp/core/topinit/generate.fsx
new file mode 100644
index 0000000..7fe7c50
--- /dev/null
+++ b/tests/fsharp/core/topinit/generate.fsx
@@ -0,0 +1,142 @@
+
+let generateTests() = 
+    let n = ref 0 
+    let commandLine = ref "fsc " 
+    let lines = 
+        [| yield "let checkNotInitialized s isInitialized = if isInitialized then (printf \"FAILED: %s, expected module not to be initialized\" s; exit 1)";
+           yield "let checkInitialized s isInitialized = if not isInitialized then (printf \"FAILED: %s, expected module to be initialized\" s; exit 1)";
+                                               
+           for (decl1, triggers1) in 
+                                      [ "let x = System.DayOfWeek.Friday", false;
+                                        "let x = 1.0", false;
+                                        "let x = 1.0f", false;
+                                        "let x = 1.0M", false;
+                                        "let x = 1", false;
+                                        "let x = 1y", false;
+                                        "let x = 1uy", false;
+                                        "let x = 1s", false;
+                                        "let x = 1us", false;
+                                        "let x = 1n", false;
+                                        "let x = 1un", false;
+                                        "let x = 1L", false;
+                                        "let x = c", false;
+                                        "let x = \"two\"", false;
+                                        "let x = 1UL", false;
+                                        "let x = enum<System.DayOfWeek>(0) ", false;
+                                        "let x = 1 + 1", false;
+                                        "let x = 1 < 1", false;
+                                        "let x = 1 > 1", false;
+                                        "let x = 1 <= 1", false;
+                                        "let x = 1 >= 1", false;
+                                        "let x = not b", false;
+                                        "let x = 1 <> 1", false;
+                                        "let x = compare 1 1", false;
+                                        "let x = 1 - 1", false;
+                                        "let x = 1 * 1", false;
+                                        "let x = 2 <<< 2", false;
+                                        "let x = 2 >>> 2", false;
+                                        "let x = 2 ||| 2", false;
+                                        "let x = 2 &&& 2", false;
+                                        "let x = 2 ^^^ 2", false;
+                                        "let x = ~~~ 2", false;
+                                        "let x = 2", false;
+                                        "let x = true && true", false;
+                                        "let x = true && false", false;
+                                        "let x = false && false", false;
+                                        "let x = b && false", false;
+                                        "let x : int list = []", false;
+                                        "let x : (int * int) list = []", false;
+                                        "let x : int option = None", false;
+                                        "let x : (int * int) option = None", false;
+                                        "let x = if true then 1 else 2", false;
+                                        "let x = if b then 1 else 2", false;
+                                        "let x = match true with true -> 1 | false -> 2", false;
+                                        "let x = match b with true -> 1 | false -> 2", false;
+                                        "let x = match b with v -> 1", false;
+                                        "let x = match 1 with 1 -> 1 | _ -> 2", false;
+                                        "let x = let a = 1 in a", false;
+                                        "let x = if b then true else false", false;
+                                        "let x = (fun () -> ())", false;
+                                        "let x = (fun a -> a)", false;
+                                        "let x = typeof<int>", false;
+                                        "let x = [[]]", false;  // this is generalized
+                                        "let x = Unchecked.defaultof<int>", false;
+                                        "let x = Unchecked.defaultof<string>", false;
+                                        "let x = Unchecked.defaultof<System.Windows.Forms.Form>", false;
+                                        "let x = sizeof<int>", false;
+                                        // These DO cause initialization
+                                        "let x = \"two\" + \"three\"", true;
+                                        "let x = \"two\" < \"three\"", true;
+                                        "let x = \"two\" > \"three\"", true;
+                                        "let x = \"two\" = \"three\"", true;
+                                        "let x = \"two\" >= \"three\"", true;
+                                        "let x = \"two\" <= \"three\"", true;
+                                        "let x = \"two\" <> \"three\"", true;
+                                        "let x = 1.0M + 2.0M", true;
+                                        "let x = 1.0M - 2.0M", true;
+                                        "let x = 1.0M * 2.0M", true;
+                                        "let x = lazy (1+1)", true;
+                                        "let x = 1.0M < 2.0M", true;
+                                        "let x = 1.0M = 2.0M", true;
+                                        "let x = 1.0M > 2.0M", true;
+                                        "let x = 1.0M <> 2.0M", true;
+                                        "let x = 1.0M >= 2.0M", true;
+                                        "let x = 1.0M <= 2.0M", true;
+                                        "let x = 1I", true;
+                                        "let x = typedefof<int>", true;
+                                        "let x = 1 / 1", true;
+                                        "let x = 2 % 2", true;
+                                        "let mutable x = 1", true;
+                                        "let (x,_) = (1,2)", true;
+                                        "let x = (1,2)", true;
+                                        "let x = Some 1", true;
+                                        "let x = [1]", true;
+                                        "let x : Choice<int,string> = Choice1Of2 3", true;
+                                        "let x = aFunction", true;
+                                        "let x = ((); 1)", true; ] do
+                  
+                  incr n
+                  commandLine :=  commandLine.Value + (sprintf " flag_deterministic_init%d.fs" n.Value)
+                  commandLine :=  commandLine.Value + (sprintf " lib_deterministic_init%d.fs" n.Value)
+                  System.IO.File.WriteAllLines(sprintf "flag_deterministic_init%d.fs" n.Value, 
+                                               [| "// This file was autogenerated by running the script in this directory"
+                                                  sprintf "module InitFlag%d" n.Value
+                                                  "let mutable init = false"; |])
+                  System.IO.File.WriteAllLines(sprintf "lib_deterministic_init%d.fs" n.Value, 
+                                               [| yield "// This file was autogenerated by running the script in this directory"
+                                                  yield sprintf "module Lib%d" n.Value
+                                                  yield "// These are some constant expressions which can be accessed from context"
+                                                  yield "let c = 1";
+                                                  yield "let b = true";
+                                                  yield "let aFunction (x:int) = x ";
+                                                  yield "// This is a value we will access from the outside."
+                                                  if triggers1 then 
+                                                      yield "// We expect accessing the value 'x' to trigger initialization of this file"
+                                                  else
+                                                      yield "// We expect accessing the value 'x' will _not_ trigger initialization of this module"
+                                                  yield decl1;
+                                                  yield "// This is a value we can access from the outside to definitely force initialziation of the module"
+                                                  yield "let mutable forceInit = 1";
+                                                  yield "// This sets a value in another module to indicate that initialization has happened"
+                                                  yield sprintf "InitFlag%d.init <- true" n.Value |])
+                  yield sprintf "//-----------------"
+                  yield sprintf "printfn \"Touching value in module Lib%d...\"" n.Value 
+                  yield sprintf "printfn \"    --> Lib%d.x = %%A\" Lib%d.x" n.Value n.Value
+                  if triggers1 then 
+                      yield sprintf "printfn \"Checking this did cause initialization of module Lib%d...\"" n.Value 
+                      yield sprintf "checkInitialized \"Lib%d\" InitFlag%d.init" n.Value n.Value 
+                  else 
+                      yield sprintf "printfn \"Checking this did not cause initialization of module Lib%d...\"" n.Value 
+                      yield sprintf "printfn \"Touching a mutable value in module Lib%d...\"" n.Value 
+                      yield sprintf "checkNotInitialized \"Lib%d\" InitFlag%d.init" n.Value n.Value 
+                      // Touching the 'init' value should trigger initialization
+                      yield sprintf "printfn \"Lib%d.forceInit = %%A\" Lib%d.forceInit" n.Value n.Value
+                      yield sprintf "checkInitialized \"Lib%d\" InitFlag%d.init" n.Value n.Value
+           yield "System.IO.File.WriteAllText(\"test.ok\",\"ok\")"
+           yield "exit 0" |]
+    System.IO.File.WriteAllLines("test_deterministic_init.fs", lines)
+    commandLine :=  commandLine.Value + " test_deterministic_init.fs"
+    System.IO.File.WriteAllLines("commandLine.bat", [| commandLine.Value |])
+                                               
+generateTests()
+
diff --git a/tests/fsharp/core/topinit/lib.ml b/tests/fsharp/core/topinit/lib.ml
new file mode 100644
index 0000000..3b8e1f1
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib.ml
@@ -0,0 +1,13 @@
+
+
+(* Check that a F# library module has its initialization code run *)
+(* before a field is accessed. *)
+let x = ref 6
+let addToRef (y:int) = x := !x + y; !x
+
+(* Note that if the above works then just about anything will work *)
+(* before a field is accessed. *)
+let observableApp = (let r = ref 7 in  fun x -> (r := !r + x; !r))
+let addToRef2 (y:int) = observableApp y
+
+
diff --git a/tests/fsharp/core/topinit/lib69514.fs b/tests/fsharp/core/topinit/lib69514.fs
new file mode 100644
index 0000000..c6f0420
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib69514.fs
@@ -0,0 +1,14 @@
+namespace Lib
+ 
+module File1 =
+ 
+    let mutable discState = System.DateTime.Now
+
+
+module File2 =
+    [<Struct>]
+    type DiscState(rep : int) =
+        member this.Rep = rep
+ 
+    let mutable discState = DiscState(0)
+ 
diff --git a/tests/fsharp/core/topinit/lib69514.fsi b/tests/fsharp/core/topinit/lib69514.fsi
new file mode 100644
index 0000000..fc9cc45
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib69514.fsi
@@ -0,0 +1,16 @@
+namespace Lib
+
+module File1 = 
+    val mutable discState : System.DateTime
+
+
+module File2 =
+    [<Struct>]
+    type DiscState =
+        new : int -> DiscState
+        member Rep : int
+ 
+    val mutable discState : DiscState
+
+
+ 
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init1.fs b/tests/fsharp/core/topinit/lib_deterministic_init1.fs
new file mode 100644
index 0000000..aa05111
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init1.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib1
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = System.DayOfWeek.Friday
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag1.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init10.fs b/tests/fsharp/core/topinit/lib_deterministic_init10.fs
new file mode 100644
index 0000000..8b78246
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init10.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib10
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1n
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag10.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init11.fs b/tests/fsharp/core/topinit/lib_deterministic_init11.fs
new file mode 100644
index 0000000..243251b
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init11.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib11
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1un
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag11.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init12.fs b/tests/fsharp/core/topinit/lib_deterministic_init12.fs
new file mode 100644
index 0000000..1be4888
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init12.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib12
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1L
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag12.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init13.fs b/tests/fsharp/core/topinit/lib_deterministic_init13.fs
new file mode 100644
index 0000000..009c6bd
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init13.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib13
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = c
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag13.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init14.fs b/tests/fsharp/core/topinit/lib_deterministic_init14.fs
new file mode 100644
index 0000000..b39e26e
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init14.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib14
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = "two"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag14.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init15.fs b/tests/fsharp/core/topinit/lib_deterministic_init15.fs
new file mode 100644
index 0000000..66734a5
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init15.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib15
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1UL
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag15.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init16.fs b/tests/fsharp/core/topinit/lib_deterministic_init16.fs
new file mode 100644
index 0000000..edbd6d9
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init16.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib16
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = enum<System.DayOfWeek>(0) 
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag16.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init17.fs b/tests/fsharp/core/topinit/lib_deterministic_init17.fs
new file mode 100644
index 0000000..4d6d5bb
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init17.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib17
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 + 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag17.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init18.fs b/tests/fsharp/core/topinit/lib_deterministic_init18.fs
new file mode 100644
index 0000000..4fc55ff
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init18.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib18
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 < 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag18.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init19.fs b/tests/fsharp/core/topinit/lib_deterministic_init19.fs
new file mode 100644
index 0000000..cea34f4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init19.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib19
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 > 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag19.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init2.fs b/tests/fsharp/core/topinit/lib_deterministic_init2.fs
new file mode 100644
index 0000000..2f92b9b
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init2.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib2
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1.0
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag2.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init20.fs b/tests/fsharp/core/topinit/lib_deterministic_init20.fs
new file mode 100644
index 0000000..b6799c4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init20.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib20
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 <= 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag20.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init21.fs b/tests/fsharp/core/topinit/lib_deterministic_init21.fs
new file mode 100644
index 0000000..7b83bf3
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init21.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib21
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 >= 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag21.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init22.fs b/tests/fsharp/core/topinit/lib_deterministic_init22.fs
new file mode 100644
index 0000000..7f3a23b
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init22.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib22
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = not b
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag22.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init23.fs b/tests/fsharp/core/topinit/lib_deterministic_init23.fs
new file mode 100644
index 0000000..63332f5
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init23.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib23
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 <> 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag23.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init24.fs b/tests/fsharp/core/topinit/lib_deterministic_init24.fs
new file mode 100644
index 0000000..5734020
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init24.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib24
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = compare 1 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag24.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init25.fs b/tests/fsharp/core/topinit/lib_deterministic_init25.fs
new file mode 100644
index 0000000..a9a05f5
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init25.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib25
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 - 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag25.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init26.fs b/tests/fsharp/core/topinit/lib_deterministic_init26.fs
new file mode 100644
index 0000000..95fcbae
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init26.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib26
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1 * 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag26.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init27.fs b/tests/fsharp/core/topinit/lib_deterministic_init27.fs
new file mode 100644
index 0000000..75b5d66
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init27.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib27
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2 <<< 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag27.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init28.fs b/tests/fsharp/core/topinit/lib_deterministic_init28.fs
new file mode 100644
index 0000000..f9564b7
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init28.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib28
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2 >>> 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag28.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init29.fs b/tests/fsharp/core/topinit/lib_deterministic_init29.fs
new file mode 100644
index 0000000..abf75c0
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init29.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib29
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2 ||| 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag29.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init3.fs b/tests/fsharp/core/topinit/lib_deterministic_init3.fs
new file mode 100644
index 0000000..4825455
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init3.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib3
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1.0f
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag3.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init30.fs b/tests/fsharp/core/topinit/lib_deterministic_init30.fs
new file mode 100644
index 0000000..30c8588
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init30.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib30
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2 &&& 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag30.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init31.fs b/tests/fsharp/core/topinit/lib_deterministic_init31.fs
new file mode 100644
index 0000000..a95f8ff
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init31.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib31
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2 ^^^ 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag31.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init32.fs b/tests/fsharp/core/topinit/lib_deterministic_init32.fs
new file mode 100644
index 0000000..43274e0
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init32.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib32
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = ~~~ 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag32.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init33.fs b/tests/fsharp/core/topinit/lib_deterministic_init33.fs
new file mode 100644
index 0000000..42af71c
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init33.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib33
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag33.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init34.fs b/tests/fsharp/core/topinit/lib_deterministic_init34.fs
new file mode 100644
index 0000000..2649789
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init34.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib34
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = true && true
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag34.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init35.fs b/tests/fsharp/core/topinit/lib_deterministic_init35.fs
new file mode 100644
index 0000000..d1b60f7
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init35.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib35
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = true && false
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag35.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init36.fs b/tests/fsharp/core/topinit/lib_deterministic_init36.fs
new file mode 100644
index 0000000..74dde75
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init36.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib36
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = false && false
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag36.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init37.fs b/tests/fsharp/core/topinit/lib_deterministic_init37.fs
new file mode 100644
index 0000000..b2e3766
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init37.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib37
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = b && false
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag37.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init38.fs b/tests/fsharp/core/topinit/lib_deterministic_init38.fs
new file mode 100644
index 0000000..e04f325
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init38.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib38
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x : int list = []
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag38.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init39.fs b/tests/fsharp/core/topinit/lib_deterministic_init39.fs
new file mode 100644
index 0000000..1bc15cc
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init39.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib39
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x : (int * int) list = []
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag39.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init4.fs b/tests/fsharp/core/topinit/lib_deterministic_init4.fs
new file mode 100644
index 0000000..5009a75
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init4.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib4
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag4.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init40.fs b/tests/fsharp/core/topinit/lib_deterministic_init40.fs
new file mode 100644
index 0000000..dc69f98
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init40.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib40
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x : int option = None
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag40.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init41.fs b/tests/fsharp/core/topinit/lib_deterministic_init41.fs
new file mode 100644
index 0000000..11ac7e9
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init41.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib41
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x : (int * int) option = None
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag41.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init42.fs b/tests/fsharp/core/topinit/lib_deterministic_init42.fs
new file mode 100644
index 0000000..4f020f0
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init42.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib42
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = if true then 1 else 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag42.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init43.fs b/tests/fsharp/core/topinit/lib_deterministic_init43.fs
new file mode 100644
index 0000000..343466c
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init43.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib43
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = if b then 1 else 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag43.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init44.fs b/tests/fsharp/core/topinit/lib_deterministic_init44.fs
new file mode 100644
index 0000000..3f3ff24
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init44.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib44
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = match true with true -> 1 | false -> 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag44.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init45.fs b/tests/fsharp/core/topinit/lib_deterministic_init45.fs
new file mode 100644
index 0000000..0a3f96f
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init45.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib45
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = match b with true -> 1 | false -> 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag45.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init46.fs b/tests/fsharp/core/topinit/lib_deterministic_init46.fs
new file mode 100644
index 0000000..af3dcd3
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init46.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib46
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = match b with v -> 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag46.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init47.fs b/tests/fsharp/core/topinit/lib_deterministic_init47.fs
new file mode 100644
index 0000000..bbbecab
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init47.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib47
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = match 1 with 1 -> 1 | _ -> 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag47.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init48.fs b/tests/fsharp/core/topinit/lib_deterministic_init48.fs
new file mode 100644
index 0000000..fad9be4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init48.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib48
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = let a = 1 in a
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag48.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init49.fs b/tests/fsharp/core/topinit/lib_deterministic_init49.fs
new file mode 100644
index 0000000..0b70696
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init49.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib49
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = if b then true else false
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag49.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init5.fs b/tests/fsharp/core/topinit/lib_deterministic_init5.fs
new file mode 100644
index 0000000..230ae19
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init5.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib5
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag5.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init50.fs b/tests/fsharp/core/topinit/lib_deterministic_init50.fs
new file mode 100644
index 0000000..6d923f4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init50.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib50
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = (fun () -> ())
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag50.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init51.fs b/tests/fsharp/core/topinit/lib_deterministic_init51.fs
new file mode 100644
index 0000000..d0fb6cd
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init51.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib51
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = (fun a -> a)
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag51.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init52.fs b/tests/fsharp/core/topinit/lib_deterministic_init52.fs
new file mode 100644
index 0000000..be26457
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init52.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib52
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = typeof<int>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag52.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init53.fs b/tests/fsharp/core/topinit/lib_deterministic_init53.fs
new file mode 100644
index 0000000..eed12d3
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init53.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib53
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = [[]]
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag53.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init54.fs b/tests/fsharp/core/topinit/lib_deterministic_init54.fs
new file mode 100644
index 0000000..0202670
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init54.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib54
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = Unchecked.defaultof<int>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag54.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init55.fs b/tests/fsharp/core/topinit/lib_deterministic_init55.fs
new file mode 100644
index 0000000..87108a4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init55.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib55
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = Unchecked.defaultof<string>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag55.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init56.fs b/tests/fsharp/core/topinit/lib_deterministic_init56.fs
new file mode 100644
index 0000000..d5d7aa9
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init56.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib56
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = Unchecked.defaultof<System.Windows.Forms.Form>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag56.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init57.fs b/tests/fsharp/core/topinit/lib_deterministic_init57.fs
new file mode 100644
index 0000000..cc948f7
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init57.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib57
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = sizeof<int>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag57.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init58.fs b/tests/fsharp/core/topinit/lib_deterministic_init58.fs
new file mode 100644
index 0000000..be1717c
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init58.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib58
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" + "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag58.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init59.fs b/tests/fsharp/core/topinit/lib_deterministic_init59.fs
new file mode 100644
index 0000000..2f6bad4
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init59.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib59
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" < "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag59.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init6.fs b/tests/fsharp/core/topinit/lib_deterministic_init6.fs
new file mode 100644
index 0000000..8afa4b0
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init6.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib6
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1y
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag6.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init60.fs b/tests/fsharp/core/topinit/lib_deterministic_init60.fs
new file mode 100644
index 0000000..8debf28
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init60.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib60
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" > "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag60.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init61.fs b/tests/fsharp/core/topinit/lib_deterministic_init61.fs
new file mode 100644
index 0000000..d1e6a93
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init61.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib61
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" = "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag61.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init62.fs b/tests/fsharp/core/topinit/lib_deterministic_init62.fs
new file mode 100644
index 0000000..e6ebbb3
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init62.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib62
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" >= "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag62.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init63.fs b/tests/fsharp/core/topinit/lib_deterministic_init63.fs
new file mode 100644
index 0000000..4db9ab8
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init63.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib63
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" <= "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag63.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init64.fs b/tests/fsharp/core/topinit/lib_deterministic_init64.fs
new file mode 100644
index 0000000..d1a4933
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init64.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib64
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = "two" <> "three"
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag64.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init65.fs b/tests/fsharp/core/topinit/lib_deterministic_init65.fs
new file mode 100644
index 0000000..2465fbf
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init65.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib65
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M + 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag65.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init66.fs b/tests/fsharp/core/topinit/lib_deterministic_init66.fs
new file mode 100644
index 0000000..f28900c
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init66.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib66
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M - 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag66.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init67.fs b/tests/fsharp/core/topinit/lib_deterministic_init67.fs
new file mode 100644
index 0000000..9449018
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init67.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib67
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M * 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag67.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init68.fs b/tests/fsharp/core/topinit/lib_deterministic_init68.fs
new file mode 100644
index 0000000..0c0f4c2
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init68.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib68
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = lazy (1+1)
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag68.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init69.fs b/tests/fsharp/core/topinit/lib_deterministic_init69.fs
new file mode 100644
index 0000000..4b3d308
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init69.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib69
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M < 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag69.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init7.fs b/tests/fsharp/core/topinit/lib_deterministic_init7.fs
new file mode 100644
index 0000000..d60be21
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init7.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib7
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1uy
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag7.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init70.fs b/tests/fsharp/core/topinit/lib_deterministic_init70.fs
new file mode 100644
index 0000000..48e5499
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init70.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib70
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M = 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag70.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init71.fs b/tests/fsharp/core/topinit/lib_deterministic_init71.fs
new file mode 100644
index 0000000..153a9a1
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init71.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib71
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M > 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag71.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init72.fs b/tests/fsharp/core/topinit/lib_deterministic_init72.fs
new file mode 100644
index 0000000..b6faa9f
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init72.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib72
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M <> 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag72.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init73.fs b/tests/fsharp/core/topinit/lib_deterministic_init73.fs
new file mode 100644
index 0000000..b520219
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init73.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib73
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M >= 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag73.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init74.fs b/tests/fsharp/core/topinit/lib_deterministic_init74.fs
new file mode 100644
index 0000000..2e8cfae
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init74.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib74
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1.0M <= 2.0M
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag74.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init75.fs b/tests/fsharp/core/topinit/lib_deterministic_init75.fs
new file mode 100644
index 0000000..1bc50b9
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init75.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib75
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1I
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag75.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init76.fs b/tests/fsharp/core/topinit/lib_deterministic_init76.fs
new file mode 100644
index 0000000..5477477
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init76.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib76
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = typedefof<int>
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag76.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init77.fs b/tests/fsharp/core/topinit/lib_deterministic_init77.fs
new file mode 100644
index 0000000..aff15e0
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init77.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib77
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 1 / 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag77.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init78.fs b/tests/fsharp/core/topinit/lib_deterministic_init78.fs
new file mode 100644
index 0000000..ad707b3
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init78.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib78
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = 2 % 2
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag78.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init79.fs b/tests/fsharp/core/topinit/lib_deterministic_init79.fs
new file mode 100644
index 0000000..ab5f58e
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init79.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib79
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let mutable x = 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag79.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init8.fs b/tests/fsharp/core/topinit/lib_deterministic_init8.fs
new file mode 100644
index 0000000..e3b7018
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init8.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib8
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1s
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag8.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init80.fs b/tests/fsharp/core/topinit/lib_deterministic_init80.fs
new file mode 100644
index 0000000..89bdd59
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init80.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib80
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let (x,_) = (1,2)
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag80.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init81.fs b/tests/fsharp/core/topinit/lib_deterministic_init81.fs
new file mode 100644
index 0000000..47f05ee
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init81.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib81
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = (1,2)
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag81.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init82.fs b/tests/fsharp/core/topinit/lib_deterministic_init82.fs
new file mode 100644
index 0000000..38de860
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init82.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib82
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = Some 1
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag82.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init83.fs b/tests/fsharp/core/topinit/lib_deterministic_init83.fs
new file mode 100644
index 0000000..e94ca25
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init83.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib83
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = [1]
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag83.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init84.fs b/tests/fsharp/core/topinit/lib_deterministic_init84.fs
new file mode 100644
index 0000000..b360305
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init84.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib84
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x : Choice<int,string> = Choice1Of2 3
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag84.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init85.fs b/tests/fsharp/core/topinit/lib_deterministic_init85.fs
new file mode 100644
index 0000000..799d2ec
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init85.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib85
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' to trigger initialization of this file
+let x = ((); 1)
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag85.init <- true
diff --git a/tests/fsharp/core/topinit/lib_deterministic_init9.fs b/tests/fsharp/core/topinit/lib_deterministic_init9.fs
new file mode 100644
index 0000000..574ed9b
--- /dev/null
+++ b/tests/fsharp/core/topinit/lib_deterministic_init9.fs
@@ -0,0 +1,12 @@
+// This file was autogenerated by running the script in this directory
+module Lib9
+// These are some constant expressions which can be accessed from context
+let c = 1
+let b = true
+// This is a value we will access from the outside.
+// We expect accessing the value 'x' will _not_ trigger initialization of this module
+let x = 1us
+// This is a value we can access from the outside to definitely force initialziation of the module
+let mutable forceInit = 1
+// This sets a value in another module to indicate that initialization has happened
+InitFlag9.init <- true
diff --git a/tests/fsharp/core/topinit/run.bat b/tests/fsharp/core/topinit/run.bat
new file mode 100644
index 0000000..5e80c29
--- /dev/null
+++ b/tests/fsharp/core/topinit/run.bat
@@ -0,0 +1,60 @@
+ at if "%_echo%"=="" echo off
+
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+
+%CLIX% .\test.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_deterministic_init.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_deterministic_init--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_deterministic_init_exe.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_deterministic_init_exe--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+
+%CLIX% .\test_static_init.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_static_init--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_static_init_exe.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\test_static_init_exe--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/topinit/static-main.fs b/tests/fsharp/core/topinit/static-main.fs
new file mode 100644
index 0000000..e66cfb0
--- /dev/null
+++ b/tests/fsharp/core/topinit/static-main.fs
@@ -0,0 +1,16 @@
+
+[<EntryPoint>]
+let main _ = 
+    InstanceTests.checkAll()
+    try printfn "trigger = %A" StaticTest1.trigger with _ -> printfn "Good, got a static initialization failure"
+    StaticTest1.checkAll()
+    try printfn "trigger = %A" StaticTest2.trigger with _ -> printfn "Good, got a static initialization failure"
+    StaticTest2.checkAll()
+    try printfn "trigger = %A" StaticTest3.trigger with _ -> printfn "Good, got a static initialization failure"
+    StaticTest3.checkAll()
+    GenericStaticTest4.checkAll()
+    try printfn "trigger = %A" StaticTest5.trigger with _ -> printfn "Good, got a static initialization failure"
+    StaticTest5.checkAll()
+    GenericStaticTest6.checkAll()
+    0
+
diff --git a/tests/fsharp/core/topinit/test.cs b/tests/fsharp/core/topinit/test.cs
new file mode 100644
index 0000000..acef2c5
--- /dev/null
+++ b/tests/fsharp/core/topinit/test.cs
@@ -0,0 +1,34 @@
+
+using System;
+using System.Diagnostics;
+
+class Maine
+{
+    public static int failures = 0;
+    
+    public static void Fail(string outputString)
+    {
+        failures++;
+        Console.WriteLine(outputString + new StackTrace(true).ToString());
+    }
+    static int Main()
+    {
+        if (Lib.addToRef(3) != 9)
+            Fail("Expected initialized value");
+        if (Lib.addToRef(6) != 15)
+            Fail("Expected initialized value (2)");
+        if (Lib.addToRef2(3) != 10)
+            Fail("Expected initialized value");
+        if (Lib.addToRef2(6) != 16)
+            Fail("Expected initialized value (2)");
+
+        Console.WriteLine("failures = {0}", failures);
+        
+        return failures;
+    }
+
+
+
+
+
+}
diff --git a/tests/fsharp/core/topinit/test0.fs b/tests/fsharp/core/topinit/test0.fs
new file mode 100644
index 0000000..ac6444b
--- /dev/null
+++ b/tests/fsharp/core/topinit/test0.fs
@@ -0,0 +1,96 @@
+// #Conformance #Interop 
+
+module InstanceTests
+
+let mutable trigger = 1
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+module ClassWithInheritAndImmediateReferenceToThisInLet = 
+    type B() = 
+        member __.P = 1
+
+    let id x = x
+
+    type C() as x = 
+        inherit B()
+        let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members
+        member __.ThisPointer1 = x
+        member __.ThisPointer2 = y
+
+
+    let checkA() = 
+        let c = C()
+        check "cwknecw021" c.ThisPointer1 c.ThisPointer2
+   
+module ClassWithNoInheritAndImmediateReferenceToThisInLet = 
+    type C() as x = 
+        let y = id x // it is ok to access the this pointer and pass it to external code as long as it doesn't call any members
+        member __.ThisPointer1 = x
+        member __.ThisPointer2 = y
+
+
+    let checkB() = 
+        let c = C()
+        check "cwknecw021" c.ThisPointer1 c.ThisPointer2
+ 
+module ClassWithInheritAndDelayedReferenceToThisInLet = 
+    type B() = 
+        member __.P = 1
+
+    let id x = x
+
+    type C() as x = 
+        inherit B()
+        let y() = x 
+        member __.ThisPointer1 = x
+        member __.ThisPointer2 = y()
+
+
+    let checkC() = 
+        let c = C()
+        check "cwknecw021" c.ThisPointer1 c.ThisPointer2
+   
+
+
+module TestPassingThisToBase = 
+    type B(thisC: unit -> obj) = 
+        member __.ThisPointerFromC = thisC()
+
+    let id x = x
+
+    type C() as this = 
+        inherit B(fun () -> box this)
+        member c.ThisPointer1 = (c.ThisPointerFromC :?> C)
+        member c.ThisPointer2 = this
+
+
+    let checkD() = 
+        let c = C()
+        check "cwknecw022" c.ThisPointer1 c.ThisPointer2
+
+module TestAccessingMemberFromBaseAfterInit = 
+    let id x = x
+
+    type B(thisC: unit -> C) = 
+        member __.ThisPointerFromC = thisC()
+
+    and C() as this = 
+        inherit B(fun () -> this)
+        do check "cwknecw023" this.ThisPointer1 this.ThisPointer2
+        member c.ThisPointer1 = c.ThisPointerFromC 
+        member c.ThisPointer2 = this
+
+    let checkE() = 
+        let c = C()
+        ()
+
+let checkAll() = 
+    ClassWithInheritAndImmediateReferenceToThisInLet.checkA()
+    ClassWithNoInheritAndImmediateReferenceToThisInLet.checkB()
+    ClassWithInheritAndDelayedReferenceToThisInLet.checkC()
+    TestPassingThisToBase.checkD()
+    TestAccessingMemberFromBaseAfterInit.checkE()
+    
diff --git a/tests/fsharp/core/topinit/test1.fs b/tests/fsharp/core/topinit/test1.fs
new file mode 100644
index 0000000..a6fbd1e
--- /dev/null
+++ b/tests/fsharp/core/topinit/test1.fs
@@ -0,0 +1,24 @@
+// #Conformance #Interop 
+
+
+module StaticTest1
+
+let mutable trigger = 1
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+module CheckStatic1 = 
+    type B() = 
+        static let x = B.P
+        static member P = x
+
+    let check1() = 
+        check "cwknecw021a1Try" (try B.P |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021a2Try" (try B.P |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021a3Try" (try B.P |> ignore; false  with :? System.InvalidOperationException -> true) true
+
+let checkAll() = 
+    CheckStatic1.check1()
+    
diff --git a/tests/fsharp/core/topinit/test2.fs b/tests/fsharp/core/topinit/test2.fs
new file mode 100644
index 0000000..98fa4d1
--- /dev/null
+++ b/tests/fsharp/core/topinit/test2.fs
@@ -0,0 +1,30 @@
+// #Conformance #Interop 
+
+module StaticTest2
+
+let mutable trigger = 1
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+module CheckStatic2 = 
+    type B() = 
+        static let x = 1
+        static let x2 = B.P1 + 1 // should be ok 
+        static let x3 = B.P1 + 2 // should be ok 
+        static member P1 = x
+        static member P2 = x2
+        static member P3 = x3
+
+    let check2() = 
+        check "cwknecw021b" B.P1 1
+        check "cwknecw021c" B.P2 2
+        check "cwknecw021d" B.P3 3   
+
+
+
+let checkAll() = 
+    CheckStatic2.check2()
+    
+
diff --git a/tests/fsharp/core/topinit/test3.fs b/tests/fsharp/core/topinit/test3.fs
new file mode 100644
index 0000000..166a516
--- /dev/null
+++ b/tests/fsharp/core/topinit/test3.fs
@@ -0,0 +1,32 @@
+// #Conformance #Interop 
+
+module StaticTest3
+
+let mutable trigger = 1
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+
+module CheckStatic3 = 
+    type B() = 
+        static let x = 1 // should be ok
+        static let x2 = B.P2 + 1 // should fail
+        static let x3 = B.P1 + 2 // should be ok 
+        static member P1 = x
+        static member P2 = x2
+        static member P3 = x3
+
+    let check3() = 
+        check "cwknecw021e2" B.P1 1 // the static initialization failed, caught in main, but subsequent accesses succeed!
+        check "cwknecw021e2" B.P1 1 // subsequent accesses succeed!
+        check "cwknecw021e3Try" (try B.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021e1Try" (try B.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021e2Try" (try B.P3 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021e3Try" (try B.P3 |> ignore; false  with :? System.InvalidOperationException -> true) true
+
+let checkAll() = 
+    CheckStatic3.check3()
+    
+
diff --git a/tests/fsharp/core/topinit/test4.fs b/tests/fsharp/core/topinit/test4.fs
new file mode 100644
index 0000000..877f249
--- /dev/null
+++ b/tests/fsharp/core/topinit/test4.fs
@@ -0,0 +1,54 @@
+// #Conformance #Interop 
+
+module GenericStaticTest4
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+
+module CheckStatic4 = 
+    type B<'T>() = 
+        static do printfn "Running initializer for %A (part 1)" typeof<B<'T>>
+        static let x = 1 // should be ok
+        static do printfn "Running initializer for %A (part 2)" typeof<B<'T>>
+        static let x2 = B<'T>.P2 + 1 // should fail
+        static do printfn "Running initializer for %A (part 3)" typeof<B<'T>>
+        static let x3 = B<'T>.P1 + 2 // should be ok 
+        static do printfn "Done initializer for %A" typeof<B<'T>>
+        static member P1 = x
+        static member P2 = x2
+        static member P3 = x3
+
+    let check4() = 
+        // THis is static initialization in a generic type, and the first access happens here
+        check "cwknecw021e1TryA" (try B<int>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+
+
+
+        // NOTE NOTE NOTE: the rest of this test may be flakey under 
+        //    - NGEN of code
+        //    - Differnt CLRs
+
+        // For generic types, it looks like the CLR implements a semantics where subsequent failure reaise an exception
+        check "cwknecw021e1TryA" (try B<int>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e1TryA" (try B<int>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e3TryB" (try B<int>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021e1TryC" (try B<int>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "cwknecw021e2TryD" (try B<int>.P3 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e3TryE" (try B<int>.P3 |> ignore; false  with :? System.TypeInitializationException -> true) true
+
+        // THis is static initialization in a generic type, and the first access happens here
+        check "cwknecw021e1TryA11" (try B<string>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e1TryA" (try B<string>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e1TryA" (try B<string>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e3TryA33" (try B<string>.P2 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e1TryA44" (try B<string>.P2 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e2TryA55" (try B<string>.P3 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        check "cwknecw021e3TryA66" (try B<string>.P3 |> ignore; false  with :? System.TypeInitializationException -> true) true
+
+let checkAll() = 
+    //CheckStatic4.check4() // BUG: FSHARP1.0:5705
+    ()
+    
+
diff --git a/tests/fsharp/core/topinit/test5.fs b/tests/fsharp/core/topinit/test5.fs
new file mode 100644
index 0000000..49b7df7
--- /dev/null
+++ b/tests/fsharp/core/topinit/test5.fs
@@ -0,0 +1,36 @@
+// #Conformance #Interop 
+
+module StaticTest5
+
+let mutable trigger = 1
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+module CheckStatic5 = 
+    type B() = 
+        static let x = 1 // should be ok
+        static let x2 = C.P2 + 1 // should fail
+        static member P1 = x
+        static member P2 = x2
+
+    and C() = 
+        static let x3 = B.P1 + 2 // should be ok 
+        static member P2 = B.P2
+        static member P3 = x3
+
+    let check5() = 
+        check "StaticTest5.cwknecDw021e2" B.P1 1 // subsequent accesses succeed!
+        check "StaticTest5.cwknecDw021e2" B.P1 1 // subsequent accesses succeed!
+        check "StaticTest5.cwknecDw021e3TryB" (try C.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "StaticTest5.cwknecDw021e1TryC" (try C.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "StaticTest5.cwknecDw021e2TryD" (try C.P3 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "StaticTest5.cwknecDw021e3TryE" (try C.P3 |> ignore; false  with :? System.InvalidOperationException -> true) true
+
+
+let checkAll() = 
+    CheckStatic5.check5()
+
+    
+
diff --git a/tests/fsharp/core/topinit/test6.fs b/tests/fsharp/core/topinit/test6.fs
new file mode 100644
index 0000000..3cc1df0
--- /dev/null
+++ b/tests/fsharp/core/topinit/test6.fs
@@ -0,0 +1,56 @@
+// #Conformance #Interop 
+
+module GenericStaticTest6
+
+let check s b1 b2 = 
+    if b1 = b2 then printfn "%s OK" s
+    else (printfn "FAIL %s: expected %A, got %A" s b2 b1; exit 1)
+
+
+module CheckStatic6 = 
+    type B<'T>() = 
+        static let x = 1 // should be ok
+        static let x2 = C<'T>.P2 + 1 // should fail
+        static member P1 = x
+        static member P2 = x2
+
+    and C<'T>() = 
+        static let x3 = B<'T>.P1 + 2 // should be ok 
+        static member P2 = B<'T>.P2
+        static member P3 = x3
+
+    let check6() = 
+        // THis is static initialization in a generic type, and the first access happens here
+        check "GenericStaticTest6.cwknecDw021e1TryA" (try B<int>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        // NOTE NOTE NOTE: the rest of this test may be flakey under 
+        //    - NGEN of code
+        //    - Differnt CLRs
+
+        check "GenericStaticTest6.cwknecw021e1TryA" B<int>.P1 1
+        check "GenericStaticTest6.cwknecDw021e3TryB" (try B<int>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        check "GenericStaticTest6.cwknecDw021e1TryC" (try B<int>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        // Note, initialization of the generic types is independent - initialization of C succeeded
+        check "GenericStaticTest6.cwknecDw021e2TryD" C<int>.P3 3
+        check "GenericStaticTest6.cwknecDw021e3TryE" C<int>.P3 3
+
+
+        // THis is static initialization in a generic type, and the first access happens here
+        check "GenericStaticTest6.cwknecDw021e1TryA" (try B<string>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        // NOTE NOTE NOTE: the rest of this test may be flakey under 
+        //    - NGEN of code
+        //    - Differnt CLRs
+
+#if OMITTED
+        //check "GenericStaticTest6.cwknecDw021e1TryA" (try B<string>.P1 |> ignore; false  with :? System.TypeInitializationException -> true) true
+        //check "GenericStaticTest6.cwknecDw021e3TryB" (try B<string>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        //check "GenericStaticTest6.cwknecDw021e1TryC" (try B<string>.P2 |> ignore; false  with :? System.InvalidOperationException -> true) true
+        // Note, initialization of the generic types is independent - initialization of C succeeded
+        //check "GenericStaticTest6.cwknecDw021e2TryD" C<string>.P3 3
+        //check "GenericStaticTest6.cwknecDw021e3TryE" C<string>.P3 3
+#endif
+
+let checkAll() = 
+    //CheckStatic6.check6() // BUG: FSHARP1.0:5705
+    ()
+    
+
diff --git a/tests/fsharp/core/topinit/test_deterministic_init.fs b/tests/fsharp/core/topinit/test_deterministic_init.fs
new file mode 100644
index 0000000..ea3d5f9
--- /dev/null
+++ b/tests/fsharp/core/topinit/test_deterministic_init.fs
@@ -0,0 +1,601 @@
+// #Conformance #Interop 
+let checkNotInitialized s isInitialized = if isInitialized then (printf "FAILED: %s, expected module not to be initialized" s; exit 1)
+let checkInitialized s isInitialized = if not isInitialized then (printf "FAILED: %s, expected module to be initialized" s; exit 1)
+//-----------------
+printfn "Touching value in module Lib1..."
+printfn "    --> Lib1.x = %A" Lib1.x
+printfn "Checking this did not cause initialization of module Lib1..."
+printfn "Touching a mutable value in module Lib1..."
+checkNotInitialized "Lib1" InitFlag1.init
+printfn "Lib1.forceInit = %A" Lib1.forceInit
+checkInitialized "Lib1" InitFlag1.init
+//-----------------
+printfn "Touching value in module Lib2..."
+printfn "    --> Lib2.x = %A" Lib2.x
+printfn "Checking this did not cause initialization of module Lib2..."
+printfn "Touching a mutable value in module Lib2..."
+checkNotInitialized "Lib2" InitFlag2.init
+printfn "Lib2.forceInit = %A" Lib2.forceInit
+checkInitialized "Lib2" InitFlag2.init
+//-----------------
+printfn "Touching value in module Lib3..."
+printfn "    --> Lib3.x = %A" Lib3.x
+printfn "Checking this did not cause initialization of module Lib3..."
+printfn "Touching a mutable value in module Lib3..."
+checkNotInitialized "Lib3" InitFlag3.init
+printfn "Lib3.forceInit = %A" Lib3.forceInit
+checkInitialized "Lib3" InitFlag3.init
+//-----------------
+printfn "Touching value in module Lib4..."
+printfn "    --> Lib4.x = %A" Lib4.x
+printfn "Checking this did not cause initialization of module Lib4..."
+printfn "Touching a mutable value in module Lib4..."
+checkNotInitialized "Lib4" InitFlag4.init
+printfn "Lib4.forceInit = %A" Lib4.forceInit
+checkInitialized "Lib4" InitFlag4.init
+//-----------------
+printfn "Touching value in module Lib5..."
+printfn "    --> Lib5.x = %A" Lib5.x
+printfn "Checking this did not cause initialization of module Lib5..."
+printfn "Touching a mutable value in module Lib5..."
+checkNotInitialized "Lib5" InitFlag5.init
+printfn "Lib5.forceInit = %A" Lib5.forceInit
+checkInitialized "Lib5" InitFlag5.init
+//-----------------
+printfn "Touching value in module Lib6..."
+printfn "    --> Lib6.x = %A" Lib6.x
+printfn "Checking this did not cause initialization of module Lib6..."
+printfn "Touching a mutable value in module Lib6..."
+checkNotInitialized "Lib6" InitFlag6.init
+printfn "Lib6.forceInit = %A" Lib6.forceInit
+checkInitialized "Lib6" InitFlag6.init
+//-----------------
+printfn "Touching value in module Lib7..."
+printfn "    --> Lib7.x = %A" Lib7.x
+printfn "Checking this did not cause initialization of module Lib7..."
+printfn "Touching a mutable value in module Lib7..."
+checkNotInitialized "Lib7" InitFlag7.init
+printfn "Lib7.forceInit = %A" Lib7.forceInit
+checkInitialized "Lib7" InitFlag7.init
+//-----------------
+printfn "Touching value in module Lib8..."
+printfn "    --> Lib8.x = %A" Lib8.x
+printfn "Checking this did not cause initialization of module Lib8..."
+printfn "Touching a mutable value in module Lib8..."
+checkNotInitialized "Lib8" InitFlag8.init
+printfn "Lib8.forceInit = %A" Lib8.forceInit
+checkInitialized "Lib8" InitFlag8.init
+//-----------------
+printfn "Touching value in module Lib9..."
+printfn "    --> Lib9.x = %A" Lib9.x
+printfn "Checking this did not cause initialization of module Lib9..."
+printfn "Touching a mutable value in module Lib9..."
+checkNotInitialized "Lib9" InitFlag9.init
+printfn "Lib9.forceInit = %A" Lib9.forceInit
+checkInitialized "Lib9" InitFlag9.init
+//-----------------
+printfn "Touching value in module Lib10..."
+printfn "    --> Lib10.x = %A" Lib10.x
+printfn "Checking this did not cause initialization of module Lib10..."
+printfn "Touching a mutable value in module Lib10..."
+checkNotInitialized "Lib10" InitFlag10.init
+printfn "Lib10.forceInit = %A" Lib10.forceInit
+checkInitialized "Lib10" InitFlag10.init
+//-----------------
+printfn "Touching value in module Lib11..."
+printfn "    --> Lib11.x = %A" Lib11.x
+printfn "Checking this did not cause initialization of module Lib11..."
+printfn "Touching a mutable value in module Lib11..."
+checkNotInitialized "Lib11" InitFlag11.init
+printfn "Lib11.forceInit = %A" Lib11.forceInit
+checkInitialized "Lib11" InitFlag11.init
+//-----------------
+printfn "Touching value in module Lib12..."
+printfn "    --> Lib12.x = %A" Lib12.x
+printfn "Checking this did not cause initialization of module Lib12..."
+printfn "Touching a mutable value in module Lib12..."
+checkNotInitialized "Lib12" InitFlag12.init
+printfn "Lib12.forceInit = %A" Lib12.forceInit
+checkInitialized "Lib12" InitFlag12.init
+//-----------------
+printfn "Touching value in module Lib13..."
+printfn "    --> Lib13.x = %A" Lib13.x
+printfn "Checking this did not cause initialization of module Lib13..."
+printfn "Touching a mutable value in module Lib13..."
+checkNotInitialized "Lib13" InitFlag13.init
+printfn "Lib13.forceInit = %A" Lib13.forceInit
+checkInitialized "Lib13" InitFlag13.init
+//-----------------
+printfn "Touching value in module Lib14..."
+printfn "    --> Lib14.x = %A" Lib14.x
+printfn "Checking this did not cause initialization of module Lib14..."
+printfn "Touching a mutable value in module Lib14..."
+checkNotInitialized "Lib14" InitFlag14.init
+printfn "Lib14.forceInit = %A" Lib14.forceInit
+checkInitialized "Lib14" InitFlag14.init
+//-----------------
+printfn "Touching value in module Lib15..."
+printfn "    --> Lib15.x = %A" Lib15.x
+printfn "Checking this did not cause initialization of module Lib15..."
+printfn "Touching a mutable value in module Lib15..."
+checkNotInitialized "Lib15" InitFlag15.init
+printfn "Lib15.forceInit = %A" Lib15.forceInit
+checkInitialized "Lib15" InitFlag15.init
+//-----------------
+printfn "Touching value in module Lib16..."
+printfn "    --> Lib16.x = %A" Lib16.x
+printfn "Checking this did not cause initialization of module Lib16..."
+printfn "Touching a mutable value in module Lib16..."
+checkNotInitialized "Lib16" InitFlag16.init
+printfn "Lib16.forceInit = %A" Lib16.forceInit
+checkInitialized "Lib16" InitFlag16.init
+//-----------------
+printfn "Touching value in module Lib17..."
+printfn "    --> Lib17.x = %A" Lib17.x
+printfn "Checking this did not cause initialization of module Lib17..."
+printfn "Touching a mutable value in module Lib17..."
+checkNotInitialized "Lib17" InitFlag17.init
+printfn "Lib17.forceInit = %A" Lib17.forceInit
+checkInitialized "Lib17" InitFlag17.init
+//-----------------
+printfn "Touching value in module Lib18..."
+printfn "    --> Lib18.x = %A" Lib18.x
+printfn "Checking this did not cause initialization of module Lib18..."
+printfn "Touching a mutable value in module Lib18..."
+checkNotInitialized "Lib18" InitFlag18.init
+printfn "Lib18.forceInit = %A" Lib18.forceInit
+checkInitialized "Lib18" InitFlag18.init
+//-----------------
+printfn "Touching value in module Lib19..."
+printfn "    --> Lib19.x = %A" Lib19.x
+printfn "Checking this did not cause initialization of module Lib19..."
+printfn "Touching a mutable value in module Lib19..."
+checkNotInitialized "Lib19" InitFlag19.init
+printfn "Lib19.forceInit = %A" Lib19.forceInit
+checkInitialized "Lib19" InitFlag19.init
+//-----------------
+printfn "Touching value in module Lib20..."
+printfn "    --> Lib20.x = %A" Lib20.x
+printfn "Checking this did not cause initialization of module Lib20..."
+printfn "Touching a mutable value in module Lib20..."
+checkNotInitialized "Lib20" InitFlag20.init
+printfn "Lib20.forceInit = %A" Lib20.forceInit
+checkInitialized "Lib20" InitFlag20.init
+//-----------------
+printfn "Touching value in module Lib21..."
+printfn "    --> Lib21.x = %A" Lib21.x
+printfn "Checking this did not cause initialization of module Lib21..."
+printfn "Touching a mutable value in module Lib21..."
+checkNotInitialized "Lib21" InitFlag21.init
+printfn "Lib21.forceInit = %A" Lib21.forceInit
+checkInitialized "Lib21" InitFlag21.init
+//-----------------
+printfn "Touching value in module Lib22..."
+printfn "    --> Lib22.x = %A" Lib22.x
+printfn "Checking this did not cause initialization of module Lib22..."
+printfn "Touching a mutable value in module Lib22..."
+checkNotInitialized "Lib22" InitFlag22.init
+printfn "Lib22.forceInit = %A" Lib22.forceInit
+checkInitialized "Lib22" InitFlag22.init
+//-----------------
+printfn "Touching value in module Lib23..."
+printfn "    --> Lib23.x = %A" Lib23.x
+printfn "Checking this did not cause initialization of module Lib23..."
+printfn "Touching a mutable value in module Lib23..."
+checkNotInitialized "Lib23" InitFlag23.init
+printfn "Lib23.forceInit = %A" Lib23.forceInit
+checkInitialized "Lib23" InitFlag23.init
+//-----------------
+printfn "Touching value in module Lib24..."
+printfn "    --> Lib24.x = %A" Lib24.x
+printfn "Checking this did not cause initialization of module Lib24..."
+printfn "Touching a mutable value in module Lib24..."
+checkNotInitialized "Lib24" InitFlag24.init
+printfn "Lib24.forceInit = %A" Lib24.forceInit
+checkInitialized "Lib24" InitFlag24.init
+//-----------------
+printfn "Touching value in module Lib25..."
+printfn "    --> Lib25.x = %A" Lib25.x
+printfn "Checking this did not cause initialization of module Lib25..."
+printfn "Touching a mutable value in module Lib25..."
+checkNotInitialized "Lib25" InitFlag25.init
+printfn "Lib25.forceInit = %A" Lib25.forceInit
+checkInitialized "Lib25" InitFlag25.init
+//-----------------
+printfn "Touching value in module Lib26..."
+printfn "    --> Lib26.x = %A" Lib26.x
+printfn "Checking this did not cause initialization of module Lib26..."
+printfn "Touching a mutable value in module Lib26..."
+checkNotInitialized "Lib26" InitFlag26.init
+printfn "Lib26.forceInit = %A" Lib26.forceInit
+checkInitialized "Lib26" InitFlag26.init
+//-----------------
+printfn "Touching value in module Lib27..."
+printfn "    --> Lib27.x = %A" Lib27.x
+printfn "Checking this did not cause initialization of module Lib27..."
+printfn "Touching a mutable value in module Lib27..."
+checkNotInitialized "Lib27" InitFlag27.init
+printfn "Lib27.forceInit = %A" Lib27.forceInit
+checkInitialized "Lib27" InitFlag27.init
+//-----------------
+printfn "Touching value in module Lib28..."
+printfn "    --> Lib28.x = %A" Lib28.x
+printfn "Checking this did not cause initialization of module Lib28..."
+printfn "Touching a mutable value in module Lib28..."
+checkNotInitialized "Lib28" InitFlag28.init
+printfn "Lib28.forceInit = %A" Lib28.forceInit
+checkInitialized "Lib28" InitFlag28.init
+//-----------------
+printfn "Touching value in module Lib29..."
+printfn "    --> Lib29.x = %A" Lib29.x
+printfn "Checking this did not cause initialization of module Lib29..."
+printfn "Touching a mutable value in module Lib29..."
+checkNotInitialized "Lib29" InitFlag29.init
+printfn "Lib29.forceInit = %A" Lib29.forceInit
+checkInitialized "Lib29" InitFlag29.init
+//-----------------
+printfn "Touching value in module Lib30..."
+printfn "    --> Lib30.x = %A" Lib30.x
+printfn "Checking this did not cause initialization of module Lib30..."
+printfn "Touching a mutable value in module Lib30..."
+checkNotInitialized "Lib30" InitFlag30.init
+printfn "Lib30.forceInit = %A" Lib30.forceInit
+checkInitialized "Lib30" InitFlag30.init
+//-----------------
+printfn "Touching value in module Lib31..."
+printfn "    --> Lib31.x = %A" Lib31.x
+printfn "Checking this did not cause initialization of module Lib31..."
+printfn "Touching a mutable value in module Lib31..."
+checkNotInitialized "Lib31" InitFlag31.init
+printfn "Lib31.forceInit = %A" Lib31.forceInit
+checkInitialized "Lib31" InitFlag31.init
+//-----------------
+printfn "Touching value in module Lib32..."
+printfn "    --> Lib32.x = %A" Lib32.x
+printfn "Checking this did not cause initialization of module Lib32..."
+printfn "Touching a mutable value in module Lib32..."
+checkNotInitialized "Lib32" InitFlag32.init
+printfn "Lib32.forceInit = %A" Lib32.forceInit
+checkInitialized "Lib32" InitFlag32.init
+//-----------------
+printfn "Touching value in module Lib33..."
+printfn "    --> Lib33.x = %A" Lib33.x
+printfn "Checking this did not cause initialization of module Lib33..."
+printfn "Touching a mutable value in module Lib33..."
+checkNotInitialized "Lib33" InitFlag33.init
+printfn "Lib33.forceInit = %A" Lib33.forceInit
+checkInitialized "Lib33" InitFlag33.init
+//-----------------
+printfn "Touching value in module Lib34..."
+printfn "    --> Lib34.x = %A" Lib34.x
+printfn "Checking this did not cause initialization of module Lib34..."
+printfn "Touching a mutable value in module Lib34..."
+checkNotInitialized "Lib34" InitFlag34.init
+printfn "Lib34.forceInit = %A" Lib34.forceInit
+checkInitialized "Lib34" InitFlag34.init
+//-----------------
+printfn "Touching value in module Lib35..."
+printfn "    --> Lib35.x = %A" Lib35.x
+printfn "Checking this did not cause initialization of module Lib35..."
+printfn "Touching a mutable value in module Lib35..."
+checkNotInitialized "Lib35" InitFlag35.init
+printfn "Lib35.forceInit = %A" Lib35.forceInit
+checkInitialized "Lib35" InitFlag35.init
+//-----------------
+printfn "Touching value in module Lib36..."
+printfn "    --> Lib36.x = %A" Lib36.x
+printfn "Checking this did not cause initialization of module Lib36..."
+printfn "Touching a mutable value in module Lib36..."
+checkNotInitialized "Lib36" InitFlag36.init
+printfn "Lib36.forceInit = %A" Lib36.forceInit
+checkInitialized "Lib36" InitFlag36.init
+//-----------------
+printfn "Touching value in module Lib37..."
+printfn "    --> Lib37.x = %A" Lib37.x
+printfn "Checking this did not cause initialization of module Lib37..."
+printfn "Touching a mutable value in module Lib37..."
+checkNotInitialized "Lib37" InitFlag37.init
+printfn "Lib37.forceInit = %A" Lib37.forceInit
+checkInitialized "Lib37" InitFlag37.init
+//-----------------
+printfn "Touching value in module Lib38..."
+printfn "    --> Lib38.x = %A" Lib38.x
+printfn "Checking this did not cause initialization of module Lib38..."
+printfn "Touching a mutable value in module Lib38..."
+checkNotInitialized "Lib38" InitFlag38.init
+printfn "Lib38.forceInit = %A" Lib38.forceInit
+checkInitialized "Lib38" InitFlag38.init
+//-----------------
+printfn "Touching value in module Lib39..."
+printfn "    --> Lib39.x = %A" Lib39.x
+printfn "Checking this did not cause initialization of module Lib39..."
+printfn "Touching a mutable value in module Lib39..."
+checkNotInitialized "Lib39" InitFlag39.init
+printfn "Lib39.forceInit = %A" Lib39.forceInit
+checkInitialized "Lib39" InitFlag39.init
+//-----------------
+printfn "Touching value in module Lib40..."
+printfn "    --> Lib40.x = %A" Lib40.x
+printfn "Checking this did not cause initialization of module Lib40..."
+printfn "Touching a mutable value in module Lib40..."
+checkNotInitialized "Lib40" InitFlag40.init
+printfn "Lib40.forceInit = %A" Lib40.forceInit
+checkInitialized "Lib40" InitFlag40.init
+//-----------------
+printfn "Touching value in module Lib41..."
+printfn "    --> Lib41.x = %A" Lib41.x
+printfn "Checking this did not cause initialization of module Lib41..."
+printfn "Touching a mutable value in module Lib41..."
+checkNotInitialized "Lib41" InitFlag41.init
+printfn "Lib41.forceInit = %A" Lib41.forceInit
+checkInitialized "Lib41" InitFlag41.init
+//-----------------
+printfn "Touching value in module Lib42..."
+printfn "    --> Lib42.x = %A" Lib42.x
+printfn "Checking this did not cause initialization of module Lib42..."
+printfn "Touching a mutable value in module Lib42..."
+checkNotInitialized "Lib42" InitFlag42.init
+printfn "Lib42.forceInit = %A" Lib42.forceInit
+checkInitialized "Lib42" InitFlag42.init
+//-----------------
+printfn "Touching value in module Lib43..."
+printfn "    --> Lib43.x = %A" Lib43.x
+printfn "Checking this did not cause initialization of module Lib43..."
+printfn "Touching a mutable value in module Lib43..."
+checkNotInitialized "Lib43" InitFlag43.init
+printfn "Lib43.forceInit = %A" Lib43.forceInit
+checkInitialized "Lib43" InitFlag43.init
+//-----------------
+printfn "Touching value in module Lib44..."
+printfn "    --> Lib44.x = %A" Lib44.x
+printfn "Checking this did not cause initialization of module Lib44..."
+printfn "Touching a mutable value in module Lib44..."
+checkNotInitialized "Lib44" InitFlag44.init
+printfn "Lib44.forceInit = %A" Lib44.forceInit
+checkInitialized "Lib44" InitFlag44.init
+//-----------------
+printfn "Touching value in module Lib45..."
+printfn "    --> Lib45.x = %A" Lib45.x
+printfn "Checking this did not cause initialization of module Lib45..."
+printfn "Touching a mutable value in module Lib45..."
+checkNotInitialized "Lib45" InitFlag45.init
+printfn "Lib45.forceInit = %A" Lib45.forceInit
+checkInitialized "Lib45" InitFlag45.init
+//-----------------
+printfn "Touching value in module Lib46..."
+printfn "    --> Lib46.x = %A" Lib46.x
+printfn "Checking this did not cause initialization of module Lib46..."
+printfn "Touching a mutable value in module Lib46..."
+checkNotInitialized "Lib46" InitFlag46.init
+printfn "Lib46.forceInit = %A" Lib46.forceInit
+checkInitialized "Lib46" InitFlag46.init
+//-----------------
+printfn "Touching value in module Lib47..."
+printfn "    --> Lib47.x = %A" Lib47.x
+printfn "Checking this did not cause initialization of module Lib47..."
+printfn "Touching a mutable value in module Lib47..."
+checkNotInitialized "Lib47" InitFlag47.init
+printfn "Lib47.forceInit = %A" Lib47.forceInit
+checkInitialized "Lib47" InitFlag47.init
+//-----------------
+printfn "Touching value in module Lib48..."
+printfn "    --> Lib48.x = %A" Lib48.x
+printfn "Checking this did not cause initialization of module Lib48..."
+printfn "Touching a mutable value in module Lib48..."
+checkNotInitialized "Lib48" InitFlag48.init
+printfn "Lib48.forceInit = %A" Lib48.forceInit
+checkInitialized "Lib48" InitFlag48.init
+//-----------------
+printfn "Touching value in module Lib49..."
+printfn "    --> Lib49.x = %A" Lib49.x
+printfn "Checking this did not cause initialization of module Lib49..."
+printfn "Touching a mutable value in module Lib49..."
+checkNotInitialized "Lib49" InitFlag49.init
+printfn "Lib49.forceInit = %A" Lib49.forceInit
+checkInitialized "Lib49" InitFlag49.init
+//-----------------
+printfn "Touching value in module Lib50..."
+printfn "    --> Lib50.x = %A" Lib50.x
+printfn "Checking this did not cause initialization of module Lib50..."
+printfn "Touching a mutable value in module Lib50..."
+checkNotInitialized "Lib50" InitFlag50.init
+printfn "Lib50.forceInit = %A" Lib50.forceInit
+checkInitialized "Lib50" InitFlag50.init
+//-----------------
+printfn "Touching value in module Lib51..."
+printfn "    --> Lib51.x = %A" Lib51.x
+printfn "Checking this did not cause initialization of module Lib51..."
+printfn "Touching a mutable value in module Lib51..."
+checkNotInitialized "Lib51" InitFlag51.init
+printfn "Lib51.forceInit = %A" Lib51.forceInit
+checkInitialized "Lib51" InitFlag51.init
+//-----------------
+printfn "Touching value in module Lib52..."
+printfn "    --> Lib52.x = %A" Lib52.x
+printfn "Checking this did not cause initialization of module Lib52..."
+printfn "Touching a mutable value in module Lib52..."
+checkNotInitialized "Lib52" InitFlag52.init
+printfn "Lib52.forceInit = %A" Lib52.forceInit
+checkInitialized "Lib52" InitFlag52.init
+//-----------------
+printfn "Touching value in module Lib53..."
+printfn "    --> Lib53.x = %A" Lib53.x
+printfn "Checking this did not cause initialization of module Lib53..."
+printfn "Touching a mutable value in module Lib53..."
+checkNotInitialized "Lib53" InitFlag53.init
+printfn "Lib53.forceInit = %A" Lib53.forceInit
+checkInitialized "Lib53" InitFlag53.init
+//-----------------
+printfn "Touching value in module Lib54..."
+printfn "    --> Lib54.x = %A" Lib54.x
+printfn "Checking this did not cause initialization of module Lib54..."
+printfn "Touching a mutable value in module Lib54..."
+checkNotInitialized "Lib54" InitFlag54.init
+printfn "Lib54.forceInit = %A" Lib54.forceInit
+checkInitialized "Lib54" InitFlag54.init
+//-----------------
+printfn "Touching value in module Lib55..."
+printfn "    --> Lib55.x = %A" Lib55.x
+printfn "Checking this did not cause initialization of module Lib55..."
+printfn "Touching a mutable value in module Lib55..."
+checkNotInitialized "Lib55" InitFlag55.init
+printfn "Lib55.forceInit = %A" Lib55.forceInit
+checkInitialized "Lib55" InitFlag55.init
+//-----------------
+printfn "Touching value in module Lib56..."
+printfn "    --> Lib56.x = %A" Lib56.x
+printfn "Checking this did not cause initialization of module Lib56..."
+printfn "Touching a mutable value in module Lib56..."
+checkNotInitialized "Lib56" InitFlag56.init
+printfn "Lib56.forceInit = %A" Lib56.forceInit
+checkInitialized "Lib56" InitFlag56.init
+//-----------------
+printfn "Touching value in module Lib57..."
+printfn "    --> Lib57.x = %A" Lib57.x
+printfn "Checking this did not cause initialization of module Lib57..."
+printfn "Touching a mutable value in module Lib57..."
+checkNotInitialized "Lib57" InitFlag57.init
+printfn "Lib57.forceInit = %A" Lib57.forceInit
+checkInitialized "Lib57" InitFlag57.init
+//-----------------
+printfn "Touching value in module Lib58..."
+printfn "    --> Lib58.x = %A" Lib58.x
+printfn "Checking this did cause initialization of module Lib58..."
+checkInitialized "Lib58" InitFlag58.init
+//-----------------
+printfn "Touching value in module Lib59..."
+printfn "    --> Lib59.x = %A" Lib59.x
+printfn "Checking this did cause initialization of module Lib59..."
+checkInitialized "Lib59" InitFlag59.init
+//-----------------
+printfn "Touching value in module Lib60..."
+printfn "    --> Lib60.x = %A" Lib60.x
+printfn "Checking this did cause initialization of module Lib60..."
+checkInitialized "Lib60" InitFlag60.init
+//-----------------
+printfn "Touching value in module Lib61..."
+printfn "    --> Lib61.x = %A" Lib61.x
+printfn "Checking this did cause initialization of module Lib61..."
+checkInitialized "Lib61" InitFlag61.init
+//-----------------
+printfn "Touching value in module Lib62..."
+printfn "    --> Lib62.x = %A" Lib62.x
+printfn "Checking this did cause initialization of module Lib62..."
+checkInitialized "Lib62" InitFlag62.init
+//-----------------
+printfn "Touching value in module Lib63..."
+printfn "    --> Lib63.x = %A" Lib63.x
+printfn "Checking this did cause initialization of module Lib63..."
+checkInitialized "Lib63" InitFlag63.init
+//-----------------
+printfn "Touching value in module Lib64..."
+printfn "    --> Lib64.x = %A" Lib64.x
+printfn "Checking this did cause initialization of module Lib64..."
+checkInitialized "Lib64" InitFlag64.init
+//-----------------
+printfn "Touching value in module Lib65..."
+printfn "    --> Lib65.x = %A" Lib65.x
+printfn "Checking this did cause initialization of module Lib65..."
+checkInitialized "Lib65" InitFlag65.init
+//-----------------
+printfn "Touching value in module Lib66..."
+printfn "    --> Lib66.x = %A" Lib66.x
+printfn "Checking this did cause initialization of module Lib66..."
+checkInitialized "Lib66" InitFlag66.init
+//-----------------
+printfn "Touching value in module Lib67..."
+printfn "    --> Lib67.x = %A" Lib67.x
+printfn "Checking this did cause initialization of module Lib67..."
+checkInitialized "Lib67" InitFlag67.init
+//-----------------
+printfn "Touching value in module Lib68..."
+printfn "    --> Lib68.x = %A" Lib68.x
+printfn "Checking this did cause initialization of module Lib68..."
+checkInitialized "Lib68" InitFlag68.init
+//-----------------
+printfn "Touching value in module Lib69..."
+printfn "    --> Lib69.x = %A" Lib69.x
+printfn "Checking this did cause initialization of module Lib69..."
+checkInitialized "Lib69" InitFlag69.init
+//-----------------
+printfn "Touching value in module Lib70..."
+printfn "    --> Lib70.x = %A" Lib70.x
+printfn "Checking this did cause initialization of module Lib70..."
+checkInitialized "Lib70" InitFlag70.init
+//-----------------
+printfn "Touching value in module Lib71..."
+printfn "    --> Lib71.x = %A" Lib71.x
+printfn "Checking this did cause initialization of module Lib71..."
+checkInitialized "Lib71" InitFlag71.init
+//-----------------
+printfn "Touching value in module Lib72..."
+printfn "    --> Lib72.x = %A" Lib72.x
+printfn "Checking this did cause initialization of module Lib72..."
+checkInitialized "Lib72" InitFlag72.init
+//-----------------
+printfn "Touching value in module Lib73..."
+printfn "    --> Lib73.x = %A" Lib73.x
+printfn "Checking this did cause initialization of module Lib73..."
+checkInitialized "Lib73" InitFlag73.init
+//-----------------
+printfn "Touching value in module Lib74..."
+printfn "    --> Lib74.x = %A" Lib74.x
+printfn "Checking this did cause initialization of module Lib74..."
+checkInitialized "Lib74" InitFlag74.init
+//-----------------
+printfn "Touching value in module Lib75..."
+printfn "    --> Lib75.x = %A" Lib75.x
+printfn "Checking this did cause initialization of module Lib75..."
+checkInitialized "Lib75" InitFlag75.init
+//-----------------
+printfn "Touching value in module Lib76..."
+printfn "    --> Lib76.x = %A" Lib76.x
+printfn "Checking this did cause initialization of module Lib76..."
+checkInitialized "Lib76" InitFlag76.init
+//-----------------
+printfn "Touching value in module Lib77..."
+printfn "    --> Lib77.x = %A" Lib77.x
+printfn "Checking this did cause initialization of module Lib77..."
+checkInitialized "Lib77" InitFlag77.init
+//-----------------
+printfn "Touching value in module Lib78..."
+printfn "    --> Lib78.x = %A" Lib78.x
+printfn "Checking this did cause initialization of module Lib78..."
+checkInitialized "Lib78" InitFlag78.init
+//-----------------
+printfn "Touching value in module Lib79..."
+printfn "    --> Lib79.x = %A" Lib79.x
+printfn "Checking this did cause initialization of module Lib79..."
+checkInitialized "Lib79" InitFlag79.init
+//-----------------
+printfn "Touching value in module Lib80..."
+printfn "    --> Lib80.x = %A" Lib80.x
+printfn "Checking this did cause initialization of module Lib80..."
+checkInitialized "Lib80" InitFlag80.init
+//-----------------
+printfn "Touching value in module Lib81..."
+printfn "    --> Lib81.x = %A" Lib81.x
+printfn "Checking this did cause initialization of module Lib81..."
+checkInitialized "Lib81" InitFlag81.init
+//-----------------
+printfn "Touching value in module Lib82..."
+printfn "    --> Lib82.x = %A" Lib82.x
+printfn "Checking this did cause initialization of module Lib82..."
+checkInitialized "Lib82" InitFlag82.init
+//-----------------
+printfn "Touching value in module Lib83..."
+printfn "    --> Lib83.x = %A" Lib83.x
+printfn "Checking this did cause initialization of module Lib83..."
+checkInitialized "Lib83" InitFlag83.init
+//-----------------
+printfn "Touching value in module Lib84..."
+printfn "    --> Lib84.x = %A" Lib84.x
+printfn "Checking this did cause initialization of module Lib84..."
+checkInitialized "Lib84" InitFlag84.init
+//-----------------
+printfn "Touching value in module Lib85..."
+printfn "    --> Lib85.x = %A" Lib85.x
+printfn "Checking this did cause initialization of module Lib85..."
+checkInitialized "Lib85" InitFlag85.init
+System.IO.File.WriteAllText("test.ok","ok")
+exit 0
diff --git a/tests/fsharp/core/unicode/build.bat b/tests/fsharp/core/unicode/build.bat
new file mode 100644
index 0000000..59552b9
--- /dev/null
+++ b/tests/fsharp/core/unicode/build.bat
@@ -0,0 +1,52 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+call %~d0%~p0..\..\single-test-build.bat
+ at if ERRORLEVEL 1 goto Error
+
+REM just checking the files actually parse/compile for now....
+
+"%FSC%" %fsc_flags% -a -o:kanji-unicode-utf8-nosig-codepage-65001.dll -g kanji-unicode-utf8-nosig-codepage-65001.fs
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:kanji-unicode-utf8-nosig-codepage-65001.dll -g kanji-unicode-utf8-nosig-codepage-65001.fs
+ at if ERRORLEVEL 1 goto Error
+
+REM check non-utf8 and --codepage flag for bootstrapped fsc.exe
+if NOT "%FSC:fscp=X%" == "%FSC%" ( 
+  "%FSC%" %fsc_flags% -a -o:kanji-unicode-utf16.dll -g kanji-unicode-utf16.fs
+  @if ERRORLEVEL 1 goto Error
+
+  "%FSC%" %fsc_flags% -a --codepage:65000 -o:kanji-unicode-utf7-codepage-65000.dll -g kanji-unicode-utf7-codepage-65000.fs
+  @if ERRORLEVEL 1 goto Error
+
+)
+"%FSC%" %fsc_flags% -a -o:kanji-unicode-utf8-withsig-codepage-65001.dll -g kanji-unicode-utf8-withsig-codepage-65001.fs
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/unicode/dont.pipe.to.stdin b/tests/fsharp/core/unicode/dont.pipe.to.stdin
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/fsharp/core/unicode/dont.pipe.to.stdin
@@ -0,0 +1 @@
+
diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf16.fs b/tests/fsharp/core/unicode/kanji-unicode-utf16.fs
new file mode 100644
index 0000000..0768afa
Binary files /dev/null and b/tests/fsharp/core/unicode/kanji-unicode-utf16.fs differ
diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs b/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs
new file mode 100644
index 0000000..6bf89cf
--- /dev/null
+++ b/tests/fsharp/core/unicode/kanji-unicode-utf7-codepage-65000.fs
@@ -0,0 +1,5 @@
+module Kanjii
+let +AF8- +AD0-
+    System.Console.WriteLine +ACJvIgAi-
+do exit 0
+    
\ No newline at end of file
diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs b/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs
new file mode 100644
index 0000000..01eb920
--- /dev/null
+++ b/tests/fsharp/core/unicode/kanji-unicode-utf8-nosig-codepage-65001.fs
@@ -0,0 +1,5 @@
+module Kanji
+let _ = stdout.WriteLine "漢"
+let f a c vef e =  stdout.WriteLine "漢"; a c vef e 
+
+do exit 0
diff --git a/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs b/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs
new file mode 100644
index 0000000..ab81cb4
--- /dev/null
+++ b/tests/fsharp/core/unicode/kanji-unicode-utf8-withsig-codepage-65001.fs
@@ -0,0 +1,5 @@
+module Kanjii
+let _ = stdout.WriteLine "漢"
+let f a c vef e =  stdout.WriteLine "漢"; a c vef e 
+
+do exit 0
diff --git a/tests/fsharp/core/unicode/out.bsl b/tests/fsharp/core/unicode/out.bsl
new file mode 100644
index 0000000..6d8eed1
--- /dev/null
+++ b/tests/fsharp/core/unicode/out.bsl
@@ -0,0 +1 @@
+©≠
\ No newline at end of file
diff --git a/tests/fsharp/core/unicode/run.bat b/tests/fsharp/core/unicode/run.bat
new file mode 100644
index 0000000..1bd59ec
--- /dev/null
+++ b/tests/fsharp/core/unicode/run.bat
@@ -0,0 +1,55 @@
+ at if "%_echo%"=="" echo off
+
+echo on
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+ at if ErrorLEVEL 1 goto :Error
+
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --utf8output kanji-unicode-utf8-nosig-codepage-65001.fs
+   IF ERRORLEVEL 1 goto :Error
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --utf8output --codepage:65001 kanji-unicode-utf8-withsig-codepage-65001.fs
+   IF ERRORLEVEL 1 goto :Error
+
+REM  if exist test.ok (del /f /q test.ok)
+REM  "%FSI%" %fsi_flags% --utf8output --codepage:65001 < kanji-unicode-utf8-withsig-codepage-65001.fs
+REM   IF ERRORLEVEL 1 goto :Error
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --utf8output kanji-unicode-utf8-withsig-codepage-65001.fs
+   IF ERRORLEVEL 1 goto :Error
+
+
+REM  if exist test.ok (del /f /q test.ok)
+REM  "%FSI%" %fsi_flags% --utf8output < kanji-unicode-utf8-withsig-codepage-65001.fs
+REM   IF ERRORLEVEL 1 goto :Error
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --utf8output --codepage:65000  kanji-unicode-utf7-codepage-65000.fs
+   IF ERRORLEVEL 1 goto :Error
+
+REM  if exist test.ok (del /f /q test.ok)
+REM  "%FSI%" %fsi_flags% --utf8output --codepage:65000  < kanji-unicode-utf7-codepage-65000.fs
+REM   IF ERRORLEVEL 1 goto :Error
+
+  if exist test.ok (del /f /q test.ok)
+  "%FSI%" %fsi_flags% --utf8output kanji-unicode-utf16.fs
+   IF ERRORLEVEL 1 goto :Error
+
+
+REM  if exist test.ok (del /f /q test.ok)
+REM  "%FSI%" %fsi_flags% --utf8output < kanji-unicode-utf16.fs
+REM   IF ERRORLEVEL 1 goto :Error
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ErrorLEVEL%
+
+:Error
+endlocal
+exit /b %ErrorLEVEL%
+
diff --git a/tests/fsharp/core/unicode/test.fsx b/tests/fsharp/core/unicode/test.fsx
new file mode 100644
index 0000000..89c67a0
--- /dev/null
+++ b/tests/fsharp/core/unicode/test.fsx
@@ -0,0 +1,144 @@
+// #Conformance #Globalization 
+#if Portable
+module Core_unicode
+#endif
+let failures = ref false
+let reportFailure s  = 
+  stderr.WriteLine ("NO: "+s); failures := true
+
+(* TEST SUITE FOR UNICODE CHARS *)
+
+
+
+#if NetCore
+#else
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+#endif
+
+#if Portable
+#else
+let input_byte (x : System.IO.FileStream) = 
+    let b = x.ReadByte() 
+    if b = -1 then raise (System.IO.EndOfStreamException()) else b
+
+let test2925 () = 
+  printfn "test2925...";
+  (* This writes a file in the standard utf8 encoding.  Probably needs to be adjusted if default encodings differ *)
+  let os = new System.IO.StreamWriter("out1.txt", false, System.Text.Encoding.UTF8) in
+  os.Write "\u00a9"; (* copyright *)
+  os.Write "\u2260"; (* not equals *)
+  os.Close();
+  use is1 = System.IO.File.OpenRead "out1.txt" in 
+  use is2 = System.IO.File.OpenRead "out.bsl" in 
+  try 
+    while true do 
+      let c2 = input_byte is2 in 
+      let c1 = try input_byte is1 with :? System.IO.EndOfStreamException -> reportFailure "end of file reached"; 0 in 
+      if c1 <> c2 then reportFailure "test3732: file contents differ";
+    done;
+  with :? System.IO.EndOfStreamException -> 
+    is1.Close();
+    is2.Close();
+    ()
+
+let _ = test2925 ()
+
+let test2925b () = 
+  printfn "test2925b...";
+  (* This writes a file in the standard utf8 encoding.  Probably needs to be adjusted if default encodings differ *)
+  let os = new System.IO.StreamWriter("out1.txt", false, System.Text.Encoding.UTF8) in
+  os.Write "\U000000a9"; (* copyright *)
+  os.Write "\U00002260"; (* not equals *)
+  os.Close();
+  let is1 = System.IO.File.OpenRead "out1.txt" in 
+  let is2 = System.IO.File.OpenRead "out.bsl" in 
+  try 
+    while true do 
+      let c2 = input_byte is2 in 
+      let c1 = try input_byte is1 with :? System.IO.EndOfStreamException -> reportFailure "end of file reached"; 0 in 
+      if c1 <> c2 then reportFailure "test373289: file contents differ";
+    done;
+  with :? System.IO.EndOfStreamException -> 
+    is1.Close();
+    is2.Close();
+    ()
+
+let _ = test2925b ()
+
+let test2926 () = 
+  printfn "test2926...";
+  (* This writes a file in the standard utf8 encoding.  Probably needs to be adjusted if default encodings differ *)
+  let os = new System.IO.StreamWriter("out2.txt", false, System.Text.Encoding.UTF8) in
+  let s = "©≠" in   (* <<<<<  UNICODE STRING for "\u00a9\u2260" HERE!!! *)
+  os.Write s;
+  Printf.printf "length s = %d\n" (String.length s);
+  os.Close();
+  let is1 = System.IO.File.OpenRead "out2.txt" in 
+  let is2 = System.IO.File.OpenRead "out.bsl" in 
+  try 
+    while true do 
+      let c2 = input_byte is2 in 
+      let c1 = try input_byte is1 with :? System.IO.EndOfStreamException -> reportFailure "end of file reached"; 0 in 
+      if c1 <> c2 then reportFailure (sprintf "test37d2392: file contents differ, got '%x', expected '%x'" c1 c2);
+    done;
+  with :? System.IO.EndOfStreamException -> 
+    is1.Close();
+    is2.Close();
+    ()
+
+let _ = test2926 ()
+
+
+let test2927 () = 
+  printfn "test2927...";
+  (* This writes a unicode string to stdout using the encoding in System.Console.OutputEncoding.  *)
+  let s = "©≠" in   (* <<<<<  UNICODE STRING for "\u00a9\u2260" HERE!!! *)
+  stdout.WriteLine s
+
+let _ = test2927 ()
+
+let test2928 () = 
+  printfn "test2928...";
+  (* This writes a file in the default encoding. *)
+  let os = new System.IO.StreamWriter("out3.txt", false, System.Text.Encoding.UTF8) in
+  let s = "©≠" in   (* <<<<<  UNICODE STRING for "\u00a9\u2260" HERE!!! *)
+  os.Write s;
+  os.Close()
+
+
+
+let _ = test2928 ()
+#endif
+
+let test2929 () = 
+  printfn "test2929...";
+  let s = "©≠" in   (* <<<<<  UNICODE STRING for "\u00a9\u2260" HERE!!! *)
+  if (Printf.sprintf "%s" s <> s) then reportFailure "sprintf did not roundtrip (1)";
+  if (Printf.sprintf "©≠" <> s) then reportFailure "sprintf did not roundtrip (2)"
+
+let _ = test2929 ()
+
+
+let ÄËÖÏÜâæçñõö = 3 + 4
+
+let МНОПРСТУФХЦẀẁẂќ = 5 + 6
+
+let αβΛΘΩΨΧΣδζȚŶǺ = 22/7
+
+let π = 3.1415
+
+let aa =
+  if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
\ No newline at end of file
diff --git a/tests/fsharp/core/unicode/utf8source.ml b/tests/fsharp/core/unicode/utf8source.ml
new file mode 100644
index 0000000..1350938
--- /dev/null
+++ b/tests/fsharp/core/unicode/utf8source.ml
@@ -0,0 +1,8 @@
+let â = 3 + 4
+
+let ãä = 3 + â
+
+let åçèë = ãä + ãä
+
+
+
diff --git a/tests/fsharp/core/verify/build.bat b/tests/fsharp/core/verify/build.bat
new file mode 100644
index 0000000..ddd73e6
--- /dev/null
+++ b/tests/fsharp/core/verify/build.bat
@@ -0,0 +1,78 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+"%PEVERIFY%" "%FSCOREDLLPATH%"
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" %FSCBinPath%\FSharp.Build.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+
+  REM Use /MD because this contains some P/Invoke code  
+  "%PEVERIFY%" /MD %FSCBinPath%\FSharp.Compiler.dll
+  @if ERRORLEVEL 1 goto Error
+
+  REM Use /MD because this contains some P/Invoke code  
+  "%PEVERIFY%" /MD %FSCBinPath%\FSharp.LanguageService.dll
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" %FSCBinPath%\FSharp.ProjectSystem.Base.dll
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" %FSCBinPath%\FSharp.ProjectSystem.dll
+  @if ERRORLEVEL 1 goto Error
+
+
+  "%PEVERIFY%" %FSCBinPath%\fsi.exe
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" %FSCBinPath%\FSharp.Compiler.Server.Shared.dll
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" %FSCBinPath%\FSharp.Compiler.Interactive.Settings.dll
+  @if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" /MD %FSCBinPath%\FSharp.VisualStudio.Session.dll
+  @if ERRORLEVEL 1 goto Error
+
+  REM Skipping remainder of test for FSI.EXE
+  goto Ok
+
+)
+
+"%FSC%" %fsc_flags% -o:xmlverify.exe -g xmlverify.fs
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" xmlverify.exe
+ at if ERRORLEVEL 1 goto Error
+
+REM == Calc correct path to FSharp.Core.dll no matter what arch we are on
+call :SetFSCoreXMLPath "%FSCOREDLLPATH%"
+
+%CLIX% xmlverify.exe "%FSHARPCOREXML%"
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Passed fsharp %~f0 ok.
+echo > build.ok
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetFSCoreXMLPath
+set FSHARPCOREXML=%~dpn1.xml
+goto :EOF
diff --git a/tests/fsharp/core/verify/run.bat b/tests/fsharp/core/verify/run.bat
new file mode 100644
index 0000000..c7fa3a7
--- /dev/null
+++ b/tests/fsharp/core/verify/run.bat
@@ -0,0 +1,30 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+goto Skip
+
+call %~d0%~p0..\..\..\config.bat
+if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/core/verify/xmlverify.fs b/tests/fsharp/core/verify/xmlverify.fs
new file mode 100644
index 0000000..69a87ab
--- /dev/null
+++ b/tests/fsharp/core/verify/xmlverify.fs
@@ -0,0 +1,12 @@
+// #Conformance 
+open System.Xml
+
+try
+   let doc = new XmlDocument() 
+   let file = System.Environment.GetCommandLineArgs().[1]
+   printf "Testing %s..." file
+   doc.Load(file)
+   printfn "OK!"
+with 
+   | e -> printfn "ERROR LOADING XML!: %A" e.Message
+          exit 1
diff --git a/tests/fsharp/optimize/analyses/build.bat b/tests/fsharp/optimize/analyses/build.bat
new file mode 100644
index 0000000..f5241f6
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/build.bat
@@ -0,0 +1,72 @@
+if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if not "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  ECHO Skipping test for FSI.EXE
+  goto Skip
+)
+
+rem recall  >fred.txt 2>&1 merges stderr into the stdout redirect
+rem however 2>&1  >fred.txt did not seem to do it.
+
+echo == FunctionSizes
+"%FSC%" %fsc_flags% --nologo -O --test:FunctionSizes sizes.fs >sizes.FunctionSizes.output.test.txt 2>&1
+echo == TotalSizes
+"%FSC%" %fsc_flags% --nologo -O --test:TotalSizes sizes.fs >sizes.TotalSizes.output.test.txt 2>&1
+echo == HasEffect
+"%FSC%" %fsc_flags% --nologo -O --test:HasEffect effects.fs >effects.HasEffect.output.test.txt 2>&1
+echo == NoNeedToTailcall
+"%FSC%" %fsc_flags% --nologo -O --test:NoNeedToTailcall tailcalls.fs >tailcalls.NoNeedToTailcall.output.test.txt 2>&1
+
+
+if NOT EXIST sizes.FunctionSizes.output.test.bsl COPY sizes.FunctionSizes.output.test.txt sizes.FunctionSizes.output.test.bsl
+if NOT EXIST sizes.TotalSizes.output.test.bsl COPY sizes.TotalSizes.output.test.txt sizes.TotalSizes.output.test.bsl
+if NOT EXIST effects.HasEffect.output.test.bsl COPY effects.HasEffect.output.test.txt effects.HasEffect.output.test.bsl
+if NOT EXIST tailcalls.NoNeedToTailcall.output.test.bsl COPY tailcalls.NoNeedToTailcall.output.test.txt tailcalls.NoNeedToTailcall.output.test.bsl
+
+%FSDIFF% sizes.FunctionSizes.output.test.txt sizes.FunctionSizes.output.test.bsl > sizes.FunctionSizes.output.test.diff
+%FSDIFF% sizes.TotalSizes.output.test.txt sizes.TotalSizes.output.test.bsl > sizes.TotalSizes.output.test.diff
+%FSDIFF% effects.HasEffect.output.test.txt effects.HasEffect.output.test.bsl > effects.HasEffect.output.test.diff
+%FSDIFF% tailcalls.NoNeedToTailcall.output.test.txt tailcalls.NoNeedToTailcall.output.test.bsl > tailcalls.NoNeedToTailcall.output.test.diff
+
+echo ======== Differences From ========
+TYPE sizes.FunctionSizes.output.test.diff
+TYPE sizes.TotalSizes.output.test.diff
+TYPE effects.HasEffect.output.test.diff
+TYPE tailcalls.NoNeedToTailcall.output.test.diff
+echo ========= Differences To =========
+
+TYPE sizes.FunctionSizes.output.test.diff > zz.alldiffs
+TYPE sizes.TotalSizes.output.test.diff >> zz.alldiffs
+TYPE effects.HasEffect.output.test.diff >> zz.alldiffs
+TYPE tailcalls.NoNeedToTailcall.output.test.diff >> zz.alldiffs
+
+for /f %%c IN (zz.alldiffs) do (
+  echo NOTE -------------------------------------
+  echo NOTE ---------- THERE ARE DIFFs ----------
+  echo NOTE -------------------------------------
+  goto Error
+)
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/optimize/analyses/effects.HasEffect.output.test.bsl b/tests/fsharp/optimize/analyses/effects.HasEffect.output.test.bsl
new file mode 100644
index 0000000..247aa52
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/effects.HasEffect.output.test.bsl
@@ -0,0 +1,50 @@
+function constantUnit at line 5 causes no side effects
+function constantInteger at line 6 causes no side effects
+function constantValue at line 7 causes no side effects
+function fieldLookup1 at line 8 causes side effects or may not terminate
+function libraryCall1 at line 9 causes side effects or may not terminate
+function libraryCall2 at line 10 causes side effects or may not terminate
+function constantData1 at line 11 causes no side effects
+function constantData2 at line 12 causes no side effects
+function constantTuple1 at line 13 causes no side effects
+function constantTuple2 at line 14 causes no side effects
+function indirectCall1 at line 16 causes side effects or may not terminate
+function indirectCall2 at line 17 causes side effects or may not terminate
+function indirectCall3 at line 18 causes side effects or may not terminate
+function sequenceOfIndirectCalls1 at line 19 causes side effects or may not terminate
+function ifThenElse at line 20 causes no side effects
+function patternMatch1 at line 21 causes no side effects
+function forLoop1 at line 22 causes side effects or may not terminate
+function whileLoop1 at line 23 causes side effects or may not terminate
+function indirectCallInNonTailcallPosition at line 27 causes side effects or may not terminate
+function infiniteLoop at line 29 causes side effects or may not terminate
+function genericInfiniteLoop at line 30 causes side effects or may not terminate
+function callInfiniteLoop at line 31 causes side effects or may not terminate
+function infiniteLoop2 at line 32 causes side effects or may not terminate
+function callGenericInfiniteLoop at line 33 causes side effects or may not terminate
+function loopViaModuleFunction1 at line 35 causes side effects or may not terminate
+function loopViaModuleFunction at line 38 causes side effects or may not terminate
+function loop at line 43 causes side effects or may not terminate
+function loopViaInnerFunction at line 41 causes side effects or may not terminate
+function simpleLibraryUse1 at line 46 causes side effects or may not terminate
+function simpleLibraryCall2 at line 47 causes side effects or may not terminate
+function simpleLibraryCall3 at line 48 causes side effects or may not terminate
+function simpleLibraryCall4 at line 49 causes side effects or may not terminate
+function simpleLibraryCall5 at line 50 causes side effects or may not terminate
+function simpleLibraryCall6 at line 52 causes side effects or may not terminate
+function simpleLibraryCall7 at line 53 causes side effects or may not terminate
+function simpleLibraryCall8 at line 54 causes side effects or may not terminate
+function simpleLibraryCall9 at line 55 causes side effects or may not terminate
+function simpleLibraryCall10 at line 57 causes side effects or may not terminate
+function simpleLibraryCall11 at line 58 causes side effects or may not terminate
+function simpleLibraryCall12 at line 59 causes side effects or may not terminate
+function simpleLibraryCall13 at line 60 causes side effects or may not terminate
+function simpleLibraryUse14 at line 61 causes no side effects
+function simpleLibraryUse15 at line 62 causes no side effects
+function simpleLibraryUse16 at line 63 causes no side effects
+function simpleLibraryUse17 at line 64 causes side effects or may not terminate
+function simpleLibraryUse18 at line 65 causes side effects or may not terminate
+function simpleLibraryUse19 at line 66 causes side effects or may not terminate
+function complexDataAnalysisFunction at line 73 causes no side effects
+function complexDataConstructionFunction at line 81 causes side effects or may not terminate
+function veryComplexDataConstructionFunction at line 90 causes side effects or may not terminate
diff --git a/tests/fsharp/optimize/analyses/effects.fs b/tests/fsharp/optimize/analyses/effects.fs
new file mode 100644
index 0000000..640e914
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/effects.fs
@@ -0,0 +1,118 @@
+
+open System
+
+module BasicSizeTests = 
+    let constantUnit () = ()           // note, size 0 - seems reasonable 
+    let constantInteger () = 1         // note, size 0 - seems reasonable 
+    let constantValue x = x            // note, size 1 - seems reasonable (this may be a field lookup to access an environment variable)
+    let fieldLookup1 x = x.contents   // note, size 2 - seems reasonable 
+    let libraryCall1 x = System.Console.WriteLine(x:string) // size 2, seems reasonable
+    let libraryCall2 x = new System.Object() // size 1, seems reasonable
+    let constantData1 () = Some 1      // note, size 2, seems reasonable, perhaps too low
+    let constantData2 () = None        // note, size 2, seems reasonable, perhaps too high 
+    let constantTuple1 () = (1,2)      // note, size 1, seems reasonable, perhaps too low
+    let constantTuple2 () = (1,2,3,4)  // note, size 1, seems reasonable, perhaps too low
+
+    let indirectCall1 f = f()          // note, size 1, seems reasonable
+    let indirectCall2 f x = f x        // note, size 2, seems reasonable
+    let indirectCall3 f x y = f x y    // note, size 3, seems reasonable
+    let sequenceOfIndirectCalls1 f x = f x; f x  // note, size 4 = 2 + 2
+    let ifThenElse x  = if x then 1 else 2  // note, size 5, seems reasonable
+    let patternMatch1 x  = match x with 1 -> 2 | 2 -> 1 | _ -> 3 // note, size 8, seems reasonable
+    let forLoop1 f x  = for i = 1 to 5 do f () // note, size 7, seems reasonable
+    let whileLoop1 f x  = while true do f () // note, size 6, seems reasonable
+
+module BasicAnalysisTests = 
+
+    let indirectCallInNonTailcallPosition f x y = f x y; 1+2  
+
+    let rec infiniteLoop (x:int) : int = infiniteLoop x
+    let rec genericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x
+    let callInfiniteLoop (x:int) : int = infiniteLoop x
+    let rec infiniteLoop2 (x1:int) (x2:int) : int = infiniteLoop2 x1 x2
+    let callGenericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x
+
+    let rec loopViaModuleFunction1 (f: 'T -> bool) (arr:array<'T>) i =
+        loopViaModuleFunction1 f arr (i+1)
+
+    let rec loopViaModuleFunction (f: 'T -> bool) (arr:array<'T>) i =
+        i >= arr.Length || (f arr.[i] && loopViaModuleFunction f arr (i+1))
+
+    let loopViaInnerFunction (f: 'T -> bool) (array:array<'T>) =
+        let len = array.Length
+        let rec loop i = i >= len || (f array.[i] && loop (i+1))
+        loop 0
+
+    let simpleLibraryUse1 s = raise s
+    let simpleLibraryCall2 inps = List.map id inps
+    let simpleLibraryCall3 inps = List.forall id inps
+    let simpleLibraryCall4 inps = List.exists id inps
+    let simpleLibraryCall5 inps = List.iter id inps
+
+    let simpleLibraryCall6 inps = Array.map id inps
+    let simpleLibraryCall7 inps = Array.forall id inps
+    let simpleLibraryCall8 inps = Array.exists id inps
+    let simpleLibraryCall9 inps = Array.iter id inps
+
+    let simpleLibraryCall10 inps = Seq.map id inps
+    let simpleLibraryCall11 inps = Seq.forall id inps
+    let simpleLibraryCall12 inps = Seq.exists id inps
+    let simpleLibraryCall13 inps = Seq.iter id inps
+    let simpleLibraryUse14 x = x + x
+    let simpleLibraryUse15 x = x - x
+    let simpleLibraryUse16 x = x * x
+    let simpleLibraryUse17 x = x / x
+    let simpleLibraryUse18 x = x % x
+    let simpleLibraryUse19 (x:string) = x + x
+
+    type SetTree<'T> = 
+        | SetEmpty                                          // complexDataAnalysisFunction = 0   
+        | SetNode of 'T * SetTree<'T> *  SetTree<'T> * int    // complexDataAnalysisFunction = int 
+        | SetOne  of 'T                                     // complexDataAnalysisFunction = 1   
+
+    let complexDataAnalysisFunction t = 
+        match t with 
+        | SetEmpty -> 0
+        | SetOne _ -> 1
+        | SetNode (_,_,_,h) -> h
+
+    let tolerance = 2
+
+    let complexDataConstructionFunction l k r = 
+        match l,r with 
+        | SetEmpty,SetEmpty -> SetOne (k)
+        | _ -> 
+          let hl = complexDataAnalysisFunction l 
+          let hr = complexDataAnalysisFunction r 
+          let m = if hl < hr then hr else hl 
+          SetNode(k,l,r,m+1)
+
+    let veryComplexDataConstructionFunction t1 k t2 =
+        let t1h = complexDataAnalysisFunction t1 
+        let t2h = complexDataAnalysisFunction t2 
+        if  t2h > t1h + tolerance then // right is heavier than left 
+            match t2 with 
+            | SetNode(t2k,t2l,t2r,t2h) -> 
+                if complexDataAnalysisFunction t2l > t1h + 1 then  
+                    match t2l with 
+                    | SetNode(t2lk,t2ll,t2lr,t2lh) ->
+                        complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) 
+                    | _ -> failwith "veryComplexDataConstructionFunction"
+                else // rotate left 
+                    complexDataConstructionFunction (complexDataConstructionFunction t1 k t2l) t2k t2r
+            | _ -> failwith "veryComplexDataConstructionFunction"
+        else
+            if  t1h > t2h + tolerance then // left is heavier than right 
+                match t1 with 
+                | SetNode(t1k,t1l,t1r,t1h) -> 
+                    if complexDataAnalysisFunction t1r > t2h + 1 then 
+                        match t1r with 
+                        | SetNode(t1rk,t1rl,t1rr,t1rh) ->
+                            complexDataConstructionFunction (complexDataConstructionFunction t1l t1k t1rl) t1rk (complexDataConstructionFunction t1rr k t2)
+                        | _ -> failwith "veryComplexDataConstructionFunction"
+                    else
+                        complexDataConstructionFunction t1l t1k (complexDataConstructionFunction t1r k t2)
+                | _ -> failwith "veryComplexDataConstructionFunction"
+            else complexDataConstructionFunction t1 k t2
+
+printfn "Test run"
\ No newline at end of file
diff --git a/tests/fsharp/optimize/analyses/sizes.FunctionSizes.output.test.bsl b/tests/fsharp/optimize/analyses/sizes.FunctionSizes.output.test.bsl
new file mode 100644
index 0000000..d876fc0
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/sizes.FunctionSizes.output.test.bsl
@@ -0,0 +1,18 @@
+value constantUnit at line 6 has method size 0
+value constantInteger at line 7 has method size 0
+value constantValue at line 8 has method size 1
+value fieldLookup1 at line 9 has method size 2
+value libraryCall1 at line 10 has method size 2
+value libraryCall2 at line 11 has method size 1
+value constantData1 at line 12 has method size 2
+value constantData2 at line 13 has method size 2
+value constantTuple1 at line 14 has method size 1
+value constantTuple2 at line 15 has method size 1
+value indirectCall1 at line 17 has method size 1
+value indirectCall2 at line 18 has method size 2
+value indirectCall3 at line 19 has method size 3
+value sequenceOfIndirectCalls1 at line 20 has method size 4
+value ifThenElse at line 21 has method size 5
+value patternMatch1 at line 22 has method size 8
+value forLoop1 at line 23 has method size 6
+value whileLoop1 at line 24 has method size 6
diff --git a/tests/fsharp/optimize/analyses/sizes.TotalSizes.output.test.bsl b/tests/fsharp/optimize/analyses/sizes.TotalSizes.output.test.bsl
new file mode 100644
index 0000000..8ca2a10
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/sizes.TotalSizes.output.test.bsl
@@ -0,0 +1,18 @@
+value constantUnit at line 6 has total size 0
+value constantInteger at line 7 has total size 0
+value constantValue at line 8 has total size 1
+value fieldLookup1 at line 9 has total size 2
+value libraryCall1 at line 10 has total size 2
+value libraryCall2 at line 11 has total size 1
+value constantData1 at line 12 has total size 2
+value constantData2 at line 13 has total size 2
+value constantTuple1 at line 14 has total size 1
+value constantTuple2 at line 15 has total size 1
+value indirectCall1 at line 17 has total size 1
+value indirectCall2 at line 18 has total size 2
+value indirectCall3 at line 19 has total size 3
+value sequenceOfIndirectCalls1 at line 20 has total size 4
+value ifThenElse at line 21 has total size 5
+value patternMatch1 at line 22 has total size 8
+value forLoop1 at line 23 has total size 6
+value whileLoop1 at line 24 has total size 6
diff --git a/tests/fsharp/optimize/analyses/sizes.fs b/tests/fsharp/optimize/analyses/sizes.fs
new file mode 100644
index 0000000..15ac076
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/sizes.fs
@@ -0,0 +1,26 @@
+
+
+open System
+
+module BasicSizeTests = 
+    let constantUnit () = ()           // note, size 0 - seems reasonable 
+    let constantInteger () = 1         // note, size 0 - seems reasonable 
+    let constantValue x = x            // note, size 1 - seems reasonable (this may be a field lookup to access an environment variable)
+    let fieldLookup1 x = x.contents   // note, size 2 - seems reasonable 
+    let libraryCall1 x = System.Console.WriteLine(x:string) // size 2, seems reasonable
+    let libraryCall2 x = new System.Object() // size 1, seems reasonable
+    let constantData1 () = Some 1      // note, size 2, seems reasonable, perhaps too low
+    let constantData2 () = None        // note, size 2, seems reasonable, perhaps too high 
+    let constantTuple1 () = (1,2)      // note, size 1, seems reasonable, perhaps too low
+    let constantTuple2 () = (1,2,3,4)  // note, size 1, seems reasonable, perhaps too low
+
+    let indirectCall1 f = f()          // note, size 1, seems reasonable
+    let indirectCall2 f x = f x        // note, size 2, seems reasonable
+    let indirectCall3 f x y = f x y    // note, size 3, seems reasonable
+    let sequenceOfIndirectCalls1 f x = f x; f x  // note, size 4 = 2 + 2
+    let ifThenElse x  = if x then 1 else 2  // note, size 5, seems reasonable
+    let patternMatch1 x  = match x with 1 -> 2 | 2 -> 1 | _ -> 3 // note, size 8, seems reasonable
+    let forLoop1 f x  = for i = 1 to 5 do f () // note, size 6, seems reasonable
+    let whileLoop1 f x  = while true do f () // note, size 6, seems reasonable
+
+printfn "hello"
diff --git a/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl b/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl
new file mode 100644
index 0000000..5f4e677
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/tailcalls.NoNeedToTailcall.output.test.bsl
@@ -0,0 +1,53 @@
+value constantUnit at line 6 does not make a critical tailcall
+value constantInteger at line 7 does not make a critical tailcall
+value constantValue at line 8 does not make a critical tailcall
+value fieldLookup1 at line 9 does not make a critical tailcall
+value libraryCall1 at line 10 does not make a critical tailcall
+value libraryCall2 at line 11 does not make a critical tailcall
+value constantData1 at line 12 does not make a critical tailcall
+value constantData2 at line 13 does not make a critical tailcall
+value constantTuple1 at line 14 does not make a critical tailcall
+value constantTuple2 at line 15 does not make a critical tailcall
+value indirectCall1 at line 17 may make a critical tailcall
+value indirectCall2 at line 18 may make a critical tailcall
+value indirectCall3 at line 19 may make a critical tailcall
+value sequenceOfIndirectCalls1 at line 20 may make a critical tailcall
+value ifThenElse at line 21 does not make a critical tailcall
+value patternMatch1 at line 22 does not make a critical tailcall
+value forLoop1 at line 23 does not make a critical tailcall
+value whileLoop1 at line 24 does not make a critical tailcall
+value overAppliedCall at line 25 may make a critical tailcall
+value exactlyAppliedCall at line 26 does not make a critical tailcall
+value underAppliedCall at line 27 does not make a critical tailcall
+value indirectCallInNonTailcallPosition at line 35 does not make a critical tailcall
+value infiniteLoop at line 37 does not make a critical tailcall
+value genericInfiniteLoop at line 38 does not make a critical tailcall
+value callInfiniteLoop at line 39 does not make a critical tailcall
+value infiniteLoop2 at line 40 does not make a critical tailcall
+value callGenericInfiniteLoop at line 41 does not make a critical tailcall
+value loopViaModuleFunction1 at line 43 does not make a critical tailcall
+value loopViaModuleFunction at line 46 does not make a critical tailcall
+value loop at line 51 does not make a critical tailcall
+value loopViaInnerFunction at line 49 does not make a critical tailcall
+value simpleLibraryUse1 at line 54 does not make a critical tailcall
+value simpleLibraryCall2 at line 55 does not make a critical tailcall
+value simpleLibraryCall3 at line 56 does not make a critical tailcall
+value simpleLibraryCall4 at line 57 does not make a critical tailcall
+value simpleLibraryCall5 at line 58 does not make a critical tailcall
+value simpleLibraryCall6 at line 60 does not make a critical tailcall
+value simpleLibraryCall7 at line 61 does not make a critical tailcall
+value simpleLibraryCall8 at line 62 does not make a critical tailcall
+value simpleLibraryCall9 at line 63 does not make a critical tailcall
+value simpleLibraryCall10 at line 65 does not make a critical tailcall
+value simpleLibraryCall11 at line 66 does not make a critical tailcall
+value simpleLibraryCall12 at line 67 does not make a critical tailcall
+value simpleLibraryCall13 at line 68 does not make a critical tailcall
+value simpleLibraryUse14 at line 69 does not make a critical tailcall
+value simpleLibraryUse15 at line 70 does not make a critical tailcall
+value simpleLibraryUse16 at line 71 does not make a critical tailcall
+value simpleLibraryUse17 at line 72 does not make a critical tailcall
+value simpleLibraryUse18 at line 73 does not make a critical tailcall
+value simpleLibraryUse19 at line 74 does not make a critical tailcall
+value complexDataAnalysisFunction at line 81 does not make a critical tailcall
+value complexDataConstructionFunction at line 89 does not make a critical tailcall
+value veryComplexDataConstructionFunction at line 98 does not make a critical tailcall
diff --git a/tests/fsharp/optimize/analyses/tailcalls.fs b/tests/fsharp/optimize/analyses/tailcalls.fs
new file mode 100644
index 0000000..c308513
--- /dev/null
+++ b/tests/fsharp/optimize/analyses/tailcalls.fs
@@ -0,0 +1,126 @@
+
+
+open System
+
+module BasicSizeTests = 
+    let constantUnit () = ()          
+    let constantInteger () = 1        
+    let constantValue x = x           
+    let fieldLookup1 x = x.contents   
+    let libraryCall1 x = System.Console.WriteLine(x:string) 
+    let libraryCall2 x = new System.Object() 
+    let constantData1 () = Some 1      
+    let constantData2 () = None        
+    let constantTuple1 () = (1,2)      
+    let constantTuple2 () = (1,2,3,4)  
+
+    let indirectCall1 f = f()          
+    let indirectCall2 f x = f x        
+    let indirectCall3 f x y = f x y    
+    let sequenceOfIndirectCalls1 f x = f x; f x  
+    let ifThenElse x  = if x then 1 else 2  
+    let patternMatch1 x  = match x with 1 -> 2 | 2 -> 1 | _ -> 3 
+    let forLoop1 f x  = for i = 1 to 5 do f () 
+    let whileLoop1 f x  = while true do f () 
+    let overAppliedCall f x = id f ()          
+    let exactlyAppliedCall f x = id f 
+    let underAppliedCall f x = id 
+
+
+
+
+
+module BasicAnalysisTests = 
+
+    let indirectCallInNonTailcallPosition f x y = f x y; 1+2  
+
+    let rec infiniteLoop (x:int) : int = infiniteLoop x
+    let rec genericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x
+    let callInfiniteLoop (x:int) : int = infiniteLoop x
+    let rec infiniteLoop2 (x1:int) (x2:int) : int = infiniteLoop2 x1 x2
+    let callGenericInfiniteLoop (x:'a) : 'a = genericInfiniteLoop x
+
+    let rec loopViaModuleFunction1 (f: 'T -> bool) (arr:array<'T>) i =
+        loopViaModuleFunction1 f arr (i+1)
+
+    let rec loopViaModuleFunction (f: 'T -> bool) (arr:array<'T>) i =
+        i >= arr.Length || (f arr.[i] && loopViaModuleFunction f arr (i+1))
+
+    let loopViaInnerFunction (f: 'T -> bool) (array:array<'T>) =
+        let len = array.Length
+        let rec loop i = i >= len || (f array.[i] && loop (i+1))
+        loop 0
+
+    let simpleLibraryUse1 s = raise s
+    let simpleLibraryCall2 inps = List.map id inps
+    let simpleLibraryCall3 inps = List.forall id inps
+    let simpleLibraryCall4 inps = List.exists id inps
+    let simpleLibraryCall5 inps = List.iter id inps
+
+    let simpleLibraryCall6 inps = Array.map id inps
+    let simpleLibraryCall7 inps = Array.forall id inps
+    let simpleLibraryCall8 inps = Array.exists id inps
+    let simpleLibraryCall9 inps = Array.iter id inps
+
+    let simpleLibraryCall10 inps = Seq.map id inps
+    let simpleLibraryCall11 inps = Seq.forall id inps
+    let simpleLibraryCall12 inps = Seq.exists id inps
+    let simpleLibraryCall13 inps = Seq.iter id inps
+    let simpleLibraryUse14 x = x + x
+    let simpleLibraryUse15 x = x - x
+    let simpleLibraryUse16 x = x * x
+    let simpleLibraryUse17 x = x / x
+    let simpleLibraryUse18 x = x % x
+    let simpleLibraryUse19 (x:string) = x + x
+
+    type SetTree<'T> = 
+        | SetEmpty                                          // complexDataAnalysisFunction = 0   
+        | SetNode of 'T * SetTree<'T> *  SetTree<'T> * int    // complexDataAnalysisFunction = int 
+        | SetOne  of 'T                                     // complexDataAnalysisFunction = 1   
+
+    let complexDataAnalysisFunction t = 
+        match t with 
+        | SetEmpty -> 0
+        | SetOne _ -> 1
+        | SetNode (_,_,_,h) -> h
+
+    let tolerance = 2
+
+    let complexDataConstructionFunction l k r = 
+        match l,r with 
+        | SetEmpty,SetEmpty -> SetOne (k)
+        | _ -> 
+          let hl = complexDataAnalysisFunction l 
+          let hr = complexDataAnalysisFunction r 
+          let m = if hl < hr then hr else hl 
+          SetNode(k,l,r,m+1)
+
+    let veryComplexDataConstructionFunction t1 k t2 =
+        let t1h = complexDataAnalysisFunction t1 
+        let t2h = complexDataAnalysisFunction t2 
+        if  t2h > t1h + tolerance then // right is heavier than left 
+            match t2 with 
+            | SetNode(t2k,t2l,t2r,t2h) -> 
+                if complexDataAnalysisFunction t2l > t1h + 1 then  
+                    match t2l with 
+                    | SetNode(t2lk,t2ll,t2lr,t2lh) ->
+                        complexDataConstructionFunction (complexDataConstructionFunction t1 k t2ll) t2lk (complexDataConstructionFunction t2lr t2k t2r) 
+                    | _ -> failwith "veryComplexDataConstructionFunction"
+                else // rotate left 
+                    complexDataConstructionFunction (complexDataConstructionFunction t1 k t2l) t2k t2r
+            | _ -> failwith "veryComplexDataConstructionFunction"
+        else
+            if  t1h > t2h + tolerance then // left is heavier than right 
+                match t1 with 
+                | SetNode(t1k,t1l,t1r,t1h) -> 
+                    if complexDataAnalysisFunction t1r > t2h + 1 then 
+                        match t1r with 
+                        | SetNode(t1rk,t1rl,t1rr,t1rh) ->
+                            complexDataConstructionFunction (complexDataConstructionFunction t1l t1k t1rl) t1rk (complexDataConstructionFunction t1rr k t2)
+                        | _ -> failwith "veryComplexDataConstructionFunction"
+                    else
+                        complexDataConstructionFunction t1l t1k (complexDataConstructionFunction t1r k t2)
+                | _ -> failwith "veryComplexDataConstructionFunction"
+            else complexDataConstructionFunction t1 k t2
+
+printfn "Test run"
\ No newline at end of file
diff --git a/tests/fsharp/optimize/basics/build.bat b/tests/fsharp/optimize/basics/build.bat
new file mode 100644
index 0000000..d3c25fe
--- /dev/null
+++ b/tests/fsharp/optimize/basics/build.bat
@@ -0,0 +1,35 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+
+"%FSC%" %fsc_flags% -g  -o:test.exe test.ml
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --optimize -o:test--optimize.exe -g test.ml
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/optimize/basics/run.bat b/tests/fsharp/optimize/basics/run.bat
new file mode 100644
index 0000000..5b5a362
--- /dev/null
+++ b/tests/fsharp/optimize/basics/run.bat
@@ -0,0 +1,50 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+if ERRORLEVEL 1 goto Error
+
+if not exist "%ILDASM%" (
+   @echo '%ILDASM%' not found.
+    goto Error 
+)
+
+"%ILDASM%" /nobar /out=test.il test.exe
+
+"%ILDASM%" /nobar /out=test--optimize.il test--optimize.exe
+
+type test--optimize.il | find /C "ShouldNotAppear" > count--optimize
+type test.il | find /C "ShouldNotAppear" > count
+for /f %%c IN (count--optimize) do (if NOT "%%c"=="0" (
+   echo Error: optimizations not removed.  Relevant lines from IL file follow:
+   type test--optimize.il | find "ShouldNotAppear"
+   goto SetError)
+)
+for /f %%c IN (count) do (
+   set NUMELIM=%%c
+)
+
+:Ok
+echo Ran fsharp %~f0 ok - optimizations removed %NUMELIM% textual occurrences of optimizable identifiers from target IL 
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetError
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/optimize/basics/test.ml b/tests/fsharp/optimize/basics/test.ml
new file mode 100644
index 0000000..5744e8a
--- /dev/null
+++ b/tests/fsharp/optimize/basics/test.ml
@@ -0,0 +1,107 @@
+// #Optimizations 
+
+
+let testEliminableBinding () = 
+  let localShouldNotAppear = "stringShouldNotAppear" in 3
+
+let testEliminableInnerFunction () = 
+  let localFunctionShouldNotAppear x = "stringShouldNotAppear" in 3
+
+(* TODO: Elimination of "letrec" bindings
+let testEliminableInnerRecursiveFunction () = 
+  let rec localFunctionShouldNotAppear1 x = localFunctionShouldNotAppear2 x 
+  and localFunctionShouldNotAppear2 x =  "stringShouldNotAppear" ^ localFunctionShouldNotAppear1 x in 
+  3
+*)
+
+
+let testMultipleEliminableBindings1 () = 
+  let localShouldNotAppear1,localShouldNotAppear2 = "stringShouldNotAppear1","stringShouldNotAppear2" in 3
+
+let testMultipleEliminableBindings2 () = 
+  let localShouldNotAppear1 = "stringShouldNotAppear1" in 
+  let localShouldNotAppear2 = localShouldNotAppear1 in 
+  let localShouldNotAppear3 = localShouldNotAppear2 in 
+  4
+
+let testBetaVarAndBindingElim1 () = 
+  let localShouldNotAppear1 = "liveString1" in 
+  localShouldNotAppear1 
+
+let testBetaVarAndBindingElim2 () = 
+  let localShouldNotAppear1 = "liveString1" in 
+  let localShouldNotAppear2 = localShouldNotAppear1 in 
+  localShouldNotAppear2 
+
+let testBetaVarAndBindingElim3 () = 
+  let localShouldNotAppear1 = "liveString1" in 
+  let localShouldNotAppear2 = localShouldNotAppear1 in 
+  localShouldNotAppear1 
+
+
+let testDeadStringInSeq () = ignore ("stringShouldNotAppear"); 3
+let testDeadBindingInSeq () = (let localShouldNotAppear1 = "stringShouldNotAppear" in ()); 3
+
+let testSimpleInliner1 () = 
+  let simpleInlineeShouldNotAppear () = 3 in
+  simpleInlineeShouldNotAppear ()
+
+let testSimpleInliner2 () = 
+  let simpleInlineeShouldNotAppear () = 3 in
+  simpleInlineeShouldNotAppear () + simpleInlineeShouldNotAppear ()
+
+let testSimplePolymorphicInliner1 () = 
+  let simplePolymorphicInlineeShouldNotAppear x = 3 in
+  ignore (simplePolymorphicInlineeShouldNotAppear 3); simplePolymorphicInlineeShouldNotAppear 4
+
+let testSimpleInliner3 () = 
+  let simpleInlineeShouldNotAppear () () = 3 in
+  simpleInlineeShouldNotAppear () ()
+
+let testBetaReduce1 () = 
+  (fun simpleVarShouldNotAppear -> simpleVarShouldNotAppear + simpleVarShouldNotAppear) 3
+
+let testSimpleProjection1 () = 
+  let pairShouldNotAppear = ("stringFromPairShouldNotAppear","stringFromPair2") in 
+  match pairShouldNotAppear with (varShouldNotAppear1,varShouldNotAppear2) -> varShouldNotAppear2
+
+let testSimpleProjection2 () = 
+  let tripleShouldNotAppear = ("stringFromPairShouldNotAppear",2,"stringFromPairShouldNotAppear") in 
+  match tripleShouldNotAppear with (varShouldNotAppear1,varShouldNotAppear2,varShouldNotAppear3) -> varShouldNotAppear2
+let testSimpleTupleMatchGetReduced () =
+  match ("stringFromPairShouldNotAppear",2,"stringFromPairShouldNotAppear") with
+    (varShouldNotAppear1,varShouldNotAppear2,varShouldNotAppear3) -> varShouldNotAppear2
+
+let testSimpleListMatch1GetsReduced () =
+  match [] with
+    [] -> ()
+  | _ -> failwith "stringFromSimpleListMatch1ShouldNotAppear"
+
+let testSimpleListMatch2GetsReduced () =
+  match [1] with
+    [x] -> x
+  | _ -> failwith "stringFromSimpleListMatch2ShouldNotAppear"
+
+let testSimpleListMatch3GetsReduced (a,b,c) =
+  let varShouldNotAppear1 = [a;b;c] in 
+  match varShouldNotAppear1 with
+    [x;y;z] -> y
+  | _ -> failwith "stringFromSimpleListMatch3GetsReducedShouldNotAppear"
+
+let testSimpleUnionProjection1 () =
+  let x = ["stringCanAppear"; "stringShouldNotAppear"] in match x with h::_ -> h
+
+
+let testSimpleUnionProjection2 () =
+  let x = ["stringShouldNotAppear"; "stringCanAppear"] in match x with _::h::_ -> h
+
+let testNestedTupleMatchGetsReduced () =
+  match ("stringFromNestedTupleMatchShouldNotAppear",(2,"stringFromNestedTupleMatchShouldNotAppear")) with
+    (varShouldNotAppear1,(varShouldNotAppear2,varShouldNotAppear3)) -> varShouldNotAppear2
+
+let testUnitMatchIsOptimized () = 
+  match () with 
+    varShouldNotAppear -> varShouldNotAppear
+
+
+
diff --git a/tests/fsharp/optimize/stats/run.bat b/tests/fsharp/optimize/stats/run.bat
new file mode 100644
index 0000000..966dc4b
--- /dev/null
+++ b/tests/fsharp/optimize/stats/run.bat
@@ -0,0 +1,49 @@
+ at if "%_echo%"=="" echo off
+REM there is no build.bat that precedes this run.bat
+
+call %~d0%~p0..\..\..\config.bat
+if ERRORLEVEL 1 goto Error
+
+if not exist "%ILDASM%" (goto Error)
+
+where sd.exe 2> NUL
+if not ERRORLEVEL 1 ( sd edit stats.txt ) else (attrib -r stats.txt )
+
+"%ILDASM%" /nobar /out=FSharp.Core.il "%FSCOREDLLPATH%"
+if ERRORLEVEL 1 goto Error
+
+echo Counting TypeFuncs...
+type FSharp.Core.il | find /C "extends Microsoft.FSharp.TypeFunc"        > count-Microsoft.FSharp-TypeFunc
+echo Counting classes...
+type FSharp.Core.il | find /C ".class"                                   > count-Microsoft.FSharp-.class
+echo Counting methods...
+type FSharp.Core.il | find /C ".method"                                  > count-Microsoft.FSharp-.method
+echo Counting fields...
+type FSharp.Core.il | find /C ".field"                                   > count-Microsoft.FSharp-.field
+
+for /f %%c IN (count-Microsoft.FSharp-TypeFunc) do (
+ for /f %%d IN (count-Microsoft.FSharp-.class) do (
+  for /f %%e IN (count-Microsoft.FSharp-.method) do (
+   for /f %%f IN (count-Microsoft.FSharp-.field) do (
+         echo %date%, %time%, Microsoft.FSharp-TypeFunc, %%c, Microsoft.FSharp-classes, %%d,  Microsoft.FSharp-methods, %%e, ,  Microsoft.FSharp-fields, %%f,  >> stats.txt
+   )
+  )
+ )
+)
+
+:Ok
+echo Ran fsharp %~f0 and added stats ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/optimize/stats/stats10.txt b/tests/fsharp/optimize/stats/stats10.txt
new file mode 100644
index 0000000..eff6907
--- /dev/null
+++ b/tests/fsharp/optimize/stats/stats10.txt
@@ -0,0 +1,77 @@
+08/09/2005,  1:32:47.34, fslib-TypeFunc, 10, fslib-classes, 480,  fslib-methods, 1464, ,  fslib-fields, 465, mllib-TypeFunc, 0, mllib-classes, 504, mllib-methods, 1629, mllib-fields, 363,  
+08/09/2005,  1:59:13.41, fslib-TypeFunc, 10, fslib-classes, 480,  fslib-methods, 1464, ,  fslib-fields, 465, mllib-TypeFunc, 0, mllib-classes, 504, mllib-methods, 1629, mllib-fields, 363,  
+09/09/2005,  2:07:34.98, fslib-TypeFunc, 10, fslib-classes, 480,  fslib-methods, 1468, ,  fslib-fields, 465, mllib-TypeFunc, 0, mllib-classes, 504, mllib-methods, 1629, mllib-fields, 363,  
+10/09/2005,  4:57:21.65, fslib-TypeFunc, 10, fslib-classes, 480,  fslib-methods, 1468, ,  fslib-fields, 465, mllib-TypeFunc, 0, mllib-classes, 504, mllib-methods, 1629, mllib-fields, 363,  
+12/09/2005, 17:26:33.13, fslib-TypeFunc, 4, fslib-classes, 432,  fslib-methods, 1363, ,  fslib-fields, 450, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1680, mllib-fields, 347,  
+13/09/2005, 22:56:40.02, fslib-TypeFunc, 4, fslib-classes, 430,  fslib-methods, 1363, ,  fslib-fields, 450, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1680, mllib-fields, 347,  
+20/09/2005,  1:38:29.28, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+21/09/2005,  4:02:39.30, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+21/09/2005, 19:13:57.52, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+22/09/2005,  1:35:23.83, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+22/09/2005, 19:44:00.39, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+28/09/2005,  1:19:10.49, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+19/10/2005, 17:56:02.22, fslib-TypeFunc, 4, fslib-classes, 434,  fslib-methods, 1368, ,  fslib-fields, 459, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1678, mllib-fields, 347,  
+21/10/2005, 23:17:57.89, fslib-TypeFunc, 4, fslib-classes, 488,  fslib-methods, 1536, ,  fslib-fields, 494, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+22/10/2005,  1:27:01.05, fslib-TypeFunc, 4, fslib-classes, 488,  fslib-methods, 1536, ,  fslib-fields, 494, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+24/10/2005, 18:51:10.25, fslib-TypeFunc, 4, fslib-classes, 488,  fslib-methods, 1536, ,  fslib-fields, 494, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+27/10/2005, 22:28:17.44, fslib-TypeFunc, 4, fslib-classes, 718,  fslib-methods, 2260, ,  fslib-fields, 719, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+29/10/2005, 15:08:27.31, fslib-TypeFunc, 4, fslib-classes, 716,  fslib-methods, 2310, ,  fslib-fields, 718, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+04/11/2005,  2:34:04.87, fslib-TypeFunc, 4, fslib-classes, 714,  fslib-methods, 2320, ,  fslib-fields, 718, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+05/11/2005, 14:35:05.20, fslib-TypeFunc, 4, fslib-classes, 714,  fslib-methods, 2320, ,  fslib-fields, 718, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+05/11/2005, 23:17:50.60, fslib-TypeFunc, 4, fslib-classes, 714,  fslib-methods, 2320, ,  fslib-fields, 718, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+09/11/2005,  4:06:03.06, fslib-TypeFunc, 4, fslib-classes, 664,  fslib-methods, 2356, ,  fslib-fields, 652, mllib-TypeFunc, 0, mllib-classes, 586, mllib-methods, 1754, mllib-fields, 390,  
+10/11/2005,  2:12:15.57, fslib-TypeFunc, 4, fslib-classes, 724,  fslib-methods, 2508, ,  fslib-fields, 684, mllib-TypeFunc, 0, mllib-classes, 610, mllib-methods, 1799, mllib-fields, 390,  
+10/11/2005, 13:08:33.48, fslib-TypeFunc, 4, fslib-classes, 724,  fslib-methods, 2508, ,  fslib-fields, 684, mllib-TypeFunc, 0, mllib-classes, 610, mllib-methods, 1799, mllib-fields, 390,  
+14/12/2005, 19:41:05.05, fslib-TypeFunc, 4, fslib-classes, 1452,  fslib-methods, 3992, ,  fslib-fields, 1063, mllib-TypeFunc, 0, mllib-classes, 618, mllib-methods, 1815, mllib-fields, 397,  
+14/12/2005, 21:36:12.81, fslib-TypeFunc, 4, fslib-classes, 1452,  fslib-methods, 3992, ,  fslib-fields, 1063, mllib-TypeFunc, 0, mllib-classes, 600, mllib-methods, 1804, mllib-fields, 391,  
+17/12/2005,  2:37:17.14, fslib-TypeFunc, 4, fslib-classes, 1476,  fslib-methods, 4035, ,  fslib-fields, 1068, mllib-TypeFunc, 0, mllib-classes, 600, mllib-methods, 1804, mllib-fields, 391,  
+20/12/2005, 22:21:05.87, fslib-TypeFunc, 4, fslib-classes, 1476,  fslib-methods, 4030, ,  fslib-fields, 1062, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1836, mllib-fields, 403,  
+21/12/2005,  2:31:13.61, fslib-TypeFunc, 4, fslib-classes, 1476,  fslib-methods, 4030, ,  fslib-fields, 1062, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1836, mllib-fields, 403,  
+26/12/2005,  2:30:39.12, fslib-TypeFunc, 4, fslib-classes, 1480,  fslib-methods, 4047, ,  fslib-fields, 1064, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1914, mllib-fields, 403,  
+26/12/2005, 15:31:07.58, fslib-TypeFunc, 4, fslib-classes, 1480,  fslib-methods, 4047, ,  fslib-fields, 1064, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1914, mllib-fields, 403,  
+27/12/2005,  3:32:04.91, fslib-TypeFunc, 4, fslib-classes, 1480,  fslib-methods, 4047, ,  fslib-fields, 1064, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1914, mllib-fields, 401,  
+28/12/2005, 19:42:30.54, fslib-TypeFunc, 4, fslib-classes, 1480,  fslib-methods, 4047, ,  fslib-fields, 1064, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1914, mllib-fields, 401,  
+31/12/2005,  2:20:47.44, fslib-TypeFunc, 4, fslib-classes, 1486,  fslib-methods, 4068, ,  fslib-fields, 1071, mllib-TypeFunc, 0, mllib-classes, 624, mllib-methods, 1914, mllib-fields, 401,  
+14/01/2006,  0:16:24.85, fslib-TypeFunc, 4, fslib-classes, 1378,  fslib-methods, 3594, ,  fslib-fields, 1046, mllib-TypeFunc, 0, mllib-classes, 626, mllib-methods, 1969, mllib-fields, 401,  
+05/02/2006, 16:35:26.99, fslib-TypeFunc, 2, fslib-classes, 1436,  fslib-methods, 3690, ,  fslib-fields, 1055, mllib-TypeFunc, 0, mllib-classes, 530, mllib-methods, 1731, mllib-fields, 375,  
+05/02/2006, 18:36:27.96, fslib-TypeFunc, 2, fslib-classes, 1436,  fslib-methods, 3690, ,  fslib-fields, 1055, mllib-TypeFunc, 0, mllib-classes, 530, mllib-methods, 1731, mllib-fields, 375,  
+05/02/2006, 21:50:07.48, fslib-TypeFunc, 2, fslib-classes, 1436,  fslib-methods, 3690, ,  fslib-fields, 1055, mllib-TypeFunc, 0, mllib-classes, 530, mllib-methods, 1731, mllib-fields, 375,  
+06/02/2006, 23:59:36.03, fslib-TypeFunc, 2, fslib-classes, 1440,  fslib-methods, 3696, ,  fslib-fields, 1061, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1722, mllib-fields, 372,  
+07/02/2006, 20:20:53.63, fslib-TypeFunc, 2, fslib-classes, 1440,  fslib-methods, 3695, ,  fslib-fields, 1061, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1722, mllib-fields, 372,  
+07/02/2006, 20:49:10.09, fslib-TypeFunc, 2, fslib-classes, 1440,  fslib-methods, 3695, ,  fslib-fields, 1061, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1722, mllib-fields, 372,  
+19/02/2006,  4:40:01.50, fslib-TypeFunc, 2, fslib-classes, 1440,  fslib-methods, 3699, ,  fslib-fields, 1054, mllib-TypeFunc, 0, mllib-classes, 534, mllib-methods, 1724, mllib-fields, 372,  
+23/02/2006,  3:13:18.36, fslib-TypeFunc, 2, fslib-classes, 1434,  fslib-methods, 3781, ,  fslib-fields, 1051, mllib-TypeFunc, 0, mllib-classes, 556, mllib-methods, 1853, mllib-fields, 392,  
+24/02/2006,  5:17:06.49, fslib-TypeFunc, 2, fslib-classes, 1434,  fslib-methods, 3781, ,  fslib-fields, 1051, mllib-TypeFunc, 0, mllib-classes, 556, mllib-methods, 1853, mllib-fields, 392,  
+06/03/2006,  6:49:41.07, fslib-TypeFunc, 2, fslib-classes, 1434,  fslib-methods, 3781, ,  fslib-fields, 1051, mllib-TypeFunc, 0, mllib-classes, 556, mllib-methods, 1853, mllib-fields, 392,  
+06/05/2006, 15:41:35.07, fslib-TypeFunc, 2, fslib-classes, 1108,  fslib-methods, 3200, ,  fslib-fields, 752, mllib-TypeFunc, 0, mllib-classes, 536, mllib-methods, 1845, mllib-fields, 394,  
+11/05/2006, 22:37:33.09, fslib-TypeFunc, 2, fslib-classes, 1114,  fslib-methods, 3161, ,  fslib-fields, 755, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1803, mllib-fields, 393,  
+13/05/2006,  3:00:55.95, fslib-TypeFunc, 2, fslib-classes, 1134,  fslib-methods, 3203, ,  fslib-fields, 759, mllib-TypeFunc, 0, mllib-classes, 538, mllib-methods, 1807, mllib-fields, 393,  
+04/11/2006,  1:46:35.91, fslib-TypeFunc, 0, fslib-classes, 1250,  fslib-methods, 3582, ,  fslib-fields, 832, mllib-TypeFunc, 0, mllib-classes, 566, mllib-methods, 1831, mllib-fields, 396,  
+08/11/2006, 20:29:19.57, fslib-TypeFunc, 0, fslib-classes, 1250,  fslib-methods, 3578, ,  fslib-fields, 832, mllib-TypeFunc, 0, mllib-classes, 566, mllib-methods, 1831, mllib-fields, 396,  
+08/11/2006, 23:32:33.24, fslib-TypeFunc, 0, fslib-classes, 1250,  fslib-methods, 3578, ,  fslib-fields, 832, mllib-TypeFunc, 0, mllib-classes, 566, mllib-methods, 1831, mllib-fields, 396,  
+20/11/2006,  3:55:56.29, fslib-TypeFunc, 0, fslib-classes, 1626,  fslib-methods, 4613, ,  fslib-fields, 1100, mllib-TypeFunc, 0, mllib-classes, 180, mllib-methods, 683, mllib-fields, 139,  
+21/11/2006, 12:39:55.81, fslib-TypeFunc, 0, fslib-classes, 1626,  fslib-methods, 4613, ,  fslib-fields, 1100, mllib-TypeFunc, 0, mllib-classes, 180, mllib-methods, 683, mllib-fields, 139,  
+21/11/2006, 20:09:24.30, fslib-TypeFunc, 0, fslib-classes, 1810,  fslib-methods, 5189, ,  fslib-fields, 1309, mllib-TypeFunc, 0, mllib-classes, 180, mllib-methods, 683, mllib-fields, 139,  
+21/11/2006, 20:51:29.64, fslib-TypeFunc, 0, fslib-classes, 1810,  fslib-methods, 5189, ,  fslib-fields, 1309, mllib-TypeFunc, 0, mllib-classes, 180, mllib-methods, 683, mllib-fields, 139,  
+22/11/2006,  0:46:09.94, fslib-TypeFunc, 0, fslib-classes, 1812,  fslib-methods, 5184, ,  fslib-fields, 1307, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006,  5:35:21.67, fslib-TypeFunc, 0, fslib-classes, 1812,  fslib-methods, 5166, ,  fslib-fields, 1307, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 685, mllib-fields, 141,  
+22/11/2006,  6:34:46.50, fslib-TypeFunc, 0, fslib-classes, 1814,  fslib-methods, 5201, ,  fslib-fields, 1309, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006,  8:50:13.89, fslib-TypeFunc, 0, fslib-classes, 1814,  fslib-methods, 5201, ,  fslib-fields, 1309, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006, 20:11:54.70, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006, 22:52:57.92, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006, 23:55:46.85, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+23/11/2006,  1:01:18.07, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+23/11/2006, 16:03:23.40, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006, 16:53:10.32, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5218, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+22/11/2006, 21:57:57.60, fslib-TypeFunc, 0, fslib-classes, 1824,  fslib-methods, 5221, ,  fslib-fields, 1315, mllib-TypeFunc, 0, mllib-classes, 182, mllib-methods, 686, mllib-fields, 141,  
+15/02/2007, 16:56:52.99, fslib-TypeFunc, 0, fslib-classes, 2194,  fslib-methods, 6116, ,  fslib-fields, 1528, mllib-TypeFunc, 0, mllib-classes, 190, mllib-methods, 690, mllib-fields, 144,  
+15/02/2007, 22:08:11.84, fslib-TypeFunc, 0, fslib-classes, 2194,  fslib-methods, 6116, ,  fslib-fields, 1528, mllib-TypeFunc, 0, mllib-classes, 190, mllib-methods, 690, mllib-fields, 144,  
+01/03/2007,  4:26:27.63, fslib-TypeFunc, 0, fslib-classes, 2230,  fslib-methods, 6161, ,  fslib-fields, 1565, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 687, mllib-fields, 143,  
+01/03/2007,  5:14:48.02, fslib-TypeFunc, 0, fslib-classes, 2230,  fslib-methods, 6161, ,  fslib-fields, 1565, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 687, mllib-fields, 143,  
+01/03/2007, 19:29:20.53, fslib-TypeFunc, 0, fslib-classes, 2230,  fslib-methods, 6161, ,  fslib-fields, 1565, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 687, mllib-fields, 143,  
+02/03/2007, 20:14:16.82, fslib-TypeFunc, 0, fslib-classes, 1792,  fslib-methods, 5396, ,  fslib-fields, 1266, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 687, mllib-fields, 143,  
+04/03/2007,  5:53:53.04, fslib-TypeFunc, 0, fslib-classes, 1796,  fslib-methods, 5452, ,  fslib-fields, 1268, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 692, mllib-fields, 143,  
+13/03/2007, 21:17:17.96, fslib-TypeFunc, 0, fslib-classes, 1796,  fslib-methods, 5452, ,  fslib-fields, 1268, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 692, mllib-fields, 143,  
+25/04/2007, 22:16:20.57, fslib-TypeFunc, 0, fslib-classes, 1806,  fslib-methods, 5470, ,  fslib-fields, 1273, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 694, mllib-fields, 145,  
+29/06/2007,  4:20:50.76, fslib-TypeFunc, 0, fslib-classes, 1896,  fslib-methods, 5756, ,  fslib-fields, 1347, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 716, mllib-fields, 149,  
+30/06/2007, 16:09:03.27, fslib-TypeFunc, 0, fslib-classes, 1896,  fslib-methods, 5756, ,  fslib-fields, 1347, mllib-TypeFunc, 0, mllib-classes, 188, mllib-methods, 716, mllib-fields, 149,  
diff --git a/tests/fsharp/optimize/tdirs b/tests/fsharp/optimize/tdirs
new file mode 100644
index 0000000..c31475e
--- /dev/null
+++ b/tests/fsharp/optimize/tdirs
@@ -0,0 +1,3 @@
+analyses
+basics
+stats
\ No newline at end of file
diff --git a/tests/fsharp/perf/graph/build.bat b/tests/fsharp/perf/graph/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/perf/graph/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/perf/graph/run.bat b/tests/fsharp/perf/graph/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/perf/graph/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/perf/graph/test.ml b/tests/fsharp/perf/graph/test.ml
new file mode 100644
index 0000000..8b0d105
--- /dev/null
+++ b/tests/fsharp/perf/graph/test.ml
@@ -0,0 +1,550 @@
+// #Stress 
+#indent "off"
+
+(*IF-OCAML*)
+  type node = int
+module NodeSet = Set.Make(struct type t = int let compare = compare end )
+module NodeMap = Map.Make(struct type t = int let compare = compare end)
+  type node_set = NodeSet.t
+  type 'a node_map = 'a NodeMap.t 
+(*ENDIF-OCAML*)
+
+  (*F# module NodeSet = Set
+  module NodeMap = Map
+  type node = int
+  type node_set = node Set
+  type 'a node_map = (node,'a) Map F#*)
+
+  type info = {
+      succ : node_set;
+      pred : node_set;
+      mutable dfNumber   : int;
+      mutable mark1      : int;
+      mutable mark2      : int;
+      mutable lowLink    : int;
+    }
+      
+  let info() = 
+    {
+     succ = NodeSet.empty;
+     pred = NodeSet.empty;
+     mark1 = 0;
+     mark2 = 0;
+     lowLink = 0;
+     dfNumber = 0;
+   }
+      
+  type t = {
+      mutable nodes : info node_map;
+      mutable generation : int;
+(*
+      mutable isLogged : bool;
+      log : Log.t;
+*)
+    }
+      
+  let is_marked    t info = info.mark1 = t.generation
+  let set_mark     t info = info.mark1 <- t.generation
+  let unset_mark   t info = info.mark1 <- 0
+
+  let is_onStack   t info = info.mark2 = t.generation
+  let set_onStack  t info = info.mark2 <- t.generation
+  let set_offStack t info = info.mark2 <- 0
+
+  let is_marked2  = is_onStack
+  let set_mark2   = set_onStack
+  let unset_mark2 = set_offStack
+      
+  let set_lowLink  t info n = info.lowLink <- n
+  let get_lowLink  t info = info.lowLink
+
+  let set_dfNumber t info n = info.dfNumber <- n
+  let get_dfNumber t info = info.dfNumber
+
+  let nodeInfo t node = NodeMap.find node t.nodes 
+
+(* constructors *)
+  let clearGraph t = t.generation <- t.generation + 1
+          
+  let empty() = 
+    {
+     nodes = NodeMap.empty;
+     generation = 0;
+(*
+     isLogged = false;
+     log = Log.empty()
+*)
+   }
+
+  let setInfo t node info oldInfo = 
+    t.nodes <- NodeMap.add node info t.nodes
+(*
+    if t.isLogged then
+      Log.append t.log 
+	(fun () -> 
+	  (match oldInfo with
+	  | None -> t.nodes <- NodeMap.remove node t.nodes
+	  | Some info -> t.nodes <- NodeMap.add node info t.nodes)
+	)
+*)
+
+  let getInfo t node = 
+    try
+      let info0 = NodeMap.find node t.nodes in
+      (Some info0, info0)
+    with
+      :? System.Collections.Generic.KeyNotFoundException -> (None, info())
+
+  let setPred t node fn = 
+    let info0, info1 = getInfo t node in
+    let info2 = { info1 with pred = fn info1.pred  } in
+    setInfo t node info1 info0
+
+  let setSucc t node fn =
+    let info0, info1 = getInfo t node in
+    let info2 = { info1 with succ = fn info1.succ  } in
+    setInfo t node info2 info0
+    
+  let addPred t src dst = setPred t dst (NodeSet.add src)
+  let addSucc t src dst = setSucc t src (NodeSet.add dst)
+      
+  let edge t src dst = 
+    addSucc t src dst;
+    addPred t src dst
+      
+
+(* inspectors *)
+
+  let nodes t f a = 
+    NodeMap.foldBack (fun key _ a -> f key a) t.nodes a
+
+  let edges t f a = 
+    NodeMap.foldBack
+      (fun src info a -> 
+	(NodeSet.foldBack (fun dst a -> f src dst a) info.succ a))
+      t.nodes a
+
+(* algorithms *)
+  exception Cycle of node list
+
+  let findCycle t = 
+    clearGraph t;
+    let rec pop_until n stack rest = 
+      match stack with 
+      | [] -> rest 
+      | n'::ns -> if n = n' then rest else pop_until n ns (n'::rest)
+    in
+    let rec search stack n info = 
+      if is_marked t info then
+	if is_onStack t info then
+	  raise (Cycle (pop_until n stack [n]))
+	else
+	  ()
+      else
+	begin
+	  let stack = n::stack in
+	  set_mark t info;
+	  set_onStack t info;
+	  NodeSet.iter
+	      (fun key -> search stack key (nodeInfo t key))
+	      info.succ;
+	  set_offStack t info
+	end
+    in
+    try 
+      NodeMap.iter
+	(fun src info -> if not (is_marked t info) then search [] src info) 
+	t.nodes;
+      []
+    with
+    | Cycle c -> c
+	
+  let assign t dst src = 
+    if src <> dst then
+      let dstI = nodeInfo t dst in
+      let srcI = nodeInfo t src in
+      let updateSet set = NodeSet.add dst (NodeSet.remove src set) in
+      NodeSet.iter (fun pred -> setSucc t pred updateSet) srcI.pred;
+      NodeSet.iter (fun succ -> setPred t succ updateSet) srcI.succ
+
+module Dfs0 = begin
+
+  (* DFS just using the call-stack *)
+  let dfs t pre post succPre succPost node nodeI acc = 
+    let rec dfsNode node nodeI acc = 
+      let acc = pre node nodeI acc in
+      let acc = NodeSet.foldBack (dfsSucc node nodeI) nodeI.succ acc in
+      post node nodeI acc
+    and dfsSucc node nodeI succ acc = 
+      let succI = nodeInfo t succ in
+      if succPre node nodeI succ succI then
+	let acc = dfsNode succ succI acc in
+	succPost node nodeI succ succI acc
+      else
+	acc  
+	in
+
+    dfsNode node nodeI acc
+
+end
+module Dfs0b = begin
+
+    let rec dfsNode ((pre,post,_,_,_) as funs) node nodeI acc = 
+      let acc = pre node nodeI acc in
+      let acc = NodeSet.foldBack (dfsSucc funs node nodeI) nodeI.succ acc in
+      post node nodeI acc
+    and dfsSucc ((_,_,succPre,succPost,t) as funs) node nodeI succ acc = 
+      let succI = nodeInfo t succ in
+      if succPre node nodeI succ succI then
+	    let acc = dfsNode funs succ succI acc in
+	    succPost node nodeI succ succI acc
+      else
+	    acc
+
+  (* DFS just using the call-stack *)
+  let inline dfs t pre post succPre succPost node nodeI acc = 
+       dfsNode (pre,post,succPre,succPost,t) node nodeI acc
+
+end
+
+
+  type sccs = node list list
+
+  type 'a stack = 
+    | Nil
+    | Cons of ('a stack -> 'a -> ('a * ('a stack))) * ('a stack)
+
+  let cons f stack = Cons(f,stack)
+  let nil = Nil
+
+  let rec eval (a, stack) = 
+    match stack with
+    | Nil -> a
+    | Cons (f,stack) -> eval (f stack a)
+
+(* requires rectypes 
+
+  type 'a stack1 = ('a stack1 -> 'a -> ('a * 'a stack1)) list
+
+  let cons1 f stack = f::stack
+
+  let rec eval1 (a, stack) = 
+    match stack with
+    | [] -> a
+    | f::stack -> eval1 (f stack a)
+*)
+
+  (* DFS building up a custom call-stack *)
+  
+  module Dfs1 = begin
+  
+  let dfs t pre post succPre succPost node nodeI acc = 
+    let wrap f node nodeI stack acc = (f node nodeI acc,stack) in
+    let pre  = wrap pre          in
+    let post = wrap post         in
+    let succPost n nI s sI stack acc = (succPost n nI s sI acc,stack) in
+    (* DFS search on a node *)
+    let rec dfsNode node nodeI stack = 
+      cons 
+	(pre node nodeI)
+	(cons 
+	   (fun stack acc -> 
+	     (acc, NodeSet.foldBack (dfsSucc node nodeI) nodeI.succ stack))
+	   (cons 
+	      (post node nodeI)
+	      stack))
+    (* DFS search on the successor *)
+    and dfsSucc node nodeI succ stack = 
+      let succI = nodeInfo t succ in
+      if succPre node nodeI succ succI then
+	cons 
+	  (fun stack acc -> (acc, dfsNode succ succI stack))
+	  (cons 
+	     (succPost node nodeI succ succI)
+	     stack)
+      else
+	stack
+    in
+    eval (acc, dfsNode node nodeI nil)
+
+ end
+ 
+ module Dfs1b = begin
+    let rec dfsNode ((pre,post,succPre,succPost,t) as funs) node nodeI stack = 
+      cons 
+	(pre node nodeI)
+	(cons 
+	   (fun stack acc -> 
+	     (acc, NodeSet.foldBack (dfsSucc funs node nodeI) nodeI.succ stack))
+	   (cons 
+	      (post node nodeI)
+	      stack))
+    (* DFS search on the successor *)
+    and dfsSucc ((pre,post,succPre,succPost,t) as funs) node nodeI succ stack = 
+      let succI = nodeInfo t succ in
+      if succPre node nodeI succ succI then
+	cons 
+	  (fun stack acc -> (acc, dfsNode funs succ succI stack))
+	  (cons 
+	     (succPost node nodeI succ succI)
+	     stack)
+      else
+	stack
+    
+
+  (* DFS building up a custom call-stack *)
+  let dfs t pre post succPre succPost node nodeI acc = 
+    let wrap f node nodeI stack acc = (f node nodeI acc,stack) in
+    let pre  = wrap pre          in
+    let post = wrap post         in
+    let succPost n nI s sI stack acc = (succPost n nI s sI acc,stack) in
+    (* DFS search on a node *)
+    eval (acc, dfsNode (pre,post,succPre,succPost,t) node nodeI nil)
+ end
+ 
+
+(*-------------------------------------------------------------------------
+   findSCCs is based upon Tarjan's algorithm, 
+   as explained in Aho, Hopcroft and Ullman. 
+   It finds all the strongly connected components of a graph.
+   It requres the call-stack to traverse the graph.
+   ------------------------------------------------------------------------*)
+
+  let findSCCsBase dfs t =
+    clearGraph t;
+    let count = ref 0  in
+    let stack = ref [] in
+    let rec pop_until node result = 
+      match !stack with
+      | [] -> result
+      | ((node',info')::rest) -> 
+	  stack := rest;
+	  set_offStack t info';
+	  let result = node'::result in
+	  if node = node' then 
+	    result
+	  else 
+	    pop_until node result
+    in
+    (* called every time visiting a new node *)
+    let pre node nodeI sccs = 
+      assert (not(is_marked t nodeI));
+      set_mark t nodeI;
+      set_dfNumber t nodeI !count;
+      set_lowLink t nodeI !count;
+      set_onStack t nodeI;
+      count := !count + 1;
+      stack := (node,nodeI)::(!stack);
+      sccs
+    in
+    (* called every time backtracking from a node *)
+    let post node nodeI sccs = 
+      if get_dfNumber t nodeI = get_lowLink t nodeI then
+	(pop_until node [])::sccs
+      else
+	sccs
+    in
+    (* called to filter out successor nodes *)
+    let succPre node nodeI succ succI = 
+      if is_marked t succI then
+	begin
+	  let dfNext = get_dfNumber t succI in
+	  let dfMe   = get_dfNumber t nodeI in
+	  if (dfNext < dfMe && is_onStack t succI) then
+	    set_lowLink t nodeI (min (get_lowLink t nodeI) dfNext);
+	  false
+	end
+      else
+	true
+    in
+    (* called when backtracking from successor nodes *)
+    let succPost node nodeI succ succI sccs = 
+      set_lowLink t nodeI 
+	(min (get_lowLink t nodeI) (get_lowLink t succI));
+      sccs
+    in    
+    let findSCC node nodeI sccs = 
+      if is_marked t nodeI then 
+	sccs
+      else
+    let rec dfsNode node nodeI acc = 
+      let acc = pre node nodeI acc in
+      let acc = NodeSet.foldBack (dfsSucc  node nodeI) nodeI.succ acc in
+      post node nodeI acc
+    and dfsSucc node nodeI succ acc = 
+      let succI = nodeInfo t succ in
+      if succPre node nodeI succ succI then
+	    let acc = dfsNode  succ succI acc in
+	    succPost node nodeI succ succI acc
+      else
+	    acc in 
+
+  (* DFS just using the call-stack *)
+  let dfs t pre post succPre succPost node nodeI acc = 
+       dfsNode node nodeI acc in
+	dfs t pre post succPre succPost node nodeI sccs
+    in
+    NodeMap.foldBack findSCC t.nodes []
+
+  let findSCCs  = findSCCsBase Dfs1.dfs
+
+  let push t = ()
+(*
+    t.isLogged <- true;
+    Log.push t.log
+*)
+
+  let pop t = ()
+(*
+    Log.pop t.log
+*)
+  exception Found
+
+  let connected t n1 n2 = 
+    clearGraph t;
+    let rec search node = 
+      if node = n2 then
+	raise Found
+      else
+	let nodeI = nodeInfo t node in
+	if not (is_marked t nodeI) then
+	  begin
+	    set_mark t nodeI;
+	    NodeSet.iter search nodeI.succ
+	  end
+    in
+    try
+      search n1;
+      false
+    with
+    | Found -> true
+
+
+(* Check whether there is a an edge from node to itself *)
+  let selfLoop t node = 
+    let nodeI = nodeInfo t node in
+    NodeSet.contains node nodeI.succ
+
+
+  (* find shortest path from initial to final, if any *)
+  (* instance of bfs *)
+
+  exception FoundPath of node list
+
+  let shortestPath t initial final = 
+    clearGraph t;
+    List.iter (fun n -> set_mark2 t (nodeInfo t n)) final;
+    let expandOne path frontier n =
+      let nodeI = nodeInfo t n in
+      if is_marked2 t nodeI then
+	raise (FoundPath (n::path))
+      else if is_marked t nodeI then
+	frontier
+      else 
+	begin
+	  set_mark t nodeI;
+	  (n::path, nodeI.succ)::frontier
+	end
+    in
+    let expandList frontier (path,succ) = 
+      NodeSet.foldBack 
+	(fun node frontier -> expandOne path frontier node) 
+	succ 
+	frontier
+    in
+    let rec loop frontier = 
+      if [] = frontier then 
+	None 
+      else
+	loop (List.fold expandList [] frontier)
+    in
+    try 
+      loop (List.fold (expandOne [])  [] initial)
+    with
+      FoundPath path -> Some (List.rev path)
+	
+(*------------------------------------------------------------------------
+  Apply fn to all nodes reachable from initial.
+  -----------------------------------------------------------------------*)
+
+  let foldReachable t initial fn a = 
+    clearGraph t;
+    let rec reach a node = 
+      let nodeI = nodeInfo t node in
+      if is_marked t nodeI then
+	a
+      else
+	let a = fn node a in
+	begin
+	  set_mark t nodeI;
+	  NodeSet.foldBack reach nodeI.succ a
+	end
+    in
+    List.fold reach a initial
+	
+
+(*module UnitTest = *)
+
+  let printGraph t =
+    (*Graph.*)nodes t (fun n () -> Printf.printf "node: %d\n" n) ();
+    (*Graph.*)edges t (fun s d () -> Printf.printf "edge: %d->%d\n" s d) ()
+
+
+  let printSccs = 
+    List.iter (fun scc -> 
+      Printf.printf "Scc\n";
+      List.iter (fun node -> Printf.printf "%d\n" node) scc)
+
+   let time () = (System.Diagnostics.Process.GetCurrentProcess()).UserProcessorTime.TotalSeconds 
+   
+  let timeIt f x = 
+    let t1 = time() in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let y  = f x in
+    let t2 = time() in
+    Printf.printf "time: %f\n" (t2  - t1);
+    y
+
+  let test() = 
+    let t = (*Graph.*)empty() in
+    let _ = (*Graph.*)edge t 1 2 in
+    let _ = (*Graph.*)edge t 2 3 in
+    let _ = (*Graph.*)edge t 3 1 in
+    let _ = (*Graph.*)edge t 1 4 in
+    let _ = (*Graph.*)edge t 4 5 in
+    let _ = printGraph t     in
+
+    let sccs = (*Graph.*)findSCCs t in
+    let _ = printSccs sccs      in
+    (* check use of call-stack *)
+    let _ = 
+      for i = 6 to 100 do
+	(*Graph.*)edge t i (i+1)
+      done;
+      (*Graph.*)edge t 99 6
+    in
+
+    Printf.printf "call stack, inner loop: ";
+    let sccs = timeIt (*Graph.*)(findSCCsBase Dfs0.dfs) t in
+    Printf.printf "call stack, outer loop: ";
+    let sccs = timeIt (*Graph.*)(findSCCsBase Dfs0b.dfs) t in
+    Printf.printf "heap stack, inner loop; ";
+    let sccs = timeIt (*Graph.*)(findSCCsBase Dfs1.dfs) t in
+    Printf.printf "heap stack, outer loop: ";
+    let sccs = timeIt (*Graph.*)(findSCCsBase Dfs1b.dfs) t in
+    Printf.printf "done.\n";
+    ()
+
+  let _ = test()
+
+do   (System.Console.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText ("test.ok", "ok");
+       exit 0)
diff --git a/tests/fsharp/perf/nbody/build.bat b/tests/fsharp/perf/nbody/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/perf/nbody/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/perf/nbody/run.bat b/tests/fsharp/perf/nbody/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/perf/nbody/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/perf/nbody/test.ml b/tests/fsharp/perf/nbody/test.ml
new file mode 100644
index 0000000..eb597e8
--- /dev/null
+++ b/tests/fsharp/perf/nbody/test.ml
@@ -0,0 +1,159 @@
+// #Stress 
+#indent "off"
+(*
+  http://shootout.alioth.debian.org/benchmark.php?test=nbody&lang=all&sort=cpu
+*)
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    System.Console.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let pi = 3.141592653589793
+let solar_mass = 4. * pi * pi
+let days_per_year = 365.24
+
+
+
+type planet = {
+  mutable x : float;  mutable y : float;  mutable z : float;
+  mutable vx: float;  mutable vy: float;  mutable vz: float;
+  mass : float;
+}
+
+
+let advance bodies dt =
+  let n = Array.length bodies - 1 in
+  for i = 0 to n do
+    let b = bodies.[i] in
+    for j = i+1 to n do
+      let b2 = bodies.[j] in
+      let dx = b.x - b2.x  in let dy = b.y - b2.y  in let dz = b.z - b2.z in
+      let distance = sqrt(dx*dx + dy*dy + dz*dz) in
+      let mag = dt / (distance * distance * distance) in
+
+      b.vx <- b.vx - dx * b2.mass * mag;
+      b.vy <- b.vy - dy * b2.mass * mag;
+      b.vz <- b.vz - dz * b2.mass * mag;
+
+      b2.vx <- b2.vx + dx * b.mass * mag;
+      b2.vy <- b2.vy + dy * b.mass * mag;
+      b2.vz <- b2.vz + dz * b.mass * mag;
+    done
+  done;
+  for i = 0 to n do
+    let b = bodies.[i] in
+    b.x <- b.x + dt * b.vx;
+    b.y <- b.y + dt * b.vy;
+    b.z <- b.z + dt * b.vz;
+  done
+
+
+let energy bodies =
+  let e = ref 0. in
+  for i = 0 to Array.length bodies - 1 do
+    let b = bodies.[i] in
+    e := !e + 0.5 * b.mass * (b.vx * b.vx + b.vy * b.vy + b.vz * b.vz);
+    for j = i+1 to Array.length bodies - 1 do
+      let b2 = bodies.[j] in
+      let dx = b.x - b2.x  in let dy = b.y - b2.y  in let dz = b.z - b2.z in
+      let distance = sqrt(dx * dx + dy * dy + dz * dz) in
+      e := !e - (b.mass * b2.mass) / distance
+    done
+  done;
+  !e
+
+
+let offset_momentum bodies =
+  let px = ref 0. in let py = ref 0. in let pz = ref 0. in
+  for i = 0 to Array.length bodies - 1 do
+    px := !px + bodies.[i].vx * bodies.[i].mass;
+    py := !py + bodies.[i].vy * bodies.[i].mass;
+    pz := !pz + bodies.[i].vz * bodies.[i].mass;
+  done;
+  bodies.[0].vx <- - !px / solar_mass;
+  bodies.[0].vy <- - !py / solar_mass;
+  bodies.[0].vz <- - !pz / solar_mass
+
+
+let bodies() = 
+let jupiter = {
+  x = 4.84143144246472090e+00;
+  y = -1.16032004402742839e+00;
+  z = -1.03622044471123109e-01;
+  vx = 1.66007664274403694e-03 * days_per_year;
+  vy = 7.69901118419740425e-03 * days_per_year;
+  vz = -6.90460016972063023e-05 * days_per_year;
+  mass = 9.54791938424326609e-04 * solar_mass;
+} in 
+
+let saturn = {
+  x = 8.34336671824457987e+00;
+  y = 4.12479856412430479e+00;
+  z = -4.03523417114321381e-01;
+  vx = -2.76742510726862411e-03 * days_per_year;
+  vy = 4.99852801234917238e-03 * days_per_year;
+  vz = 2.30417297573763929e-05 * days_per_year;
+  mass = 2.85885980666130812e-04 * solar_mass;
+} in 
+
+let uranus = {
+  x = 1.28943695621391310e+01;
+  y = -1.51111514016986312e+01;
+  z = -2.23307578892655734e-01;
+  vx = 2.96460137564761618e-03 * days_per_year;
+  vy = 2.37847173959480950e-03 * days_per_year;
+  vz = -2.96589568540237556e-05 * days_per_year;
+  mass = 4.36624404335156298e-05 * solar_mass;
+} in 
+
+let neptune = {
+  x = 1.53796971148509165e+01;
+  y = -2.59193146099879641e+01;
+  z = 1.79258772950371181e-01;
+  vx = 2.68067772490389322e-03 * days_per_year;
+  vy = 1.62824170038242295e-03 * days_per_year;
+  vz = -9.51592254519715870e-05 * days_per_year;
+  mass = 5.15138902046611451e-05 * solar_mass;
+} in 
+
+let sun = {
+  x = 0.0;  y = 0.0;  z = 0.0;  vx = 0.0;  vy = 0.0; vz = 0.0;
+  mass= solar_mass;
+} in 
+
+let bodies = [| sun; jupiter; saturn; uranus; neptune |] in 
+bodies
+
+let main n =
+  let bodies = bodies() in 
+  offset_momentum bodies;
+
+  Printf.printf "Energy prior = %.9f\n" (energy bodies);
+  for i = 1 to n do
+    advance bodies 0.01
+  done;
+  Printf.printf "Energy posterior = %.9f\n" (energy bodies);
+  Printf.sprintf "%.9f" (energy bodies)
+
+let _ = main 500000
+
+let failures = ref false
+let report_failure () = 
+  System.Console.Error.WriteLine " NO"; failures := true
+let test (s:string) b = System.Console.Error.Write s;  if b then System.Console.Error.WriteLine " OK" else report_failure() 
+
+let _ = test "dce98nj" (main 500000 = "-0.169096567")
+
+
+
+do   (System.Console.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText ("test.ok", "ok"); 
+       exit 0)
+
diff --git a/tests/fsharp/perf/tdirs b/tests/fsharp/perf/tdirs
new file mode 100644
index 0000000..aff175d
--- /dev/null
+++ b/tests/fsharp/perf/tdirs
@@ -0,0 +1,2 @@
+graph
+nbody
diff --git a/tests/fsharp/regression/26/build.bat b/tests/fsharp/regression/26/build.bat
new file mode 100644
index 0000000..6df2653
--- /dev/null
+++ b/tests/fsharp/regression/26/build.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/26/run.bat b/tests/fsharp/regression/26/run.bat
new file mode 100644
index 0000000..1b38749
--- /dev/null
+++ b/tests/fsharp/regression/26/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/regression/26/test.ml b/tests/fsharp/regression/26/test.ml
new file mode 100644
index 0000000..525ae7c
--- /dev/null
+++ b/tests/fsharp/regression/26/test.ml
@@ -0,0 +1,32 @@
+// #Regression 
+
+let fail m = System.Console.Error.WriteLine (m:string); exit 99
+
+let _ = if (compare [| 1 |] [| 2 |] <> -1) then fail "Test Failed (cew90u98f)"
+let _ = if (compare [| 2 |] [| 1 |] <> 1) then fail "Test Failed (d23v902)"
+let _ = if (compare [| 2 |] [| 2 |] <> 0) then fail "Test Failed (few0vwrlk)"
+let _ = if (compare [| |] [| 2 |] <> -1) then fail "Test Failed (cwe0vr9)"
+let _ = if (compare [| 2 |] [| |] <> 1) then fail "Test Failed (fwelkm23)"
+let _ = if (compare [| |] [| |] <> 0) then fail "Test Failed (cwlvero02)"
+
+let _ = if (compare [| "1" |] [| "2" |] <> -1) then fail "Test Failed (scew90u98f)"
+let _ = if (compare [| "2" |] [| "1" |] <> 1) then fail "Test Failed (sd23v902)"
+let _ = if (compare [| "2" |] [| "2" |] <> 0) then fail "Test Failed (sfew0vwrlk)"
+let _ = if (compare [| |] [| "2" |] <> -1) then fail "Test Failed (scwe0vr9)"
+let _ = if (compare [| "2" |] [| |] <> 1) then fail "Test Failed (sfwelkm23)"
+let _ = if (compare [| |] [| |] <> 0) then fail "Test Failed (scwlvero02)"
+
+type a = A | B
+let _ = if (compare [| A |] [| B |] <> -1) then fail "Test Failed (abcew90u98f)"
+let _ = if (compare [| B |] [| A |] <> 1) then fail "Test Failed (abd23v902)"
+let _ = if (compare [| B |] [| B |] <> 0) then fail "Test Failed (abfew0vwrlk)"
+let _ = if (compare [| |] [| B |] <> -1) then fail "Test Failed (abcwe0vr9)"
+let _ = if (compare [| B |] [| |] <> 1) then fail "Test Failed (abfwelkm23)"
+let _ = if (compare [| |] [| |] <> 0) then fail "Test Failed (abcwlvero02)"
+
+let _ = System.Console.Error.WriteLine "Test Passed"
+
+do (System.Console.Out.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok", "ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/regression/321/build.bat b/tests/fsharp/regression/321/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/regression/321/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/regression/321/run.bat b/tests/fsharp/regression/321/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/regression/321/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/regression/321/test.ml b/tests/fsharp/regression/321/test.ml
new file mode 100644
index 0000000..8669efd
--- /dev/null
+++ b/tests/fsharp/regression/321/test.ml
@@ -0,0 +1,29 @@
+// #Regression 
+type Name = string
+type Attribute = string * string
+and Content =
+   | CElem of Name * Attribute list * Content list
+   | CText of string
+
+type CFilter = Content -> Content list
+
+(* Crude: doesn't do encode entities like ' *)
+(* usage: ignore (List.map (ppContent 0) parse) *)
+let rec ppContent depth content =
+   let indent = "" in
+   let ppA a acc = match a with (n,v) -> System.String.Format(" {0}=\"{1}\"{2}", n, v, acc) in
+   match content with
+   | CElem (n, a, c) -> (match (a,c) with
+                               | ([], []) -> System.Console.Write("<{0}/>\n", n)
+                               | _  -> System.Console.Write("<{0}{1}>\n", n, List.foldBack ppA a "");
+                                       ignore (List.map (ppContent depth) c);
+                                       System.Console.Write("</{0}>\n", n))
+   | CText s -> System.Console.Write("{0}{1}\n", indent, s)
+
+exception Bad_xml_structure of string
+
+ 
+let _ = 
+      (System.Console.Out.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText("test.ok", "ok"); 
+       exit 0)
diff --git a/tests/fsharp/regression/321/test.mli b/tests/fsharp/regression/321/test.mli
new file mode 100644
index 0000000..9fa9855
--- /dev/null
+++ b/tests/fsharp/regression/321/test.mli
@@ -0,0 +1,3 @@
+exception Bad_xml_structure of string
+
+
diff --git a/tests/fsharp/regression/655/build.bat b/tests/fsharp/regression/655/build.bat
new file mode 100644
index 0000000..dc6c2be
--- /dev/null
+++ b/tests/fsharp/regression/655/build.bat
@@ -0,0 +1,40 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto SKip
+)
+
+  
+"%FSC%" %fsc_flags% -a -o:pack.dll xlibC.ml
+if ERRORLEVEL 1 goto Error  
+
+"%PEVERIFY%" pack.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags%    -o:test.exe -r:pack.dll main.fs
+if ERRORLEVEL 1 goto Error  
+
+"%PEVERIFY%" test.exe
+ at if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/655/main.fs b/tests/fsharp/regression/655/main.fs
new file mode 100644
index 0000000..2a5f4da
--- /dev/null
+++ b/tests/fsharp/regression/655/main.fs
@@ -0,0 +1,13 @@
+#indent "off"
+
+open DF
+let x  = new RawPcapfile()
+let xI = x :> Datafile
+
+let _ = 
+      (System.Console.Out.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText("test.ok", "ok"); 
+       exit 0)
+
+	
+
diff --git a/tests/fsharp/regression/655/run.bat b/tests/fsharp/regression/655/run.bat
new file mode 100644
index 0000000..3c41f38
--- /dev/null
+++ b/tests/fsharp/regression/655/run.bat
@@ -0,0 +1,38 @@
+if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+if not exist test.exe goto SetError
+
+if exist test.ok (del /f /q test.ok)
+%CLIX% test.exe
+if ERRORLEVEL 1 goto Error
+if NOT EXIST test.ok goto SetError
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetError
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/regression/655/xlibC.ml b/tests/fsharp/regression/655/xlibC.ml
new file mode 100644
index 0000000..7317495
--- /dev/null
+++ b/tests/fsharp/regression/655/xlibC.ml
@@ -0,0 +1,15 @@
+// #Regression 
+module DF
+
+type Datafile = 
+  interface
+    abstract member advance: unit -> unit
+  end
+
+type RawPcapfile =
+  class
+    new() = {}
+    interface Datafile with
+	member self.advance ()   = ()
+    end
+  end
diff --git a/tests/fsharp/regression/656/build.bat b/tests/fsharp/regression/656/build.bat
new file mode 100644
index 0000000..f666618
--- /dev/null
+++ b/tests/fsharp/regression/656/build.bat
@@ -0,0 +1,33 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+  "%FSC%" %fsc_flags% -o:pack%ILX_CONFIG%.exe misc.fs mathhelper.fs filehelper.fs formshelper.fs plot.fs traj.fs playerrecord.fs trackedplayers.fs form.fs
+  if ERRORLEVEL 1 goto Error  
+
+  "%PEVERIFY%" pack%ILX_CONFIG%.exe
+  if ERRORLEVEL 1 goto Error  
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/656/filehelper.fs b/tests/fsharp/regression/656/filehelper.fs
new file mode 100644
index 0000000..ab637ee
--- /dev/null
+++ b/tests/fsharp/regression/656/filehelper.fs
@@ -0,0 +1,36 @@
+#indent "off"
+
+module FileHelper
+
+open System
+open System.IO
+open System.Windows.Forms
+
+/// Gets subfolder names from specified path
+let GetSubFolderNames path = 
+	let dir = new DirectoryInfo(path) in
+	dir.GetDirectories() |> Array.map ( fun (info:DirectoryInfo) -> info.Name )
+
+/// Gets latest file in specified path matching specified search pattern
+let GetLatestFile path searchPattern	=
+	let dir = new DirectoryInfo(path) in
+	let fileInfos = dir.GetFileSystemInfos(searchPattern) in
+	if (fileInfos.Length>0 ) then
+		let latest = Array.fold 
+		( fun (acc:FileSystemInfo) (info:FileSystemInfo) -> if (info.CreationTime>acc.CreationTime) then info else acc  ) 
+			fileInfos.[0] fileInfos in
+		Some latest.Name
+	else
+		None
+		
+/// Create an enumarable stream from specified file
+let CreateEnumerableStream (fileName:string) =
+    let reader = new StreamReader (fileName) in
+    reader |> Seq.unfold (fun (reader:StreamReader) -> if (reader.EndOfStream) then (reader.Close(); None) else Some(reader.ReadLine(),reader))
+
+/// Create an enumerable csv stream from specified file 
+let CreateEnumrableCSVStream fileName = 
+	CreateEnumerableStream fileName |> Seq.map (fun (s:string) -> s.Split([|','|]))
+			
+			
+	
diff --git a/tests/fsharp/regression/656/form.fs b/tests/fsharp/regression/656/form.fs
new file mode 100644
index 0000000..8699a79
--- /dev/null
+++ b/tests/fsharp/regression/656/form.fs
@@ -0,0 +1,932 @@
+#indent "off"
+
+// command line build:
+// fsc --target-winexe -g --standalone misc.fs mathhelper.fs filehelper.fs formshelper.fs plot.fs traj.fs playerrecord.fs trackedplayers.fs form.fs -o viewer.exe
+
+open System
+open System.IO
+open System.Collections.Generic
+open System.Windows.Forms
+open System.Diagnostics
+open System.Drawing
+open System.Drawing.Drawing2D
+open System.Threading
+open System.Xml
+open Misc
+open MathHelper
+open FileHelper
+open FormsHelper
+open PlayerRecords
+open TrackedPlayers
+open PlotTrajectory
+open Plot
+open PlayerRecords
+
+// Initialise level calculation
+do SetLevel !k1 !k2 k3
+let pins = (Array.init (List.length !skillList) (fun _ -> true))
+
+/// Base Path to search for results in
+let basePath = ref @"c:\" 
+let argv = System.Environment.GetCommandLineArgs()
+do basePath := if (argv |> Array.length > 1) then argv.[1] else @"c:\"
+	
+let gamesPlayedStart = ref 0s
+let gamesPlayedEnd = ref 10000s
+
+let labelK1 = new Label()
+let labelK2 = new Label()
+	
+// Create form	
+let mainForm = CreateForm "Select Experiment (v1.05)"
+let tip = new ToolTip()
+do tip.ShowAlways <- true; tip.ReshowDelay <- 100; tip.AutoPopDelay <- 1500; tip.InitialDelay <- 100
+
+let groupFolder = new GroupBox()
+do groupFolder |> BlueFlash
+do groupFolder.Text <- "Experiment folder"
+do groupFolder.Dock <- DockStyle.Left
+do groupFolder.Size <- new Size(mainForm.Size.Width/2,groupFolder.Size.Height)
+
+// Create table layout panel for folders
+let folderPanel = new TableLayoutPanel()
+do folderPanel.ColumnCount <- 1
+do folderPanel.RowCount <- 6
+do folderPanel.Dock <- DockStyle.Fill
+do groupFolder.Controls.Add(folderPanel)
+	
+let formDock = FormDockLocation.Create mainForm
+
+/// ComboBox of folder names indicating selected variables
+let combos = new List<ComboBox>()
+let selectedMeasure = ref "Mu"
+let lastFileLock = ref (Guid.NewGuid())
+let lastFileName = ref ""
+let mutable lastTable = []
+
+/// Get measurement function
+let GetMeasureFun measure = 
+	match measure with | "TrueSkill" ->	(fun (player:PlayerRecord) -> player.TrueSkill) 
+					   | "Level" ->	(fun (player:PlayerRecord) -> player.Level !k1 !k2 k3 ) 
+				       | _ -> (fun (player:PlayerRecord) -> player.mu)
+
+let mutable brush = new HatchBrush(HatchStyle.HorizontalBrick, Colour.Blue, Colour.Blue)
+
+let playedEdges =(linspace 0. 500. 101) |>  List.map (fun v -> Math.Round(v,0) )
+let playedCounts = Array.init ((List.length playedEdges) + 1) (fun _ -> 0) 	
+let playedTree = System.Double.MinValue :: playedEdges |> List.toArray |> CreateTree 0
+
+let ShowGamesPlayed() =
+	let edges = System.Double.MinValue :: (List.append playedEdges [System.Double.MaxValue]) |> List.toArray in
+	let playedPairs = List.zip (System.Double.MinValue :: playedEdges) (List.append playedEdges [System.Double.MaxValue]) |> List.toArray in				
+	let funNo = ref 0 in
+	let rangeFun() = 
+		let vertRange = 
+			match !funNo with 
+				| 0 -> {new Range with min=0.0F; and max=max 1.0F (float32 (Array.fold max 0 playedCounts)); and name="Players" }
+				| 1 -> {new Range with min=0.0F; and max=max 1.0F (float32 (Array.fold (+) 0 playedCounts)); and name="Cum Players" }
+				| 2 -> {new Range with min=0.0F; and max=100.0F; and name="Cum Players %" }
+				| 3 -> {new Range with min=0.0F; and max=100.0F; and name="Cum Players %" }
+				| _ -> raise (new ApplicationException("error"))
+				in
+		let horizRange = {new Range with min=0.0F; and max=500.0F; and name="Played" } in 
+		(vertRange, horizRange)
+		in
+	let drawFun gr t = 
+		let playedCum, total = playedCounts |> Array.fold ( fun (li,cum) i -> let v = cum+i in (v :: li, v ) ) ([],0) in
+		let playedCum = playedCum |> List.rev in
+		match !funNo with
+			| 0 -> 
+				let ar = playedCounts |> Array.mapi (fun i a -> let x1,x2 = playedPairs.[i] in (float32 x1,float32 x2,a) ) in					
+				Array.sub ar 1 (ar.Length-2) |> DrawBarGraph gr t brush 		
+			| 1 ->
+				let ar = playedCum |> List.toArray |> Array.mapi (fun i a -> let x1,x2 = playedPairs.[i] in (float32 x1,float32 x2,a) ) in					
+				Array.sub ar 1 (ar.Length-2) |> DrawBarGraph gr t brush; 		
+ 
+				let cum = playedCum |> List.mapi (fun i v -> (edges.[i+1], float v) ) |> List.toArray in	
+				Array.sub cum 1 (cum.Length-2) |> DrawLineGraph gr t 				
+			| 2 -> 
+				let playedPc = playedCum |> List.map ( fun i -> if 0=i  then 0.0 else let y = float i in let t = float total in  
+				((y*100.0)/t) ) in	
+				let pc = playedPc |> List.mapi (fun i v -> (edges.[i+1], v) ) |> List.toArray in	
+				Array.sub pc 1 (pc.Length-2) |> DrawLineGraph gr t	
+			| 3 ->
+				let m = max 1.0F (float32 (Array.fold max 0 playedCounts)) in
+				let ar = playedCounts |> Array.mapi (fun i a -> let x1,x2 = playedPairs.[i] in (float32 x1,float32 x2, int (float32 a * 100.F/m)) ) in					
+				Array.sub ar 1 (ar.Length-2) |> DrawBarGraph gr t brush;
+
+				let playedPc = playedCum |> List.map ( fun i -> if 0=i  then 0.0 else let y = float i in let t = float total in  
+				((y*100.0)/t) ) in	
+				let pc = playedPc |> List.mapi (fun i v -> (edges.[i+1], v) ) |> List.toArray in	
+				Array.sub pc 1 (pc.Length-2) |> DrawLineGraph gr t									 
+				
+			| _ -> raise (new ApplicationException("error"))
+		in		
+	let form = CreateForm "Games played" in
+	form.Width <- 1000; form.Height <- 800;	
+	let picture = AddGraph form rangeFun drawFun false in
+
+	let menuFunction = form.Menu.MenuItems.Add("&Function") in 
+	let miHist = new MenuItem("Histogram") in
+	let miCum = new MenuItem("Cumulative") in
+	let miPc = new MenuItem("Cumulative %")in
+	let miPcHist = new MenuItem("Cumulative % (+ Histogram)")in
+
+	menuFunction.MenuItems.AddRange([|miHist;miCum;miPc;miPcHist|]) |> ignore;			
+	miHist.Click.Add( fun _ -> funNo := 0; form.Invalidate(true) );
+	miCum.Click.Add( fun _ -> funNo := 1; form.Invalidate(true) ); 
+	miPc.Click.Add( fun _ -> funNo := 2; form.Invalidate(true) ); 
+	miPcHist.Click.Add( fun _ -> funNo := 3; form.Invalidate(true) ); 
+	form.Menu.MenuItems.Add(menuFunction) |> ignore;
+
+	let _ = form.Show() in
+	form
+
+
+/// Display sample histogram on specified form
+let DisplaySample (form:Form) (measure, fileName) =	
+	let skillEdges = (linspace -25. 75. 101) |> List.map (fun v -> Math.Round(v,2) ) in	  
+	let skillCounts = Array.init ((List.length skillEdges) + 1) (fun _ -> 0) in		
+		
+	let dataThread = new Thread( fun() ->			
+		let f = GetMeasureFun measure in
+		let skillTree = System.Double.MinValue :: skillEdges |> List.toArray |> CreateTree 0 in
+			form.Invoke( new MethodInvoker( fun _ -> tip.SetToolTip(labelK1, "Mean: calculating" ) )) |> ignore;
+			form.Invoke( new MethodInvoker( fun _ -> tip.SetToolTip(labelK2, "Standard Deviation: calculating" ) )) |>ignore;											
+			let ShowStatistics count total skills = 					
+				let (mean:float) = (total/(float) count ) in
+				let _ = try if not form.IsDisposed then form.Invoke( new MethodInvoker( 
+					fun _ -> try tip.SetToolTip(labelK1, "Mean: " ^ mean.ToString() ) with e -> LogWarning e
+					)) |> ignore with e -> LogWarning e
+				in
+				let deltaSquared = skills |> List.fold ( fun acc value -> let delta = (mean-value) in acc + (delta*delta) ) 0.0 in
+				let sd = Math.Sqrt(deltaSquared / (float count)) in								
+				try if not form.IsDisposed then form.Invoke( new MethodInvoker( 
+					fun _ -> try tip.SetToolTip(labelK2, "Standard Deviation: " ^ sd.ToString() ) with e -> LogWarning e
+					)) |>ignore  with e -> LogWarning e |> ignore
+			in
+			lock lastFileLock ( fun _ ->
+			if not (fileName = (!lastFileName)) then 
+			(					
+				Array.fill playedCounts 0 (Array.length playedCounts) 0;		
+				let (table, skills, total, count) = EnumerateLeaderboard fileName |>
+					Seq.fold (fun (table, skills, total, count) (p:PlayerRecord) -> 			
+						addone playedTree playedCounts (Convert.ToDouble(p.games_played));		
+						if (p.games_played>=(!gamesPlayedStart) && p.games_played<(!gamesPlayedEnd)) then							
+							let v = f(p) in 
+								addone skillTree skillCounts v;	// update histogram
+						    let skill = GetSkill p.mu  p.sigma in
+							(p :: table, skill :: skills, total + skill, count + 1)
+						else						
+							(p :: table, skills, total, count) ) ([], [], 0., 0) in			
+				lastFileName := fileName; lastTable <- table;				
+				ShowStatistics count total skills
+			)
+			else
+			(			
+				let skills, total, count = lastTable |> List.fold ( fun (skills,total,count) (p:PlayerRecord) ->
+					if (p.games_played>=(!gamesPlayedStart) && p.games_played<(!gamesPlayedEnd)) then
+						let v = f(p) in addone skillTree skillCounts v;	// update histogram											
+						let skill = GetSkill p.mu p.sigma in
+						(skill :: skills, total + skill, count + 1)
+					else
+						(skills, total, count) ) ([], 0., 0)								
+				in
+				ShowStatistics count total skills
+			)
+		)
+	) in dataThread.Start();	
+	
+	let finished = ref false in
+	let drawThread = new Thread( fun () -> 
+		let f() = try if not (form.IsDisposed) then form.Invalidate(true) with e -> LogWarning e in
+		try 
+			brush <- new HatchBrush(HatchStyle.DiagonalCross, Colour.AliceBlue, Colour.Blue);			
+			while( not form.IsDisposed && not !finished ) do 
+				finished := dataThread.Join(100);				
+				let _ = if !finished then brush <- new HatchBrush(HatchStyle.HorizontalBrick, Colour.Blue, Color.Blue) in
+				if not (form.IsDisposed) then form.Invoke( new MethodInvoker(f) ) |> ignore
+				done; 
+		with e -> LogWarning e
+	) in drawThread.Start();
+	
+		
+		
+	let funNo = ref 0 in		
+												
+	let edgesArray = skillEdges |> List.map float32 |> List.toArray in																							
+	/// Show bar graph
+	let hlabel = measure in let vlabel = "Players" in
+	let rangeFun() = 
+		let first = System.Array.FindIndex(skillCounts, ( fun (v:int) -> v>0 ) ) in
+		let last = System.Array.FindLastIndex(skillCounts, ( fun(v:int) -> v>0 ) ) in					
+		let horizRange = {new Range with min=if -1 = first then 0.F else min 0.F edgesArray.[first]; 
+			and max=if -1 = last then 1.F else edgesArray.[last]; and name=hlabel }  in
+		let vertRange = match !funNo with
+			| 0 -> {new Range with min=0.0F; and max=max 1.0F (float32 (skillCounts |> Array.fold max 1)); and name=vlabel }
+			| 1 -> {new Range with min=0.0F; and max=max 1.0F (float32 (skillCounts |> Array.fold (+) 0)); and name=vlabel }
+			| 2 -> {new Range with min=0.0F; and max=100.0F; and name="Players %" }
+			| _ -> raise (new ApplicationException("error"))
+		in
+		(vertRange, horizRange) 
+	in
+	let drawFun gr t = 
+		let _, hRange = rangeFun() in
+		let first, last = max 1 (System.Array.FindIndex(edgesArray, (fun(v) -> hRange.min = v ) )), 	
+			System.Array.FindIndex(edgesArray,(fun(v) -> hRange.max = v) )in			
+		let copy = Array.init (last - first) (fun _ -> 0 ) in 
+		System.Array.ConstrainedCopy(skillCounts,first,copy,0,last-first);
+		
+		let ar = match !funNo with
+			| 0 -> copy
+			| 1 -> let li, t = copy |> Array.fold( fun (li,t) i -> let x = t + i in (x :: li, x)  ) ([],0) in li |> List.rev |> List.toArray
+			| 2 -> let li, t = copy |> Array.fold( fun (li,t) i -> let x = t + i in (x :: li, x)  ) ([],0) in 
+				li |> List.map ( fun v -> if v = 0 then 0 else (v*100)/t )	// TODO: fix rounding issue
+				|> List.rev |> List.toArray
+			| _ -> raise (new ApplicationException("error"))
+		in
+		ar |> Array.mapi (fun i a -> (edgesArray.[i+first-1], edgesArray.[i+first],a) ) |>
+		DrawBarGraph gr t brush in
+	let picture = AddGraph form rangeFun drawFun false in
+	let menuFunction = form.Menu.MenuItems.Add("&Function") in 
+	let miHist = new MenuItem("Histogram") in
+	let miCum = new MenuItem("Cumulative") in
+	let miPc = new MenuItem("Cumulative %") in
+	menuFunction.MenuItems.AddRange([|miHist;miCum;miPc|]) |> ignore;			
+	miHist.Click.Add( fun _ -> funNo := 0; form.Invalidate(true) );
+	miCum.Click.Add( fun _ -> funNo := 1; form.Invalidate(true) ); 
+	miPc.Click.Add( fun _ -> funNo := 2; form.Invalidate(true) ); 
+	form.Menu.MenuItems.Add(menuFunction) |> ignore
+
+
+  	   																				
+/// Show leaderboard histogram
+let LeaderBoardHandler form measure fileName =	
+	let ShowSample sample =  			
+		let f() = try DisplaySample form sample with e -> LogWarning e in
+		if not form.IsDisposed then try form.Invoke( new MethodInvoker(f) ) |> ignore with e -> LogWarning e else ()
+	in	
+	//AsyncApp (measure,fileName) LoadSample ShowSample;
+	DisplaySample form (measure,fileName);
+	form
+	
+/// Handler change to input paramters
+let ChangeHandler measure path =
+	// Check for tracked players file
+	let trackFile = GetLatestFile path "Track-*.csv" in
+	let _ = match trackFile with 
+		| Some name -> 	let title = "Select Tracked Players (" ^ path ^ ")" in
+						let form = match formDock.GetChildForm "track" with
+								   | Some child -> child.Text <- title; child
+								   | None -> let child = CreateForm title in
+											 child.Width <- 1000;										
+											 let _ = child.Show() in 	
+											 formDock.SetChild child "track" 0 mainForm.Height; // Align to bottom left
+											 child
+						in																					   					  
+						let _ = TrackedPlayersHandler form formDock measure (!gamesPlayedStart,!gamesPlayedEnd) (Path.Combine(path,name)) in					   
+						()					    
+		| None -> ()
+	in
+	let width = 1000 in
+	// Check for leader board of players file
+	let leadFile = GetLatestFile path "Lead-*.csv" in
+	let _ = match leadFile with 
+		| Some name ->	let title =  "Bar graph (" ^ path ^ ")" in
+						let form = match formDock.GetChildForm "lead" with
+								  | Some child -> child.Text<-title;child.Controls.Clear();child.Menu.MenuItems.Clear();child
+								  | None -> let child = CreateForm title in child.Show();
+											child.Height <- mainForm.Height;
+   											child.Width <- width - mainForm.Width;
+											formDock.SetChild child "lead" mainForm.Width 0;	// Align to top right
+											child
+					   in		      			   					   	
+					   let _ = LeaderBoardHandler form measure (Path.Combine(path,name)) in  					   				   					     					   
+					   ()
+		| None -> ()
+	in ()		
+	
+/// Get relative path from combos
+let GetRelativePath (combos:List<ComboBox>) =
+	let folders = combos.ToArray() |> Array.map ( fun (combo:ComboBox) -> if combo.SelectedItem <> null then combo.SelectedItem.ToString() else "" ) in
+	System.String.Join(Path.DirectorySeparatorChar.ToString(), folders)
+	
+/// Get selected path from combo boxes	
+let GetSelectedPath (combos:List<ComboBox>) = 
+	let relPath = GetRelativePath combos in
+	Path.Combine(!basePath,relPath)
+
+/// ComboBox select event handler
+let rec ComboSelectHandler (sender:obj) (e:EventArgs) =
+	let index = combos.FindIndex((fun combo -> combo.Equals(sender) ) ) in	
+	let relevant = combos.GetRange(0, (index+1)) in 
+	let path = GetSelectedPath relevant in
+	let folders = GetSubFolderNames path in
+	let _ = if (folders.Length > 0 ) then 
+		// Remove any combos after this one
+		let _ = combos.ToArray() |> Array.iteri (fun i combo -> 
+			if( i>index ) then let _ = combos.Remove(combo) in folderPanel.Controls.Remove(combo); ()  ) in
+		// Create the new combo
+		let combo = CreateCombo folders in
+		let _ = combos.Add(combo) in		
+		let	_ = combo.SelectionChangeCommitted.AddHandler( new EventHandler(ComboSelectHandler) )  in
+		folderPanel.Controls.Add(combo)
+	in
+	ChangeHandler !selectedMeasure path				
+			
+/// Sets combos from specified path
+let SetCombos (relPath:string) =
+	// Remove current combos
+	combos.ToArray() |> Array.iter (fun combo -> combos.Remove(combo) |> ignore; folderPanel.Controls.Remove(combo) );	
+	// Set combos
+	let path = relPath.Split([|Path.DirectorySeparatorChar|]) |> Array.fold ( fun (acc:string) folder ->
+		let absPath = Path.Combine( !basePath, acc) in
+		let folders = GetSubFolderNames absPath in
+		let combo = CreateCombo folders in
+		combo.SelectedItem <- folder;
+		let _ = combos.Add(combo) in		
+		let	_ = combo.SelectionChangeCommitted.AddHandler( new EventHandler(ComboSelectHandler) )  in
+		folderPanel.Controls.Add(combo) |> ignore; 
+		Path.Combine(acc,folder)
+	) "" in	
+	ChangeHandler !selectedMeasure (Path.Combine(!basePath,path))
+			
+			
+// Create first ComboBox	
+do let folders = GetSubFolderNames !basePath in
+	let combo = CreateCombo folders in
+	let _ = combos.Add(combo) in
+	combo.SelectionChangeCommitted.AddHandler( new EventHandler(ComboSelectHandler) );
+	folderPanel.Controls.Add( combo )
+
+// Group box for measurment types
+let groupMeasure = new GroupBox()
+do groupMeasure |> BlueFlash
+do groupMeasure.Dock <- DockStyle.Top
+do groupMeasure.Text <- "Measure"
+
+let tableMeasure = new TableLayoutPanel() 
+do tableMeasure.ColumnCount <- 3 
+do tableMeasure.Dock <- DockStyle.Fill
+do tableMeasure |> AddToControl groupMeasure
+	
+do	let f = (fun (sender:obj) e -> let radio = sender :?> RadioButton in 
+		if radio.Checked then let path = GetSelectedPath combos in 
+			selectedMeasure := radio.Text;
+			ChangeHandler radio.Text path	
+	) in	
+	let r1 = CreateRadio "Mu" f in r1 |> BlueFlash;
+	let r2 = CreateRadio "TrueSkill" f in r2 |> BlueFlash; r2.Checked <- true;
+	let r3 = CreateRadio "Level" f in r3 |> BlueFlash;
+	[|r1;r2;r3|] |> AddArrayToControl tableMeasure
+			
+do	tableMeasure |> AddToControl groupMeasure	
+do groupMeasure.Size <- new Size(groupMeasure.Size.Width, groupMeasure.PreferredSize.Height + tableMeasure.PreferredSize.Height)
+
+// Create right panel	
+let rightPanel = new Panel()
+do rightPanel.Dock <- DockStyle.Fill
+
+
+do mainForm.Controls.Add(rightPanel)
+do mainForm.Controls.Add(groupFolder)	
+do groupMeasure |> AddToControl mainForm
+
+// --- Range Group
+let rangeGroup = new GroupBox()
+do rangeGroup |> BlueFlash
+do rangeGroup.FlatStyle <- FlatStyle.Popup
+do rangeGroup.Height <- rightPanel.Height/2
+do rangeGroup.Text <- "Games played range"
+do rangeGroup.Click.Add( fun _ -> ShowGamesPlayed() |> ignore ) 
+do rangeGroup.Dock <- DockStyle.Fill //Bottom
+do rangeGroup |> AddToControl rightPanel
+
+let rangeTable = new TableLayoutPanel()
+do rangeTable.ColumnStyles.Add( new ColumnStyle(SizeType.Percent,50.0f) ) |> ignore
+do rangeTable.ColumnStyles.Add( new ColumnStyle(SizeType.Percent,50.0f) ) |> ignore
+do rangeTable.Dock <- DockStyle.Fill
+do rangeTable.ColumnCount <- 2
+let labelStart = new Label()
+do labelStart.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Right
+do labelStart.Text <- "Start"
+do labelStart |> BlueFlash
+let editStart = new NumericUpDown()
+do editStart.Maximum <- Convert.ToDecimal(100000)
+do editStart.Value <- Convert.ToDecimal(!gamesPlayedStart)
+do editStart.Increment <- Convert.ToDecimal(10)
+do editStart.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Left
+do editStart.Width <- 64
+do editStart.TextChanged.Add( fun _ -> gamesPlayedStart := if editStart.Value<=Convert.ToDecimal(Int16.MaxValue) then Decimal.ToInt16(editStart.Value) else Int16.MaxValue )
+let labelEnd = new Label()
+do labelEnd.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Right
+do labelEnd.Text <- "End"
+do labelEnd |> BlueFlash
+let editEnd = new NumericUpDown()
+do editEnd.Maximum <- Convert.ToDecimal(100000)
+do editEnd.Value <- Convert.ToDecimal(!gamesPlayedEnd)
+do editEnd.Increment <- Convert.ToDecimal(10)
+do editEnd.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Left
+do editEnd.Width <- 64
+do editEnd.TextChanged.Add( fun _ -> gamesPlayedEnd := if editEnd.Value<=Convert.ToDecimal(Int16.MaxValue) then Decimal.ToInt16(editEnd.Value) else Int16.MaxValue )
+
+
+do rangeTable.Controls.Add(labelStart)
+do rangeTable.Controls.Add(editStart)
+do rangeTable.Controls.Add(labelEnd)
+do rangeTable.Controls.Add(editEnd)
+
+do rangeGroup.Controls.Add(rangeTable)
+
+let rangeUpdateButton = new Button();
+do rangeUpdateButton.Text <- "Update"
+do rangeUpdateButton.Dock <- DockStyle.Bottom
+do rangeUpdateButton |> BlueFlash
+do rangeGroup.Controls.Add(rangeUpdateButton)
+
+do rangeUpdateButton.Click.Add( fun _ -> GetSelectedPath combos |> ChangeHandler !selectedMeasure)
+// ---
+
+// --- Level Group -----
+let levelGroup = new GroupBox()
+do levelGroup |> BlueFlash
+do levelGroup.Height <- (rightPanel.Height/2)+4
+do levelGroup.Text <- "Level parameters"
+do levelGroup.Dock <- DockStyle.Top
+do levelGroup |> AddToControl rightPanel
+
+
+let levelTable = new TableLayoutPanel()
+do levelTable.ColumnStyles.Add( new ColumnStyle(SizeType.Percent,50.0f) ) |> ignore
+do levelTable.ColumnStyles.Add( new ColumnStyle(SizeType.Percent,50.0f) ) |> ignore
+do levelTable.Dock <- DockStyle.Fill
+do levelTable.ColumnCount <- 2
+do labelK1.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Right
+do labelK1.Text <- "K1"
+do labelK1 |> BlueFlash
+do tip.SetToolTip(labelK1, "Experiment's mean (of mu-n*sigma) will appear on this tip" ) 
+let editK1 = CreateNumericBox true
+do editK1.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Left
+do editK1.Width <- 64
+do editK1.Text <- Convert.ToString(!k1)
+do editK1.TextChanged.Add( fun _ -> let v = ref 0.0 in if Double.TryParse(editK1.Text, v) then k1 := !v) 
+do labelK2.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Right
+do labelK2.Text <- "K2"
+do labelK2 |> BlueFlash
+do tip.SetToolTip(labelK2, "Experiment's standard deviation (from mu-n*sigma) will appear on this tip" ) 
+let editK2 = CreateNumericBox false
+do editK2.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Left
+do editK2.Width <- 64
+do editK2.Text <- Convert.ToString(!k2)
+do editK2.TextChanged.Add( fun _ -> let v = ref 0.0 in if Double.TryParse(editK2.Text, v) then k2 := !v)
+
+let labelSigma = CreateLabel "Sigma"
+do labelSigma.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Right
+do labelSigma |> BlueFlash
+do tip.SetToolTip(labelSigma, "Experiment's sigma factor used to calculate TrueSkill and Level as mu - n*sigma, default value is 3." ) 
+let editSigma = CreateNumericBox true
+do editSigma.Anchor <- AnchorStyles.Bottom ||| AnchorStyles.Left
+do editSigma.Width <- 64
+do editSigma.Text <- Convert.ToString(!SigmaFactor)
+do editSigma.TextChanged.Add( fun _ -> let v = ref 0.0 in if Double.TryParse(editSigma.Text, v) then SigmaFactor := !v)
+
+let labelMap = new Label()
+do labelMap.Text <- "Skill map"
+
+let buttonEditor = new Button();
+do buttonEditor.Text <- "Edit"
+
+do levelTable.Controls.Add(labelK1)
+//do levelTable.Controls.Add(editK1)
+do levelTable.Controls.Add(labelK2)
+//do levelTable.Controls.Add(editK2)
+do levelTable.Controls.Add( labelMap )
+do levelTable.Controls.Add( buttonEditor )
+do levelTable.Controls.Add(labelSigma)
+do levelTable.Controls.Add(editSigma)
+
+do levelGroup.Controls.Add(levelTable)
+
+let levelUpdateButton = new Button();
+do levelUpdateButton.Text <- "Update"
+do levelUpdateButton.Dock <- DockStyle.Bottom
+do levelUpdateButton |> BlueFlash
+do levelGroup.Controls.Add(levelUpdateButton)
+
+do levelUpdateButton.Click.Add( fun _ -> GetSelectedPath combos |> ChangeHandler !selectedMeasure)
+
+// Test code
+let showInverse() =
+	let xs = linspace -10. 70. 81 in
+	let li = xs |> List.map (fun x -> (x, GetLevelFromSkill x !k1 !k2 k3) ) in
+	let _ = ShowLineGraph "Level" "TrueSkill" (List.toArray li) in ()
+	
+do levelGroup.Click.Add( fun _ -> showInverse() )
+
+let resetItem points (pinned: _ []) item = 
+	let mutable low = if item = 0 then 0 else item-1 in
+	while not pinned.[low] do low <- low - 1 done;
+	let top = (Array.length points)-1 in
+	let mutable high = if item = top then top else item+1 in
+	while not pinned.[high] do high <- high + 1 done;		
+		
+	for i = (low+1) to high-1 do 
+		let sx, sy = points.[low] in let ex, ey = points.[high] in
+		let dy = ey - sy in let dx = ex - sx in
+		let	cx, cy = points.[i] in					
+		points.[i] <- (cx, sy + ((dy*(cx-sx))/dx))
+		done;
+
+// Skill mapping editor
+do buttonEditor.Click.Add( fun _ ->
+	let lt = ref {new Transformation2d with origin = (new PointF(0.F,0.F)); and scale = (new SizeF(0.F,0.F)) } in
+	let rects = ref [||] in
+
+ 	let xs = linspace 1.0 49. 49 in
+ 	//xs |> List.iter ( fun x -> Debug.WriteLine(x) );
+ 	let on = Array.init (List.length xs) (fun i -> true) in
+ 	pins |> Array.iteri (fun i x -> on.[i] <- x );
+ 	
+ 	let skillArray = !skillList |> List.toArray in
+	let data = xs |> List.mapi (fun i x -> (x,  skillArray.[i]) //(norminv (x/k3))*(!k2) + !k1 ) 
+		) |> List.toArray in	
+	let original = Array.copy data in
+		
+	
+	let GetCrosshairs (points:PointF array) =
+		let width = 4.0F in
+		points |> Array.map ( fun (point:PointF) ->			 
+		new RectangleF( point.X - width, point.Y - width, (2.0F*width)+1.0F, (2.0F*width)+1.0F) ) 		
+	in
+	
+	let DrawLineGraph (gr:Graphics) transform (data:(float * float) array) = 		
+		lt := transform;
+		
+		// Draw original line
+		let op = original |> Array.map ( fun (x,y) -> CreatePoint transform (float32 x, float32 y) ) in			
+		gr.DrawLines( new Pen(Colour.Green), op);
+		
+		//let opabove = original |> Array.map ( fun (x,y) -> CreatePoint transform (float32 x, float32 (y + 1.0)) ) in			
+		//gr.DrawLines( new Pen(Colour.Honeydew), opabove);
+
+		//let opbelow = original |> Array.map ( fun (x,y) -> CreatePoint transform (float32 x, float32 (y - 1.0)) ) in			
+		//gr.DrawLines( new Pen(Colour.Honeydew), opbelow);
+												
+		let points = data |> Array.map ( fun (x,y) -> CreatePoint transform (float32 x, float32 y) ) in
+		rects := GetCrosshairs points; 		
+				
+		// Draw red line
+		let pen = new Pen(Colour.Red) in
+		pen.Width <- 2.0F;
+		let linePoints = on |> Array.mapi( fun i b -> (b, points.[i]) ) |> Array.filter( fun (b,pt) -> b )
+			|> Array.map( fun (b,pt) -> pt ) in		
+		gr.DrawLines(pen, linePoints);
+		
+		// Draw red rectangles
+		let red = !rects |>  Array.mapi( fun i x -> (on.[i], x) ) |> Array.filter( fun (b,x) -> b )
+			|> Array.map( fun (b,x) -> x ) in
+		
+		gr.DrawRectangles(pen, red);
+		
+		// Draw blue (disabled) rectangles
+		let blue = !rects |>  Array.mapi( fun i x -> (on.[i], x) ) |> Array.filter( fun (b,x) -> not b )
+			|> Array.map( fun (b,x) -> x ) in
+
+		if Array.length blue > 0 then gr.DrawRectangles(new Pen(Colour.Blue), blue)
+						
+	in
+		
+	let drawFun gr transform = data |> DrawLineGraph gr transform in
+	
+	let setItem item ay = 
+		let mutable low = if item = 0 then 0 else item-1 in
+		while not on.[low] do low <- low - 1 done;
+		let top = (Array.length data)-1 in
+		let mutable high = if item = top then top else item+1 in
+		while not on.[high] do high <- high + 1 done;		
+		let hello = 0.1134 in
+		let _,miny = if item>0 then data.[low] else (hello, Double.NegativeInfinity) in
+		let _,maxy = if item<top then data.[high] else (hello, Double.PositiveInfinity) in
+		let ky = float ay in
+		let ry = min (max miny ky) maxy in						
+		let vx, vy = data.[item] in	
+		data.[item] <- (vx, ry);
+		// Recalculate points
+		for i = (low+1) to item do 
+			let sx, sy = data.[low] in let ex, ey = data.[item] in
+			let dy = ey - sy in let dx = ex - sx in
+			let cx, cy = data.[i] in
+			data.[i] <- (cx, sy + ((dy*(cx-sx))/dx))
+			done;					
+		for i = item+1 to (high-1) do
+			let sx, sy = data.[item] in let ex, ey = data.[high] in
+			let dy = ey - sy in let dx = ex - sx in
+			let cx, cy = data.[i] in
+			data.[i] <- (cx, sy + ((dy*(cx-sx))/dx))			
+			done;									
+		()
+		in 
+		
+	// Create form	
+	let rangeFun() =
+		let xl, xh, yl, yh = data |> Array.fold ( fun acc (x,y) -> 
+		let xl,xh,yl,yh = acc in (min x xl, max x xh, min y yl, max y yh) 
+		) (Double.MaxValue,Double.MinValue,Double.MaxValue,Double.MinValue) in
+		let yl,yh = if yl=yh then yl - 1.,yh + 1. else yl,yh in
+		let horizRange = {new Range with min=min 0.0F (float32 xl); and max=float32 xh; and name="Level" } in	
+		let vertRange = { new Range with min=min 0.0F (float32 (yl - 2.0)); and max=float32 (yh + 2.0); and name="TrueSkill" } in	
+		(vertRange, horizRange) in
+	let form = CreateForm "Skill mapping editor" in
+	form.Width <- 1000; form.Height <- 800;	
+	let panel, picture = AddGraph form rangeFun drawFun true in
+			
+		
+	let buttonShow = new Button() in buttonShow.Text <- "Show";		
+	let buttonUse = new Button() in buttonUse.Text <- "Use";
+	let buttonClearAll = new Button() in buttonClearAll.Text <- "Clear All";
+	let buttonSetAll = new Button() in buttonSetAll.Text <- "Set All";
+	//let buttonInverse = new Button() in buttonInverse.Text <- "Show Inverse";
+	let buttonOK = new Button() in buttonOK.Text <- "OK(Commit)"; buttonOK.DialogResult <- DialogResult.OK;
+	let buttonCancel = new Button() in buttonCancel.Text <- "Cancel(Exit)"; buttonCancel.DialogResult <- DialogResult.Cancel;
+
+	buttonClearAll.Click.Add( fun _ -> 
+		for i=1 to (Array.length on)-2 do on.[i] <- false done;
+		resetItem data on ((Array.length on)/2);
+		panel.Invalidate() 
+	) ;
+	
+	buttonSetAll.Click.Add( fun _ -> 
+		for i=1 to (Array.length on)-2 do on.[i] <- true done; 
+		panel.Invalidate() 		
+	);	
+	
+	buttonShow.Click.Add( fun _ ->
+		// replot original
+		let ar = xs |> List.map (fun x -> (x, (norminv (x/k3))*(!k2) + !k1 ) ) |> List.toArray in
+		ar |> Array.iteri (fun i v -> original.[i] <- v );
+		panel.Invalidate()
+	);
+	
+	buttonUse.Click.Add( fun _ -> 		
+		let ar = xs |> List.map (fun x -> (x, (norminv (x/k3))*(!k2) + !k1 ) ) |> List.toArray in
+		ar |> Array.iteri (fun i v -> original.[i] <- v; data.[i] <-v );
+		for i=1 to (Array.length on)-2 do on.[i] <- true done; 
+		panel.Invalidate()
+	); 
+	
+	//buttonInverse.Click.Add( fun _ -> showInverse() ); // Note: doesn't work until values have been committed!
+	
+	let labelK1a = new Label() in
+	let labelK2a = new Label() in
+
+	labelK1a.Text <- "K1";
+	labelK1a.Width <- 32;
+	labelK1a |> BlueFlash;		
+	let editK1 = CreateNumericBox true in
+	editK1.Width <- 64;
+	editK1.Text <- Convert.ToString(!k1);
+	editK1.TextChanged.Add( fun _ -> let v = ref 0.0 in if Double.TryParse(editK1.Text, v) then k1 := !v);
+	labelK2a.Text <- "K2";
+	labelK2a.Width <- 32;
+	labelK2a |> BlueFlash;	
+	let editK2 = CreateNumericBox false in
+	editK2.Width <- 64;
+	editK2.Text <- Convert.ToString(!k2);
+	editK2.TextChanged.Add( fun _ -> let v = ref 0.0 in if Double.TryParse(editK2.Text, v) then k2 := !v);
+	
+	let panel2 = new TableLayoutPanel() in 
+	panel2.ColumnCount <- 12;
+	panel2.Controls.Add(labelK1a);
+	panel2.Controls.Add(editK1);
+	panel2.Controls.Add(labelK2a);
+	panel2.Controls.Add(editK2);
+		
+	panel2.Controls.Add(buttonShow);
+	panel2.Controls.Add(buttonUse);
+	panel2.Controls.Add(buttonClearAll);
+	panel2.Controls.Add(buttonSetAll);
+	//panel2.Controls.Add(buttonInverse);
+	panel2.Controls.Add( new Label() );
+	panel2.Controls.Add( new Label() );
+	panel2.Controls.Add(buttonOK);
+	panel2.Controls.Add(buttonCancel);
+		
+	panel2.Dock <- DockStyle.Bottom;
+	panel2.Height <- 32;
+	form.Controls.Add(panel2);
+		
+	//form.Load.Add( fun _ -> SendKeys.Send("{F6}") ); 		
+		
+	let GetRectNo x y = System.Array.FindIndex(!rects, (fun rect -> rect.Contains(x,y) ))
+		in
+	
+	// left mouse click - toggle box - right mouse click drag
+	let dragItem = ref (-1) in
+    let oldMouseX = ref 0 in
+    let oldMouseY = ref 0 in                         
+   	picture.MouseDown.Add (fun me -> 
+   		oldMouseX := me.X; oldMouseY := me.Y;
+		let x,y = float32 me.X, float32 me.Y in
+		let index = GetRectNo x y in
+		if index <> -1 then if on.[index] then dragItem := index 
+			else dragItem := -1
+   	);	
+   	
+   	picture.MouseUp.Add(fun me -> dragItem := -1; panel.Invalidate() );
+   						
+	picture.MouseMove.Add (fun me ->
+		if !dragItem <> -1 then
+			let x,y = float32 me.X, float32 me.Y in
+			let ax,ay = (!lt).InverseTransform(x,y)
+			in
+													
+			setItem !dragItem ay
+	);	
+	
+	picture.MouseClick.Add( fun e -> 	
+			let x,y = float32 e.X, float32 e.Y in
+			
+			let item = GetRectNo x y in
+			let _ = if item <> -1 && item>0 && item<((Array.length !rects)-1) then on.[item] <- (if on.[item] then false else true)
+			in ()			
+			;
+			if item <> -1 then		
+				// Recalc points								
+				resetItem data on item;
+				panel.Invalidate()			
+		);	
+						
+	let result = form.ShowDialog() in
+	if result = DialogResult.OK then 
+		(
+		Debug.WriteLine( "OK" );
+		let _ = on |> Array.iteri ( fun i x -> pins.[i] <- x ) in
+		let ar = data |> Array.map (fun (x,y) -> y ) in				
+		let li = ar |> Array.toList in 
+		let _ = SetLevelList li in
+		let _ = GetSelectedPath combos |> ChangeHandler !selectedMeasure in
+		() 
+		)
+	)
+// ---
+
+// -- Menu Code
+let memuMain = mainForm.Menu <- new MainMenu()
+let menuFile= mainForm.Menu.MenuItems.Add("&File")
+let miFileOpen = new MenuItem("&Open")
+let miFileExit = new MenuItem("&Exit")
+do menuFile.MenuItems.Add(miFileOpen) |> ignore
+do menuFile.MenuItems.Add(miFileExit) |> ignore
+do miFileOpen.Click.Add( fun _ ->
+	let browser = new FolderBrowserDialog() in
+	browser.SelectedPath <- !basePath;
+	if DialogResult.OK = browser.ShowDialog() then
+		basePath := browser.SelectedPath;
+		SetCombos "" )
+do miFileExit.Click.Add( fun _ -> mainForm.Close() )		
+
+let menuEdit = mainForm.Menu.MenuItems.Add("&Edit")
+let miEditCopy = new MenuItem("&Copy") 
+do miEditCopy.Shortcut <- Shortcut.CtrlC; miEditCopy.ShowShortcut <- true
+let miEditPaste = new MenuItem("&Paste")
+do miEditPaste.Shortcut <- Shortcut.CtrlV; miEditPaste.ShowShortcut <- true
+do menuEdit.MenuItems.Add(miEditCopy) |> ignore
+do menuEdit.MenuItems.Add(miEditPaste) |> ignore
+do miEditCopy.Click.Add( fun _ ->
+			let levels = (!skillList) |> List.mapi ( fun i x -> 
+				if pins.[i] then ("\t\t<level index=\"" ^ (i+1).ToString() ^ "\">" ^ x.ToString() ^ "</level>\r\n") else "")  in
+			let value = "<view>\r\n" ^ 
+				"\t<folder>" ^ (GetRelativePath combos) ^ "</folder>\r\n" ^
+				"\t<k1>" ^ (!k1).ToString() ^ "</k1>\r\n" ^
+				"\t<k2>" ^ (!k2).ToString() ^ "</k2>\r\n" ^
+				"\t<sigma>" ^(!SigmaFactor).ToString() ^ "</sigma>\r\n" ^
+				"\t<playedStart>" ^ (!gamesPlayedStart).ToString() ^ "</playedStart>\r\n" ^
+				"\t<playedEnd>" ^ (!gamesPlayedEnd).ToString() ^ "</playedEnd>\r\n" ^
+				"\t<levels>\r\n" ^ System.String.Join("",levels |> List.toArray) ^ "\t</levels>\r\n" ^								
+				"</view>\r\n" 
+			in Clipboard.SetDataObject(value)	// Copy xml to clip board
+		)
+do miEditPaste.Click.Add( fun _ ->
+		// Paste xml from clipboard
+		let value = Clipboard.GetDataObject() in
+		match value.GetData(typeof<string>) with
+			| :? string as xml ->
+				let _ = try 
+					
+					Debug.WriteLine(xml);			
+					let doc = new XmlDocument() in
+					doc.LoadXml( xml );
+					let root = doc.FirstChild in
+					let relPath = (root.Item("folder")).InnerText in								
+					let k1Text = (root.Item("k1")).InnerText in
+					k1 := Double.Parse(k1Text);
+					editK1.Text <- Convert.ToString(!k1);
+					let k2Text = (root.Item("k2")).InnerText in
+					k2 := Double.Parse(k2Text);					
+					editK2.Text <- Convert.ToString(!k2);
+					let sigmaNode = root.Item("sigma") in
+					let _ = if( sigmaNode<>null ) then SigmaFactor := Double.Parse(sigmaNode.InnerText) in
+					editSigma.Text <- Convert.ToString(!SigmaFactor);
+					let playedStart = root.Item("playedStart") in
+					let _ = if playedStart <> null then gamesPlayedStart := XmlConvert.ToInt16(playedStart.InnerText); editStart.Value <- Convert.ToDecimal(!gamesPlayedStart); editStart.Invalidate() in
+					let playedEnd = root.Item("playedEnd") in
+					let _ = if playedEnd <> null then gamesPlayedEnd := XmlConvert.ToInt16(playedEnd.InnerText); editEnd.Value <- Convert.ToDecimal(!gamesPlayedEnd); editEnd.Invalidate() in					
+					SetCombos relPath;													
+					// Read levels
+					let levelsNode = root.Item("levels") in
+					let _ = if(levelsNode<>null ) then 					
+						let xs = linspace 1.0 49. 49 in 	 							
+						let data = xs |> List.mapi (fun i x -> (x, (norminv (x/k3))*(!k2) + !k1 )) |> List.toArray in														
+						pins |> Array.iteri ( fun i _ -> pins.[i] <- false );
+						levelsNode.ChildNodes |> Seq.cast |> Seq.iter ( fun (node:XmlNode) ->
+							Debug.WriteLine( node.InnerText.ToString() );
+							let attribute = node.Attributes.GetNamedItem("index") in 
+							Debug.WriteLine( attribute.Value.ToString() );
+							let index = System.Int32.Parse( attribute.Value ) - 1
+							in pins.[index] <- true;
+							let x,_ = data.[index] in
+							data.[index] <- (x, Double.Parse(node.InnerText));							
+							()
+						);
+						pins |> Array.iteri ( fun i x -> if not x then resetItem data pins i );
+						skillList := data |> Array.toList |> List.map ( fun (x,y) -> y )
+						in
+					
+					()															
+				with e -> MessageBox.Show("Paste failed: " ^ e.Message) |> ignore
+				in () 			
+			| _ -> ()	
+	)
+
+let menuHelp = mainForm.Menu.MenuItems.Add("&Help")
+let miHelpAbout = new MenuItem("&About")
+do menuHelp.MenuItems.Add(miHelpAbout) |> ignore
+do miHelpAbout.Click.Add( fun _ ->
+		let dialog = new Form() in dialog.Text <- "About";
+		let box = new RichTextBox() in box.Dock <- DockStyle.Fill;
+		box.BackColor <- Colour.White;
+		box.ForeColor <- Colour.Black;	
+		box.SelectionAlignment <- HorizontalAlignment.Center;	
+		box.SelectedText <- "Experiment Viewer\r\n\r\n";
+		box.SelectionAlignment <- HorizontalAlignment.Left;
+		box.SelectedText <- "The starting folder can be specified from the command line or the File Menu.\r\n\r\n" ^
+							"Once an experiment file has loaded the suggested values for K1 & K2 are viewable by hovering the mouse over the respective labels.\r\n" ^
+							"The values for K1 & K2 are calculated as the mean and standard deviation of Mu-(n*Sigma).\r\n\r\n" ^
+							"The setting can be copied and pasted as XML to and from the editable windows using CTRL-C & CTRL-V.\r\n\r\n" ^
+							"The graphs can be panned by moving the mouse with the left mouse button down, and zoomed with the right mouse button down." ^
+							"Press F5 to reset the view, and F3 to toggle the grid off and on.";
+		box.Enabled <- false;
+		dialog.Controls.Add(box);
+		dialog.ShowDialog() |> ignore
+	) 	
+	
+	
+let testFunc () =
+	let form = CreateForm "Test" in
+	
+	let data = [|(0.0F,1.0F,0);(1.0F,2.0F,1);(2.0F,3.0F,2);(3.0F,4.0F,3)|] in	
+	let controls = data |> Array.map( fun _ -> let control = new Label() in control.Visible <- false; control ) in
+	controls |> Array.iter (fun control -> form.Controls.Add(control) );
+	
+	let DrawBarGraph2 (gr:Graphics) (transform:Transformation2d) (brush:#Brush) (values:(float32 * float32 * int) array) =					
+		let border = new Pen(Colour.Black) in
+		values |> Array.iteri (fun i (x1,x2,y) ->
+
+		let tx, ty = transform.Transform (x1, float32 y) in
+		let bx, by = transform.Transform (x2, 0.0F) in		
+		gr.FillRectangle(brush, tx, ty, bx - tx, by - ty );		
+		gr.DrawRectangle(border, tx, ty, bx - tx, by - ty );
+		()
+	)
+	in
+	
+	let horizRange = {new Range with min=0.0F; and max=float32 (Array.length data); and name="x" } in
+	let vertRange = {new Range with min=0.0F; and max=3.0F; and name="y" } in
+	let rangeFunc() = (vertRange, horizRange) in	
+	let drawFunc gr t = data |> DrawBarGraph2 gr t (Brushes.Blue) in
+	let panel, pbox = AddGraph form rangeFunc drawFunc false in
+	let _ = form.Show() in
+	()
+	
+do testFunc()
+	
+do mainForm.Paint.Add(fun _ -> Application.Exit());;
+
+// Run the main code. The attribute marks the startup application thread as "Single 
+// Thread Apartment" mode, which is necessary for GUI applications. 
+[<STAThread>]    
+
+// On Vista (don't know about other OS'), if I [a-sazach] am away (e.g. "lock my computer" or if I log out of a TS session)
+// then this form just sits there waiting for me to log back in.  
+// This hack seems to fix that.
+let timer = new System.Windows.Forms.Timer()
+do timer.Interval <- 2000 (* ms *)
+do timer.add_Tick(new EventHandler(fun _ _ -> mainForm.Close()));;
+do timer.Start();;
+
+do Application.Run(mainForm)
+
+let _ = 
+   (System.Console.Out.WriteLine "Test Passed"; 
+        System.IO.File.WriteAllText("test.ok", "ok"); 
+        exit 0)
diff --git a/tests/fsharp/regression/656/formshelper.fs b/tests/fsharp/regression/656/formshelper.fs
new file mode 100644
index 0000000..6b5bd1f
--- /dev/null
+++ b/tests/fsharp/regression/656/formshelper.fs
@@ -0,0 +1,169 @@
+#indent "off"
+
+module FormsHelper
+
+open System
+open System.Collections.Generic
+open System.Windows.Forms
+open System.Drawing
+
+/// Add a control to a control
+let AddToControl (parent:#Control) (child:#Control) = parent.Controls.Add(child)
+
+/// Add controls to a control
+let AddArrayToControl (parent:#Control) (children:#Control array) = 
+	parent.Controls.AddRange(children |> Array.map (fun (i:#Control) -> (i :> Control)))
+
+/// Add a hint of blue when mouse enters control
+let BlueFlash (control:#Control) =
+	let AddBlue n (c:Color) = 
+		Color.FromArgb(int c.R,int c.G, min 255 (int c.B + n))		
+	in
+	control.MouseEnter.Add( fun _ -> 
+		control.ForeColor <- Color.DarkBlue;
+		control.BackColor <- AddBlue 5 Control.DefaultBackColor
+	);
+	control.MouseLeave.Add( fun _ -> 
+		control.ForeColor <- Control.DefaultForeColor; 
+		control.BackColor <- Control.DefaultBackColor )
+
+/// Creates a numeric text box
+let CreateNumericBox allowNeg = 
+	let edit = new TextBox() in
+	edit.KeyDown.Add( fun(e:KeyEventArgs) -> if( Keys.D0 <= e.KeyCode && Keys.D9 >= e.KeyCode ) then ()
+					else if (Keys.NumPad0 <= e.KeyCode && Keys.NumPad9 >= e.KeyCode ) then ()
+					else if (Keys.Back = e.KeyCode) then ()
+					else if (Keys.Left = e.KeyCode || Keys.Right = e.KeyCode) then ()
+					else if (Keys.OemPeriod = e.KeyCode) then ()
+					else if (allowNeg && 0 = edit.SelectionStart && Keys.Subtract = e.KeyCode) then ()
+					else if (allowNeg && 0 = edit.SelectionStart && Keys.OemMinus = e.KeyCode) then ()					
+					else e.SuppressKeyPress <- true );
+	edit
+
+/// Creates a form with a specified name
+let CreateForm name =
+	let form = new Form() in form.Text <- name; form
+
+/// Creates a label with the specified text
+let CreateLabel text =
+	let label = new Label() in
+	label.Text <- text;
+	label	
+
+/// Creates a radio button	
+let CreateRadio label changeHandler =
+	let radio = new RadioButton() in 
+	radio.Text <- label; 
+	radio.CheckedChanged.AddHandler(new EventHandler(changeHandler) );
+	radio	
+
+/// Adds tool tip specified text to control
+let AddToolTip (control:#Control) (text:string) =
+	let tip = new ToolTip() in tip.SetToolTip(control, text)
+
+/// Creates a track bar	
+let CreateTrackBar label extent tickFreq value changedHandler =
+	let slider = new TrackBar() in 
+	let tip = new ToolTip() in tip.SetToolTip(slider, label);
+	slider.Text <- label; 
+	slider.Maximum <- extent; 
+	slider.TickFrequency <- tickFreq;
+	slider.Value <- value;
+	slider.ValueChanged.AddHandler(new EventHandler(changedHandler)); 
+	slider	
+	
+/// Create a combox box with the specified names
+let CreateCombo names =
+	let combo = new ComboBox() in
+	Array.iter ( fun name -> let _ = combo.Items.Add(name) in () ) names;
+	combo	
+	
+type OpaqueCheckBox =
+	class 
+		inherit CheckBox
+		new () as x = { inherit CheckBox();  } (* then 			
+			x.SetStyle(ControlStyles.UserPaint,true);								
+			x.UseVisualStyleBackColor <- true;
+			x.FlatStyle <- FlatStyle.Flat
+			override x.OnPaint (p:PaintEventArgs) = ControlPaint.DrawCheckBox(p.Graphics, p.ClipRectangle, if x.Checked then ButtonState.Checked else ButtonState.Normal);
+				p.Graphics.DrawString( x.Text, new Font(FontFamily.GenericMonospace, 9.0F), Brushes.Black, float32 p.ClipRectangle.Left, float32 p.ClipRectangle.Top) *)
+	end	
+		
+/// Create a check box with given name and handler	
+let CreateCheckBox name tag eventHandler =
+	let box = new OpaqueCheckBox() in 		
+	box.CheckStateChanged.AddHandler(new EventHandler(eventHandler));		
+	box.Tag <- tag;	box.Text <- name;
+	box
+	
+/// Create a table layout panel	
+let CreateTableLayoutPanel columns = 	
+	let panel = new TableLayoutPanel() in 
+	panel.GrowStyle <- TableLayoutPanelGrowStyle.AddRows;
+	panel.ColumnCount <- columns;
+	panel.Dock <- DockStyle.Fill; 
+	panel
+
+/// Creats a PictureBox with the specified Bitmap	
+let CreatePictureBox (bm:Bitmap) =
+	let pict = new PictureBox() in	
+	pict.Size <- bm.Size;	pict.Image <- bm;
+	pict.Dock <- DockStyle.Fill;
+	pict
+				
+/// Creates a form from a control
+let CreateFormWithControl (title:string) (control:#Control) =
+	// Create form to contain picture box 
+	let form = CreateForm(title) in 
+	let header = 32 in
+	form.Size <- new Size(control.Size.Width, control.Size.Height + header); 
+	control.Dock <- DockStyle.Fill;
+	form.Controls.Add(control); 
+	form
+	
+/// Docks desktop location of parent form with a set of named child forms
+type FormDockLocation = 
+	class
+		val parent : Form		// Parent form
+		val mutable childForms : ((Form * string * int * int) list)	// List of child forms
+				
+		/// Docks child locations with parent
+		member instance.DockChildren () = 
+			instance.childForms |> List.iter ( 
+				fun ((child:Form),label,x,y) -> 					
+					let point = new Point(instance.parent.DesktopLocation.X + x, instance.parent.DesktopLocation.Y + y ) in
+					child.DesktopLocation <- point )
+		
+		/// Constructor (would ideally be private)
+		new (form:Form) = { parent = form; childForms = [] }
+		
+		///	Create instance factory method
+		static member Create (form:Form) =
+			let instance = new FormDockLocation(form) in			
+			form.Move.Add ( fun _ -> instance.DockChildren() );
+			form.HandleDestroyed.AddHandler ( fun sender e -> 
+				// Close child windows
+				instance.childForms |> List.iter (fun (child,_,_,_) -> let _ = child.Close() in ()  ) );				
+			instance
+			
+		/// Get child form instance with specified name
+		member instance.GetChildForm name =
+			match instance.childForms |> List.tryFind (fun (_,label,_,_) -> (label = name) ) with
+				| Some (form,_,_,_) -> Some(form)
+				| None -> None
+					
+		/// Set child - there can be only one with a sepcified name
+		member instance.SetChild (child:Form) name x y = 		
+			child.DesktopLocation <- new Point(instance.parent.DesktopLocation.X + x, instance.parent.DesktopLocation.Y + y);		
+			// Remove any forms with same label
+			instance.childForms <- instance.childForms |> 
+				List.filter (fun ((form:Form),label,x,y) -> if (label = name) then let _ = form.Close() in false else true );
+			// Add child form
+			instance.childForms <- (child,name,x,y) :: instance.childForms;
+			// Handle window closed/destroyed
+			child.HandleDestroyed.AddHandler ( fun sender e -> 
+				let control = sender :?> Form in
+				instance.childForms <- instance.childForms |> List.filter ( fun (form,label,x,y) -> form <> control ) 
+			)
+	end	
+	
diff --git a/tests/fsharp/regression/656/mathhelper.fs b/tests/fsharp/regression/656/mathhelper.fs
new file mode 100644
index 0000000..c326e5b
--- /dev/null
+++ b/tests/fsharp/regression/656/mathhelper.fs
@@ -0,0 +1,136 @@
+#indent "off"
+
+module MathHelper
+
+open System
+open System.Diagnostics
+
+/// Tree node
+type Tree = 
+    | LeafNode of int
+    | InnerNode of float * Tree * Tree
+
+/// Creates a specialized index tree from an array (Note: nodes are repeated for the search)
+let rec CreateTree index (edges:float array) =
+    let length = Array.length edges in
+    match length with
+    | 0 -> LeafNode (index)
+    | 1 -> LeafNode (index)
+    | n -> 
+        let mid = ((Array.length edges)/2) in                         
+        let lhs = Array.sub edges 0 mid in
+        let rhs = Array.sub edges (mid) (length-mid) in
+        
+        InnerNode (edges.[mid], CreateTree index lhs, CreateTree (index+mid) rhs)
+
+/// Finds node in tree                   
+let rec TreeFind (node:Tree) value  =
+    match (node) with
+    | LeafNode(index) -> index
+    | InnerNode(x,lhs,rhs) -> if (value < x) then TreeFind lhs value else TreeFind rhs value
+ 
+ /// Add one to count
+let addone tree (counts: _[]) v =
+	let i = TreeFind tree v in
+		counts.[i] <- counts.[i] + 1
+ 
+/// Computes the counts for a sample
+let histcex (sample:float list) edges counts =
+	//let timer = Stopwatch.StartNew() in
+    //let edgePairs = List.zip (System.Double.MinValue :: edges) (List.append edges [System.Double.MaxValue]) |> List.toArray in 
+    let tree = System.Double.MinValue :: edges |> List.toArray |> CreateTree 0 in
+    List.iter (fun x -> 
+		//let i2 = Array.FindIndex(edgePairs, (fun (l,u) -> (l <= x && x < u) )) in counts.(i2) <- counts.(i2) + 1
+		addone tree counts x		
+		 ) sample
+	//timer.Stop(); Debug.WriteLine( "Elapsed " ^ timer.ElapsedMilliseconds.ToString() );		
+
+let histc (sample:float list ) edges =
+     let N = List.length edges in    
+     let counts = Array.init (N + 1) (fun _ -> 0) in
+     histcex sample edges counts;
+     counts
+
+/// Computes an equal spacing between a and b of N  numbers
+let linspace a b N = 
+    let M = N - 1 in 
+    List.init N (fun i -> a + (float i) / (float M) * (b - a))
+
+/// Calculate mean of sample
+let Mean (sample:float array) = 
+	let total = sample |> Array.fold( fun acc value -> acc + value ) 0.0 in
+	let n = (Array.length sample) in
+	total / (float n)
+
+/// Calculate standard deviation from mean
+let StandardDeviationFromMean mean (sample:float array) = 
+	let deltaSquared = sample |> Array.fold (fun acc value -> let delta = (mean-value) in acc + (delta*delta) ) 0.0 in
+	let n = (Array.length sample) in
+	Math.Sqrt(deltaSquared / (float n))
+	
+/// Calculate standard deviation of sample
+let StandardDeviation (sample:float array) = 
+	Mean sample |> StandardDeviationFromMean 
+	
+/// Computes the complementary error function. This function is defined by 2/sqrt(pi) * integral from x to infinity of exp (-t^2) dt.
+let erfc x =
+    if (System.Double.IsNegativeInfinity (x)) then
+        2.0
+    else
+        if (System.Double.IsPositiveInfinity (x)) then
+            0.0
+        else
+            let z = abs (x) in
+            let t = 1.0 / (1.0 + 0.5 * z) in
+            let res = t * exp (-z * z - 
+                1.26551223 + 
+                        t * (1.00002368 + 
+                        t * (0.37409196 + 
+                        t * (0.09678418 + 
+                        t * (-0.18628806 + 
+                        t * (0.27886807 + 
+                        t * (-1.13520398 +
+                        t * (1.48851587 + 
+                        t * (-0.82215223 + 
+                        t * 0.17087277))))))))) in
+                if (x >= 0.0) then
+                    res
+                else
+                    2.0 - res
+
+/// Computes the inverse of the complementary error function. 
+let erfcinv y = 
+	if (y < 0.0 || y > 2.0) then
+		failwith "Inverse complementary function not defined outside [0,2]."
+	else if (y = 0.0) then
+		System.Double.PositiveInfinity
+	else if (y = 2.0) then
+		System.Double.NegativeInfinity
+	else 
+		let x = 
+			if (y >= 0.0485 && y <= 1.9515) then
+				let q = y - 1.0 in
+				let r = q * q in
+				(((((0.01370600482778535*r - 0.3051415712357203)*r + 1.524304069216834)*r - 3.057303267970988)*r + 2.710410832036097)*r - 0.8862269264526915) * q /
+				(((((-0.05319931523264068*r + 0.6311946752267222)*r - 2.432796560310728)*r + 4.175081992982483)*r - 3.320170388221430)*r + 1.0)
+			else if (y < 0.0485) then
+				let q = sqrt (-2.0 * log (y / 2.0)) in
+				(((((0.005504751339936943*q + 0.2279687217114118)*q + 1.697592457770869)*q + 1.802933168781950)*q + -3.093354679843504)*q - 2.077595676404383) / 
+				((((0.007784695709041462*q + 0.3224671290700398)*q + 2.445134137142996)*q + 3.754408661907416)*q + 1.0)
+			else if (y > 1.9515) then
+				let q = sqrt (-2.0 * log (1.0 - y / 2.0)) in
+				-(((((0.005504751339936943*q + 0.2279687217114118)*q + 1.697592457770869)*q + 1.802933168781950)*q + -3.093354679843504)*q - 2.077595676404383) / 
+				 ((((0.007784695709041462*q + 0.3224671290700398)*q + 2.445134137142996)*q + 3.754408661907416)*q + 1.0) 
+			else 0.0
+		in 
+		let u = (erfc (x) - y) / (-2.0 / sqrt (Math.PI) * exp (-x * x)) in
+		x - u / (1.0 + x * u)
+
+/// Computes the cummulative Gaussian distribution at a specified point of interest.
+let normcdf t = 
+    let sqrt2 = 1.4142135623730951 in (erfc (-t / sqrt2)) / 2.0
+			
+/// Computes the inverse of the cummulative Gaussian distribution (qunatile function) at a specified point of interest.
+let norminv p = 
+	let sqrt2 = 1.4142135623730951 in -sqrt2 * erfcinv (2.0 * p)
+	
diff --git a/tests/fsharp/regression/656/misc.fs b/tests/fsharp/regression/656/misc.fs
new file mode 100644
index 0000000..f262417
--- /dev/null
+++ b/tests/fsharp/regression/656/misc.fs
@@ -0,0 +1,30 @@
+#indent "off"
+
+module Misc
+
+open System
+open System.Diagnostics
+open System.Reflection
+
+/// Write event entry to Windows Event Log
+let WriteEvent (source:string) (message:string) (entryType:EventLogEntryType) =
+	try 
+		let _ = if not (EventLog.SourceExists(source)) then EventLog.CreateEventSource(source, "Application") else () in
+		EventLog.WriteEntry(source, message, entryType)				
+	with _ -> ()
+
+/// Get exception message details
+let rec GetExceptionMessage (e:#Exception) = 
+	(e.GetType()).Name ^ ": " ^ e.Message ^ "\r\n StackTrace: " ^ e.StackTrace ^
+		if e.InnerException = null then "" else "Inner Exception: " ^ (GetExceptionMessage e.InnerException)
+	
+/// Log exception message	
+let LogWarning e =
+	let message = GetExceptionMessage e in 
+		Debug.WriteLine(message); WriteEvent e.Source message EventLogEntryType.Warning
+ 	
+/// Async call abstraction
+let AsyncApp input f g  =
+	let fd = new Converter<_,_>(f) in
+	let cb = new AsyncCallback(fun ar -> g (fd.EndInvoke(ar))) in
+	fd.BeginInvoke(input, cb, (null : Object) ) |> ignore 	
diff --git a/tests/fsharp/regression/656/playerrecord.fs b/tests/fsharp/regression/656/playerrecord.fs
new file mode 100644
index 0000000..b9860c5
--- /dev/null
+++ b/tests/fsharp/regression/656/playerrecord.fs
@@ -0,0 +1,89 @@
+#indent "off"
+
+module PlayerRecords
+
+open System
+open FileHelper
+open MathHelper
+
+let SigmaFactor = ref 3.0
+
+let GetSkill mu sigma = mu - ((!SigmaFactor)*sigma)		
+
+let skillList = ref []
+let skillTree = ref (LeafNode 0)
+
+let SetLevelList li =
+	skillList := li;
+	skillTree := System.Double.MinValue :: li |> List.toArray |> CreateTree 0 
+
+let SetLevel k1 k2 k3 = 
+	let xs = linspace 1.0 49. 49 in 	 	 	
+	let li = xs |> List.map (fun x -> (norminv (x/k3))*(k2) + k1 ) in
+	SetLevelList li
+
+let GetLevelFromSkill skill k1 k2 k3 = 
+	(float (TreeFind !skillTree skill)) + 1.0
+
+let GetLevel mu sigma k1 k2 k3 = 
+	GetLevelFromSkill (GetSkill mu sigma) k1 k2 k3
+		
+	(*let a = (((GetSkill mu sigma) - k1) / k2) in
+	let value = (normcdf a) * k3 in
+	Math.Floor(value)*)
+			
+/// Player record
+type PlayerRecord = { gamertag:string; player_id:int64; mu:float; sigma:float; games_played:int16; }
+		with 
+			member instance.TrueSkill = let skill = (GetSkill instance.mu instance.sigma)
+				in Math.Floor(skill) 			
+				
+			member instance.Level k1 k2 k3 = 
+				GetLevel instance.mu instance.sigma k1 k2 k3				
+		end
+
+/// Named PlayerRecord array type		
+type NamedPlayerRecordArray = { mutable name:(string); mutable value:(PlayerRecord array) }
+	with 
+		member instance.LoadWith (fileName:string) f = 
+			if not (instance.name = fileName ) then				
+				let table = f fileName in
+				instance.value <- table;
+				instance.name <- fileName;
+				table
+			else
+				instance.value			
+	end
+	
+/// Get player table from specified file	
+let GetPlayerTable fileName =
+	CreateEnumrableCSVStream fileName |> Seq.map (fun s -> 
+		{ new PlayerRecord with gamertag = s.[0]; 
+						    and player_id = Convert.ToInt64(s.[1]); 
+						    and mu = Convert.ToDouble(s.[2]); 
+						    and sigma = Convert.ToDouble(s.[3]);
+						    and games_played = Convert.ToInt16(s.[4]) } ) 							    						  
+
+let LastPlayerTable = { new NamedPlayerRecordArray with name = ""; and value = [||] }
+
+let LoadPlayerTable fileName =
+	let f fileName = GetPlayerTable fileName |> Seq.toArray in
+	LastPlayerTable.LoadWith fileName f
+
+/// Enumerates leader board table from specified file						  
+let EnumerateLeaderboard fileName = 
+	  	CreateEnumrableCSVStream fileName |> Seq.map (fun s -> 
+		{ new PlayerRecord with gamertag = System.String.Empty 
+						    and player_id = Convert.ToInt64(s.[0]); 
+						    and mu = Convert.ToDouble(s.[1]); 
+						    and sigma = Convert.ToDouble(s.[2]);
+						    and games_played = Convert.ToInt16(s.[3]) } ) 
+						    
+
+/// Cache of last leaderboard to load
+let LastLeaderboard = { new NamedPlayerRecordArray with name = ""; and value = [||] }
+
+/// Loads leaderboard
+let LoadLeaderboard fileName =
+	let f fileName = EnumerateLeaderboard fileName |> Seq.toArray in
+	LastLeaderboard.LoadWith fileName f
diff --git a/tests/fsharp/regression/656/plot.fs b/tests/fsharp/regression/656/plot.fs
new file mode 100644
index 0000000..a708ef7
--- /dev/null
+++ b/tests/fsharp/regression/656/plot.fs
@@ -0,0 +1,174 @@
+#indent "off"
+
+module Plot
+
+open System
+open System.Collections.Generic
+open System.Windows.Forms
+open System.Drawing
+open System.Diagnostics
+
+/// Encapsulates a named range of values 
+type Range = { min:float32; max:float32; name:string }
+		with 
+			member instance.distance = instance.max - instance.min
+		end
+								
+/// 2d Transformation type
+type Transformation2d = { origin:PointF; scale:SizeF }
+	with 
+		/// Transform coordinate pair by scale around origin
+		member instance.Transform (x,y) =
+			let tx = (instance.origin.X + (instance.scale.Width * x)) in 
+			let ty = (instance.origin.Y - (instance.scale.Height * y)) in
+			(tx,ty)
+		
+		/// Inverse transform	
+		member instance.InverseTransform (x,y) = 
+			let tx = (x - instance.origin.X)/instance.scale.Width in
+			let ty = (instance.origin.Y - y)/instance.scale.Height in
+			(tx,ty)				
+
+		/// Create new 2d transformation from given	variables
+		static member Create (source:RectangleF) (dest:RectangleF) (zoom:float32)  = 
+			Debug.Assert(dest.Width <> 0.0F ); Debug.Assert(dest.Height <> 0.0F );
+			Debug.Assert(source.Width <> 0.0F); Debug.Assert(source.Height <> 0.0F);			
+			let scale = new SizeF(dest.Width/source.Width, dest.Height/source.Height) in
+			let origin = new PointF(dest.X - (scale.Width  * source.X),	
+									dest.Y + (scale.Height * source.Y)) in		
+			{ new Transformation2d with origin = origin; 
+				and scale = new SizeF(scale.Width*zoom,scale.Height*zoom) }
+	end
+			
+/// Creates a generic font
+let CreateFont = new Font(FontFamily.GenericMonospace, 9.0F)
+
+/// Draw string to graphics
+let DrawString (gr:Graphics) (pen:Pen) (point:PointF) (label:string) =
+	let font = CreateFont in	
+	let brush = new SolidBrush(pen.Color) in
+	gr.DrawString(label, font, brush, point)
+	
+/// Measure string
+let MeasureString (gr:Graphics) (label:string) =
+	gr.MeasureString(label, CreateFont)		
+	
+/// Draws string to left of specified point					
+let DrawStringOnScreen (gr:Graphics) (pen:Pen) (point:PointF) (label:string) =	
+	let textSize = MeasureString gr label in
+	let x = max point.X 0.0F in let x = min x (gr.VisibleClipBounds.Right - textSize.Width) in
+	let y = max point.Y 0.0F in let y = min y (gr.VisibleClipBounds.Bottom - textSize.Height) in	
+	let point = new PointF(x,y) in
+	DrawString gr pen point label
+			
+/// Negate points
+let Rotate180 points =
+	points |> Array.map (fun (x,y) -> (-x,-y))		
+	
+/// Map relative points to origin	
+let MapPointsTo (originx,originy) relPoints  =
+	relPoints |> Array.map (fun (x,y) -> new PointF(originx+x, originy+y) )
+
+/// Polygon fill function	
+let FillPolygon (gr:Graphics) (brush:Brush) (points:PointF array) = 
+	gr.FillPolygon(brush,points)
+			
+/// Draw X & Y Axis	
+let DrawAxis (gr:Graphics) (pen:Pen) (transform:Transformation2d) (horiz:Range) (vert:Range) =
+	let x, y = transform.Transform (0.0F, 0.0F) in // Note: axis origin assumed to be at (0,0)
+	
+	let K = 3.0F in	// Draw lines beyond extents
+	let xmin, ymin = transform.Transform (horiz.min, vert.min) in
+	let xmax, ymax = transform.Transform (horiz.max, vert.max) in	
+	let xmin, ymin, xmax, ymax = (xmin-K, ymin+K, xmax+K, ymax-K) in
+		
+	// Draw x axis
+	let _ = gr.DrawLine(pen, (new PointF(xmin, y)), (new PointF(xmax,y)) ) in
+	let rarrow = [|(0.0F, -3.0F);(0.0F,3.0F);(7.0F,0.0F)|] in
+	let _ = rarrow |> MapPointsTo (xmax,y) |> FillPolygon gr Brushes.Black in
+	let _ = DrawStringOnScreen gr pen (new PointF(xmax + 12.0F, y + 12.0F)) horiz.name in
+	let _ = if (horiz.min < 0.0F ) then let _ = Rotate180 rarrow |> MapPointsTo (xmin, y) |> FillPolygon gr Brushes.Black in () in
+
+	// Draw y axis
+	gr.DrawLine(pen, (new PointF(x, ymin)), (new PointF(x,ymax)) );
+	let uarrow = [|(-3.0F,0.0F);(3.0F,0.0F);(0.0F,-7.0F)|] in
+	uarrow |> MapPointsTo (x,ymax) |> FillPolygon gr Brushes.Black;
+	if (vert.min < 0.0F ) then 	Rotate180 uarrow |> MapPointsTo (x, ymin) |> FillPolygon gr Brushes.Black;
+	let vtsize = (MeasureString gr vert.name) in
+	DrawString gr pen (new PointF(x - (vtsize.Width/2.0F), ymax - 8.0F - vtsize.Height)) vert.name
+
+/// Draw X Axis units		
+let DrawXAxisUnits (gr:Graphics) (pen:Pen) (transform:Transformation2d) (horiz:Range) (vert:Range) hunit (grid:bool) =
+	// Note: axis origin assumed to be at (0,0)
+	let _, ymin = transform.Transform (horiz.min, vert.min) in
+	let _, ymax = transform.Transform (horiz.max, vert.max) in	
+	// Draw horizontal point function
+	let DrawHPoint (p:float32) =
+		let x, y = transform.Transform (p, 0.0F) in		
+		let ystart, yend = if (grid) then (ymin,ymax) else (y - 2.0F, y + 2.0F) in
+		gr.DrawLine( pen, new PointF(x, ystart), new PointF(x, yend) );
+		let legend = if (hunit >= 1.0F) then sprintf "%.0f" (float p) else sprintf "%.2f" (float p) in
+		if( x <> 0.0F ) then
+			let textSize = MeasureString gr legend in
+			DrawString gr pen (new PointF(x - (textSize.Width / 2.0F), y + 4.0F)) legend
+	in	
+	// Draw horizantal scale	
+	if hunit>0.F then
+		let i = ref 0.0F in
+		while (!i <= horiz.max) do DrawHPoint !i; i := !i + hunit done;
+		i := - hunit;
+		while (!i >= horiz.min) do DrawHPoint !i; i := !i - hunit done
+	
+/// Draw y axis units
+let DrawYAxisUnits (gr:Graphics) (pen:Pen) (transform:Transformation2d) (horiz:Range) (vert:Range) vunit (grid:bool) =
+	// Note: axis origin assumed to be at (0,0)
+	let xmin, _ = transform.Transform (horiz.min, vert.min) in
+	let xmax, _ = transform.Transform (horiz.max, vert.max) in	
+	// Draw vertical point function
+	let DrawVPoint (p:float32) =
+		let x, y = transform.Transform (0.0F, p) in
+		let xstart, xend = if (grid) then (xmin,xmax) else (x - 2.0F, x + 2.0F) in
+		gr.DrawLine( pen, new PointF(xstart, y), new PointF(xend, y) );
+		if (y <> 0.0F ) then					
+			let legend = if (vunit>=1.0F) then sprintf "%.0f" (float p) else sprintf "%.2f" (float p) in
+			let textSize = MeasureString gr legend in
+			DrawString gr pen (new PointF(x - textSize.Width - 4.0F,y - 6.0F)) legend		
+	in	
+	// Draw vertical scale
+	if vunit>0.F then
+		let i = ref 0.0F in
+		while (!i <= vert.max) do DrawVPoint !i; i := !i + vunit done;
+		i := - vunit;
+		while (!i >= vert.min) do DrawVPoint !i; i := !i - vunit done	
+					
+/// Creates a transformed point from the coordinate pair
+let CreatePoint (transform:Transformation2d)  (x,y) =
+	let pointx, pointy = transform.Transform (x,y) in
+	new PointF(pointx,pointy)					
+				
+/// Creates a point array from specified values within specified range
+let CreatePoints transform (values:float array)  =
+	let pointList = new List<PointF>() in	
+	values |>  Array.iteri ( fun (index:int) (value:float) ->	
+		pointList.Add( CreatePoint transform (float32 index, float32 value) )		
+	);
+	pointList.ToArray()
+	
+/// Draw crosshairs (markers) over points
+let DrawCrosshairs (gr:Graphics) (pen:Pen) (points:PointF array) =
+	let rects = points |> Array.map ( fun (point:PointF) -> 
+		new RectangleF( point.X - (2.0F*pen.Width), point.Y - (2.0F*pen.Width), (4.0F*pen.Width)+1.0F, (4.0F*pen.Width)+1.0F) ) in
+	gr.DrawRectangles(pen, rects)
+										
+/// Plot values on graphics surface with pen
+let PlotValues (gr:Graphics) (pen:Pen) transform  (label:string) (values:float array) =	 		
+	if Array.length values = 0 then () else
+	// Create list of points
+	let points = CreatePoints transform values in
+	// Draw points as lines
+	gr.DrawLines(pen, points );
+	// If possible draw crosshairs to highlight points
+	let _ = if (transform.scale.Width >= (10.0F*pen.Width)) then DrawCrosshairs gr pen points in
+	// Draw label
+	let lastPoint = points.[points.Length-1] in		
+	DrawStringOnScreen gr pen lastPoint label
diff --git a/tests/fsharp/regression/656/run.bat b/tests/fsharp/regression/656/run.bat
new file mode 100644
index 0000000..3004a18
--- /dev/null
+++ b/tests/fsharp/regression/656/run.bat
@@ -0,0 +1,34 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% pack%ILX_CONFIG%.exe
+  if NOT EXIST test.ok goto SetError
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetError
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/regression/656/trackedplayers.fs b/tests/fsharp/regression/656/trackedplayers.fs
new file mode 100644
index 0000000..7746325
--- /dev/null
+++ b/tests/fsharp/regression/656/trackedplayers.fs
@@ -0,0 +1,375 @@
+#indent "off"
+
+module TrackedPlayers
+
+open System
+open System.IO
+open System.Text
+open System.Xml
+open System.Collections.Generic
+open System.Windows.Forms
+open System.Diagnostics
+open System.Drawing
+open Misc
+open FormsHelper
+open Plot
+open PlotTrajectory
+open PlayerRecords
+
+let k1 = ref 25.0 
+let k2 = ref 8.333
+let k3 = 50.0
+
+let AutoScale = ref true
+
+/// Read table
+let ReadTable fileName =
+	let _ = Cursor.Current <- Cursors.WaitCursor in
+	let table = LoadPlayerTable fileName in
+	let _ = Cursor.Current <- Cursors.Default in	
+	table
+
+/// Get array of players last record
+let GetPlayersLastRecord (table:PlayerRecord array) = 
+	let dict = new Dictionary<string,int>() in
+	// Get last array index for each player
+	table |> Array.iteri ( fun i (player:PlayerRecord) ->
+		let gamertag = player.gamertag in
+		if( dict.ContainsKey(gamertag) ) then dict.[gamertag] <- i
+		else dict.Add(gamertag, i) );	
+	let list = new List<PlayerRecord>() in
+	dict |> Seq.iter (fun (pair:KeyValuePair<string,int>) -> list.Add( table.[pair.Value])  );
+	list.ToArray()		
+
+/// Gets records associated with a specified player
+let GetPlayerRecords (gamertag:string) (table:PlayerRecord array) =
+	table |> Array.filter ( fun player -> gamertag = player.gamertag )
+
+/// Get Mu trajectory from specified table
+let GetMuTrajectory (table:PlayerRecord array) =
+	table |> Array.map ( fun player -> (player.mu) )
+	
+/// Get TrueSkill trajectory from specified table
+let GetTrueSkillTrajectory 	(table:PlayerRecord array) =
+	table |> Array.map ( fun player -> player.TrueSkill )
+	
+/// Get (Bungie) Level tranjectory from specified table
+let GetLevelTrajectory (table:PlayerRecord array) = 
+	table |> Array.map ( fun player -> player.Level !k1 !k2 k3  )
+
+/// Create trajectories for players
+let CreateTrajectories (gamertags:string array) table f =
+	gamertags |> Array.map ( fun (gamertag:string) -> 
+		let values = GetPlayerRecords gamertag table |> f in
+		(gamertag, values) )
+													
+/// Create player check box					
+let CreatePlayerCheckBox (toolTip:ToolTip) (player:PlayerRecord) eventHandler =
+	let box = CreateCheckBox player.gamertag player eventHandler in
+	let tipText = "Mu(" ^ player.mu.ToString() ^ ")" 
+				^ ", TrueSkill(" ^ player.TrueSkill.ToString() ^ ")" 
+				^ ", Level(" ^ (player.Level !k1 !k2 k3).ToString() ^ ")"
+				^ ", Played(" ^ player.games_played.ToString() ^ ")" in
+	toolTip.SetToolTip(box, tipText); 
+	box
+
+// Create eventHanlder here
+let CheckBoxEventHandler (selected:List<string>) f =
+		let eventHandler (sender:obj) (e:EventArgs) = 
+		let checkBox = sender :?> CheckBox in 
+		let player = checkBox.Tag :?> PlayerRecord in
+		let _ = if( true = checkBox.Checked ) then 
+			if (false = selected.Contains(player.gamertag)) then selected.Add(player.gamertag) else ()
+		else 
+			if (true  = selected.Contains(player.gamertag)) then let _ = selected.Remove(player.gamertag) in () else ()
+		in 
+		f ()
+		in eventHandler
+					
+/// Create CheckBox panel from specified players
+let CreateCheckBoxPanel tooltip (players:PlayerRecord array) (selected:List<string>) f =
+	// Try to make the panel look square like
+	let count = Array.length players in
+	let columns = max 10 (int (Math.Sqrt(float count))) in
+	// Create panel
+	let panel = CreateTableLayoutPanel columns in
+	panel.SuspendLayout();
+	// Checkbox click handler local definition
+	let eventHandler = CheckBoxEventHandler selected f in			
+	// Add CheckBoxes
+	players |> Array.iter ( fun (player:PlayerRecord) -> 			
+			let box = CreatePlayerCheckBox tooltip player eventHandler in	
+			let _ = if (true = selected.Contains(player.gamertag)) then box.Checked <- true in				
+			panel.Controls.Add(box) 
+		);
+	// Pad out last row with empty labels	
+	let remainder = columns - (count%columns) in
+	for i=0 to (remainder+columns) do panel.Controls.Add(new Label()) done;
+	panel.ResumeLayout();
+	// Return panel
+	panel				
+
+/// Line width for plot
+let lineWidth = ref 2.0F
+
+/// Draw trajectories to graphics surface
+let DrawTrajectories gr transform  trajectories =
+	// Colours to cycle through		
+	let colours = [|Colour.Red;Colour.Green;Colour.Blue;
+					Colour.Yellow;Colour.Orange;Colour.Violet;
+					Colour.Brown;Colour.Black;Colour.White|] in
+	trajectories |> Array.iteri ( fun index ((name:string),values) ->
+		let pen = new Pen(colours.[index%colours.Length]) in		
+		pen.Width <- !lineWidth; 		
+		PlotValues gr pen transform name values  )
+
+/// Show trajectories	
+let ShowTrajectories form vlabel hlabel trajectories =
+	// Get maximum length of values array
+	let maxLength = trajectories |> Array.fold ( fun acc (_,values) -> Array.length values |> max acc ) 0 in					
+	// Define horizontal and vertical ranges
+	let horizRange = {new Range with min=0.F; and max=max 1.0F (float32 (maxLength-1)); and name=hlabel } in
+	let vertRange = if !AutoScale then 
+		let vmin, vmax = trajectories |> Array.fold ( fun ((cmin:float),(cmax:float)) (_,values) -> 
+		(Array.fold min cmin values, Array.fold max cmax values) ) (0.0,1.0)
+		in { new Range with min=float32 vmin; and max=float32 vmax; and name=vlabel }
+	else 
+		{new Range with min= -20.0F; and max=70.0F; and name=vlabel }
+		
+	in
+	
+	let rangeFun() = (vertRange, horizRange) in
+	let drawFun gr transform = trajectories |> DrawTrajectories gr transform in
+	AddGraph form rangeFun drawFun false	
+
+/// Get all the child controls of the specified controls
+let rec GetAllControls (controls:IEnumerable<Control>) =		
+	controls |> Seq.fold (fun acc (c:Control) -> Seq.append acc (GetAllControls (Seq.cast c.Controls)) ) controls
+
+/// Gets collection of selected CheckBoxes in a collection of controls
+let GetSelectedCheckBoxes controls =	
+	controls |> Seq.filter
+	(fun (control:Control) -> match control with
+								| :? CheckBox as checkBox -> checkBox.CheckState = CheckState.Checked
+								| _ -> false ) 
+					
+										
+/// Populate form
+let PopulateForm (form:Form) (formDock:FormDockLocation) measure (playedStart,playedEnd) table =
+	let toolTip = new ToolTip() in
+	toolTip.ShowAlways <- true; toolTip.ReshowDelay <- 100; toolTip.AutoPopDelay <- 1500; toolTip.InitialDelay <- 100;
+
+	let update = ref true in
+	
+	// Get list of distinct gamer tags
+	let players = GetPlayersLastRecord table |> Array.filter (fun (p:PlayerRecord) -> p.games_played>= playedStart && p.games_played < playedEnd)  in
+
+	let selected = new List<string>() in	
+	// Get any existing selections
+	let controls = (GetAllControls (Seq.cast form.Controls)) in
+
+	GetSelectedCheckBoxes controls |> Seq.iter ( fun (control:Control) -> 
+		let checkBox = control :?> CheckBox in
+		let player = checkBox.Tag :?> PlayerRecord in
+		if table |> Array.exists (fun p -> p.gamertag = player.gamertag ) then selected.Add(player.gamertag)
+	 );
+			
+	form.Controls.Clear();
+		
+	let rec SetTrajectoriesWindow () =
+		if !update then 
+			let childForm = match formDock.GetChildForm "Child" with
+				| Some child -> child.Controls.Clear(); child.Menu.MenuItems.Clear(); child
+				| None -> let child = CreateForm "Trajectories" in
+						  child.Width <- form.Width; child.Height <- 400;	
+						  child.Show();
+						  formDock.SetChild child "Child" 0 (form.Height+formDock.parent.Height);
+						  child
+			in															  
+			let f = match measure with 
+				| "Mu" -> GetMuTrajectory
+				| "TrueSkill" -> GetTrueSkillTrajectory
+				| "Level" -> GetLevelTrajectory		
+				| _ -> GetMuTrajectory 
+			in 
+			let _ = f |> CreateTrajectories (selected.ToArray()) table
+			|> ShowTrajectories childForm measure "Played" in ();
+			let menuLine = childForm.Menu.MenuItems.Add("&Line Width") in 
+			let miLine1 = new MenuItem("1") in
+			let miLine2 = new MenuItem("2") in
+			let miLine3 = new MenuItem("3")in
+			menuLine.MenuItems.AddRange([|miLine1;miLine2;miLine3|]) |> ignore;			
+			miLine1.Click.Add( fun _ -> lineWidth := 1.0F; childForm.Invalidate(true) );
+			miLine2.Click.Add( fun _ -> lineWidth := 2.0F; childForm.Invalidate(true) ); 
+			miLine3.Click.Add( fun _ -> lineWidth := 3.0F; childForm.Invalidate(true) ); 
+			childForm.Menu.MenuItems.Add(menuLine) |> ignore;
+			let menuRange = childForm.Menu.MenuItems.Add("&Range") in
+			let miRangeAuto = new MenuItem("Auto") in miRangeAuto.Checked <- !AutoScale;
+			let _ = menuRange.MenuItems.Add(miRangeAuto) in
+			let _ = miRangeAuto.Click.Add( fun _ -> AutoScale := if !AutoScale then false else true; miRangeAuto.Checked <- !AutoScale; SetTrajectoriesWindow()  ) in	
+			childForm.Menu.MenuItems.Add(menuRange) |> ignore
+	in
+		
+			
+	// Create a tracked player panel
+	update := false;
+	let panel = ref (CreateCheckBoxPanel toolTip players selected SetTrajectoriesWindow) in
+	form.Size <- new Size( form.Size.Width, (!panel).PreferredSize.Height); 
+	form.Controls.Add(!panel);
+	update := true;
+	
+	SetTrajectoriesWindow();
+
+	// Create menus	
+	let memuMain = form.Menu <- new MainMenu() in
+	// Create edit menu
+	let menuEdit = form.Menu.MenuItems.Add("&Edit") in
+	let miEditCopy = new MenuItem("Copy") in
+	miEditCopy.Shortcut <- Shortcut.CtrlC; miEditCopy.ShowShortcut <- true;
+	let miEditPaste = new MenuItem("Paste") in
+	miEditPaste.Shortcut <- Shortcut.CtrlV; miEditPaste.ShowShortcut <- true;
+	let miEditSelAll = new MenuItem("Select All") in
+	miEditSelAll.Shortcut <- Shortcut.CtrlA; miEditSelAll.ShowShortcut <- true;
+	let miEditClrAll = new MenuItem("Reset All") in
+	miEditClrAll.Shortcut <- Shortcut.CtrlR; miEditClrAll.ShowShortcut <- true;
+	let _ = menuEdit.MenuItems.Add(miEditCopy) in
+	let _ = menuEdit.MenuItems.Add(miEditPaste) in
+	let _ = menuEdit.MenuItems.Add(miEditSelAll) in
+	let _ = menuEdit.MenuItems.Add(miEditClrAll) in
+	
+	let _ = miEditCopy.Click.Add ( fun _ -> 
+		let builder = new StringBuilder() in
+		let writer = new XmlTextWriter( new StringWriter(builder) ) in
+		writer.WriteStartElement("players");
+		selected |> List.ofSeq |> List.iter ( fun (s:string) -> writer.WriteElementString("gamertag", s) );
+		writer.WriteEndElement();
+		writer.Close();
+		Clipboard.SetDataObject(builder.ToString())
+	) in
+	let _ = miEditPaste.Click.Add ( fun _ -> 
+		let value = Clipboard.GetDataObject() in
+		match value.GetData(typeof<string>) with
+			| :? string as xml ->
+				let _ = try 
+					Debug.WriteLine(xml);			
+					let doc = new XmlDocument() in
+					doc.LoadXml( xml );
+					let root = doc.FirstChild in																	
+					root.ChildNodes |> Seq.cast |> 
+					Seq.filter( fun (node:XmlNode) -> node.Name = "gamertag" ) |>
+					Seq.iter( fun (node:XmlNode) -> 
+						(!panel).Controls |> Seq.cast |> Seq.iter (fun (control:Control) ->  
+						match control with
+							| :? CheckBox as checkBox -> 
+								let player = checkBox.Tag :?> PlayerRecord in
+								if player.gamertag = node.InnerText then checkBox.CheckState <- CheckState.Checked
+							| _ ->  () );
+					);										
+					()															
+				with e -> MessageBox.Show("Paste failed: " ^ e.Message) |> ignore
+				in () 			
+			| _ -> ()		
+	 ) in	
+	// Set box state function
+	let setBoxState state =
+		update := false;
+		(!panel).Controls |> Seq.cast |> Seq.iter (fun (control:Control) ->  
+			match control with
+				| :? CheckBox as checkBox -> checkBox.CheckState <- state
+				| _ ->  () );
+		update := true; SetTrajectoriesWindow()		
+	in						
+	let _ = miEditSelAll.Click.Add( fun _ -> CheckState.Checked |> setBoxState ) in
+	let _ = miEditClrAll.Click.Add( fun _ -> CheckState.Unchecked |> setBoxState ) in
+
+	// Create sort menu
+	let menuSort = form.Menu.MenuItems.Add("&Sort") in
+	let miSortName = new MenuItem("Name") in
+	let miSortMu = new MenuItem("Mu") in
+	let miSortTrueSkill = new MenuItem("TrueSkill") in
+	let miSortLevel = new MenuItem("Level") in
+	let miSortPlayed = new MenuItem("Played") in
+	let miSortSpecial = new MenuItem("Special") in
+	let _ = menuSort.MenuItems.Add(miSortName) in
+	let _ = menuSort.MenuItems.Add(miSortMu) in
+	let _ = menuSort.MenuItems.Add(miSortTrueSkill) in
+	let _ = menuSort.MenuItems.Add(miSortLevel) in
+	let _ = menuSort.MenuItems.Add(miSortPlayed) in
+	let _ = menuSort.MenuItems.Add(miSortSpecial) in
+	// Sort boxes function
+	let sortBoxes f =
+		let toolTip = new ToolTip() in
+		toolTip.ShowAlways <- true; toolTip.ReshowDelay <- 100; toolTip.AutoPopDelay <- 1500; toolTip.InitialDelay <- 100;
+
+		update := false; 	
+		form.Controls.Clear();
+		players |> Array.sortInPlaceWith f ;
+		panel := CreateCheckBoxPanel toolTip players selected SetTrajectoriesWindow;
+		form.Controls.Add(!panel);
+		update := true
+	in	
+	let _ = miSortName.Click.Add( fun _ -> (fun (p1:PlayerRecord) (p2:PlayerRecord) -> p1.gamertag.CompareTo(p2.gamertag) )
+		|> sortBoxes ) in	
+	let _ = miSortMu.Click.Add( fun _ -> (fun (p1:PlayerRecord) (p2:PlayerRecord) -> Math.Sign(p1.mu - p2.mu) )  
+		|> sortBoxes ) in
+	let _ = miSortTrueSkill.Click.Add( fun _ -> (fun (p1:PlayerRecord) (p2:PlayerRecord) -> Math.Sign(p1.TrueSkill - p2.TrueSkill) )  
+		|> sortBoxes ) in		
+	let _ = miSortLevel.Click.Add( fun _ -> (fun (p1:PlayerRecord) (p2:PlayerRecord) -> Math.Sign( (p1.Level !k1 !k2 k3) - (p2.Level !k1 !k2 k3) ) )  
+		|> sortBoxes ) in				
+	let _ = miSortPlayed.Click.Add( fun _ -> (fun (p1:PlayerRecord) (p2:PlayerRecord) -> Convert.ToInt32(p1.games_played - p2.games_played) )
+		|> sortBoxes ) in
+	let _ = miSortSpecial.Click.Add( fun _ ->		
+	
+		let f = match measure with | "mu" -> ( fun player -> (player.mu) )
+			| "TrueSkill" -> ( fun player -> (player.TrueSkill) )
+			| "Level" -> ( fun player -> (player.Level !k1 !k2 k3) ) 
+			| _ -> ( fun player -> (player.mu) )
+		in
+	
+		let maxF = table |> Array.fold ( fun acc (p:PlayerRecord) ->f(p) |> max acc ) 0.0 in
+		let minF = table |> Array.fold ( fun acc (p:PlayerRecord) -> f(p) |> min acc ) 0.0 in
+		let maxPlayed = table |> Array.fold ( fun acc (p:PlayerRecord) -> Convert.ToInt32(p.games_played) |> max acc ) 0 in
+		let minPlayed = table |> Array.fold ( fun acc (p:PlayerRecord) -> Convert.ToInt32(p.games_played) |> min acc ) 0 in
+				
+		form.Controls.Clear();				
+		
+		let width = form.Width in let height = form.Height in
+		let eventHandler = CheckBoxEventHandler selected SetTrajectoriesWindow in			
+						
+	    let OnResize() =	    
+    		let toolTip = new ToolTip() in
+			toolTip.ShowAlways <- true; toolTip.ReshowDelay <- 100; toolTip.AutoPopDelay <- 1500; toolTip.InitialDelay <- 100;
+
+			update := false;	     			
+			form.Controls.Clear();
+			players |> Array.iter (fun player -> let box = CreatePlayerCheckBox toolTip player eventHandler in 								
+			let v = f(player) in
+			box.Top <- (form.Height - 64) - (int ((v - minF)*(float form.Height - 64.0) / (maxF - minF)));
+			box.Left <-  (((Convert.ToInt32(player.games_played) - minPlayed)*(form.Width - 64)) / (maxPlayed - minPlayed));
+			let _ = if (true = selected.Contains(player.gamertag)) then box.Checked <- true in							
+			form.Controls.Add(box)
+			);
+			update := true;
+			form.Invalidate(); () 
+		in   
+		OnResize();		    
+	    form.Resize.Add (fun _ -> OnResize ());    
+			
+			
+		// TODO: handle resize of form
+		//)		 		
+	) in
+	()
+																	
+/// Show tracker file
+let TrackedPlayersHandler form formDock (measure:string) (playedStart,playedEnd) (fileName:string) =
+	// Load table async and populate form on completion
+	
+	let ShowTable table =
+		let f() = try PopulateForm form formDock measure (playedStart,playedEnd) table with e -> LogWarning e in
+		if not form.IsDisposed then try form.Invoke( new MethodInvoker(f) ) |> ignore with e -> LogWarning e else () 
+	in		
+	AsyncApp fileName ReadTable ShowTable;
+	form
+	
+	
diff --git a/tests/fsharp/regression/656/traj.fs b/tests/fsharp/regression/656/traj.fs
new file mode 100644
index 0000000..f3cea94
--- /dev/null
+++ b/tests/fsharp/regression/656/traj.fs
@@ -0,0 +1,255 @@
+#indent "off"
+
+module PlotTrajectory
+
+open System
+open System.Collections.Generic
+open System.Windows.Forms
+open System.Drawing
+open FormsHelper
+open Plot
+
+/// Map US to English(UK) spelling
+type Colour = Color	
+
+/// Infinite collection of units
+let WholeUnits = 
+	Seq.initInfinite ( fun  (i:int) ->
+		let sequence = [|1.0;2.0;5.0|] in
+		let x = i / (Array.length sequence) in
+		let y = i % (Array.length sequence) in				
+		let value = (Math.Pow(10., float x) * sequence.[y]) in
+		value
+		)
+		
+// Infinite collection of fractional units
+let FractionalUnits =
+	let ItemAt i = 
+		let sequence = [|1.0;0.5;0.2|] in
+		let x = i / (Array.length sequence) in
+		let y = i % (Array.length sequence) in				
+		(Math.Pow(10., float (-x) ) * sequence.[y]) 
+	in
+	Seq.initInfinite ( fun  (i:int) -> (ItemAt i, ItemAt (i+1)) )		
+
+/// Gets a unit from the specified value				
+let GetUnit (value:float) =
+	let sign = float(Math.Sign(value)) in 
+	let value2 = value * sign in
+	if ( value > 1.0 ) then let unit = WholeUnits |> Seq.find ( fun unit -> unit >= value2 ) in unit * sign
+	else 
+		let previous, unit = FractionalUnits |> Seq.find ( fun (previous,unit) -> unit <= value2 ) in previous * sign
+		
+/// Draw scale
+let DrawScaleToGraphics (gr:Graphics) transform horiz vert grid =
+	// Draw scale
+	let pen = new Pen(Color.Gray) in
+	let v = (16.0F/transform.scale.Height) in let vunit = GetUnit (float v) in 
+	DrawYAxisUnits gr pen transform horiz vert (float32 vunit) grid;
+	let h = (32.0F/transform.scale.Width) in let hunit = GetUnit (float h) in
+	DrawXAxisUnits gr pen transform horiz vert (float32 hunit) grid;		
+	let pen = new Pen(Color.Black) in
+	DrawAxis gr pen transform horiz vert
+	
+/// Show graph	
+let AddGraph (form:Form) rangeFun drawFun pinUp =
+	// Variables
+	let margin = new SizeF(64.0F, 32.0F) in
+	let header = 32 in
+	let width = form.Width in let height = form.Height-32 in 
+	let pinned = ref false in
+	let panX = ref 0.0F in
+    let panY = ref 0.0F in
+    let zoom = ref 1.0F in
+    let drawGrid = ref true in
+    let transform = ref {new Transformation2d with origin = (new PointF(0.F,0.F)); and scale = (new SizeF(0.F,0.F)) } in
+    let hlabel = ref "" in let vlabel = ref "" in
+
+	// Create bitmap (double buffer)
+	let buffers = [|new Bitmap(width, height); new Bitmap(width,height)|] in let buffer = ref 0 in
+	let bm = buffers.[!buffer] in
+	// Create PictureBox and add to panel
+	let picture = CreatePictureBox bm in
+	let panel = new Panel() in panel.Controls.Add(picture);
+	panel.Dock <- DockStyle.Fill;
+	panel.Size <- bm.Size;
+	
+	form.Controls.Add(panel); 
+	
+	let statusBar = new StatusBar() in
+		    
+    let OnPaint() = 
+    	let vertRange, horizRange = rangeFun() in
+    	vlabel := vertRange.name; hlabel := horizRange.name;
+		// Create tranformation
+		let width = (float32 (panel.Size.Width)) in let height = (float32 panel.Size.Height) in
+		let source = new RectangleF(horizRange.min, vertRange.min, horizRange.distance, vertRange.distance) in
+		let dest = new RectangleF(margin.Width - (!panX * width), height - margin.Height - (!panY*height), 
+			width - (margin.Width * 2.0F), height - (margin.Height * 2.0F)) in
+		transform := Transformation2d.Create source dest !zoom;
+		// Draw to non-visible buffer
+		buffer := (!buffer + 1)%2;
+		let bm =  if( (buffers.[!buffer]).Size.Equals(panel.Size) ) then buffers.[!buffer] else
+			let _ = (buffers.[!buffer]).Dispose() in buffers.[!buffer] <- new Bitmap(panel.Width,panel.Height); 
+			buffers.[!buffer]
+		in
+		let gr = Graphics.FromImage(bm) in
+		gr.Clear(panel.BackColor);
+		// Draw scale
+		DrawScaleToGraphics gr !transform horizRange vertRange !drawGrid;
+		// Draw function
+		drawFun gr !transform;
+		// Now set picture with updated bitmap -> avoids flicker
+		picture.Image <- bm;    
+		()         
+    in   		    
+    panel.Paint.Add (fun _ -> OnPaint ());    
+            
+    let oldMouseX = ref 0 in
+    let oldMouseY = ref 0 in             
+            
+   	picture.MouseDown.Add (fun me -> oldMouseX := me.X; oldMouseY := me.Y );	
+	
+	picture.MouseMove.Add (fun me ->
+		if not !pinned then 
+		let x,y = (!transform).InverseTransform (float32 me.X, float32 me.Y) in 
+		let loc = sprintf "(%s,%s) (%.2f,%.2f)" !hlabel !vlabel (float x) (float y)  in
+		statusBar.Text <- loc;
+        let _ = match me.Button with
+        | MouseButtons.Left ->  let dx = float32 (me.X - !oldMouseX) in let width = (float32 ) panel.Size.Width in  
+								panX := !panX - (dx/width);
+                                let dy = float32 (me.Y - !oldMouseY) in let height = (float32 ) panel.Size.Height in  
+                                panY := !panY - (dy/height);
+                                oldMouseX := me.X; oldMouseY := me.Y;
+                                panel.Invalidate ()
+        | MouseButtons.Right -> zoom := max 0.1F (!zoom - float32 (me.Y - !oldMouseY) / 100.0F);
+                                oldMouseX := me.X; oldMouseY := me.Y;
+                                panel.Invalidate ()
+        | _ -> ()
+        in ()
+        
+        );
+        
+    picture.MouseLeave.Add(fun _ -> statusBar.Text <- System.String.Empty );
+        
+    panel.Resize.Add (fun _ -> panel.Invalidate ());    
+        		
+	form.Controls.Add( statusBar );
+		
+	let memuMain = form.Menu <- new MainMenu() in
+	let menuFile = form.Menu.MenuItems.Add("&File") in
+	let miFileSaveAs = new MenuItem("&Save As") in
+	miFileSaveAs.Shortcut <- Shortcut.CtrlS; miFileSaveAs.ShowShortcut <- true;
+	let _ = menuFile.MenuItems.Add(miFileSaveAs) in
+	let _ = miFileSaveAs.Click.Add( fun _ ->
+			let bm = buffers.[!buffer] in
+			let dialog = new SaveFileDialog() in			
+			dialog.Filter <- "Bitmap|*.bmp|GIF|*.gif|JPEG|*.jpg";
+			let _ = if ( DialogResult.OK = dialog.ShowDialog() ) then
+				let imageFormat = match dialog.FilterIndex with 
+					| 2 -> Imaging.ImageFormat.Gif
+					| 3 -> Imaging.ImageFormat.Jpeg
+					| _ -> Imaging.ImageFormat.Bmp in
+				bm.Save( dialog.FileName, imageFormat)
+			in ()
+		) in
+	let menuEdit = form.Menu.MenuItems.Add("&Edit") in
+	let miEditCopy = new MenuItem("&Copy") in
+	miEditCopy.Shortcut <- Shortcut.CtrlC; miEditCopy.ShowShortcut <- true;
+	let _ = menuEdit.MenuItems.Add(miEditCopy) in
+	let _ = miEditCopy.Click.Add( fun _ ->
+			let bm = buffers.[!buffer] in Clipboard.SetDataObject(bm)	// Copy image to clip board
+		) in
+	let menuView = form.Menu.MenuItems.Add("&View") in
+	let miViewGrid = new MenuItem("&Grid") in miViewGrid.Checked <- !drawGrid;
+	miViewGrid.Shortcut <- Shortcut.F3; miViewGrid.ShowShortcut <- true;
+	let miViewReset = new MenuItem("&Reset") in
+	miViewReset.Shortcut <- Shortcut.F5; miViewReset.ShowShortcut <- true;
+	let _ = menuView.MenuItems.AddRange([|miViewGrid;miViewReset|]) in
+	if  pinUp then 
+		(
+			pinned := true;
+			let miViewPinned = new MenuItem("&Pin") in
+			miViewPinned.Shortcut <- Shortcut.F6; miViewPinned.ShowShortcut <- true;
+			let _ = miViewPinned.Click.Add( fun _ -> pinned := if !pinned then false else true; miViewPinned.Checked <- !pinned ) in
+			let _ = menuView.MenuItems.Add(miViewPinned) in ()
+		);
+	let _ = miViewGrid.Click.Add( fun _ ->
+		if (!drawGrid) then drawGrid := false else drawGrid := true;
+		miViewGrid.Checked <- !drawGrid; panel.Invalidate() ) 
+	in	
+	let _ = miViewReset.Click.Add( fun _ -> panX := 0.0F; panY := 0.0F; zoom := 1.0F; panel.Invalidate() ) in
+	(panel,picture)
+	
+/// Creates new form and shows graph	
+let ShowGraph title vertRange horizRange drawFun =
+	let rangeFun() = (vertRange, horizRange) in
+	let form = CreateForm title in
+	form.Width <- 1000; form.Height <- 800;	
+	let picture = AddGraph form rangeFun drawFun false in
+	let _ = form.Show() in
+	(form,picture)
+	
+/// Draw line graph to graphics surface 
+let DrawLineGraph (gr:Graphics) transform (data:(float * float) array) = 
+	let pen = new Pen(Colour.Red) in
+	pen.Width <- 2.0F;
+	let points = data |> Array.map ( fun (x,y) -> CreatePoint transform (float32 x, float32 y) ) in
+	gr.DrawLines(pen, points);
+	if (transform.scale.Width >= (8.0F*pen.Width)) then DrawCrosshairs gr pen points 	 	
+		
+/// Draw scattergram to graphics surface		
+let DrawScattergram (gr:Graphics) (transform:Transformation2d) (pairs:(float * float) array) =
+	let pen = new Pen(Colour.Black) in		 	
+	pairs |> Array.iter ( fun (x,y) ->
+		let tx, ty  = transform.Transform (float32 x, float32 y) in
+		let point = new PointF(tx,ty) in
+		gr.DrawLine(pen,point, new PointF(point.X+0.5F, point.Y+0.5F) ) 
+		)
+
+/// Draw bar graph to graphics surface 
+let DrawBarGraph (gr:Graphics) (transform:Transformation2d) (brush:#Brush) (values:(float32 * float32 * int) array) =
+	let border = new Pen(Colour.Black) in		 	
+	values |> Array.iter (fun (x1,x2,y) ->
+		let tx, ty = transform.Transform (x1, float32 y) in
+		let bx, by = transform.Transform (x2, 0.0F) in		
+		gr.FillRectangle(brush, tx, ty, bx - tx, by - ty );
+		gr.DrawRectangle(border, tx, ty, bx - tx, by - ty );
+	)
+
+/// Draw bar graph to grahics surface
+let DrawLabelledBarGraph (gr:Graphics) (transform:Transformation2d) (pairs:(string * float) array) =
+	let blue = new SolidBrush(Colour.Blue) in
+	let black = new Pen(Colour.Black) in		 	
+	pairs |> Array.iteri (fun x (label,y) ->
+		let tx, ty = transform.Transform (float32 x, float32 y) in
+		let bx, by = transform.Transform (float32 (x+1), 0.0F) in		
+		gr.FillRectangle(blue, tx, ty, bx - tx, by - ty );
+		gr.DrawRectangle(black, tx, ty, bx - tx, by - ty );		
+	)	
+	
+/// Show line graph	
+let ShowLineGraph vlabel hlabel (data:(float * float) array) =
+	let xl, xh, yl, yh = data |> Array.fold ( fun acc (x,y) -> 
+		let xl,xh,yl,yh = acc in (min x xl, max x xh, min y yl, max y yh) 
+	) (Double.MaxValue,Double.MinValue,Double.MaxValue,Double.MinValue) in
+     let yl,yh = if yl=yh then yl - 1.,yh + 1. else yl,yh in
+	let horizRange = {new Range with min=min 0.0F (float32 xl); and max=float32 xh; and name=hlabel } in	
+	let vertRange = { new Range with min=min 0.0F (float32 yl); and max=float32 yh; and name=vlabel } in
+	let drawFun gr transform = data |> DrawLineGraph gr transform in
+	ShowGraph "Line graph" vertRange horizRange drawFun
+	
+/// Show scatter graph	
+let ShowScattergram vlabel hlabel data =
+	let horizRange = {new Range with min=0.F; and max=1000.0F; and name=hlabel } in
+	let vertRange = {new Range with min= -20.0F; and max=70.0F; and name=vlabel } in
+	let drawFun gr transform = data |> DrawScattergram gr transform in
+	ShowGraph "Scattergram" vertRange horizRange drawFun
+
+/// Show bar graph
+let ShowLabelledBarGraph vlabel hlabel (data:(string * float) array) = 	
+	let low, high = data |> Array.fold ( fun acc (_,i) -> let l,h = acc in (min i l, max i h) ) (Double.MaxValue , Double.MinValue) in
+	let horizRange = {new Range with min=0.0F; and max=float32 (Array.length data); and name=hlabel } in
+	let vertRange = {new Range with min=min (float32 low) 0.0F; and max=float32 high; and name=vlabel } in
+	let drawFun gr transform = data |> DrawLabelledBarGraph gr transform in
+	ShowGraph "Bar graph" vertRange horizRange drawFun
diff --git a/tests/fsharp/regression/83/build.bat b/tests/fsharp/regression/83/build.bat
new file mode 100644
index 0000000..72fe90d
--- /dev/null
+++ b/tests/fsharp/regression/83/build.bat
@@ -0,0 +1,32 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+if "%CLR_SUPPORTS_WINFORMS%"=="false" ( goto Skip)
+
+call %~d0%~p0..\..\single-test-build.bat
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/83/run.bat b/tests/fsharp/regression/83/run.bat
new file mode 100644
index 0000000..548501d
--- /dev/null
+++ b/tests/fsharp/regression/83/run.bat
@@ -0,0 +1,16 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+if "%CLR_SUPPORTS_WINFORMS%"=="false" ( goto Skip )
+if "%COMPLUS_Version%"=="v1.0.3705" ( goto Skip )
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
+
+:Error
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/regression/83/test.ml b/tests/fsharp/regression/83/test.ml
new file mode 100644
index 0000000..5dad355
--- /dev/null
+++ b/tests/fsharp/regression/83/test.ml
@@ -0,0 +1,46 @@
+// #Regression 
+let failures = ref false
+let report_failure () = 
+  System.Console.Error.WriteLine " NO"; failures := true
+
+open System
+open System.Windows.Forms
+
+let form = new Form()
+
+let lblHello = new Label()
+let btnSay = new Button()
+
+let btnSay_Click(sender, e) =
+    lblHello.Text <- "Hello"
+
+let form_Load(sender, e) =
+    btnSay.add_Click(new EventHandler(fun sender e -> btnSay_Click(sender, e)))
+
+
+
+let _ = lblHello.Location <- new System.Drawing.Point(16, 16)
+let _ = lblHello.Name <- "lblHello"
+let _ = lblHello.Size <- new System.Drawing.Size(72, 23)
+let _ = lblHello.TabIndex <- 0
+
+let _ = btnSay.Location <- new System.Drawing.Point(216, 16)
+let _ = btnSay.Name <- "btnApply"
+let _ = btnSay.TabIndex <- 1
+let _ = btnSay.Text <- "Apply"
+
+let _ = form.Text <- "1st F# App"
+let _ = form.add_Load(new EventHandler(fun sender e -> form_Load(sender, e)))
+let _ = form.Controls.AddRange(Array.ofList [(upcast (lblHello) : Control);
+                                            (upcast (btnSay) : Control);
+                                                        ])
+ 
+(* let _ = Application.Run(form) *)
+
+let _ = 
+  if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) 
+
+do (System.Console.Out.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok", "ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/regression/84/build.bat b/tests/fsharp/regression/84/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/regression/84/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/regression/84/run.bat b/tests/fsharp/regression/84/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/regression/84/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/regression/84/test.ml b/tests/fsharp/regression/84/test.ml
new file mode 100644
index 0000000..b2e868f
--- /dev/null
+++ b/tests/fsharp/regression/84/test.ml
@@ -0,0 +1,11 @@
+// #Regression 
+
+let _ = 
+  match false with 
+  | true -> (System.Console.Out.WriteLine "Test Failed"; exit 1) 
+  | false -> 
+      (System.Console.Out.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText("test.ok", "ok"); 
+       exit 0)
+
+let _ = (System.Console.Out.WriteLine "Test Ended"; exit 100)
diff --git a/tests/fsharp/regression/85/Category.ml b/tests/fsharp/regression/85/Category.ml
new file mode 100644
index 0000000..c975598
--- /dev/null
+++ b/tests/fsharp/regression/85/Category.ml
@@ -0,0 +1,8 @@
+// #Regression 
+open System
+open System.Web
+
+let ProcessRequest = fun (context : HttpContext) ->
+    let form = new ASP.Category_aspx() in
+    ()
+
diff --git a/tests/fsharp/regression/85/build.bat b/tests/fsharp/regression/85/build.bat
new file mode 100644
index 0000000..917ef74
--- /dev/null
+++ b/tests/fsharp/regression/85/build.bat
@@ -0,0 +1,40 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+ at if ERRORLEVEL 1 goto Error
+
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+if "%CLR_SUPPORTS_GENERICS%"=="false" ( goto Skip)
+if "%CLR_SUPPORTS_SYSTEM_WEB%"=="false" ( goto Skip)
+
+"%FSC%" %fsc_flags% -r:Category.dll -a -o:petshop.dll Category.ml
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" petshop.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/85/category.dll b/tests/fsharp/regression/85/category.dll
new file mode 100644
index 0000000..b80f660
Binary files /dev/null and b/tests/fsharp/regression/85/category.dll differ
diff --git a/tests/fsharp/regression/85/run.bat b/tests/fsharp/regression/85/run.bat
new file mode 100644
index 0000000..64332e4
--- /dev/null
+++ b/tests/fsharp/regression/85/run.bat
@@ -0,0 +1,26 @@
+ at if "%_echo%"=="" echo off
+
+REM build.bat produces only dll's. Nothing to run
+
+goto SKip
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetError
+set NonexistentErrorLevel 2> nul
+goto Error
diff --git a/tests/fsharp/regression/86/build.bat b/tests/fsharp/regression/86/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/regression/86/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/regression/86/run.bat b/tests/fsharp/regression/86/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/regression/86/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/regression/86/test.ml b/tests/fsharp/regression/86/test.ml
new file mode 100644
index 0000000..4b1abe3
--- /dev/null
+++ b/tests/fsharp/regression/86/test.ml
@@ -0,0 +1,11 @@
+// #Regression 
+
+    
+let _ = 
+  if '\\' = '\092' & "\\" = "\092" then
+      (System.Console.Out.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText("test.ok", "ok"); 
+       exit 0)
+
+  else (System.Console.Out.WriteLine "Test Failed"; exit 1) 
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.dll b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.dll
new file mode 100644
index 0000000..7839694
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.pdb b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.pdb
new file mode 100644
index 0000000..4565c1e
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SA.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.dll b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.dll
new file mode 100644
index 0000000..e916232
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.pdb b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.pdb
new file mode 100644
index 0000000..1b204a9
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.xml b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.xml
new file mode 100644
index 0000000..3c8999d
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethod.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>AsmL.Tools.Algos.SimplexMethod</name>
+    </assembly>
+    <members>
+        <member name="T:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP">
+            <summary>
+            Solves the general liner program but always looking for minimum
+            </summary>
+        </member>
+        <member name="M:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.SetCosts(System.Double[])">
+            <summary>
+            set the cost function
+            </summary>
+            <param name="costs">the objective vector</param>
+        </member>
+        <member name="M:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.AddConstraint(System.Double[],Microsoft.AsmL.Tools.Algos.SimplexMethod.Relation,System.Double)">
+            <summary>
+            adds a constraint: the coeffiecents should not be very close to zero or too huge.
+            If it is the case, as one can scale for example the whole programm to zero,
+            then such coefficient will be treated az zeros. We are talking here about the numbers
+            with absolute values less than 1.0E-8
+            </summary>
+            <param name="coeff">the constraint coefficents</param>
+            <param name="relation">could be 'less or equal', equal or 'greater or equal'</param>
+            <param name="rightSide">right side of the constraint</param>
+        </member>
+        <member name="M:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.Minimize">
+            <summary>
+            Solves the linear program, minimizing, by going through stages one and two
+            </summary>
+        </member>
+        <member name="P:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.FeasibleSolution">
+            <summary>
+            finds a solution which is feasible but not necesserily optimal
+            </summary>
+        </member>
+        <member name="P:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.MinimalSolution">
+            <summary>
+            returns an optimal solution
+            </summary>
+        </member>
+        <member name="P:Microsoft.AsmL.Tools.Algos.SimplexMethod.LP.MinimalValue">
+            <summary>
+            return the value of the cost function at the optimal solution
+            if the client is too lazy to calculate it by himself
+            </summary>
+        </member>
+        <member name="T:Microsoft.AsmL.Tools.Algos.SimplexMethod.Solver">
+            <summary>
+            The problem is to find min c*x under constraint Ax=b,x>=0 where A|b=X is the tableu
+            Solver solves LP starting with a given feasible solution given by the basis array
+            a tableu and a cost. 
+            </summary>
+        </member>
+        <member name="M:Microsoft.AsmL.Tools.Algos.SimplexMethod.Solver.#ctor(System.Int32[],System.Double[0:,0:],System.Double[],System.Double[])">
+            <summary>
+            constructor
+            </summary>
+            <param name="basis">basis[i] is the var chosen for the constraint i</param>
+            <param name="X">the tableu, the tableu will be changed in place</param>
+            <param name="c">cost</param>
+        </member>
+    </members>
+</doc>
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll
new file mode 100644
index 0000000..7cca120
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.pdb b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.pdb
new file mode 100644
index 0000000..a97697e
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/AsmL.Tools.Algos.SimplexMethodOpt.Tableu.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/HashMultiMap.fs b/tests/fsharp/regression/lucian-standalone-bug/HashMultiMap.fs
new file mode 100644
index 0000000..4560ee9
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/HashMultiMap.fs
@@ -0,0 +1,166 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections.Generic
+open Microsoft.FSharp.Collections
+                                 
+// Each entry in the HashMultiMap dictionary has at least one entry. Under normal usage each entry has _only_
+// one entry. So use two hash tables: one for the main entries and one for the overflow.
+[<Sealed>]
+type HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) = 
+    let firstEntries = new Dictionary<_,_>(n,hasheq);
+    let rest = new Dictionary<_,_>(3,hasheq);
+ 
+    new (hasheq : IEqualityComparer<'Key>) = new HashMultiMap<'Key,'Value>(11, hasheq)
+    new (seq : seq<'Key * 'Value>, hasheq : IEqualityComparer<'Key>) as x = 
+        new HashMultiMap<'Key,'Value>(11, hasheq)
+        then seq |> Seq.iter (fun (k,v) -> x.Add(k,v))
+
+    new (seq : seq<'Key * 'Value>) =  failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    new (n:int) = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    new () = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+
+    static member Create (seq : seq<'Key * 'Value>) =  failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    static member Create (n:int) = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    static member Create () = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+
+
+    member x.GetRest(k) = 
+        let mutable res = []
+        let ok = rest.TryGetValue(k,&res)
+        if ok then res else []
+
+    member x.Add(y,z) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then 
+            rest.[y] <- res :: x.GetRest(y)
+        firstEntries.[y] <- z
+
+    member x.Clear() = 
+         firstEntries.Clear()
+         rest.Clear()
+
+    member x.FirstEntries = firstEntries
+    member x.Rest = rest
+    member x.Copy() = 
+        let res = new HashMultiMap<'Key,'Value>(firstEntries.Count,firstEntries.Comparer) 
+        for kvp in firstEntries do 
+             res.FirstEntries.Add(kvp.Key,kvp.Value)
+        for kvp in rest do 
+             res.Rest.Add(kvp.Key,kvp.Value)
+        res
+
+    member x.Item 
+        with get(y : 'Key) = 
+            let mutable res = Unchecked.defaultof<'Value>
+            let ok = firstEntries.TryGetValue(y,&res)
+            if ok then res else raise (new System.Collections.Generic.KeyNotFoundException("The item was not found in collection"))
+        and set (y:'Key) (z:'Value) = 
+            x.Replace(y,z)
+
+    member x.FindAll(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then res :: x.GetRest(y) else []
+
+    member x.Fold f acc = 
+        let mutable res = acc
+        for kvp in firstEntries do
+            res <- f kvp.Key kvp.Value res
+            match x.GetRest(kvp.Key)  with
+            | [] -> ()
+            | rest -> 
+                for z in rest do
+                    res <- f kvp.Key z res
+        res
+
+    member x.Iterate(f) =  
+        for kvp in firstEntries do
+            f kvp.Key kvp.Value
+            match x.GetRest(kvp.Key)  with
+            | [] -> ()
+            | rest -> 
+                for z in rest do
+                    f kvp.Key z
+
+    member x.Contains(y) = firstEntries.ContainsKey(y)
+
+    member x.ContainsKey(y) = firstEntries.ContainsKey(y)
+
+    member x.Remove(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        // Note, if not ok then nothing to remove - nop
+        if ok then 
+            // We drop the FirstEntry. Here we compute the new FirstEntry and residue MoreEntries
+            let mutable res = []
+            let ok = rest.TryGetValue(y,&res)
+            if ok then 
+                match res with 
+                | [h] -> 
+                    firstEntries.[y] <- h; 
+                    rest.Remove(y) |> ignore
+                | (h::t) -> 
+                    firstEntries.[y] <- h
+                    rest.[y] <- t
+                | _ -> 
+                    // note: broken invariant
+                    ()
+            else
+                firstEntries.Remove(y) |> ignore 
+
+    member x.Replace(y,z) = 
+        firstEntries.[y] <- z
+
+    member x.TryFind(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then Some(res) else None
+
+    member x.Count = firstEntries.Count
+
+    interface IEnumerable<KeyValuePair<'Key, 'Value>> with
+        member s.GetEnumerator() = 
+            let elems = new System.Collections.Generic.List<_>(firstEntries.Count + rest.Count)
+            for kvp in firstEntries do
+                elems.Add(kvp)
+                for z in s.GetRest(kvp.Key) do
+                   elems.Add(KeyValuePair(kvp.Key, z))
+            (elems.GetEnumerator() :> IEnumerator<_>)
+
+    interface System.Collections.IEnumerable with
+        member s.GetEnumerator() = ((s :> seq<_>).GetEnumerator() :> System.Collections.IEnumerator)
+
+    interface IDictionary<'Key, 'Value> with 
+        member s.Item 
+            with get x = s.[x]            
+            and  set x v = s.[x] <- v
+            
+        member s.Keys = ([| for kvp in s -> kvp.Key |] :> ICollection<'Key>)
+        member s.Values = ([| for kvp in s -> kvp.Value |] :> ICollection<'Value>)
+        member s.Add(k,v) = s.[k] <- v
+        member s.ContainsKey(k) = s.ContainsKey(k)
+        member s.TryGetValue(k,r) = if s.ContainsKey(k) then (r <- s.[k]; true) else false
+        member s.Remove(k:'Key) = 
+            let res = s.ContainsKey(k) in 
+            s.Remove(k); res
+
+    interface ICollection<KeyValuePair<'Key, 'Value>> with 
+        member s.Add(x) = s.[x.Key] <- x.Value
+        member s.Clear() = s.Clear()            
+        member s.Remove(x) = 
+            let res = s.ContainsKey(x.Key) 
+            if res && Unchecked.equals s.[x.Key] x.Value then 
+                s.Remove(x.Key); 
+            res
+        member s.Contains(x) = 
+            s.ContainsKey(x.Key) && 
+            Unchecked.equals s.[x.Key] x.Value
+        member s.CopyTo(arr,arrIndex) = s |> Seq.iteri (fun j x -> arr.[arrIndex+j] <- x)
+        member s.IsReadOnly = false
+        member s.Count = s.Count
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/HashSet.fs b/tests/fsharp/regression/lucian-standalone-bug/HashSet.fs
new file mode 100644
index 0000000..2894cc4
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/HashSet.fs
@@ -0,0 +1,54 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections
+open System.Collections.Generic
+
+// HashSets are currently implemented using the .NET Dictionary type. 
+[<Sealed>]
+type HashSet<'T>(t: Dictionary<'T,int>) = 
+
+    new (hasheq: IEqualityComparer<'T>) = 
+        new HashSet<_>(new Dictionary<_,_>(hasheq))
+
+    new (size:int,hasheq: IEqualityComparer<'T>) = 
+        new HashSet<_>(new Dictionary<_,_>(size,hasheq))
+
+    new (elements:seq<'T>, hasheq: IEqualityComparer<'T>) as t = 
+        new HashSet<_>(new Dictionary<_,_>(hasheq)) 
+        then 
+           for x in elements do t.Add x
+
+    new (size:int) = failwith "unreachable"; new HashSet<'T>(11)
+
+    new () = failwith "unreachable"; new HashSet<'T>(11)
+
+    new (seq:seq<'T>) = failwith "unreachable"; new HashSet<'T>(11)
+        
+    member x.Add(y)    = t.[y] <- 0
+
+    member x.Clear() = t.Clear()
+
+    member x.Copy() : HashSet<'T>  = 
+        let t2 = new Dictionary<'T,int>(t.Count,t.Comparer) in 
+        t |> Seq.iter (fun kvp -> t2.[kvp.Key] <- 0); 
+        new HashSet<'T>(t2)
+
+    member x.Fold f acc = 
+        let mutable res = acc
+        for kvp in t do
+            res <- f kvp.Key res
+        res
+
+    member x.Iterate(f) =  t |> Seq.iter (fun kvp -> f kvp.Key)
+
+    member x.Contains(y) = t.ContainsKey(y)
+    member x.Remove(y) = t.Remove(y) |> ignore
+    member x.Count = t.Count
+    interface IEnumerable<'T> with
+        member x.GetEnumerator() = t.Keys.GetEnumerator() :> IEnumerator<_>
+    interface System.Collections.IEnumerable with
+        member x.GetEnumerator() = t.Keys.GetEnumerator()  :> IEnumerator 
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.dll
new file mode 100644
index 0000000..6ec250b
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.pdb
new file mode 100644
index 0000000..239455b
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Drawing.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.dll
new file mode 100644
index 0000000..728da0b
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.pdb
new file mode 100644
index 0000000..d9ab2cb
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphHelper.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.XML b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.XML
new file mode 100644
index 0000000..492a1a0
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.XML
@@ -0,0 +1,446 @@
+<?xml version="1.0"?>
+<doc>
+    <assembly>
+        <name>Microsoft.GLEE.GraphViewerGDI</name>
+    </assembly>
+    <members>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.SpatialAlgorithm">
+            <summary>
+            Build a spatial hierarchy
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.Geometry">
+            <summary>
+            Summary description for Geometry.
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.Tessellator">
+            <summary>
+            
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.Tessellator.Epsilon">
+            <summary>
+            is used to determine the tessellation tolerance as diagonal
+            length divided by fractionOfPicture
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.Line">
+            <summary>
+            
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.DrawingPanel">
+            <summary>
+            this class serves as a drawing panel for GViewer
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.DrawingPanel.GetHitSlack">
+            <summary>
+            It should be physically on the screen be one tenth of an inch
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.LabelGeometry">
+            <summary>
+            
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.DEdge">
+            <summary>
+            it is class holding Microsoft.GLEE.Drawing.Edge and Microsoft.GLEE.Edge
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.DEdge.GraphicsPath">
+            <summary>
+            Can be set to GraphicsPath of GDI (
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.GViewer">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.RemoveToolbar">
+            <summary>
+            This function removes the toolbar from the control
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.OnPaint(System.Windows.Forms.PaintEventArgs)">
+            <summary>
+            The ViewInfo gives all info needed for setting the view
+            </summary>
+        </member>
+        <member name="F:Microsoft.GLEE.GraphViewerGDI.GViewer.xLong">
+            <summary>
+            
+            xLong = GrapWidth/ClientRect.Width>GraphHeight/ClientRect.Height
+            </summary>
+        </member>
+        <member name="F:Microsoft.GLEE.GraphViewerGDI.GViewer.scaledDown">
+            <summary>
+            if scaledDown is true - take the scale from the zoomCoeff 
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.#ctor">
+            <summary>
+            Default constructor
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Dispose(System.Boolean)">
+            <summary> 
+            Clean up any resources being used.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.InitializeComponent">
+            <summary> 
+            Required method for Designer support - do not modify 
+            the contents of this method with the code editor.
+            </summary>
+        </member>
+        <member name="F:Microsoft.GLEE.GraphViewerGDI.GViewer.scale">
+            <summary>
+            this varaible, scale, is fixed for a given window size and used as a constant multiplier to ZoomF value
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.OnResize(System.EventArgs)">
+            <summary>
+            Handle Resize event
+            </summary>
+            <param name="e"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ShowGroup(System.Object[])">
+            <summary>
+            Brings in to the view the object of the group
+            </summary>
+            <param name="objs"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CenterToGroup(System.Object[])">
+            <summary>
+            Changes the view in a way that the group is at the center
+            </summary>
+            <param name="objs"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ShowBBox(Microsoft.GLEE.Drawing.Rectangle)">
+            <summary>
+            Make the bounding box fully visible
+            </summary>
+            <param name="bb"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Pan(System.Double,System.Double)">
+            <summary>
+            Pans the view by vector (x,y)
+            </summary>
+            <param name="x"></param>
+            <param name="y"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Pan(Microsoft.GLEE.Splines.Point)">
+            <summary>
+            Pans the view by vector p
+            </summary>
+            <param name="p"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CenterToPoint(System.Double,System.Double)">
+            <summary>
+            centers the view to the point (x,y)
+            </summary>
+            <param name="x"></param>
+            <param name="y"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CenterToPoint(Microsoft.GLEE.Splines.Point)">
+            <summary>
+            Centers the view to the point p
+            </summary>
+            <param name="p"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.GetObjectAt(System.Int32,System.Int32)">
+            <summary>
+            Finds the object under point (x,y) where x,y are given in the window coordinates
+            </summary>
+            <param name="x"></param>
+            <param name="y"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.GetObjectAt(System.Drawing.Point)">
+            <summary>
+            Finds the object under point p where p is given in the window coordinates
+            </summary>
+            <param name="p"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ZoomInPressed">
+            <summary>
+            Zooms in
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ZoomOutPressed">
+            <summary>
+            Zooms out
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.SaveButtonPressed">
+            <summary>
+            Raises a dialog of saving the drawing image to a file
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ForwardButtonPressed">
+            <summary>
+            Navigates forward in the view history
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.BackwardButtonPressed">
+            <summary>
+            Navigates backward in the view history
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.OnKey(System.Windows.Forms.KeyEventArgs)">
+            <summary>
+            Reacts on some pressed keys
+            </summary>
+            <param name="e"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CalculateLayout(Microsoft.GLEE.IGraphViewer.IGraph)">
+            <summary>
+            calcualates the layout and returns the object ready to be drawn
+            </summary>
+            <param name="graph"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.SetToolTip(System.Windows.Forms.ToolTip,System.String)">
+            <summary>
+            sets a tool tip
+            </summary>
+            <param name="toolTip"></param>
+            <param name="tip"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.SetObjectWithCalculatedLayout(System.Object)">
+            <summary>
+            Just uses the passed object to draw the graph. The method expects DGraph as the argument
+            </summary>
+            <param name="objectContainingLayout"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.ScreenToSource(System.Single,System.Single,System.Single@,System.Single@)">
+            <summary>
+            maps screen coordinates to viewer coordinates
+            </summary>
+            <param name="screenX"></param>
+            <param name="screenY"></param>
+            <param name="viewerX"></param>
+            <param name="viewerY"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Pan(System.Single,System.Single)">
+            <summary>
+            pans the drawing on deltaX, deltaY in the drawing coords
+            </summary>
+            <param name="deltaX"></param>
+            <param name="deltaY"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CreateGraph(System.String)">
+            <summary>
+            creates an empty graph with the label
+            </summary>
+            <param name="label"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.CreateGraph(System.String,System.String)">
+            <summary>
+            creates an empty graph with the label
+            </summary>
+            <param name="id"></param>
+            <param name="label"></param>
+            <returns></returns>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#Select">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#Invalidate">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#add_MouseWheel(System.Windows.Forms.MouseEventHandler)">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#remove_MouseWheel(System.Windows.Forms.MouseEventHandler)">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#add_Click(System.EventHandler)">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#remove_Click(System.EventHandler)">
+            <summary>
+            Summary description for DOTViewer.
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.DrawingPanel">
+            <summary>
+            The panel containing GViewer object
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.NavigationVisible">
+            <summary>
+            Gets or sets the forward and backward buttons visibility
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.SaveButtonVizible">
+            <summary>
+            Gets or sets the save button visibility
+            </summary>
+        </member>
+        <member name="E:Microsoft.GLEE.GraphViewerGDI.GViewer.SelectionChanged">
+            <summary>
+            The event raised every time when the mouse cursor is hovered on a new object graphic object or nowhere
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.SrcRect">
+            <summary>
+            debug properties
+            </summary>
+            
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.DestRect">
+            <summary>
+            The rectangle for drawing
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.SelectedObject">
+            <summary>
+            The object which is currently located under the mouse cursor
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.ZoomFraction">
+            <summary>
+            Sets or gets the fraction on which the zoom value chandes in every zoom out ot zoom in
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.ForwardEnabled">
+            <summary>
+            Enables or disables the forward button
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.BackwardEnabled">
+            <summary>
+            Enables or disables the backward button
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.hVal">
+            <summary>
+            positions and largeValue of scroll bars define srcRect in the graph coordinates
+            </summary>		
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.vVal">
+            <summary>
+            positions and largeValue of scroll bars define srcRect in the graph coordinates
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.GraphWidth">
+            <summary>
+            The width of the current graph
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.GraphHeight">
+            <summary>
+            The height of the current graph
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.ZoomF">
+            <summary>
+            Gets or sets the zoom factor
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.Graph">
+            <summary>
+            Setting the Graph property shows the graph in the control
+            </summary>
+            
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.MouseHitDistance">
+            <summary>
+            SelectedObject can be detected if the distance in inches between it and 
+            the cursor is less than MouseHitDistance
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.GraphWithLayout">
+            <summary>
+            Returns layouted Microsoft.GLEE.DrawingDefs.Graph
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.GViewer.Microsoft#GLEE#IGraphViewer#IGraphViewer#Graph">
+            <summary>
+            Returns layouted Microsoft.GLEE.DrawingDefs.Graph
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.DGraph">
+            <summary>
+            This yet another graph is needed to hold additional GDI specific data for drawing.
+            It has a pointer to Microsoft.GLEE.Drawing.Graph and Microsoft.GLEE.Graph.
+            It is passed to the drawing routine
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.BezierCurve">
+            <summary>
+            
+            </summary>
+        </member>
+        <member name="F:Microsoft.GLEE.GraphViewerGDI.BezierCurve.par0">
+            <summary>
+            the parameter interval
+            </summary>
+        </member>
+        <member name="F:Microsoft.GLEE.GraphViewerGDI.BezierCurve.par1">
+            <summary>
+            the parameter interval
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.BezierCurve.Par0">
+            <summary>
+            start of the parameter interval
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.BezierCurve.Par1">
+            <summary>
+            end of the parameter interval
+            </summary>
+        </member>
+        <member name="P:Microsoft.GLEE.GraphViewerGDI.BezierCurve.Item(System.Double)">
+            <summary>
+            //value at t
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.Printing">
+            <summary>
+            Summary description for Printing.
+            </summary>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.Printing.#ctor(Microsoft.GLEE.GraphViewerGDI.GViewer)">
+            <summary>
+            Constructor
+            </summary>
+            <param name="dv"></param>
+        </member>
+        <member name="M:Microsoft.GLEE.GraphViewerGDI.Printing.OnPrintPage(System.Drawing.Printing.PrintPageEventArgs)">
+            <summary>
+            This methods "draws" to the printer
+            </summary>
+            <param name="e"></param>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.BBNode">
+            <summary>
+            Summary description for BBNode.
+            </summary>
+        </member>
+        <member name="T:Microsoft.GLEE.GraphViewerGDI.DNode">
+            <summary>
+            it is a class holding Microsoft.GLEE.Drawing.Node and Microsoft.GLEE.Node
+            </summary>
+        </member>
+    </members>
+</doc>
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.dll
new file mode 100644
index 0000000..9f9fcea
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.pdb
new file mode 100644
index 0000000..09e24b6
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.GraphViewerGDI.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.dll
new file mode 100644
index 0000000..a8b12dd
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.pdb
new file mode 100644
index 0000000..4c6a63e
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.IGraphViewer.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.dll
new file mode 100644
index 0000000..4401a4b
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.pdb
new file mode 100644
index 0000000..d8e4ce4
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.Splines.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.dll b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.dll
new file mode 100644
index 0000000..4c69859
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.dll differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.pdb b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.pdb
new file mode 100644
index 0000000..bc27886
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/Microsoft.GLEE.pdb differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/TaggedHash.fs b/tests/fsharp/regression/lucian-standalone-bug/TaggedHash.fs
new file mode 100644
index 0000000..822e5ac
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/TaggedHash.fs
@@ -0,0 +1,59 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections.Tagged
+
+    #nowarn "51"
+
+    open System
+    open System.Collections.Generic
+    open Microsoft.FSharp.Collections
+    type UntaggedHashMultiMap<'Key,'Value> = Microsoft.FSharp.Collections.HashMultiMap<'Key,'Value>
+
+    type HashMultiMap<'Key,'Value,'HashTag>
+         when 'HashTag :> IEqualityComparer<'Key> =
+        { t : UntaggedHashMultiMap<'Key,'Value> }
+
+        static member Create(hasheq: 'HashTag,n:int)  : HashMultiMap<'Key,'Value,'HashTag> = 
+            { t = new UntaggedHashMultiMap<_,_>(n,hasheq) }
+
+        member x.Add(y,z) = x.t.Add(y,z)
+        member x.Clear() = x.t.Clear()
+        member x.Copy() : HashMultiMap<'Key,'Value,'HashTag>  = { t = x.t.Copy() }
+        member x.Item with get(y) = x.t.[y]
+                      and  set y z = x.t.[y] <- z
+        member x.FindAll(y) = x.t.FindAll(y) 
+        member x.Fold f acc =  x.t.Fold f acc
+        member x.Iterate(f) =  x.t.Iterate(f)
+        member x.Contains(y) = x.t.ContainsKey(y)
+        member x.ContainsKey(y) = x.t.ContainsKey(y)
+        member x.Remove(y) = x.t.Remove(y)
+        member x.Replace(y,z) = x.t.Replace(y,z)
+        member x.TryFind(y) = x.t.TryFind(y)
+        member x.Count = x.t.Count
+
+    type HashMultiMap<'Key,'Value> = HashMultiMap<'Key,'Value, IEqualityComparer<'Key>>    
+
+
+    [<Sealed>]
+    type HashSet<'T,'HashTag when 'T : equality> 
+         when 'HashTag :> IEqualityComparer<'T>(t:  HashSet<'T>) =
+
+        static member Create(hasheq: ('HashTag :> IEqualityComparer<'T>),size:int) : HashSet<'T,'HashTag> = 
+            new HashSet<'T,'HashTag>(HashSet<_>(size,hasheq))
+
+        member x.Add(y)    = t.Add(y)
+        member x.Clear() = t.Clear()
+        member x.Copy() = new HashSet<'T,'HashTag>(t.Copy())
+        member x.Fold f acc = t.Fold f acc
+        member x.Iterate(f) =  t.Iterate(f)
+        member x.Contains(y) = t.Contains(y)
+        member x.Remove(y) = t.Remove(y)
+        member x.Count = t.Count
+
+        interface IEnumerable<'T> with
+            member x.GetEnumerator() = (t :> seq<_>).GetEnumerator() 
+
+        interface System.Collections.IEnumerable with 
+            member x.GetEnumerator() = (t :> System.Collections.IEnumerable).GetEnumerator()  
+
+    type HashSet<'T when 'T : equality> = HashSet<'T, IEqualityComparer<'T>>    
diff --git a/tests/fsharp/regression/lucian-standalone-bug/analysis.fs b/tests/fsharp/regression/lucian-standalone-bug/analysis.fs
new file mode 100644
index 0000000..87334ab
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/analysis.fs
@@ -0,0 +1,1097 @@
+#indent "off"
+
+module Analysis
+
+open System
+open System.Windows.Forms
+open Utils
+open Ast
+open States
+
+
+// TODO:
+// check for infinite loops through notifies.
+// Each entity in the source code has an optional [id], which is taken to be line-number if absent, and used for debugging messages
+// Clean up compiler error messages: have each one print, and allow continued compilation to find further error messages
+// Enforce non-multiwire inputs to most nodes, as per email to Georgio
+// Make the type-inferer handle circular loops
+// If you BeginRead/BeginWrite with no outwires, it's probably a bug!
+// Change where the {inwires} go in the syntax
+// Georgio wanted to check that locks are released
+// Check that there will be only one return.
+// Should have much more determinism for instantiating queues and doing CallReturn nodes and synthesising an external thing
+// Check all the dependencies. They should flow with wires, not with evaluating. Needs some refactoring.
+// When we make a call/return, hopefully the dependencies will propogate
+// The types for StateValue/StateVersion/getstate/setstate should be tidied up
+// Circular loops (in wires and notify-ports) will require (1) proper hash-table for state-space exploration, and
+// (2) a search strategy with good coverage (doesn't get bogged down in places), and
+// (3) counting, so we know when to stop prematurely.
+// For circular locks between modules, the best solution is type-based. Make the type-inference-thing
+// figure out for each handler which calls it makes while possibly under the influence of locks.
+// Also admit this information in the handler declaration for externs.
+// Then, look for cycles in the graph.
+// NB. Won't bother analysing how many "return" statements get called. Because they won't be used in the graphs.
+// NB. For purpose of marshalling state to fingerprint to compare if two states are equal, we
+// won't bother re-ordering the instance-indexes (because exploration is only used for race-detection,
+// where the two instances are fixed and determinate... or at least they will be once I short-circuit
+// calling to an extern). We will have to re-order the message queues though. This will be important,
+// because reordering and fingerprinting and sharing states will cut things down from 2 + n to n + 2.
+// Must come up with an error model that deals with problems of over-approximation - e.g. thinking
+// that a lock is released twice when in reality it's only ever released once. At the moment
+// I e.g. throw an exception in the twice-release case.
+// Must add the cycle-stuff to external handlers.
+
+
+// VERIFICATION:
+// We have a runtime execution model which tracks "causality" and type and importance. That is,
+// for each value, (1) if any GETs led to this value then it records the sequence-tag
+// on the GET; (2) if any important notifications led to it then it records that fact.
+// Runtime errors:
+// (1) accessing a field which doesn't exist (done by datatype checking)
+// (2) failing a type assertion (activity handlers/notifies have explicit types)
+// (3) if we SET#n due to an important message, then any subsequent SET which depends on a GET#<n is erroneous
+// Model-checking errors:
+// (4) no possible execution trace can reach a particular state
+// Bugs so far observed:
+// In both my MyState and Bumper, I forgot to SetState. This would have been picked up by reachability analysis
+// In the original diagram there was a miswire on b. This would have been picked up by type analysis
+// In the translation of Explorer I bet there were race conditions. This will hopefully be found by importance analysis
+// When writing the conditions in Wander.OnBumper, I mistyped the third condition so it was the same as the first
+// When testing Wander.OnBumper, I accidentally gave it (false,false) so it got nowhere.
+
+
+
+// flatten_typelist: given a typelist, if anything inside it is the name of a choice-typedef
+// then it will be expanded to the contents of that choice-typedef. Oh, and it's an error to
+// call it "important" if it is a choice-typedef, since its expansion will say that.
+// Oh, and in what we produce, everything must be a valid type
+// tlclean: cleans up a typelist by merging entries; choosing max importance in case of duplicates
+let tl_union tail =
+  let rec tmerge_imp tail = match tail with
+      | [] -> []
+      | (t1,imp1)::[] -> [(t1,imp1)]
+      | (t1,imp1)::(t2,imp2)::tail -> if t1=t2 then tmerge_imp ((t1,imp_max [imp1;imp2])::tail)
+                                    else (t1,imp1) :: (tmerge_imp ((t2,imp2)::tail)) in
+  tmerge_imp (List.sortWith type_compare_unimp tail)
+//
+let rec flatten_typelist tc tp tail =
+  if (tail=TUnk) then tail else
+  let deref (t,imp) = match List.try_assoc t tc with None -> [(t,imp)]
+      | Some tail -> if imp=Unimportant then flatten_typelist tc tp tail else raise (new System.Exception("can't call " + t + " important")) in
+  let tail = tl_union (List.concat (List.map deref tail)) in
+  let ensuretypedefined (t,i) = (match List.try_assoc t tp with Some _ -> () | None -> raise (new System.Exception("Type " + t + " undefined")) ) in
+  List.iter ensuretypedefined tail;
+  tail
+
+// PostParse: Normalizes all the type definitions - so that all TDefChoice are lists
+// of TPrims, and they're all dereferenced in the code.
+// Also ensures that no typename is used as an activity, state, handler or wire name.
+// Also ensures that no statename is used as a wirename.
+// Also ensures that no two activities have the same name
+// Also ensures that in NIfType all the conditionals are on the same name
+// (and fills in that for the "else" branch if present)
+// and makes sure that their if-types are unique
+// Also ensures that NIf and NIfType have at least one ifdat.
+// Also converts NExpr(EIdPath[type;field]) to NExpr(EEnum(type,field))
+// Also completes inWires, by adding to inWires any wires mentioned in the expression
+// that weren't already listed in inWires.
+// Also ensures that all request/response handlers have an unbounded input queue
+// Also simplifies the code:
+// NExpr contains no "state-get" expressions (IdPath on state bceomes NGet), also for if-then nodes.
+// (nb. that the grammar of the language already forces if-then nodes to be expressions anyway).
+// NCall/NSet/NSignal/NReturn/NFirst arguments are pure wires (EIdPath(IdPath))
+// NCall has exactly one outwire which leads to a NCallreturn
+// NIf expressions have no gets.
+// Note that when we evaluate an NIf consequence, it's done in the same context as the If part of it.
+// Also fixes up the outWires.
+// Note: outWires should be done after the simplification (so as to fix up outWires of
+// the simplification as well). And simplification must be done after inWires. Simplification
+// will generate correct inWires itself, but not correct outWires. Simplification needs to
+// know the inWires before it can generate extra nodes.
+// Note: the simplifications can introduce extra wires. Each wire has a buffer. We generally
+// use "maximum buffer size of what it's replacing" as the size of these introduced wires.
+// This can result in the system having more buffering than the user originally programmed.
+// In effect, we should think of the user program as specifying minimum buffer sizes, not exact.
+let PostParse ((tp,tc,ef,a):(TDefPrim list * TDefChoice list * ExternFun list * Activity list)) :Prog =
+  let tc = List.map (fun (tname,tail) -> (tname, flatten_typelist tc tp tail)) tc in
+  //
+  let rec postparse_activity (a:Activity) = 
+    System.Console.Out.WriteLine ("postparse: activity " + a.s + "\n");
+    if (List.mem_assoc a.s tp) || (List.mem_assoc a.s tc) then raise(new System.Exception("ERROR: activity " + a.s + " is named after a type"));
+    let lvars = List.map (fun (s,sf)->s) a.state in
+    {new Activity with s=a.s and state=List.map (postparse_state a) a.state and signal=flatten_typelist tc tp a.signal and h=List.map (postparse_h a lvars) a.h and ext=a.ext}
+  // postparse_state: flattens the typelist
+  and postparse_state (a:Activity) (s,e) =
+    if (List.mem_assoc s tp) || (List.mem_assoc s tc) then raise(new System.Exception("ERROR: state " + a.s + "." + s + " is named after a type"));
+    (s, {new Expr with e=e.e and t=flatten_typelist tc tp e.t} )
+  // postparse_h: given a handler (s,h), it returns a corrected handler - first it
+  // makes all expressions simple in the handler (see below), then it computs the outWires list
+  // (similar to explanation of postparse_outWires), then it flattens h.at (handler argument type).
+  and postparse_h (a:Activity) (lvars:string list) ((s,h):(string*Handler)) =
+    System.Console.Out.WriteLine ("postparse: handler " + s + "(" + (type_to_string h.at) + ")\n");
+    if (List.mem_assoc s tp) || (List.mem_assoc s tc) then raise(new System.Exception("ERROR: " + a.s + ".on " + s + " is named after a type"));
+    if (h.rt<>[] && h.aq<>NUnbounded) then raise(new System.Exception("ERROR: " + a.s + "." + s + ":" + (type_to_string h.at) + " has a bounded queue; being a request/response handler, it must be unbounded"));
+    let (hat,hai)=h.at in if (hai=Important && h.aq<>NUnbounded) then raise(new System.Exception("ERROR: " + a.s + "." + s + ":" + (type_to_string h.at) + " has finite queue; being a handler for important notifies, it must be unbounded"));
+    let n = List.concat (List.map (postparse_node a h h.a lvars) h.n) in // simplify &c.
+    let n = List.concat (List.map (postparse_callOutWires a h) n) in // make so Call nodes have only a single outwire
+    //
+    let outWires = List.choose (has_inWire h.a) n in
+    let at = flatten_typelist tc tp [h.at] in
+    let at = if List.length(at)=1 then List.head(at) else raise(new System.Exception("Handler " + s + " must have exactly one input type")) in
+    (s, {new Handler with a=h.a and aq=h.aq and at=at and outWires=outWires and rt=flatten_typelist tc tp h.rt and n=n} )
+  //
+  // postparse2: this simply fixes the output wires. It has to be called as a separate
+  // phase after postparse, since postparse might turn a "call" node into a "call''/callreturn" pair
+  // and people who before would have had outwires to "call" now have them to "call''".
+  // postparse_outWires: given a node n, returns an updated version of it in which
+  // the "outWires" list has been computed. (how? by looking for all other nodes in the
+  // handler which have n as one of their inWires). Also, if the node is an If node,
+  // does the same for all the If branches.
+  and postparse2_activity (a:Activity) = {new Activity with h=List.map (postparse2_handler a) a.h and s=a.s and state=a.state and signal=a.signal and ext=a.ext}
+  and postparse2_handler (a:Activity) ((s,h):(string*Handler)) = (s, {new Handler with n=List.map (postparse2_outWires a h h.n) h.n and a=h.a and at=h.at and aq=h.aq and outWires=h.outWires and rt=h.rt} )
+  and postparse2_outWires (a:Activity) (h:Handler) (ns:Node list) (n:Node) =
+    let outWires = List.choose (has_inWire n.s) ns in
+    let nd = match n.d with
+     | NIf(ifs) -> let ifs = List.map (postparse_outWires_ifdat a h ns) ifs in NIf(ifs)
+     | NIfType(ifs) -> let ifs = List.map (postparse_outWires_iftypedat a h ns) ifs in NIfType(ifs)
+     | _ -> n.d in
+    {new Node with d=nd and outWires=outWires and s=n.s and t=n.t and inWires=n.inWires and src=n.src}
+  and postparse_outWires_ifdat (a:Activity) (h:Handler) (ns:Node list) (id:IfDat) : IfDat =
+    let outWires = List.choose (has_inWire id.thens) ns in
+    {id with thenOutWires = outWires}
+  and postparse_outWires_iftypedat (a:Activity) (h:Handler) (ns:Node list) (id:IfTypeDat) : IfTypeDat =
+    let outWires = List.choose (has_inWire id.tthens) ns in
+    {id with tthenOutWires = outWires}
+  //
+  // postparse_callOutWires: given a node n, returns an updated version of it in which
+  // the "outWires" list has 1 element pointing to a NCallreturn node. This means might
+  // have to return a list of nodes. What should be the queue-length of this intermediate
+  // thing? -- the maximum of what fallows.
+  and postparse_callOutWires (a:Activity) (h:Handler) (n:Node) =  match n.d with
+    | NCall(_) -> 
+      ( let qmax = queue_max (List.map (fun ((w,q):Wire)->q) (("",NBounded(1))::n.outWires) ) in
+        let callnode = {new Node with s=n.s + "''" and outWires=[(n.s,qmax)] and t=n.t and d=n.d and inWires=n.inWires and src=n.src} in
+        let returnnode = {new Node with s=n.s and t=n.t and d=NCallreturn({new Expr with e=EIdPath([n.s + "''"]) and t=n.t}) and inWires=[(n.s + "''",qmax)] and outWires=n.outWires and src=n.src} in
+        [callnode;returnnode] )
+    | _ -> [n]
+  // has_inWire: returns Some (n.s,q) if this node has (q,dst) as an inWire
+  and has_inWire (dst:string) (n:Node) : (Wire option) =
+    let q = List.try_assoc dst n.inWires in
+    match q with Some q -> Some (n.s,q) | None ->  None
+  // postparse_node: first completes the "inWires" list, by adding to it any
+  // wire that was mentioned in the expr but was not yet in the list. (or,
+  // makes it triggered by the handler itself if there are no other triggers).
+  // Then it simplifies in the expression inside the node, as described above.
+  // This might result in some additional prior nodes being generated (all of which
+  // will have their inWires correct). It returns a list of nodes: this corrected
+  // one, plus any prior ones that arose from expr-simplification.
+  and postparse_node (a:Activity) (h:Handler) (activityarg:string) (lvars:string list) (n:Node) = try (
+    System.Console.Out.WriteLine ("postparse: line " + string(n.src) + ": " + (node_to_string n) + "\n");
+    if (List.mem_assoc n.s tp) || (List.mem_assoc n.s tc) then raise(new System.Exception("ERROR: Node at line " + string(n.src) + " is named " + n.s + ", after a type"));
+    if (List.mem n.s lvars) then raise(new System.Exception("ERROR: Node at line " + string(n.src) + " is named " + n.s + ", after a state variable"));
+    let inWires = wire_union_qmerge [n.inWires;(get_ndInWires lvars n.d)] in
+    let inWires = (if List.length(inWires)=0 then [(activityarg,NBounded(1))] else inWires) in
+    // that's so it depends on the handler itself if there were no other inWires
+    let n = {new Node with s=n.s and t=flatten_typelist tc tp n.t and d=n.d and inWires=inWires and outWires=n.outWires and src=n.src} in
+    match n.d with
+    | NExpr(e) -> let (inWires,e,ne) = make_expression_simple false activityarg lvars n e in
+          ne @ [{n with d=NExpr(e); inWires=inWires}]
+    | NCall(peer,verb,nq,e) -> let (inWires,e,ne) = make_expression_simple true activityarg lvars n e in
+          ne @ [{n with d=NCall(peer,verb,nq,e); inWires=inWires}]
+    | NCallreturn(s) -> [n]
+    | NSet(idp,tail,e) -> let (inWires,e,ne) = make_expression_simple true activityarg lvars n e in
+          ne @ [{n with d=NSet(idp,tail,e); inWires=inWires}]
+    | NAtomic(ad) -> [n]
+    | NGet(idp,tail) -> [n]
+    | NFirst(_) -> [n]
+    | NSignal(e) -> let (inWires,e,ne) = make_expression_simple true activityarg lvars n e in
+          ne @ [{n with d=NSignal(e); inWires=inWires}]
+    | NReturn(e) -> let (inWires,e,ne) = make_expression_simple true activityarg lvars n e in
+          ne @ [{n with d=NReturn(e); inWires=inWires}]
+    | NIf(ifs) -> 
+          // to do this easily, we make a dummy expression that includes all the "if" expressions
+          // and the "then" expressions.
+          // then pass this dummy expression to the simplify_expression routine, then unpack it.
+          // That's because the simplify_expression routine only takes in a single expression
+          // rather than a list. (we can't call simplify_expression multiple times, once for
+          // each expression, because the If node really needs inWires as the union of all expressions,
+          // and needs all get-state things pulled out ahead of it.)
+          // NOTE: We are requiring all "THEN" variables to be present up-front at the start of the IF.
+          // This might be unexpected semantics. But it simplifies implementation and is in any case
+          // still a generalisation of what the diagrams can express.
+          let es = List.map (fun (id:IfDat) -> {new Expr with t=TUnk and e=EFun("dummyarg",[id.ife;id.thene])}) ifs in
+          let e:Expr = {new Expr with t=TUnk and e=EFun("dummy",es)} in 
+          let (inWires,e,ne) = make_expression_simple false activityarg lvars n e in
+          let es:Expr list = match e.e with EFun(_,es)->es | _ -> raise(new System.Exception("not a dummy fun")) in
+          let es:(Expr*Expr)list = List.map (fun e -> match e.e with EFun(_,[e1;e2])->(e1,e2) | _ -> raise(new System.Exception("not a dummy arg"))) es in
+          let ifs = List.map2 (fun oldid (e1,e2) -> {oldid with ife=e1; thene=e2}) ifs es in
+          if List.length(ifs)=0 then raise(new System.Exception("ERROR: no branches on if"));
+          ne @ [{n with d=NIf(ifs); inWires=inWires}]
+     | NIfType(ifs) ->
+          // like "if" with the dummy expression with all the "then" expressions
+          // but we first have to do work on the types -- flatten them, make sure they're unique
+          // and we also have to ensure that the variable name that we're testing is unique
+          let names = List.choose (fun (id:IfTypeDat) -> if (id.ifv="") then None else Some id.ifv) ifs in
+          let names = list_makeunique (List.sortWith Operators.compare names) in
+          if (List.length(names)=0) then raise(new System.Exception("ERROR: iftype without names"));
+          if (List.length(names)>1) then raise(new System.Exception("ERROR: if (v:type) must use same variable for all branches"));
+          let ifv = List.head names in
+          if List.mem ifv lvars then raise(new System.Exception("ERROR: if (" + ifv + ":type) cannot test type of a state variable"));
+          let ifs = List.map (fun (id:IfTypeDat) -> {id with ifv=ifv; ift=flatten_typelist tc tp id.ift}) ifs in
+          // now we can do the dummy expression
+          let es = List.map (fun (id:IfTypeDat) -> id.tthene) ifs in
+          let e:Expr = {new Expr with t=TUnk and e=EFun("dummy",es)} in
+          let (inWires,e,ne) = make_expression_simple false activityarg lvars n e in
+          let es:Expr list = match e.e with EFun(_,es)->es | _ -> raise(new System.Exception("not a dummy fun")) in
+          let ifs = List.map2 (fun oldid e -> {oldid with tthene=e}) ifs es in
+          if List.length(ifs)=0 then raise(new System.Exception("ERROR: no branches on iftype"));
+          ne @ [{n with d=NIfType(ifs); inWires=inWires}]
+     ) with e -> raise (new System.Exception("line " + string(n.src) + ": " + e.ToString()))
+  // recognize_enums: every EIdPath([type;...]) is turned into an EEnum
+  and recognize_enums (e:Expr) : Expr = match e.e with
+    | EVoid -> e | EInt(_) -> e | EBool(_) -> e | EString(_) -> e | EEnum(_) -> e
+    | EImportance(i,e) -> {e with e=EImportance(i,recognize_enums e)}
+    | EFun(f,es) -> {e with e=EFun(f,List.map recognize_enums es)}
+    | EExternal(f,es) -> {e with e=EExternal(f,List.map recognize_enums es)}
+    | EConstructor(t,fs) -> {e with e=EConstructor(t,List.map (fun (f,e)->(f,recognize_enums e)) fs)}
+    | EIdPath(idp) -> let head = List.head idp in match (List.try_assoc head tp) with None -> e
+        | Some(TEnum(ss)) -> if List.length(idp)<>2 then raise(new System.Exception("ERROR: " + (idpath_to_string idp) + " not a valid enum expression"));
+          let field = List.nth idp 1 in if List.mem field ss then {e with e=EEnum(head,field)}
+          else raise(new System.Exception("ERROR: " + (idpath_to_string idp) + " not a valid enum field"));
+        | _ -> raise(new System.Exception("ERROR: " + (idpath_to_string idp) + " not an enum type"));
+  // make_expression_simple: it's job is to factor out an expression so that some operations
+  // (e.g. getting state) are done by a prior node. For some purposes we have to factor
+  // out all interesting expressions and just return an Expr which is a pure wire.
+  // Well, the function returns (inWires, e', nodes) where "nodes" are the additional prior nodes
+  // that are needed (their own inWires are all correct), and e' is the updated expression, and
+  // inWires is the updated list of inWires needed for this expression.
+  // As for the additional nodes that we synthesize, suppose we're handling
+  // node "n" which has expression "e"=state.field+2, and suppose that we're asked to
+  // return just a pure-wire expression. So we synthesize
+  //   n'state = NGet(state)  -- because we have to factor out NGet nodes
+  //   n' = n'state.field+2   -- because we were asked to return just a pure wire expression
+  //   n  = n'                -- and this, "n'", is the expression we'll return.                
+  and make_expression_simple (mustbewire:bool) activityarg (lvars:string list) (n:Node) (e:Expr) : (Wire list * Expr * Node list) =
+    let e = recognize_enums e in
+    // "states" is a list of all state fields which are needed for this expression, and which we'll synthesize NGet nodes for:
+    let states = list_makeunique (List.sortWith Operators.compare (get_expression_states lvars e)) in
+    // make_getnode: a small function which produces a "NGet" node which gets the specified state
+    let make_getnode s = {new Node with s=n.s + "'" + s and t=TUnk and d=NGet(s,TUnk) and inWires=n.inWires and outWires=[] and src=n.src} in
+    let ne = List.map make_getnode states in
+    // question: if in simplifying NExpr(e) we need to synthesise a NGet node,
+    // then what should be the queue-size of the link from NGet to NExpr? Answer:
+    // just the smallest of the queue-sizes that made up the original inWires.
+    let minqueue = queue_min (List.map (fun (s,q)->q) n.inWires) in
+    let newInWires = List.map (fun s -> (n.s + "'" + s,minqueue)) states in
+    let inWires = wire_union_qmerge [newInWires;n.inWires] in
+    // "renames" is because an expression which used to be, say, state+5, must now be "state'+5" where state' is the name of the wire we synthesized.
+    let renames = List.map (fun s -> (s,n.s + "'" + s)) states in
+    let e = rename_expr_id renames e in // expr with all the renamings done on it
+    // now for the answer. If our expression is just selecting a field of an inwire, or whoever
+    // called us didn't require a pure wire, then we can return what we've made:
+    if (is_eidp e || not mustbewire) then
+    ( (inWires,e,ne)
+    ) else
+    ( // otherwise, our caller required an answer that was a pure wire. So we have to synthesize it
+      // by generating an extra NExpr node, and then returning an Expr which is a pure wire.
+      // See discussion at the start of this function for an example of how nodes are named.
+      let ne = ne @ [{new Node with s=n.s + "'" and t=TUnk and d=NExpr(e) and inWires=inWires and outWires=[] and src=n.src}] in
+      let inWires = [(n.s + "'", minqueue)] in // the new inWires that our pure wire will depend upon
+      ( inWires, {new Expr with t=TUnk and e=EIdPath([n.s + "'"])}, ne)
+    )
+  // get_expression_states: returns a list of every state-variable that the expression refers to
+  and get_expression_states (lvars:string list) (e:Expr) : string list = match e.e with
+    | EVoid -> []
+    | EImportance(i,e) -> get_expression_states lvars e
+    | EIdPath(idp) -> if List.mem (List.head idp) lvars then [List.head idp] else []
+    | EFun(f,es) -> List.concat (List.map (get_expression_states lvars) es)
+    | EExternal(f,es) -> List.concat (List.map (get_expression_states lvars) es)
+    | EConstructor(t,fs) -> List.concat (List.map (fun (s,e)->get_expression_states lvars e) fs)
+    | EInt(i) -> [] | EBool(b) -> [] | EString(s) -> [] | EEnum(t,f)->[]
+  // rename_expr_id: for every EIdPath[a;b;c] turns it into EIdPath[a';b;c] if "renames" had the pair (a,a')
+  and rename_expr_id (renames:(string*string)list) (e:Expr) : Expr = match e.e with
+    | EVoid ->  e
+    | EIdPath(idp) -> (let nn = List.try_assoc (List.head idp) renames in match nn with None -> e
+        | Some nn -> {e with e=EIdPath(nn :: (List.tail idp))} )
+    | EFun(f,es) -> {e with e=EFun(f,List.map (rename_expr_id renames) es)}
+    | EExternal(f,es) -> {e with e=EExternal(f,List.map (rename_expr_id renames) es)}
+    | EConstructor(t,fs) -> {e with e=EConstructor(t,List.map (fun (s,e)->(s,rename_expr_id renames e)) fs)}
+    | EImportance(i,e) -> {e with e=EImportance(i,rename_expr_id renames e)}
+    | EInt(i) -> e | EBool(b) -> e | EString(s) -> e | EEnum(t,f)->e
+  and is_eidp (e:Expr) = match e.e with EIdPath(wire) -> true | _ -> false
+  and are_eidp (es:Expr list) = let nwes = List.filter (fun e -> not(is_eidp e)) es in List.length(nwes)=0
+  and wire_union_qmerge (t:Wire list list) : (Wire list) = let t = List.sortWith wire_compare_q (List.concat t) in wire_unique_qmerge t
+  // get_ndInWires: given a NData, returns a list of all wires that are mentioned in the NData expression.
+  and get_ndInWires (lvars:string list) (nd:NData) : (Wire list) = match nd with
+    | NExpr(e) -> get_etriggers lvars e
+    | NCall(peer,verb,nq,e) -> get_etriggers lvars e
+    | NCallreturn(e) -> get_etriggers lvars e
+    | NSet(idp,tail,e) -> get_etriggers lvars e
+    | NGet(idp,tail) -> []
+    | NAtomic(ad) -> []
+    | NFirst(fs) -> List.map (fun (s,tail)->(s,NBounded(1))) fs
+    | NSignal(e) -> get_etriggers lvars e
+    | NReturn(e) -> get_etriggers lvars e
+    | NIf(ifs) -> List.concat (List.map (fun (id:IfDat) -> List.concat [get_etriggers lvars id.ife; get_etriggers lvars id.thene]) ifs)
+    | NIfType(ifs) -> ((List.head ifs).ifv,NBounded(1)) :: (List.concat (List.map (fun (id:IfTypeDat) -> get_etriggers lvars id.tthene) ifs))
+  // get_etriggers: given an expression, the expression will include several EIdPath[a;b;c...],
+  // and this function returns the list of all such "a"s that aren't in the argument "lvars"
+  and get_etriggers (lvars:string list) (e:Expr) = match e.e with
+    | EBool(_) -> [] | EInt(_) -> [] | EString(_) -> [] | EVoid -> [] | EEnum(t,f)->[]
+    | EImportance(i,e) -> get_etriggers lvars e
+    | EFun(f,es) -> List.concat (List.map (get_etriggers lvars) es)
+    | EExternal(f,es) -> List.concat (List.map (get_etriggers lvars) es)
+    | EConstructor(cn,args) -> List.concat (List.map (fun (s,e) -> get_etriggers lvars e) args)
+    | EIdPath(idp) -> if List.mem (List.head idp) lvars then [] else [(List.head idp,NBounded(1))]
+  in
+  //
+  let anames = List.map (fun (a:Activity)->a.s) a in
+  let anames = List.sortWith Operators.compare anames in
+  let e = list_firstdup Operators.compare anames in
+  (match e with None -> () | Some(e) -> raise(new System.Exception("ERROR: two activities both named " + e + ".")) );
+  let a = List.map postparse_activity a in
+  let a = List.map postparse2_activity a in
+  {new Prog with tp=tp and ef=ef and a=a}
+
+
+
+  
+// CheckServicePorts: each activity declares what TypeList it can notify
+// (or has this empty if it has no notifications), and it declares a list of
+// Request/Response handlers with their input Type and output TypeList.
+// For "extern" activities this is all. But for the activities implemented
+// in the program there is more: there are handlers that receive notifications,
+// and there are "call" nodes.
+// For declarations, we merely check that each request/response handler within
+// an activity has a unique name/type combination (and types must be unique, not 0 or multi)
+// For extern activities, we check that there are no handlers and no state and no bodies of request/responses.
+// For handlers, we check that the peer they're listening to has been declared,
+// and that the type they're listening on is exactly one of the declared notify types
+// (not zero or many), and that no activity has two handlers for the same peer+type.
+// For call-nodes, we check that the peer+verb has been defined in the program.
+// (type-checking of input and output is left for later, as is fixing NCall(..nq).)
+let CheckServicePorts (p:Prog) =
+  let rec check_activity (a:Activity) =
+  ( System.Console.Out.WriteLine ("checkports: activity " + a.s + "\n");
+    // first, check the declarations: each request/response handler has unique name and unique input type
+    let hts = List.choose (fun ((hs,h):(string*Handler))->if h.rt=[] then None else Some(hs,h.at)) a.h in // all the req/resp handlers
+    let hts = List.sortWith (fun (s1,t1) (s2,t2) -> Operators.compare s1 s2) hts in
+    let e = list_firstdup (fun (hs1,ht1) (hs2,ht2) -> compare_compose [(Operators.compare hs1 hs2);(type_compare_unimp ht1 ht2)]) hts in
+    (match e with None->() | Some(hs,ht) -> raise (new System.Exception("ERROR: " + a.s + ".on " + hs + "(" + (type_to_string ht) + ") is defined twice")) );
+    System.Console.Out.WriteLine ("checkports: declarations okay\n");
+    // second, for extern activities, check that we have no handlers and no state
+    if (a.ext) then
+    ( let e = List.tryPick (fun ((hs,h):(string*Handler)) -> if h.rt=[] then Some(hs) else None) a.h in
+      (match e with None->() | Some(e)-> raise (new System.Exception("ERROR: extern handler " + a.s + ".on " + e + " defined; should be left abstract")) );
+      if (List.length(a.state)>0) then raise (new System.Exception("ERROR: extern activity " + a.s + " has state")) else ();
+      let e = List.tryPick (fun ((hs,h):(string*Handler)) -> if List.length(h.n)>0 then Some(hs) else None) a.h in
+      (match e with None->() | Some(e)-> raise (new System.Exception("ERROR: handler " + a.s + ".on " + e + " implemented; should be left abstract")) );
+      System.Console.Out.WriteLine ("checkports: extern okay\n");
+    );
+    // third, for implemented activities, check the handlers. (thanks to the above, the hts we construct will be empty for all extern activities)
+    let hts = List.choose (fun ((hs,h):(string*Handler))->if h.rt=[] then Some(hs,h.at) else None) a.h in // all the notify-handlers
+    let hts = List.sortWith (fun ((hs1,ht1):(string*Type)) ((hs2,ht2):(string*Type)) -> Operators.compare hs1 hs2) hts in
+    let e = list_firstdup (fun (hs1,ht1) (hs2,ht2) -> compare_compose [(Operators.compare hs1 hs2);(type_compare_unimp ht1 ht2)]) hts in
+    (match e with None->() | Some(hs,ht) -> raise (new System.Exception("ERROR: " + a.s + ".on " + hs + "(" + (type_to_string ht) + ") is defined twice.")) );
+    let is_notify_generated (aname:string) (t:Type) = (let a = try_activity_in_prog aname p in match a with None -> false | Some a -> tl_contains_imp a.signal t) in
+    let e = List.tryPick (fun (hs,ht) -> if (is_notify_generated hs ht) then None else Some(hs,ht)) hts in
+    (match e with None->() | Some(hs,ht)-> raise (new System.Exception("ERROR: " + a.s + ".on " + hs + "(" + (type_to_string ht) + ") will never be triggered.")) );
+    System.Console.Out.WriteLine ("checkports: handlers okay\n");
+    // fourth, check the call-nodes.
+    let n = List.concat (List.map (fun ((hs,h):(string*Handler))->h.n) a.h) in // gathers together every node in this activity
+    let n = List.choose (fun n -> match n.d with NCall(peer,verb,nq,e) -> Some(peer,verb,n) | _ -> None) n in // pick out the call nodes
+    let is_verb_declared peer verb = (let a = try_activity_in_prog peer p in match a with None->false | Some a -> List.exists (fun ((hs,h):(string*Handler))->hs=verb && List.length(h.rt)>0) a.h) in
+    let e = List.tryPick (fun (peer,verb,n) -> if (is_verb_declared peer verb) then None else Some(peer,verb,n)) n in
+    (match e with None->() | Some(peer,verb,n)-> raise (new System.Exception("ERROR: " + peer + "." + verb + " is invoked at line " + string(n.src) + " but not declared")) );
+    System.Console.Out.WriteLine ("checkports: call-nodes okay\n");
+    ()
+  )
+  //
+  in
+  List.iter check_activity p.a;
+  p
+    
+  
+
+// type_expr: given an expression and a type-environment, it returns
+// a modified version of that expression in which all typefields have been
+// filled in. (If there were any type-errors then it raises an exception).
+// Note: this function also populates the "important" field of the types
+// it fills in. For all constant expressions (void, int, bool, string, enum) it
+// says their importance equals the importance-parameter passed to the function.
+// For EIdPath, the importance is what EIdPath looks up in the environment.
+// For functions on arguments, the importance is the maximal importance of all their arguments.
+// Note: this function ignores+overwrites the existing type fields in the expr.
+let rec type_expr (tp:TDefPrim list) (ef:ExternFun list) (env:TypeEnv) (basei:Importance) (e:Expr) : Expr =
+  match e.e with
+  | EVoid -> {new Expr with e=EVoid and t=[("void",basei)]}
+  | EInt(i) -> {new Expr with e=EInt(i) and t=[("int",basei)]}
+  | EBool(b) -> {new Expr with e=EBool(b) and t=[("bool",basei)]}
+  | EString(s) -> {new Expr with e=EString(s) and t=[("string",basei)]}
+  | EEnum(t,f) -> {new Expr with e=EEnum(t,f) and t=[(t,basei)]}
+  | EImportance(i,sube) ->
+       let sube:Expr = type_expr tp ef env basei sube in
+       let subt:TypeList = List.map (fun (t,oldi)->(t,i)) sube.t in
+       {new Expr with e=EImportance(i,sube) and t=subt}
+  | EIdPath(idp) ->
+    ( // varname.field.subfield...: we look up varname in the environment, get its type
+      // and importance, then we drill down to find the types of its subfields
+      let v = (List.head idp) in
+      let tail = List.assoc v env in
+      if List.length(tail)=0 then raise(new System.Exception("ERROR: field access of nullary type"));
+      if List.length(idp)=1 then {new Expr with e=EIdPath(idp) and t=tail} else
+      ( if List.length(tail)>1 then raise(new System.Exception("ERROR: field access of non-unique type"));
+        let (t,i) = List.head tail in
+        let tsub = type_drill_record tp t (List.tail idp) in
+        match tsub with None -> raise(new System.Exception("ERROR: field access invalid in " + (idpath_to_string idp) + ".")) | Some tsub ->
+        let idp = (List.head idp)::(idp_drill_record tp t (List.tail idp)) in // convert subfields to integers
+        {new Expr with e=EIdPath(idp) and t=[(tsub,i)]}
+      )
+    )
+  | EFun (f,es) ->
+      // for functions, we check that the argument types are all unique and correct, and
+      // figure out from the function name what its return-type is. The importance of the
+      // result is the maximal importance of all args.
+      if (f="==" || f="!=") then
+      ( // equality/inequality is a special case: all types can be compared
+        let es = List.map (type_expr tp ef env basei) es in
+        match es with [e1;e2] ->
+        ( let isokay = (tl_is_unique e1.t) && (tl_is_unique e2.t) && ((type_compare_unimp (List.head e1.t) (List.head e2.t))=0) in
+          if (not isokay) then raise(new System.Exception("ERROR: (" + (expr_to_string e1) + ":" + (typelist_to_string e1.t) + ")" + f + "(" + (expr_to_string e2) + ":" + (typelist_to_string e2.t) + ") requires identical unique types"));
+          let i = imp_max ((imps_of_tl e1.t)@(imps_of_tl e2.t)) in
+          {new Expr with e=EFun(f,es) and t=[("bool",i)]}
+        ) | _ -> raise(new System.Exception("ERROR: " + f + " requires two arguments; not (" + (exprs_to_string es) + ")"));
+      )
+      else let (es,rt) = (type_fun tp ef env f es false basei) in {new Expr with e=EFun(f,es) and t=rt}
+    // for other functions (above) and external functions (below) we look up a table of
+    // possible functions.
+  | EExternal(f,es) -> let (es,rt) = (type_fun tp ef env f es true basei) in {new Expr with e=EExternal(f,es) and t=rt}
+  | EConstructor(tname,afes) ->
+      // for constructing a record, we make sure that all arguments are filled and all arguments
+      // are of the correct type; we return the record type tname. Importance is the maximal
+      // importance of all arguments.
+      // Implementation: make a mutable list for the remaining arguments, and for each constructor
+      // field look for an argument and remove it if it's there; if it's not there or is of the
+      // wrong type then raise an exception; if any arguments are left then raise an exception
+      let afes = List.map (fun ((f,e):(string*Expr))->(f,type_expr tp ef env basei e)) afes in // typed version of all field assignments
+      if List.exists (fun ((f,e):(string*Expr)) -> not (tl_is_unique e.t)) afes then raise(new System.Exception("ERROR: an argument is not unique"));
+      let afts = List.map (fun ((f,e):(string*Expr))->(f,List.head e.t)) afes in // pick out just the type of each argument
+      let is = List.map (fun (f,t) -> let (t,i)=t in i) afts in // the importances of all arguments
+      let afts = ref afts in // mutable list, as discussed above
+      let prim = List.try_assoc tname tp in (match prim with
+      | None -> raise(new System.Exception("ERROR: constructor " + tname + " not defined"))
+      | Some (TRecord(cfs)) ->
+        ( let check_field ((cf,ct):TField) = (
+            let at = List.try_assoc cf (!afts) in match at with None -> raise(new System.Exception("ERROR: field " + cf + " undefined")) | Some (at,ai) ->
+            if at<>ct then raise(new System.Exception("ERROR: field " + cf + " has type " + at + " but requires " + ct + "."));
+            afts := List.remove_assoc cf (!afts); () ) in
+          List.iter check_field cfs;
+          if List.length(!afts)>0 then raise(new System.Exception("ERROR: constructor " + tname + " has excess arguments"));
+          {new Expr with e=EConstructor(tname,afes) and t=[(tname,imp_max is)]}
+        )
+      | _ -> raise(new System.Exception("ERROR: " + tname + " is not a record-constructor")) )
+
+// type_fun: this routine, given set of argument expressions and a function-name, first
+// generates correct type-information in the arguments. Then finds a match based on
+// both function-name and argument-types (for operator-overloading) and, if it finds one,
+// returns the return-type. The return-importance is the maximum of all argument importances.
+// If there were any type-errors (e.g. functional match not found) then it raises an exception.
+// Note: each argument must have a unique type; not a "+" type.
+and type_fun tp ef env f (es:Expr list) (ext:bool) (basei:Importance) : (Expr list * TypeList) =
+   let builtins = [("+",["int";"int"],"int"); ("-",["int";"int"],"int"); ("*",["int";"int"],"int"); ("/",["int";"int"],"int");
+                   ("<",["int";"int"],"bool"); (">",["int";"int"],"bool"); ("<=",["int";"int"],"bool"); (">=",["int";"int"],"bool");
+                   ("&&",["bool";"bool"],"bool"); ("||",["bool";"bool"],"bool"); ("!",["bool"],"bool") ] in
+   let externals = List.map (fun ((f,ef):ExternFun)->(f,List.map (fun (s,t)->t) ef.ats,ef.rt)) ef in
+   let candidates = (if ext then externals else builtins) in
+   let es = List.map (type_expr tp ef env basei) es in
+   let i = imp_max (imps_of_es es) in
+   if List.exists (fun (e:Expr) -> not (tl_is_unique e.t)) es then raise(new System.Exception("ERROR: function " + f + "(" + (exprs_to_string es) + ") has an ambiguous argument"));
+   let ts = tnames_of_tl (tls_of_es es) in
+   let candidates = List.choose (fun (cf,cargs,cr) -> if cf=f && (list_eq cargs ts) then Some cr else None) candidates in
+   if List.length(candidates)=0 then raise(new System.Exception("ERROR: no match for function " + f + "(" + (exprs_to_string es) + ")"))
+   else if List.length(candidates)>1 then raise(new System.Exception("ERROR: ambiguous match for function " + f + "(" + (exprs_to_string es) + ")"))
+   else let cr=List.head candidates in
+   (es, [(cr,i)])
+
+
+
+// InferTypes: given a program that has been PostParsed and which has passed
+// CheckServicePorts (so all call nodes point to declared handlers), 
+// infers the rest of the types. Also checks for state-fields that initial-exprs match declared types
+// Also, compiles "idpath" expression to now refer to subfields by index, so they're
+// now of the form "wire.1.3.5". (This compilation requires us to know which type
+// the thing has.)
+// Also, fixes the "nq" field of NCall nodes
+// Also calculates importance of IfType branches
+// NB. This version of InferTypes goes through the nodes in sequence, and expects
+// all incoming wires to have been already defined. This prevents wire loops. However,
+// handler loops "activity test:T { on test(m:T) {signal m} }" are still allowed.
+let InferTypes (p:Prog) : Prog =
+   // infer_activity: just iterates through all handlers within the activity
+   let rec infer_activity (a:Activity) =
+      System.Console.Out.WriteLine ("infer: activity " + a.s + "\n");
+      {new Activity with state=List.map (infer_state a) a.state and h=List.map (infer_handler a) a.h and s=a.s and signal=a.signal and ext=a.ext}
+   // infer_state: calculates types of all initial-value expressions, and ensures that they match the declared types
+   and infer_state (a:Activity) ((s,e):(string*Expr)) : (string*Expr) =
+      System.Console.Out.WriteLine ("infer: state " + a.s + "." + s + "\n");
+      let t = e.t in
+      if not (tl_is_unique t) then raise(new System.Exception("ERROR: state variable " + a.s + "." + s + " declared with a non-unique type"));
+      let e = type_expr p.tp p.ef [] Unimportant e in
+      if not (tl_is_unique e.t) then raise(new System.Exception("ERROR: initial state " + a.s + "." + s + " evaluates to a non-unique type"));
+      if (type_compare_imp (List.head t) (List.head e.t))<>0 then raise(new System.Exception("ERROR: state variable " + a.s + "." + s + " declared with type " + (typelist_to_string t) + " but expr " + (expr_to_string e) + " has type " + (typelist_to_string e.t) + "."));
+      (s,e)
+   // infer_handler: sets up an environment with the initial message then iterates through all nodes within the handler
+   and infer_handler (a:Activity) ((hs,h):(string*Handler)) : (string*Handler) =
+     System.Console.Out.WriteLine ("infer: handler " + a.s + ".on " + hs + "(" + (type_to_string h.at) + ")\n");
+     let env:TypeEnv ref = ref [(h.a,[h.at])] in
+     (hs, {new Handler with n=List.map (infer_node env a (hs,h) h.n) h.n and a=h.a and at=h.at and aq=h.aq and outWires=h.outWires and rt=h.rt} )
+   // infer_node: does inference within the node data, then checks that the answer is
+   // what was declared, and updates the environment.
+   and infer_node (env:TypeEnv ref) (a:Activity) ((hs,h):(string*Handler)) (ns:Node list) (n:Node) : Node = 
+     // first figure out the base importance arising from the inwires
+     let intypes:TypeList = List.concat (List.choose (fun (w,wq)-> type_of_wire_in_handler w h) n.inWires) in
+     let inimps:Importance list = List.map (fun (t,i)->i) intypes in
+     let basei = imp_max inimps in 
+     // now infer the type of the node
+     let (t,d)=infer_ndata env a (hs,h) n basei n.d in
+     if n.t<>TUnk && n.t<>t then raise (new System.Exception("ERROR: Node " + a.s + "." + hs + "." + n.s + " is declared " + (typelist_to_string n.t) + " but inferred " + (typelist_to_string t)));
+     env := (n.s,t)::(!env);
+     let d = (match d with NIf(ifs) -> NIf(List.map (infer_ifdat env) ifs) | _ -> d) in
+     let n = {new Node with s=n.s and t=t and d=d and inWires=n.inWires and outWires=n.outWires and src=n.src} in
+     System.Console.Out.WriteLine ("infer: line " + string(n.src) + ": " + (node_to_string n) + "\n");
+     n
+   //
+   // type_of_wire: looks for a wire of this name in this handler; if it finds it, returns Some(typelist), otherwise None.
+   and type_of_wire_in_handler (s:string) (h:Handler) : TypeList option =
+      if h.a=s then Some [h.at] else List.tryPick (type_of_wire_in_node s) h.n
+   and type_of_wire_in_node (s:string) (n:Node) : TypeList option =
+      if n.s=s then Some n.t else (match n.d with
+      | NIf(ifs) -> List.tryPick (fun id -> if id.thens=s then Some(id.thent) else None) ifs
+      | NIfType(ifs) -> List.tryPick (fun id -> if id.tthens=s then Some(id.tthent) else None) ifs
+      | _ -> None )
+   //
+   and infer_ifdat (env:TypeEnv ref) (id:IfDat) : IfDat = 
+     if id.thent<>TUnk && id.thent<>id.thene.t then raise(new System.Exception("ERROR: conditional " + (ifdat_to_string id) + " is declared " + (typelist_to_string id.thent) + " but inferred " + (typelist_to_string id.thene.t) + "."));
+     if (id.thens<>"") then env := (id.thens,id.thene.t)::(!env);
+     {id with thent=id.thene.t}
+   and infer_ndata env a (s,h) n basei nd : (TypeList*NData) = match nd with
+     | NExpr(e) -> let e = type_expr p.tp p.ef (!env) basei e in (e.t,NExpr(e))
+     | NCall(peer,verb,nq,e) -> // thanks to CheckServicePorts, we know the peer+verb exist
+          let e = type_expr p.tp p.ef (!env) basei e in
+          if not (tl_is_unique e.t) then raise(new System.Exception("ERROR: argument " + (expr_to_string e) + " to " + peer + "." + verb + " is not uniquely typed"));
+          let t = List.head e.t in
+          let (a:Activity) = activity_in_prog peer p in
+          let (h:Handler) = handler_in_activity (verb,t) a in
+          if (type_compare_imp t h.at)<>0 then raise(new System.Exception("ERROR: argument " + (expr_to_string e) + " to " + peer + "." + verb + " has type " + (type_to_string t) + " but should be " + (type_to_string h.at) + "."));
+          (h.rt, NCall(peer,verb,h.aq,e)) // with h.aq we have fixed the NCall(nq) field.
+     | NCallreturn(e) ->
+          let e = type_expr p.tp p.ef (!env) basei e in (e.t,NCallreturn(e))
+     | NSet(idp,tail,e) -> 
+       (  let e = type_expr p.tp p.ef (!env) basei e in
+          if not (tl_is_unique e.t) then raise(new System.Exception("ERROR: attempt to SET " + a.s + "." + (idpath_to_string idp) + " := " + (expr_to_string e) + " but the expr has non-unique type"));
+          let state_name = List.head idp in
+          let state_t = (List.assoc state_name a.state).t in 
+          let (state_t,i) = List.head state_t in // by infer_state above, state_t is guaranteed to be unique
+          let state_t = type_drill_record p.tp state_t (List.tail idp) in // drill down to the type of the field we're setting
+          match state_t with None -> raise(new System.Exception("ERROR: subfields " + (idpath_to_string idp) + " not valid")) | Some state_t ->
+          if (type_compare_unimp (state_t,i) (List.head e.t))<>0 then raise(new System.Exception("ERROR: attempt to SET " + a.s + "." + (idpath_to_string idp) + ":" + (type_to_string (state_t,i)) + " with expr of type " + (typelist_to_string e.t) + "."));
+          (e.t, NSet(idp,e.t,e)) ) // we return the importance field of the input expr, not of the state.
+     | NAtomic(ad) -> // we ensure that ad.rw is a state-variable with type "readwrite"
+          let tail = List.try_assoc ad.rw a.state in
+          ( match tail with None -> raise(new System.Exception("ERROR: " + (atomic_to_string ad.m) + "(" + ad.rw + ") but " + ad.rw + " isn't a state-variable of type 'readwrite'"));
+          | Some tail -> let tail=tail.t in
+          if (not (tl_is_unique tail)) || (not (tl_contains_unimp tail ("readwrite",Unimportant))) then raise(new System.Exception("ERROR: " + (atomic_to_string ad.m) + "(" + ad.rw + ") must be done on a 'readwrite', not a " + (typelist_to_string tail) + "."));
+          ([("void",basei)], NAtomic(ad)) )
+     | NGet(s,tail) ->
+          let tail = (List.assoc s a.state).t in
+          (tail, NGet(s,tail))
+     | NFirst(ids) -> // we update the declared types of all ids, and our output is the union of them all
+          let get_wire_tl s = let e = {new Expr with e=EIdPath([s]) and t=TUnk} in let e = type_expr p.tp p.ef (!env) basei e in e.t in
+          let ids = List.map (fun (s,tail)->(s,get_wire_tl s)) ids in
+          let tls = List.map (fun (s,tail)->tail) ids in
+          let tail = tl_union (List.concat tls) in
+          (tail, NFirst(ids))
+     | NSignal(e) -> // we update the type, and check that type matches the declared output type of the activity
+          let e = type_expr p.tp p.ef (!env) basei e in 
+          if not (tl_is_unique e.t) then raise(new System.Exception("ERROR: attempt to signal a non-unique expr " + (expr_to_string e) + "."));
+          let t = List.head e.t in
+          if not (tl_contains_unimp a.signal t) then raise(new System.Exception("ERROR: signal " + (expr_to_string e) + " not an acceptable type for " + a.s + "." + (typelist_to_string a.signal) + "."));
+          ([], NSignal(e))  // empty return type; no one can follow
+     | NReturn(e) -> // we update the type, and check that the type matches declared output of handler
+          let e = type_expr p.tp p.ef (!env) basei e in
+          if not (tl_is_unique e.t) then raise(new System.Exception("ERROR: attempt to signal a non-unique expr " + (expr_to_string e) + "."));
+          let t = List.head e.t in
+          if not (tl_contains_unimp h.rt t) then raise(new System.Exception("ERROR: signal " + (expr_to_string e) + " not an acceptable type for " + a.s + "." + (typelist_to_string a.signal) + "."));
+          ([], NReturn(e)) // empty return type; no one can follow
+     | NIf(ifs) -> // we make sure that each "if" has boolean type. Then we figure the output types of the "thene" expressions.
+          let do_ifcond (id:IfDat) : IfDat =
+          ( let ife = type_expr p.tp p.ef (!env) basei id.ife in
+            if not (tl_is "bool" ife.t) then raise(new System.Exception("ERROR: if branch " + (expr_to_string ife) + " isn't boolean"));
+            let thene = type_expr p.tp p.ef (!env) basei id.thene in
+            {id with ife=ife; thene=thene}
+          ) in
+          let ifs = List.map do_ifcond ifs in
+          ([], NIf(ifs))
+     | NIfType(ifs) -> // we fix up the types. This involves importance-escallation if necessary
+          // for the ift-branches that have types, and "else" filling-in for the empty ift-branch,
+          // and checking that each one can be fulfilled. We keep a reference "tall" which initially
+          // lists all types that the input value can have, and which is whittled down. NB. by PostParse,
+          // there's guaranteed to be at least one "if" in the list, and all branches are guaranteed to
+          // have the same "ifv".
+          let ifv = (List.head ifs).ifv in 
+          let tall = List.try_assoc ifv (!env) in let tall = (match tall with Some(t)->t | None -> raise(new System.Exception("ERROR: iftype variable " + ifv + " not found")) )  in
+          let tall = ref tall in // reference to it, for whittling down
+          // we use this subfunction:
+          let do_iftype (id:IfTypeDat) : IfTypeDat = 
+           ( let ift = (if id.ift=[] then !tall else id.ift) in // the else-branch case
+             let notfounds = List.choose (fun t -> if tl_contains_unimp (!tall) t then None else Some(t)) ift in
+             if List.length(notfounds)>0 then raise(new System.Exception("ERROR: if (" + id.ifv + ":" + (typelist_to_string id.ift) + ") can never match " + (typelist_to_string notfounds) + "."));
+             // now escalate the typenames that the user wrote
+             let ift = List.map (fun (t,_) -> if tl_contains_imp (!tall) (t,Important) then (t,Important) else (t,Unimportant)) ift in
+             // and remove them
+             tall := List.choose (fun (t:Type) -> if tl_contains_unimp ift t then None else Some(t)) (!tall);
+             // now type the "thene" branch given this information
+             let localenv = (ifv,ift) :: (List.remove_assoc ifv (!env)) in
+             let tthene = type_expr p.tp p.ef localenv basei id.tthene in
+             {id with ift=ift; tthene=tthene}
+           )
+          in
+          let ifs = List.map do_iftype ifs in
+          ([], NIfType(ifs))
+   in
+   {new Prog with a=List.map infer_activity p.a and tp=p.tp and ef=p.ef}
+
+
+
+
+
+let reachability (form:Form) (p:Prog) (gprint:ProgState->bool->unit) =
+( // First, for convenience, make a flat list of all the signals we're going to exercise
+  let signals = List.concat (List.map (fun (a:Activity)->if a.ext then List.map (fun t->(a.s,t)) a.signal else []) p.a) in
+  // as we run we're going to log events in the profiler. The profiler will
+  // keep track of which states have been reached. So first we initiate it with
+  // the full set of state-assignments that we expect to reach.
+  // Here for convenience is the flat list of all states
+  let states:(string*TypeList)list = List.concat (List.map (fun (a:Activity)->List.map (fun ((s,e):State) -> a.s + "." + s,e.t) a.state) p.a) in
+  printf "%A" states;
+  let states:(string*TName)list = List.map (fun ((id,tail):(string*TypeList)) -> let (t,i)=List.head tail in (id,t)) states in
+  printf "%A" states;
+  let cover:(string*VPrim)list = List.concat (List.map (fun (id,t) -> allvprims_of_type p t id) states) in
+  System.Console.Out.WriteLine ("FULL COVERAGE REMAINING: " + (coverage_to_string cover) + "\n");
+  let cover = ref cover in // and that's the list of things that we have to cover
+  let profiler (prof:ProfileEvent) =
+  ( match prof with
+    | PStateSet(svold,svnew,dep) -> cover := remove_assignment_from_allvprims p (svnew.s.a + "." + svnew.s.s, svnew.v) (!cover);
+    | _ -> ()
+  ) in
+  // First we have to set as "covered" all the initial state assignments:
+  let rec sub_state (a:string) ((s,e):State) =
+  ( let v = Evaluate p.ef [] [] Unimportant e in
+    cover := remove_assignment_from_allvprims p (a + "." + s,v.v) (!cover);
+  )
+  in List.iter (fun (a:Activity) -> List.iter (sub_state a.s) a.state) p.a;
+  System.Console.Out.WriteLine ("COVERAGE REMAINING AFTER INIT: " + (coverage_to_string (!cover)) + "\n");
+  //
+  // Now we're going to go through that list. For each one, we start with
+  // an empty initial-state in which all state variables have been set to "Any".
+  // Then we insert an "Any" message and run through to completion. Once it's
+  // all done we look at the coverage.
+  let rec sub_signal ((a,t):(string*Type)) =
+  ( let ps = MakeInitialState p true in
+    let v = genericvalue_of_type p t in
+    let ps = insert p ps gprint a v in
+    explore "" p ps GMRemoveOrderingNondeterminism gprint (Some profiler); // runs through all possible execution traces
+  ) in
+  //
+  List.iter sub_signal signals;
+  let cover = !cover in
+  // Now we're going to print all the states of the system, some in red if they
+  // can't be reached.
+  let rtb = new RichTextBox() in
+  let rec msg_activity (a:Activity) =
+  ( if (not a.ext) then
+    ( rtb.SelectionColor <- Drawing.Color.Black;
+      rtb.AppendText("Activity " + a.s + "\r\n");
+      List.iter (msg_state a) a.state;
+      rtb.AppendText("\r\n");
+    )
+  )
+  and msg_state (a:Activity) ((s,e):State) =
+  ( let prefix = a.s + "." + s in let plen=String.length(prefix) in
+    let uncover = List.choose (fun (s,v) -> if String.length(s)>=plen && (String.sub s 0 plen)=prefix then Some(String.sub s plen (String.length(s)-plen),v) else None) cover in
+    if List.length(uncover)=0 then
+    ( rtb.SelectionColor <- Drawing.Color.Black;
+      rtb.AppendText("  " + s + " = " + (expr_to_string e) + "\r\n");
+    )
+    else
+    ( let uncover = List.map (fun (s,v)->if String.length(s)=0 then vprim_to_string v else "field" + s + "=" + (vprim_to_string v)) uncover in
+      let uncover = list_to_string ", " uncover in
+      rtb.SelectionColor <- Drawing.Color.Red;
+      rtb.AppendText("  " + s + " = " + (expr_to_string e));
+      rtb.AppendText("     // NEVER REACHES " + uncover + "\r\n");
+    )
+  ) in
+  List.iter msg_activity p.a;
+  // Now to display them.
+  let f = new Form() in
+  f.Owner <- form;
+  f.Size <- new Drawing.Size(800,500);
+  f.Text <- "States";
+  rtb.Dock <- DockStyle.Fill;
+  rtb.ReadOnly <- true;
+  f.Controls.Add(rtb);
+  let _ = f.ShowDialog() in
+  ()
+)
+
+// make_pairwise_combinations: given a list, returns a
+// new list with every pairwise combination. e.g. given
+// [1;2;3] it returns [(1,1);(1,2);(1,3);(2,2);(2,3);(3,3)]
+let rec make_pairwise_combinations (xs:'a list) : ('a*'a)list = match xs with [] -> []
+  | (x::xs) -> (List.map (fun y -> (x,y)) (x::xs) ) @ (make_pairwise_combinations xs)
+
+
+// Race detection.  
+let race (form:Form) (p:Prog) (gprint:ProgState->bool->unit) =
+( let rtb = new RichTextBox() in
+  //
+  let profiler (a:Activity) (sh1:string) (sh2:string) (scount:int ref) (prof:ProfileEvent) =
+  ( match prof with
+    | PStateSet(svold,svnew,dep) ->
+      ( let msg = sh1 + "--" + sh2 + ". set " + (if svold.i=Important then "important " else "") + svold.s.a + "." + svold.s.s + "#" + string(svold.s.seq) + " = " + (vprim_to_string svnew.v) + "#" + string(svnew.s.seq) + " " + (dep_to_string dep) in
+        let older_deps = List.choose (fun (dep:StateVersion)->if dep.a=svold.s.a && dep.s=svold.s.s && dep.seq<svold.s.seq then Some(dep) else None) dep in
+        if svold.i=Unimportant || List.length(older_deps)=0 then rtb.AppendText(msg + "\r\n") else
+        ( rtb.SelectionColor <- Drawing.Color.Red;
+          let important_set_n = somenode_to_string svold.s.n in
+          let overwrite_read_n = somenode_to_string (List.head older_deps).n in
+          let overwrite_write_n = somenode_to_string svnew.s.n in
+          rtb.AppendText(msg + "    // (1)read@" + overwrite_read_n + ", (2) imp.write@" + important_set_n + ", (3) overwrite@" + overwrite_write_n + "\r\n");
+          rtb.SelectionColor <- Drawing.Color.Black;
+        )
+      )
+    | PExplore(_) -> scount := (!scount)+1;
+    | _ -> ()
+  ) in
+  //
+  let rec race_activity (a:Activity) : unit = if not a.ext then
+  ( // construct a new program in which all but this activity are external
+    let activities = List.map (fun (a1:Activity)->if a1.s=a.s then a1 else {a1 with ext=true}) p.a in
+    let p1 = {new Prog with a=activities and ef=p.ef and tp=p.tp} in
+    // our task will be to try every pairwise combination of handlers.
+    // here, let's make a list of them
+    let hpairs = make_pairwise_combinations a.h in
+    List.iter (race_handler_pair p1 a) hpairs;
+  )
+  and race_handler_pair (p1:Prog) (a:Activity) (((sh1,h1),(sh2,h2)):((string*Handler)*(string*Handler))) : unit =
+  ( // We start the program with all variables set to "any" and all
+    // readwriters set to (0,0). This will give a maximal set of possible traces.
+    // And they really all are sensible traces (up to the limits of abstraction).
+    // To justify the "readwriters set to (0,0)", suppose they weren't. Then suppose
+    // some other activity finishes so that they reach (0,0). Then continue.
+    let (ps:ProgState) = MakeInitialState p1 true in // make it using "Anys" for the state-variables
+    let v1 = genericvalue_of_type p1 h1.at in 
+    let v2 = genericvalue_of_type p1 h2.at in
+    let mq = ps.mq in
+    let mq = queue_add_main [{new MainPort with a=a.s and h=sh1 and ht=h1.at and nq=NUnbounded}] (v1,IgnoreReturn) mq in
+    let mq = queue_add_main [{new MainPort with a=a.s and h=sh2 and ht=h2.at and nq=NUnbounded}] (v2,IgnoreReturn) mq in
+    let ps = {ps with mq=mq} in
+    // we're going to instantiate the two instances here. (we can't leave this
+    // until later, because that may generate different instance numbers according
+    // to when the ConsumeMove is done).
+    let scount = ref 0 in // count the states we explore
+    let moves = GenerateConsumeMoves ps GMRemoveAllNondeterminism in
+    let ps = PerformMove p ps (List.head moves) ("i" + sh1 + ".") (Some(profiler a sh1 sh2 scount)) in
+    let moves = GenerateConsumeMoves ps GMRemoveAllNondeterminism in
+    let ps = PerformMove p ps (List.head moves) ("i" + sh2 + ".") (Some(profiler a sh1 sh2 scount)) in
+    log ("** RACE " + sh1 + " vs " + sh2 + " **\n");
+    explore "" p1 ps GMRemoveInessentialNondeterminism gprint (Some (profiler a sh1 sh2 scount));
+    rtb.AppendText("RACE " + sh1 + " vs " + sh2 + ": explored " + string(!scount) + " states\n");
+  )
+  in
+  //
+  List.iter race_activity p.a;
+  // Now to display them.
+  let f = new Form() in
+  f.Owner <- form;
+  f.Size <- new Drawing.Size(800,500);
+  f.Text <- "States";
+  rtb.Dock <- DockStyle.Fill;
+  rtb.ReadOnly <- true;
+  f.Controls.Add(rtb);
+  let _ = f.ShowDialog() in
+  ()
+)
+
+
+
+// release detection -- is every handler guaranteed to release the locks it acquired?
+// The strategy here is to exercise each handler in complete isolation.
+// Start it off with (0,0) and check that it finishes with (0,0) for each of
+// its readwrites. Actually, it won't be in true isolation. That's because one
+// handler in the activity might call another handler in the same activity. 
+// And imagine what if one handler acquired the lock but then called another handler
+// which releases the lock. So, what we do is check only at each leaf of an explore tree.
+// The datastructure of reports is like "activity.handler:type -> [(rw1 at line16,(rcount,wcount));(rw2 at line12,(rcount,wcount));...]"
+let release (form:Form) (p:Prog) (gprint:ProgState->bool->unit) =
+( let reports:(string*((string*(int*int))list))list ref = ref [] in 
+  //
+  let profiler (label:string) (prof:ProfileEvent) =
+  ( match prof with
+    | PExploreEnd(ps) -> 
+      ( // let's pick out the readwrite states that we've ended with
+        let pick_rw (sv:StateValue) : (string*(int*int)) option = if sv.t<>"readwrite" then None else
+        ( let (rcount,rcountt) = drill_record_getvprim (sv.v,sv.t) ["0"] in // field-names have been compiled down to indexes
+          let (wcount,wcountt) = drill_record_getvprim (sv.v,sv.t) ["1"] in
+          let rcount = match rcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: rcount not an int")) in
+          let wcount = match wcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: wcount not an int")) in
+          let rwlabel = sv.s.a + "." + sv.s.s in
+          let rwlabel = (match sv.s.n with None->rwlabel | Some n -> rwlabel + "@line" + string(n.src) ) in
+          if rcount=0 && wcount=0 then None else Some (rwlabel, (rcount, wcount))
+        )
+        in
+        let readwrites = List.choose pick_rw ps.s in
+        // pick out the list of current maximums for each one
+        let labmaxes = List.try_assoc label (!reports) in 
+        let labmaxes = (match labmaxes with None -> [] | Some labmaxes -> labmaxes) in
+        let labmaxes = labmaxes @ readwrites in 
+        let labmaxes = List.sortWith (fun (rw1,_) (rw2,_) -> Operators.compare rw1 rw2) labmaxes in
+        let labmaxes = list_merge (fun (rw1,(cr1,cw1)) (rw2,(cr2,cw2)) -> if rw1<>rw2 then None else Some(rw1,(max cr1 cr2,max cw1 cw2))) labmaxes in
+        reports := (label,labmaxes) :: (List.remove_assoc label (!reports));         
+      )
+    | _ -> ()
+  ) in
+  //
+  let rec release_activity (a:Activity) : unit = if not a.ext then
+  ( // construct a new program in which all but this activity are external
+    let activities = List.map (fun (a1:Activity)->if a1.s=a.s then a1 else {a1 with ext=true}) p.a in
+    let p1 = {new Prog with a=activities and ef=p.ef and tp=p.tp} in
+    List.iter (release_handler p1 a) a.h;
+  )
+  and release_handler (p1:Prog) (a:Activity) ((sh,h):(string*Handler)) : unit =
+  ( let (ps:ProgState) = MakeInitialState p1 true in // make it using "Anys" for the state-variables
+    let v = genericvalue_of_type p1 h.at in
+    let mq = queue_add_main [{new MainPort with a=a.s and h=sh and ht=h.at and nq=h.aq}] (v,IgnoreReturn) ps.mq in
+    let ps = {ps with mq=mq} in
+    let label = a.s + "." + sh + ":" + (type_to_string h.at) in
+    explore "" p1 ps GMRemoveOrderingNondeterminism gprint (Some (profiler label));
+  )
+  in
+  //
+  List.iter release_activity p.a;
+  // Now to display them.
+  let rtb = new RichTextBox() in
+  let print_report (label, labmaxes) =
+  ( if List.length(labmaxes)=0 then rtb.AppendText(label + " -- all readwrites released.\r\n")
+    else
+    ( rtb.SelectionColor <- Drawing.Color.Red;
+      let labmaxes = List.map (fun (s,(rc,wc)) -> s + "(rcount=" + string(rc) + ",wcount=" + string(wc) + ")") labmaxes in
+      let labmaxes = list_to_string ", " labmaxes in
+      rtb.AppendText(label + " -- leaves unreleased " + labmaxes + "\r\n");
+      rtb.SelectionColor <- Drawing.Color.Black;
+    )
+  ) in
+  List.iter print_report (!reports);
+  let f = new Form() in
+  f.Owner <- form;
+  f.Size <- new Drawing.Size(800,500);
+  f.Text <- "Release";
+  rtb.Dock <- DockStyle.Fill;
+  rtb.ReadOnly <- true;
+  f.Controls.Add(rtb);
+  let _ = f.ShowDialog() in
+  ()
+)
+
+
+
+
+// Cycle detection -- this finds potentially deadlocking cycles.
+// It grossly overapproximates. That's because even the hint of inter-activity
+// cycles is bad design. More precisely, imagine a graph where each node N
+// corresponds to an (activity*handler*htype) triple. Draw a labelled edge
+// N -{rw1,rw2,...}-> N' if N does a CALL(N') while potentially holding lock rw1.
+// Also, write f(N)={rw1,rw2,...} for the set of all locks that N might acquire.
+// If ever we find a path such that N -rw1-> ... -> N' and rw1 is in f(N')
+// then this gives a warning. It means that while we hold a lock rw1, we go through
+// some set of calls which might attempt to lock rw1 again.
+// Implementation:
+// (1) Form the graph through analysis of the program. We don't do any simulation.
+// For calculating the -rw1-> edges, it's much like type-inference: the wires out
+// of a "begin rw1" node carry the "type" rw1=1, and the "type" is decremented upon
+// reaching "end rw1". That's how we tag edges. And the function f(N) is just by
+// examining the nodes flatly.
+// (2) Then we propogate the tags. Given N -rw1-> N' we add the mark (rw1,(0,N)) to N'.
+// That means that rw1 has travelled a total distance of 0 to reach us here, and the most
+// recent stop on the way was node N. If there are multiple routes into N' that would
+// propogate rw1 then we pick one of the ones with the shortest distance.
+// (3) If ever we get a node N where it has the thing marked through propogation, and
+// also present in f(N), then this is an error.
+// (4) For presenting the error message, we must list the starting N0 -rw1-> N1, and
+// the subsequent nodes N2, N3, N4, such that f(N4) includes rw1. That's easy. We've
+// found rw1 in f(N4) and also (rw1,(5,N3)) in marks(N4). So the trace we print will
+// finish in N3,N4. Keep following the trace back in this way until it reaches the
+// original edge. Actually, for better printouts, we should record each N with a
+// line number of where it's declared, and each -rw1-> edge with a line number where
+// the call is made, and each f(N)={rw1,rw2,...} with the line numbers where each one
+// comes from.
+// Optimization: 
+// Work with integer indexes for nodes, and for "rw"s.
+// CNode.f is sorted. So is CNode.marks.
+type CNodeIndex = int
+and  CRwIndex = int
+and  CLineNum = int
+and  CNode = {f:(CRwIndex*CLineNum) list; e:CEdge list; marks:CMark list}
+and  CEdge = {f:(CRwIndex*CLineNum) list; dst:CNodeIndex; n:Node}
+and  CMark = CRwIndex * (int*CNodeIndex*CLineNum)
+//
+let cmark_compare (crw1,_) (crw2,_) = compare crw1 crw2
+let cmark_merge_fun ((crw1,(d1,src1,line1)):CMark) ((crw2,(d2,src2,line2)):CMark) : CMark option =
+  if crw1<>crw2 then None else
+  if d1<d2 then Some(crw1,(d1,src1,line1)) else Some(crw1,(d2,src2,line2))
+let marks_merge (marks1:CMark list) (marks2:CMark list) : (CMark list * bool) =
+  let marks = List.sortWith cmark_compare (marks1 at marks2) in
+  let marks = list_merge cmark_merge_fun marks in
+  (marks, List.length(marks1)<>List.length(marks))
+//
+let cycle (form:Form) (p:Prog) (gprint:ProgState->bool->unit) =
+( //
+  // (some variables to accumulate the names of the nodes we'll build)
+  let node_names:string list ref = ref [] in
+  let rw_names:string list ref = ref [] in
+  // First we construct the graph nodes
+  let rec construct_activity (a:Activity) = (List.iter (construct_handler a) a.h; List.iter (construct_state a) a.state; )
+  and construct_state (a:Activity) ((s,e):State) = ( let (t,i)=List.head e.t in
+    if t="readwrite" then rw_names := (a.s + "." + s) :: (!rw_names); )
+  and construct_handler (a:Activity) ((hs,h):(string*Handler)) = ( node_names := (a.s + "." + hs + ":" + (type_to_string h.at)) :: (!node_names); ) in
+  // ... and tidy up the arrays we've just constructed.
+  List.iter construct_activity p.a;
+  let rw_names = List.mapi (fun i s -> (s,i)) (!rw_names) in
+  let node_names = List.mapi (fun i s -> (s,i)) (!node_names) in
+  let nnodes = List.length(node_names) in
+  let nodes:CNode[] = Array.create nnodes {new CNode with f=[] and e=[] and marks=[]} in
+  //
+  // Now trace through each handler to find which locks it acquires, and where,
+  // and which calls it makes while under which locks.
+  let profiler (src:CNodeIndex) (prof:ProfileEvent) =
+  ( match prof with
+    | PCall(ps,peer,verb,t,n) -> 
+      ( // let's pick out the readwrite states that we've ended with
+        let pick_rw (sv:StateValue) : (CRwIndex*CLineNum) option = if sv.t<>"readwrite" then None else
+        ( let (rcount,rcountt) = drill_record_getvprim (sv.v,sv.t) ["0"] in // field-names have been compiled down to indexes
+          let (wcount,wcountt) = drill_record_getvprim (sv.v,sv.t) ["1"] in
+          let rcount = match rcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: rcount not an int")) in
+          let wcount = match wcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: wcount not an int")) in
+          let rwlabel = List.assoc (sv.s.a + "." + sv.s.s) rw_names in
+          let rwlabel = (match sv.s.n with None->(rwlabel,-1) | Some n -> (rwlabel,n.src) ) in
+          if rcount>0 || wcount>0 then Some(rwlabel) else None
+        )
+        in
+        let readwrites = List.choose pick_rw ps.s in // has (CRwIndex*CLineNum) for every lock we held while making the call
+        let dst = List.assoc (peer + "." + verb + ":" + (type_to_string t)) node_names in
+        let cnode = nodes.[src] in
+        let cedges = {new CEdge with f=readwrites and dst=dst and n=n} :: cnode.e in
+        nodes.[src] <- {cnode with e=cedges};
+      )
+    | PAtomic(a,s,mode,rcount,wcount,n) -> if mode=BeginRead || mode=BeginWrite then
+      ( let rwlabel = (List.assoc (a + "." + s) rw_names, n.src) in
+        let cnode = nodes.[src] in
+        let cf = rwlabel :: cnode.f in
+        nodes.[src] <- {new CNode with f=cf and e=cnode.e and marks=cnode.marks};
+      )
+    | _ -> ()
+  ) in
+  //
+  let rec findlock_activity (a:Activity) : unit = if not a.ext then
+  ( // construct a new program in which all but this activity are external
+    let activities = List.map (fun (a1:Activity)->if a1.s=a.s then a1 else {a1 with ext=true}) p.a in
+    let p1 = {new Prog with a=activities and ef=p.ef and tp=p.tp} in
+    List.iter (findlock_handler p1 a) a.h;
+  )
+  and findlock_handler (p1:Prog) (a:Activity) ((hs,h):(string*Handler)) : unit =
+  ( let (ps:ProgState) = MakeInitialState p1 true in // make it using "Anys" for the state-variables
+    let v = genericvalue_of_type p1 h.at in
+    let mq = queue_add_main [{new MainPort with a=a.s and h=hs and ht=h.at and nq=h.aq}] (v,IgnoreReturn) ps.mq in
+    let ps = {ps with mq=mq} in
+    let label = List.assoc (a.s + "." + hs + ":" + (type_to_string h.at)) node_names in
+    explore "" p1 ps GMRemoveOrderingNondeterminism gprint (Some (profiler label));
+    // That has built up the labelled-edges out of each node, and the f() on each node
+  )
+  in
+  List.iter findlock_activity p.a;
+  //
+  // Now propogate the marks
+  let workqueue:CNodeIndex list ref = ref [] in
+  // first stick in the edges
+  let rec mark_initial ((s,src):(string*CNodeIndex)) = List.iter (mark_initial_edge src) nodes.[src].e
+  and mark_initial_edge (src:CNodeIndex) (e:CEdge) =
+  ( let newmarks = List.map (fun (frw,line) -> (frw,(0,src,line))) e.f in
+    let cnode = nodes.[e.dst] in
+    let (marks,changed) = marks_merge cnode.marks newmarks in
+    if changed then ( nodes.[e.dst] <- {cnode with marks=marks}; workqueue := e.dst :: (!workqueue); )
+  ) in
+  List.iter mark_initial node_names;
+  //
+  while List.length(!workqueue)>0 do
+  ( let src:CNodeIndex = List.head (!workqueue) in
+    workqueue := List.tail (!workqueue);
+    let cnode_src = nodes.[src] in
+    let newmarks = cnode_src.marks in
+    let mark_subsequent_edge (newmarks:CMark list) (src:CNodeIndex) (e:CEdge) =
+    ( let cnode_dst = nodes.[e.dst] in
+      let (marks,changed) = marks_merge cnode_dst.marks newmarks in
+      if changed then ( nodes.[e.dst] <- {cnode_dst with marks=marks}; workqueue := e.dst :: (!workqueue); )
+    ) in
+    List.iter (mark_subsequent_edge newmarks src) cnode_src.e;
+    workqueue := list_makeunique (List.sortWith compare (!workqueue)); // in case we'd put in duplicates
+  )
+  done;
+  //
+  // Now look for any nodes which have an rw listed in both marks and f
+  let badmarks : (CNodeIndex*CRwIndex*(int*CNodeIndex*CLineNum)*CLineNum) list ref = ref [] in
+  let bad_node ((s,n):(string*CNodeIndex)) =
+  ( let cnode = nodes.[n] in
+    let f = List.sortWith (fun (rw1,_) (rw2,_) -> compare rw1 rw2) cnode.f in
+    let marks = List.sortWith (fun (rw1,_) (rw2,_) -> compare rw1 rw2) cnode.marks in
+    let mergefun (rw1,line) (rw2,mark) = let c = compare rw1 rw2 in
+      if c<>0 then (c,None) else (c,Some(n,rw1,mark,line)) in
+    let bads = list_intersect mergefun f marks in
+    List.iter (fun b -> badmarks := b :: (!badmarks) ) bads;
+  ) in
+  List.iter bad_node node_names;
+  let badmarks = !badmarks in
+  // 
+  // Now trace back all those paths
+  let rec trace (rw:CRwIndex) ((i,n,line):(int*CNodeIndex*CLineNum)) : (CNodeIndex list) = if i=0 then [n] else
+  ( let cnode = nodes.[n] in
+    let mark = List.assoc rw cnode.marks in
+    n :: (trace rw mark)
+  ) in
+  let badmarks = List.map (fun (n,rw,(marki,markn,markline),line) -> (n,rw,markline,trace rw (marki,markn,markline),line)) badmarks in
+  //
+  // Now print an error message
+  let rtb = new RichTextBox() in
+  let print_report ((n,rw,linecall,mark,linelock):(CNodeIndex*CRwIndex*CLineNum*(CNodeIndex list)*CLineNum)) =
+  ( // handler n makes call-chain "mark" from linecall while holding lock rw, but comes back to linelock/rw
+    let (n,_) = List.nth node_names n in
+    let (rw,_) = List.nth rw_names rw in
+    let mark = List.map (fun n -> let (n,_) = List.nth node_names n in n) mark in
+    let mark = list_to_string ", " mark in
+    let linelock = string(linelock) in
+    let linecall = string(linecall) in
+    let msg = "@line" + linecall + " we acquire a lock on " + rw + ", and then do the callstack " + mark + ". But this winds up at " + n + "@line" + linelock + " which tries to lock " + rw + " again\r\n" in
+    rtb.SelectionColor <- Drawing.Color.Red;
+    rtb.AppendText(msg);
+    rtb.SelectionColor <- Drawing.Color.Black;
+  ) in
+  List.iter print_report badmarks;
+  if List.length(badmarks)=0 then rtb.AppendText("No circle problems detected.");
+  let f = new Form() in
+  f.Owner <- form;
+  f.Size <- new Drawing.Size(800,500);
+  f.Text <- "Release";
+  rtb.Dock <- DockStyle.Fill;
+  rtb.ReadOnly <- true;
+  f.Controls.Add(rtb);
+  let _ = f.ShowDialog() in
+  ()
+)
diff --git a/tests/fsharp/regression/lucian-standalone-bug/ast.fs b/tests/fsharp/regression/lucian-standalone-bug/ast.fs
new file mode 100644
index 0000000..0ce7db9
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/ast.fs
@@ -0,0 +1,234 @@
+#indent "off"
+
+module Ast
+
+open Utils
+
+// Types are references through typename.
+// Primitive types - ints, enums, classes whose fields are other primitive types.
+// The references "bool"->TBool, "int"->TInt, "string"->TString are built in, and
+// all other primitive type definitions are done by the user with class/enum declarations
+// Choice types - a union of (distinct) primitive types, referred to by name, eg. int+string
+// Each one has an "important" flag to indicate whether it's bad for messages of that type
+// to be lost. When evaluating an expression, the importance of the expression comes from
+// the importance of the things that make it up. As for constants (bools, ints, ...),
+// their importance equals the maximal importance of all the wires going into the node
+type TName = string
+and  TPrim = TVoid | TBool | TInt | TString | TRecord of TField list | TEnum of string list
+and  TField = string*TName
+and  TDefPrim  = TName * TPrim // e.g. "int"=TInt, "TFred"=TRecord(field1:int, field2:string)
+and  TDefChoice = TName * TypeList // e.g. "TJones = T1 + (T2 important)
+and  Importance = Important | Unimportant
+and  Type = TName * Importance // where TName is the name of some primitive
+and  TypeList = Type list
+// In the code for activities, once types have been resolved, every "Type list" lists only primitive typenames;
+// the choice-typenames have been resolved away.
+let  TUnk:TypeList = [("?",Unimportant)]
+type ExternFunDat = {ats:(string*TName) list; rt:TName} // argument types and return type
+type ExternFun = string*ExternFunDat // string is the function-name
+type TypeEnv = (string*TypeList)list
+
+
+type Activity = {s:string; state:State list; signal:TypeList; h:(string*Handler) list; ext:bool}
+and  State = string*Expr // string is the varname; expr is the initial value; expr.t is its type
+and  Handler = {a:string; at:Type; aq:NQueue; outWires:Wire list; rt:TypeList; n:Node list} // if t is empty, then it has no return value; otherwise the return value is the choice of all these t's
+and  NData = NExpr of Expr | NCall of string*string*NQueue*Expr | NCallreturn of Expr | NSet of IdPath*TypeList * Expr | NGet of string*TypeList
+           | NFirst of (string*TypeList) list | NSignal of Expr | NReturn of Expr
+           | NIf of IfDat list // the "t/outWires" fields of an NIf node are to be empty; that stuff is contained in the IfDat expressions
+           | NIfType of IfTypeDat list // likewise
+           | NAtomic of AtomicDat // for begin/end of read/write.
+and  NQueue = NUnbounded | NBounded of int
+and  Node = {s:string; t:TypeList; d:NData; inWires:Wire list; outWires:Wire list; src:int}
+and  Wire = string*NQueue
+and  IdPath = string list // e.g. "value.field.subfield"
+and  Expr = {e:ExprDat; t:TypeList}
+and  ExprDat = EVoid | EIdPath of IdPath | EFun of string * Expr list | EExternal of string * Expr list
+          | EConstructor of TName * (string*Expr) list
+          | EInt of int | EBool of bool | EString of string | EEnum of TName*string
+          | EImportance of Importance*Expr
+and  IfDat = {ife:Expr; thens:string; thent:TypeList; thene:Expr; thenOutWires:Wire list}
+and  IfTypeDat = {ifv:string; ift:TypeList; tthens:string; tthent:TypeList; tthene:Expr; tthenOutWires:Wire list}
+and  AtomicMode = BeginRead | EndRead | BeginWrite | EndWrite
+and  AtomicDat = {m:AtomicMode; rw:string}
+type Prog = {tp:TDefPrim list; ef:ExternFun list; a:Activity list}
+
+
+
+let rec type_compare_unimp (n1,imp1) (n2,imp2) = Operators.compare n1 n2
+and type_compare_imp (n1,imp1) (n2,imp2) = let c = Operators.compare n1 n2 in if c<>0 then c else imp_compare imp1 imp2
+and tl_is n1 tail = match tail with [(n2,i2)]->(n1=n2) | _ -> false
+and tl_isnt n1 tail = not (tl_is n1 tail)
+and tl_contains_imp (tail:TypeList) (t2:Type) = List.exists (fun t1 -> (type_compare_imp t1 t2)=0) tail
+and tl_contains_unimp (tail:TypeList) (t2:Type) = List.exists (fun t1 -> (type_compare_unimp t1 t2)=0) tail
+and imp_compare imp1 imp2 = if imp1=imp2 then 0 else if imp1=Unimportant then -1 else 1
+and imp_max imps = match imps with [] -> Unimportant | (i::imps) -> if i=Important then Important else imp_max imps
+//
+let tls_of_es (es:Expr list) = List.concat (List.map (fun (e:Expr)->e.t) es)
+let imps_of_tl (tail:TypeList) = List.map (fun (t,i)->i) tail
+let imps_of_es (es:Expr list) = imps_of_tl (tls_of_es es)
+let rec list_eq (xs) (ys) = match (xs,ys) with ([],[]) -> true | (x::xs,y::ys) -> (x=y && (list_eq xs ys)) | _ -> false
+let tnames_of_tl (tail:TypeList) = List.map (fun (t,i)->t) tail
+let tl_is_unique (tail:TypeList) = List.length(tail)=1
+let activity_in_prog (aname:string) (p:Prog) = List.find (fun (a:Activity) -> a.s=aname) p.a
+let try_activity_in_prog (aname:string) (p:Prog) = List.tryFind (fun (a:Activity) -> a.s=aname) p.a
+let handler_in_activity ((verb,t):(string*Type)) (a:Activity) : Handler = let (hs,h) = List.find (fun (hs,h) -> hs=verb && (type_compare_imp h.at t)=0) a.h in h
+let node_in_handler (ns:string) (h:Handler) = List.find (fun (n:Node) -> n.s=ns) h.n
+//
+let rgen = new System.Random()
+let randb() = if (rgen.Next(0,2) = 0) then false else true
+let randi() = rgen.Next(0,20)
+let rands() = let ss = ["fred";"bert";"arnie";"wooster";"wilbur";"navel";"grapefruit";"giraffe";"melon";"chair";"happy";"microsoft";"bender";"fry";"bjork";"carcinogen"] in List.nth ss (rgen.Next(0,List.length(ss)))
+
+
+
+// type_drill_record: given a starting typename, and an idlist from it, drills down
+let rec type_drill_record (tp:TDefPrim list) (t:TName) (idp:IdPath) : TName option =
+  match idp with [] -> Some(t) | id::idp -> 
+  let prim = List.try_assoc t tp in match prim with None -> None | Some prim ->
+  match prim with
+  | TRecord(fs) ->
+    (  let tf = List.try_assoc id fs in match tf with None -> None | Some tf ->
+       type_drill_record tp tf idp )
+  | _ -> None
+// idp_drill_record: given an field-referencing idpath, compiles it into an integer/index-referencing idpath
+let rec idp_drill_record tp t idp : IdPath = match idp with [] -> [] | id::idp ->
+  match (List.assoc t tp) with
+  | TRecord(fs) ->
+    (  let i = list_assoc_index_of fs id in
+       let tf = List.assoc id fs in
+       (string(i)) :: (idp_drill_record tp tf idp) )
+  | _ -> raise (new System.Exception("ERROR: accessing field "^id^" of type "^t^" which isn't a record"))
+
+   
+
+ 
+
+let rec type_exemplar (tp:TDefPrim list) ((tname,i):Type) =
+  let i = (if i=Important then "important " else "") in
+  let t = List.try_assoc tname tp in
+  match t with
+  | None -> "(type "^tname^" not found)"
+  | Some(TVoid) -> i^"void"
+  | Some(TBool) -> if randb() then i^"true" else i^"false"
+  | Some(TInt) -> i^string(randi())
+  | Some(TString) -> i^rands()
+  | Some(TEnum(ss)) -> i^tname^"."^(List.nth ss (rgen.Next(0,List.length(ss))))
+  | Some(TRecord(fs)) ->
+      let fs = List.map (fun (s,tname)->s^"="^(type_exemplar tp (tname,Unimportant))) fs in
+      let fs = list_to_string ", " fs in
+      i^"new "^tname^"("^fs^")"
+
+
+let rec wire_compare_q ((s1,q1):Wire) ((s2,q2):Wire) = let c=Operators.compare s1 s2 in if c<>0 then c else queue_compare q1 q2
+and queue_compare q1 q2 = match (q1,q2) with
+  | (NUnbounded,NUnbounded) -> 0
+  | (NUnbounded,_) -> 1
+  | (_,NUnbounded) -> -1
+  | (NBounded(i1),NBounded(i2)) -> compare i1 i2
+and queue_max q = match q with [] -> raise (new System.Exception("max of empty queue list"))
+  | [q1] -> q1
+  | (NBounded(i1))::(NBounded(i2))::q -> if i1>i2 then queue_max ((NBounded(i1))::q) else queue_max ((NBounded(i2))::q)
+  | q1::q2::q -> NUnbounded
+and queue_min q = match q with [] -> raise (new System.Exception("min of empty queue list"))
+  | [q1] -> q1
+  | (NBounded(i1))::(NBounded(i2))::q -> if i1<i2 then queue_min ((NBounded(i1))::q) else queue_max ((NBounded(i2))::q)
+  | b::NUnbounded::q -> queue_min (b::q)
+  | NUnbounded::b::q -> queue_min (b::q)
+and wire_unique_qmerge (t:Wire list) : (Wire list) = match t with [] -> [] | [t]->[t]
+  | ((s1,q1)::(s2,q2)::t) -> let r = wire_unique_qmerge ((s2,queue_max [q1;q2])::t) in
+    if s1=s2 then r else (s1,q1)::r
+
+
+let rec tdefprim_to_string (n,t) = match t with
+  | TRecord(fs) -> let fs = List.map (fun (s,t) -> t^" "^s) fs in
+                "class "^n^" {"^(list_to_string ";" fs)^"}"
+  | TEnum(e) -> "enum "^n^" {"^(list_to_string "," e)^"}"
+  | TBool -> "type "^n^" = System.Bool"
+  | TInt -> "type "^n^" = System.Int"
+  | TString -> "type "^n^" = System.String"
+  | TVoid ->  "type "^n^" = void"
+and tdefchoice_to_string (n,ts) = "type "^n^" = "^(typelist_to_string ts)
+and type_to_string (t,i) = match i with Important -> "important "^t | Unimportant -> t
+and typelist_to_string ts = if ts=TUnk then "" else list_to_string " + " (List.map type_to_string ts)
+and tdefprims_to_string tp = let s = list_to_string "\n" (List.map tdefprim_to_string tp) in if s="" then "" else s^"\n\n"
+and tdefchoices_to_string tc = let s = list_to_string "\n" (List.map tdefchoice_to_string tc) in if s="" then "" else s^"\n"
+and externfuns_to_string ef = let s = list_to_string "\n" (List.map externfun_to_string ef) in if s="" then "" else s^"\n\n"
+and externfun_to_string (f,ef) = "extern "^f^"("^(list_to_string "," (List.map externfunarg_to_string ef.ats))^"):"^ef.rt
+and externfunarg_to_string (s,t) = if s="_" then t else t^" "^s
+and importance_to_string i = match i with Important -> "important" | Unimportant -> "unimportant"
+
+let rec expr_to_string e = match e.e with
+  | EVoid -> ""
+  | EIdPath(idp) -> idpath_to_string idp
+  | EFun(f,es) -> f^"("^(exprs_to_string es)^")"
+  | EConstructor(t,fs) -> "new "^t^"("^(fieldexprs_to_string fs)^")"
+  | EInt(i) -> string(i)
+  | EBool(b) -> if b then "true" else "false"
+  | EString(s) -> "\""^s^"\""
+  | EExternal(f,es) -> "external "^f^"("^(exprs_to_string es)^")"
+  | EEnum(t,f) -> t^"."^f
+  | EImportance(i,e) -> (importance_to_string i)^" "^(expr_to_string e)
+and fieldexpr_to_string (s,e) = s^"="^(expr_to_string e)
+and fieldexprs_to_string fs = list_to_string ", " (List.map fieldexpr_to_string fs)
+and exprs_to_string es = list_to_string "," (List.map expr_to_string es)
+and idpath_to_string idp = list_to_string "." idp
+
+let rec node_to_string n = match n.d with
+  | NExpr(e) -> (nassign_to_string n)^(expr_to_string e)^(nwires_to_string n.outWires)
+  | NCall(peer,verb,nq,e) -> (nassign_to_string n)^"call "^peer^"."^verb^"("^(expr_to_string e)^")"^(nwires_to_string n.outWires)
+  | NCallreturn(e) -> (nassign_to_string n)^"callret("^(expr_to_string e)^")"^(nwires_to_string n.outWires)
+  | NSet(idp,t,e) -> (nassign_to_string n)^"SET "^(idpath_to_string idp)^":="^(expr_to_string e)^(nwires_to_string n.outWires)
+  | NGet(s,t) -> (nassign_to_string n)^"GET s"^(nwires_to_string n.outWires)
+  | NFirst(ids) -> (nassign_to_string n)^"first("^(list_to_string "," (List.map fst ids))^")"^(nwires_to_string n.outWires)
+  | NSignal(e) -> (nassign_to_string n)^"signal "^(expr_to_string e)^(nwires_to_string n.outWires)
+  | NReturn(e) -> (nassign_to_string n)^"return "^(expr_to_string e)^(nwires_to_string n.outWires)
+  | NIf(cs) -> (nassign_to_string n)^"if "^(ifdats_to_string cs)^(nwires_to_string n.outWires)
+  | NIfType(ifs) -> (nassign_to_string n)^"if "^(iftypedats_to_string ifs)^(nwires_to_string n.outWires)
+  | NAtomic(ad) -> (nassign_to_string n)^(atomic_to_string ad.m)^"("^ad.rw^")"^(nwires_to_string n.outWires)
+and nassign_to_string n =
+  let t = typelist_to_string n.t in let t = (if t="" then "" else t^" ") in
+  let s = if n.s="" then "" else t^n.s^" = " in
+  s^(wires_to_string n.inWires)
+and nwires_to_string (ws:Wire list) = let s = wires_to_string ws in
+  if s="" then "" else " -> "^s
+and atomic_to_string (m:AtomicMode) = match m with BeginRead -> "begin_read" | EndRead -> "end_read" | BeginWrite -> "begin_write" | EndWrite -> "end_write"
+and ifdat_to_string (id:IfDat) = 
+  let t = typelist_to_string id.thent in let t = (if t="" then "" else t^" ") in
+  let s = if id.thens="" then "" else t^id.thens^" = " in
+  "("^(expr_to_string id.ife)^") then "^s^(expr_to_string id.thene)^(nwires_to_string id.thenOutWires)
+and ifdats_to_string cs = list_to_string " else if " (List.map ifdat_to_string cs)
+and iftypedat_to_string (id:IfTypeDat) =
+  let t = typelist_to_string id.tthent in let t = (if t="" then "" else t^" ") in
+  let s = if id.tthens="" then "" else t^id.tthens^" = " in
+  "("^id.ifv^":"^(typelist_to_string id.ift)^") then "^s^(expr_to_string id.tthene)^(nwires_to_string id.tthenOutWires)
+and iftypedats_to_string ifs = list_to_string " else if " (List.map iftypedat_to_string ifs)   
+and wires_to_string ws = if List.length(ws)=0 then "" else "{"^(list_to_string "," (List.map wire_to_string ws))^"} "
+and wire_to_string (s,q) = match q with NUnbounded -> "*"^s | NBounded(i) -> if i=1 then s else "["^string(i)^"]"^s
+and nodes_to_string ns = let s = list_to_string "\n    " (List.map node_to_string ns) in if s="" then "" else s^"\n"
+
+let rec activity_to_string (a:Activity) = 
+  let states = (astates_to_string a.state) in 
+  let states = (if states="" then "" else states^"\n") in
+  let signal = (typelist_to_string a.signal) in 
+  let signal = (if signal="" then "" else " : "^signal) in
+  "activity "^a.s^signal^" {\n" ^ states ^(ahandlers_to_string a.h)^"}\n"
+and astate_to_string (s,e) = "  "^(typelist_to_string e.t)^" "^s^" = "^(expr_to_string e)^"\n"
+and astates_to_string states = list_to_string "" (List.map astate_to_string states)
+and ahandler_to_string ((s,h):(string*Handler)) = 
+  let rtype = if List.length(h.rt)=0 then "" else ":"^(typelist_to_string h.rt) in
+  let outWires = wires_to_string h.outWires in
+  let outWires = (if outWires="" then "" else " -> "^outWires) in
+  "  on "^s^"("^(type_to_string h.at)^" "^h.a^outWires^")"^rtype^" {\n    "^(nodes_to_string h.n)^"  }\n" 
+and ahandlers_to_string h = list_to_string "\n" (List.map ahandler_to_string h)
+and activities_to_string a = list_to_string "\n" (List.map activity_to_string a)
+
+let rec typeenv_to_string (env:TypeEnv) = "[" ^ (list_to_string "," (List.map typeenvv_to_string env)) ^ "]"
+and typeenvv_to_string (s,tail) = s^":"^(typelist_to_string tail)
+
+
+let rec prog_to_string (p:Prog) = (tdefprims_to_string p.tp) ^ (externfuns_to_string p.ef) ^ (activities_to_string p.a)
+
+
+
+
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/build.bat b/tests/fsharp/regression/lucian-standalone-bug/build.bat
new file mode 100644
index 0000000..e7d44a7
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/build.bat
@@ -0,0 +1,28 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+call %~d0%~p0..\..\..\config.bat
+
+IF EXIST ..\..\samples\dont.use.standalone (
+  "%FSC%" -g -r:AsmL.Tools.Algos.SA.dll -r:Microsoft.GLEE.GraphHelper.dll -r:Microsoft.GLEE.dll -r:Microsoft.GLEE.Drawing.dll -r:Microsoft.GLEE.GraphViewerGDI.dll -r:Microsoft.GLEE.IGraphViewer.dll -r:Microsoft.GLEE.Splines.dll -r:AsmL.Tools.Algos.SimplexMethod.dll -r:AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll -o:checkmri.exe prim-lexing.fs prim-parsing.fs lexing.fs parsing.fs HashMultiMap.fs HashSet.fs TaggedHash.fs hashtbl.fs utils.fs ast.fs pars.fs lex.fs states.fs analysis.fs test. [...]
+) ELSE (
+  "%FSC%" --standalone -g -r:AsmL.Tools.Algos.SA.dll -r:Microsoft.GLEE.GraphHelper.dll -r:Microsoft.GLEE.dll -r:Microsoft.GLEE.Drawing.dll -r:Microsoft.GLEE.GraphViewerGDI.dll -r:Microsoft.GLEE.IGraphViewer.dll -r:Microsoft.GLEE.Splines.dll -r:AsmL.Tools.Algos.SimplexMethod.dll -r:AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll -o:checkmri.exe prim-lexing.fs prim-parsing.fs lexing.fs parsing.fs HashMultiMap.fs HashSet.fs TaggedHash.fs hashtbl.fs utils.fs ast.fs pars.fs lex.fs states.fs anal [...]
+)
+if ERRORLEVEL 1 goto Error  
+  
+"%PEVERIFY%" checkmri.exe
+if ERRORLEVEL 1 goto Error  
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/lucian-standalone-bug/checkmri.doc b/tests/fsharp/regression/lucian-standalone-bug/checkmri.doc
new file mode 100644
index 0000000..eb7f3cb
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/checkmri.doc differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/checkmri.fs b/tests/fsharp/regression/lucian-standalone-bug/checkmri.fs
new file mode 100644
index 0000000..b1a56f6
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/checkmri.fs
@@ -0,0 +1,279 @@
+#indent "off"
+
+open System
+open System.Windows.Forms
+open Ast
+open Utils
+open States
+open Analysis
+
+[<STAThread>] do ()
+
+
+let argv = System.Environment.GetCommandLineArgs()
+
+let print_graph (p:Prog) (gv:Microsoft.GLEE.GraphViewerGDI.GViewer list) = if gv=[] then () else
+( let g = new Microsoft.GLEE.Drawing.Graph("graph") in
+  //
+  let rec sub_activity (a:Activity) = List.iter (sub_handler a) a.h
+  and sub_handler (a:Activity) ((hs,h):(string*Handler)) =
+  ( let prefix = a.s^"."^hs^":"^(type_to_string h.at)^"." in
+    let node = g.AddNode(prefix^h.a) :?> Microsoft.GLEE.Drawing.Node in
+    node.Attr.Fillcolor <- Microsoft.GLEE.IGraphViewer.Color.Aqua;
+    node.Attr.Label <- a.s^"."^hs^":"^(type_to_string h.at);
+    let edge = g.AddEdge(prefix^h.a, prefix^h.a) :?> Microsoft.GLEE.Drawing.Edge in
+    edge.Attr.Color <- Microsoft.GLEE.IGraphViewer.Color.White; // invisible, just to make sure the node is rendered onscreen
+    edge.Attr.Id <- prefix^h.a;
+    List.iter (sub_node prefix) h.n;
+  )
+  and sub_node prefix (n:Node) =
+  ( let node = g.AddNode(prefix^n.s) :?> Microsoft.GLEE.Drawing.Node in
+    node.Attr.Shape <- Microsoft.GLEE.IGraphViewer.Shape.Box;
+    node.Attr.XRad <- 3.0F;
+    node.Attr.YRad <- 3.0F;
+    ( match n.d with
+      | NExpr(e) -> node.Attr.Label <- (expr_to_string e)
+      | NCall(peer,verb,q,e) -> ( node.Attr.Label <- "CALL "^peer^"."^verb^"("^(expr_to_string e)^")"; node.Attr.Fillcolor <- Microsoft.GLEE.IGraphViewer.Color.Pink; )
+      | NCallreturn(e) -> node.Attr.Label <- (expr_to_string e)
+      | NAtomic(ad) -> node.Attr.Label <- (atomic_to_string ad.m)^" "^ad.rw;
+      | NSet(idp,tail,e) -> node.Attr.Label <- "SET "^(idpath_to_string idp)^":="^(expr_to_string e)
+      | NGet(v,tail) -> node.Attr.Label <- "GET "^v
+      | NFirst(fs) -> node.Attr.Label <- "SELECT"
+      | NSignal(e) -> (node.Attr.Label <- "SIGNAL("^(expr_to_string e)^")"; node.Attr.Fillcolor <- Microsoft.GLEE.IGraphViewer.Color.LightGreen )
+      | NReturn(e) -> (node.Attr.Label <- "RETURN("^(expr_to_string e)^")"; node.Attr.Fillcolor <- Microsoft.GLEE.IGraphViewer.Color.LightGreen )
+      | NIf(ifs) -> (node.Attr.Label <- "IF"; List.iter (sub_ifnode prefix n) ifs )
+      | NIfType(ifs) -> (node.Attr.Label <- "TYPESWITCH("^(List.head ifs).ifv^")"; List.iter (sub_iftypenode prefix n) ifs )
+    );
+    List.iter (sub_inwire prefix n) n.inWires
+  )
+  and sub_ifnode prefix n (id:IfDat) =
+  ( let node = g.AddNode(prefix^id.thens) :?> Microsoft.GLEE.Drawing.Node in
+    node.Attr.Shape <- Microsoft.GLEE.IGraphViewer.Shape.Box;
+    node.Attr.XRad <- 3.0F;
+    node.Attr.YRad <- 3.0F;
+    node.Attr.Label <- "("^(expr_to_string id.ife)^")";
+    let edge = g.AddEdge(prefix^n.s,prefix^id.thens) :?> Microsoft.GLEE.Drawing.Edge in
+    edge.Attr.Id <- prefix^n.s^"--"^prefix^id.thens;
+  )
+  and sub_iftypenode prefix n (id:IfTypeDat) =
+  ( let node = g.AddNode(prefix^id.tthens) :?> Microsoft.GLEE.Drawing.Node in
+    node.Attr.Shape <- Microsoft.GLEE.IGraphViewer.Shape.Box;
+    node.Attr.XRad <- 3.0F;
+    node.Attr.YRad <- 3.0F;
+    node.Attr.Label <- "["^(typelist_to_string id.ift)^"]";
+    let edge = g.AddEdge(prefix^n.s,prefix^id.tthens) :?> Microsoft.GLEE.Drawing.Edge in
+    edge.Attr.Id <- prefix^n.s^"--"^prefix^id.tthens;
+  )
+  and sub_inwire prefix n ((ws,wq):Wire) =
+  ( let edge = g.AddEdge(prefix^ws, prefix^n.s) :?> Microsoft.GLEE.Drawing.Edge in
+    edge.Attr.Id <- prefix^ws^"--"^prefix^n.s;
+    let star = (match wq with | NUnbounded -> "*" | NBounded(1) -> "" | NBounded(n) -> string(n)) in
+    edge.Attr.Label <- star^ws;
+  )
+  in
+  //
+  List.iter sub_activity p.a;
+  List.iter (fun (gv:Microsoft.GLEE.GraphViewerGDI.GViewer) -> gv.Graph <- g ) gv;
+)
+
+let update_graph (p:Prog) (ps:ProgState) (gv:Microsoft.GLEE.GraphViewerGDI.GViewer list) (show:bool) = if gv=[] then () else
+( let g = (List.head gv).Graph in
+  //
+  let rec sub_instance ((i,inst):(int*Instance)) =
+  ( let cols = [| Microsoft.GLEE.IGraphViewer.Color.Red; Microsoft.GLEE.IGraphViewer.Color.Gold; Microsoft.GLEE.IGraphViewer.Color.Green; Microsoft.GLEE.IGraphViewer.Color.Blue; Microsoft.GLEE.IGraphViewer.Color.Purple |] in
+    let col = if show then cols.[i % Array.length(cols)] else Microsoft.GLEE.IGraphViewer.Color.Black in
+    let prefix = inst.a^"."^inst.h^":"^(type_to_string inst.ht)^"." in
+    List.iter (sub_queue prefix col) inst.q;
+  )
+  and sub_queue prefix col (wq:WireQueue) =
+  ( let name = prefix^wq.src^"--"^prefix^wq.dst in
+    let edge = g.EdgeById(name) :?> Microsoft.GLEE.Drawing.Edge in
+    edge.Attr.Color <- col;
+    edge.Attr.Fontcolor <- col;
+    edge.Attr.LineWidth <- if show then 10 else 1;
+  )
+  and sub_mainqueue (mq:MainQueue) =
+  ( let (a:Activity) = activity_in_prog mq.a p in
+    let (h:Handler) = handler_in_activity (mq.h,mq.ht) a in
+    let prefix = mq.a^"."^mq.h^":"^(type_to_string mq.ht)^"." in
+    let node = g.FindNode(prefix^h.a)  :?> Microsoft.GLEE.Drawing.Node in
+    node.Attr.Color <- if show then Microsoft.GLEE.IGraphViewer.Color.Red else Microsoft.GLEE.IGraphViewer.Color.Black;
+    node.Attr.LineWidth <- if show then 10 else 1;
+  )
+  in
+  //
+  List.iter sub_mainqueue ps.mq;
+  List.iter sub_instance ps.i;
+  List.iter (fun (gv:Microsoft.GLEE.GraphViewerGDI.GViewer) -> gv.Invalidate(); if show then gv.Refresh(); ) gv;
+  Application.DoEvents();
+)
+
+
+
+
+
+
+let amain (fn:string) =
+  let fs = new IO.FileStream(fn, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read) in
+  let stream = new IO.StreamReader(fs) in
+  let lexbuf = Lexing.from_text_reader System.Text.Encoding.ASCII stream in 
+  let prog = 
+    try Pars.start Lex.token lexbuf
+    with e -> let pos = Lexing.lexbuf_curr_p lexbuf in 
+      raise (new System.Exception("Parsing error near line "^string(pos.pos_lnum+1)^" char "^string(pos.pos_cnum-pos.pos_bol)^"\n"^e.ToString()))
+    in
+  stream.Close();
+  fs.Close();
+  let prog = Analysis.PostParse(prog) in
+  let prog = Analysis.CheckServicePorts(prog) in
+  let prog = Analysis.InferTypes(prog) in
+  log ("\n\nProgram:\n-------------\n"^(prog_to_string prog)^"\n\n");
+  let ps = ref (MakeInitialState prog false) in
+  log (progstate_to_string (!ps));
+  //
+  let form = new Form() in
+  form.AutoScaleDimensions <- new Drawing.SizeF(8.0F,16.0F);
+  form.AutoScaleMode <- AutoScaleMode.Font;
+  form.ClientSize <- new Drawing.Size(676,363);
+  form.Text <- argv.[1];
+  let numhandlers = List.length (List.concat (List.map (fun (a:Activity)->a.h) prog.a)) in
+  let split = new SplitContainer() in
+  let gv = if IO.File.Exists("Microsoft.GLEE.dll") then [new Microsoft.GLEE.GraphViewerGDI.GViewer(); new Microsoft.GLEE.GraphViewerGDI.GViewer()]
+  else (let _ = MessageBox.Show("Need these DLLs to display the graph:\nMicrosoft.GLEE.dll\nMicrosoft.GLEE.Drawing.dll\nMicrosoft.GLEE.GraphHelper.dll\nMicrosoft.GLEE.GraphViewerGDI.dll\nMicrosoft.GLEE.IGraphViewer.dll\nMicrosoft.GLEE.Splines.dll\nAsml.Tools.Algos.SA.dll\nAsml.Tools.Algos.SimplexMethod.dll\nAsml.Tools.Algos.SimplexMethodOpt.Tableau.dll\n") in []) in
+  let gprint (ps:ProgState) (show:bool) : unit = update_graph prog ps gv show in
+  let handle f = new EventHandler (fun x y -> try f x y with e -> Console.Beep(); log("EXCEPTION\n"); log (e.ToString()^"\n\n") ) in
+  let autostep = ref false in // for whether generating an event does an automatic step-over
+  //
+  let btnStepInto = new Button() in
+  btnStepInto.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnStepInto.Location <- new Drawing.Point(12,12);
+  btnStepInto.Size <- new Drawing.Size(75,23);
+  btnStepInto.TabIndex <- 1;
+  btnStepInto.Text <- "Step&Into";
+  btnStepInto.UseVisualStyleBackColor <- true;
+  btnStepInto.add_Click (handle (fun _ _ -> ps := step prog (!ps) gprint false None ));
+  form.Controls.Add(btnStepInto);
+  let btnStepOver = new Button() in
+  btnStepOver.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnStepOver.Location <- new Drawing.Point(93,12);
+  btnStepOver.Size <- new Drawing.Size(75,23);
+  btnStepOver.TabIndex <- btnStepInto.TabIndex + 1;
+  btnStepOver.Text <- "Step&Over";
+  btnStepOver.UseVisualStyleBackColor <- true;
+  btnStepOver.add_Click (handle (fun _ _ -> ps := step prog (!ps) gprint true None ));
+  form.Controls.Add(btnStepOver);
+  let btnReach = new Button() in
+  btnReach.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnReach.Location <- new Drawing.Point(174,12);
+  btnReach.Size <- new Drawing.Size(75,23);
+  btnReach.TabIndex <- btnStepOver.TabIndex + 1;
+  btnReach.Text <- "&Reach";
+  btnReach.UseVisualStyleBackColor <- true;
+  btnReach.add_Click (handle (fun _ _ -> reachability form prog gprint ));
+  form.Controls.Add(btnReach);
+  let btnRace = new Button() in
+  btnRace.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnRace.Location <- new Drawing.Point(255,12);
+  btnRace.Size <- new Drawing.Size(75,23);
+  btnRace.TabIndex <- btnReach.TabIndex + 1;
+  btnRace.Text <- "Ra&ce";
+  btnRace.UseVisualStyleBackColor <- true;
+  btnRace.add_Click (handle (fun _ _ -> race form prog gprint ));
+  form.Controls.Add(btnRace);
+  let btnRelease = new Button() in
+  btnRelease.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnRelease.Location <- new Drawing.Point(336,12);
+  btnRelease.Size <- new Drawing.Size(75,23);
+  btnRelease.TabIndex <- btnRace.TabIndex + 1;
+  btnRelease.Text <- "Re&lease";
+  btnRelease.UseVisualStyleBackColor <- true;
+  btnRelease.add_Click (handle (fun _ _ -> release form prog gprint ));
+  form.Controls.Add(btnRelease);
+  let btnCycle = new Button() in
+  btnCycle.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left;
+  btnCycle.Location <- new Drawing.Point(417,12);
+  btnCycle.Size <- new Drawing.Size(75,23);
+  btnCycle.TabIndex <- btnRelease.TabIndex + 1;
+  btnCycle.Text <- "C&ycle";
+  btnCycle.UseVisualStyleBackColor <- true;
+  btnCycle.add_Click (handle (fun _ _ -> cycle form prog gprint ));
+  form.Controls.Add(btnCycle);
+  let btnAutoRun = new CheckBox() in
+  btnAutoRun.Anchor <- AnchorStyles.Top ||| AnchorStyles.Right;
+  btnAutoRun.AutoSize <- true;
+  btnAutoRun.Location <- new Drawing.Point(537,12);
+  btnAutoRun.Size <- new Drawing.Size(127,21);
+  btnAutoRun.TabIndex <- btnCycle.TabIndex + 1;
+  btnAutoRun.Text <- "Events &Autorun";
+  btnAutoRun.UseVisualStyleBackColor <- true;
+  btnAutoRun.add_CheckedChanged (handle (fun _ _ -> autostep := btnAutoRun.Checked ));
+  form.Controls.Add(btnAutoRun);
+  //
+  let count = ref 0 in
+  for ai=0 to List.length(prog.a)-1 do
+    let (a:Activity) = List.nth prog.a ai in
+    if a.ext then (for ti=0 to List.length(a.signal)-1 do
+      let t = List.nth a.signal ti in
+      let txt = new TextBox() in
+      txt.Anchor <- AnchorStyles.Top ||| AnchorStyles.Left ||| AnchorStyles.Right;
+      txt.Location <- new Drawing.Point(12,40+(!count)*28);
+      txt.Size <- new Drawing.Size(571,22);
+      txt.TabIndex <- btnAutoRun.TabIndex+1+(!count)*2;
+      txt.Text <- type_exemplar prog.tp t;
+      form.Controls.Add(txt);
+      let btn = new Button() in
+      btn.Anchor <- AnchorStyles.Top ||| AnchorStyles.Right;
+      btn.Location <- new Drawing.Point(589,40+(!count)*28);
+      btn.Size <- new Drawing.Size(75,23);
+      btn.TabIndex <- 4+(!count)*2+1;
+      btn.Text <- a.s;
+      btn.UseVisualStyleBackColor <- true;
+      btn.add_Click (handle (fun _ _ -> 
+         let expr = string_to_expr txt.Text in
+         let v = Evaluate prog.ef [] [] Unimportant expr in
+         ps := insert prog (!ps) gprint btn.Text v;
+         if (!autostep) then ps := step prog (!ps) gprint true None; ));
+      form.Controls.Add(btn);
+      count := (!count)+1;
+    done; )
+  done;
+  //
+  split.Anchor <- AnchorStyles.Top;
+  split.Location <- new Drawing.Point(12,40+(!count)*28);
+  split.Size <- new Drawing.Size(652,311-(!count)*28);
+  split.SplitterDistance <- (if numhandlers>=6 then split.ClientSize.Width/2 else split.ClientSize.Width);
+  List.iter (fun (gv:Microsoft.GLEE.GraphViewerGDI.GViewer) ->
+    gv.Name <- "gv";
+    gv.Dock <- DockStyle.Fill;
+    gv.TabIndex <- btnAutoRun.TabIndex+1+(!count)*2;
+    gv.NavigationVisible <- true;
+    gv.SaveButtonVizible <- false;
+    gv.MouseHitDistance <- 0.05;
+  ) gv;
+  split.Panel1.Controls.Add (List.nth gv 0);
+  split.Panel2.Controls.Add (List.nth gv 1);
+  form.Controls.Add(split);
+  print_graph prog gv;
+  //
+  Application.Run(form);
+  ()
+
+
+let _ = try
+  if argv.Length <> 2 then (log "usage: checkmri filename.viper | /test\n"; exit(0) );
+  log "CheckMRI\n----------\n";
+  let arg = argv.[1] in
+  if arg="-test" || arg="--test" || arg="/test" then Test.tmain()
+  else amain(arg)
+with e -> log (e.ToString())
+//let _ = log "\nPress Return\n"; input_line stdin
+
+
+
+// Here are some useful F# references:
+//
+// http://www.strangelights.com/fsharp/
+// http://www.strangelights.com/fsharp/Wiki/default.aspx
+// http://research.microsoft.com/projects/ilx/fsharp-manual/default.aspx
+// http://www.strangelights.com/fsharp/Doc/index.html
+// http://research.microsoft.com/projects/ilx/fsharp-manual/namespaces.html
diff --git a/tests/fsharp/regression/lucian-standalone-bug/checkmri.fsharpp b/tests/fsharp/regression/lucian-standalone-bug/checkmri.fsharpp
new file mode 100644
index 0000000..5bd5f84
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/checkmri.fsharpp
@@ -0,0 +1,122 @@
+"General"
+{
+"ProjectIdGuid" = "{52A4D03F-6242-4951-A460-2A59A3A0F8D3}"
+}
+"Configurations"
+{
+    "Debug|Win32"
+    {
+    "ProjectType" = "EXE"
+    "OptLevel" = "Off"
+    "StrongNamingLevel" = "None"
+    "LanguageRestriction" = "None"
+    "OutputPath" = ""
+    "SearchPath" = "-r Microsoft.GLEE.dll -r Microsoft.GLEE.Drawing.dll -r Microsoft.GLEE.GraphViewerGDI.dll -r Microsoft.GLEE.IGraphViewer.dll -r Microsoft.GLEE.Splines.dll -r AsmL.Tools.Algos.SimplexMethod.dll -r AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll"
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "TRUE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = "eg1.viper"
+    }
+    "Release|Win32"
+    {
+    "ProjectType" = "EXE"
+    "OptLevel" = "3"
+    "StrongNamingLevel" = "None"
+    "LanguageRestriction" = "Fast F#"
+    "OutputPath" = ""
+    "SearchPath" = ""
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "FALSE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = ""
+    }
+}
+"Files"
+{
+    "pars.fsy"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lex.fsl"
+    {
+    "ProjRelPath" = "T"
+    }
+    "utils.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "ast.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "pars.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lex.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "states.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "analysis.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "test.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "checkmri.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg1.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg2.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg3.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg4.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg5.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg6.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+    "eg7.viper"
+    {
+    "ProjRelPath" = "T"
+    }
+}
+"ProjStartupServices"
+{
+}
+"Globals"
+{
+}
diff --git a/tests/fsharp/regression/lucian-standalone-bug/checkmri.ppt b/tests/fsharp/regression/lucian-standalone-bug/checkmri.ppt
new file mode 100644
index 0000000..e310e93
Binary files /dev/null and b/tests/fsharp/regression/lucian-standalone-bug/checkmri.ppt differ
diff --git a/tests/fsharp/regression/lucian-standalone-bug/checkmri.sln b/tests/fsharp/regression/lucian-standalone-bug/checkmri.sln
new file mode 100644
index 0000000..f4feb30
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/checkmri.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{94D665CA-D915-4DE1-AA53-913450A1AE2D}") = "checkmri", "checkmri.fsharpp", "{52A4D03F-6242-4951-A460-2A59A3A0F8D3}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{52A4D03F-6242-4951-A460-2A59A3A0F8D3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{52A4D03F-6242-4951-A460-2A59A3A0F8D3}.Debug|Win32.Build.0 = Debug|Win32
+		{52A4D03F-6242-4951-A460-2A59A3A0F8D3}.Release|Win32.ActiveCfg = Release|Win32
+		{52A4D03F-6242-4951-A460-2A59A3A0F8D3}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/tests/fsharp/regression/lucian-standalone-bug/edit.bat b/tests/fsharp/regression/lucian-standalone-bug/edit.bat
new file mode 100644
index 0000000..0c12f41
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/edit.bat
@@ -0,0 +1,15 @@
+sd edit checkmri.fs
+sd edit ast.fs
+sd edit pars.fsy
+sd edit utils.fs
+sd edit analysis.fs
+sd edit states.fs
+sd edit test.fs
+sd edit eg1.viper
+sd edit eg2.viper
+sd edit eg3.viper
+sd edit eg4.viper
+sd edit eg5.viper
+sd edit eg6.viper
+sd edit eg7.viper
+sd edit checkmri.exe
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg1.viper b/tests/fsharp/regression/lucian-standalone-bug/eg1.viper
new file mode 100644
index 0000000..e7fd750
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg1.viper
@@ -0,0 +1,121 @@
+// This is the "Wanderer" example from the VIPER docs.
+
+class Mode {bool Tracking;}
+class Position {int x; int y;}
+type Color = Position + important Mode
+class Bumper {bool l1; bool l2;}
+class Motor {int M1; int M2;}
+class Find {bool Find;}
+class Track {bool Track;}
+class FindTrack {bool Find; bool Track;}
+type StateSet = Find + Track + FindTrack
+class Success {string s;}
+class Failure {string f;}
+extern void setm(string id,int m1,int m2);
+extern int f(int x,int y);
+extern int g(int x,int y);
+extern int rand(int min,int max);
+extern void print(string);
+
+extern activity BumperHW : Bumper {} 
+extern activity ColorHW : Color {}
+extern activity Timer {on Delay(int *i):int {} }
+
+
+
+activity MyState : FindTrack
+{ FindTrack s = new FindTrack(Find=false, Track=false);
+
+  on Set(Find *m):FindTrack
+  { n = new FindTrack(Find=m.Find, Track=s.Track) |
+    set =  s := n |
+    signal set |
+    return set
+  }
+  on Set(Track *m):FindTrack
+  { n = new FindTrack(Find=s.Find, Track=m.Track) |
+    set =  s := n |
+    signal set |
+    return set
+  }
+  on Set(FindTrack *m):FindTrack
+  { set =  s := m |
+    signal set |
+    return set
+  }
+
+  on Get(void *m):FindTrack
+  { return {m} s
+  }
+}
+
+
+activity MotorAct
+{ Motor s = new Motor(M1=0, M2=0);
+  string id = "dev102";
+
+  on Set(Motor *m):Motor
+  { hwset = external setm(id,m.M1,m.M2) |
+    iset = s := m |
+    return {hwset} iset
+  }
+
+  on Get(void *m):Motor
+  { return {m} s
+  }
+}
+
+
+activity BumperAct : Bumper
+{ Bumper s = new Bumper(l1=false, l2=false);
+  string id = "dev105";
+
+  on BumperHW(Bumper m)
+  { iset = s := m |
+    signal iset
+  }
+
+  on Get(void *m):Bumper
+  { return {m} s
+  }
+}
+
+
+
+activity Wander
+{
+
+  on MyState(FindTrack m)
+  { if (m.Find) then s = new Motor(M1=7, M2=7) |
+    call MotorAct.Set(s)
+  }
+
+  on ColorHW(important Mode *ct)
+  { if (ct.Tracking) then track=true |
+    s = {track} call MyState.Get(void) |
+    if (s.Find) then m=new Find(Find=false) |
+    call MyState.Set(m)
+  }
+
+  on ColorHW(Position ct)
+  { s = {ct} call MyState.Get(void) |
+    if (!s.Find && s.Track) then istracking=true |
+    m = {istracking} new Motor(M1=external f(ct.x,ct.y), M2=external g(ct.x,ct.y)) |
+    call MotorAct.Set(m)
+  }
+
+  on BumperAct(Bumper b)
+  { s2 = {b} call MyState.Set(new FindTrack(Find=false, Track=false)) |
+    {s2} call MotorAct.Set(new Motor(M1=-7, M2=-7)) |
+    t1 = {s2} 2 |
+    t2 = call Timer.Delay(t1) |
+    if {t2} (b.l1 && b.l2) then c1 = new Motor(M1=7,M2=-7)
+    else if (!b.l1 && b.l2) then c2 = new Motor(M1=-7,M2=7)
+    else if (b.l1 && !b.l2) then c3 = new Motor(M1=external rand(-7,7),M2=external rand(-7,7)) |
+    dc = first(c1,c2,c3) |
+    t3 = {dc} call Timer.Delay(t1) |
+    call MotorAct.Set(dc) |
+    t4 = {t3} new FindTrack(Find=false, Track=false) |
+    call MyState.Set(t4)
+  }
+}
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg2.viper b/tests/fsharp/regression/lucian-standalone-bug/eg2.viper
new file mode 100644
index 0000000..5136024
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg2.viper
@@ -0,0 +1,30 @@
+// This code exercises "multiwire-out" for services
+
+class Success {string s;}
+class Failure {string f;}
+extern int rand(int min,int max);
+extern void print(string);
+
+extern activity Test : void
+{
+}
+
+activity Multiwire
+{
+  on Test(void m)
+  { t = {m} call Multiwire.Spurious(void) |
+    if (t:Success) then b1=t.s
+    else if (t:Failure) then b2=t.f |
+    dummy1 = {b1} external print("hello") |
+    dummy2 = {b2} external print("there")
+  }
+  
+  on Spurious(void *m):Success+Failure
+  { i = {m} external rand(0,2) |
+    if (i==0) then b1=void
+    else b2=void |
+    return {b1} new Success(s="hello") |
+    return {b2} new Failure(f="world")
+  }
+
+}
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg3.viper b/tests/fsharp/regression/lucian-standalone-bug/eg3.viper
new file mode 100644
index 0000000..e0c6e8b
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg3.viper
@@ -0,0 +1,36 @@
+// This code exercises the reader/writer locking primitive
+
+extern activity TestR1 : void {}
+extern activity TestR2 : void {}
+extern activity TestW3 : void {}
+
+activity Sync : int
+{ readwrite rw = new readwrite(rcount=0, wcount=0);
+  int x=0;
+
+  on TestR1(void m)
+  { t = {m} begin_read(rw) |
+    gx1 = {t} x |
+    gx2 = {t} x |
+    y = gx1+gx2 |
+    t2 = {gx1,gx2} end_read(rw) |
+    signal y
+  }
+
+  on TestR2(void m)
+  { t = {m} begin_read(rw) |
+    gx1 = {t} x |
+    gx2 = {t} x |
+    y = gx1*gx2 |
+    t2 = {y} end_read(rw) |
+    signal y
+  }
+  
+  on TestW3(void m)
+  { t = {m} begin_write(rw) |
+    done =  {t} x := x+1 |
+    t3 = {done} end_write(rw) |
+    signal done
+  }
+
+}
\ No newline at end of file
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg4.viper b/tests/fsharp/regression/lucian-standalone-bug/eg4.viper
new file mode 100644
index 0000000..b1d570d
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg4.viper
@@ -0,0 +1,23 @@
+// This code has a race condition. The important message
+// tells us to reset the counter. The unimportant one tells
+// us to increment it. The sequence
+//  [unimp]GET, [imp]SET, [unimp]SET
+// has a race because once we do [imp]SET then we're not allowed
+// to do any SETs which depend on a GET prior to that [imp]SET.
+
+
+extern activity Tick : void {}
+extern activity Reset : important void {}
+
+activity Race : int
+{ int count = 0;
+
+  on Tick(void m)
+  { t = {m} count := count+1
+  }
+
+  on Reset(important void *m)
+  { t = {m} count := 0
+  }
+
+}
\ No newline at end of file
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg5.viper b/tests/fsharp/regression/lucian-standalone-bug/eg5.viper
new file mode 100644
index 0000000..eae8417
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg5.viper
@@ -0,0 +1,23 @@
+// This is like eg4.viper, but the race condition
+// has been removed through the use of a read-writer.
+
+extern activity Tick : void {}
+extern activity Reset : important void {}
+
+activity Race : int
+{ int count = 0;
+  readwrite rw = new readwrite(rcount=0,wcount=0);
+
+  on Tick(void m)
+  { lock = {m} begin_write(rw) |
+    t = {lock} count := count+1 |
+    e = {t} end_write(rw)
+  }
+
+  on Reset(important void *m)
+  { lock = {m} begin_write(rw) |
+    t = {lock} count := 0 |
+    e = {t} end_write(rw)
+  }
+
+}
\ No newline at end of file
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg6.viper b/tests/fsharp/regression/lucian-standalone-bug/eg6.viper
new file mode 100644
index 0000000..ceb7f98
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg6.viper
@@ -0,0 +1,34 @@
+// This code has a "release" problem, where the readwriter is not released
+
+extern activity ReadBad : void {}
+extern activity WriteBad : void {}
+extern activity DoGood : important void {}
+
+activity Race : int
+{ int count = 0;
+  readwrite rw = new readwrite(rcount=0,wcount=0);
+
+  on ReadBad(void m)
+  { lock = {m} begin_read(rw) |
+    t = {lock} count := count+1 |
+    // "release" error because we didn't release the lock
+  }
+
+  on WriteBad(void m)
+  { lock = {m} begin_write(rw) |
+    t = {lock} count := 0 |
+    // "release" error because we didn't release the lock
+  }
+
+  on DoGood(important void *a)
+  { b = {a} begin_write(rw) |
+    c = {b} count := count+1 |
+    d = {c} end_write(rw) |
+    e = {d} count := count+1 |  // yes I know there's a "race" error here
+    f = {e} begin_read(rw) |
+    g = {f} count := count+1 |
+    h = {g} end_read(rw) |
+    signal {h} count
+  }
+
+}
\ No newline at end of file
diff --git a/tests/fsharp/regression/lucian-standalone-bug/eg7.viper b/tests/fsharp/regression/lucian-standalone-bug/eg7.viper
new file mode 100644
index 0000000..53015c8
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/eg7.viper
@@ -0,0 +1,29 @@
+// This code has cyclic dependency between activities
+
+activity One : int
+{ readwrite rw = new readwrite(rcount=0,wcount=0);
+
+  on Test(void *t1):int
+  { t2 = {t1} begin_read(rw) |
+    t3 = {t2} call Two.Handle(void) |
+    t4 = {t3} end_read(rw) |
+    return {t4} 0
+  }
+
+  on Back(void *b1):int
+  { b2 = {b1} begin_write(rw) |
+    b3 = {b2} end_write(rw) |
+    return {b3} 0
+  }
+
+}
+
+
+activity Two : int
+{ readwrite rw = new readwrite(rcount=0,wcount=0);
+
+  on Handle(void *h1):int
+  { h2 = call One.Back(void) |
+    return {h2} 0
+  }
+}
\ No newline at end of file
diff --git a/tests/fsharp/regression/lucian-standalone-bug/hashtbl.fs b/tests/fsharp/regression/lucian-standalone-bug/hashtbl.fs
new file mode 100644
index 0000000..5e56572
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/hashtbl.fs
@@ -0,0 +1,79 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  
+//
+//===========================================================================
+
+module Microsoft.FSharp.Compatibility.OCaml.Hashtbl
+
+open Microsoft.FSharp.Collections
+open System.Collections.Generic
+open System.IO
+
+type HashTable<'Key,'Val> = HashMultiMap<'Key,'Val> 
+type ('Key,'Val) t = HashMultiMap<'Key,'Val> 
+
+let inline create (n:int) = new HashMultiMap<_,_>(n, HashIdentity.Structural)
+
+let add (t:HashMultiMap<'Key,'Val>) x y = t.Add(x,y)
+let of_list (l : _ list) = 
+     let t = create (List.length l) in 
+     List.iter (fun (x,y) -> add t x y) l; 
+     t
+
+let of_seq (l:seq<_>) = 
+    let arr = Array.ofSeq l in 
+    let t = create (Array.length arr) in Array.iter (fun (x,y) -> add t x y) arr; 
+    t
+
+let copy (t:HashMultiMap<'Key,'Val>)  = t.Copy()
+let find (t:HashMultiMap<'Key,'Val>)  x = t.[x]
+let tryfind (t:HashMultiMap<'Key,'Val>)  x = t.TryFind x
+let find_all (t:HashMultiMap<'Key,'Val>)  x = t.FindAll x
+let mem (t:HashMultiMap<'Key,'Val>)  x =  t.ContainsKey x
+let remove (t:HashMultiMap<'Key,'Val>)  x = t.Remove x
+let replace (t:HashMultiMap<'Key,'Val>)  x y = t.Replace(x,y)
+let fold f (t:HashMultiMap<'Key,'Val>)  c = t.Fold f c
+let clear (t:HashMultiMap<'Key,'Val>)  = t.Clear ()
+let iter f (t:HashMultiMap<'Key,'Val>)  = t.Iterate f
+
+let hash x = LanguagePrimitives.GenericHash x
+let hashq x = LanguagePrimitives.PhysicalHash x
+
+// Componentized Hash Tables
+type Provider<'Key,'Val,'Tag> 
+     when 'Tag :> IEqualityComparer<'Key> =
+  interface
+    abstract create  : int -> Tagged.HashMultiMap<'Key,'Val,'Tag>;
+    abstract clear   : Tagged.HashMultiMap<'Key,'Val,'Tag> -> unit;
+    abstract add     : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val -> unit;
+    abstract copy    : Tagged.HashMultiMap<'Key,'Val,'Tag> -> Tagged.HashMultiMap<'Key,'Val,'Tag>;
+    abstract find    : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val;
+    abstract find_all: Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val list;
+    abstract tryfind : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val option;
+    abstract mem     : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> bool;
+    abstract remove  : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> unit;
+    abstract replace : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val -> unit;
+    abstract iter    : ('Key -> 'Val -> unit) -> Tagged.HashMultiMap<'Key,'Val,'Tag> -> unit;
+    abstract fold    : ('Key -> 'Val -> 'State -> 'State) -> Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'State -> 'State;
+    
+  end
+
+type Provider<'Key,'Val> = Provider<'Key,'Val,IEqualityComparer<'Key>>
+
+let MakeTagged (ops : 'Tag) : Provider<'Key,'Val,'Tag> when 'Tag :> IEqualityComparer<'Key> = 
+  { new Provider<_,_,_> with 
+      member p.create n = Tagged.HashMultiMap<'Key,'Val,'Tag>.Create(ops,n);
+      member p.clear c = c.Clear();
+      member p.add c x y = c.Add(x,y);
+      member p.copy c = c.Copy();
+      member p.find  c x = c.[x];
+      member p.find_all c x = c.FindAll(x);
+      member p.tryfind c x = c.TryFind(x);
+      member p.mem c x = c.ContainsKey(x);
+      member p.remove c x = c.Remove(x);
+      member p.replace c x y = c.Replace(x,y);
+      member p.iter f c = c.Iterate(f);
+      member p.fold f c acc = c.Fold f acc; }
+
+let Make (hash,eq) = MakeTagged (HashIdentity.FromFunctions hash eq)
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/lex.fs b/tests/fsharp/regression/lucian-standalone-bug/lex.fs
new file mode 100644
index 0000000..46a36b9
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/lex.fs
@@ -0,0 +1,678 @@
+#light "off"
+# 1 "lex.fsl"
+ 
+
+module Lex
+open System
+open Pars
+open Lexing
+open Microsoft.FSharp.Text.Lexing
+
+let inc_lnum bol pos = 
+  let lnum = pos.pos_lnum in 
+  {pos with pos_lnum =  lnum+1; pos_bol = bol }
+
+let newline lexbuf = 
+  lexbuf_set_curr_p lexbuf 
+    ( inc_lnum (lexeme_end lexbuf) (lexeme_end_p lexbuf))
+
+
+# 19 "lex.fs"
+let trans : uint16[] array = 
+    [| 
+   (* State 0 *)
+ [|4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 1us; 4us; 4us; 2us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 3us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; [...]
+   (* State 1 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 2 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 6us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us [...]
+   (* State 3 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 5us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us [...]
+   (* State 4 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 5 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 6 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 7 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 8us; 9us; 65535us; 65535us; 10us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 8us; 23us; 41us; 65535us; 65535us; 65535us; 32us; 65535us; 35us; 36us; 26us; 38us; 37us; 39us; 25us; 40us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 29us; 27us; 31us; 28us; 30us; 65535us; 65535u [...]
+   (* State 8 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 9 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 10 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 9us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us [...]
+   (* State 11 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 12 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 13 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 14 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 15 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 16 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 17 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 18 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 19 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 20 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 21 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 22 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 23 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 24 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 25 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 26 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 27 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 28 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 29 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 30 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 31 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 32 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 61us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535u [...]
+   (* State 33 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 34 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 35 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 36 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 37 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 38 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 39 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44us; 44u [...]
+   (* State 40 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 58us; 65535us; 65535us; 65535us; 65535us; 57us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us;  [...]
+   (* State 41 *)
+ [|54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 65535us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 65535us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54us; 54u [...]
+   (* State 42 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 43 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 44 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 48us; 65535us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us;  [...]
+   (* State 45 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 46 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 48us; 65535us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us; 46us;  [...]
+   (* State 47 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 51us; 51us; 51us; 51us; 51us; 51us; 51us; 51us; 51us; 51u [...]
+   (* State 48 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 49us; 49us; 49us; 49us; 49us; 49us; 49us; 49us; 49us; 49u [...]
+   (* State 49 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50u [...]
+   (* State 50 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50u [...]
+   (* State 51 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52u [...]
+   (* State 52 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52us; 52u [...]
+   (* State 53 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 54 *)
+ [|56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 65535us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 55us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us;  [...]
+   (* State 55 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 56 *)
+ [|56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 65535us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 55us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us; 56us;  [...]
+   (* State 57 *)
+ [|60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 59us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60u [...]
+   (* State 58 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 59 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 60 *)
+ [|60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 59us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60us; 60u [...]
+   (* State 61 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 62 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 63 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 64 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 65 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 66 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 67 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 655 [...]
+   (* State 68 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 69 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 70 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 71 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 72 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 73 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 74 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 75 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 76 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 77 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 78 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 79 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 80 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 81 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 82 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 83 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 84 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 85 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 86 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 87 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 88 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 89 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 90 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 91 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 92 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 93 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 94 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 95 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 96 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 97 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 98 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 99 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 100 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 101 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 102 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 103 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 104 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 105 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 106 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 107 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 108 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 109 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 110 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 111 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 112 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 113 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 114 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 115 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 116 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 117 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 118 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 119 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 120 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 121 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 122 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 123 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 124 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 125 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 126 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 127 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 128 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 129 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 130 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 131 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 132 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 133 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 134 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 135 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 136 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 137 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 138 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 139 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 140 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 141 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 142 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 143 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 144 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 145 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 146 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 147 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 148 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 149 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 150 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 151 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 152 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 153 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 154 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 155 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 156 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 157 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 158 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 159 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 160 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 161 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 162 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 163 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 164 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 165 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 166 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 167 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+   (* State 168 *)
+ [|65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53us; 53u [...]
+    |] 
+let actions : uint16[] = [|65535us; 0us; 2us; 2us; 2us; 1us; 0us; 65535us; 0us; 1us; 65535us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 50us; 23us; 24us; 25us; 26us; 27us; 28us; 36us; 38us; 37us; 65535us; 39us; 40us; 41us; 42us; 43us; 44us; 45us; 46us; 65535us; 50us; 50us; 52us; 54us; 52us; 65535us; 65535us; 53us; 53us; 53us; 53us; 50us; 65535us; 47us; 65535us; 65535us; 56us; 55us; 65535us; 34us; 33us; 32us; 30us; 29us; 35us; 31us; 50us; 50us; 50us; 50us; 50us; 50 [...]
+let _fslex_tables = Microsoft.FSharp.Text.Lexing.AsciiTables.Create(trans,actions)
+let rec _fslex_dummy () = _fslex_dummy() 
+(* Rule token *)
+and token  (lexbuf : Microsoft.FSharp.Text.Lexing.LexBuffer<_>) = _fslex_token  7 lexbuf
+and _fslex_token  _fslex_state lexbuf =
+  match _fslex_tables.Interpret(_fslex_state,lexbuf) with
+  | 0 -> ( 
+# 24 "lex.fsl"
+                              token lexbuf 
+# 371 "lex.fs"
+          )
+  | 1 -> ( 
+# 25 "lex.fsl"
+                            newline lexbuf; token lexbuf 
+# 376 "lex.fs"
+          )
+  | 2 -> ( 
+# 26 "lex.fsl"
+                               ACTIVITY 
+# 381 "lex.fs"
+          )
+  | 3 -> ( 
+# 27 "lex.fsl"
+                        IF 
+# 386 "lex.fs"
+          )
+  | 4 -> ( 
+# 28 "lex.fsl"
+                          TYPE 
+# 391 "lex.fs"
+          )
+  | 5 -> ( 
+# 29 "lex.fsl"
+                           CLASS 
+# 396 "lex.fs"
+          )
+  | 6 -> ( 
+# 30 "lex.fsl"
+                          ENUM 
+# 401 "lex.fs"
+          )
+  | 7 -> ( 
+# 31 "lex.fsl"
+                               IMPORTANT 
+# 406 "lex.fs"
+          )
+  | 8 -> ( 
+# 32 "lex.fsl"
+                                 UNIMPORTANT 
+# 411 "lex.fs"
+          )
+  | 9 -> ( 
+# 33 "lex.fsl"
+                         NEW 
+# 416 "lex.fs"
+          )
+  | 10 -> ( 
+# 34 "lex.fsl"
+                            SIGNAL 
+# 421 "lex.fs"
+          )
+  | 11 -> ( 
+# 35 "lex.fsl"
+                          THEN 
+# 426 "lex.fs"
+          )
+  | 12 -> ( 
+# 36 "lex.fsl"
+                          ELSE 
+# 431 "lex.fs"
+          )
+  | 13 -> ( 
+# 37 "lex.fsl"
+                        ON 
+# 436 "lex.fs"
+          )
+  | 14 -> ( 
+# 38 "lex.fsl"
+                           FIRST 
+# 441 "lex.fs"
+          )
+  | 15 -> ( 
+# 39 "lex.fsl"
+                              EXTERNAL 
+# 446 "lex.fs"
+          )
+  | 16 -> ( 
+# 40 "lex.fsl"
+                          CALL 
+# 451 "lex.fs"
+          )
+  | 17 -> ( 
+# 41 "lex.fsl"
+                            RETURN 
+# 456 "lex.fs"
+          )
+  | 18 -> ( 
+# 42 "lex.fsl"
+                            EXTERN 
+# 461 "lex.fs"
+          )
+  | 19 -> ( 
+# 43 "lex.fsl"
+                                BEGINREAD 
+# 466 "lex.fs"
+          )
+  | 20 -> ( 
+# 44 "lex.fsl"
+                              ENDREAD 
+# 471 "lex.fs"
+          )
+  | 21 -> ( 
+# 45 "lex.fsl"
+                                 BEGINWRITE 
+# 476 "lex.fs"
+          )
+  | 22 -> ( 
+# 46 "lex.fsl"
+                               ENDWRITE 
+# 481 "lex.fs"
+          )
+  | 23 -> ( 
+# 47 "lex.fsl"
+                            PLING 
+# 486 "lex.fs"
+          )
+  | 24 -> ( 
+# 48 "lex.fsl"
+                            PAR 
+# 491 "lex.fs"
+          )
+  | 25 -> ( 
+# 49 "lex.fsl"
+                            DOT 
+# 496 "lex.fs"
+          )
+  | 26 -> ( 
+# 50 "lex.fsl"
+                            STAR 
+# 501 "lex.fs"
+          )
+  | 27 -> ( 
+# 51 "lex.fsl"
+                            SEMI 
+# 506 "lex.fs"
+          )
+  | 28 -> ( 
+# 52 "lex.fsl"
+                            EQUALS 
+# 511 "lex.fs"
+          )
+  | 29 -> ( 
+# 53 "lex.fsl"
+                            EQEQUALS 
+# 516 "lex.fs"
+          )
+  | 30 -> ( 
+# 54 "lex.fsl"
+                            COLONEQUALS 
+# 521 "lex.fs"
+          )
+  | 31 -> ( 
+# 55 "lex.fsl"
+                            NOTEQUALS 
+# 526 "lex.fs"
+          )
+  | 32 -> ( 
+# 56 "lex.fsl"
+                            ABOVEEQUALS 
+# 531 "lex.fs"
+          )
+  | 33 -> ( 
+# 57 "lex.fsl"
+                            BELOWEQUALS 
+# 536 "lex.fs"
+          )
+  | 34 -> ( 
+# 58 "lex.fsl"
+                            AND 
+# 541 "lex.fs"
+          )
+  | 35 -> ( 
+# 59 "lex.fsl"
+                            OR 
+# 546 "lex.fs"
+          )
+  | 36 -> ( 
+# 60 "lex.fsl"
+                            COLON 
+# 551 "lex.fs"
+          )
+  | 37 -> ( 
+# 61 "lex.fsl"
+                            LANGLE 
+# 556 "lex.fs"
+          )
+  | 38 -> ( 
+# 62 "lex.fsl"
+                            RANGLE 
+# 561 "lex.fs"
+          )
+  | 39 -> ( 
+# 63 "lex.fsl"
+                            LBRACE 
+# 566 "lex.fs"
+          )
+  | 40 -> ( 
+# 64 "lex.fsl"
+                            RBRACE 
+# 571 "lex.fs"
+          )
+  | 41 -> ( 
+# 65 "lex.fsl"
+                            LPAREN 
+# 576 "lex.fs"
+          )
+  | 42 -> ( 
+# 66 "lex.fsl"
+                            RPAREN 
+# 581 "lex.fs"
+          )
+  | 43 -> ( 
+# 67 "lex.fsl"
+                            COMMA 
+# 586 "lex.fs"
+          )
+  | 44 -> ( 
+# 68 "lex.fsl"
+                            PLUS 
+# 591 "lex.fs"
+          )
+  | 45 -> ( 
+# 69 "lex.fsl"
+                            MINUS 
+# 596 "lex.fs"
+          )
+  | 46 -> ( 
+# 70 "lex.fsl"
+                            DIV 
+# 601 "lex.fs"
+          )
+  | 47 -> ( 
+# 71 "lex.fsl"
+                                               let s=lexeme lexbuf in STRING(s) 
+# 606 "lex.fs"
+          )
+  | 48 -> ( 
+# 72 "lex.fsl"
+                            BOOL(true) 
+# 611 "lex.fs"
+          )
+  | 49 -> ( 
+# 73 "lex.fsl"
+                            BOOL(false) 
+# 616 "lex.fs"
+          )
+  | 50 -> ( 
+# 74 "lex.fsl"
+                                                                        ID(lexeme lexbuf) 
+# 621 "lex.fs"
+          )
+  | 51 -> ( 
+# 75 "lex.fsl"
+                                 ID("_") 
+# 626 "lex.fs"
+          )
+  | 52 -> ( 
+# 76 "lex.fsl"
+                                      INT (Int32.Parse(lexeme lexbuf)) 
+# 631 "lex.fs"
+          )
+  | 53 -> ( 
+# 77 "lex.fsl"
+                                                               FLOAT (Double.Parse(lexeme lexbuf)) 
+# 636 "lex.fs"
+          )
+  | 54 -> ( 
+# 78 "lex.fsl"
+                         EOF 
+# 641 "lex.fs"
+          )
+  | 55 -> ( 
+# 79 "lex.fsl"
+                                     newline lexbuf; token lexbuf 
+# 646 "lex.fs"
+          )
+  | 56 -> ( 
+# 80 "lex.fsl"
+                        comment lexbuf 
+# 651 "lex.fs"
+          )
+  | _ -> failwith "token"
+(* Rule comment *)
+and comment  (lexbuf : Microsoft.FSharp.Text.Lexing.LexBuffer<_>) = _fslex_comment  0 lexbuf
+and _fslex_comment  _fslex_state lexbuf =
+  match _fslex_tables.Interpret(_fslex_state,lexbuf) with
+  | 0 -> ( 
+# 83 "lex.fsl"
+                            newline lexbuf; comment lexbuf 
+# 661 "lex.fs"
+          )
+  | 1 -> ( 
+# 84 "lex.fsl"
+                        token lexbuf 
+# 666 "lex.fs"
+          )
+  | 2 -> ( 
+# 85 "lex.fsl"
+                     comment lexbuf 
+# 671 "lex.fs"
+          )
+  | _ -> failwith "comment"
+
+# 87 "lex.fsl"
+
+# 3000000 "lex.fs"
diff --git a/tests/fsharp/regression/lucian-standalone-bug/lex.fsl b/tests/fsharp/regression/lucian-standalone-bug/lex.fsl
new file mode 100644
index 0000000..fb378f1
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/lex.fsl
@@ -0,0 +1,86 @@
+{
+
+module Lex
+open System
+open Pars
+open Lexing
+
+let inc_lnum bol pos = 
+  let lnum = pos.pos_lnum in 
+  {pos with pos_lnum =  lnum+1; pos_bol = bol }
+
+let newline lexbuf = 
+  lexbuf_set_curr_p lexbuf 
+    ( inc_lnum (lexeme_end lexbuf) (lexeme_end_p lexbuf))
+
+}
+
+let digit = ['0'-'9']
+let whitespace = [' ' '\t' ]
+let newline = ('\n' | '\r' '\n')
+let quote = '"'
+
+rule token = parse
+| whitespace	{ token lexbuf }
+| newline  { newline lexbuf; token lexbuf }
+| "activity"	 { ACTIVITY }
+| "if" { IF }
+| "type" { TYPE }
+| "class" { CLASS }
+| "enum" { ENUM }
+| "important" { IMPORTANT }
+| "unimportant" { UNIMPORTANT }
+| "new" { NEW }
+| "signal" { SIGNAL }
+| "then" { THEN }
+| "else" { ELSE }
+| "on" { ON }
+| "first" { FIRST }
+| "external" { EXTERNAL }
+| "call" { CALL }
+| "return" { RETURN }
+| "extern" { EXTERN }
+| "begin_read" { BEGINREAD }
+| "end_read" { ENDREAD }
+| "begin_write" { BEGINWRITE }
+| "end_write" { ENDWRITE }
+| "!"      { PLING }
+| "|"      { PAR }
+| "."      { DOT }
+| "*"      { STAR }
+| ";"      { SEMI }
+| "="      { EQUALS }
+| "=="     { EQEQUALS }
+| ":="     { COLONEQUALS }
+| "!="     { NOTEQUALS }
+| ">="     { ABOVEEQUALS }
+| "<="     { BELOWEQUALS }
+| "&&"     { AND }
+| "||"     { OR }
+| ":"      { COLON }
+| "<"      { LANGLE }
+| ">"      { RANGLE }
+| "{"      { LBRACE }
+| "}"      { RBRACE }
+| "("      { LPAREN }
+| ")"      { RPAREN }
+| ","      { COMMA }
+| "+"      { PLUS }
+| "-"      { MINUS }
+| "/"      { DIV }
+| (quote)[^ '"' '\n']+(quote) { let s=lexeme lexbuf in STRING(String.sub s 1 (String.length(s)-2)) }
+| "true"   { BOOL(true) }
+| "false"  { BOOL(false) }
+| ['a'-'z' 'A'-'Z' '_'] ['a'-'z' 'A'-'Z' '_' '0'-'9']* { ID(lexeme lexbuf) }
+| "_"           { ID("_") }
+| ['-']?digit+       { INT (Int32.Parse(lexeme lexbuf)) }
+| ['-']?digit+('.'digit+)?(['e''E']digit+)?   { FLOAT (Double.Parse(lexeme lexbuf)) }
+| eof   { EOF }
+| "//"[^'\n']*'\n' {  newline lexbuf; token lexbuf }
+| "/*" { comment lexbuf }
+
+and comment = parse
+| newline  { newline lexbuf; comment lexbuf }
+| "*/" { token lexbuf }
+| _ { comment lexbuf }
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/lexing.fs b/tests/fsharp/regression/lucian-standalone-bug/lexing.fs
new file mode 100644
index 0000000..e05012c
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/lexing.fs
@@ -0,0 +1,67 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//
+//=========================================================================
+
+module Lexing
+
+open Microsoft.FSharp.Text.Lexing
+open System.IO
+open System.Text
+
+type position = Position  
+
+type lexbuf =  LexBuffer<byte>
+
+let from_function (f: byte[] -> int -> int)  = 
+    LexBuffer<byte>.FromByteFunction f
+
+
+let from_text_reader (enc: System.Text.Encoding) (tr: TextReader) =
+  LexBuffer<byte>.FromFunction (fun (bytebuf,start,len) ->
+    /// Don't read too many characters!
+    let lenc = (len * 99) / enc.GetMaxByteCount(100) 
+    let charbuf : char[] = Array.zeroCreate lenc 
+    let nRead = tr.Read(charbuf,start,lenc) 
+    if nRead = 0 then 0 
+    else enc.GetBytes(charbuf,0,nRead,bytebuf,start))
+                 
+let defaultEncoding =
+#if FX_NO_DEFAULT_ENCODING
+        Encoding.UTF8
+#else
+        Encoding.Default
+#endif
+
+let from_channel (is:TextReader)  = from_text_reader defaultEncoding is
+
+let from_bytearray s  = 
+    LexBuffer<byte>.FromBytes(s)
+
+#if FX_NO_ASCII_ENCODING
+let from_string s  = from_channel (new StringReader(s))
+#else
+let from_string s  = from_bytearray (System.Text.Encoding.ASCII.GetBytes(s:string))
+#endif
+
+let from_binary_reader (sr: BinaryReader)  = LexBuffer<byte>.FromFunction(sr.Read)
+
+let lexeme_char (lb:lexbuf) n =  char (int32 (lb.LexemeChar n))
+let lexeme_start_p (lb:lexbuf) = lb.StartPos
+let lexeme_end_p (lb:lexbuf) = lb.EndPos
+let lexeme_start (lb:lexbuf) = (lexeme_start_p lb).pos_cnum
+let lexeme_end (lb:lexbuf) = (lexeme_end_p lb).pos_cnum
+#if FX_NO_ASCII_ENCODING
+let lexeme_utf8 (lb:lexbuf) = System.Text.Encoding.UTF8.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+#else
+let lexeme (lb:lexbuf) = System.Text.Encoding.ASCII.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+let lexeme_utf8 (lb:lexbuf) = System.Text.Encoding.UTF8.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+#endif
+
+let lexeme_bytes (lb:lexbuf) = lb.Lexeme
+let flush_input (lb: lexbuf) = lb.DiscardInput ()
+
+
+let lexbuf_curr_p lb = lexeme_end_p lb
+let lexbuf_set_curr_p (lb:lexbuf) (p : position) = lb.EndPos  <- p
+let lexbuf_set_start_p (lb:lexbuf) (p : position) = lb.StartPos <- p
diff --git a/tests/fsharp/regression/lucian-standalone-bug/make.bat b/tests/fsharp/regression/lucian-standalone-bug/make.bat
new file mode 100644
index 0000000..21af6ed
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/make.bat
@@ -0,0 +1,14 @@
+ at setlocal
+ at if "%FSHARP_HOME%"=="" ( set FSHARP_HOME=c:\program files\fsharp-1.1.10.4)
+ at if "%FSC%"=="" ( set FSC=%FSCBinPath%\fsc.exe)
+ at if "%FSYACC%"=="" ( set FSYACC=%FSCBinPath%\fsyacc.exe)
+ at if "%FSLEX%"=="" ( set FSLEX=%FSCBinPath%\fslex.exe)
+"%FSLEX%" --light-off -o lex.fs lex.fsl
+ at if ERRORLEVEL 1 goto Exit
+"%FSYACC%" --light-off -o pars.fs pars.fsy
+ at if ERRORLEVEL 1 goto Exit
+"%FSC%" --standalone -g -r:Microsoft.GLEE.dll -r:Microsoft.GLEE.Drawing.dll -r:Microsoft.GLEE.GraphViewerGDI.dll -r:Microsoft.GLEE.IGraphViewer.dll -r:Microsoft.GLEE.Splines.dll -r:AsmL.Tools.Algos.SimplexMethod.dll -r:AsmL.Tools.Algos.SimplexMethodOpt.Tableu.dll -o:checkmri.exe utils.fs ast.fs pars.fs lex.fs states.fs analysis.fs test.fs checkmri.fs
+ at if ERRORLEVEL 1 goto Exit
+:Exit
+ at endlocal
+ at exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/lucian-standalone-bug/pars.fs b/tests/fsharp/regression/lucian-standalone-bug/pars.fs
new file mode 100644
index 0000000..a313c00
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/pars.fs
@@ -0,0 +1,1804 @@
+// Implementation file for parser generated by fsyacc
+#light "off"
+module Pars
+#nowarn "64";; // turn off warnings that type variables used in production annotations are instantiated to concrete type
+open Microsoft.FSharp.Text.Lexing
+open Microsoft.FSharp.Text.Parsing.ParseHelpers
+# 1 "pars.fsy"
+
+
+open Ast
+
+type StringOrList = {asstring:string; aslist:string list}
+
+
+# 15 "pars.fs"
+// This type is the type of tokens accepted by the parser
+type token = 
+  | EOF
+  | LBRACE
+  | RBRACE
+  | SEMI
+  | LPAREN
+  | RPAREN
+  | COLON
+  | DOT
+  | LANGLE
+  | RANGLE
+  | COMMA
+  | STAR
+  | PAR
+  | PLUS
+  | MINUS
+  | DIV
+  | EQUALS
+  | EQEQUALS
+  | NOTEQUALS
+  | AND
+  | OR
+  | ABOVEEQUALS
+  | BELOWEQUALS
+  | COLONEQUALS
+  | PLING
+  | ACTIVITY
+  | IF
+  | CALL
+  | EXTERNAL
+  | TYPE
+  | CLASS
+  | ENUM
+  | IMPORTANT
+  | UNIMPORTANT
+  | NEW
+  | SIGNAL
+  | THEN
+  | ELSE
+  | ON
+  | FIRST
+  | RETURN
+  | EXTERN
+  | BEGINREAD
+  | ENDREAD
+  | BEGINWRITE
+  | ENDWRITE
+  | BOOL of (bool)
+  | STRING of (string)
+  | FLOAT of (System.Double)
+  | INT of (System.Int32)
+  | ID of (string)
+// This type is used to give symbolic names to token indexes, useful for error messages
+type tokenId = 
+    | TOKEN_EOF
+    | TOKEN_LBRACE
+    | TOKEN_RBRACE
+    | TOKEN_SEMI
+    | TOKEN_LPAREN
+    | TOKEN_RPAREN
+    | TOKEN_COLON
+    | TOKEN_DOT
+    | TOKEN_LANGLE
+    | TOKEN_RANGLE
+    | TOKEN_COMMA
+    | TOKEN_STAR
+    | TOKEN_PAR
+    | TOKEN_PLUS
+    | TOKEN_MINUS
+    | TOKEN_DIV
+    | TOKEN_EQUALS
+    | TOKEN_EQEQUALS
+    | TOKEN_NOTEQUALS
+    | TOKEN_AND
+    | TOKEN_OR
+    | TOKEN_ABOVEEQUALS
+    | TOKEN_BELOWEQUALS
+    | TOKEN_COLONEQUALS
+    | TOKEN_PLING
+    | TOKEN_ACTIVITY
+    | TOKEN_IF
+    | TOKEN_CALL
+    | TOKEN_EXTERNAL
+    | TOKEN_TYPE
+    | TOKEN_CLASS
+    | TOKEN_ENUM
+    | TOKEN_IMPORTANT
+    | TOKEN_UNIMPORTANT
+    | TOKEN_NEW
+    | TOKEN_SIGNAL
+    | TOKEN_THEN
+    | TOKEN_ELSE
+    | TOKEN_ON
+    | TOKEN_FIRST
+    | TOKEN_RETURN
+    | TOKEN_EXTERN
+    | TOKEN_BEGINREAD
+    | TOKEN_ENDREAD
+    | TOKEN_BEGINWRITE
+    | TOKEN_ENDWRITE
+    | TOKEN_BOOL
+    | TOKEN_STRING
+    | TOKEN_FLOAT
+    | TOKEN_INT
+    | TOKEN_ID
+    | TOKEN_end_of_input
+    | TOKEN_error
+// This type is used to give symbolic names to token indexes, useful for error messages
+type nonTerminalId = 
+    | NONTERM__startstart
+    | NONTERM__startExpr
+    | NONTERM_start
+    | NONTERM_TypeOrActivityList
+    | NONTERM_TypeOrActivity
+    | NONTERM_FieldList
+    | NONTERM_Field
+    | NONTERM_EnumList
+    | NONTERM_TypeList
+    | NONTERM_ImpId
+    | NONTERM_StateOrHandlerList
+    | NONTERM_StateOrHandler
+    | NONTERM_NodeList
+    | NONTERM_Node
+    | NONTERM_ExprNode
+    | NONTERM_OtherNode
+    | NONTERM_IdList
+    | NONTERM_ArgList
+    | NONTERM_Arg
+    | NONTERM_IdPath
+    | NONTERM_Atomic
+    | NONTERM_Wires
+    | NONTERM_WireList
+    | NONTERM_Wire
+    | NONTERM_IfList
+    | NONTERM_CondAndConsequence
+    | NONTERM_Consequence
+    | NONTERM_IfTypeList
+    | NONTERM_TypeCondAndConsequence
+    | NONTERM_TypeConsequence
+    | NONTERM_Expr
+    | NONTERM_ExprList
+    | NONTERM_AssignList
+
+// This function maps tokens to integers indexes
+let tagOfToken (t:token) = 
+  match t with
+  | EOF  -> 0 
+  | LBRACE  -> 1 
+  | RBRACE  -> 2 
+  | SEMI  -> 3 
+  | LPAREN  -> 4 
+  | RPAREN  -> 5 
+  | COLON  -> 6 
+  | DOT  -> 7 
+  | LANGLE  -> 8 
+  | RANGLE  -> 9 
+  | COMMA  -> 10 
+  | STAR  -> 11 
+  | PAR  -> 12 
+  | PLUS  -> 13 
+  | MINUS  -> 14 
+  | DIV  -> 15 
+  | EQUALS  -> 16 
+  | EQEQUALS  -> 17 
+  | NOTEQUALS  -> 18 
+  | AND  -> 19 
+  | OR  -> 20 
+  | ABOVEEQUALS  -> 21 
+  | BELOWEQUALS  -> 22 
+  | COLONEQUALS  -> 23 
+  | PLING  -> 24 
+  | ACTIVITY  -> 25 
+  | IF  -> 26 
+  | CALL  -> 27 
+  | EXTERNAL  -> 28 
+  | TYPE  -> 29 
+  | CLASS  -> 30 
+  | ENUM  -> 31 
+  | IMPORTANT  -> 32 
+  | UNIMPORTANT  -> 33 
+  | NEW  -> 34 
+  | SIGNAL  -> 35 
+  | THEN  -> 36 
+  | ELSE  -> 37 
+  | ON  -> 38 
+  | FIRST  -> 39 
+  | RETURN  -> 40 
+  | EXTERN  -> 41 
+  | BEGINREAD  -> 42 
+  | ENDREAD  -> 43 
+  | BEGINWRITE  -> 44 
+  | ENDWRITE  -> 45 
+  | BOOL _ -> 46 
+  | STRING _ -> 47 
+  | FLOAT _ -> 48 
+  | INT _ -> 49 
+  | ID _ -> 50 
+
+// This function maps integers indexes to symbolic token ids
+let tokenTagToTokenId (tokenIdx:int) = 
+  match tokenIdx with
+  | 0 -> TOKEN_EOF 
+  | 1 -> TOKEN_LBRACE 
+  | 2 -> TOKEN_RBRACE 
+  | 3 -> TOKEN_SEMI 
+  | 4 -> TOKEN_LPAREN 
+  | 5 -> TOKEN_RPAREN 
+  | 6 -> TOKEN_COLON 
+  | 7 -> TOKEN_DOT 
+  | 8 -> TOKEN_LANGLE 
+  | 9 -> TOKEN_RANGLE 
+  | 10 -> TOKEN_COMMA 
+  | 11 -> TOKEN_STAR 
+  | 12 -> TOKEN_PAR 
+  | 13 -> TOKEN_PLUS 
+  | 14 -> TOKEN_MINUS 
+  | 15 -> TOKEN_DIV 
+  | 16 -> TOKEN_EQUALS 
+  | 17 -> TOKEN_EQEQUALS 
+  | 18 -> TOKEN_NOTEQUALS 
+  | 19 -> TOKEN_AND 
+  | 20 -> TOKEN_OR 
+  | 21 -> TOKEN_ABOVEEQUALS 
+  | 22 -> TOKEN_BELOWEQUALS 
+  | 23 -> TOKEN_COLONEQUALS 
+  | 24 -> TOKEN_PLING 
+  | 25 -> TOKEN_ACTIVITY 
+  | 26 -> TOKEN_IF 
+  | 27 -> TOKEN_CALL 
+  | 28 -> TOKEN_EXTERNAL 
+  | 29 -> TOKEN_TYPE 
+  | 30 -> TOKEN_CLASS 
+  | 31 -> TOKEN_ENUM 
+  | 32 -> TOKEN_IMPORTANT 
+  | 33 -> TOKEN_UNIMPORTANT 
+  | 34 -> TOKEN_NEW 
+  | 35 -> TOKEN_SIGNAL 
+  | 36 -> TOKEN_THEN 
+  | 37 -> TOKEN_ELSE 
+  | 38 -> TOKEN_ON 
+  | 39 -> TOKEN_FIRST 
+  | 40 -> TOKEN_RETURN 
+  | 41 -> TOKEN_EXTERN 
+  | 42 -> TOKEN_BEGINREAD 
+  | 43 -> TOKEN_ENDREAD 
+  | 44 -> TOKEN_BEGINWRITE 
+  | 45 -> TOKEN_ENDWRITE 
+  | 46 -> TOKEN_BOOL 
+  | 47 -> TOKEN_STRING 
+  | 48 -> TOKEN_FLOAT 
+  | 49 -> TOKEN_INT 
+  | 50 -> TOKEN_ID 
+  | 53 -> TOKEN_end_of_input
+  | 51 -> TOKEN_error
+  | _ -> failwith "tokenTagToTokenId: bad token"
+
+/// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production
+let prodIdxToNonTerminal (prodIdx:int) = 
+  match prodIdx with
+    | 0 -> NONTERM__startstart 
+    | 1 -> NONTERM__startExpr 
+    | 2 -> NONTERM_start 
+    | 3 -> NONTERM_TypeOrActivityList 
+    | 4 -> NONTERM_TypeOrActivityList 
+    | 5 -> NONTERM_TypeOrActivity 
+    | 6 -> NONTERM_TypeOrActivity 
+    | 7 -> NONTERM_TypeOrActivity 
+    | 8 -> NONTERM_TypeOrActivity 
+    | 9 -> NONTERM_TypeOrActivity 
+    | 10 -> NONTERM_TypeOrActivity 
+    | 11 -> NONTERM_TypeOrActivity 
+    | 12 -> NONTERM_TypeOrActivity 
+    | 13 -> NONTERM_FieldList 
+    | 14 -> NONTERM_FieldList 
+    | 15 -> NONTERM_Field 
+    | 16 -> NONTERM_EnumList 
+    | 17 -> NONTERM_EnumList 
+    | 18 -> NONTERM_TypeList 
+    | 19 -> NONTERM_TypeList 
+    | 20 -> NONTERM_TypeList 
+    | 21 -> NONTERM_ImpId 
+    | 22 -> NONTERM_ImpId 
+    | 23 -> NONTERM_StateOrHandlerList 
+    | 24 -> NONTERM_StateOrHandlerList 
+    | 25 -> NONTERM_StateOrHandler 
+    | 26 -> NONTERM_StateOrHandler 
+    | 27 -> NONTERM_StateOrHandler 
+    | 28 -> NONTERM_NodeList 
+    | 29 -> NONTERM_NodeList 
+    | 30 -> NONTERM_NodeList 
+    | 31 -> NONTERM_NodeList 
+    | 32 -> NONTERM_Node 
+    | 33 -> NONTERM_Node 
+    | 34 -> NONTERM_ExprNode 
+    | 35 -> NONTERM_ExprNode 
+    | 36 -> NONTERM_OtherNode 
+    | 37 -> NONTERM_OtherNode 
+    | 38 -> NONTERM_OtherNode 
+    | 39 -> NONTERM_OtherNode 
+    | 40 -> NONTERM_OtherNode 
+    | 41 -> NONTERM_OtherNode 
+    | 42 -> NONTERM_OtherNode 
+    | 43 -> NONTERM_OtherNode 
+    | 44 -> NONTERM_OtherNode 
+    | 45 -> NONTERM_OtherNode 
+    | 46 -> NONTERM_OtherNode 
+    | 47 -> NONTERM_OtherNode 
+    | 48 -> NONTERM_OtherNode 
+    | 49 -> NONTERM_IdList 
+    | 50 -> NONTERM_IdList 
+    | 51 -> NONTERM_ArgList 
+    | 52 -> NONTERM_ArgList 
+    | 53 -> NONTERM_ArgList 
+    | 54 -> NONTERM_Arg 
+    | 55 -> NONTERM_Arg 
+    | 56 -> NONTERM_IdPath 
+    | 57 -> NONTERM_IdPath 
+    | 58 -> NONTERM_Atomic 
+    | 59 -> NONTERM_Atomic 
+    | 60 -> NONTERM_Atomic 
+    | 61 -> NONTERM_Atomic 
+    | 62 -> NONTERM_Wires 
+    | 63 -> NONTERM_Wires 
+    | 64 -> NONTERM_WireList 
+    | 65 -> NONTERM_WireList 
+    | 66 -> NONTERM_WireList 
+    | 67 -> NONTERM_Wire 
+    | 68 -> NONTERM_Wire 
+    | 69 -> NONTERM_IfList 
+    | 70 -> NONTERM_IfList 
+    | 71 -> NONTERM_IfList 
+    | 72 -> NONTERM_CondAndConsequence 
+    | 73 -> NONTERM_Consequence 
+    | 74 -> NONTERM_IfTypeList 
+    | 75 -> NONTERM_IfTypeList 
+    | 76 -> NONTERM_IfTypeList 
+    | 77 -> NONTERM_TypeCondAndConsequence 
+    | 78 -> NONTERM_TypeConsequence 
+    | 79 -> NONTERM_Expr 
+    | 80 -> NONTERM_Expr 
+    | 81 -> NONTERM_Expr 
+    | 82 -> NONTERM_Expr 
+    | 83 -> NONTERM_Expr 
+    | 84 -> NONTERM_Expr 
+    | 85 -> NONTERM_Expr 
+    | 86 -> NONTERM_Expr 
+    | 87 -> NONTERM_Expr 
+    | 88 -> NONTERM_Expr 
+    | 89 -> NONTERM_Expr 
+    | 90 -> NONTERM_Expr 
+    | 91 -> NONTERM_Expr 
+    | 92 -> NONTERM_Expr 
+    | 93 -> NONTERM_Expr 
+    | 94 -> NONTERM_Expr 
+    | 95 -> NONTERM_Expr 
+    | 96 -> NONTERM_Expr 
+    | 97 -> NONTERM_Expr 
+    | 98 -> NONTERM_Expr 
+    | 99 -> NONTERM_Expr 
+    | 100 -> NONTERM_Expr 
+    | 101 -> NONTERM_Expr 
+    | 102 -> NONTERM_ExprList 
+    | 103 -> NONTERM_ExprList 
+    | 104 -> NONTERM_ExprList 
+    | 105 -> NONTERM_AssignList 
+    | 106 -> NONTERM_AssignList 
+    | 107 -> NONTERM_AssignList 
+    | _ -> failwith "prodIdxToNonTerminal: bad production index"
+
+let _fsyacc_endOfInputTag = 53 
+let _fsyacc_tagOfErrorTerminal = 51
+
+// This function gets the name of a token as a string
+let token_to_string (t:token) = 
+  match t with 
+  | EOF  -> "EOF" 
+  | LBRACE  -> "LBRACE" 
+  | RBRACE  -> "RBRACE" 
+  | SEMI  -> "SEMI" 
+  | LPAREN  -> "LPAREN" 
+  | RPAREN  -> "RPAREN" 
+  | COLON  -> "COLON" 
+  | DOT  -> "DOT" 
+  | LANGLE  -> "LANGLE" 
+  | RANGLE  -> "RANGLE" 
+  | COMMA  -> "COMMA" 
+  | STAR  -> "STAR" 
+  | PAR  -> "PAR" 
+  | PLUS  -> "PLUS" 
+  | MINUS  -> "MINUS" 
+  | DIV  -> "DIV" 
+  | EQUALS  -> "EQUALS" 
+  | EQEQUALS  -> "EQEQUALS" 
+  | NOTEQUALS  -> "NOTEQUALS" 
+  | AND  -> "AND" 
+  | OR  -> "OR" 
+  | ABOVEEQUALS  -> "ABOVEEQUALS" 
+  | BELOWEQUALS  -> "BELOWEQUALS" 
+  | COLONEQUALS  -> "COLONEQUALS" 
+  | PLING  -> "PLING" 
+  | ACTIVITY  -> "ACTIVITY" 
+  | IF  -> "IF" 
+  | CALL  -> "CALL" 
+  | EXTERNAL  -> "EXTERNAL" 
+  | TYPE  -> "TYPE" 
+  | CLASS  -> "CLASS" 
+  | ENUM  -> "ENUM" 
+  | IMPORTANT  -> "IMPORTANT" 
+  | UNIMPORTANT  -> "UNIMPORTANT" 
+  | NEW  -> "NEW" 
+  | SIGNAL  -> "SIGNAL" 
+  | THEN  -> "THEN" 
+  | ELSE  -> "ELSE" 
+  | ON  -> "ON" 
+  | FIRST  -> "FIRST" 
+  | RETURN  -> "RETURN" 
+  | EXTERN  -> "EXTERN" 
+  | BEGINREAD  -> "BEGINREAD" 
+  | ENDREAD  -> "ENDREAD" 
+  | BEGINWRITE  -> "BEGINWRITE" 
+  | ENDWRITE  -> "ENDWRITE" 
+  | BOOL _ -> "BOOL" 
+  | STRING _ -> "STRING" 
+  | FLOAT _ -> "FLOAT" 
+  | INT _ -> "INT" 
+  | ID _ -> "ID" 
+
+// This function gets the data carried by a token as an object
+let _fsyacc_dataOfToken (t:token) = 
+  match t with 
+  | EOF  -> (null : System.Object) 
+  | LBRACE  -> (null : System.Object) 
+  | RBRACE  -> (null : System.Object) 
+  | SEMI  -> (null : System.Object) 
+  | LPAREN  -> (null : System.Object) 
+  | RPAREN  -> (null : System.Object) 
+  | COLON  -> (null : System.Object) 
+  | DOT  -> (null : System.Object) 
+  | LANGLE  -> (null : System.Object) 
+  | RANGLE  -> (null : System.Object) 
+  | COMMA  -> (null : System.Object) 
+  | STAR  -> (null : System.Object) 
+  | PAR  -> (null : System.Object) 
+  | PLUS  -> (null : System.Object) 
+  | MINUS  -> (null : System.Object) 
+  | DIV  -> (null : System.Object) 
+  | EQUALS  -> (null : System.Object) 
+  | EQEQUALS  -> (null : System.Object) 
+  | NOTEQUALS  -> (null : System.Object) 
+  | AND  -> (null : System.Object) 
+  | OR  -> (null : System.Object) 
+  | ABOVEEQUALS  -> (null : System.Object) 
+  | BELOWEQUALS  -> (null : System.Object) 
+  | COLONEQUALS  -> (null : System.Object) 
+  | PLING  -> (null : System.Object) 
+  | ACTIVITY  -> (null : System.Object) 
+  | IF  -> (null : System.Object) 
+  | CALL  -> (null : System.Object) 
+  | EXTERNAL  -> (null : System.Object) 
+  | TYPE  -> (null : System.Object) 
+  | CLASS  -> (null : System.Object) 
+  | ENUM  -> (null : System.Object) 
+  | IMPORTANT  -> (null : System.Object) 
+  | UNIMPORTANT  -> (null : System.Object) 
+  | NEW  -> (null : System.Object) 
+  | SIGNAL  -> (null : System.Object) 
+  | THEN  -> (null : System.Object) 
+  | ELSE  -> (null : System.Object) 
+  | ON  -> (null : System.Object) 
+  | FIRST  -> (null : System.Object) 
+  | RETURN  -> (null : System.Object) 
+  | EXTERN  -> (null : System.Object) 
+  | BEGINREAD  -> (null : System.Object) 
+  | ENDREAD  -> (null : System.Object) 
+  | BEGINWRITE  -> (null : System.Object) 
+  | ENDWRITE  -> (null : System.Object) 
+  | BOOL _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
+  | STRING _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
+  | FLOAT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
+  | INT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
+  | ID _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x 
+let _fsyacc_gotos = [| 0us; 65535us; 0us; 65535us; 1us; 65535us; 0us; 1us; 2us; 65535us; 0us; 4us; 6us; 7us; 2us; 65535us; 0us; 6us; 6us; 6us; 2us; 65535us; 10us; 11us; 49us; 50us; 2us; 65535us; 10us; 49us; 49us; 49us; 1us; 65535us; 15us; 16us; 18us; 65535us; 20us; 21us; 31us; 70us; 34us; 35us; 36us; 70us; 41us; 70us; 44us; 45us; 46us; 70us; 58us; 59us; 60us; 61us; 68us; 70us; 81us; 82us; 83us; 96us; 86us; 96us; 91us; 96us; 192us; 95us; 200us; 95us; 204us; 95us; 212us; 95us; 19us; 65535u [...]
+let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 2us; 4us; 7us; 10us; 13us; 16us; 18us; 37us; 57us; 63us; 69us; 73us; 77us; 85us; 89us; 93us; 96us; 99us; 136us; 139us; 150us; 153us; 157us; 160us; 163us; 166us; 169us; 172us; 175us; 211us; 214us; |]
+let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 13us; 1us; 80us; 81us; 82us; 83us; 84us; 85us; 86us; 87us; 88us; 89us; 90us; 91us; 1us; 2us; 1us; 2us; 1us; 4us; 1us; 4us; 1us; 5us; 1us; 5us; 1us; 5us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 2us; 6us; 17us; 1us; 6us; 1us; 7us; 1us; 7us; 1us; 7us; 1us; 7us; 3us; 8us; 11us; 12us; 1us; 8us; 1us; 8us; 1us; 8us; 1us; 8us; 1us; 8us; 1us; 8us; 2us; 9us; 10us; 2us; 9us; 10us; 1us; 9us; 1us; 9us; 1us; 9us; 1us [...]
+let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 34us; 36us; 38us; 40us; 42us; 44us; 47us; 49us; 51us; 53us; 55us; 57us; 61us; 63us; 65us; 67us; 69us; 71us; 73us; 76us; 79us; 81us; 83us; 85us; 87us; 89us; 91us; 93us; 95us; 98us; 101us; 103us; 105us; 107us; 109us; 111us; 113us; 115us; 117us; 119us; 121us; 123us; 125us; 127us; 129us; 131us; 133us; 136us; 138us; 140us; 142us; 144us; 146us; 148us; 150us; 152us; 155us; 162us; 164us;  [...]
+let _fsyacc_action_rows = 270
+let _fsyacc_actionTableElements = [|5us; 16387us; 25us; 29us; 29us; 18us; 30us; 8us; 31us; 13us; 41us; 22us; 0us; 49152us; 11us; 32768us; 4us; 215us; 14us; 253us; 24us; 248us; 28us; 249us; 32us; 262us; 33us; 263us; 34us; 257us; 46us; 255us; 47us; 256us; 49us; 254us; 50us; 172us; 12us; 49152us; 8us; 240us; 9us; 241us; 11us; 238us; 13us; 236us; 14us; 237us; 15us; 239us; 17us; 242us; 18us; 243us; 19us; 246us; 20us; 247us; 21us; 244us; 22us; 245us; 1us; 32768us; 0us; 5us; 0us; 16386us; 5us;  [...]
+let _fsyacc_actionTableRowOffsets = [|0us; 6us; 7us; 19us; 32us; 34us; 35us; 41us; 42us; 44us; 46us; 48us; 50us; 51us; 53us; 55us; 57us; 60us; 61us; 63us; 65us; 69us; 70us; 73us; 75us; 77us; 79us; 81us; 83us; 84us; 86us; 89us; 94us; 96us; 97us; 101us; 103us; 108us; 110us; 111us; 113us; 116us; 121us; 123us; 124us; 128us; 130us; 135us; 137us; 138us; 140us; 141us; 143us; 145us; 146us; 147us; 149us; 150us; 152us; 156us; 157us; 161us; 163us; 164us; 166us; 167us; 168us; 170us; 172us; 177us; 17 [...]
+let _fsyacc_reductionSymbolCounts = [|1us; 1us; 2us; 0us; 2us; 5us; 5us; 4us; 7us; 5us; 7us; 6us; 8us; 0us; 2us; 3us; 1us; 3us; 1us; 3us; 3us; 2us; 1us; 0us; 2us; 5us; 11us; 9us; 0us; 1us; 1us; 3us; 1us; 1us; 5us; 4us; 8us; 7us; 7us; 6us; 11us; 10us; 8us; 3us; 3us; 8us; 7us; 3us; 3us; 1us; 3us; 0us; 1us; 3us; 1us; 2us; 1us; 3us; 1us; 1us; 1us; 1us; 0us; 3us; 0us; 1us; 3us; 1us; 2us; 1us; 4us; 3us; 5us; 1us; 1us; 4us; 3us; 7us; 1us; 3us; 3us; 3us; 3us; 3us; 3us; 3us; 3us; 3us; 3us; 3us; 3 [...]
+let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 3us; 3us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 4us; 5us; 5us; 6us; 7us; 7us; 8us; 8us; 8us; 9us; 9us; 10us; 10us; 11us; 11us; 11us; 12us; 12us; 12us; 12us; 13us; 13us; 14us; 14us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 15us; 16us; 16us; 17us; 17us; 17us; 18us; 18us; 19us; 19us; 20us; 20us; 20us; 20us; 21us; 21us; 22us; 22us; 22us; 23us; 23us; 24us; 24us; 24us; 25us; 26us; 27us; 27us; 27us; 28us; 29 [...]
+let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 65535us; 65535us; 16386us; 65535us; 16388us; 65535us; 65535us; 65535us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 16390us; 65535us; 65535us; 65535us; 16391us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16392us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 65535us; 65535us; 65535us; 16394us; 65535us; 65535us; 65535us; 65535us; 16395us; 65535us; 65535us; 65535us; 65535us; 16396us; 65535us; 16398us;  [...]
+let _fsyacc_reductions ()  =    [| 
+# 509 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  TDefPrim list * TDefChoice list * ExternFun list * Activity list )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+                      raise (Microsoft.FSharp.Text.Parsing.Accept(Microsoft.FSharp.Core.Operators.box _1))
+                   )
+                 : '_startstart));
+# 518 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+                      raise (Microsoft.FSharp.Text.Parsing.Accept(Microsoft.FSharp.Core.Operators.box _1))
+                   )
+                 : '_startExpr));
+# 527 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeOrActivityList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 40 "pars.fsy"
+                                                     _1 
+                   )
+# 40 "pars.fsy"
+                 :  TDefPrim list * TDefChoice list * ExternFun list * Activity list ));
+# 538 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 43 "pars.fsy"
+                                           ([("void",TVoid);("int",TInt);("bool",TBool);("string",TString);("readwrite",TRecord[("rcount","int");("wcount","int")])],[],[],[]) 
+                   )
+# 43 "pars.fsy"
+                 : 'TypeOrActivityList));
+# 548 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeOrActivity)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeOrActivityList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 44 "pars.fsy"
+                                                             match (_1,_2) with ((tp1,tc1,ef1,a1),(tp2,tc2,ef2,a2)) -> (tp1 at tp2, tc1 at tc2, ef1 at ef2, a1 at a2) 
+                   )
+# 44 "pars.fsy"
+                 : 'TypeOrActivityList));
+# 560 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'FieldList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 45 "pars.fsy"
+                                                                        let tp=(_2,TRecord(_4)) in ([tp],[],[],[]) 
+                   )
+# 45 "pars.fsy"
+                 : 'TypeOrActivity));
+# 572 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'EnumList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 46 "pars.fsy"
+                                                            let tp=(_2,TEnum(_4)) in ([tp],[],[],[]) 
+                   )
+# 46 "pars.fsy"
+                 : 'TypeOrActivity));
+# 584 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 47 "pars.fsy"
+                                                     let tc=(_2,_4) in ([],[tc],[],[]) 
+                   )
+# 47 "pars.fsy"
+                 : 'TypeOrActivity));
+# 596 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'ArgList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 48 "pars.fsy"
+                                                                      let ef=(_3, {new ExternFunDat with ats=_5 and rt=_2}) in ([],[],[ef],[]) 
+                   )
+# 48 "pars.fsy"
+                 : 'TypeOrActivity));
+# 609 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'StateOrHandlerList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 49 "pars.fsy"
+                                                                          let a = match _4 with (state,h) -> {new Ast.Activity with s=_2 and state=state and signal=[] and h=h and ext=false} in ([],[],[],[a]) 
+                   )
+# 49 "pars.fsy"
+                 : 'TypeOrActivity));
+# 621 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _6 = (let data = parseState.GetInput(6) in (Microsoft.FSharp.Core.Operators.unbox data : 'StateOrHandlerList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 50 "pars.fsy"
+                                                                                         let a = match _6 with (state,h) -> {new Ast.Activity with s=_2 and state=state and signal=_4 and h=h and ext=false} in ([],[],[],[a]) 
+                   )
+# 50 "pars.fsy"
+                 : 'TypeOrActivity));
+# 634 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'StateOrHandlerList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 51 "pars.fsy"
+                                                                                 let a = match _5 with (state,h) -> {new Ast.Activity with s=_3 and state=state and signal=[] and h=h and ext=true} in ([],[],[],[a]) 
+                   )
+# 51 "pars.fsy"
+                 : 'TypeOrActivity));
+# 646 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data : 'StateOrHandlerList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 52 "pars.fsy"
+                                                                                                let a = match _7 with (state,h) -> {new Ast.Activity with s=_3 and state=state and signal=_5 and h=h and ext=true} in ([],[],[],[a]) 
+                   )
+# 52 "pars.fsy"
+                 : 'TypeOrActivity));
+# 659 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 54 "pars.fsy"
+                                  [] 
+                   )
+# 54 "pars.fsy"
+                 : 'FieldList));
+# 669 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Field)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'FieldList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 55 "pars.fsy"
+                                            _1 :: _2 
+                   )
+# 55 "pars.fsy"
+                 : 'FieldList));
+# 681 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 56 "pars.fsy"
+                                         (_2,_1) 
+                   )
+# 56 "pars.fsy"
+                 : 'Field));
+# 693 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 57 "pars.fsy"
+                                    [_1] 
+                   )
+# 57 "pars.fsy"
+                 : 'EnumList));
+# 704 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'EnumList)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 58 "pars.fsy"
+                                             _1 @ [_3] 
+                   )
+# 58 "pars.fsy"
+                 : 'EnumList));
+# 716 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  string*Importance )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 59 "pars.fsy"
+                                       [_1] 
+                   )
+# 59 "pars.fsy"
+                 : 'TypeList));
+# 727 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  string*Importance )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 60 "pars.fsy"
+                                               _1 :: _3 
+                   )
+# 60 "pars.fsy"
+                 : 'TypeList));
+# 739 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 61 "pars.fsy"
+                                                  _2 
+                   )
+# 61 "pars.fsy"
+                 : 'TypeList));
+# 750 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 62 "pars.fsy"
+                                           (_2,Important) 
+                   )
+# 62 "pars.fsy"
+                 :  string*Importance ));
+# 761 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 63 "pars.fsy"
+                              (_1,Unimportant) 
+                   )
+# 63 "pars.fsy"
+                 :  string*Importance ));
+# 772 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 65 "pars.fsy"
+                                           ([],[]) 
+                   )
+# 65 "pars.fsy"
+                 : 'StateOrHandlerList));
+# 782 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  (string*Expr)list * (string*Handler)list )) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'StateOrHandlerList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 66 "pars.fsy"
+                                                             match (_1,_2) with ((st1,h1),(st2,h2)) -> (st1 at st2,h1 at h2) 
+                   )
+# 66 "pars.fsy"
+                 : 'StateOrHandlerList));
+# 794 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 67 "pars.fsy"
+                                                                    let st=(_2, {_4 with t=_1}) in ([st],[]) 
+                   )
+# 67 "pars.fsy"
+                 :  (string*Expr)list * (string*Handler)list ));
+# 807 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  string*Importance )) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wire)) in
+            let _8 = (let data = parseState.GetInput(8) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _10 = (let data = parseState.GetInput(10) in (Microsoft.FSharp.Core.Operators.unbox data : 'NodeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 68 "pars.fsy"
+                                                                                                match _5 with (a,q) -> let h=(_2,{new Handler with a=a and aq=q and at=_4 and outWires=[] and rt=_8 and n=_10}) in ([],[h]) 
+                   )
+# 68 "pars.fsy"
+                 :  (string*Expr)list * (string*Handler)list ));
+# 822 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  string*Importance )) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wire)) in
+            let _8 = (let data = parseState.GetInput(8) in (Microsoft.FSharp.Core.Operators.unbox data : 'NodeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 69 "pars.fsy"
+                                                                                 match _5 with (a,q) -> let h=(_2,{new Handler with a=a and aq=q and at=_4 and outWires=[] and rt=[] and n=_8}) in ([],[h]) 
+                   )
+# 69 "pars.fsy"
+                 :  (string*Expr)list * (string*Handler)list ));
+# 836 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 71 "pars.fsy"
+                                 [] 
+                   )
+# 71 "pars.fsy"
+                 : 'NodeList));
+# 846 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 72 "pars.fsy"
+                              [] 
+                   )
+# 72 "pars.fsy"
+                 : 'NodeList));
+# 856 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Node )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 73 "pars.fsy"
+                               [_1] 
+                   )
+# 73 "pars.fsy"
+                 : 'NodeList));
+# 867 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Node )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'NodeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 74 "pars.fsy"
+                                            _1 :: _3 
+                   )
+# 74 "pars.fsy"
+                 : 'NodeList));
+# 879 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'ExprNode)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 75 "pars.fsy"
+                                      _1 
+                   )
+# 75 "pars.fsy"
+                 :  Ast.Node ));
+# 890 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'OtherNode)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 75 "pars.fsy"
+                                                         _1 
+                   )
+# 75 "pars.fsy"
+                 :  Ast.Node ));
+# 901 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 78 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_2 and t=_1 and d=NExpr(_5) and inWires=_4 and outWires=[] and src=src} 
+                   )
+# 78 "pars.fsy"
+                 : 'ExprNode));
+# 915 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 80 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_1 and t=TUnk and d=NExpr(_4) and inWires=_3 and outWires=[] and src=src} 
+                   )
+# 80 "pars.fsy"
+                 : 'ExprNode));
+# 928 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data :  AtomicMode )) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 83 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_2 and t=_1 and d=NAtomic {new AtomicDat with m=_5 and rw=_7} and inWires=_4 and outWires=[] and src=src} 
+                   )
+# 83 "pars.fsy"
+                 : 'OtherNode));
+# 943 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  AtomicMode )) in
+            let _6 = (let data = parseState.GetInput(6) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 85 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_1 and t=TUnk and d=NAtomic {new AtomicDat with m=_4 and rw=_6} and inWires=_3 and outWires=[] and src=src} 
+                   )
+# 85 "pars.fsy"
+                 : 'OtherNode));
+# 957 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data :  StringOrList )) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 87 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_2 and t=_1 and d=NSet(_5.aslist,TUnk,_7) and inWires=_4 and outWires=[] and src=src} 
+                   )
+# 87 "pars.fsy"
+                 : 'OtherNode));
+# 972 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  StringOrList )) in
+            let _6 = (let data = parseState.GetInput(6) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 89 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_1 and t=TUnk and d=NSet(_4.aslist,TUnk,_6) and inWires=_3 and outWires=[] and src=src} 
+                   )
+# 89 "pars.fsy"
+                 : 'OtherNode));
+# 986 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _6 = (let data = parseState.GetInput(6) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _8 = (let data = parseState.GetInput(8) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _10 = (let data = parseState.GetInput(10) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 91 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_2 and t=_1 and d=NCall(_6,_8,NUnbounded,_10) and inWires=_4 and outWires=[] and src=src} 
+                   )
+# 91 "pars.fsy"
+                 : 'OtherNode));
+# 1002 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _9 = (let data = parseState.GetInput(9) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 93 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_1 and t=TUnk and d=NCall(_5,_7,NUnbounded,_9) and inWires=_3 and outWires=[] and src=src} 
+                   )
+# 93 "pars.fsy"
+                 : 'OtherNode));
+# 1017 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 95 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=TUnk and d=NCall(_3,_5,NUnbounded,_7) and inWires=_1 and outWires=[] and src=src} 
+                   )
+# 95 "pars.fsy"
+                 : 'OtherNode));
+# 1031 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 97 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NSignal(_3) and inWires=_2 and outWires=[] and src=src} 
+                   )
+# 97 "pars.fsy"
+                 : 'OtherNode));
+# 1043 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 99 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NReturn(_3) and inWires=_2 and outWires=[] and src=src} 
+                   )
+# 99 "pars.fsy"
+                 : 'OtherNode));
+# 1055 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeList)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data : 'IdList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 101 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_2 and t=_1 and d=NFirst(_7) and inWires=_4 and outWires=[] and src=src} 
+                   )
+# 101 "pars.fsy"
+                 : 'OtherNode));
+# 1069 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _6 = (let data = parseState.GetInput(6) in (Microsoft.FSharp.Core.Operators.unbox data : 'IdList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 103 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=_1 and t=TUnk and d=NFirst(_6) and inWires=_3 and outWires=[] and src=src} 
+                   )
+# 103 "pars.fsy"
+                 : 'OtherNode));
+# 1082 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat list )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 105 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NIf(_3) and inWires=_2 and outWires=[] and src=src} 
+                   )
+# 105 "pars.fsy"
+                 : 'OtherNode));
+# 1094 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wires)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'IfTypeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 107 "pars.fsy"
+                              let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NIfType(_3) and inWires=_2 and outWires=[] and src=src} 
+                   )
+# 107 "pars.fsy"
+                 : 'OtherNode));
+# 1106 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 110 "pars.fsy"
+                                  [(_1,TUnk)] 
+                   )
+# 110 "pars.fsy"
+                 : 'IdList));
+# 1117 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'IdList)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 111 "pars.fsy"
+                                          _1 @ [(_3,TUnk)] 
+                   )
+# 111 "pars.fsy"
+                 : 'IdList));
+# 1129 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 112 "pars.fsy"
+                                [] 
+                   )
+# 112 "pars.fsy"
+                 : 'ArgList));
+# 1139 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Arg)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 113 "pars.fsy"
+                              [_1] 
+                   )
+# 113 "pars.fsy"
+                 : 'ArgList));
+# 1150 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Arg)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'ArgList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 114 "pars.fsy"
+                                            _1 :: _3 
+                   )
+# 114 "pars.fsy"
+                 : 'ArgList));
+# 1162 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 115 "pars.fsy"
+                               ("_",_1) 
+                   )
+# 115 "pars.fsy"
+                 : 'Arg));
+# 1173 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 116 "pars.fsy"
+                                (_2,_1) 
+                   )
+# 116 "pars.fsy"
+                 : 'Arg));
+# 1185 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 117 "pars.fsy"
+                                  {new StringOrList with asstring=_1 and aslist=[_1]} 
+                   )
+# 117 "pars.fsy"
+                 :  StringOrList ));
+# 1196 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  StringOrList )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 118 "pars.fsy"
+                                         {new StringOrList with asstring=_1.asstring^"."^_3 and aslist=_1.aslist @ [_3]} 
+                   )
+# 118 "pars.fsy"
+                 :  StringOrList ));
+# 1208 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 120 "pars.fsy"
+                                          BeginRead 
+                   )
+# 120 "pars.fsy"
+                 :  AtomicMode ));
+# 1218 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 121 "pars.fsy"
+                                  EndRead 
+                   )
+# 121 "pars.fsy"
+                 :  AtomicMode ));
+# 1228 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 122 "pars.fsy"
+                                     BeginWrite 
+                   )
+# 122 "pars.fsy"
+                 :  AtomicMode ));
+# 1238 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 123 "pars.fsy"
+                                   EndWrite 
+                   )
+# 123 "pars.fsy"
+                 :  AtomicMode ));
+# 1248 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 125 "pars.fsy"
+                              [] 
+                   )
+# 125 "pars.fsy"
+                 : 'Wires));
+# 1258 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : 'WireList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 126 "pars.fsy"
+                                                  _2 
+                   )
+# 126 "pars.fsy"
+                 : 'Wires));
+# 1269 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 127 "pars.fsy"
+                                 [] 
+                   )
+# 127 "pars.fsy"
+                 : 'WireList));
+# 1279 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wire)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 128 "pars.fsy"
+                                [_1] 
+                   )
+# 128 "pars.fsy"
+                 : 'WireList));
+# 1290 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'Wire)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'WireList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 129 "pars.fsy"
+                                               _1 :: _3 
+                   )
+# 129 "pars.fsy"
+                 : 'WireList));
+# 1302 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 130 "pars.fsy"
+                                (_1,NBounded(1)) 
+                   )
+# 130 "pars.fsy"
+                 : 'Wire));
+# 1313 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 131 "pars.fsy"
+                                   (_2,NUnbounded) 
+                   )
+# 131 "pars.fsy"
+                 : 'Wire));
+# 1324 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 133 "pars.fsy"
+                                                  [_1] 
+                   )
+# 133 "pars.fsy"
+                 :  IfDat list ));
+# 1335 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat )) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat list )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 134 "pars.fsy"
+                                                             _1 :: _4 
+                   )
+# 134 "pars.fsy"
+                 :  IfDat list ));
+# 1347 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 135 "pars.fsy"
+                                                               [_1; _3] 
+                   )
+# 135 "pars.fsy"
+                 :  IfDat list ));
+# 1359 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data :  IfDat )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 137 "pars.fsy"
+                         let ifdat = _5 in {ifdat with ife=_2} 
+                   )
+# 137 "pars.fsy"
+                 :  IfDat ));
+# 1371 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'ExprNode)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 139 "pars.fsy"
+                         let n=_1 in match n.d with NExpr(e) -> {new IfDat with ife={new Expr with t=[("bool",Unimportant)] and e=EBool(true)} and thens=n.s and thent=n.t and thene=e and thenOutWires=n.outWires} | _ -> raise(new System.Exception("ERROR: then not an expr")) 
+                   )
+# 139 "pars.fsy"
+                 :  IfDat ));
+# 1382 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeCondAndConsequence)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 141 "pars.fsy"
+                                                          [_1] 
+                   )
+# 141 "pars.fsy"
+                 : 'IfTypeList));
+# 1393 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeCondAndConsequence)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'IfTypeList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 142 "pars.fsy"
+                                                                     _1 :: _4 
+                   )
+# 142 "pars.fsy"
+                 : 'IfTypeList));
+# 1405 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeCondAndConsequence)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeConsequence)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 143 "pars.fsy"
+                                                                       [_1; _3] 
+                   )
+# 143 "pars.fsy"
+                 : 'IfTypeList));
+# 1417 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'IdList)) in
+            let _7 = (let data = parseState.GetInput(7) in (Microsoft.FSharp.Core.Operators.unbox data : 'TypeConsequence)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 145 "pars.fsy"
+                         let (ift:TypeList) = List.map (fun (id,t) -> (id,Unimportant)) _4 in
+                         let (ifdat:IfTypeDat) = _7 in
+                         {ifdat with ifv=_2; ift=ift} 
+                   )
+# 145 "pars.fsy"
+                 : 'TypeCondAndConsequence));
+# 1432 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : 'ExprNode)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 149 "pars.fsy"
+                         let n=_1 in match n.d with NExpr(e) -> {new IfTypeDat with ifv="" and ift=[] and tthens=n.s and tthent=n.t and tthene=e and tthenOutWires=n.outWires} | _ -> raise(new System.Exception("ERROR: then not an expr")) 
+                   )
+# 149 "pars.fsy"
+                 : 'TypeConsequence));
+# 1443 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 153 "pars.fsy"
+                                                _2 
+                   )
+# 153 "pars.fsy"
+                 :  Ast.Expr ));
+# 1454 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 154 "pars.fsy"
+                                          {new Expr with t=TUnk and e=EFun("+",[_1;_3])} 
+                   )
+# 154 "pars.fsy"
+                 :  Ast.Expr ));
+# 1466 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 155 "pars.fsy"
+                                           {new Expr with t=TUnk and e=EFun("-",[_1;_3])} 
+                   )
+# 155 "pars.fsy"
+                 :  Ast.Expr ));
+# 1478 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 156 "pars.fsy"
+                                          {new Expr with t=TUnk and e=EFun("*",[_1;_3])} 
+                   )
+# 156 "pars.fsy"
+                 :  Ast.Expr ));
+# 1490 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 157 "pars.fsy"
+                                         {new Expr with t=TUnk and e=EFun("/",[_1;_3])} 
+                   )
+# 157 "pars.fsy"
+                 :  Ast.Expr ));
+# 1502 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 158 "pars.fsy"
+                                            {new Expr with t=TUnk and e=EFun("<",[_1;_3])} 
+                   )
+# 158 "pars.fsy"
+                 :  Ast.Expr ));
+# 1514 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 159 "pars.fsy"
+                                            {new Expr with t=TUnk and e=EFun(">",[_1;_3])} 
+                   )
+# 159 "pars.fsy"
+                 :  Ast.Expr ));
+# 1526 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 160 "pars.fsy"
+                                              {new Expr with t=TUnk and e=EFun("==",[_1;_3])} 
+                   )
+# 160 "pars.fsy"
+                 :  Ast.Expr ));
+# 1538 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 161 "pars.fsy"
+                                               {new Expr with t=TUnk and e=EFun("!=",[_1;_3])} 
+                   )
+# 161 "pars.fsy"
+                 :  Ast.Expr ));
+# 1550 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 162 "pars.fsy"
+                                                 {new Expr with t=TUnk and e=EFun(">=",[_1;_3])} 
+                   )
+# 162 "pars.fsy"
+                 :  Ast.Expr ));
+# 1562 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 163 "pars.fsy"
+                                                 {new Expr with t=TUnk and e=EFun("<=",[_1;_3])} 
+                   )
+# 163 "pars.fsy"
+                 :  Ast.Expr ));
+# 1574 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 164 "pars.fsy"
+                                         {new Expr with t=TUnk and e=EFun("&&",[_1;_3])} 
+                   )
+# 164 "pars.fsy"
+                 :  Ast.Expr ));
+# 1586 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 165 "pars.fsy"
+                                        {new Expr with t=TUnk and e=EFun("||",[_1;_3])} 
+                   )
+# 165 "pars.fsy"
+                 :  Ast.Expr ));
+# 1598 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 166 "pars.fsy"
+                                      {new Expr with t=TUnk and e=EFun("!",[_2])} 
+                   )
+# 166 "pars.fsy"
+                 :  Ast.Expr ));
+# 1609 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  StringOrList )) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'ExprList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 167 "pars.fsy"
+                                                                  {new Expr with t=TUnk and e=EExternal(_2.asstring,_4)} 
+                   )
+# 167 "pars.fsy"
+                 :  Ast.Expr ));
+# 1621 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 168 "pars.fsy"
+                                                   {new Expr with t=TUnk and e=EFun("-",[{new Expr with t=TUnk and e=EInt(0)};_2])} 
+                   )
+# 168 "pars.fsy"
+                 :  Ast.Expr ));
+# 1632 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : System.Int32)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 169 "pars.fsy"
+                               {new Expr with t=TUnk and e=EInt(_1)} 
+                   )
+# 169 "pars.fsy"
+                 :  Ast.Expr ));
+# 1643 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : bool)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 170 "pars.fsy"
+                                {new Expr with t=TUnk and e=EBool(_1)} 
+                   )
+# 170 "pars.fsy"
+                 :  Ast.Expr ));
+# 1654 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 171 "pars.fsy"
+                                  {new Expr with t=TUnk and e=EString(_1)} 
+                   )
+# 171 "pars.fsy"
+                 :  Ast.Expr ));
+# 1665 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  StringOrList )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 172 "pars.fsy"
+                                  {new Expr with t=TUnk and e=if _1.asstring="void" then EVoid else EIdPath(_1.aslist)} 
+                   )
+# 172 "pars.fsy"
+                 :  Ast.Expr ));
+# 1676 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _4 = (let data = parseState.GetInput(4) in (Microsoft.FSharp.Core.Operators.unbox data : 'AssignList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 173 "pars.fsy"
+                                                           {new Expr with t=TUnk and e=EConstructor(_2,_4)} 
+                   )
+# 173 "pars.fsy"
+                 :  Ast.Expr ));
+# 1688 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 174 "pars.fsy"
+                                          {new Expr with t=TUnk and e=EImportance(Important,_2)} 
+                   )
+# 174 "pars.fsy"
+                 :  Ast.Expr ));
+# 1699 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _2 = (let data = parseState.GetInput(2) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 175 "pars.fsy"
+                                            {new Expr with t=TUnk and e=EImportance(Unimportant,_2)} 
+                   )
+# 175 "pars.fsy"
+                 :  Ast.Expr ));
+# 1710 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 176 "pars.fsy"
+                                 [] 
+                   )
+# 176 "pars.fsy"
+                 : 'ExprList));
+# 1720 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 177 "pars.fsy"
+                                [_1] 
+                   )
+# 177 "pars.fsy"
+                 : 'ExprList));
+# 1731 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data : 'ExprList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 178 "pars.fsy"
+                                               _1 :: _3 
+                   )
+# 178 "pars.fsy"
+                 : 'ExprList));
+# 1743 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 179 "pars.fsy"
+                                   [] 
+                   )
+# 179 "pars.fsy"
+                 : 'AssignList));
+# 1753 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 180 "pars.fsy"
+                                          [(_1,_3)] 
+                   )
+# 180 "pars.fsy"
+                 : 'AssignList));
+# 1765 "pars.fs"
+        (fun (parseState : Microsoft.FSharp.Text.Parsing.IParseState) ->
+            let _1 = (let data = parseState.GetInput(1) in (Microsoft.FSharp.Core.Operators.unbox data : string)) in
+            let _3 = (let data = parseState.GetInput(3) in (Microsoft.FSharp.Core.Operators.unbox data :  Ast.Expr )) in
+            let _5 = (let data = parseState.GetInput(5) in (Microsoft.FSharp.Core.Operators.unbox data : 'AssignList)) in
+            Microsoft.FSharp.Core.Operators.box
+                (
+                   (
+# 181 "pars.fsy"
+                                                           (_1,_3)::_5 
+                   )
+# 181 "pars.fsy"
+                 : 'AssignList));
+|]
+# 1779 "pars.fs"
+let tables () : Microsoft.FSharp.Text.Parsing.Tables<_> = 
+  { reductions= _fsyacc_reductions ();
+    endOfInputTag = _fsyacc_endOfInputTag;
+    tagOfToken = tagOfToken;
+    dataOfToken = _fsyacc_dataOfToken; 
+    actionTableElements = _fsyacc_actionTableElements;
+    actionTableRowOffsets = _fsyacc_actionTableRowOffsets;
+    stateToProdIdxsTableElements = _fsyacc_stateToProdIdxsTableElements;
+    stateToProdIdxsTableRowOffsets = _fsyacc_stateToProdIdxsTableRowOffsets;
+    reductionSymbolCounts = _fsyacc_reductionSymbolCounts;
+    immediateActions = _fsyacc_immediateActions;
+    gotos = _fsyacc_gotos;
+    sparseGotoTableRowOffsets = _fsyacc_sparseGotoTableRowOffsets;
+    tagOfErrorTerminal = _fsyacc_tagOfErrorTerminal;
+    parseError = (fun (ctxt:Microsoft.FSharp.Text.Parsing.ParseErrorContext<_>) -> 
+                              match parse_error_rich with 
+                              | Some f -> f ctxt
+                              | None -> parse_error ctxt.Message);
+    numTerminals = 54;
+    productionToNonTerminalTable = _fsyacc_productionToNonTerminalTable  }
+let engine lexer lexbuf startState = (tables ()).Interpret(lexer, lexbuf, startState)
+let start lexer lexbuf :  TDefPrim list * TDefChoice list * ExternFun list * Activity list  =
+    Microsoft.FSharp.Core.Operators.unbox ((tables ()).Interpret(lexer, lexbuf, 0))
+let Expr lexer lexbuf :  Ast.Expr  =
+    Microsoft.FSharp.Core.Operators.unbox ((tables ()).Interpret(lexer, lexbuf, 2))
diff --git a/tests/fsharp/regression/lucian-standalone-bug/pars.fsy b/tests/fsharp/regression/lucian-standalone-bug/pars.fsy
new file mode 100644
index 0000000..90d7f08
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/pars.fsy
@@ -0,0 +1,181 @@
+%{
+
+open Ast
+
+type StringOrList = {asstring:string; aslist:string list}
+
+%}
+
+%token <string> ID
+%token <System.Int32> INT
+%token <System.Double> FLOAT
+%token <string> STRING
+%token <bool> BOOL
+%token ACTIVITY IF CALL EXTERNAL TYPE CLASS ENUM IMPORTANT UNIMPORTANT NEW SIGNAL THEN ELSE ON FIRST RETURN EXTERN BEGINREAD ENDREAD BEGINWRITE ENDWRITE
+%token PLUS MINUS DIV EQUALS EQEQUALS NOTEQUALS AND OR ABOVEEQUALS BELOWEQUALS COLONEQUALS PLING
+%token LBRACE RBRACE SEMI LPAREN RPAREN COLON DOT LANGLE RANGLE COMMA STAR PAR
+%token EOF
+%nonassoc IMPORTANT UNIMPORTANT /* lowest precedence */
+%left AND OR          
+%left NOTEQUALS ABOVEEQUALS BELOWEQUALS EQEQUALS /* next lowest */
+%left LANGLE RANGLE 
+%left PLUS MINUS 
+%left STAR DIV  
+%left COLON PLING
+%nonassoc UMINUS /* highest precedence */
+%type < Ast.Expr > Expr
+%type < Ast.Node > Node
+%type < AtomicMode > Atomic
+%type < (string*Expr)list * (string*Handler)list > StateOrHandler
+%type < string*Importance > ImpId
+%type < StringOrList > IdPath
+%type < TDefPrim list * TDefChoice list * ExternFun list * Activity list > start
+%type < IfDat list > IfList
+%type < IfDat > Consequence
+%type < IfDat > CondAndConsequence
+%start start Expr
+
+%%
+
+start: TypeOrActivityList EOF { $1 }
+
+
+TypeOrActivityList: { ([("void",TVoid);("int",TInt);("bool",TBool);("string",TString);("readwrite",TRecord[("rcount","int");("wcount","int")])],[],[],[]) }
+  | TypeOrActivity TypeOrActivityList { match ($1,$2) with ((tp1,tc1,ef1,a1),(tp2,tc2,ef2,a2)) -> (tp1 at tp2, tc1 at tc2, ef1 at ef2, a1 at a2) }
+TypeOrActivity: CLASS ID LBRACE FieldList RBRACE { let tp=($2,TRecord($4)) in ([tp],[],[],[]) }
+  |   ENUM ID LBRACE EnumList RBRACE { let tp=($2,TEnum($4)) in ([tp],[],[],[]) }
+  |   TYPE ID EQUALS TypeList { let tc=($2,$4) in ([],[tc],[],[]) }
+  |   EXTERN ID ID LPAREN ArgList RPAREN SEMI  { let ef=($3, {new ExternFunDat with ats=$5 and rt=$2}) in ([],[],[ef],[]) }
+  |   ACTIVITY ID LBRACE StateOrHandlerList RBRACE { let a = match $4 with (state,h) -> {new Ast.Activity with s=$2 and state=state and signal=[] and h=h and ext=false} in ([],[],[],[a]) }
+  |   ACTIVITY ID COLON TypeList LBRACE StateOrHandlerList RBRACE { let a = match $6 with (state,h) -> {new Ast.Activity with s=$2 and state=state and signal=$4 and h=h and ext=false} in ([],[],[],[a]) }
+  |   EXTERN ACTIVITY ID LBRACE StateOrHandlerList RBRACE { let a = match $5 with (state,h) -> {new Ast.Activity with s=$3 and state=state and signal=[] and h=h and ext=true} in ([],[],[],[a]) }
+  |   EXTERN ACTIVITY ID COLON TypeList LBRACE StateOrHandlerList RBRACE { let a = match $7 with (state,h) -> {new Ast.Activity with s=$3 and state=state and signal=$5 and h=h and ext=true} in ([],[],[],[a]) }
+
+FieldList: { [] }
+  |  Field FieldList { $1 :: $2 }
+Field: ID ID SEMI { ($2,$1) } // fieldname * TName
+EnumList: ID { [$1] }
+  | EnumList COMMA ID { $1 @ [$3] }
+TypeList: ImpId { [$1] }
+  | ImpId PLUS TypeList { $1 :: $3 }
+  | LPAREN TypeList RPAREN { $2 }
+ImpId: IMPORTANT ID { ($2,Important) }
+  | ID { ($1,Unimportant) }
+
+StateOrHandlerList: { ([],[]) }
+  | StateOrHandler StateOrHandlerList { match ($1,$2) with ((st1,h1),(st2,h2)) -> (st1 at st2,h1 at h2) }
+StateOrHandler: TypeList ID EQUALS Expr SEMI { let st=($2, {$4 with t=$1}) in ([st],[]) }
+  | ON ID LPAREN ImpId Wire RPAREN COLON TypeList LBRACE NodeList RBRACE { match $5 with (a,q) -> let h=($2,{new Handler with a=a and aq=q and at=$4 and outWires=[] and rt=$8 and n=$10}) in ([],[h]) }
+  | ON ID LPAREN ImpId Wire RPAREN LBRACE NodeList RBRACE { match $5 with (a,q) -> let h=($2,{new Handler with a=a and aq=q and at=$4 and outWires=[] and rt=[] and n=$8}) in ([],[h]) }
+
+NodeList: { [] }
+ | PAR { [] }
+ | Node { [$1] }
+ | Node PAR NodeList { $1 :: $3 }
+Node: ExprNode { $1 } | OtherNode { $1 }
+ExprNode:
+ | TypeList ID EQUALS Wires Expr 
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$2 and t=$1 and d=NExpr($5) and inWires=$4 and outWires=[] and src=src} }
+ | ID EQUALS Wires Expr 
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$1 and t=TUnk and d=NExpr($4) and inWires=$3 and outWires=[] and src=src} }
+OtherNode:
+ | TypeList ID EQUALS Wires Atomic LPAREN ID RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$2 and t=$1 and d=NAtomic {new AtomicDat with m=$5 and rw=$7} and inWires=$4 and outWires=[] and src=src} } 
+ | ID EQUALS Wires Atomic LPAREN ID RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$1 and t=TUnk and d=NAtomic {new AtomicDat with m=$4 and rw=$6} and inWires=$3 and outWires=[] and src=src} } 
+ | TypeList ID EQUALS Wires IdPath COLONEQUALS Expr
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$2 and t=$1 and d=NSet($5.aslist,TUnk,$7) and inWires=$4 and outWires=[] and src=src} } 
+ | ID EQUALS Wires IdPath COLONEQUALS Expr
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$1 and t=TUnk and d=NSet($4.aslist,TUnk,$6) and inWires=$3 and outWires=[] and src=src} } 
+ | TypeList ID EQUALS Wires CALL ID DOT ID LPAREN Expr RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$2 and t=$1 and d=NCall($6,$8,NUnbounded,$10) and inWires=$4 and outWires=[] and src=src} }
+ | ID EQUALS Wires CALL ID DOT ID LPAREN Expr RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$1 and t=TUnk and d=NCall($5,$7,NUnbounded,$9) and inWires=$3 and outWires=[] and src=src} }
+ | Wires CALL ID DOT ID LPAREN Expr RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=TUnk and d=NCall($3,$5,NUnbounded,$7) and inWires=$1 and outWires=[] and src=src} }
+ | SIGNAL Wires Expr
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NSignal($3) and inWires=$2 and outWires=[] and src=src} }
+ | RETURN Wires Expr
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NReturn($3) and inWires=$2 and outWires=[] and src=src} }
+ | TypeList ID EQUALS Wires FIRST LPAREN IdList RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$2 and t=$1 and d=NFirst($7) and inWires=$4 and outWires=[] and src=src} }
+ | ID EQUALS Wires FIRST LPAREN IdList RPAREN
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s=$1 and t=TUnk and d=NFirst($6) and inWires=$3 and outWires=[] and src=src} }
+ | IF Wires IfList
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NIf($3) and inWires=$2 and outWires=[] and src=src} }
+ | IF Wires IfTypeList
+       { let src = (Parsing.set_parse_state parseState; (Parsing.rhs_start_pos 1).pos_lnum+1) in {new Node with s="_t"^string(src) and t=[] and d=NIfType($3) and inWires=$2 and outWires=[] and src=src} }
+
+
+IdList: ID { [($1,TUnk)] }
+ | IdList COMMA ID { $1 @ [($3,TUnk)] }
+ArgList: { [] }
+ | Arg { [$1] }
+ | Arg COMMA ArgList { $1 :: $3 }
+Arg: ID { ("_",$1) }
+ | ID ID { ($2,$1) }
+IdPath: ID { {new StringOrList with asstring=$1 and aslist=[$1]} }
+ |  IdPath DOT ID { {new StringOrList with asstring=$1.asstring^"."^$3 and aslist=$1.aslist @ [$3]} }
+
+Atomic : BEGINREAD { BeginRead }
+ | ENDREAD { EndRead }
+ | BEGINWRITE { BeginWrite }
+ | ENDWRITE { EndWrite }
+
+Wires: { [] }
+ |  LBRACE WireList RBRACE { $2 }
+WireList: { [] }
+ |  Wire { [$1] }
+ |  Wire COMMA WireList { $1 :: $3 }
+Wire: ID { ($1,NBounded(1)) }
+ |  STAR ID { ($2,NUnbounded) }
+
+IfList: CondAndConsequence { [$1] }
+ |  CondAndConsequence ELSE IF IfList { $1 :: $4 }
+ |  CondAndConsequence ELSE Consequence { [$1; $3] }
+CondAndConsequence: LPAREN Expr RPAREN THEN Consequence
+  { let ifdat = $5 in {ifdat with ife=$2} }
+Consequence: ExprNode
+  { let n=$1 in match n.d with NExpr(e) -> {new IfDat with ife={new Expr with t=[("bool",Unimportant)] and e=EBool(true)} and thens=n.s and thent=n.t and thene=e and thenOutWires=n.outWires} | _ -> raise(new System.Exception("ERROR: then not an expr")) }
+
+IfTypeList: TypeCondAndConsequence { [$1] }
+ |  TypeCondAndConsequence ELSE IF IfTypeList { $1 :: $4 }
+ |  TypeCondAndConsequence ELSE TypeConsequence { [$1; $3] }
+TypeCondAndConsequence: LPAREN ID COLON IdList RPAREN THEN TypeConsequence
+  { let (ift:TypeList) = List.map (fun (id,t) -> (id,Unimportant)) $4 in
+    let (ifdat:IfTypeDat) = $7 in
+    {ifdat with ifv=$2; ift=ift} }
+TypeConsequence: ExprNode
+  { let n=$1 in match n.d with NExpr(e) -> {new IfTypeDat with ifv="" and ift=[] and tthens=n.s and tthent=n.t and tthene=e and tthenOutWires=n.outWires} | _ -> raise(new System.Exception("ERROR: then not an expr")) }
+
+
+
+Expr: LPAREN Expr RPAREN { $2 }
+ |  Expr PLUS Expr { {new Expr with t=TUnk and e=EFun("+",[$1;$3])} }
+ |  Expr MINUS Expr { {new Expr with t=TUnk and e=EFun("-",[$1;$3])} }
+ |  Expr STAR Expr { {new Expr with t=TUnk and e=EFun("*",[$1;$3])} }
+ |  Expr DIV Expr { {new Expr with t=TUnk and e=EFun("/",[$1;$3])} }
+ |  Expr LANGLE Expr { {new Expr with t=TUnk and e=EFun("<",[$1;$3])} }
+ |  Expr RANGLE Expr { {new Expr with t=TUnk and e=EFun(">",[$1;$3])} }
+ |  Expr EQEQUALS Expr { {new Expr with t=TUnk and e=EFun("==",[$1;$3])} }
+ |  Expr NOTEQUALS Expr { {new Expr with t=TUnk and e=EFun("!=",[$1;$3])} }
+ |  Expr ABOVEEQUALS Expr { {new Expr with t=TUnk and e=EFun(">=",[$1;$3])} }
+ |  Expr BELOWEQUALS Expr { {new Expr with t=TUnk and e=EFun("<=",[$1;$3])} }
+ |  Expr AND Expr { {new Expr with t=TUnk and e=EFun("&&",[$1;$3])} }
+ |  Expr OR Expr { {new Expr with t=TUnk and e=EFun("||",[$1;$3])} }
+ |  PLING Expr { {new Expr with t=TUnk and e=EFun("!",[$2])} }
+ |  EXTERNAL IdPath LPAREN ExprList RPAREN { {new Expr with t=TUnk and e=EExternal($2.asstring,$4)} }
+ |  MINUS Expr %prec UMINUS { {new Expr with t=TUnk and e=EFun("-",[{new Expr with t=TUnk and e=EInt(0)};$2])} }
+ |  INT { {new Expr with t=TUnk and e=EInt($1)} }
+ |  BOOL { {new Expr with t=TUnk and e=EBool($1)} }
+ |  STRING { {new Expr with t=TUnk and e=EString($1)} }
+ |  IdPath { {new Expr with t=TUnk and e=if $1.asstring="void" then EVoid else EIdPath($1.aslist)} }
+ |  NEW ID LPAREN AssignList RPAREN { {new Expr with t=TUnk and e=EConstructor($2,$4)} }
+ |  IMPORTANT Expr { {new Expr with t=TUnk and e=EImportance(Important,$2)} }
+ |  UNIMPORTANT Expr { {new Expr with t=TUnk and e=EImportance(Unimportant,$2)} }
+ExprList: { [] }
+ |  Expr { [$1] }
+ |  Expr COMMA ExprList { $1 :: $3 }
+AssignList: { [] }
+ |  ID EQUALS Expr { [($1,$3)] }
+ |  ID EQUALS Expr COMMA AssignList { ($1,$3)::$5 }
diff --git a/tests/fsharp/regression/lucian-standalone-bug/parsing.fs b/tests/fsharp/regression/lucian-standalone-bug/parsing.fs
new file mode 100644
index 0000000..08c44eb
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/parsing.fs
@@ -0,0 +1,41 @@
+// (c) Microsoft Corporation 2005-2009.
+// Parsing: support fsyacc-generated parsers
+
+[<CompilerMessage("This module is for ML compatibility. Consider using the Microsoft.FSharp.Text.Parsing namespace directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Parsing
+open Microsoft.FSharp.Text.Lexing
+open Microsoft.FSharp.Text.Parsing
+
+let err _  = failwith "You must generate your parser using the '--ml-compatibility' option or call 'Parsing.set_parse_state parseState' in each action before using functions from the Parsing module.  This is because the module uses global state which must be set up for use in each parsing action. Review the notes in the 'Microsoft.FSharp.Compatibility.OCaml.Parsing' module if you are using parsers on multiple threads."
+let dummyProvider = 
+    { new IParseState with 
+        member x.InputRange(i) = err();
+        member p.InputStartPosition(n) = err();
+        member p.InputEndPosition(n) = err();
+        member x.ResultRange = err();
+        member x.GetInput(i) = err();
+        member x.ParserLocalStore = err();
+        member x.RaiseError() = err()  
+      }
+
+let mutable parse_information = dummyProvider
+let set_parse_state (x:IParseState) = parse_information <- x
+
+let enforce_nonnull_pos p = 
+  match (box p) with 
+  | null -> Position.Empty
+  | _ -> p
+
+let symbol_start_pos ()   = parse_information.ResultRange   |> fst |> enforce_nonnull_pos
+let symbol_end_pos ()     = parse_information.ResultRange   |> snd |> enforce_nonnull_pos
+let rhs_start_pos (n:int) = parse_information.InputRange(n) |> fst |> enforce_nonnull_pos
+let rhs_end_pos (n:int)   = parse_information.InputRange(n) |> snd |> enforce_nonnull_pos
+
+exception Parse_error  = RecoverableParseError
+let parse_error s = parse_information.RaiseError()(failwith s : unit)
+
+let symbol_start () = (symbol_start_pos()).pos_cnum
+let symbol_end () = (symbol_end_pos()).pos_cnum
+let rhs_start n = (rhs_start_pos n).pos_cnum
+let rhs_end n = (rhs_end_pos n).pos_cnum
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/prim-lexing.fs b/tests/fsharp/regression/lucian-standalone-bug/prim-lexing.fs
new file mode 100644
index 0000000..6fd3d30
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/prim-lexing.fs
@@ -0,0 +1,418 @@
+// (c) Microsoft Corporation 2005-2009.
+
+#nowarn "47" // recursive initialization of LexBuffer
+
+
+namespace Microsoft.FSharp.Text.Lexing 
+
+    open System.Collections.Generic
+
+    // REVIEW: This type showed up on a parsing-intensive performance measurement. Consider whether it can be a struct-record later when we have this feature. -jomo
+#if INTERNALIZED_POWER_PACK
+    type internal Position = 
+#else
+    type Position = 
+#endif
+        { pos_fname : string;
+          pos_lnum : int;
+#if INTERNALIZED_POWER_PACK
+          pos_orig_lnum : int;
+#endif
+          pos_bol : int;
+          pos_cnum : int; }
+        member x.FileName = x.pos_fname
+        member x.Line = x.pos_lnum
+#if INTERNALIZED_POWER_PACK
+        member x.OriginalLine = x.pos_orig_lnum
+#endif
+        member x.Char = x.pos_cnum
+        member x.AbsoluteOffset = x.pos_cnum
+        member x.StartOfLine = x.pos_bol
+        member x.StartOfLineAbsoluteOffset = x.pos_bol
+        member x.Column = x.pos_cnum - x.pos_bol
+        member pos.NextLine = 
+            { pos with 
+#if INTERNALIZED_POWER_PACK
+                    pos_orig_lnum = pos.OriginalLine + 1;
+#endif
+                    pos_lnum = pos.Line+1; 
+                    pos_bol = pos.AbsoluteOffset }
+        member pos.EndOfToken(n) = {pos with pos_cnum=pos.pos_cnum + n }
+        member pos.AsNewLinePos() = pos.NextLine
+        member pos.ShiftColumnBy(by) = {pos with pos_cnum = pos.pos_cnum + by}
+        static member Empty = 
+            { pos_fname=""; 
+              pos_lnum= 0; 
+#if INTERNALIZED_POWER_PACK
+              pos_orig_lnum = 0;
+#endif
+              pos_bol= 0; 
+              pos_cnum=0 }
+        static member FirstLine(filename) = 
+            { pos_fname=filename; 
+#if INTERNALIZED_POWER_PACK
+              pos_orig_lnum = 1;
+#endif
+              pos_lnum= 1; 
+              pos_bol= 0; 
+              pos_cnum=0 }
+
+#if INTERNALIZED_POWER_PACK
+    type internal LexBufferFiller<'char> = 
+#else
+    type LexBufferFiller<'char> = 
+#endif
+        { fillSync : (LexBuffer<'char> -> unit) option
+          fillAsync : (LexBuffer<'char> -> Async<unit>) option } 
+        
+    and [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+        internal LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = 
+#else
+        LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = 
+#endif
+        let context = new Dictionary<string,obj>(1) in 
+        let extendBufferSync = (fun () -> match filler.fillSync with Some refill -> refill this | None -> invalidOp "attempt to read synchronously from an asynchronous lex buffer")
+        let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer")
+        let mutable buffer=[||];
+        /// number of valid charactes beyond bufferScanStart 
+        let mutable bufferMaxScanLength=0;
+        /// count into the buffer when scanning 
+        let mutable bufferScanStart=0;
+        /// number of characters scanned so far 
+        let mutable bufferScanLength=0;
+        /// length of the scan at the last accepting state 
+        let mutable lexemeLength=0;
+        /// action related to the last accepting state 
+        let mutable bufferAcceptAction=0;
+        let mutable eof = false;
+        let mutable startPos = Position.Empty ;
+        let mutable endPos = Position.Empty
+
+        // Throw away all the input besides the lexeme 
+              
+        let discardInput () = 
+            let keep = Array.sub buffer bufferScanStart bufferScanLength
+            let nkeep = keep.Length 
+            Array.blit keep 0 buffer 0 nkeep;
+            bufferScanStart <- 0;
+            bufferMaxScanLength <- nkeep
+                 
+              
+        member lexbuf.EndOfScan () : int =
+            // Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength;
+            if bufferAcceptAction < 0 then 
+                failwith "unrecognized input"
+
+            //  Printf.printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp;
+            //   Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer); 
+            lexbuf.StartPos <- endPos;
+            lexbuf.EndPos <- endPos.EndOfToken(lexbuf.LexemeLength);
+            bufferAcceptAction
+
+        member lexbuf.StartPos
+           with get() = startPos
+           and  set(b) =  startPos <- b
+           
+        member lexbuf.EndPos 
+           with get() = endPos
+           and  set(b) =  endPos <- b
+
+        member lexbuf.Lexeme         = Array.sub buffer bufferScanStart lexemeLength
+        member lexbuf.LexemeChar(n)  = buffer.[n+bufferScanStart]
+        
+        member lexbuf.BufferLocalStore = (context :> IDictionary<_,_>)
+        member lexbuf.LexemeLength        with get() : int = lexemeLength    and set v = lexemeLength <- v
+        member internal lexbuf.Buffer              with get() : 'char[] = buffer              and set v = buffer <- v
+        member internal lexbuf.BufferMaxScanLength with get() = bufferMaxScanLength and set v = bufferMaxScanLength <- v
+        member internal lexbuf.BufferScanLength    with get() = bufferScanLength    and set v = bufferScanLength <- v
+        member internal lexbuf.BufferScanStart     with get() : int = bufferScanStart     and set v = bufferScanStart <- v
+        member internal lexbuf.BufferAcceptAction  with get() = bufferAcceptAction  and set v = bufferAcceptAction <- v
+        member internal lexbuf.RefillBuffer = extendBufferSync
+        member internal lexbuf.AsyncRefillBuffer = extendBufferAsync
+
+        static member LexemeString(lexbuf:LexBuffer<char>) = 
+            new System.String(lexbuf.Buffer,lexbuf.BufferScanStart,lexbuf.LexemeLength)
+
+        member lexbuf.IsPastEndOfStream 
+           with get() = eof
+           and  set(b) =  eof <- b
+
+        member lexbuf.DiscardInput() = discardInput ()
+
+        member x.BufferScanPos = bufferScanStart + bufferScanLength
+
+        member lexbuf.EnsureBufferSize n = 
+            if lexbuf.BufferScanPos + n >= buffer.Length then 
+                let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) 
+                Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength;
+                buffer <- repl
+
+        static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async<int>) option) : LexBuffer<'char> = 
+            let extension= Array.zeroCreate 4096
+            let fillers = 
+                { fillSync = 
+                    match syncRead with 
+                    | None -> None
+                    | Some read -> 
+                         Some (fun lexBuffer -> 
+                             let n = read(extension,0,extension.Length)
+                             lexBuffer.EnsureBufferSize n;
+                             Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n;
+                             lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n); 
+                  fillAsync = 
+                    match asyncRead with 
+                    | None -> None
+                    | Some read -> 
+                         Some (fun lexBuffer -> 
+                                  async { 
+                                      let! n = read(extension,0,extension.Length)
+                                      lexBuffer.EnsureBufferSize n;
+                                      Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n;
+                                      lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n }) }
+            new LexBuffer<_>(fillers)
+
+        // A full type signature is required on this method because it is used at more specific types within its own scope
+        static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> =  LexBuffer<_>.FromReadFunctions(Some(f),None)
+        static member FromAsyncFunction (f : 'char[] * int * int -> Async<int>) : LexBuffer<'char> =  LexBuffer<_>.FromReadFunctions(None,Some(f))
+              
+        static member FromCharFunction f : LexBuffer<char> = 
+            LexBuffer<char>.FromFunction(fun (buff,start,len) -> 
+                let buff2 = Array.zeroCreate len
+                let n = f buff2 len 
+                Array.blit buff2 0 buff start len
+                n)
+        static member FromByteFunction f : LexBuffer<byte> = 
+            LexBuffer<byte>.FromFunction(fun (buff,start,len) -> 
+                let buff2 = Array.zeroCreate len
+                let n = f buff2 len 
+                Array.blit buff2 0 buff start len
+                n)
+
+        // A full type signature is required on this method because it is used at more specific types within its own scope
+        static member FromArray (s: 'char[]) : LexBuffer<'char> = 
+            let lexBuffer = 
+                new LexBuffer<_> 
+                    { fillSync = Some (fun _ -> ()); 
+                      fillAsync = Some (fun _ -> async { return () }) }
+            let buffer = Array.copy s 
+            lexBuffer.Buffer <- buffer;
+            lexBuffer.BufferMaxScanLength <- buffer.Length;
+            lexBuffer
+
+        static member FromBytes    (arr) = LexBuffer<byte>.FromArray(arr)
+        static member FromChars    (arr) = LexBuffer<char>.FromArray(arr) 
+        static member FromString (s:string) = LexBuffer<char>.FromChars (s.ToCharArray())
+
+        static member FromTextReader (tr:System.IO.TextReader)  : LexBuffer<char> = 
+           LexBuffer<char>.FromFunction(tr.Read) 
+
+        static member FromBinaryReader (br:System.IO.BinaryReader)  : LexBuffer<byte> = 
+           LexBuffer<byte>.FromFunction(br.Read) 
+
+        static member FromStream (stream:System.IO.Stream)  : LexBuffer<byte> = 
+           LexBuffer<byte>.FromReadFunctions(Some(stream.Read),Some(fun (buf,offset,len) -> stream.AsyncRead(buf,offset=offset,count=len))) 
+
+    module GenericImplFragments = 
+        let startInterpret(lexBuffer:LexBuffer<_>)= 
+            lexBuffer.BufferScanStart <- lexBuffer.BufferScanStart + lexBuffer.LexemeLength;
+            lexBuffer.BufferMaxScanLength <- lexBuffer.BufferMaxScanLength - lexBuffer.LexemeLength;
+            lexBuffer.BufferScanLength <- 0;
+            lexBuffer.LexemeLength <- 0;
+            lexBuffer.BufferAcceptAction <- -1;
+
+        let afterRefill (trans: uint16[] array,sentinel,lexBuffer:LexBuffer<_>,scanUntilSentinel,endOfScan,state,eofPos) = 
+            // end of file occurs if we couldn't extend the buffer 
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then  
+                let snew = int trans.[state].[eofPos] // == EOF 
+                if snew = sentinel then 
+                    endOfScan()
+                else 
+                    if lexBuffer.IsPastEndOfStream then failwith "End of file on lexing stream";
+                    lexBuffer.IsPastEndOfStream <- true;
+                    // Printf.printf "state %d --> %d on eof\n" state snew;
+                    scanUntilSentinel(lexBuffer,snew)
+            else 
+                scanUntilSentinel(lexBuffer, state)
+
+        let onAccept (lexBuffer:LexBuffer<_>,a) = 
+            lexBuffer.LexemeLength <- lexBuffer.BufferScanLength;
+            lexBuffer.BufferAcceptAction <- a;
+
+    open GenericImplFragments
+
+    [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+    type internal AsciiTables(trans: uint16[] array, accept: uint16[]) =
+#else
+    type AsciiTables(trans: uint16[] array, accept: uint16[]) =
+#endif
+        let rec scanUntilSentinel(lexBuffer, state) =
+            let sentinel = 255 * 256 + 255 
+            // Return an endOfScan after consuming the input 
+            let a = int accept.[state] 
+            if a <> sentinel then 
+                onAccept (lexBuffer,a)
+            
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                lexBuffer.DiscardInput();
+                lexBuffer.RefillBuffer ();
+              // end of file occurs if we couldn't extend the buffer 
+                afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,lexBuffer.EndOfScan,state,256 (* == EOF *) )
+            else
+                // read a character - end the scan if there are no further transitions 
+                let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos])
+                let snew = int trans.[state].[inp] 
+                if snew = sentinel then 
+                    lexBuffer.EndOfScan()
+                else 
+                    lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                    // Printf.printf "state %d --> %d on '%c' (%d)\n" state snew (Char.chr inp) inp;
+                    scanUntilSentinel(lexBuffer, snew)
+            
+        /// Interpret tables for an ascii lexer generated by fslex. 
+        member tables.Interpret(initialState,lexBuffer : LexBuffer<byte>) = 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        /// Interpret tables for an ascii lexer generated by fslex. 
+        member tables.AsyncInterpret(initialState,lexBuffer : LexBuffer<byte>) = 
+        
+            let rec scanUntilSentinel(lexBuffer,state) : Async<int> = 
+                async {  
+                    let sentinel = 255 * 256 + 255 
+                    // Return an endOfScan after consuming the input 
+                    let a = int accept.[state] 
+                    if a <> sentinel then 
+                        onAccept (lexBuffer,a)
+                    
+                    if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                        lexBuffer.DiscardInput();
+                        do! lexBuffer.AsyncRefillBuffer ();
+                       // end of file occurs if we couldn't extend the buffer 
+                        return! afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,endOfScan,state,256 (* == EOF *) )
+                    else
+                        // read a character - end the scan if there are no further transitions 
+                        let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos])
+                        let snew = int trans.[state].[inp] 
+                        if snew = sentinel then 
+                            return! endOfScan()
+                        else 
+                            lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                            return! scanUntilSentinel(lexBuffer,snew)
+                }
+            and endOfScan() = 
+                async { return lexBuffer.EndOfScan() }
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+
+        static member Create(trans,accept) = new AsciiTables(trans,accept)
+
+    [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+    type internal UnicodeTables(trans: uint16[] array, accept: uint16[]) = 
+#else
+    type UnicodeTables(trans: uint16[] array, accept: uint16[]) = 
+#endif
+        let sentinel = 255 * 256 + 255 
+        let numUnicodeCategories = 30 
+        let numLowUnicodeChars = 128 
+        let numSpecificUnicodeChars = (trans.[0].Length - 1 - numLowUnicodeChars - numUnicodeCategories)/2
+        let lookupUnicodeCharacters (state,inp) = 
+            let inpAsInt = int inp
+            // Is it a fast ASCII character?
+            if inpAsInt < numLowUnicodeChars then 
+                int trans.[state].[inpAsInt]
+            else 
+                // Search for a specific unicode character
+                let baseForSpecificUnicodeChars = numLowUnicodeChars
+                let rec loop i = 
+                    if i >= numSpecificUnicodeChars then 
+                        // OK, if we failed then read the 'others' entry in the alphabet,
+                        // which covers all Unicode characters not covered in other
+                        // ways
+                        let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2
+                        let unicodeCategory = System.Char.GetUnicodeCategory(inp)
+                        //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]);
+                        int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory]
+                    else 
+                        // This is the specific unicode character
+                        let c = char (int trans.[state].[baseForSpecificUnicodeChars+i*2])
+                        //System.Console.WriteLine("c = {0}, inp = {1}, i = {2}", [| box c; box inp; box i |]);
+                        // OK, have we found the entry for a specific unicode character?
+                        if c = inp
+                        then int trans.[state].[baseForSpecificUnicodeChars+i*2+1]
+                        else loop(i+1)
+                
+                loop 0
+        let eofPos    = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories 
+        
+        let rec scanUntilSentinel(lexBuffer,state) =
+            // Return an endOfScan after consuming the input 
+            let a = int accept.[state] 
+            if a <> sentinel then 
+                onAccept(lexBuffer,a)
+            
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                lexBuffer.DiscardInput();
+                lexBuffer.RefillBuffer ();
+              // end of file occurs if we couldn't extend the buffer 
+                afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,lexBuffer.EndOfScan,state,eofPos)
+            else
+                // read a character - end the scan if there are no further transitions 
+                let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos]
+                
+                // Find the new state
+                let snew = lookupUnicodeCharacters (state,inp)
+
+                if snew = sentinel then 
+                    lexBuffer.EndOfScan()
+                else 
+                    lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                    // Printf.printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp;
+                    scanUntilSentinel(lexBuffer,snew)
+                          
+        // Each row for the Unicode table has format 
+        //      128 entries for ASCII characters
+        //      A variable number of 2*UInt16 entries for SpecificUnicodeChars 
+        //      30 entries, one for each UnicodeCategory
+        //      1 entry for EOF
+
+        member tables.Interpret(initialState,lexBuffer : LexBuffer<char>) = 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        member tables.AsyncInterpret(initialState,lexBuffer : LexBuffer<char>) = 
+
+            let rec scanUntilSentinel(lexBuffer, state) =
+                async {
+                    // Return an endOfScan after consuming the input 
+                    let a = int accept.[state] 
+                    if a <> sentinel then 
+                        onAccept(lexBuffer,a)
+                    
+                    if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                        lexBuffer.DiscardInput();
+                        lexBuffer.RefillBuffer ();
+                        // end of file occurs if we couldn't extend the buffer 
+                        return! afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,endOfScan,state,eofPos)
+                    else
+                        // read a character - end the scan if there are no further transitions 
+                        let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos]
+                        
+                        // Find the new state
+                        let snew = lookupUnicodeCharacters (state,inp)
+
+                        if snew = sentinel then 
+                            return! endOfScan()
+                        else 
+                            lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                            return! scanUntilSentinel(lexBuffer, snew)
+                }
+            and endOfScan() = 
+                async { return lexBuffer.EndOfScan() } 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        static member Create(trans,accept) = new UnicodeTables(trans,accept)
diff --git a/tests/fsharp/regression/lucian-standalone-bug/prim-parsing.fs b/tests/fsharp/regression/lucian-standalone-bug/prim-parsing.fs
new file mode 100644
index 0000000..0ee0c51
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/prim-parsing.fs
@@ -0,0 +1,513 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#if INTERNALIZED_POWER_PACK
+
+namespace  Internal.Utilities.Text.Parsing
+open Internal.Utilities
+open Internal.Utilities.Text.Lexing
+
+#else
+namespace Microsoft.FSharp.Text.Parsing
+open Microsoft.FSharp.Text.Lexing
+#endif
+
+
+
+open System
+open System.Collections.Generic
+
+#if INTERNALIZED_POWER_PACK
+type internal IParseState = 
+#else
+type IParseState = 
+#endif
+    abstract InputRange: int -> Position * Position
+    abstract InputEndPosition: int -> Position 
+    abstract InputStartPosition: int -> Position 
+    abstract ResultRange: Position * Position
+    abstract GetInput: int -> obj 
+    abstract ParserLocalStore : IDictionary<string,obj>
+    abstract RaiseError<'b> : unit -> 'b 
+
+//-------------------------------------------------------------------------
+// This context is passed to the error reporter when a syntax error occurs
+
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal ParseErrorContext<'tok>
+#else
+type ParseErrorContext<'tok>
+#endif
+         (//lexbuf: LexBuffer<_>,
+          stateStack:int list,
+          parseState: IParseState, 
+          reduceTokens: int list, 
+          currentToken: 'tok option, 
+          reducibleProductions: int list list, 
+          shiftableTokens: int list , 
+          message : string) =
+      //member x.LexBuffer = lexbuf
+      member x.StateStack  = stateStack
+      member x.ReduceTokens = reduceTokens
+      member x.CurrentToken = currentToken
+      member x.ParseState = parseState
+      member x.ReducibleProductions = reducibleProductions
+      member x.ShiftTokens = shiftableTokens
+      member x.Message = message
+
+
+//-------------------------------------------------------------------------
+// This is the data structure emitted as code by FSYACC.  
+
+#if INTERNALIZED_POWER_PACK
+type internal Tables<'tok> = 
+#else
+type Tables<'tok> = 
+#endif
+    { reductions: (IParseState -> obj) array;
+      endOfInputTag: int;
+      tagOfToken: 'tok -> int;
+      dataOfToken: 'tok -> obj; 
+      actionTableElements: uint16[];  
+      actionTableRowOffsets: uint16[];
+      reductionSymbolCounts: uint16[];
+      immediateActions: uint16[];
+      gotos: uint16[];
+      sparseGotoTableRowOffsets: uint16[];
+      stateToProdIdxsTableElements: uint16[];  
+      stateToProdIdxsTableRowOffsets: uint16[];  
+      productionToNonTerminalTable: uint16[];
+      /// For fsyacc.exe, this entry is filled in by context from the generated parser file. If no 'parse_error' function
+      /// is defined by the user then ParseHelpers.parse_error is used by default (ParseHelpers is opened
+      /// at the top of the generated parser file)
+      parseError:  ParseErrorContext<'tok> -> unit;
+      numTerminals: int;
+      tagOfErrorTerminal: int }
+
+//-------------------------------------------------------------------------
+// An implementation of stacks.
+
+// This type is in System.dll so for the moment we can't use it in FSharp.Core.dll
+//type Stack<'a> = System.Collections.Generic.Stack<'a>
+
+#if INTERNALIZED_POWER_PACK
+type Stack<'a>(n)  = 
+#else
+type internal Stack<'a>(n)  = 
+#endif
+    let mutable contents = Array.zeroCreate<'a>(n)
+    let mutable count = 0
+
+    member buf.Ensure newSize = 
+        let oldSize = Array.length contents
+        if newSize > oldSize then 
+            let old = contents
+            contents <- Array.zeroCreate (max newSize (oldSize * 2));
+            Array.blit old 0 contents 0 count;
+    
+    member buf.Count = count
+    member buf.Pop() = count <- count - 1
+    member buf.Peep() = contents.[count - 1]
+    member buf.Top(n) = [ for x in contents.[max 0 (count-n)..count - 1] -> x ] |> List.rev
+    member buf.Push(x) =
+        buf.Ensure(count + 1); 
+        contents.[count] <- x; 
+        count <- count + 1
+        
+    member buf.IsEmpty = (count = 0)
+    member buf.PrintStack() = 
+        for i = 0 to (count - 1) do 
+            System.Console.Write("{0}{1}",(contents.[i]),if i=count-1 then ":" else "-") 
+          
+exception RecoverableParseError
+exception Accept of obj
+
+#if DEBUG
+module Flags = 
+    let mutable debug = false
+#endif
+
+#if INTERNALIZED_POWER_PACK
+module internal Implementation = 
+#else
+module Implementation = 
+#endif
+    
+    // Definitions shared with fsyacc 
+    let anyMarker = 0xffff
+    let shiftFlag = 0x0000
+    let reduceFlag = 0x4000
+    let errorFlag = 0x8000
+    let acceptFlag = 0xc000
+    let actionMask = 0xc000
+
+    let actionValue action = action &&& (~~~ actionMask)                                    
+    let actionKind action = action &&& actionMask
+    
+    //-------------------------------------------------------------------------
+    // Read the tables written by FSYACC.  
+
+    type AssocTable(elemTab:uint16[], offsetTab:uint16[]) =
+        let cache = new Dictionary<_,_>(2000)
+
+        member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) =     
+            // do a binary chop on the table 
+            let elemNumber : int = (minElemNum+maxElemNum)/2
+            if elemNumber = maxElemNum 
+            then defaultValueOfAssoc
+            else 
+                let x = int elemTab.[elemNumber*2]
+                if keyToFind = x then 
+                    int elemTab.[elemNumber*2+1]
+                elif keyToFind < x then t.readAssoc (minElemNum ,elemNumber,defaultValueOfAssoc,keyToFind)
+                else                    t.readAssoc (elemNumber+1,maxElemNum,defaultValueOfAssoc,keyToFind)
+
+        member t.Read(rowNumber ,keyToFind) =
+        
+            // First check the sparse lookaside table
+            // Performance note: without this lookaside table the binary chop in readAssoc
+            // takes up around 10% of of parsing time 
+            // for parsing intensive samples such as the bootstrapped F# compiler.
+            //
+            // Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal.
+            // Some other better sparse lookup table may be better.
+            let mutable res = 0 
+            let cacheKey = (rowNumber <<< 16) ||| keyToFind
+            let ok = cache.TryGetValue(cacheKey, &res) 
+            if ok then res 
+            else
+                let headOfTable = int offsetTab.[rowNumber]
+                let firstElemNumber = headOfTable + 1           
+                let numberOfElementsInAssoc = int elemTab.[headOfTable*2]
+                let defaultValueOfAssoc = int elemTab.[headOfTable*2+1]          
+                let res = t.readAssoc (firstElemNumber,(firstElemNumber+numberOfElementsInAssoc),defaultValueOfAssoc,keyToFind)
+                cache.[cacheKey] <- res
+                res
+
+        // Read all entries in the association table
+        // Used during error recovery to find all valid entries in the table
+        member x.ReadAll(n) =       
+            let headOfTable = int offsetTab.[n]
+            let firstElemNumber = headOfTable + 1           
+            let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2]           
+            let defaultValueOfAssoc = int elemTab.[headOfTable*2+1]          
+            [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> 
+                (int elemTab.[i*2], int elemTab.[i*2+1]) ], defaultValueOfAssoc
+
+    type IdxToIdxListTable(elemTab:uint16[], offsetTab:uint16[]) =
+
+        // Read all entries in a row of the table
+        member x.ReadAll(n) =       
+            let headOfTable = int offsetTab.[n]
+            let firstElemNumber = headOfTable + 1           
+            let numberOfElements = int32 elemTab.[headOfTable]           
+            [ for i in firstElemNumber .. (firstElemNumber+numberOfElements-1) -> int elemTab.[i] ]
+
+    //-------------------------------------------------------------------------
+    // interpret the tables emitted by FSYACC.  
+
+    [<NoEquality; NoComparison>]
+    [<Struct>]
+    type ValueInfo = 
+        val value: obj
+        val startPos: Position
+        val endPos: Position
+        new(value,startPos,endPos) = { value=value; startPos=startPos;endPos=endPos }
+
+    let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState =                                                                      
+        let localStore = new Dictionary<string,obj>() in
+        localStore.["LexBuffer"] <- lexbuf;
+#if DEBUG
+        if Flags.debug then System.Console.WriteLine("\nParser: interpret tables");
+#endif
+        let stateStack : Stack<int> = new Stack<_>(100)
+        stateStack.Push(initialState);
+        let valueStack = new Stack<ValueInfo>(100)
+        let mutable haveLookahead = false                                                                              
+        let mutable lookaheadToken = Unchecked.defaultof<'tok>
+        let mutable lookaheadEndPos = Unchecked.defaultof<Position>
+        let mutable lookaheadStartPos = Unchecked.defaultof<Position>
+        let mutable finished = false
+        // After an error occurs, we suppress errors until we've shifted three tokens in a row.
+        let mutable errorSuppressionCountDown = 0
+        
+        // When we hit the end-of-file we don't fail straight away but rather keep permitting shift
+        // and reduce against the last token in the token stream 20 times or until we've accepted
+        // or exhausted the stack. This allows error recovery rules of the form
+        //      input : realInput EOF | realInput error EOF | error EOF
+        // where consuming one EOF to trigger an error doesn't result in overall parse failure 
+        // catastrophe and the loss of intermediate results.
+        //
+        let mutable inEofCountDown = false
+        let mutable eofCountDown = 20 // Number of EOFs to supply at the end for error recovery
+        // The 100 here means a maximum of 100 elements for each rule
+        let ruleStartPoss = (Array.zeroCreate 100 : Position array)              
+        let ruleEndPoss   = (Array.zeroCreate 100 : Position array)              
+        let ruleValues    = (Array.zeroCreate 100 : obj array)              
+        let lhsPos        = (Array.zeroCreate 2 : Position array)                                            
+        let reductions = tables.reductions
+        let actionTable = new AssocTable(tables.actionTableElements, tables.actionTableRowOffsets)
+        let gotoTable = new AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets)
+        let stateToProdIdxsTable = new IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets)
+
+        let parseState =                                                                                            
+            { new IParseState with 
+                member p.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1]; 
+                member p.InputStartPosition(n) = ruleStartPoss.[n-1]
+                member p.InputEndPosition(n) = ruleEndPoss.[n-1]; 
+                member p.GetInput(n)    = ruleValues.[n-1];        
+                member p.ResultRange    = (lhsPos.[0], lhsPos.[1]);  
+                member p.ParserLocalStore = (localStore :> IDictionary<_,_>); 
+                member p.RaiseError()  = raise RecoverableParseError  (* NOTE: this binding tests the fairly complex logic associated with an object expression implementing a generic abstract method *)
+            }       
+
+#if DEBUG
+        let report haveLookahead lookaheadToken = 
+            if haveLookahead then sprintf "%A" lookaheadToken 
+            else "[TBC]"
+#endif
+
+        // Pop the stack until we can shift the 'error' token. If 'tokenOpt' is given
+        // then keep popping until we can shift both the 'error' token and the token in 'tokenOpt'.
+        // This is used at end-of-file to make sure we can shift both the 'error' token and the 'EOF' token.
+        let rec popStackUntilErrorShifted(tokenOpt) =
+            // Keep popping the stack until the "error" terminal is shifted
+#if DEBUG
+            if Flags.debug then System.Console.WriteLine("popStackUntilErrorShifted");
+#endif
+            if stateStack.IsEmpty then 
+#if DEBUG
+                if Flags.debug then 
+                    System.Console.WriteLine("state stack empty during error recovery - generating parse error");
+#endif
+                failwith "parse error";
+            
+            let currState = stateStack.Peep()
+#if DEBUG
+            if Flags.debug then 
+                System.Console.WriteLine("In state {0} during error recovery", currState);
+#endif
+            
+            let action = actionTable.Read(currState, tables.tagOfErrorTerminal)
+            
+            if actionKind action = shiftFlag &&  
+                (match tokenOpt with 
+                 | None -> true
+                 | Some(token) -> 
+                    let nextState = actionValue action 
+                    actionKind (actionTable.Read(nextState, tables.tagOfToken(token))) = shiftFlag) then
+
+#if DEBUG
+                if Flags.debug then System.Console.WriteLine("shifting error, continuing with error recovery");
+#endif
+                let nextState = actionValue action 
+                // The "error" non terminal needs position information, though it tends to be unreliable.
+                // Use the StartPos/EndPos from the lex buffer
+                valueStack.Push(ValueInfo(box (), lexbuf.StartPos, lexbuf.EndPos));
+                stateStack.Push(nextState)
+            else
+                if valueStack.IsEmpty then 
+                    failwith "parse error";
+#if DEBUG
+                if Flags.debug then 
+                    System.Console.WriteLine("popping stack during error recovery");
+#endif
+                valueStack.Pop();
+                stateStack.Pop();
+                popStackUntilErrorShifted(tokenOpt)
+
+        while not finished do                                                                                    
+            if stateStack.IsEmpty then 
+                finished <- true
+            else
+                let state = stateStack.Peep()
+#if DEBUG
+                if Flags.debug then (Console.Write("{0} value(state), state ",valueStack.Count); stateStack.PrintStack())
+#endif
+                let action = 
+                    let immediateAction = int tables.immediateActions.[state]
+                    if not (immediateAction = anyMarker) then
+                        // Action has been pre-determined, no need to lookahead 
+                        // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? 
+                        immediateAction
+                    else
+                        // Lookahead required to determine action 
+                        if not haveLookahead then 
+                            if lexbuf.IsPastEndOfStream then 
+                                // When the input runs out, keep supplying the last token for eofCountDown times
+                                if eofCountDown>0 then
+                                    haveLookahead <- true
+                                    eofCountDown <- eofCountDown - 1
+                                    inEofCountDown <- true
+                                else 
+                                    haveLookahead <- false
+                            else 
+                                lookaheadToken <- lexer lexbuf
+                                lookaheadStartPos <- lexbuf.StartPos
+                                lookaheadEndPos <- lexbuf.EndPos
+                                haveLookahead <- true;
+
+                        let tag = 
+                            if haveLookahead then tables.tagOfToken lookaheadToken 
+                            else tables.endOfInputTag   
+                                    
+                        // Printf.printf "state %d\n" state  
+                        actionTable.Read(state,tag)
+                        
+                let kind = actionKind action 
+                if kind = shiftFlag then (
+                    if errorSuppressionCountDown > 0 then 
+                        errorSuppressionCountDown <- errorSuppressionCountDown - 1;
+#if DEBUG
+                        if Flags.debug then Console.WriteLine("shifting, reduced errorRecoverylevel to {0}\n", errorSuppressionCountDown);
+#endif
+                    let nextState = actionValue action                                     
+                    if not haveLookahead then failwith "shift on end of input!";
+                    let data = tables.dataOfToken lookaheadToken
+                    valueStack.Push(ValueInfo(data, lookaheadStartPos, lookaheadEndPos));
+                    stateStack.Push(nextState);                                                                
+#if DEBUG
+                    if Flags.debug then Console.WriteLine("shift/consume input {0}, shift to state {1}", report haveLookahead lookaheadToken, nextState);
+#endif
+                    haveLookahead <- false
+
+                ) elif kind = reduceFlag then
+                    let prod = actionValue action                                     
+                    let reduction = reductions.[prod]                                                             
+                    let n = int tables.reductionSymbolCounts.[prod]
+                       // pop the symbols, populate the values and populate the locations                              
+#if DEBUG
+                    if Flags.debug then Console.Write("reduce popping {0} values/states, lookahead {1}", n, report haveLookahead lookaheadToken);
+#endif
+                    for i = 0 to n - 1 do                                                                             
+                        if valueStack.IsEmpty then failwith "empty symbol stack";
+                        let topVal = valueStack.Peep()
+                        valueStack.Pop();
+                        stateStack.Pop();
+                        ruleValues.[(n-i)-1] <- topVal.value;  
+                        ruleStartPoss.[(n-i)-1] <- topVal.startPos;  
+                        ruleEndPoss.[(n-i)-1] <- topVal.endPos;  
+                        if i = 0 then lhsPos.[1] <- topVal.endPos;                                     
+                        if i = n - 1 then lhsPos.[0] <- topVal.startPos
+                    done;                                                                                             
+                    // Use the lookahead token to populate the locations if the rhs is empty                        
+                    if n = 0 then 
+                        if haveLookahead then 
+                           lhsPos.[0] <- lookaheadStartPos;                                                                     
+                           lhsPos.[1] <- lookaheadEndPos;                                                                       
+                        else 
+                           lhsPos.[0] <- lexbuf.StartPos;
+                           lhsPos.[1] <- lexbuf.EndPos;
+                    try                                                                                               
+                          // Printf.printf "reduce %d\n" prod;                                                       
+                        let redResult = reduction parseState                                                          
+                        valueStack.Push(ValueInfo(redResult, lhsPos.[0], lhsPos.[1]));
+                        let currState = stateStack.Peep()
+                        let newGotoState = gotoTable.Read(int tables.productionToNonTerminalTable.[prod], currState)
+                        stateStack.Push(newGotoState)
+#if DEBUG
+                        if Flags.debug then Console.WriteLine(" goto state {0}", newGotoState)
+#endif
+                    with                                                                                              
+                    | Accept res ->                                                                            
+                          finished <- true;                                                                             
+                          valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) 
+                    | RecoverableParseError ->
+#if DEBUG
+                          if Flags.debug then Console.WriteLine("RecoverableParseErrorException...\n");
+#endif
+                          popStackUntilErrorShifted(None);
+                          // User code raised a Parse_error. Don't report errors again until three tokens have been shifted 
+                          errorSuppressionCountDown <- 3
+                elif kind = errorFlag then (
+#if DEBUG
+                    if Flags.debug then Console.Write("ErrorFlag... ");
+#endif
+                    // Silently discard inputs and don't report errors 
+                    // until three tokens in a row have been shifted 
+#if DEBUG
+                    if Flags.debug then printfn "error on token '%A' " (if haveLookahead then Some(lookaheadToken) else None);
+#endif
+                    if errorSuppressionCountDown > 0 then 
+                        // If we're in the end-of-file count down then we're very keen to 'Accept'.
+                        // We can only do this by repeatedly popping the stack until we can shift both an 'error' token
+                        // and an EOF token. 
+                        if inEofCountDown && eofCountDown < 10 then 
+#if DEBUG
+                            if Flags.debug then printfn "poppin stack, lokking to shift both 'error' and that token, during end-of-file error recovery" ;
+#endif
+                            popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None);
+
+                        // If we don't haveLookahead then the end-of-file count down is over and we have no further options.
+                        if not haveLookahead then 
+                            failwith "parse error: unexpected end of file"
+                            
+#if DEBUG
+                        if Flags.debug then printfn "discarding token '%A' during error suppression" (if haveLookahead then Some(lookaheadToken) else None);
+#endif
+                        // Discard the token
+                        haveLookahead <- false
+                        // Try again to shift three tokens
+                        errorSuppressionCountDown <- 3
+                    else (
+
+                        let currentToken = if haveLookahead then Some(lookaheadToken) else None
+                        let actions,defaultAction = actionTable.ReadAll(state) 
+                        let explicit = Set.ofList [ for (tag,_action) in actions -> tag ]
+                        
+                        let shiftableTokens = 
+                           [ for (tag,action) in actions do
+                                 if (actionKind action) = shiftFlag then 
+                                     yield tag
+                             if actionKind defaultAction = shiftFlag  then
+                                 for tag in 0 .. tables.numTerminals-1 do  
+                                    if not (explicit.Contains(tag)) then 
+                                         yield tag ] in
+
+                        let stateStack = stateStack.Top(12) in
+                        let reducibleProductions = 
+                            [ for state in stateStack do 
+                               yield stateToProdIdxsTable.ReadAll(state)  ]
+
+                        let reduceTokens = 
+                           [ for (tag,action) in actions do
+                                if actionKind(action) = reduceFlag then
+                                    yield tag
+                             if actionKind(defaultAction) = reduceFlag  then
+                                 for tag in 0 .. tables.numTerminals-1 do  
+                                    if not (explicit.Contains(tag)) then 
+                                         yield tag ] in
+                        //let activeRules = stateStack |> List.iter (fun state -> 
+                        let errorContext = new ParseErrorContext<'tok>(stateStack,parseState, reduceTokens,currentToken,reducibleProductions, shiftableTokens, "syntax error")
+                        tables.parseError(errorContext);
+                        popStackUntilErrorShifted(None);
+                        errorSuppressionCountDown <- 3;
+#if DEBUG
+                        if Flags.debug then System.Console.WriteLine("generated syntax error and shifted error token, haveLookahead = {0}\n", haveLookahead);
+#endif
+                    )
+                ) elif kind = acceptFlag then 
+                    finished <- true
+#if DEBUG
+                else
+                  if Flags.debug then System.Console.WriteLine("ALARM!!! drop through case in parser");  
+#endif
+        done;                                                                                                     
+        // OK, we're done - read off the overall generated value
+        valueStack.Peep().value
+
+#if INTERNALIZED_POWER_PACK
+type internal Tables<'tok> with
+#else
+type Tables<'tok> with
+#endif
+    member tables.Interpret (lexer,lexbuf,initialState) = 
+        Implementation.interpret tables lexer lexbuf initialState
+    
+#if INTERNALIZED_POWER_PACK
+module internal ParseHelpers = 
+#else
+module ParseHelpers = 
+#endif
+    let parse_error (_s:string) = ()
+    let parse_error_rich = (None : (ParseErrorContext<_> -> unit) option)
diff --git a/tests/fsharp/regression/lucian-standalone-bug/states.fs b/tests/fsharp/regression/lucian-standalone-bug/states.fs
new file mode 100644
index 0000000..e7ece55
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/states.fs
@@ -0,0 +1,1013 @@
+#indent "off"
+
+module States
+
+open System
+open Ast
+open Utils
+open Microsoft.FSharp.Compatibility.OCaml
+open Microsoft.FSharp.Text.Lexing
+
+// SIMULATOR.
+// The model is that there are messages floating in queues.
+// Each message value has a single well-defined type, but it's value
+// may either be a relevant value like VInt(3) or just VAny to stand
+// for some arbitrary value of that type. We use VAny because listing
+// every possible VInt(i) is impossible, and even listing every possible
+// VBool(true)/VBool(false) might get a bit tedious. We perhaps could
+// have extended this generalization to types, such as T1+T2, but didn't...
+// multiple types just have to be handled with a fork in the trace.
+// As for records, we say that they must be fully fleshed out VRecord(...)
+// rather than just VAny, for convenience in the "drill_record" function.
+// Note: actually, if a state value is a "readwrite" then we instead
+// store the two values as VInts. That's because if we abstracted to VAny
+// then we'd lose too much precision for the kinds of analysis we want to do.
+//
+//
+// We maintain these queues:
+//
+// 1. For every notify which is referenced through an "on Notify(T arg)" handler,
+// we keep a queue. Stored like this: ((DstActivity,Handler,HandlerType),(qsize,q))
+// NB. that SrcActivity = HandlerName, and HandlerType is a unique type out of the
+// notify-types of SrcActivity.
+// We also keep a list of (SrcActivity,TypeList) for all those names mentioned in
+// the program but where SrcActivity was declared extern; these will
+// be used by the model-checker for synthesising new messages.
+//
+// 2. For every wire in a running instance, we keep a queue. Indexed
+// by a lot of things: ( (activity,handler,src,dest,instance), (qsize,q))
+// This and the previous data structures are defined with an eye to the
+// algorithm for exploring statespaces, i.e. exploring which moves are possible.
+//
+// Possible moves:
+//
+// 1. synthesise one of those (SrcActivity,Typelist) messages and place it
+// in all the queues waiting for it.
+//
+// 2. consume a message from a main queue (notify/request). This can happen for any
+// of the queues which have at least one message in them. The procedure is to take
+// the message, spawn off a new instance of the handler, and post the initial
+// message on all wires within that instance that need it. (note: an activity
+// cannot have more than one handler for a notify/type pair.)
+//
+// 3. fire a node. This can happen for any instance/node for which enough of its
+// trigger-wires have messages on them. The procedure is to iterate through all
+// nodes in the program. For each one, look up the queues on its wires and make
+// a decision whether or not it can fire. If it can fire, well, we have to execute
+// the respective node. The case of call-nodes is special. This node looks to see
+// if its data is ready. If so, it spawns an instance of the handler. The instance
+// keeps a record of where to return to.
+//
+// 4. Also, for an external request/response handler instance that has been invoked,
+// we can return any acceptable value from it. (this is implemented within the
+// routine that generates node-moves (3)).
+//
+// Each move is marked as to whether it "isInternal" or not. The definition of an
+// internal move is that doing it now or delaying it till later will have no effect
+// on the overall behavior of the program. Algorithmically, once we've generated
+// a list of possible moves, we check: if there are any "isInternal" moves then
+// we deterministically say that the next move WILL be the first isInternal move
+// possible. This reduces the statespace.
+//
+// Note: the analysis goal will constrain which moves we seriously consider.
+// For coverage analysis (to detect whether any states fail to be reached),
+// we assume that coverage is not dependant upon subtle interleaving of handlers;
+// therefore we run instances sequentially. Ultimately we want to reach coverage
+// of every possible message being delivered to every reachable state.
+// For race-condition analysis (to detect whether there are problems arising from
+// interleaving), we of course need to have interleaves. But we'll only look at
+// pairwise interleavings, i.e. every possible pair of handlers running together.
+// 
+
+type VPrim = VAny | VVoid | VInt of int | VString of string | VBool of bool | VEnum of string | VRecord of (VPrim*TName) list // each field records its type
+type StateVersion = {a:string; s:string; seq:int; n:Node option}  // activity.state : sequence-number. The node says at which node the state was set
+and  Value = {t:TName; i:Importance; v:VPrim; dep:Dependencies} // r is the return address. "dep" records what this value has depended on so far
+and  StateValue = {s:StateVersion; v:VPrim; i:Importance; t:TName}
+and  Dependencies = StateVersion list
+// nb. VAny cannot be used for a VRecord. It can be used for everything else, though.
+//
+// in the following queues, "head" of the list is where we remove elements; "tail" is where we add them.
+type MainPort = {a:string; h:string; ht:Type; nq:NQueue} // unique identifies a mainport. The nq(queuesize) is for when we use this structure to add to a queue, so we know how big that queue is
+type WirePort = {i:int; src:string; dst:string; nq:NQueue} // uniquely identifies a instance+wire
+let  NQNotForAdding = NBounded(-1) // what we put in nq field of MainPort/WirePort if we're using them to identify messages to remove, not to add
+let  NoReturn = {new WirePort with i=(-1) and src="" and dst="" and nq=NQNotForAdding } // means that there must be no return statement to this
+let  IgnoreReturn = {new WirePort with i=(-2) and src="" and dst="" and nq=NQNotForAdding } // means that even if there is a return, we'll just ignore it
+type MainQueue = {a:string; h:string; ht:Type; q:(Value*WirePort)list} // a queue leading into a notify-port or request-port. The WirePort is a return-address.
+type WireQueue = {src:string; dst:string; q:Value list} // a queue leading into a node in the diagram
+type Instance = {a:string; h:string; ht:Type; q:WireQueue list; r:WirePort; count:int} // q is sorted. r is the return-address (if we're spun-up to handle a reqest/response call). If any wirequeue is empty then it should not be listed here. Count says how many "calls" are outstanding.
+type ProgState = {mq:MainQueue list; s:StateValue list; i:(int*Instance)list} // a program state. mq, s and i are sorted. If a queue is empty then it should not be listed here.
+//
+type MSynthesizeDat = {a:string; t:TName; v:Value; isInternal:bool} // isInternal says that the move is purely internal, and doing it now or later is completely immaterial
+type MConsumeDat = {mp:MainPort; r:WirePort; isInternal:bool} // r is the return-address
+type MFireNodeDat = {instance:int; node:string; src:string list; index:int; isInternal:bool} // src says which wires to take messages out of. index is for "if/iftype" branches to say which one is taken, and for "call" nodes to say (-1) to act on it or "i" for the ith possible output type of the extern req/resp handler
+type Move = MSynthesize of MSynthesizeDat | MConsume of MConsumeDat | MFireNode of MFireNodeDat
+//
+type Environment = (string*Value) list 
+//
+type ProfileEvent = PStateSet of StateValue*StateValue*Dependencies | PStateGet of StateValue | PExploreEnd of ProgState
+       | PCall of ProgState*string*string*Type*Node | PAtomic of string*string*AtomicMode*int*int*Node
+       | PExplore of ProgState
+
+let rec vprim_to_string (v:VPrim) = match v with
+  | VAny -> "?"
+  | VVoid -> "void"
+  | VInt(i) -> string(i)
+  | VString(s) -> "\""^s^"\""
+  | VBool(b) -> if b then "true" else "false"
+  | VEnum(s) -> s
+  | VRecord(vs) -> "("^(list_to_string "," (List.map (fun (v,t)->(vprim_to_string v)) vs))^")" //^":"^t) vs)) ^ ")"
+and vprimt_to_string ((v,t):(VPrim*TName)) = (vprim_to_string v)^":"^t
+and stateversion_to_string (sv:StateVersion) = sv.a^"."^sv.s^"#"^string(sv.seq)^" "^(somenode_to_string sv.n)
+and somenode_to_string (n:Node option) = match n with None->"start" | Some n -> "line"^string(n.src)
+and value_to_string (v:Value) = (if v.i=Important then "important " else "")^(vprim_to_string v.v)^":"^v.t^(dep_to_string v.dep)
+and values_to_string (vs:Value list) = list_to_string "," (List.map value_to_string vs)
+and dep_to_string (dep:Dependencies) = let dep = list_to_string "," (List.map stateversion_to_string dep) in
+  if dep="" then "" else "dep.("^dep^")"
+and statevalue_to_string (sv:StateValue) = (stateversion_to_string sv.s)^" = "^(if sv.i=Important then "important " else "")^(vprim_to_string sv.v) //^":"^sv.t
+and profileevent_to_string p = match p with
+  | PStateGet(sv) -> "GET "^sv.s.a^"."^sv.s.s^": "^(vprim_to_string sv.v)^"#"^string(sv.s.seq)
+  | PStateSet(svold,svnew,dep) -> "SET "^svold.s.a^"."^svold.s.s^": "^(vprim_to_string svold.v)^"#"^string(svold.s.seq)^" -> "^(vprim_to_string svnew.v)^"#"^string(svnew.s.seq)^" "^(dep_to_string dep)
+  | PExploreEnd(ps) -> "EXPLORE-END"
+  | PCall(ps,peer,verb,t,n) -> "CALL "^peer^"."^verb^":"^(type_to_string t)
+  | PAtomic(a,s,mode,rcount,wcount,n) -> "ATOMIC "^(atomic_to_string mode)^" "^a^"."^s^"(rcount="^string(rcount)^",wcount="^string(wcount)^")"
+  | PExplore(ps) -> "EXPLORE"
+and coverage_to_string (cover:(string*VPrim)list) = list_to_string ", " (List.map cover_to_string cover)
+and cover_to_string ((s,v):(string*VPrim)) = s^"="^(vprim_to_string v)
+//
+let rec mainport_to_string (mp:MainPort) = mp.a^"."^mp.h^":"^(type_to_string mp.ht)
+and wireport_to_string (wp:WirePort) = if wp=NoReturn then "noret" else if wp=IgnoreReturn then "ignoreret" else "i"^string(wp.i)^"."^wp.src^"->"^wp.dst
+and wireports_to_string (wps:WirePort list) = list_to_string ", " (List.map wireport_to_string wps)
+and mainqueue_to_string (mq:MainQueue) = mq.a^"."^mq.h^":"^(type_to_string mq.ht)^".{"^(mainqueue_contents_to_string mq.q)^"}"
+and mainqueue_contents_to_string (q:(Value*WirePort)list) =
+  let s = List.map (fun (v,w)->(value_to_string v)^"; r."^(wireport_to_string w)) q in
+  list_to_string "," s
+and wirequeue_to_string (wq:WireQueue) = "   "^wq.src^"->"^wq.dst^".{"^(values_to_string wq.q)^"}"
+and instance_to_string (i:Instance) =
+  let wires = (list_to_string "\n" (List.map wirequeue_to_string i.q)) in
+  let wires = (if wires="" then "" else wires^"\n") in
+  let count = (if i.count=0 then "" else "count:"^string(i.count)^" ") in
+  let ret = (if i.r=NoReturn || i.r=IgnoreReturn then "" else "return-to:"^(wireport_to_string i.r)^" ") in
+  i.a^"."^i.h^":"^(type_to_string i.ht)^"{"^count^ret^"\n"^wires^"}\n"
+and progstate_to_string (ps:ProgState) =
+  let ss = list_to_string "\n" (List.map statevalue_to_string ps.s) in let ss = (if ss="" then "" else ss^"\n\n") in
+  let mqs = list_to_string "\n" (List.map mainqueue_to_string ps.mq) in let mqs = (if mqs="" then "" else mqs^"\n\n") in
+  let is = list_to_string "" (List.map (fun (i,inst)->"i"^string(i)^" = "^(instance_to_string inst)) ps.i) in
+  "--PROGSTATE--\n"^mqs^ss^is^"\n"
+//
+let rec move_to_string (m:Move) = match m with
+  | MSynthesize(md) -> "msynth("^md.a^":"^md.t^" <- "^(value_to_string md.v)^")"
+  | MConsume(md) -> "mconsume("^(mainport_to_string md.mp)^" r."^(wireport_to_string md.r)^")"
+  | MFireNode(md) -> "mnode(i"^string(md.instance)^" node "^md.node^" #"^string(md.index)^")"
+and moves_to_string (ms:Move list) = list_to_string ", " (List.map move_to_string ms)
+and environment_to_string (env:Environment) =
+  let es = List.map (fun (s,v)->s^"="^(value_to_string v)) env in
+  "[" ^ (list_to_string "," es) ^ "]"
+
+
+
+// Some ordering functions. These *_compare_keys functions are used for
+// ordering the various lists into a canonical order. They do it by
+// comparing just the keys. So, once a state has been sorted into canonical
+// order, then any two states which are structurally congruent will
+// also be syntactically identical. NOTE: That's not quite true.
+// To make it so would require "moveable pointers", e.g. for when one progstate
+// has an instance called "i2" and the other has an instance called "i3"
+// though they're both fundamentally the same. I don't want to do this.
+// In any case, in the context in which the canonical is being used (to
+// generate fingerprints for states) it doesn't matter, because the
+// explorations we use that do this are guaranteed to only ever have
+// the same two instances throughout.
+let wirequeue_compare_keys (wq1:WireQueue) (wq2:WireQueue) : int = compare_compose [Operators.compare wq1.src wq2.src; Operators.compare wq1.dst wq2.dst]
+let mainqueue_compare_keys (mq1:MainQueue) (mq2:MainQueue) : int =  compare_compose [Operators.compare mq1.a mq2.a; Operators.compare mq1.h mq2.h; type_compare_unimp mq1.ht mq2.ht]
+let statevalue_compare_keys (sv1:StateValue) (sv2:StateValue) : int = compare_compose [Operators.compare sv1.s.a sv2.s.a; Operators.compare sv1.s.s sv2.s.s]
+let instance_compare_keys ((i1,inst1):(int*Instance)) ((i2,inst2):(int*Instance)) : int = compare i1 i2
+// The above functions were all for sorting the various lists into canonical order.
+// Here's one slightly-different function which checks that the entire progstate
+// has been sorted into canonical order throughout (including the wirequeues inside
+// each instance).
+let is_progstate_sorted (ps:ProgState) : bool =
+  (is_list_sorted_uniq mainqueue_compare_keys ps.mq) 
+  && (is_list_sorted_uniq statevalue_compare_keys ps.s)
+  && (is_list_sorted_uniq instance_compare_keys ps.i)
+  && not(List.exists (fun (i,inst)->not (is_list_sorted_uniq wirequeue_compare_keys inst.q)) ps.i)
+//
+let assert_sorted_progstate (ps:ProgState) : unit =  if not (is_progstate_sorted ps) then
+( System.Console.Out.WriteLine("\n\n"^(progstate_to_string ps)^"\n");
+  raise(new System.Exception("INTERROR: progstate is not sorted"));
+)
+
+
+// Here are functions which test for actual full equality, leading up to an equality test on states
+// Before submitting things to these tests, you should sort themself, so the syntactic structural
+// comparison we do here ends up amounting to one quotiented by structural congruence.
+let rec vprim_compare (v1:VPrim) (v2:VPrim) : int = match (v1,v2) with
+  | (VAny,VAny) -> 0 | (VAny,_) -> -1 | (_,VAny) -> 1
+  | (VVoid,VVoid) -> 0 | (VVoid,_) -> -1 | (_,VVoid) -> 1
+  | (VInt(i1),VInt(i2)) -> compare i1 i2 | (VInt(_),_) -> -1 | (_,VInt(_)) -> 1
+  | (VString(s1),VString(s2)) -> Operators.compare s1 s2 | (VString _,_) -> -1 | (_,VString _) -> 1
+  | (VBool(b1),VBool(b2)) -> if b1=b2 then 0 else if b2 then 1 else -1 | (VBool _,_) -> -1 | (_,VBool _) -> 1
+  | (VEnum(e1),VEnum(e2)) -> Operators.compare e1 e2 | (VEnum _,_) -> -1 | (_,VEnum _) -> 1
+  | (VRecord(fs1),VRecord(fs2)) -> list_compare vprim_record_compare fs1 fs2
+and vprim_record_compare (v1,t1) (v2,t2) = compare_compose [vprim_compare v1 v2; Operators.compare t1 t2]
+and stateversion_compare (sv1:StateVersion) (sv2:StateVersion) : int = compare_compose [Operators.compare sv1.a sv2.a; Operators.compare sv1.s sv2.s; compare sv1.seq sv2.seq; nodeoption_compare sv1.n sv2.n]
+and nodeoption_compare (n1:Node option) (n2:Node option) : int = match (n1,n2) with
+  | (None,None) -> 0 | (None,_) -> -1 | (_,None) -> 1
+  | (Some n1,Some n2) -> compare_compose [Operators.compare n1.s n2.s; compare n1.src n2.src]
+and value_compare (v1:Value) (v2:Value) : int = compare_compose [Operators.compare v1.t v2.t; importance_compare v1.i v2.i; vprim_compare v1.v v2.v; dependencies_compare v1.dep v2.dep]
+and importance_compare (i1:Importance) (i2:Importance) = match (i1,i2) with
+  | (Unimportant,Unimportant)->0 | (Unimportant,_) -> -1 | (_,Unimportant) -> 1 | (Important,Important) -> 0
+and dependencies_compare (dep1:Dependencies) (dep2:Dependencies) = list_compare stateversion_compare dep1 dep2
+and statevalue_compare (sv1:StateValue) (sv2:StateValue) : int = compare_compose [stateversion_compare sv1.s sv2.s; vprim_compare sv1.v sv2.v; importance_compare sv1.i sv2.i; Operators.compare sv1.t sv2.t]
+and mainport_compare (mp1:MainPort) (mp2:MainPort) : int = compare_compose [Operators.compare mp1.a mp2.a; Operators.compare mp1.h mp2.a; type_compare_imp mp1.ht mp2.ht; queue_compare mp1.nq mp2.nq]
+and wireport_compare (wp1:WirePort) (wp2:WirePort) : int = compare_compose [compare wp1.i wp2.i; Operators.compare wp1.src wp2.src; Operators.compare wp1.dst wp2.dst; queue_compare wp1.nq wp2.nq]
+and mainqueue_compare (mq1:MainQueue) (mq2:MainQueue) : int = compare_compose [Operators.compare mq1.a mq2.a; Operators.compare mq1.h mq2.h; type_compare_imp mq1.ht mq2.ht; list_compare mainqueue_compare_content mq1.q mq2.q]
+and mainqueue_compare_content ((v1,wp1):(Value*WirePort)) ((v2,wp2):(Value*WirePort)) : int = compare_compose [value_compare v1 v2; wireport_compare wp1 wp2]
+and wirequeue_compare (wq1:WireQueue) (wq2:WireQueue) : int = compare_compose [Operators.compare wq1.src wq2.src; Operators.compare wq1.dst wq2.dst; list_compare value_compare wq1.q wq2.q]
+and instance_compare (i1:Instance) (i2:Instance) : int = compare_compose [Operators.compare i1.a i2.a; Operators.compare i1.h i2.h; type_compare_imp i1.ht i2.ht; list_compare wirequeue_compare i1.q i2.q; wireport_compare i1.r i2.r; compare i1.count i2.count]
+and iinstance_compare ((i1,inst1):(int*Instance)) ((i2,inst2):(int*Instance)) : int = compare_compose [compare i1 i2; instance_compare inst1 inst2]
+and progstate_compare (ps1:ProgState) (ps2:ProgState) : int = compare_compose [list_compare mainqueue_compare ps1.mq ps2.mq; list_compare statevalue_compare ps1.s ps2.s; list_compare iinstance_compare ps1.i ps2.i]
+
+
+
+
+
+
+
+
+
+
+// genericvalue_of_type: constructs "Any". Or, if we're asked for a record,
+// constructs record(Any,Any,Any...).
+let rec genericvalue_of_type (p:Prog) ((t,i):Type) : Value =
+  // first a subfunction which constructs a VPrim
+  let rec vprim_of_type (t:TName) : VPrim =
+  ( let prim = List.assoc t p.tp in
+    match prim with
+    | TRecord(fs) -> let fs = List.map (fun ((ff,ft):TField)->(vprim_of_type ft, ft)) fs in VRecord(fs)
+    | _ -> VAny
+  )
+  in
+  {new Value with t=t and i=i and v=vprim_of_type t and dep=[]}
+
+
+// allvprims_of_type: given a bool named n, constructs [n=true,n=false]. Given an enum,
+// constructs [n=enum1,n=enum2,...]. Given a string/int, constructs [n=any]. Given
+// a record, constructs [n.0=A, n.0=B, n.1=X, n.1=Y, n.1=Z].
+let rec allvprims_of_type (p:Prog) (t:TName) (s:string) : ((string*VPrim)list) =
+( let tprim = List.assoc t p.tp in
+  match tprim with
+  | TVoid -> [(s,VVoid)]
+  | TBool -> [(s,VBool(true)); (s,VBool(false))]
+  | TInt -> [(s,VAny)]
+  | TString -> [(s,VAny)]
+  | TEnum(es) -> List.map (fun e -> (s,VEnum(e))) es
+  | TRecord(fs) -> List.concat (List.mapi (fun i (f,ft) -> allvprims_of_type p ft (s^"."^string(i))) fs)
+)
+
+// remove_assignment_from_allvprims: given a list of things that we have to hit
+// [s.track=true, s.track=false, s.scan=true, s.scan=false], and given a
+// value id=v:t which has just been assigned, we remove from the "to-hit" list
+// anything that it did indeed hit.
+let rec remove_assignment_from_allvprims (p:Prog) ((id,v):(string*VPrim)) (sv:(string*VPrim)list) : ((string*VPrim)list) =
+( System.Console.Out.WriteLine ("cover: "^id^" = "^(vprim_to_string v)^"\n");
+  match v with
+  | VAny -> List.choose (fun (s,v)->if s=id then None else Some(s,v)) sv
+  | VVoid -> List.choose (fun (s,v)->if s=id && (v=VVoid || v=VAny) then None else Some(s,v)) sv
+  | VInt(i) -> List.choose (fun (s,v)->if s=id && (v=VInt(i) || v=VAny) then None else Some(s,v)) sv
+  | VString(s) -> List.choose (fun (s,v)->if s=id && (v=VString(s) || v=VAny) then None else Some(s,v)) sv
+  | VBool(b) -> List.choose (fun (s,v)->if s=id && (v=VBool(b) || v=VAny) then None else Some(s,v)) sv
+  | VEnum(e) -> List.choose (fun (s,v)->if s=id && (v=VEnum(e) || v=VAny) then None else Some(s,v)) sv
+  | VRecord(fs) ->
+      ( let sv = ref sv in
+        List.iteri (fun i (v,t) -> sv := remove_assignment_from_allvprims p (id^"."^string(i),v) (!sv)) fs;
+        !sv
+      )
+)
+
+
+
+let rec vop_not (v:VPrim) = match v with VAny -> VAny | VBool(b) -> VBool(not b) | _ -> raise(new System.Exception("vop_not("^(vprim_to_string v)^")"))
+and vop_plus v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VInt(i1+i2) | _ -> raise(new System.Exception("vop_plus("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_minus v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VInt(i1-i2) | _ -> raise(new System.Exception("vop_minus("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_times v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VInt(i1*i2) | _ -> raise(new System.Exception("vop_times("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_divide v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VInt(i1/i2) | _ -> raise(new System.Exception("vop_divide("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_below v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VBool(i1<i2) | (VAny,VString s) -> VAny | (VString s,VAny) -> VAny | (VString s1,VString s2) -> VBool(String.Compare(s1,s2)<0) | _ -> raise(new System.Exception("vop_below("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_above v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VBool(i1>i2) | (VAny,VString s) -> VAny | (VString s,VAny) -> VAny | (VString s1,VString s2) -> VBool(String.Compare(s1,s2)>0) | _ -> raise(new System.Exception("vop_above("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_leq v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VBool(i1<=i2) | (VAny,VString s) -> VAny | (VString s,VAny) -> VAny | (VString s1,VString s2) -> VBool(String.Compare(s1,s2)<=0) | _ -> raise(new System.Exception("vop_leq("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_geq v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VInt i) -> VAny | (VInt i,VAny) -> VAny | (VInt i1,VInt i2) -> VBool(i1>=i2) | (VAny,VString s) -> VAny | (VString s,VAny) -> VAny | (VString s1,VString s2) -> VBool(String.Compare(s1,s2)>=0) | _ -> raise(new System.Exception("vop_geq("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_and v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VBool b)->VAny | (VBool b,VAny) -> VAny | (VBool b1,VBool b2)->VBool(b1&&b2) | _ -> raise(new System.Exception("vop_and("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_or v1 v2 = match (v1,v2) with (VAny,VAny)->VAny | (VAny,VBool b)->VAny | (VBool b,VAny) -> VAny | (VBool b1,VBool b2)->VBool(b1||b2) | _ -> raise(new System.Exception("vop_or("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+and vop_neq v1 v2 = vop_not(vop_eq v1 v2)
+and vop_eq v1 v2 = match (v1,v2) with | (VAny,_)->VAny | (_,VAny)->VAny
+  | (VVoid,VVoid)->VBool(true) | (VInt i1,VInt i2)->VBool(i1=i2) | (VString s1,VString s2)->VBool(s1=s2)
+  | (VBool b1,VBool b2)->VBool(b1=b2) | (VEnum e1,VEnum e2)->VBool(e1=e2)
+  | (VRecord vs1,VRecord vs2) -> let eqs = List.map2 (fun (v1,t1) (v2,t2) -> [vop_eq v1 v2;VBool(t1=t2)]) vs1 vs2 in 
+         let eqs = List.concat eqs in List.foldBack vop_eq eqs (VBool(true))
+  | _ -> raise(new System.Exception("vop_eq("^(vprim_to_string v1)^","^(vprim_to_string v2)^")"))
+        
+
+let seq_oldest (seq1:int) (seq2:int) = if seq1<seq2 then seq1 else seq2
+let stateversion_compare_noseq (sv1:StateVersion) (sv2:StateVersion) = compare_compose [Operators.compare sv1.a sv2.a; Operators.compare sv1.s sv2.s]
+
+let dep_union (dep:Dependencies) : Dependencies = 
+  let rec depmerge_seq (dep:Dependencies) = match dep with [] -> []
+      | sv1::[] -> [sv1]
+      | sv1::sv2::dep -> if sv1.a=sv2.a && sv1.s=sv2.s then depmerge_seq ({sv2 with seq=seq_oldest sv1.seq sv2.seq} :: dep)
+                         else sv1 :: (depmerge_seq (sv2::dep)) in
+  depmerge_seq (List.sortWith stateversion_compare_noseq dep)
+
+
+let rec drill_record_getvprim (vt:(VPrim*TName)) (idp:IdPath) : (VPrim*TName) = match (vt,idp) with
+  | (_,[]) -> vt
+  | ((VRecord(vs),t),i::idp) -> let i=int32(i) in drill_record_getvprim (List.nth vs i) idp
+  | (vt,idp) -> raise(new System.Exception("RUNERROR: val "^(vprimt_to_string vt)^" not a record"))
+//
+and drill_record_setvprim (vt:(VPrim*TName)) (idp:IdPath) (setvt:(VPrim*TName)) : (VPrim*TName) = match (vt,idp) with
+  | (_,[]) -> setvt
+  | ((VRecord(vs),t),i::idp) -> let i=int32(i) in 
+      let vs = Array.ofList(vs) in
+      vs.[i] <- drill_record_setvprim vs.[i] idp setvt;
+      (VRecord(List.ofArray(vs)),t)
+  | (vt,idp) -> raise(new System.Exception("RUNERROR: val "^(vprimt_to_string vt)^" not a record"))
+
+
+
+// queuelist_contains_msg: says whether there exists a message on this port.
+// Note that the "WireQueue list" data structure within Instance is defined
+// so that each WireQueue in the list has a non-empty queue. That makes
+// our test easy...
+let queuelist_contains_msg (wqs:WireQueue list) (wp:WirePort) =
+  List.exists (fun (wq:WireQueue) -> wq.src=wp.src && wq.dst=wp.dst) wqs
+
+// splitoff: if there is an element in the list which matches a,h,ht, then split it off and
+// return it separately
+let rec splitoff_mainports_element ((a,h,ht):(string*string*Type)) (mps:MainPort list) : (MainPort list * (MainPort option)) =
+  match mps with [] -> ([],None)
+  | (mp::mps) -> if (mp.a=a && mp.h=h && mp.ht=ht) then (mps,Some mp)
+                 else let (a,r)=splitoff_mainports_element (a,h,ht) mps in (mp::a, r)
+
+let rec splitoff_wireports_element ((i,src,dst):(int*string*string)) (wps:WirePort list) : (WirePort list * (WirePort option)) =
+  match wps with [] -> ([],None)
+  | (wp::wps) -> if (wp.i=i && wp.src=src && wp.dst=dst) then (wps,Some wp)
+                 else let (a,r)=splitoff_wireports_element (i,src,dst) wps in (wp::a, r)
+
+let append_queue (q:'a list) (nq:NQueue) (v:'a) = match nq with
+  | NUnbounded -> q@[v]
+  | NBounded(n) -> if n=0 then [] else if List.length(q)>=n then (List.tail q)@[v] else q@[v]
+
+
+
+// queue_remove_main: removes the head of the queue identified by "mp"
+// and returns this value/returnport, plus the new queue with that bit removed.
+let queue_remove_main (mp:MainPort) (mqs:MainQueue list) : (MainQueue list * (Value*WirePort)) = 
+  let (vr:(Value*WirePort) option ref) = ref None in // here we'll keep the answer that we've found
+  //
+  let inner_loop (mq:MainQueue) : (MainQueue option) = if (!vr)<>None || mq.a<>mp.a || mq.h<>mp.h || mq.ht<>mp.ht then Some mq else
+  ( vr := Some (List.head mq.q); let q = List.tail mq.q in
+    if List.length(q)=0 then None
+    else Some {new MainQueue with a=mq.a and h=mq.h and ht=mq.ht and q=q}
+  ) in
+  let mqs = List.choose inner_loop mqs in // runs the inner-loop on each of them
+  match (!vr) with Some vr -> (mqs,vr) | None -> raise(new System.Exception("No queue found"))
+
+
+// queue_add_main: adds the element onto the tail of the queues identified in "mps",
+// creating the queue if it's not there already. Returns the new queueset.
+// For the implementation, we keep a mutable copy of "mps" and remove elements from it
+// as we find them in existing queues. Anything left in mps means there was no
+// preexisting queue for those mainports so we have to create them.
+let queue_add_main (mps:MainPort list) (vr:(Value*WirePort)) (mqs:MainQueue list) : (MainQueue list) =
+  let mps = ref mps in
+  let inner_loop (mq:MainQueue) : MainQueue =
+  ( let (mps2,thismp) = splitoff_mainports_element (mq.a,mq.h,mq.ht) (!mps) in 
+    match thismp with None -> mq | Some thismp ->
+    ( mps := mps2;
+      {new MainQueue with a=mq.a and h=mq.h and ht=mq.ht and q=(append_queue mq.q thismp.nq vr)}
+    )
+  ) in
+  let mqs = List.map inner_loop mqs in // will add to various of the queues; "mps" will have some elements removed from it.
+  let nqs = List.map (fun (mp:MainPort)->{new MainQueue with a=mp.a and h=mp.h and ht=mp.ht and q=[vr]})(!mps) in // build fresh queues for the ones where we couldn't just add to a pre-existing one
+  List.sortWith mainqueue_compare_keys (mqs @ nqs)
+  
+// queue_broadcast_main: adds the element onto the tail of all queues which handle
+// messages of this type from this activity
+let queue_broadcast_main (p:Prog) (srcactivity:string) (t:Type) (mqs:MainQueue list) (v:Value) : (MainQueue list) =
+  let rec inner_loop_a (a:Activity) : (MainPort list) = List.choose (inner_loop_h a) a.h
+  and inner_loop_h (a:Activity) ((sh,h):(string*Handler)) : (MainPort option) =
+    if sh=srcactivity && t=h.at then Some{new MainPort with a=a.s and h=sh and ht=h.at and nq=h.aq} else None
+  in
+  let mps = List.concat (List.map inner_loop_a p.a) in
+  queue_add_main mps (v,NoReturn) mqs
+
+
+
+// queue_remove: removes the head of the queue identified by "wp" and returns
+// this value, plus the new queue with that bit removed.
+// Note: must call purge-instances afterwards to clean up
+let queue_remove (wp:WirePort) (instances:(int*Instance)list) : ((int*Instance)list * Value) =
+  let (vr:Value option ref) = ref None in // here we'll keep the answer that we've found
+  let rec instance_loop ((i,instance):(int*Instance)) : (int*Instance) =
+    if (!vr)<>None || wp.i<>i then (i,instance)
+    else (i,{instance with q=List.choose (queue_loop i) instance.q}) 
+  and queue_loop (i:int) (wq:WireQueue) : (WireQueue option) =
+    if wp.src<>wq.src || wp.dst<>wq.dst || (!vr)<>None then Some(wq)
+    else
+    ( vr := Some(List.head wq.q);
+      if List.length(wq.q)=1 then None
+      else Some {new WireQueue with src=wq.src and dst=wq.dst and q=List.tail wq.q}
+    )
+  in
+  let instances = List.map instance_loop instances in
+  match (!vr) with Some vr -> (instances,vr) | None -> raise(new System.Exception("No queue found to remove from "^(wireport_to_string wp)^"."))
+
+// queue_add: adds the element onto the tail of all queues in the "wps" list.
+// Similar to queue_add_main, above.
+let queue_add (wps:WirePort list) (v:Value) (instances:(int*Instance)list) : ((int*Instance)list) =
+  // in the following inner loop, "wps" is a ref list, and the function removes entries from it as they're added
+  let rec instance_loop (wps:WirePort list ref) ((i,instance):(int*Instance)) : (int*Instance) =
+    let wpis = ref (List.filter (fun (wp:WirePort)->wp.i=i) (!wps)) in // get the ones just for this instance
+    wps := List.filter (fun (wp:WirePort)-> wp.i<>i) (!wps); // and update the main list to remove the rest
+    let q = List.map (queue_loop wpis i) instance.q in // this adds things from wpi into queues that the instance already had
+    let newq = List.map (fun (wp:WirePort) -> {new WireQueue with src=wp.src and dst=wp.dst and q=[v]}) (!wpis) in // make new queues for stuff that couldn't be added
+    (i,{instance with q=List.sortWith wirequeue_compare_keys (q at newq)})
+  // once again, "wpis" is a ref list, and we remove from it each time we can add to a queue
+  and queue_loop (wpis:WirePort list ref) (i:int) (wq:WireQueue) : (WireQueue) =
+  ( let (wpis2,thiswp) = splitoff_wireports_element (i,wq.src,wq.dst) (!wpis) in
+    match thiswp with None -> wq | Some thiswp ->
+    ( wpis := wpis2;
+      {new WireQueue with src=wq.src and dst=wq.dst and q=(append_queue wq.q thiswp.nq v)}
+    )
+  ) in
+  //
+  let wps = ref wps in 
+  let instances = List.map (instance_loop wps) instances in
+  if List.length(!wps)>0 then raise(new System.Exception("RUNERROR: trying to add a message in a non-existant instance"));
+  instances  
+
+
+// modify_instance_callcount: alters the "count" field of the specified instance.
+// Note: must call purge-instances afterwards, to clean up any empty instances which have no calls outstanding
+// perhaps removing the instance if there are no messages it it and no calls outstanding
+let modify_instance_callcount (changei:int) (delta:int) (instances:(int*Instance)list) : ((int*Instance)list) =
+  let instance_loop ((i,instance):(int*Instance)) : (int*Instance) =
+    if i=changei then (i,{instance with count=instance.count+delta}) else (i,instance)
+  in
+  List.map instance_loop instances
+
+
+
+let rec Evaluate (ef:ExternFun list) (env:Environment) (basedep:Dependencies) (basei:Importance) (e:Expr) : Value = match e.e with
+  | EVoid -> {new Value with v=VVoid and t="void" and i=basei and dep=basedep}
+  | EString(s) -> {new Value with v=VString(s) and t="string" and i=basei and dep=basedep}
+  | EInt(i) -> {new Value with v=VInt(i) and t="int" and i=basei and dep=basedep}
+  | EBool(b) -> {new Value with v=VBool(b) and t="bool" and i=basei and dep=basedep}
+  | EEnum(t,s) -> {new Value with v=VEnum(s) and t=t and i=basei and dep=basedep}
+  | EImportance(i,e) -> let v = Evaluate ef env basedep basei e in
+        {new Value with t=v.t and i=i and v=v.v and dep=v.dep}
+  | EIdPath(idp) ->
+        let envvar = List.assoc (List.head idp) env in
+        let (v,t) = drill_record_getvprim (envvar.v,envvar.t) (List.tail idp) in
+        {new Value with v=v and t=t and i=envvar.i and dep=envvar.dep}
+  | EConstructor(tn,fes) ->
+        let vs = List.map (fun (f,e)->Evaluate ef env basedep basei e) fes in // get all the values
+        let i = imp_max (List.map (fun (v:Value) -> v.i) vs) in // maximum importance of all of them
+        let dep = dep_union (List.concat (List.map (fun v -> v.dep) vs)) in // all the dependencies
+        let vs = List.map (fun (v:Value) -> (v.v,v.t)) vs in // get just VPrim*TName fields
+        {new Value with v=VRecord(vs) and t=tn and i=i and dep=dep}
+  | EExternal(f,es) ->
+        let vs = List.map (Evaluate ef env basedep basei) es in // evaluate all the arguments to values
+        let i = imp_max (List.map (fun (v:Value) -> v.i) vs) in // maximum importance of them all
+        let dep = dep_union (List.concat (List.map (fun v -> v.dep) vs)) in // all the dependencies
+        let ef = List.assoc f ef in
+        {new Value with v=VAny and t=ef.rt and i=i and dep=dep}
+  | EFun(f,es) ->
+        let vs = List.map (Evaluate ef env basedep basei) es in // evaluate all arguments to values
+        let i = imp_max (List.map (fun (v:Value) -> v.i) vs) in // maximum importance of them all
+        let dep = dep_union (List.concat (List.map (fun v -> v.dep) vs)) in // all the dependencies
+        if f="!" then
+        ( if List.length(vs)<>1 then raise(new System.Exception("RUNERROR: function "^f^" given wrong number of arguments"));
+          let v1 = List.head vs in
+          {new Value with v=vop_not(v1.v) and t="bool" and i=i and dep=dep}
+        )
+        else // the rest of the builtins are binary
+        ( if List.length(vs)<>2 then raise(new System.Exception("RUNERROR: function "^f^" given wrong number of arguments"));
+          let (v1,v2) = (List.head vs, List.head (List.tail vs)) in
+          if (f="+") then {new Value with v=vop_plus v1.v v2.v and t="int" and i=i and dep=dep}
+          else if (f="-") then {new Value with v=vop_minus v1.v v2.v and t="int" and i=i and dep=dep}
+          else if (f="*") then {new Value with v=vop_times v1.v v2.v and t="int" and i=i and dep=dep}
+          else if (f="/") then {new Value with v=vop_divide v1.v v2.v and t="int" and i=i and dep=dep}
+          else if (f="<") then {new Value with v=vop_below v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f=">") then {new Value with v=vop_above v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f="<=") then {new Value with v=vop_leq v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f=">=") then {new Value with v=vop_geq v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f="==") then {new Value with v=vop_eq v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f="!=") then {new Value with v=vop_neq v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f="&&") then {new Value with v=vop_and v1.v v2.v and t="bool" and i=i and dep=dep}
+          else if (f="||") then {new Value with v=vop_or v1.v v2.v and t="bool" and i=i and dep=dep}
+          else raise(new System.Exception("RUNERROR: function "^f^" not recognized"));
+        )
+
+
+
+// InitialState: all it does is set up the state variables for all services
+// nb. the flag "useany" means to use VAny rather than the concrete initializer.
+// But if the state variable is a "readwrite" then we will indeed use the concrete
+// initializer because VAny would lead to a too-imprecise analysis
+let MakeInitialState (p:Prog) (useany:bool) : ProgState =
+  let (state:StateValue list ref) = ref [] in // we'll accumulate the results here
+  //
+  let rec mis_activity (a:Activity) = List.iter (mis_state a) a.state
+  and mis_state (a:Activity) ((ss,se):State) =
+  ( let v = if (not useany || tl_contains_unimp se.t ("readwrite",Unimportant)) then Evaluate p.ef [] [] Unimportant se
+    else genericvalue_of_type p (List.head se.t) in // guaranteed from inferTypes that se.t is a unique type
+    let sv = {new StateValue with v=v.v and t=v.t and i=v.i and s={new StateVersion with a=a.s and s=ss and seq=0 and n=None} } in
+    state := sv :: (!state)
+  ) in
+  //
+  List.iter mis_activity p.a;
+  {new ProgState with mq=[] and s=List.sortWith statevalue_compare_keys (!state) and i=[]}
+
+
+// GenerateMoves:
+type GenerateMovesMode = GMFull | GMRemoveInessentialNondeterminism | GMRemoveOrderingNondeterminism | GMRemoveAllNondeterminism | GMToTestForPurging
+// GMFull generates every possible interleaved mode
+// GMRemoveInessentialNondetermism does "transacted-style" things, i.e. it does the first available purely-internal move. Computed in "GenerateMoves" function.
+// GMRemoveOrderingNondeterminsm uses a determinstic order for interleaving, but leaves open all possibilities e.g. for an If
+// GMRemoveAllNondeterminism picks one deterministic move out of those available
+// GMToTestForPurging is only used to indicate the presence or absence of any moves (including any possible future moves at a later time, e.g. for blocking operations begin_read/begin_write)
+// When we rewrite, these things should be systematized. Maybe made into flags/bitmask for whether to generate each kind of move.
+
+// GenerateConsumeMoves: these are easy. A move is merely to consume
+// a message from one of the queues. Note: every MainQueue and WireQueue
+// data structure that's listed is guaranteed to have a non-empty
+// queue. That's our invariant.
+let GenerateConsumeMoves (ps:ProgState) (gmode:GenerateMovesMode) : (Move list) =
+( // gcm: turns a MainQueue structure into a move which offers up the first element of that queue
+  let gcm (mq:MainQueue) : Move =
+    let (v,r) = List.head mq.q in
+    let mp = {new MainPort with a=mq.a and h=mq.h and ht=mq.ht and nq=NQNotForAdding} in
+    MConsume {new MConsumeDat with mp=mp and r=r and isInternal=false} in
+  //
+  let moves = List.map gcm ps.mq in
+  if List.length(moves)=0 then [] else
+  if gmode=GMRemoveAllNondeterminism then [List.head moves] else
+  if gmode=GMRemoveOrderingNondeterminism then [List.head moves] else
+  if gmode=GMRemoveInessentialNondeterminism then moves else
+  moves
+)
+
+
+let get_state_value (states:StateValue list) ((a,s):(string*string)) : (VPrim*TName*Importance*int*(Node option)) =
+  let r = List.tryPick (fun (sv:StateValue)-> if sv.s.a=a && sv.s.s=s then Some(sv.v,sv.t,sv.i,sv.s.seq,sv.s.n) else None) states
+  in match r with Some(r)->r | None -> raise(new System.Exception("RUNERROR: "^a^"."^s^" is not a state"))
+
+let set_state_value (states:StateValue list) ((a,s):(string*string)) ((v,t,i,seq,n):(VPrim*TName*Importance*int*(Node option))) : (StateValue list) =
+  let inner_loop (sv:StateValue) =
+  ( if sv.s.a=a && sv.s.s=s then {new StateValue with s={new StateVersion with a=sv.s.a and s=sv.s.s and seq=seq and n=n} and v=v and t=t and i=i}
+    else sv
+  )
+  in List.map inner_loop states
+
+
+
+// GenerateNodeMoves: a move is when a node consumes the data that's present
+// on its wires and does its computation. In this function we have to scan
+// through the program; for each node, scan through the instances and see which
+// of those instances can trigger the node. We represent a node's "triggers"
+// with a Choices structure:
+type Choices = Join list // (a&b) + (a&c)
+and  Join = string list  // (a&c)
+//
+let GenerateNodeMoves (p:Prog) (ps:ProgState) (gmode:GenerateMovesMode) : (Move list) =
+  let (moves : Move list ref) = ref [] in // accumulate the result here
+  //
+  // gnm_activity, gnm_handler and gnm_node just drill down through the program
+  let rec gnm_activity (a:Activity) = List.iter (gnm_handler a) a.h
+  and gnm_handler (a:Activity) ((sh,h):(string*Handler)) =
+  ( if not a.ext then List.iter (gnm_node a (sh,h)) h.n;
+  )
+  and gnm_node (a:Activity) ((sh,h):(string*Handler)) (n:Node) =
+  ( // figure out the possible triggers for this node
+    let triggers:Choices = (match n.d with
+       | NFirst(wts) -> List.map (fun (w,t)->[w]) wts    // from each (wirename,type) pair, we generate [ [wire1];[wire2];... ]
+       | _ -> [ List.map (fun (w,q)->w) n.inWires ] ) in // from each (wirename,qsize),  we generate [ [wire1;wire2;...] ]
+    // then look through instances to see if they're there
+    List.iter (gnm_instance_choice a.s (sh,h.at) n triggers) ps.i
+  )
+  // gnm_instance takes a proposed activity/handler/node, with the triggers that
+  // can fire it, and examines whether the given instance can supply those triggers.
+  // all it does is an iteration over the trigger choices, to call gnm_instance_join.
+  // That's where the work is.
+  and gnm_instance_choice (a:string) ((h,ht):(string*Type)) (n:Node) (triggers:Choices) ((i,inst):(int*Instance)) =
+  ( if inst.a=a && inst.h=h && inst.ht=ht then List.iter (gnm_instance_join a (h,ht) n (i,inst)) triggers
+  )
+  and gnm_instance_join a (h,ht) n (i,inst) (triggers:Join) =
+  ( let (wps:WirePort list) = List.map (fun (src:string) -> {new WirePort with i=i and src=src and dst=n.s and nq=NQNotForAdding}) triggers in
+    let (contains:bool list) = List.map (queuelist_contains_msg inst.q) wps in
+    let any_missing = List.exists (fun b -> b=false) contains in
+    let abort = (gmode=GMRemoveAllNondeterminism || gmode=GMRemoveOrderingNondeterminism) && List.length(!moves)>0 in
+    if any_missing || abort then () else match n.d with
+    | NIf(ifs) ->
+         // consider the if-expression if (x>5). If we give it x=VAny, then the first branch
+         // might accept it and might also let it fall through. But if we give it x=VInt(7) then
+         // the first branch will accept it and deny a fallthrough. Of course, expressions just
+         // evaluate to booleans VAny/VBool(true)/VBool(false) which makes this process easier
+         // first, we need to grab the environment (made up of the input wires)
+         let wps = List.map (fun src->{new WirePort with i=i and src=src and dst=n.s and nq=NQNotForAdding}) triggers in
+         let (env:Environment) = List.map (fun (wp:WirePort) -> let (ni,v) = queue_remove wp [(i,inst)] in (wp.src,v)) wps in
+         // although the above said "queue_remove", it didn't actually alter the real version of "instances": it discarded the version "ni" where the removals had taken place
+         let rec do_ifs index ifs = match ifs with [] -> () |  (id::ifs) ->
+           ( let v = Evaluate p.ef env [] Unimportant id.ife in match v.v with // "Unimportant" because here, for purposes of move-generation, we don't care about importance. That comes later in PerformMove.
+             | VBool(true) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=index and isInternal=true}) :: (!moves);
+             | VBool(false) -> do_ifs (index+1) ifs
+             | VAny -> System.Console.Out.WriteLine("IFMOVE: index="^string(index)^"\n"); moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=index and isInternal=true}) :: (!moves); do_ifs (index+1) ifs;
+             | _ -> raise(new System.Exception("RUNERROR: not-a-bool handed to if statement"));
+           )
+         in
+         do_ifs 0 ifs
+    | NIfType(ifs) ->
+         // unlike the case for NIfType, the way Values are is that each one has a single
+         // type. Therefore at most one of the if branches here can be taken
+         // NB. guarantee from PostParse that there's at least one "if" and that all have the same ifv
+         // first, we need to grab the environment (made up of the input wires)
+         let wps = List.map (fun src->{new WirePort with i=i and src=src and dst=n.s and nq=NQNotForAdding}) triggers in
+         let (env:Environment) = List.map (fun (wp:WirePort) -> let (ni,v) = queue_remove wp [(i,inst)] in (wp.src,v)) wps in
+         //
+         let ifvar = (List.head ifs).ifv in
+         let v = Evaluate p.ef env [] Unimportant {new Expr with e=EIdPath[ifvar] and t=TUnk} in  // again, still Unimportant because we don't use the type here
+         let ifs = List.mapi (fun i id -> (i,id)) ifs in // put index numbers on them for convenience
+         let index = List.tryPick (fun (i,id) -> if tl_contains_unimp id.ift (v.t,Unimportant) then Some(i) else None) ifs in
+         ( match index with None -> () | Some(index) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=index and isInternal=true}) :: (!moves); )
+    | NCall(peer,verb,nq,e) ->
+         // There are two cases. If we're calling an extern, then we're going to
+         // synthesize its return-value right here and now in a kind of short-circuit.
+         // (This saves on book-keeping, because we don't have to worry about extra instances
+         // in degenerate cases). Note that the shortcircuit does not reduce nondeterminism
+         // in any way. First, all call-handlers have infinite input queue (guaranteed by
+         // PostParse) so we'd never need to simulate the loss of one of the messages
+         // queued up at them. Second, any non-determinism due to a delay before the handler
+         // gets activated can just as well be simulated by a delay before calling the "call" node.
+         // We use index=(-1) for non-extern handlers which will be instantiated,
+         // and index="i" means to call an extern handler and take back the ith element of its type
+         // nb. the call argument has only one type, as guaranteed by InferTypes.
+         if (List.length(e.t)<>1) then raise(new System.Exception("RUNERROR: call argument has non-unique type"));
+         let a = activity_in_prog peer p in
+         let h = handler_in_activity (verb,List.head e.t) a in
+         // nb. the call handler is infinite as guaranteed by PostParse
+         if (h.aq<>NUnbounded) then raise(new System.Exception("RUNERROR: call queue is bounded"));
+         // In both the following we say "isInternal=true" as per the discussion above.
+         let newmoves = if a.ext then List.mapi (fun index _->MFireNode{new MFireNodeDat with instance=i and node=n.s and src=triggers and index=index and isInternal=true}) h.rt
+         else [MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=true}] in
+         moves := newmoves @ (!moves)
+    | NAtomic(ad) -> 
+         // for an atomic primitive (beginread/beginwrite/endread/endwrite) we need to look up the state to see if it can proceed
+         // The possibilities under "Any" are a bit weird. See also the discussion
+         // in PerformMove. GenerateNodeMoves merely generates "possible" moves from the
+         // current abstract state. If the current abstract state had "Any" number of
+         // writers current, then an additional Begin.Write is possible in some of the
+         // real-states corresponding to that abstract-state. And so we have to return it.
+         let (statev,statet,statei,stateseq,staten) = get_state_value ps.s (a,ad.rw) in
+         let (rcount,rcountt) = drill_record_getvprim (statev,statet) ["0"] in // field-names have been compiled down to indexes
+         let (wcount,wcountt) = drill_record_getvprim (statev,statet) ["1"] in
+         let rcount = match rcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: rcount not an int")) in
+         let wcount = match wcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: wcount not an int")) in
+         let canmove = (match ad.m with BeginRead -> wcount<=0 | BeginWrite -> rcount<=0 && wcount<=0 | EndRead -> true | EndWrite -> true) in
+         let canmove = (if gmode=GMToTestForPurging then true else canmove) in
+         if canmove then moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+    // these two are purely internal
+    | NExpr(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=true}) :: (!moves);
+    | NCallreturn(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=true}) :: (!moves);
+    // these are external: i.e. delaying them can change the behavior of the program
+    | NSet(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+    | NGet(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+    | NFirst(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+    | NSignal(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+    | NReturn(_) -> moves := (MFireNode {new MFireNodeDat with instance=i and node=n.s and src=triggers and index=(-1) and isInternal=false}) :: (!moves);
+  )
+  in
+  //
+  List.iter gnm_activity p.a;
+  !moves
+
+
+
+// GenerateMoves: figures out all possible moves; but then,
+// if there were any purely internal ones, it returns only the first one.
+//
+let GenerateMoves (p:Prog) (ps:ProgState) (gmode:GenerateMovesMode) =
+( // a function to pick out the purely internal moves
+  let picki (m:Move) = ( match m with
+    | MSynthesize(md) -> if md.isInternal then Some(m) else None
+    | MConsume(md) -> if md.isInternal then Some(m) else None
+    | MFireNode(md) -> if md.isInternal then Some(m) else None
+  ) in
+  //
+  let cmoves = GenerateConsumeMoves ps gmode in
+  let nmoves = GenerateNodeMoves p ps gmode in
+  if List.length(cmoves)=0 && List.length(nmoves)=0 then [] else
+  //
+  // If no nondetermisn is allowed at all, then we pick a single one
+  if gmode=GMRemoveAllNondeterminism then [List.head (nmoves at cmoves)] else
+  // For the "remove-ordering-nondeterminism" case, we trust that nmoves
+  // already has none of that: it only examined the first node that could
+  // trigger, and gave all the outcomes from that. If there were no node-moves
+  // at all then we'll have to consume something
+  if gmode=GMRemoveOrderingNondeterminism then (if List.length(nmoves)>0 then nmoves else [List.head cmoves]) else
+  // For the "full" case, give them all!
+  if gmode=GMFull then (nmoves at cmoves) else
+  // Finally, for the "remove-inessential-nondeterminism" case, we check
+  // if there are any available internal-only moves, and if there are then we do them.
+  let moves = (GenerateConsumeMoves ps gmode) @ (GenerateNodeMoves p ps gmode) in
+  let imoves = List.choose picki moves in
+  let moves = if List.length(imoves)>0 then [List.head imoves] else moves in 
+  moves
+)
+
+
+
+// purge_instances: removes any empty queues within an instance;
+// and if any instance has no moves available and no outstanding calls then the instance is removed;
+let purge_instances (p:Prog) (ps:ProgState) : ProgState =
+  // we'll pick out the instances that can fire nodes:
+  let moves = GenerateNodeMoves p ps GMToTestForPurging in 
+  let movei = List.choose (fun (m:Move)->match m with MFireNode(fd)->Some(fd.instance) | _ -> None) moves in
+  let msg = "  movei = "^(list_to_string "," (List.map string movei))^"\n" in
+  // and the ones that are waiting for someone to return to them:
+  let waiti = List.choose (fun ((i,inst):(int*Instance))->if inst.count>0 then Some(i) else None) ps.i in
+  let msg = msg^"  waiti = "^(list_to_string "," (List.map string waiti))^"\n" in
+  // and the ones that are external hence 
+  // and merge them together:
+  let keepi = List.sortWith compare (movei @ waiti) in
+  let keepi = list_makeunique keepi in
+  let msg = msg^"  keepi = "^(list_to_string "," (List.map string keepi))^"\n" in
+  // Now we keep every instance that's on that list
+  let (instances, discardi) = List.partition (fun ((i,inst):(int*Instance)) -> List.mem i keepi) ps.i in
+  //if List.length(discardi)>0 then log ("Purge instances:\n"^(progstate_to_string ps)^msg);
+  {ps with i=instances}
+
+
+
+
+
+// PerformMove: given a current state and a choice of move, this
+// computes the successor state. We keep a global variable "instance-counter"
+// so as to generate new names
+let instance_counter = ref 0
+let PerformMove (p:Prog) (ps:ProgState) (move:Move) (movedesc:string) (profiler:(ProfileEvent->unit)option) : ProgState =
+  //log ("\n---\nPerformMove "^movedesc^" "^(move_to_string move)^"...\n");
+  match move with
+  | MConsume(cd) -> 
+    ( // take the message
+      let (mq,(v,r)) = queue_remove_main cd.mp ps.mq in
+      // spawn off a new instance of the handler
+      let inst = (!instance_counter)+1 in
+      instance_counter := inst;
+      // post the init message on all wires that need it
+      let a = activity_in_prog cd.mp.a p in 
+      let h = handler_in_activity (cd.mp.h,cd.mp.ht) a in
+      let outWires = h.outWires in // all wire-names and wire-sizes where the init message has to be posted
+      let (wq:WireQueue list) = List.map (fun ((w,nq):Wire) -> {new WireQueue with src=h.a and dst=w and q=[v]})  outWires in
+      let newinst = {new Instance with a=cd.mp.a and h=cd.mp.h and ht=cd.mp.ht and q=List.sortWith wirequeue_compare_keys wq and r=r and count=0} in
+      let ps = {ps with mq=mq; i=List.sortWith instance_compare_keys ((inst,newinst)::ps.i)} in
+      let ps = purge_instances p ps in // remove all empty queues and instances
+      assert_sorted_progstate ps;
+      ps
+    )
+  | MFireNode(fd) ->
+    ( let states = ref ps.s in // we may have to update the program-state, so take a copy now
+      let mqs = ref ps.mq in // likewise for the mainqueues
+      let instances = ref ps.i in // likewise for the instances
+      //
+      // first, let's store each wire/trigger we need as WirePort datastructures, which are easier:
+      let wps = List.map (fun src->{new WirePort with i=fd.instance and src=src and dst=fd.node and nq=NQNotForAdding}) fd.src in
+      // next, take the trigger messages out of the queues. Store them in a (wire,value) list, the "environment"
+      let (env:Environment) = List.map (fun (wp:WirePort) -> let (ni,v) = queue_remove wp (!instances) in instances := ni; (wp.src,v)) wps in
+      let basei:Importance = imp_max (List.map (fun ((s,v):(String*Value))->v.i) env) in
+      let basedep:Dependencies = dep_union (List.concat (List.map (fun ((s,v):(String*Value))->v.dep) env)) in
+      // the next step depends on what the node is.
+      let instance = List.assoc fd.instance (!instances) in
+      let a = activity_in_prog instance.a p in
+      let h = handler_in_activity (instance.h,instance.ht) a in
+      let n = node_in_handler fd.node h in
+      log ("  move: "^(node_to_string n)^"\n");
+      // we'll just assemble the outWire list, for convenience, because regardless of node type we'll have to send on it
+      // use i=(-1) 
+      let (nwps:WirePort list) = List.map (fun (dst,nq) -> {new WirePort with i=fd.instance and src=n.s and dst=dst and nq=nq}) n.outWires in
+      // NB. Here we have mutable variable "q" for the wirequeues of this instance,
+      // and mutable variable "states" for the states of the program,
+      // and the following code can read+update them both.
+      ( match n.d with 
+        | NExpr(e) ->
+          ( let v = Evaluate p.ef env basedep basei e in
+            instances := queue_add nwps v (!instances)
+          )
+        | NCall(peer,verb,nq,e) ->
+          ( (match profiler with None -> () | Some profiler -> profiler (PCall(ps,peer,verb,List.head e.t,n)) );
+            // The index tells us (-1) to instantiate the call-handler,
+            // or "i" to immediately synthesis the ith return type of an extern call handler.
+            let a:Activity = activity_in_prog peer p in
+            let h:Handler = handler_in_activity (verb,List.head e.t) a in
+            if a.ext then
+            ( // in case of a call to an external node, we synthesis the return value immediately
+              let t = List.nth h.rt fd.index in
+              let v = genericvalue_of_type p t in // "any"
+              if List.length(nwps)>1 then raise(new System.Exception("RUNERROR: a call statement with more than one returnpoints"));
+              instances := queue_add nwps v (!instances);
+              instances := modify_instance_callcount fd.instance (List.length(nwps)) (!instances);
+              // modify-callcount because the very next node will be a CallReturn.
+            )
+            else
+            ( // otherwise, in case of a call to a non-external node, we spin off a new instance
+              // This code is similar to MConsume above.
+              let v = Evaluate p.ef env basedep basei e in // that's what we're going to send
+              // spawn off a new instance of the handler
+              let inst = (!instance_counter)+1 in
+              instance_counter := inst;
+              // post the init message on all wires that need it
+              let outWires = h.outWires in // all wire-names and wire-sizes where the init message has to be posted
+              let (wq:WireQueue list) = List.map (fun ((w,nq):Wire) -> {new WireQueue with src=h.a and dst=w and q=[v]})  outWires in
+              // the return port:
+              if List.length(nwps)>1 then raise(new System.Exception("RUNERROR: call has more than one return port")); // PostParse synthesises just one
+              let r = (if List.length(nwps)=0 then IgnoreReturn else List.head nwps) in
+              let newinst = {new Instance with a=peer and h=verb and ht=h.at and q=List.sortWith wirequeue_compare_keys wq and r=r and count=0} in
+              instances := List.sortWith instance_compare_keys ((inst,newinst) :: (!instances));
+              instances := modify_instance_callcount fd.instance (List.length(nwps)) (!instances);
+            )
+          )
+        | NCallreturn(e) ->
+          ( let v = Evaluate p.ef env basedep basei e in
+            instances := queue_add nwps v (!instances);
+            instances := modify_instance_callcount fd.instance (-1) (!instances);
+          ) 
+        | NSet(idp,t,e) -> 
+          ( let v = Evaluate p.ef env basedep basei e in
+            let varname = List.head idp in
+            let (statev,statet,statei,stateseq,staten) = get_state_value (!states) (a.s,varname) in
+            let svold = {new StateValue with s={new StateVersion with a=a.s and s=varname and seq=stateseq and n=staten} and v=statev and t=statet and i=statei} in
+            let (statev,statet) = drill_record_setvprim (statev,statet) (List.tail idp) (v.v,v.t) in
+            let statei = v.i in
+            let stateseq = stateseq+1 in
+            states := set_state_value (!states) (a.s,varname) (statev,statet,statei,stateseq,Some(n));
+            instances := queue_add nwps v (!instances);
+            let svnew = {new StateValue with s={new StateVersion with a=a.s and s=varname and seq=stateseq and n=Some(n)} and v=statev and t=statet and i=statei} in
+            match profiler with None -> () | Some(profiler) -> profiler(PStateSet(svold,svnew,v.dep));
+          )
+        | NGet(s,t) -> 
+          ( let (statev,statet,statei,stateseq,staten) = get_state_value (!states) (a.s,s) in
+            let v = {new Value with t=statet and i=basei and v=statev and dep={new StateVersion with a=a.s and s=s and seq=stateseq and n=Some(n)}::basedep } in
+            // NB. When we get the statevalue, we take our "importance" from the inwires to our node;
+            // not from whether or not the state was important
+            instances := queue_add nwps v (!instances);
+            let sv = {new StateValue with s={new StateVersion with a=a.s and s=s and seq=stateseq and n=staten} and v=statev and t=statet and i=v.i} in
+            match profiler with None -> () | Some(profiler) -> profiler(PStateGet(sv));
+          )
+        | NAtomic(ad) ->
+          ( // NB. for importance and dependencies, the outwire of an atomic action just
+            // reflect that of the inwire. They don't take importance or dependencies from
+            // the readwrite state.
+            let (statev,statet,statei,stateseq,staten) = get_state_value (!states) (a.s,ad.rw) in
+            let svold = {new StateValue with s={new StateVersion with a=a.s and s=ad.rw and seq=stateseq and n=staten} and v=statev and t=statet and i=statei} in
+            let (rcount,rcountt) = drill_record_getvprim (statev,statet) ["0"] in // "rcount"
+            let (wcount,wcountt) = drill_record_getvprim (statev,statet) ["1"] in // "wcount"
+            let rcounti = match rcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: rcount not an int")) in
+            let wcounti = match wcount with VInt(i)->i | VAny->(-1) | _ -> raise(new System.Exception("RUNERROR: wcount not an int")) in
+            if (ad.m=BeginRead && wcounti>0) then raise(new System.Exception("RUNERROR: BeginRead, but there are writers"));
+            if (ad.m=BeginWrite && (rcounti>0 || wcounti>0)) then raise(new System.Exception("RUNERROR: BeginWrite, but there are others"));
+            if (ad.m=EndRead && rcounti=0) then raise(new System.Exception("RUNERROR: EndRead, but there are no readers"));
+            if (ad.m=EndWrite && wcounti=0) then raise(new System.Exception("RUNERROR: EndWrite, but there are not writers"));
+            // The way we deal with VAny might seem a bit weird. But here it is...
+            // Suppose that rcount=VAny and wcount=VAny. Then the Generate-Node-Moves function
+            // will say that a BeginWrite move may be possible. If the state-space exploration
+            // decides to explore this route, well, the route must necessarily have
+            // corresponded to a reality with rcount=0 and wcount=0, and so we assign
+            // rcount:=0,wcount:=1 in our continuation.
+            let (rcounti,wcounti) = (match ad.m with
+            | BeginRead -> if rcounti=(-1) then (-1,0) else (rcounti+1, 0)
+            | EndRead -> if rcounti=(-1) then (-1,0) else (rcounti-1, 0)
+            | BeginWrite -> (0, 1)
+            | EndWrite -> (0, 0) ) in
+            let rcount = if rcounti=(-1) then VAny else VInt(rcounti) in
+            let wcount = if wcounti=(-1) then VAny else VInt(wcounti) in
+            let (statev,statet) = drill_record_setvprim (statev,statet) ["0"] (rcount, rcountt) in
+            let (statev,statet) = drill_record_setvprim (statev,statet) ["1"] (wcount, wcountt) in            
+            let v = {new Value with t="void" and i=basei and v=VVoid and dep=basedep } in
+            // for staten, we only record lock-acquisitions, not lock-releases
+            let staten = (match ad.m with | BeginRead -> Some(n) | BeginWrite -> Some(n) | EndRead -> staten | EndWrite -> staten) in
+            states := set_state_value (!states) (a.s,ad.rw) (statev,statet,statei,stateseq+1,staten);
+            instances := queue_add nwps v (!instances);
+            let svnew = {new StateValue with s={new StateVersion with a=a.s and s=ad.rw and seq=stateseq+1 and n=Some(n)} and v=statev and t=statet and i=statei} in
+            ( match profiler with None -> () | Some(profiler) -> profiler(PStateSet(svold,svnew,basedep)) );
+            ( match profiler with None -> () | Some(profiler) -> profiler(PAtomic(a.s,ad.rw,ad.m,rcounti,wcounti,n)) );
+          )
+        | NFirst(ids) -> 
+          ( // it came from fd.src which is guaranteed to have size 1, and was put in the environment
+            // therefore the environment has only this value
+            if (List.length(env)<>1) then raise(new System.Exception("RUNERROR: NFirst got more than one value"));
+            let (n,v) = List.head env in
+            instances := queue_add nwps v (!instances);
+          )
+        | NSignal(e) -> 
+          ( let v = Evaluate p.ef env basedep basei e in
+            mqs := queue_broadcast_main p a.s (v.t,v.i) (!mqs) v;            
+          )
+        | NReturn(e) -> 
+          ( let instance = List.assoc fd.instance (!instances) in // that's the instance where this node is firing
+            let v = Evaluate p.ef env basedep basei e in
+            if instance.r=IgnoreReturn then ()
+            else if instance.r=NoReturn then raise(new System.Exception("RUNERROR: return on a NoReturn"))
+            else instances := queue_add [instance.r] v (!instances);
+          )
+        | NIf(ifs) -> 
+          ( let id = List.nth ifs fd.index in // pick out the winning branch
+            // TODO: narrow the local environment and hence "thene"
+            let v = Evaluate p.ef env basedep basei id.thene in
+            let (nwps:WirePort list) = List.map (fun (dst,nq) -> {new WirePort with i=fd.instance and src=id.thens and dst=dst and nq=nq}) id.thenOutWires in
+            instances := queue_add nwps v (!instances)
+          )
+        | NIfType(ifs) ->
+          ( let id = List.nth ifs fd.index in // pick out the winning branch
+            let v = Evaluate p.ef env basedep basei id.tthene in
+            let (nwps:WirePort list) = List.map (fun (dst,nq) -> {new WirePort with i=fd.instance and src=id.tthens and dst=dst and nq=nq}) id.tthenOutWires in
+            instances := queue_add nwps v (!instances)
+          )
+      );
+      // finally, package up the answers
+      let ps = {new ProgState with mq=(!mqs) and s=(!states) and i=(!instances)} in
+      let ps = purge_instances p ps in // remove all empty queues and instances
+      assert_sorted_progstate ps;
+      ps
+    )
+  | _ -> raise(new System.Exception("Move "^(move_to_string move)^" unimplemented"))
+
+  
+
+// step: performs some moves, updating the program state and printing stuff as it goes
+let step (p:Prog) (ps:ProgState) (gprint:ProgState->bool->unit) (keepgoing:bool) (profiler:(ProfileEvent->unit)option) : ProgState =
+  let ps = ref ps in
+  let moves = ref (GenerateMoves p (!ps) GMFull) in
+  let nmade = ref 0 in 
+  while List.length(!moves)>0 do
+  ( let nmoves = List.length(!moves) in
+    let i = rgen.Next(0,nmoves) in
+    let movedesc="#"^string(i+1)^"/"^string(nmoves) in
+    let move = List.nth (!moves) i in
+    gprint (!ps) false;
+    ps := PerformMove p (!ps) move movedesc profiler;
+    gprint (!ps) true;
+    System.Threading.Thread.Sleep(10);
+    nmade := (!nmade)+1;
+    if (keepgoing) then moves := GenerateMoves p (!ps) GMFull else moves := [];
+  ) done;
+  if (!nmade)>0 then log ((progstate_to_string (!ps))^"\n")
+  else log ("stopped.\n");
+  !ps
+
+
+let string_to_expr (s:string) : Expr =
+  let lexbuf = Lexing.from_string s in
+  let expr =
+    try Pars.Expr Lex.token lexbuf
+    with e -> let pos = Lexing.lexbuf_curr_p lexbuf in
+      raise (new System.Exception("Parsing error near char "^string(pos.pos_cnum+1)^"\n"^e.ToString()))
+    in
+  expr
+
+// insert: given Notify(v) that the user provides, we stick it in all the
+// appropriate notify-queues. (i.e. stick it in every notify-queue in the
+// program which handles that notify+type).
+let insert (p:Prog) (ps:ProgState) (gprint:ProgState->bool->unit) (notify:string) (v:Value) : ProgState =
+  log ("INSERT "^notify^"("^(value_to_string v)^")\n");
+  let mq = queue_broadcast_main p notify (v.t,v.i) ps.mq v in
+  gprint ps false;
+  let ps = {ps with mq=mq} in
+  gprint ps true;
+  log ((progstate_to_string ps)^"\n");
+  ps
+
+
+let explore (prefix:string) (p:Prog) (ps:ProgState) (gmode:GenerateMovesMode) (gprint:ProgState->bool->unit) (profiler:(ProfileEvent->unit)option) : unit =
+( let explored = Hashtbl.create 100 in // contains ps->true for every ps that we've visited
+  let workqueue : (ProgState*string) list ref = ref [(ps,prefix)] in // ps*movedesc
+  // invariant: the workqueue contains only things which are not already explored
+  while List.length(!workqueue)>0 do
+    let (ps,prefix) = List.head (!workqueue) in
+    workqueue := List.tail (!workqueue);
+    //gprint ps true;
+    //log ("EXPLORE "^prefix^":\n"^(progstate_to_string ps)^"\n\n");
+    log (prefix^"\n");
+    (match profiler with None -> () | Some profiler -> profiler (PExplore(ps)) );
+    let moves = GenerateMoves p ps gmode in
+    let nmoves = List.length moves in
+    let per_move (i:int) (m:Move) : unit = 
+    ( let movedesc = if nmoves=1 then prefix^"." else prefix^string(i+1)^"/"^string(nmoves)^"." in
+      let ps = PerformMove p ps m movedesc profiler in
+      if Hashtbl.mem explored ps then ()
+      else (workqueue := (ps,movedesc)::(!workqueue); Hashtbl.add explored ps true)
+    )
+    in
+    List.iteri per_move moves
+  done;
+)
+
+
+
diff --git a/tests/fsharp/regression/lucian-standalone-bug/test.fs b/tests/fsharp/regression/lucian-standalone-bug/test.fs
new file mode 100644
index 0000000..3811e89
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/test.fs
@@ -0,0 +1,25 @@
+// #Regression 
+#indent "off"
+
+module Test
+
+open System
+open Utils
+open Ast
+open States
+
+let check ((e,s):(bool*string)) : unit =  if not e then raise(new System.Exception("FAILURE: "^s))
+
+let test_compare_lists () =
+( let c = list_compare compare [1;2;3] [1;2;3] in check (c=0,"compare_lists 1");
+  let c = list_compare compare [] [1;2;3] in check (c<0,"compare_lists 2");
+  let c = list_compare compare [2;3;1] [1;2;3] in check (c=0, "compare lists 3");
+)
+
+let tmain () =
+( log ("Tests.\r\n");
+  test_compare_lists();
+)
+
+// tests: (1) is_progstate_sorted that I write is like checking that fingerprint before sorting and after is identical
+// (2) if progstate_compare says 0, then the key-comparison also says 0.
diff --git a/tests/fsharp/regression/lucian-standalone-bug/utils.fs b/tests/fsharp/regression/lucian-standalone-bug/utils.fs
new file mode 100644
index 0000000..aab7cff
--- /dev/null
+++ b/tests/fsharp/regression/lucian-standalone-bug/utils.fs
@@ -0,0 +1,70 @@
+#indent "off"
+
+module Utils
+
+open System
+
+module String = begin
+
+    let sub (s:string) (start:int) (len:int) =
+        try s.Substring(start,len)
+        with :? System.ArgumentException -> failwith "String.sub" 
+
+end
+// some utility functions. The "unique" ones assume that the list has already been sorted
+module List = begin
+    let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+    let rec assoc x l = 
+        match l with 
+        | [] -> indexNotFound()
+        | ((h,r)::t) -> if x = h then r else assoc x t
+
+    let rec try_assoc x l = 
+        match l with 
+        | [] -> None
+        | ((h,r)::t) -> if x = h then Some(r) else try_assoc x t
+    let rec mem_assoc x l = 
+        match l with 
+        | [] -> false
+        | ((h,_)::t) -> x = h || mem_assoc x t
+
+    let rec remove_assoc x l = 
+        match l with 
+        | [] -> []
+        | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t
+
+    let rec contains x l = match l with [] -> false | h::t -> x = h || contains x t
+    let mem x l = contains x l
+
+    let combine x1 x2 =  List.zip x1 x2
+
+end
+exception Not_found = System.Collections.Generic.KeyNotFoundException
+
+let rec list_assoc_index_of (xs:('a*'b)list) (y:'a) : int = let xs = List.mapi (fun i (xkey,xval) -> (xkey,i)) xs in List.assoc y xs
+let rec list_to_string sep l = match l with [] -> "" | [a]->a | (a::b) -> a^sep^(list_to_string sep b)
+let rec list_makeunique l = match l with []->[] | [a]->[a] | (a::b::l) -> if a=b then list_makeunique (b::l) else a::(list_makeunique (b::l))
+let rec list_intersect f xs ys = match (xs,ys) with ([],_)->[] | (_,[]) -> [] | (x::sxs,y::sys) ->
+  let (c,r)=f x y in if c<0 then list_intersect f sxs ys else if c>0 then list_intersect f xs sys else
+  ( match r with None->list_intersect f sxs sys | Some r -> r :: (list_intersect f sxs sys) )
+let rec list_merge mfn l = match l with []->[] | [a]->[a] | (a::b::l) -> let m=mfn a b in (match m with None -> a::(list_merge mfn (b::l)) | Some ab -> list_merge mfn (ab::l) )
+let rec list_firstdup (fcomp:'a->'a->int) (l:'a list) = match l with []->None | [a]->None | (a::b::l) -> if (fcomp a b)=0 then Some(a) else list_firstdup fcomp (b::l)
+let rec list_remove (x:'a) (ys:'a list) = match ys with [] -> raise Not_found | (y::ys) -> if x=y then ys else y::(list_remove x ys)
+let rec compare_compose (cs:int list) = match cs with [] -> 0 | (c::cs) -> if c<>0 then c else compare_compose cs
+let rec list_compare (f:'a->'a->int) (xs:'a list) (ys:'a list) : int = match (xs,ys) with ([],[])->0 | ([],_)-> -1 | (_,[])->1
+  | (x::xs,y::ys) -> let c = f x y in if c<>0 then c else list_compare f xs ys
+let rec is_list_sorted_uniq (f:'a->'a->int) (xs:'a list) : bool = match xs with []->true | [x]->true
+  | (x::y::zs) -> let c = f x y in if c>=0 then false else is_list_sorted_uniq f (y::zs)
+let fst (a,b)=a
+let snd (a,b)=b
+
+
+let appendlog = ref false
+let log (s:string) =
+  System.Console.Out.WriteLine s;
+  let f = new IO.StreamWriter("log.txt",!appendlog) in
+  let String s = box s in
+  let s = s.Replace("\n","\r\n") in
+  f.Write(s);
+  f.Close();
+  appendlog := true
diff --git a/tests/fsharp/regression/tdirs b/tests/fsharp/regression/tdirs
new file mode 100644
index 0000000..f75b737
--- /dev/null
+++ b/tests/fsharp/regression/tdirs
@@ -0,0 +1,11 @@
+26
+83
+84
+85
+86
+321
+655
+656
+lucian-standalone-bug
+tuple-bug-1
+wecker-1
\ No newline at end of file
diff --git a/tests/fsharp/regression/tuple-bug-1/build.bat b/tests/fsharp/regression/tuple-bug-1/build.bat
new file mode 100644
index 0000000..37e5b9c
--- /dev/null
+++ b/tests/fsharp/regression/tuple-bug-1/build.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/regression/tuple-bug-1/run.bat b/tests/fsharp/regression/tuple-bug-1/run.bat
new file mode 100644
index 0000000..dc0c6fe
--- /dev/null
+++ b/tests/fsharp/regression/tuple-bug-1/run.bat
@@ -0,0 +1,4 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/tuple-bug-1/test.ml b/tests/fsharp/regression/tuple-bug-1/test.ml
new file mode 100644
index 0000000..d839ccd
--- /dev/null
+++ b/tests/fsharp/regression/tuple-bug-1/test.ml
@@ -0,0 +1,30 @@
+// #Regression 
+let failures = ref false
+let report_failure () = 
+  System.Console.Error.WriteLine "NO"; failures := true
+
+
+
+type typ = 
+  | Type_void          
+  | Type_other1 of int 
+  | Type_other2 of int 
+
+
+let _ = if (4, ".ctor",0, Type_void, []) =  (4, ".ctor",0, Type_void, [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success A"
+let _ = if (4, ".ctor",0, Type_void, [Type_other2 4]) =  (4, ".ctor",0, Type_void, [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success B"
+let _ = if (".ctor",0, Type_void, []) =  (".ctor",0, Type_void, [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success C"
+
+let _ = if (0, Type_void, []) =  (0, Type_void, [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success D"
+let _ = if (Type_void, []) =  (Type_void, [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success E"
+let _ = if ([], []) =  ([], [Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success F"
+let _ = if ([], 3) =  ([], 4)  then report_failure () else System.Console.Error.WriteLine "success G"
+let _ = if ([]) =  ([Type_other1 3])  then report_failure () else System.Console.Error.WriteLine "success H"
+
+let _ = 
+  if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) 
+  else
+      (System.Console.Out.WriteLine "Test Passed"; 
+       System.IO.File.WriteAllText("test.ok", "ok"); 
+       exit 0)
+
diff --git a/tests/fsharp/regression/wecker-1/JSTM.dll b/tests/fsharp/regression/wecker-1/JSTM.dll
new file mode 100644
index 0000000..78bcbcd
Binary files /dev/null and b/tests/fsharp/regression/wecker-1/JSTM.dll differ
diff --git a/tests/fsharp/regression/wecker-1/build.bat b/tests/fsharp/regression/wecker-1/build.bat
new file mode 100644
index 0000000..31933f1
--- /dev/null
+++ b/tests/fsharp/regression/wecker-1/build.bat
@@ -0,0 +1,55 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+"%FSC%" %fsc_flags% --optimize -r:jstm.dll -a chan.fsi chan.fs -o:dbwlib2--optimize.dll
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" dbwlib2--optimize.dll
+  @if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --optimize -r:jstm.dll -r:dbwlib2--optimize.dll main.fs -o:main--optimize.exe
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" dbwlib2--optimize.dll
+  @if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -r:jstm.dll -a -o:dbwlib2.dll  chan.fsi chan.fs 
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" dbwlib2.dll
+  @if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -r:jstm.dll -r:dbwlib2.dll -o:main.exe main.fs
+ at if ERRORLEVEL 1 goto Error
+
+  "%PEVERIFY%" main.exe
+  @if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/regression/wecker-1/chan.fs b/tests/fsharp/regression/wecker-1/chan.fs
new file mode 100644
index 0000000..d61ce50
--- /dev/null
+++ b/tests/fsharp/regression/wecker-1/chan.fs
@@ -0,0 +1,241 @@
+// #Regression #Regression 
+#indent "off"
+
+// Basic Machine Learning tools v20060201a DBW
+// - Support for concurrent channels
+
+module DBWchan
+
+open System
+open System.Threading
+open JSTM
+
+let doDBG		= ref false					// Verbose debugging output
+
+////////////////////////////////// List functions ////////////////////////////////
+
+// Filter a list along with a supplied index value and return a new list
+// syntax:		filteri (fun idx val -> bool) [list to filter]
+// example:		filteri (fun i j -> i % 2 <> 0) [0;1;2;3;4;5;6;7]
+//		creates a new list with all the even elements
+let filteri (f : int -> 'a -> bool) (src : 'a list) = 
+	let len			= List.length src in
+	let rec filteri2 f2 src2 i =
+		if i = len then [] else match src2 with
+			  []	-> []
+			| h::t	-> if f2 i h then h::(filteri2 f2 t (i+1)) else filteri2 f2 t (i+1)
+	in
+		filteri2 f src 0
+
+///////////////////////////////// Array functions ///////////////////////////////
+
+let iter_and_set f (t: _[]) 		=								// Iterate a function over an array and set values
+	Array.iteri (fun i -> fun x -> t.[i] <- f x) t
+
+
+
+//////////////////////////// TVar: Transaction Variables /////////////////////////////////
+
+exception BadTxn of string									// Txn exceptions
+
+let retryRaise () 				=							// Abort Txn and try again
+	Tx.Retry();
+	raise(BadTxn("Read across empty barrier"))				// We should NEVER get here
+
+[<ReferenceEquality>]
+type 'a TVar 				= {mutable v: 'a} with			// Txn protected storage
+interface JSTM.IUndoable with
+		member x.Save () 	= 
+			let sav 		= {v=x.v} in box sav.v
+		member x.Undo (o : obj) 
+							= x.v <- unbox o
+	end
+end
+
+let getTVar tv 				=								// Get a TVar within a txn
+	Tx.Current.OpenRead(tv);
+	tv.v
+
+let setTVar tv v 			=								// Set a TVar within a txn
+	Tx.Current.OpenWrite(tv);
+	tv.v					<-	v
+
+////////////////////// MVar: SingleCast/SingleValue Channels /////////////////////////////
+
+type 'a MVar				= ('a option) TVar				// Single place transacted channel
+
+let newMVar (data : 'a) 	=								// Create a channel (not under a TXN)
+	let item : 'a option	= None in					// Create a new empty item for the channel to hold
+	let chan : 'a MVar		= {v=item} in					// and place it in the channel
+		chan												// return the channel
+
+let rcvMVar chan			=								// Take a transacted value from a channel
+	let item				= getTVar chan in
+		match item with
+			  None			-> 	retryRaise ()				// Nothing there, wait for it to fill
+			| Some data		-> 	setTVar chan None; 			// Empty the data in the channel
+							data							//  and return it
+
+let sndMVar chan data		=								// Put a transacted value on a channel
+	let item				= getTVar chan in
+		match item with
+			  None			-> 	setTVar chan data			// No data, so safe to put a new value
+			| Some data		-> 	retryRaise ()				// Something there, have to wait for it to empty
+	
+//////////// Chan: MultiCast/MultiValue/Bounded Channels  /////////////////////
+
+let newTVary len value	=									// Create an array of inidividual TVars
+	let a = Array.create len {v=value} in
+		iter_and_set (fun(x) -> {v=value}) a;
+		a
+
+type 'a Port				= class							// Read port for a channel
+	val mutable idx	: int;									// Index to read from for this port (local "head")
+	val chan		: 'a Chan;
+	new(chn: 'a Chan)	= {											// Create a new read port (from inside a TXN)
+		chan=chn;
+		idx=				
+			let ports = getTVar chn.ports  in
+				setTVar chn.ports (ports+1);
+				getTVar chn.tail							// Start after last item in queue
+	}
+	member x.rcv ()			=								// Read a value off the Chan (within a TXN)
+		let chan			= x.chan in
+		let tail			= getTVar chan.tail in
+			if x.idx = tail then							// Queue empty? 
+				retryRaise ()
+			else
+				let value	= getTVar chan.data.[x.idx] in
+				let rcvs	= getTVar chan.rcvs.[x.idx] - 1 in
+				let newIdx	= (x.idx+1) % chan.len in
+					if rcvs = 0 then						// We were the last rcvr, free the item in the channel
+						setTVar chan.head newIdx
+					else
+						setTVar chan.rcvs.[x.idx] rcvs;		// More rcvrs, decrement the count
+					x.idx <- newIdx;						// We move to the next item no matter what
+					value
+end
+
+// Create a new queue with: new Chan<type>(maxDepth,dummyValue)
+and	 'a Chan 				= class							// Channel to write on
+	val head		: int TVar;								// index of first element in the queue (rcv incrs)
+	val tail		: int TVar;								// index of last element in the queue (snd incrs)
+	val ports		: int TVar;								// Total number of read ports on this queue
+	val len			: int;									// Max length of queue
+	val rcvs		: (int TVar) array;						// Number of reads left on this item
+	val data		: ('a TVar) array;						// data storage
+	val dummy		: 'a;									// initial dummy value
+	new(maxDepth,value)		= {								// Constructor
+		dummy=value;
+		head={v=0};
+		tail={v=0}; 
+		ports={v=0};
+		len=maxDepth+1;										// Extry entry for 1 entry channels to work
+		rcvs=newTVary (maxDepth+1) 0;
+		data=newTVary (maxDepth+1) value;
+	}
+	new(baseChan : 'a Chan)		= {								// Create from a prototype
+		dummy=baseChan.dummy;
+		head={v=0};
+		tail={v=0}; 
+		ports={v=0};
+		len=baseChan.len;
+		rcvs=newTVary baseChan.len 0;
+		data=newTVary baseChan.len baseChan.dummy;
+	}
+	member x.snd value		=								// Send a value on a channel
+		let head			= getTVar x.head in
+		let tail			= getTVar x.tail in
+		let newTl			= (tail + 1) % x.len in
+			if !doDBG then Console.WriteLine("DBG Snd0 newTl:{0} head:{1} [{2}]",newTl,head,x.GetHashCode());
+			if head = newTl then							// Queue is full
+				retryRaise ()
+			else
+				let ports	= getTVar x.ports in
+					if !doDBG then Console.WriteLine("DBG Snd1 value:{0} tail:{1} [{2}]",value,tail,x.GetHashCode());
+					setTVar x.data.[tail] value;
+					setTVar x.rcvs.[tail] ports;
+					setTVar x.tail newTl;
+					if !doDBG then Console.WriteLine("DBG Snd2 value:{0} tail:{1} [{2}]",value,tail,x.GetHashCode())
+	member x.rcv ()			=								// Read a value off the Chan (within a TXN)
+		let ports			= getTVar x.ports in			// Make sure that there is no multi-cast
+			if ports > 0 then
+				raise(BadTxn("Tried to do a channel read when there were multi-cast ports!"))
+			else
+				let tail	= getTVar x.tail in
+				let head	= getTVar x.head in
+					if !doDBG then Console.WriteLine("DBG Rcv0 tail:{0} head:{1} [{2}]",tail,head,x.GetHashCode());
+					if head = tail then						// Queue empty? 
+						retryRaise ()
+					else
+						let value	= getTVar x.data.[head] in
+						let newIdx	= (head+1) % x.len in
+							if !doDBG then Console.WriteLine("DBG Rcv1 value:{0} newIdx:{1} [{2}]",value,newIdx,x.GetHashCode());
+							setTVar x.head newIdx;
+							if !doDBG then Console.WriteLine("DBG Rcv2 value:{0} newIdx:{1} [{2}]",value,newIdx,x.GetHashCode());
+							value
+end
+
+////////////////////////////// MultiChannels //////////////////////////////////////////////
+
+type 'a MChan				= class						// Multi Channel (for NN implementation)
+	val mutable rcvLen	: int;							// Number of messages to recv (gather)
+	val	mutable sndLst	: 'a MChan list;				// List of N channels to send to
+	val rcvChn			: 'a Chan;						// Channel to receive N messages on
+	new(rcvChan) = {									// Gather channel
+		rcvLen=0;
+		rcvChn=rcvChan;
+		sndLst=[];
+	}
+	member x.snd value		=							// Send to all channels (inside a TXN)
+		if !doDBG then Console.WriteLine("DBG MChan snd to {0} channels",List.length x.sndLst);
+		List.iter (fun (mchn : 'a MChan) -> 
+			mchn.rcvChn.snd value;
+			if !doDBG then Console.WriteLine("DBG MChan snd {0} to [{1}]",value,mchn.rcvChn.GetHashCode())
+			) x.sndLst
+
+	member x.rcv ()			=							// Receive from all channels (inside a TXN)
+		List.init x.rcvLen (fun i -> x.rcvChn.rcv())
+end
+
+let wrapChan (chan : 'a Chan) =							// Wrap a channel in a multi channel list
+	let mchn = new MChan<_>(chan) in
+		[mchn]
+
+let wrapChans (chans : 'a Chan list)	=				// wrap a list of channels in multi channels
+	List.map (fun chn -> new MChan<_>(chn)) chans
+
+let linkMChan (src : 'a MChan) dstLst =								// Link an MChan to a list of MChans
+	src.sndLst				<- List.append src.sndLst dstLst;
+	List.iter (fun (dst : _ MChan) -> dst.rcvLen <- dst.rcvLen + 1) dstLst
+
+let linkMChans (srcLst:MChan<_> list) (dstLst:MChan<_> list) =							// Link two MChan lists
+	List.iter (fun src -> linkMChan src dstLst) srcLst
+
+///////////////////////////// Thread stuff ////////////////////////////////////////////////
+
+let initThreads min =									// Set default number of threads to use
+	ignore(ThreadPool.SetMinThreads(min,2))
+
+// spawn: ('a lazy) -> ('a -> unit) -> AsyncResult
+let spawn (x: 'a Lazy) g 				=							// Spawn x asyncronusly and call g when completed
+  let fd 					= new Converter<_,_>(fun () -> x.Force()) in
+  let cb 					= AsyncCallback(fun ar -> g (fd.EndInvoke(ar))) in
+	fd.BeginInvoke((), cb, (null : Object))
+
+let txn (x : (unit -> unit))	=							// Group lazy operations under a TXN
+	Tx.Atomically(Tx.D x)
+
+let spawnCntr (x: Lazy<_>) (ctr : int TVar) =						// Spawn x asyncronusly and update a ref TVar counter of running threads
+	let fd					= new Converter<_,_>(fun() ->
+			txn (fun() ->
+				setTVar ctr (getTVar ctr + 1)
+			);
+			x.Force()) in
+	let cb					= AsyncCallback(fun ar -> 
+			fd.EndInvoke(ar);
+			txn (fun() ->
+				setTVar ctr (getTVar ctr - 1)
+			)) in
+		fd.BeginInvoke((), cb, (null : Object))	
+
diff --git a/tests/fsharp/regression/wecker-1/chan.fsi b/tests/fsharp/regression/wecker-1/chan.fsi
new file mode 100644
index 0000000..c6442dc
--- /dev/null
+++ b/tests/fsharp/regression/wecker-1/chan.fsi
@@ -0,0 +1,87 @@
+#indent "off"
+
+module DBWchan
+
+open System
+open System.Threading
+open JSTM
+
+////////////////////////////////// List functions ////////////////////////////////
+
+// Filter a list along with a supplied index value and return a new list
+// syntax:		filteri (fun idx val -> bool) [list to filter]
+// example:		filteri (fun i j -> i % 2 <> 0) [0;1;2;3;4;5;6;7]
+//		creates a new list with all the even elements
+val filteri: (int -> 'a -> bool) -> 'a list -> 'a list
+
+///////////////////////////////// Array functions ///////////////////////////////
+
+val iter_and_set: ('a -> 'a) -> 'a array -> unit			// Iterate a function over an array and set values
+
+//////////////////////////// TVar: Transaction Variables /////////////////////////////////
+[<ReferenceEquality>]
+type 'a TVar				= {mutable v: 'a} with
+	interface IUndoable
+end
+	
+val getTVar: 'a TVar -> 'a							// Get a TVar within a TXN
+val setTVar: 'a TVar -> 'a -> unit					// Set a TVar within a TXN
+
+////////////////////// MVar: SingleCast/SingleValue Channels /////////////////////////////
+
+type 'a MVar	= ('a option) TVar					// Single valued transacted channel
+
+val newMVar: 'a -> 'a MVar							// Create a channel (not in a TXN)
+val rcvMVar: 'a option TVar -> 'a					// Receive a value or block (in a TXN)
+val sndMVar: 'a option TVar -> 'a option -> unit	// Send a value or block (in a TXN)
+
+//////////// Chan: MultiCast/MultiValue/Bounded Channels  /////////////////////
+
+type 'a Port = class								// Multicast read port
+	new: 'a Chan -> 'a Port							// Channel written to
+	member rcv: unit -> 'a							// Receive a value or block in a TXN
+end
+
+and 'a Chan = class									// Multicast write channel
+	val dummy: 'a;									// initial dummy value
+	new: int * 'a -> 'a Chan						// Create the channel (not in a TXN)
+	new: 'a Chan -> 'a Chan							// Create the channel (not in a TXN)
+	member snd: 'a -> unit							// Send a value or block if full
+	member rcv: unit -> 'a							// Receive a value (if no ports (no multicast))
+end
+
+////////////////////////////// MultiChannels //////////////////////////////////////////////
+
+type 'a MChan = class									// Multi Channel (for NN implementation)
+	val rcvChn: 'a Chan;								// Channel to receive N messages on
+	new: 'a Chan -> 'a MChan							// Gather channel
+	member snd: 'a -> unit								// Send to all channels (inside a TXN)
+	member rcv: unit -> 'a list							// Receive from all channels (inside a TXN)
+end
+
+val wrapChan: 'a Chan -> 'a MChan list					// Wrap a channel in a multi channel list
+val wrapChans: 'a Chan list -> 'a MChan list			// wrap a list of channels in multi channels
+
+val linkMChan: 'a MChan -> 'a MChan list -> unit			// Link an MChan and an MChan list
+val linkMChans: 'a MChan list -> 'a MChan list -> unit		// Link two MChan lists
+
+///////////////////////////// Thread stuff ////////////////////////////////////////////////
+
+val initThreads: int -> unit						// Set default number of threads to use
+
+// 1. Create a delegate of arg1 (lazy unit function) and execute it asynchronusly
+// 2. Callback arg2 when arg1 completes
+// 3. Return IAsyncResult immediately so async status can be monitored/controlled
+//
+// Example:
+//
+// let ar = spawn (lazy (foo a b)) (fun a -> ()) in
+//    while ar.IsCompleted = false do
+//	    ...
+
+val spawn: Lazy<'a> -> ('a -> unit) -> IAsyncResult	// Spawn an asynchronus function
+
+val txn: (unit -> unit) -> unit						// Group operations inside a transaction
+
+val spawnCntr: Lazy<unit> -> TVar<int> -> IAsyncResult	// Spawn an async function that incrs a counter at start and decrs at stop
+
diff --git a/tests/fsharp/regression/wecker-1/main.fs b/tests/fsharp/regression/wecker-1/main.fs
new file mode 100644
index 0000000..53db9b0
--- /dev/null
+++ b/tests/fsharp/regression/wecker-1/main.fs
@@ -0,0 +1,88 @@
+// #Regression #Regression 
+#indent "off"
+
+// Basic Machine Learning tools v20060201a DBW
+// - Support for concurrent channels
+
+
+open System
+open System.Threading
+open JSTM
+open DBWchan
+
+type NNdata = float list
+
+let doVerbose		= ref true
+let doDBG			= ref true					// Verbose debugging output
+let tstCntr			= {v=0}
+
+let doWork numSum inputs	=					// Dummy worker for the work thread
+	let sum			= ref 0.0 in
+		for i = 1 to numSum do
+			sum := List.fold (fun accum vec -> List.fold (+) accum vec) !sum inputs
+		done;
+		!sum
+
+let wrkThrd (id:int) numIter numSum (mchn : _ MChan) =
+	let	name		= String.Format("W{0,2}",id) in
+	let v			= ref [[0.0]] in
+		if !doVerbose then
+			Console.WriteLine("doWork {0}: [{1}]",name,mchn.rcvChn.GetHashCode());
+		for i=1 to numIter do
+			if !doVerbose then Console.WriteLine("{0}: <?? inps...",name);
+			txn(fun() -> v := mchn.rcv());
+			if !doVerbose then Console.WriteLine("{0}: <-- inps...",name);
+			let sum = doWork numSum !v in
+				if !doVerbose then Console.WriteLine("{0}: ??> outs...",name);
+				txn(fun() -> mchn.snd (List.head !v));
+				if !doVerbose then Console.WriteLine("{0}: --> outs...",name)
+		done
+
+[<EntryPoint>]
+let main argv =
+	let	args		= Array.length argv in
+	let numThrds	= if args > 1 then Convert.ToInt32(argv.[1]) else 4 in
+	let numIter		= if args > 2 then Convert.ToInt32(argv.[2]) else 100 in
+	let numSum		= if args > 3 then Convert.ToInt32(argv.[3]) else 50000 in
+	let verbose		= if args > 4 then Convert.ToInt32(argv.[4]) else 0 in
+	
+	let data		= List.init 10 (fun i -> float i) in
+	let protoChan	= new Chan<NNdata>(1,data) in
+	let topChan		= new Chan<NNdata>(numThrds,data) in
+	let topMChan	= new MChan<NNdata>(topChan) in
+	let workers		= wrapChans (List.init numThrds (fun i -> new Chan<NNdata>(protoChan))) in
+	let cntr		= ref 999 in
+	let prevCntr	= ref !cntr in
+	let	start		= System.DateTime.Now in
+		
+	Console.WriteLine("ML2 Thrd/{0} Iter/{1} Sum/{2} Verb/{3}",
+		numThrds,numIter,numSum,verbose);
+	
+	//doVerbose	:= if verbose = 0 then false else true;
+	
+	// Link up the workers
+	linkMChan	topMChan	workers;
+	linkMChans	workers		[topMChan];
+	
+	// Create threads
+	initThreads(numThrds);
+	List.iteri (fun i w -> ignore (spawnCntr (lazy (wrkThrd i numIter numSum w)) tstCntr)) workers;
+
+	let v		= ref [data] in
+		for i=1 to numIter do
+			txn (fun() -> topMChan.snd data);
+			if !doVerbose then Console.WriteLine("top  --> outs...");
+			txn (fun() -> v	:= topMChan.rcv());
+			if !doVerbose then Console.WriteLine("top  <-- inps...");			
+			
+			txn(fun() -> cntr := getTVar tstCntr);
+			if !cntr <> !prevCntr then
+				Console.WriteLine("... Thread Counter: {0}",(prevCntr := !cntr;!prevCntr));
+		done;
+	
+	let diff	= System.DateTime.Now.Subtract(start) in
+  Console.Write("Total={0,5:f2} secs, thrds={1,2} iters={2} sums={3}",
+	diff.TotalSeconds,numThrds,numIter,numSum);
+	Console.WriteLine(" Work={0}",numThrds*numIter*numSum);
+	System.IO.File.WriteAllText("test.ok","ok"); 
+  0
diff --git a/tests/fsharp/regression/wecker-1/ml2.exe b/tests/fsharp/regression/wecker-1/ml2.exe
new file mode 100644
index 0000000..2c05f99
Binary files /dev/null and b/tests/fsharp/regression/wecker-1/ml2.exe differ
diff --git a/tests/fsharp/regression/wecker-1/run.bat b/tests/fsharp/regression/wecker-1/run.bat
new file mode 100644
index 0000000..7a5e444
--- /dev/null
+++ b/tests/fsharp/regression/wecker-1/run.bat
@@ -0,0 +1,39 @@
+ at if "%_echo%"=="" echo off
+
+setlocal 
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\..\..\config.bat
+
+
+REM only a valid test if generics supported
+%CLIX% .\main--optimize.exe
+if ERRORLEVEL 1 goto Error
+
+%CLIX% .\main.exe
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SetError
+set NonexistentErrorLevel 2> nul
+goto Error
+
diff --git a/tests/fsharp/single-neg-test.bat b/tests/fsharp/single-neg-test.bat
new file mode 100644
index 0000000..c041e31
--- /dev/null
+++ b/tests/fsharp/single-neg-test.bat
@@ -0,0 +1,108 @@
+ at if "%_echo%"=="" echo off
+setlocal
+set ERRORMSG=
+
+call %~d0%~p0..\config.bat
+if errorlevel 1 (
+    set ERRORMSG=%ERRORMSG% config.bat failed;
+    goto :ERROR
+)
+call :check "%FSC%"
+if not "%ERRORMSG%"=="" goto :ERROR
+
+%FSDIFF% %~f0 %~f0
+ at if ERRORLEVEL 1 (
+    set ERRORMSG=%ERRORMSG% FSDIFF likely not found;
+    goto Error
+)
+
+set testname=%1
+
+REM == Set baseline (fsc vs vs, in case the vs baseline exists)
+IF     EXIST %testname%.vsbsl (set BSLFILE=%testname%.vsbsl)
+IF NOT EXIST %testname%.vsbsl (set BSLFILE=%testname%.bsl)
+
+set sources=
+if exist "%testname%.mli" (set sources=%sources% %testname%.mli)
+if exist "%testname%.fsi" (set sources=%sources% %testname%.fsi)
+if exist "%testname%.ml" (set sources=%sources% %testname%.ml)
+if exist "%testname%.fs" (set sources=%sources% %testname%.fs)
+if exist "%testname%.fsx" (set sources=%sources% %testname%.fsx)
+if exist "%testname%a.mli" (set sources=%sources% %testname%a.mli)
+if exist "%testname%a.fsi" (set sources=%sources% %testname%a.fsi)
+if exist "%testname%a.ml" (set sources=%sources% %testname%a.ml)
+if exist "%testname%a.fs" (set sources=%sources% %testname%a.fs)
+if exist "%testname%b.mli" (set sources=%sources% %testname%b.mli)
+if exist "%testname%b.fsi" (set sources=%sources% %testname%b.fsi)
+if exist "%testname%b.ml" (set sources=%sources% %testname%b.ml)
+if exist "%testname%b.fs" (set sources=%sources% %testname%b.fs)
+if exist "helloWorldProvider.dll" (set sources=%sources% -r:helloWorldProvider.dll)
+
+REM check negative tests for bootstrapped fsc.exe due to line-ending differences
+if "%FSC:fscp=X%" == "%FSC%" ( 
+
+    echo Negative typechecker testing: %testname%
+    echo "%FSC%" %fsc_flags% --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll  %sources%
+    "%FSC%" %fsc_flags% --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll  %sources% 2> %testname%.err
+    @if NOT ERRORLEVEL 1 (
+        set ERRORMSG=%ERRORMSG% FSC passed unexpectedly for  %sources%;
+        goto SetError
+    )
+
+    %FSDIFF% %testname%.err %testname%.bsl > %testname%.diff
+    for /f %%c IN (%testname%.diff) do (
+        echo ***** %testname%.err %testname%.bsl differed: a bug or baseline may neeed updating
+        set ERRORMSG=%ERRORMSG% %testname%.err %testname%.bsl differ;
+
+        IF DEFINED WINDIFF  (start %windiff% %testname%.bsl  %testname%.err)
+        goto SetError
+    )
+    echo Good, output %testname%.err matched %testname%.bsl
+
+    echo "%FSC%" %fsc_flags% --test:ContinueAfterParseFailure --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll  %sources%
+    "%FSC%" %fsc_flags% --test:ContinueAfterParseFailure --vserrors --warnaserror --nologo --maxerrors:10000 -a -o:%testname%.dll  %sources% 2> %testname%.vserr
+    @if NOT ERRORLEVEL 1 (
+        set ERRORMSG=%ERRORMSG% FSC passed unexpectedly for  %sources%;
+        goto SetError
+    )
+
+    %FSDIFF% %testname%.vserr %BSLFILE% > %testname%.vsdiff
+
+    for /f %%c IN (%testname%.vsdiff) do (
+        echo ***** %testname%.vserr %BSLFILE% differed: a bug or baseline may neeed updating
+        set ERRORMSG=%ERRORMSG% %testname%.vserr %BSLFILE% differ;
+        IF DEFINED WINDIFF  (start %windiff% %BSLFILE%  %testname%.vserr)
+        goto SetError
+    )
+    echo Good, output %testname%.vserr matched %BSLFILE%
+)
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+goto :EOF
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+goto :EOF
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0  "%ERRORMSG%"
+exit /b %ERRORLEVEL% 
+goto :EOF
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
+goto :EOF
+
+:Check
+for /f  %%i in ("%1") do (
+  dir %%i > NUL 2>&1 || (
+    set ERRORMSG=%ERRORMSG% %1 was not found; 
+  )
+)
+goto :EOF
\ No newline at end of file
diff --git a/tests/fsharp/single-test-build.bat b/tests/fsharp/single-test-build.bat
new file mode 100644
index 0000000..b135b52
--- /dev/null
+++ b/tests/fsharp/single-test-build.bat
@@ -0,0 +1,313 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\config.bat
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" (
+  goto Skip
+)
+
+set source1=
+if exist test.ml (set source1=test.ml)
+if exist test.fs (set source1=test.fs)
+
+set sources=
+if exist testlib.fsi (set sources=%sources% testlib.fsi)
+if exist testlib.fs (set sources=%sources% testlib.fs)
+if exist test.mli (set sources=%sources% test.mli)
+if exist test.ml (set sources=%sources% test.ml)
+if exist test.fsi (set sources=%sources% test.fsi)
+if exist test.fs (set sources=%sources% test.fs)
+if exist test2.mli (set sources=%sources% test2.mli)
+if exist test2.ml (set sources=%sources% test2.ml)
+if exist test2.fsi (set sources=%sources% test2.fsi)
+if exist test2.fs (set sources=%sources% test2.fs)
+if exist test.fsx (set sources=%sources% test.fsx)
+if exist test2.fsx (set sources=%sources% test2.fsx)
+
+set sourceshw=
+if exist test-hw.mli (set sourceshw=%sourceshw% test-hw.mli)
+if exist test-hw.ml (set sourceshw=%sourceshw% test-hw.ml)
+if exist test-hw.fsx (set sourceshw=%sourceshw% test-hw.fsx)
+if exist test2-hw.mli (set sourceshw=%sourceshw% test2-hw.mli)
+if exist test2-hw.ml (set sourceshw=%sourceshw% test2-hw.ml)
+if exist test2-hw.fsx (set sourceshw=%sourceshw% test2-hw.fsx)
+
+rem to run the 64 bit version of the code set FSC_BASIC_64=FSC_BASIC_64
+set PERMUTATIONS_LIST=FSI_FILE FSI_STDIN FSI_STDIN_OPT FSI_STDIN_GUI FSC_BASIC %FSC_BASIC_64% FSC_HW FSC_O3 GENERATED_SIGNATURE EMPTY_SIGNATURE EMPTY_SIGNATURE_OPT FSC_OPT_MINUS_DEBUG FSC_OPT_PLUS_DEBUG FRENCH SPANISH AS_DLL WRAPPER_NAMESPACE WRAPPER_NAMESPACE_OPT
+
+if "%REDUCED_RUNTIME%"=="1" (
+    echo REDUCED_RUNTIME set
+    
+    if not defined PERMUTATIONS (
+        powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\PickPermutations.ps1' '%cd%' '%FSC%' '%PERMUTATIONS_LIST%'}" > _perm.txt
+        if errorlevel 1 (
+            set ERRORMSG=%ERRORMSG% PickPermutations.ps1 failed;
+            goto :ERROR
+        )
+        set /p PERMUTATIONS=<_perm.txt
+    )
+    
+    powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\DecidePEVerify.ps1' '%cd%' '%FSC%'}"
+    if errorlevel 1 (
+        set ERRORMSG=%ERRORMSG% DecidePEVerify.ps1 failed;
+        goto :ERROR
+    )
+)
+
+if not defined PERMUTATIONS (
+    echo "PERMUTATIONS not defined. Building everything."
+    set PERMUTATIONS=%PERMUTATIONS_LIST%
+)
+
+for %%A in (%PERMUTATIONS%) do (
+    call :%%A
+    IF ERRORLEVEL 1 EXIT /B 1
+)
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+:SETERROR
+set NonexistentErrorLevel 2> nul
+goto Error
+
+:FSI_FILE
+ at echo do :FSI_FILE
+goto :DO_NOOP
+
+:FSI_STDIN
+ at echo do :FSI_STDIN
+goto :DO_NOOP
+
+:FSI_STDIN_OPT
+ at echo do :FSI_STDIN_OPT
+goto :DO_NOOP
+
+:FSI_STDIN_GUI
+ at echo do :FSI_STDIN_GUI
+goto :DO_NOOP
+
+:DO_NOOP
+ at echo No build action to take for this permutation
+goto :EOF
+
+:FRENCH
+ at echo do :FRENCH
+goto :DOBASIC
+
+:SPANISH
+ at echo do :SPANISH
+goto :DOBASIC
+
+:FSC_BASIC
+ at echo do :FSC_BASIC
+:DOBASIC
+"%FSC%" %fsc_flags% --define:BASIC_TEST -o:test.exe -g %sources%
+if ERRORLEVEL 1 goto Error
+
+if NOT EXIST dont.run.peverify (
+    "%PEVERIFY%" test.exe
+    @if ERRORLEVEL 1 goto Error
+)
+goto :EOF
+
+:FSC_BASIC_64
+ at echo do :FSC_BASIC_64
+"%FSC%" %fsc_flags% --define:BASIC_TEST --platform:x64 -o:testX64.exe -g %sources%
+if ERRORLEVEL 1 goto Error
+
+if NOT EXIST dont.run.peverify (
+    "%PEVERIFY%" testX64.exe
+    @if ERRORLEVEL 1 goto Error
+)
+goto :EOF
+
+:FSC_HW
+ at echo do :FSC_HW
+if exist test-hw.* (
+  "%FSC%" %fsc_flags% -o:test-hw.exe -g %sourceshw%
+  if ERRORLEVEL 1 goto Error
+
+
+  if NOT EXIST dont.run.peverify (
+    "%PEVERIFY%" test-hw.exe
+    @if ERRORLEVEL 1 goto Error
+  )
+)
+goto :EOF
+
+:FSC_O3
+ at echo do :FSC_O3
+"%FSC%" %fsc_flags% --optimize --define:PERF -o:test--optimize.exe -g %sources%
+if ERRORLEVEL 1 goto Error
+
+if NOT EXIST dont.run.peverify (
+    "%PEVERIFY%" test--optimize.exe
+    @if ERRORLEVEL 1 goto Error
+)
+goto :EOF
+
+:GENERATED_SIGNATURE
+ at echo do :GENERATED_SIGNATURE
+if NOT EXIST dont.use.generated.signature (
+ if exist test.ml (
+
+  echo Generating interface file...
+  copy /y %source1% tmptest.ml
+  REM NOTE: use --generate-interface-file since results may be in Unicode
+  "%FSC%" %fsc_flags% --sig:tmptest.mli tmptest.ml
+  if ERRORLEVEL 1 goto Error
+
+  echo Compiling against generated interface file...
+  "%FSC%" %fsc_flags% -o:tmptest1.exe tmptest.mli tmptest.ml
+  if ERRORLEVEL 1 goto Error
+
+  if NOT EXIST dont.run.peverify (
+    "%PEVERIFY%" tmptest1.exe
+    @if ERRORLEVEL 1 goto Error
+  )
+ )
+)
+goto :EOF
+
+:EMPTY_SIGNATURE
+ at echo do :EMPTY_SIGNATURE
+if NOT EXIST dont.use.empty.signature (
+    if exist test.ml ( 
+        echo Compiling against empty interface file...
+        echo // empty file  > tmptest2.mli
+
+        copy /y %source1% tmptest2.ml
+        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE -o:tmptest2.exe tmptest2.mli tmptest2.ml
+        if ERRORLEVEL 1 goto Error
+
+        if NOT EXIST dont.run.peverify (
+            "%PEVERIFY%" tmptest2.exe
+            @if ERRORLEVEL 1 goto Error
+        )
+    )
+)
+goto :EOF
+
+:EMPTY_SIGNATURE_OPT
+ at echo do :EMPTY_SIGNATURE_OPT
+if NOT EXIST dont.use.empty.signature (
+    if exist test.ml ( 
+        echo Compiling against empty interface file...
+        echo // empty file  > tmptest2.mli
+
+        copy /y %source1% tmptest2.ml
+        "%FSC%" %fsc_flags% --define:COMPILING_WITH_EMPTY_SIGNATURE --optimize -o:tmptest2--optimize.exe tmptest2.mli tmptest2.ml
+        if ERRORLEVEL 1 goto Error
+
+        if NOT EXIST dont.run.peverify (
+            "%PEVERIFY%" tmptest2--optimize.exe
+            @if ERRORLEVEL 1 goto Error
+        )
+    )
+)
+goto :EOF
+
+:FSC_OPT_MINUS_DEBUG
+ at echo do :FSC_OPT_MINUS_DEBUG
+    "%FSC%" %fsc_flags% --optimize- --debug -o:test--optminus--debug.exe -g %sources%
+    if ERRORLEVEL 1 goto Error
+
+    if NOT EXIST dont.run.peverify (
+        "%PEVERIFY%" test--optminus--debug.exe
+        @if ERRORLEVEL 1 goto Error
+    )
+goto :EOF
+
+:FSC_OPT_PLUS_DEBUG
+ at echo do :FSC_OPT_PLUS_DEBUG
+    "%FSC%" %fsc_flags% --optimize+ --debug -o:test--optplus--debug.exe -g %sources%
+    if ERRORLEVEL 1 goto Error
+
+    if NOT EXIST dont.run.peverify (
+        "%PEVERIFY%" test--optplus--debug.exe
+        @if ERRORLEVEL 1 goto Error
+    )
+)
+goto :EOF
+
+REM Compile as a DLL to exercise pickling of interface data, then recompile the original source file referencing this DLL
+REM THe second compilation will not utilize the information from the first in any meaningful way, but the
+REM compiler will unpickle the interface and optimization data, so we test unpickling as well.
+
+:AS_DLL
+ at echo do :AS_DLL
+if NOT EXIST dont.compile.test.as.dll (
+    "%FSC%" %fsc_flags% --optimize -a -o:test--optimize-lib.dll -g %sources%
+    if ERRORLEVEL 1 goto Error
+    "%FSC%" %fsc_flags% --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g %sources%
+    if ERRORLEVEL 1 goto Error
+
+    if NOT EXIST dont.run.peverify (
+        "%PEVERIFY%" test--optimize-lib.dll
+        @if ERRORLEVEL 1 goto Error
+    )
+
+    if NOT EXIST dont.run.peverify (
+        "%PEVERIFY%" test--optimize-client-of-lib.exe
+    )
+    @if ERRORLEVEL 1 goto Error
+)
+goto :EOF
+
+:WRAPPER_NAMESPACE
+ at echo do :WRAPPER_NAMESPACE
+if NOT EXIST dont.use.wrapper.namespace (
+    if exist test.ml (
+        echo Compiling when wrapped in a namespace declaration...
+
+        echo module TestNamespace.TestModule > tmptest3.ml
+        type %source1%  >> tmptest3.ml
+
+        "%FSC%" %fsc_flags% -o:tmptest3.exe tmptest3.ml
+        if ERRORLEVEL 1 goto Error
+
+        if NOT EXIST dont.run.peverify (
+            "%PEVERIFY%" tmptest3.exe
+            @if ERRORLEVEL 1 goto Error
+        )
+    )
+)
+goto :EOF
+
+:WRAPPER_NAMESPACE_OPT
+ at echo do :WRAPPER_NAMESPACE
+if NOT EXIST dont.use.wrapper.namespace (
+    if exist test.ml (
+        echo Compiling when wrapped in a namespace declaration...
+
+        echo module TestNamespace.TestModule > tmptest3.ml
+        type %source1%  >> tmptest3.ml
+      
+        "%FSC%" %fsc_flags% --optimize -o:tmptest3--optimize.exe tmptest3.ml
+        if ERRORLEVEL 1 goto Error
+
+        if NOT EXIST dont.run.peverify (
+            "%PEVERIFY%" tmptest3--optimize.exe
+            @if ERRORLEVEL 1 goto Error
+        )
+    )
+)
+goto :EOF
\ No newline at end of file
diff --git a/tests/fsharp/single-test-run.bat b/tests/fsharp/single-test-run.bat
new file mode 100644
index 0000000..8b06ac4
--- /dev/null
+++ b/tests/fsharp/single-test-run.bat
@@ -0,0 +1,324 @@
+ at if "%_echo%"=="" echo off
+setlocal
+set ERRORMSG=
+
+dir build.ok > NUL ) || (
+  @echo 'build.ok' not found.
+  set ERRORMSG=%ERRORMSG% Skipped because 'build.ok' not found.
+  goto :ERROR
+)
+
+call %~d0%~p0..\config.bat
+if errorlevel 1 (
+  set ERRORMSG=%ERRORMSG% config.bat failed;
+  goto :ERROR
+)
+
+REM NOTE: There is an expectation here that the full path to FSC, FSi and other tools be given.
+REM This is reasonable for testing, because you want to know exactly which binary you are running.
+REM Ideally we would use 'where' here, but WinXP does not support that.
+REM Trying do define my own WHERE
+
+call :WHERE %FSC%
+if errorlevel 1 goto :ERROR
+call :WHERE %FSI%
+if errorlevel 1 goto :ERROR
+
+set sources=
+if exist testlib.fsi (set sources=%sources% testlib.fsi)
+if exist testlib.fs (set sources=%sources% testlib.fs)
+if exist test.mli (set sources=%sources% test.mli)
+if exist test.ml (set sources=%sources% test.ml)
+if exist test.fsi (set sources=%sources% test.fsi)
+if exist test.fs (set sources=%sources% test.fs)
+if exist test2.mli (set sources=%sources% test2.mli)
+if exist test2.ml (set sources=%sources% test2.ml)
+if exist test2.fsi (set sources=%sources% test2.fsi)
+if exist test2.fs (set sources=%sources% test2.fs)
+if exist test.fsx (set sources=%sources% test.fsx)
+if exist test2.fsx (set sources=%sources% test2.fsx)
+
+set sourceshw=
+if exist test-hw.mli (set sourceshw=%sourceshw% test-hw.mli)
+if exist test-hw.ml (set sourceshw=%sourceshw% test-hw.ml)
+if exist test2-hw.mli (set sourceshw=%sourceshw% test2-hw.mli)
+if exist test2-hw.ml (set sourceshw=%sourceshw% test2-hw.ml)
+if exist test-hw.fsi (set sourceshw=%sourceshw% test-hw.fsi)
+if exist test-hw.fs (set sourceshw=%sourceshw% test-hw.fs)
+if exist test2-hw.fsi (set sourceshw=%sourceshw% test2-hw.fsi)
+if exist test2-hw.fs (set sourceshw=%sourceshw% test2-hw.fs)
+if exist test-hw.fsx (set sourceshw=%sourceshw% test-hw.fsx)
+if exist test2-hw.fsx (set sourceshw=%sourceshw% test2-hw.fsx)
+
+:START
+
+set PERMUTATIONS_LIST=FSI_FILE FSI_STDIN FSI_STDIN_OPT FSI_STDIN_GUI FSC_BASIC %FSC_BASIC_64% FSC_HW FSC_O3 GENERATED_SIGNATURE EMPTY_SIGNATURE EMPTY_SIGNATURE_OPT FSC_OPT_MINUS_DEBUG FSC_OPT_PLUS_DEBUG FRENCH SPANISH AS_DLL WRAPPER_NAMESPACE WRAPPER_NAMESPACE_OPT
+
+if "%REDUCED_RUNTIME%"=="1" (
+    echo REDUCED_RUNTIME set
+    
+    if not defined PERMUTATIONS (
+        powershell.exe %PSH_FLAGS% -command "&{& '%~d0%~p0\PickPermutations.ps1' '%cd%' '%FSC%' '%PERMUTATIONS_LIST%'}" > _perm.txt
+        if errorlevel 1 (
+            set ERRORMSG=%ERRORMSG% PickPermutations.ps1 failed;
+            goto :ERROR
+        )
+        set /p PERMUTATIONS=<_perm.txt
+    )
+)
+
+if not defined PERMUTATIONS (
+    echo "PERMUTATIONS not defined. Running everything."
+    set PERMUTATIONS=%PERMUTATIONS_LIST%
+)
+
+for %%A in (%PERMUTATIONS%) do (
+    call :%%A
+    IF ERRORLEVEL 1 EXIT /B 1
+)
+
+if "%ERRORMSG%"==""  goto Ok
+
+set NonexistentErrorLevel 2> nul
+goto :ERROR
+
+:END
+
+:EXIT_PATHS
+
+:Ok
+echo Ran fsharp %~f0 ok.
+exit /b 0
+goto :EOF
+
+:Skip
+echo Skipped %~f0
+exit /b 0
+goto :EOF
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0  "%ERRORMSG%"
+exit /b %ERRORLEVEL% 
+goto :EOF
+
+REM =========================================
+REM THE TESTS
+REM =========================================
+
+:FSI_STDIN
+ at echo do :FSI_STDIN
+if NOT EXIST dont.pipe.to.stdin (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% "%FSI%" %fsi_flags% < %sources% && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo FSI_STDIN failed;
+  set ERRORMSG=%ERRORMSG% FSI_STDIN failed;
+  )
+)
+goto :EOF
+
+:FSI_STDIN_OPT
+ at echo do :FSI_STDIN_OPT
+if NOT EXIST dont.pipe.to.stdin (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% "%FSI%" %fsi_flags% --optimize < %sources% && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo FSI_STDIN_OPT failed
+  set ERRORMSG=%ERRORMSG% FSI_STDIN_OPT failed;
+  )
+)
+goto :EOF
+
+:FSI_STDIN_GUI
+ at echo do :FSI_STDIN_GUI
+if NOT EXIST dont.pipe.to.stdin (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% "%FSI%" %fsi_flags% --gui < %sources% && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo FSI_STDIN_GUI failed;
+  set ERRORMSG=%ERRORMSG% FSI_STDIN_GUI failed;
+  )
+)
+goto :EOF
+
+:FSI_FILE
+ at echo do :FSI_FILE
+if NOT EXIST dont.run.as.script (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% "%FSI%" %fsi_flags% %sources% && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo FSI_FILE failed
+  set ERRORMSG=%ERRORMSG% FSI_FILE failed;
+  )
+)
+goto :EOF
+
+:FSC_BASIC
+ at echo do :FSC_BASIC
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FSC_BASIC failed
+  set ERRORMSG=%ERRORMSG% FSC_BASIC failed;
+  )
+goto :EOF
+
+:FSC_BASIC_64
+ at echo do :FSC_BASIC_64
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\testX64.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FSC_BASIC_64 failed
+  set ERRORMSG=%ERRORMSG% FSC_BASIC_64 failed;
+  )
+goto :EOF
+
+:FSC_HW
+ at echo do :FSC_HW
+if exist test-hw.* (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test-hw.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo  :FSC_HW failed
+  set ERRORMSG=%ERRORMSG% FSC_HW failed;
+  )
+)
+goto :EOF
+
+:FSC_O3
+ at echo do :FSC_O3
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test--optimize.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FSC_O3 failed
+  set ERRORMSG=%ERRORMSG% FSC_03 failed;
+  )
+goto :EOF
+
+:FSC_OPT_MINUS_DEBUG
+ at echo do :FSC_OPT_MINUS_DEBUG
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test--optminus--debug.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FSC_OPT_MINUS_DEBUG failed
+  set ERRORMSG=%ERRORMSG% FSC_OPT_MINUS_DEBUG failed;
+  )
+goto :EOF
+
+:FSC_OPT_PLUS_DEBUG
+ at echo do :FSC_OPT_PLUS_DEBUG
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test--optplus--debug.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FSC_OPT_PLUS_DEBUG failed
+  set ERRORMSG=%ERRORMSG% FSC_OPT_PLUS_DEBUG failed;
+  )
+goto :EOF
+
+:GENERATED_SIGNATURE
+ at echo do :GENERATED_SIGNATURE
+if NOT EXIST dont.use.generated.signature (
+  if exist test.ml (
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% tmptest1.exe && (
+    dir test.ok > NUL 2>&1 ) || (
+    @echo :GENERATED_SIGNATURE failed
+    set ERRORMSG=%ERRORMSG% FSC_GENERATED_SIGNATURE failed;
+    )
+  )
+)
+goto :EOF
+
+:EMPTY_SIGNATURE
+ at echo do :EMPTY_SIGNATURE
+if NOT EXIST dont.use.empty.signature (
+  if exist test.ml (
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% tmptest2.exe && (
+    dir test.ok > NUL 2>&1 ) || (
+    @echo :EMPTY_SIGNATURE failed
+    set ERRORMSG=%ERRORMSG% FSC_EMPTY_SIGNATURE failed;
+    )
+  )
+)
+goto :EOF
+
+:EMPTY_SIGNATURE_OPT
+ at echo do :EMPTY_SIGNATURE_OPT
+if NOT EXIST dont.use.empty.signature (
+  if exist test.ml (
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% tmptest2--optimize.exe && (
+      dir test.ok > NUL 2>&1 ) || (
+      @echo :EMPTY_SIGNATURE_OPT --optimize failed
+      set ERRORMSG=%ERRORMSG% EMPTY_SIGNATURE_OPT --optimize failed;
+    )
+  )
+)
+goto :EOF
+
+:FRENCH
+ at echo do :FRENCH
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test.exe fr-FR && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :FRENCH failed
+  set ERRORMSG=%ERRORMSG% FRENCH failed;
+  )
+goto :EOF
+
+:SPANISH
+ at echo do :SPANISH
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test.exe es-ES && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :SPANISH failed
+  set ERRORMSG=%ERRORMSG% SPANISH failed;
+  )
+goto :EOF
+
+:AS_DLL
+ at echo do :AS_DLL
+if NOT EXIST dont.compile.test.as.dll (
+  if exist test.ok (del /f /q test.ok)
+  %CLIX% .\test--optimize-client-of-lib.exe && (
+  dir test.ok > NUL 2>&1 ) || (
+  @echo :AS_DLL failed
+  set ERRORMSG=%ERRORMSG% AS_DLL failed;
+  )
+)
+goto :EOF
+
+:WRAPPER_NAMESPACE
+ at echo do :WRAPPER_NAMESPACE
+if NOT EXIST dont.use.wrapper.namespace (
+  if exist test.ml (
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% .\tmptest3.exe && (
+    dir test.ok > NUL 2>&1 ) || (
+    @echo :WRAPPER_NAMESPACE failed
+    set ERRORMSG=%ERRORMSG% WRAPPER_NAMESPACE failed;
+    )
+  )
+)
+goto :EOF
+
+:WRAPPER_NAMESPACE_OPT
+ at echo do :WRAPPER_NAMESPACE_OPT
+if NOT EXIST dont.use.wrapper.namespace (
+  if exist test.ml (
+    if exist test.ok (del /f /q test.ok)
+    %CLIX% .\tmptest3--optimize.exe && (
+    dir test.ok > NUL 2>&1 ) || (
+    @echo :WRAPPER_NAMESPACE_OPT failed
+    set ERRORMSG=%ERRORMSG% WRAPPER_NAMESPACE_OPT failed;
+    )
+  )
+)
+goto :EOF
+
+:WHERE
+for /f %%i in ("%~1") do set _WHERE=%%~$PATH:i
+if not defined _WHERE set ERRORMSG=%ERRORMSG% %~1 not found;
+set _WHERE > NUL 2>&1
+goto :EOF
\ No newline at end of file
diff --git a/tests/fsharp/tdirs b/tests/fsharp/tdirs
new file mode 100644
index 0000000..724c6a2
--- /dev/null
+++ b/tests/fsharp/tdirs
@@ -0,0 +1,7 @@
+core
+optimize
+perf
+regression
+tools
+typecheck
+typeProviders
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/README.txt b/tests/fsharp/tools/FSharp.PowerPack/README.txt
new file mode 100644
index 0000000..64ae18e
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/README.txt
@@ -0,0 +1,10 @@
+
+This directory contains the source for the "test" copies of an early version of the FSharp Power Pack (circa Jan 2010)
+
+They build the TEst.PowerPack.dll and related DLLs.
+
+Many samples acquired during F# as a research project depend on these DLLs
+
+Note: the current version is based on the PowerPack on CodePlex (look at the sources there)
+
+Contact: dsyme
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.Compiler.CodeDom.dll b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.Compiler.CodeDom.dll
new file mode 100644
index 0000000..924f39d
Binary files /dev/null and b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.Compiler.CodeDom.dll differ
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.Linq.dll b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.Linq.dll
new file mode 100644
index 0000000..c96a36d
Binary files /dev/null and b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.Linq.dll differ
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.dll b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.dll
new file mode 100644
index 0000000..30d5143
Binary files /dev/null and b/tests/fsharp/tools/FSharp.PowerPack/fixed/Test.PowerPack.dll differ
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.Settings.targets b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.Settings.targets
new file mode 100644
index 0000000..453c325
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.Settings.targets
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <PropertyGroup>
+    <!-- Standard defaults for configuration and platform  -->
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+  </PropertyGroup>
+  <PropertyGroup>
+    <!-- Standard defaults for output path and warning level -->
+    <OutputPath Condition="'$(OutputPath)' == ''">bin\$(Configuration)</OutputPath>
+    <WarningLevel Condition=" '$(WarningLevel)' == '' ">3</WarningLevel>
+  </PropertyGroup>
+  <!-- Standard interpretations of Debug and Release configurations -->
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <DebugType Condition=" '$(DebugType)' == '' ">full</DebugType>
+    <Optimize Condition=" '$(Optimize)' == '' ">false</Optimize>
+    <DefineConstants Condition=" '$(DefineConstants)' == '' ">DEBUG;TRACE</DefineConstants>
+    <ErrorReport Condition=" '$(ErrorReport)' == '' ">prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <DebugType Condition=" '$(DebugType)' == '' ">pdbonly</DebugType>
+    <Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
+    <DefineConstants Condition=" '$(DefineConstants)' == '' ">TRACE</DefineConstants>
+    <ErrorReport Condition=" '$(ErrorReport)' == '' ">prompt</ErrorReport>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.targets b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.targets
new file mode 100644
index 0000000..dc3fd8c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/CodePlex.targets
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+
+  <PropertyGroup>
+    <LkgVersion>1.9.7.7</LkgVersion>
+    <FsLexUnicode>true</FsLexUnicode>
+    <OutputPath>$(FSharpPowerPackSourcesRoot)\$(Configuration)\bin</OutputPath>
+    <FsLexToolPath>$(FSharpPowerPackSourcesRoot)\..\lkg\FSharp.PowerPack-$(LkgVersion)\bin</FsLexToolPath>
+    <FsLexToolExe>fslex.exe</FsLexToolExe>
+    <FsYaccToolPath>$(FSharpPowerPackSourcesRoot)\..\lkg\FSharp.PowerPack-$(LkgVersion)\bin</FsYaccToolPath>
+    <FsYaccToolExe>fsyacc.exe</FsYaccToolExe>
+  </PropertyGroup>
+
+  <!-- Selecting the correct key pair -->
+
+  <PropertyGroup Condition=" '$(TargetFrameworkVersion)' != 'vSilverlight20'">
+    <OtherFlags>/keyfile:$(FSharpPowerPackSourcesRoot)\fs.snk $(OtherFlags)</OtherFlags>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(TargetFrameworkVersion)' == 'vSilverlight20'">
+    <OtherFlags>/keyfile:$(FSharpPowerPackSourcesRoot)\fsSilverlight.snk $(OtherFlags)</OtherFlags>
+  </PropertyGroup>
+
+</Project>
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/Test.Compiler.CodeDom.fsproj b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/Test.Compiler.CodeDom.fsproj
new file mode 100644
index 0000000..c1122d9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/Test.Compiler.CodeDom.fsproj
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <FSharpPowerPackSourcesRoot>..</FSharpPowerPackSourcesRoot>
+    <Name>Test.Compiler.CodeDom</Name>
+  </PropertyGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.Settings.targets" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{9EF49218-FD64-43A8-922B-84B1FF576773}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AssemblyName>Test.Compiler.CodeDom</AssemblyName>
+    <AllowCrossTargeting>true</AllowCrossTargeting>
+    <TreatWarningsAsErrors>
+    </TreatWarningsAsErrors>
+    <!-- 5310 tracks reenabling -->
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <!-- These dummy entries are needed for F# Beta2 -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="..\assemblyinfo.Common.fs">
+      <Link>assemblyinfo.Common.fs</Link>
+    </Compile>
+    <Compile Include="assemblyinfo.FSharp.Compiler.CodeDom.dll.fs">
+      <Link>assemblyinfo.FSharp.Compiler.CodeDom.dll.fs</Link>
+    </Compile>
+    <Compile Include="..\FSharp.PowerPack\CompilerLocationUtils.fs">
+      <Link>CompilerLocationUtils.fs</Link>
+    </Compile>
+    <Compile Include="codedomvisitor.fs" />
+    <Compile Include="generator.fs" />
+    <Compile Include="compiler.fs" />
+    <Compile Include="codeprovider.fsi" />
+    <Compile Include="codeprovider.fs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="FSharp.Core" />
+  </ItemGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.targets" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets'))" />
+  <Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets'))" />
+</Project>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/assemblyinfo.FSharp.Compiler.CodeDom.dll.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/assemblyinfo.FSharp.Compiler.CodeDom.dll.fs
new file mode 100644
index 0000000..264931d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/assemblyinfo.FSharp.Compiler.CodeDom.dll.fs
@@ -0,0 +1,8 @@
+namespace Microsoft.FSharp
+open System.Reflection
+[<assembly:AssemblyDescription("Test.Compiler.CodeDom.dll")>]
+[<assembly:AssemblyCompany("Microsoft Corporation")>]
+[<assembly:AssemblyTitle("Test.Compiler.CodeDom.dll")>]
+[<assembly:AssemblyCopyright("\169 Microsoft Corporation.  All rights reserved.")>]
+[<assembly:AssemblyProduct("Microsoft\174 F#")>]
+do()
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codedomvisitor.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codedomvisitor.fs
new file mode 100644
index 0000000..117122f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codedomvisitor.fs
@@ -0,0 +1,101 @@
+namespace Microsoft.Test.Compiler.CodeDom.Internal
+
+open System
+open System.IO
+open System.Text
+open System.Collections
+open System.CodeDom
+open System.CodeDom.Compiler
+open Microsoft.FSharp.Collections
+
+//---------------------------------------------------------------------------------------------
+// This module contains several utility functions for walking through CodeDom tree
+module Visitor = 
+
+  // Get all relevant CodeDom properties of an object 
+  // - more functions can return properties for one object because of class hierarchy 
+  let memberMap = [
+      (fun (c:obj) -> match c with | :? CodeArrayCreateExpression as co -> [(co.CreateType:>obj); (co.Initializers:>obj); (co.SizeExpression:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeArrayIndexerExpression as co -> [(co.Indices:>obj); (co.TargetObject:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeAssignStatement as co -> [(co.Left:>obj); (co.Right:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeAttachEventStatement as co -> [(co.Event:>obj); (co.Listener:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeAttributeArgument as co -> [(co.Value:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeAttributeDeclaration as co -> [(co.AttributeType:>obj); (co.Arguments:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeBinaryOperatorExpression as co -> [(co.Left:>obj); (co.Operator:>obj); (co.Right:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeCastExpression as co -> [(co.Expression:>obj); (co.TargetType:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeCatchClause as co -> [(co.CatchExceptionType:>obj); (co.Statements:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeCommentStatement as co -> [(co.Comment:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeCompileUnit as co -> [(co.AssemblyCustomAttributes:>obj); (co.EndDirectives:>obj); (co.Namespaces:>obj); (co.StartDirectives:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeConditionStatement as co -> [(co.Condition:>obj); (co.FalseStatements:>obj); (co.TrueStatements:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeConstructor as co -> [(co.BaseConstructorArgs:>obj); (co.ChainedConstructorArgs:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeDefaultValueExpression as co -> [(co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeDelegateCreateExpression as co -> [(co.TargetObject:>obj); (co.DelegateType:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeDelegateInvokeExpression as co -> [(co.TargetObject:>obj); (co.Parameters:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeDirectionExpression as co -> [(co.Expression:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeEventReferenceExpression as co -> [(co.TargetObject:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeExpressionStatement as co -> [(co.Expression:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeFieldReferenceExpression as co -> [(co.TargetObject:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeIndexerExpression as co -> [(co.Indices:>obj); (co.TargetObject:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeIterationStatement as co -> [(co.IncrementStatement:>obj); (co.InitStatement:>obj); (co.Statements:>obj); (co.TestExpression:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeLabeledStatement as co -> [(co.Statement:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMemberEvent as co -> [(co.ImplementationTypes:>obj); (co.PrivateImplementationType:>obj); (co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMemberField as co -> [(co.InitExpression:>obj); (co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMemberMethod as co -> [(co.ImplementationTypes:>obj); (co.Parameters:>obj); (co.PrivateImplementationType:>obj); (co.ReturnType:>obj); (co.ReturnTypeCustomAttributes:>obj); (co.Statements:>obj); (co.TypeParameters:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMemberProperty as co -> [(co.GetStatements:>obj); (co.ImplementationTypes:>obj); (co.Parameters:>obj); (co.PrivateImplementationType:>obj); (co.SetStatements:>obj); (co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMethodInvokeExpression as co -> [(co.Method:>obj); (co.Parameters:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMethodReferenceExpression as co -> [(co.TargetObject:>obj); (co.TypeArguments:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeMethodReturnStatement as co -> [(co.Expression:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeNamespace as co -> [(co.Comments:>obj); (co.Imports:>obj); (co.Types:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeNamespaceImport as co -> [(co.LinePragma:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeObjectCreateExpression as co -> [(co.CreateType:>obj); (co.Parameters:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeParameterDeclarationExpression as co -> [(co.CustomAttributes:>obj); (co.Direction:>obj); (co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodePropertyReferenceExpression as co -> [(co.TargetObject:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeRemoveEventStatement as co -> [(co.Event:>obj); (co.Listener:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeStatement as co -> [(co.EndDirectives:>obj); (co.StartDirectives:>obj); (co.LinePragma:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeThrowExceptionStatement as co -> [(co.ToThrow:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTryCatchFinallyStatement as co -> [(co.CatchClauses:>obj); (co.FinallyStatements:>obj); (co.TryStatements:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeDeclaration as co -> [(co.BaseTypes:>obj); (co.Members:>obj); (co.TypeAttributes:>obj); (co.TypeParameters:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeDelegate as co -> [(co.Parameters:>obj); (co.ReturnType:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeMember as co -> [(co.Attributes:>obj); (co.Comments:>obj); (co.CustomAttributes:>obj); (co.EndDirectives:>obj); (co.LinePragma:>obj); (co.StartDirectives:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeOfExpression as co -> [(co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeParameter as co -> [(co.Constraints:>obj); (co.CustomAttributes:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeReference as co -> [(co.ArrayElementType:>obj); (co.TypeArguments:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeTypeReferenceExpression as co -> [(co.Type:>obj);] | _ -> []);
+      (fun (c:obj) -> match c with | :? CodeVariableDeclarationStatement as co -> [(co.InitExpression:>obj); (co.Type:>obj);] | _ -> []) ];
+
+  let children o = memberMap |> Seq.collect (fun e -> e o) 
+
+  let rec codeDomFold' f st o = 
+    match box o with 
+      | :? CollectionBase as cl -> 
+           cl |> Seq.cast |> Seq.fold (codeDomFold' f) st;
+      | _ ->
+           let (nst,recurse) = f st o;
+           if (recurse) then
+             o |> children |> Seq.fold (codeDomFold' f) nst;
+           else nst
+
+  let codeDomCallbackWithScope' f  = 
+    let rec callback oscope res o =
+        match box o with 
+          | :? CollectionBase as cl -> 
+              cl |> Seq.cast |> Seq.fold (f callback oscope) res;
+          | _ ->
+              o |> children |> Seq.fold (f callback oscope) res;
+    f callback;
+                       
+  /// Search for members and return flat list of selected members
+  /// Function given as an argument returns tuple - first item specifies
+  /// if the current element should be included in the result, the second
+  /// specifies if we should walk through child members of the current object
+  let codeDomFlatFilter f o = codeDomFold' ( fun st o -> let (inc,rc) = (f o) in if (inc) then (o::st,rc) else (st,rc) ) [] (box o)            
+  
+  /// Walks through the CodeDom tree and keeps current "scope" and the result.
+  /// The result is collected through entire tree, but the modified scope is 
+  /// passed only to sub-nodes of the current node.
+  ///
+  /// First argument is a function that is called for nodes and has a 
+  /// function as a first argument, scope and result as a second and current node as a third.
+  /// The function argument can be used to walk deeper in the tree if wanted.
+  let codeDomCallbackWithScope f scope st o = codeDomCallbackWithScope' f scope st (box o)
+  let codeDomCallBackNoScope f st o = codeDomCallbackWithScope (fun rcall () res x -> f (rcall ()) res x) () st o
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fs
new file mode 100644
index 0000000..9ba38c7
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fs
@@ -0,0 +1,302 @@
+#nowarn "62" // This construct is for ML compatibility.
+
+//-------------------------------------------------------------------------------------------------
+// Internal members
+
+namespace Microsoft.Test.Compiler.CodeDom.Internal
+
+    open System
+    open System.IO
+    open System.Text
+    open System.Collections
+    open System.CodeDom
+    open System.CodeDom.Compiler
+
+    open Microsoft.Test.Compiler.CodeDom.Internal
+    module AspNetUtils = 
+      
+        /// Preprocessing of the CodeDom compile unit from ASP.NET
+        let aspNetPreProcessCompileUnit (c:CodeCompileUnit) =
+        
+            // Remove partial calsses from ASP.NET generated code (we can leave empty namespaces)
+            // F# doesn't support partial classes, so we need to remove generated 'second' part of the 
+            // handwritten class that contains fields for all controls - these have to be written 
+            // manually in the handwritten code...
+            (* if false then  *)
+            begin
+                for ns in c.Namespaces do
+                    // Phase 1. Find classes to remove
+                    let toRemove = 
+                        ns.Types 
+                        |> Seq.cast
+                        |> Seq.filter (fun (t:CodeTypeDeclaration)  -> t.IsPartial ) 
+                        |> Seq.toList
+                    // Phase 2. remove (destructive). 
+                    toRemove |> List.iter ns.Types.Remove;
+            end;
+
+            
+            // Fix one very specific bug in ASP.NET generated CodeDom tree.
+            // In one case it generates "<null>.SetStringResourcePointer" instead of
+            // "this.SetStringResourcePointer" (Reported here: 
+            // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=164512)
+            for ns in c.Namespaces do
+              for t in ns.Types do 
+                for m in t.Members do 
+                  match m with 
+                    | :? CodeMemberMethod as meth ->
+                        if (meth.Name = "FrameworkInitialize") then 
+                          for smt in meth.Statements do
+                            match smt with 
+                            | :? CodeExpressionStatement as stm -> 
+                                match stm.Expression with 
+                                  | :? CodeMethodInvokeExpression as inv ->
+                                    if ((inv.Method.TargetObject = null) && (inv.Method.MethodName = "SetStringResourcePointer")) then 
+                                      inv.Method.TargetObject <- new CodeThisReferenceExpression();
+                                  | _ -> ();
+                            | _ -> ();
+                        else ();
+                    | _ -> ();
+              
+
+        // Sorts ASP.NET source files
+        // ASP.NET compiler sends three kinds of files
+        // - CodeDOM generated file from ASPX file
+        // - handwritten file (codebehind for the previous)
+        // - fast factory for creating the first one
+        // 
+        // We need to send them to compiler in following order:
+        // - handwritten, aspx, handwritten, aspx, ..., factory
+        // 
+        // File name is: "Something.num.fs" where num is an index, but the array isn't
+        // sorted so we sort them using the index. Then we find all ASPX and swap 
+        // ASPX and handwritten file. Factory should be the last file.
+        
+
+        /// Does the file contain the given text?
+        let fileContains (text:string) (filename:string) = 
+          try
+            use fs = new IO.StreamReader(filename)
+            let rec testLine () = 
+                let line = fs.ReadLine()
+                (line <> null) && (line.IndexOf(text) <> -1 || testLine())
+            testLine()
+          with _ -> false
+
+        /// Swap two elements of an array
+        let swap (arr:'a[]) i j = 
+            let tmp = arr.[j] 
+            arr.[j] <- arr.[i]
+            arr.[i] <- tmp
+
+
+        /// Compiled forms of ASPX source files always contain "(__initialized:bool)".
+        /// The factory file contains "static member Create_ASP_"
+        let isFactoryFile filename = 
+            fileContains "static member Create_ASP_" filename &&
+            fileContains "FastObjectFactory" filename 
+
+        let isGeneratedFromAspxFile filename = 
+            fileContains "static val mutable private __initialized:bool" filename &&
+            fileContains "<autogenerated>" filename
+
+        let isUserFile filename = 
+            not (isGeneratedFromAspxFile filename)  &&
+            not (isFactoryFile filename) 
+
+          // REVIEW: will "Temporary ASP.NET Files" survive internationalization????
+        let indexOfAspNetFile(el:string) = 
+              let n = 
+                try
+                  let bnum = el.LastIndexOf(".", el.Length - 4)
+                  Int32.Parse(el.Substring(bnum + 1, el.Length - bnum - 4))
+                with _ -> -1
+              if (el.IndexOf("Temporary ASP.NET Files") <> -1) 
+              then n
+              else -1
+      
+          
+        let aspNetSortFiles (files:string array) =
+
+            // Verify that files are from ASP.NET & sort them.
+            let aspFiles = files |> Array.map (fun el -> indexOfAspNetFile el, el)              
+            let allAspNet = aspFiles |> Array.forall (fun (n, a) -> n <> -1)
+            
+            let sortedFiles = 
+                if (allAspNet) then
+                    Array.sortInPlaceWith (fun (n1, _) (n2, _) -> n1 - n2) aspFiles
+                    let filesMod = aspFiles |> Array.map snd 
+                    
+                    //System.Windows.Forms.MessageBox.Show(sprintf "filesMod = %A" filesMod) |> ignore
+                    // Rearrange files
+                    // NOTE: ack! surely there's a nicer way to do this!
+                    let mutable i = 0
+                    while (i < filesMod.Length) do
+                        if  (isGeneratedFromAspxFile filesMod.[i]
+                             && not (isFactoryFile filesMod.[i]) 
+                             && isUserFile filesMod.[i+1]) 
+                        then
+                            swap filesMod i (i+1)
+                            i <- i + 1
+                        i <- i + 1
+                    filesMod
+                else
+                    files
+            //System.Windows.Forms.MessageBox.Show(sprintf "sortedFiles = %A" sortedFiles) |> ignore
+            sortedFiles
+
+    // Generic code generator that can be specialized with preprocessing function and additional 
+    // CodeGenerator configuration options (this is used by ASP.NET generator)
+    //   preprocCu: 
+    module FSharpCodeGenerator = 
+        let Create(preprocCu, addop) = 
+      
+            let usingStringWriter f =
+                let sb = new StringBuilder()
+                use sw = new StringWriter(sb)
+                f (sw :> TextWriter);
+                let res = sb.ToString();
+                res
+          
+            { new ICodeGenerator with
+                // Identifier related functions            
+                member this.CreateEscapedIdentifier (value:string) : string =
+                  Generator.makeEscapedIdentifier value
+                member this.CreateValidIdentifier (value:string) : string =
+                  Generator.makeValidIdentifier value
+                member this.IsValidIdentifier (value:string) : bool =
+                  Generator.isValidIdentifier value; 
+                member this.ValidateIdentifier (value:string) : unit =
+                  if (not (Generator.isValidIdentifier value)) then 
+                    raise (ArgumentException(sprintf "'%s' is not a valid F# identifier!" value))
+      
+                // Implementations of code generation related functions
+                member this.GenerateCodeFromCompileUnit(compileUnit, textWriter, options) =
+                    (Generator.createContext textWriter options addop) 
+                    |> (Generator.generateCompileUnit compileUnit preprocCu) 
+                    |> ignore
+                
+                member this.GenerateCodeFromExpression(codeExpr, textWriter, options) : unit =
+                    (Generator.createContext textWriter options addop) 
+                    |> (Generator.generateExpression codeExpr) 
+                    |> ignore
+                
+                member this.GenerateCodeFromNamespace(codeNamespace, textWriter, options) : unit =
+                    (Generator.createContext textWriter options addop) 
+                    |> (Generator.generateNamespace codeNamespace) 
+                    |> ignore
+                
+                member this.GenerateCodeFromStatement(codeStatement, textWriter, options) : unit =
+                    (Generator.createContext textWriter options addop) 
+                    |> (Generator.generateStatement codeStatement) 
+                    |> ignore
+                    
+                member this.GenerateCodeFromType(codeTypeDecl, textWriter, options) : unit =
+                    (Generator.createContext textWriter options addop) 
+                    |> (Generator.generateTypeDeclOnly codeTypeDecl) 
+                    |> ignore
+                member this.GetTypeOutput (t:CodeTypeReference) : string =
+                    usingStringWriter (fun sw ->
+                      (Generator.createContext sw (CodeGeneratorOptions()) addop) 
+                      |> (Generator.generateTypeRef t) |> ignore)
+
+                member this.Supports (supports:GeneratorSupport) : bool =
+                  (supports &&&  (GeneratorSupport.ReturnTypeAttributes ||| 
+                                  GeneratorSupport.ParameterAttributes ||| 
+                                  GeneratorSupport.AssemblyAttributes ||| 
+                                  GeneratorSupport.StaticConstructors ||| 
+                                  GeneratorSupport.NestedTypes ||| 
+                                  GeneratorSupport.EntryPointMethod |||
+                                  GeneratorSupport.GotoStatements ||| 
+                                  GeneratorSupport.MultipleInterfaceMembers |||
+                                  GeneratorSupport.ChainedConstructorArguments
+                                  ) = enum 0) }
+
+    // Generic code compiler - the argument is a function for sorting files that can be used by
+    // tool-specific providers if needed (like in case of ASP.NET)
+    module FSharpCodeCompiler = 
+        let Create(sortFiles) =
+            { new ICodeCompiler with       
+                member this.CompileAssemblyFromDom (options:CompilerParameters,compileUnit:CodeCompileUnit) : CompilerResults =
+                  this.CompileAssemblyFromDomBatch (options, [|compileUnit|]);
+                member this.CompileAssemblyFromSource (options:CompilerParameters,source:string) : CompilerResults =
+                  this.CompileAssemblyFromSourceBatch (options, [|source|]);                
+                member this.CompileAssemblyFromFile (options:CompilerParameters,fileName:string) : CompilerResults =
+                  this.CompileAssemblyFromFileBatch (options, [|fileName|]);
+                    
+                member this.CompileAssemblyFromDomBatch (options:CompilerParameters,compilationUnits:CodeCompileUnit[]) : CompilerResults =
+                  let res = new CompilerResults(options.TempFiles);
+                  let files = 
+                      compilationUnits 
+                      |> Array.map ( fun cu -> 
+                          let fn = res.TempFiles.AddExtension("fs", false)
+                          use wr = new StreamWriter(fn, false, Encoding.UTF8)
+                          Generator.createContext wr (CodeGeneratorOptions()) Generator.AdditionalOptions.None 
+                              |> (Generator.generateCompileUnit cu (fun _ -> ())) |> ignore
+                          fn)        
+                  Compiler.compileAssemblyFromFileBatch options files res sortFiles
+
+                member this.CompileAssemblyFromSourceBatch (options:CompilerParameters,sources:string[]) : CompilerResults =
+                  let res = new CompilerResults(options.TempFiles);
+                  let files = sources |> Array.map ( fun src -> 
+                      let fn = res.TempFiles.AddExtension("fs", false)
+                      use wr = new StreamWriter(fn)
+                      wr.Write(src) 
+                      fn)
+                  Compiler.compileAssemblyFromFileBatch options files res sortFiles       
+                  
+                member this.CompileAssemblyFromFileBatch (options:CompilerParameters,fileNames:string[]) : CompilerResults =
+                  Compiler.compileAssemblyFromFileBatch options fileNames (new CompilerResults(options.TempFiles)) sortFiles
+            }
+          
+
+//-------------------------------------------------------------------------------------------------
+// Public types
+
+namespace Microsoft.Test.Compiler.CodeDom
+
+    open System
+    open System.IO
+    open System.Text
+    open System.Collections
+    open System.CodeDom
+    open System.CodeDom.Compiler
+
+    open Microsoft.Test.Compiler.CodeDom.Internal
+
+    type FSharpCodeProvider() = 
+        inherit CodeDomProvider()
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]
+        override this.FileExtension = "fs";
+        
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]
+        override this.CreateCompiler() =
+            FSharpCodeCompiler.Create(AspNetUtils.aspNetSortFiles)
+
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]            
+        override this.CreateGenerator() =
+            FSharpCodeGenerator.Create((fun _ -> ()), Generator.AdditionalOptions.None)
+
+    type FSharpAspNetCodeProvider() = 
+        inherit CodeDomProvider()
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]
+        override this.FileExtension = "fs";
+        
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]
+        override this.CreateCompiler() =
+            FSharpCodeCompiler.Create(AspNetUtils.aspNetSortFiles)
+            
+        [<System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")>]
+        override this.CreateGenerator() =
+            
+            // If you set the options to "Generator.AdditionalOptions.UnknonwFieldsAsLocals"
+            // than the generator will treat all fields that are not declared in the class as locals
+            // (and will generated "fld" instead of "this.fld")            
+            // This will make it possible to use implicit class syntax in ASP.NET, but only when
+            // the fields will have non-private visibility (because we need to access them from inherited class
+            
+            // AspNetArrays is workaround for ASP.NET which generates wrong type in array initializers
+            // (according to the CodeDOM test suite it should be "int[]" for [| 1; 2 |], but ASP.NET gives us "int" !! 
+            let opts = Generator.AdditionalOptions.AspNetArrays
+            FSharpCodeGenerator.Create(AspNetUtils.aspNetPreProcessCompileUnit, opts)
+        
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fsi
new file mode 100644
index 0000000..18d787d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/codeprovider.fsi
@@ -0,0 +1,15 @@
+namespace Microsoft.Test.Compiler.CodeDom
+
+open System.CodeDom.Compiler
+
+/// Implementation of the CodeDomProvider for the F# language.
+/// If you intend to use CodeDom with ASP.NET you should use <c>FSharpAspNetCodeProvider</c> instead.
+type FSharpCodeProvider = 
+    inherit CodeDomProvider 
+    new : unit -> FSharpCodeProvider
+
+/// Implementation of the CodeDomProvider for the F# language.
+/// This is specialized version that can be used with ASP.NET.
+type FSharpAspNetCodeProvider = 
+    inherit CodeDomProvider 
+    new : unit -> FSharpAspNetCodeProvider
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/compiler.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/compiler.fs
new file mode 100644
index 0000000..86c199f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/compiler.fs
@@ -0,0 +1,176 @@
+namespace Microsoft.Test.Compiler.CodeDom.Internal
+
+open System
+open System.IO
+open System.Text
+open System.Text.RegularExpressions
+open System.Collections
+open System.Diagnostics
+open System.CodeDom
+open System.Security
+open System.Security.Permissions
+open System.CodeDom.Compiler
+
+module internal AssemblyAttributes = 
+    //[<assembly: System.Security.SecurityTransparent>]
+    do()
+
+//-------------------------------------------------------------------------------------------------
+module internal Global = 
+    let debug_commandline_args = true
+    let (++) x y = Path.Combine(x,y)
+    
+    // search for "fsc.exe"
+    let FscExeBaseName = "fsc.exe"
+
+    let FSharpBinFromEnvironmentVariable = 
+        try match System.Environment.GetEnvironmentVariable("FSHARP_BIN") with 
+            | null -> None
+            | s -> Some(s)
+        with _ -> None
+
+    // Note: this technique is now deprecated by BinFolderOfDefaultFSharpCompiler, which we try first
+    let FSharpBinFromDeprecatedInstallLocationGuess = 
+        try match Internal.Utilities.FSharpEnvironment.FSharpCoreLibRunningVersion with 
+            | Some v -> Some(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) ++ "FSharp-" +  v)
+            | _ -> None
+        with _ -> None
+
+             
+    let FscPath = 
+        let tryFscPath x = 
+            match x with 
+            | None -> None
+            | Some dir -> 
+                 let fscName = dir  ++ FscExeBaseName 
+                 if File.Exists(fscName) then Some(fscName) else None
+
+        let search0 = tryFscPath Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler 
+        match search0 with 
+        | Some(res) -> res
+        | None -> 
+        
+        let search1 = tryFscPath FSharpBinFromEnvironmentVariable
+        match search1 with 
+        | Some(res) -> res
+        | None -> 
+            
+        let search2 = tryFscPath FSharpBinFromDeprecatedInstallLocationGuess
+        match search2 with 
+        | Some(res) -> res
+        | None -> 
+        FscExeBaseName
+    
+    // regular expressions for parsing result         
+    let regParseFsOutput = Regex(@"(?<file>[^\(]*)\((?<line>[0-9]*),(?<col>[0-9]*)\):\s(?<type>[^:]*)\s(?<err>[^:]*):\s(?<msg>.*)", RegexOptions.Compiled);
+    let regParseFsOutputNoNum = Regex(@"(?<file>[^\(]*)\((?<line>[0-9]*),(?<col>[0-9]*)\):\s(?<type>[^:]*)\s(?<msg>.*)", RegexOptions.Compiled);
+
+//-------------------------------------------------------------------------------------------------
+module internal Compiler = 
+    let id a = a
+    let (+>) (ctx:StringBuilder) (foo:StringBuilder -> StringBuilder) = foo ctx;
+    let (--) (ctx:StringBuilder) (str:String) = ctx.Append(str)
+    let untyped_fold f col st = Seq.fold f st (Seq.cast col)
+     
+    // Generate command-line arguments for FSC
+    let cmdArgsFromParameters (o:CompilerParameters) filenames = 
+      let sb = new StringBuilder(50)
+      (sb 
+        +> if (not o.GenerateExecutable) then (fun ctx -> ctx -- "-a ") else id
+        +> untyped_fold (fun ctx e -> ctx -- "-r:\"" -- e -- "\" ") o.ReferencedAssemblies
+        -- "--nologo -o:\"" -- o.OutputAssembly -- "\" "        
+        +> if (o.IncludeDebugInformation) then (fun ctx -> ctx -- "--debug+ ") else id        
+        +> if (o.Win32Resource <> null) then (fun ctx -> ctx -- "--win32res:\"" -- o.Win32Resource -- "\" ") else id 
+        +> if (o.CompilerOptions <> null) then (fun ctx -> ctx -- o.CompilerOptions -- " ") else id) 
+        
+        // Never treat warnings as errors - this overrides "#nowarn", but the generated code
+        // will contain some warnings in almost any case...
+        //   +> if (o.TreatWarningsAsErrors) then (fun ctx -> ctx -- "--warnaserror ") else id
+        
+        |> ignore  
+        
+      filenames |> Array.iter ( fun (fn:string) ->
+        ignore (sb.AppendFormat(" \"{0}\"", fn)) )
+      sb.ToString();
+
+    // Process FSC output
+    let processMsg msg (res:CompilerResults) = 
+      let m = 
+        let t1 = Global.regParseFsOutput.Match(msg) in
+          if (t1.Success) then t1 else Global.regParseFsOutputNoNum.Match(msg)
+      let ce = 
+        if (m.Success) then 
+          let errNo = (if (m.Groups.Item("err") <> null) then (m.Groups.Item("err")).Value else "") 
+          let ce = CompilerError(m.Groups.Item("file").Value, Int32.Parse(m.Groups.Item("line").Value), 
+                                 Int32.Parse(m.Groups.Item("col").Value), errNo, m.Groups.Item("msg").Value);
+          ce.IsWarning <- ((m.Groups.Item("type")).Value = "warning");
+          ce
+        else new CompilerError("unknown-file", 0, 0, "0", msg);
+      res.Errors.Add(ce) |> ignore      
+      
+    // Invoke FSC compiler and parse output  
+    let compileFiles args (res:CompilerResults) =
+        let p = new Process() in
+        p.StartInfo.FileName <- Global.FscPath;
+        p.StartInfo.UseShellExecute <- false;
+        p.StartInfo.Arguments <- args;
+        p.StartInfo.RedirectStandardError <- true;
+        p.StartInfo.CreateNoWindow <- true;
+        p.Start() |> ignore
+
+        // useful when debugging
+        if (Global.debug_commandline_args) then
+          let s = res.TempFiles.AddExtension("cmdargs")
+          use sw = new StreamWriter(s);
+          sw.WriteLine(args);
+        
+        let mutable serr = "" 
+        let mutable smsg = ""
+        while (serr <- p.StandardError.ReadLine(); serr <> null) do 
+          if (serr.Trim().Length = 0 && smsg <> "") then 
+            processMsg smsg res; smsg <- "";
+          else 
+            smsg <- smsg + " " + (serr.Trim());
+        if (smsg <> "") then processMsg smsg res;
+        p.WaitForExit();
+        res.NativeCompilerReturnValue <- p.ExitCode;
+
+    // Compile assembly from given array of files
+    let compileAssemblyFromFileBatch (options:CompilerParameters) (fileNames:string array) 
+                                     (results:CompilerResults) sortf : CompilerResults =
+                                     
+      // Call 'fix' sorting function                                      
+      let fileNames = sortf fileNames
+      let createdAssembly = 
+        if (options.OutputAssembly = null || options.OutputAssembly.Length = 0) then begin
+          let extension = if (options.GenerateExecutable) then "exe" else "dll" 
+          options.OutputAssembly <- results.TempFiles.AddExtension(extension, not options.GenerateInMemory)
+
+          // Create an empty assembly, so the file can be later accessed using current credential.  
+          let fs = new FileStream(options.OutputAssembly, FileMode.Create, FileAccess.ReadWrite) in 
+          fs.Close();
+          true;
+        end else false in
+      ignore(results.TempFiles.AddExtension("pdb"));
+        
+      // Compile..      
+      let args = cmdArgsFromParameters options fileNames 
+      compileFiles args results;
+        
+      if (options.GenerateInMemory) then
+        use fs = new FileStream(options.OutputAssembly, FileMode.Open, FileAccess.Read, FileShare.Read)
+        let count = int32 fs.Length 
+        if (count > 0) then
+          let buffer = (Array.zeroCreate count) 
+          fs.Read(buffer, 0, count) |> ignore
+          (new SecurityPermission(SecurityPermissionFlag.ControlEvidence)).Assert();
+          try
+            results.CompiledAssembly <- System.Reflection.Assembly.Load(buffer, null, options.Evidence);
+          finally
+            CodeAccessPermission.RevertAssert();
+      else 
+        results.PathToAssembly <- options.OutputAssembly;
+
+      // Delete the assembly if we created it
+      if (createdAssembly) then File.Delete(options.OutputAssembly);
+      results      
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/generator.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/generator.fs
new file mode 100644
index 0000000..c4eccb3
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.Compiler.CodeDom/generator.fs
@@ -0,0 +1,1810 @@
+namespace Microsoft.Test.Compiler.CodeDom.Internal
+#nowarn "57" // parametrized active patterns
+#nowarn "62" // This construct is for ML compatibility.
+
+open System
+open System.IO
+open System.Text
+open System.Reflection
+open System.Collections
+open System.Collections.Generic
+open System.CodeDom
+open System.CodeDom.Compiler
+
+open Microsoft.Test.Compiler.CodeDom.Internal.Visitor
+
+
+module internal Generator =
+
+    type ResizeArray<'T> = System.Collections.Generic.List<'T> // alias
+  
+    //---------------------------------------------------------------------------------------------
+    // Context and configuration
+    
+    type AdditionalOptions =
+      /// No extra configuration
+      | None = 0                      
+      
+      /// Reference inherited fields using "fld" instead of "this.fld" 
+      /// (could be used in the future to allow implicit classes in ASP.NET?)
+      | UnknonwFieldsAsLocals = 1     
+                                      
+      /// Hacking for ASP.NET incorrect array initializers 
+      /// They generate "string" where codedom test suite uses "string[]"
+      | AspNetArrays = 2              
+                                      
+    
+    type Context = 
+      {
+        /// Some unique ID for every namespace (so we don't have name clashes)
+        UniqueID:string
+        
+        /// Options, output, ...
+        Options:AdditionalOptions
+        Writer:IndentedTextWriter
+        
+        // *** Method/type scope ***
+        
+        /// Names of all type arguments in scope (need to rename T -> 'T etc.)
+        TypeArgumentNames:Set<string>
+        /// Types of all local variables in the method
+        LocalVariableTypes:Map<string,Type>;
+        /// Type of the method 
+        CurrentMethodReturnType:CodeTypeReference option;
+        /// We use exception for returning value when generating complex
+        /// code that returns using imperative "return" statement
+        ReturnUsingException:bool;
+      
+        // *** Information for the current class *** 
+        
+        CurrentType:CodeTypeDeclaration;
+        BaseTypes:CodeTypeReference option * CodeTypeReference list
+        AllFields:Map<string,CodeMemberField>;
+        AllProps:Map<string,CodeMemberProperty>;
+        AllMeths:Map<string,CodeMemberMethod>;
+        AllEvents:Map<string,CodeMemberEvent>;
+        FieldTypes:Map<string,CodeTypeReference>;
+        PropertyTypes:Map<string,CodeTypeReference>;
+        DeclaredEvents:CodeMemberEvent list;
+          
+        // *** Namespace scope ***         
+        
+        // Renamed types (when flattening nested classes)
+        TypeRenames:Map<string,string>
+        // Current namespace (can't be used in the type reference expression)
+        CurrentNamespace:string; 
+        // Set of interface names declared in the current namespace
+        DeclaredInterfaces:Set<string>
+        // A static Main method declared by one of the classes in this namespace
+        MainMethodForCurrentNamespace:(CodeEntryPointMethod * CodeTypeDeclaration) option
+      }
+    
+    /// Create context using specified text writer and options
+    let createContext (wr:TextWriter) (opts:CodeGeneratorOptions) (addopts) = 
+      { UniqueID = (Guid.NewGuid()).ToString("N")
+        Writer = new IndentedTextWriter(wr); TypeRenames = Map.empty; 
+        CurrentType = null; CurrentNamespace = ""; 
+        DeclaredEvents = []; 
+        BaseTypes = (None, []); 
+        AllFields = Map.empty;
+        AllEvents = Map.empty;
+        AllProps = Map.empty;
+        AllMeths = Map.empty;
+        FieldTypes = Map.empty 
+        CurrentMethodReturnType = None; 
+        LocalVariableTypes = Map.empty; 
+        ReturnUsingException = false; 
+        PropertyTypes = Map.empty
+        Options = addopts; 
+        DeclaredInterfaces = Set.empty; 
+        TypeArgumentNames = Set.empty; 
+        MainMethodForCurrentNamespace = None }    
+
+    /// Where are we generating member?
+    type MemberGenerateType = 
+      | InsideInterface = 0
+      | InsideStruct = 1
+      | InsideClass = 2
+      
+    //---------------------------------------------------------------------------------------------
+    // Collections and combinators for generating
+
+    /// Function composition operator
+    let (+>) (ctx:Context -> Context) (foo:Context -> Context) x =
+      foo (ctx x);
+
+    /// Print unique id using: "+> uniqid"
+    let uniqid (c:Context) =
+      c.Writer.Write(c.UniqueID);
+      c;
+
+    /// Break-line and append specified string
+    let (++) (ctx:Context -> Context) (str:String) x =
+      let c = (ctx x)
+      c.Writer.WriteLine();
+      c.Writer.Write(str);
+      c;
+
+    /// Append specified string without line-break
+    let (--) (ctx:Context -> Context) (str:String) x =
+      let c = (ctx x)
+      c.Writer.Write(str);
+      c;
+
+    /// Call function, but give it context as an argument      
+    let withCtxt f x =
+      (f x) x;
+      
+    /// Identity function
+    let id a = a
+
+    /// Print object converted to string
+    let str (o: 'T) (ctx:Context) =
+      ctx.Writer.Write(o :> obj);
+      ctx;
+
+    /// Create closure to do the counting 
+    /// (this is usend when we need indexing during collection processing)
+    let createCounter() =   
+      let i = ref (-1)
+      (fun () -> i := (!i) + 1; !i)
+      
+    /// Perform map and filter operations in one 
+    let rec mapFilter f l =
+      match l with
+      | [] -> [];
+      | a::r -> match (f a) with | None -> (mapFilter f r) | Some el -> el::(mapFilter f r)
+
+    /// Process collection - keeps context through the whole processing
+    /// calls 'f' for every element in sequence and 'fs' between every two elements 
+    /// as a separator
+    let col fs (c:IEnumerable) f (ctx:Context) = 
+      let mutable tryPick = true in
+      let mutable st = ctx
+      let e = c.GetEnumerator()
+      while (e.MoveNext()) do
+        if (tryPick) then tryPick <- false else st <- fs st
+        st <- f (unbox e.Current) st
+      st
+    
+    /// Process collection - keeps context through the whole processing
+    /// calls 'f' for every element in sequence and 'fs' between every two elements 
+    /// as a separator. This is a variant that works on typed collections.
+    let colT fs (c:seq<'T>) f (ctx:Context) =
+      let mutable tryPick = true in
+      let mutable st = ctx
+      let e = c.GetEnumerator();
+      while (e.MoveNext()) do
+        if (tryPick) then tryPick <- false else st <- fs st;
+        st <- f (e.Current) st;
+      st
+        
+    /// Call specified function only on elements of specified type.
+    /// (performs dynamic type test using x.GetType())
+    let colFilterT<'T> fs (c:IEnumerable) (f: 'T -> Context -> Context) ctx =
+      let sq : seq<'T>
+          = c |> Seq.cast |> Seq.filter (fun (o:obj) -> o.GetType() = typeof<'T>) |> Seq.cast
+      colT fs sq f ctx
+
+    let colFilter<'T> fs (c:IEnumerable) (f: 'T -> Context -> Context) ctx =
+      let sq = c |> Seq.cast |> Seq.filter (fun (o:obj) -> o.GetType() = typeof<'T>)
+      col fs sq f ctx
+
+    // Separator functions        
+    let sepDot          = id -- "."
+    let sepWordAnd      = id -- " and "      
+    let sepSpace        = id -- " "      
+    let sepNln          = id ++ ""
+    let sepArgs         = id -- ", "
+    let sepArgsSemi     = id -- "; "
+    let sepNone         = id
+    let sepStar         = id -- " * "
+    let sepNlnSemiSpace = id -- ";" ++ "  "
+    
+    //---------------------------------------------------------------------------------------------
+    // F# keywords and identifiers and also type resolving for standard .NET libraries
+    
+    let fsKeyWords = 
+      new HashSet<_>
+         (["abstract"; "and"; "as"; "assert"; "asr"; "base"; "begin"; "class"; "default"; "delegate"; "do"; "done";
+           "downcast"; "downto"; "elif"; "else"; "end"; "exception"; "extern"; "false"; "finally"; "for"; "fun";
+           "function"; "if"; "in"; "inherit"; "inline"; "interface"; "internal"; "land"; "lazy"; "let"; "lor"; "lsl"; "lsr"; "lxor";
+           "match"; "member"; "method"; "mod"; "module"; "mutable"; "namespace"; "new"; "null"; "of"; "open"; "or"; "override";
+           "private"; "public"; "rec"; "return"; "sig"; "static"; "struct"; "then"; "to"; "true"; "try"; "type"; "upcast"; "use"; "val"; "virtual"; "void"; "when"; 
+           "while"; "with"; "yield";
+           
+           "atomic"; "break"; 
+           "checked"; "component"; "const"; "constraint"; "constructor"; "continue"; 
+           "eager"; 
+           "fixed"; "fori"; "functor"; "global";"recursive";"measure"; 
+           "include";  (* "instance"; *)
+           "mixin"; 
+           "object"; "parallel"; "params";  "process"; "protected"; "pure"; (* "pattern"; *)
+           "sealed"; "trait";  "tailcall";
+           "volatile"; ], HashIdentity.Structural)
+
+    let isValidIdentifier str = 
+      not (fsKeyWords.Contains(str))
+
+    let makeEscapedIdentifier str = 
+      if (fsKeyWords.Contains(str)) then "i'"+str+"'" else str;
+
+    let makeValidIdentifier str = 
+      if (fsKeyWords.Contains(str)) then "_"+str else str;
+      
+    let freshName = 
+      let counter = createCounter ()
+      (fun () -> "UnnamedMethod_" + counter().ToString())
+
+    // List of "known" libraries that we try to search when we need to resolve a type
+    let coreAssemblies = 
+       ["mscorlib"; "System"; "System.Web"; "System.Xml"; 
+        "System.Data"; "System.Deployment"; "System.Design"; "System.DirectoryServices"; 
+        "System.Drawing.Design"; "System.Drawing"; "System.EnterpriseServices"; 
+        "System.Management"; "System.Messaging"; "System.Runtime.Remoting"; 
+        "System.Security"; "System.ServiceProcess"; "System.Transactions"; 
+        "System.Configuration"; "System.Web.Mobile"; "System.Web.RegularExpressions"; 
+        "System.Web.Services"; "System.Windows.Forms"; "System.Core";
+        "PresentationCore"; "PresentationFramework"; "WindowsBase"; "WindowsFormsIntegration"]
+      |> List.map ( fun n -> lazy(try Some(System.Reflection.Assembly.LoadWithPartialName(n)) with _ -> None); );
+
+    let dict = new Dictionary<string, Type>();
+
+    /// Tries to find .NET type for specified type name
+    /// This is used when we need to know type in order to generate something correctly,
+    /// but it's just a fallback case
+    let (|FoundSystemType|_|) s =
+      if (dict.ContainsKey(s)) then Some dict.[s] else
+      let ty = coreAssemblies |> Seq.tryPick ( fun lazyAsm -> 
+        match lazyAsm.Force() with 
+        | None -> None
+        | Some asm -> 
+            match (try asm.GetType(s) with _ -> null) with
+            | null -> None
+            | t -> Some t ) 
+      match ty with | Some t -> dict.Add(s, t) | _ -> ()
+      ty
+
+    //---------------------------------------------------------------------------------------------
+    // Interface recognition magic
+
+    // If the name of the type matches a name of interface declared in this file 
+    // (stored in a set in the context) than we treat it as an interface, otherwise
+    // we rely on .NET naming pattern (starts with I followed by uppercase letter)
+    // We could search known DLLs, but that's useless since all DLLs we could find
+    // follow this naming pattern...
+    let isInterface (t:CodeTypeReference) (ctx:Context) = 
+      let tn = t.BaseType.Substring(t.BaseType.LastIndexOf(".") + 1) 
+      let decLoc = Set.contains tn ctx.DeclaredInterfaces
+      decLoc || (tn.StartsWith("I") && (((tn.ToUpper()).[1]) = (tn.[1])))
+
+
+    // Splits base types into base class and implemented interfaces
+    // using rules described in <c>isInterface</c>
+    // Returns optional base class and list of interfaces
+    let resolveHierarchy (c:CodeTypeDeclaration) ctx =
+      let (interf, bcl) = 
+        c.BaseTypes |> Seq.cast |> Seq.toList
+          |> List.partition ( fun (r:CodeTypeReference) -> isInterface r ctx )
+          
+      if (bcl.Length = 0) then 
+        // All supertypes all interfaces
+        (None, interf)
+      elif (bcl.Length = 1) then 
+        // Exactly one supertype is class, other were recognized as interfaces
+        (Some (List.head bcl), interf) 
+      else 
+        // Fallback case - we found more than one supertypes that look like a class
+        // so we just return the tryPick one and treat other as interfaces
+        (Some (List.head bcl), (List.tail bcl)@interf) 
+        
+    
+    //---------------------------------------------------------------------------------------------
+    // Generating strings and working with context   
+    
+    let incIndent (ctx:Context) = 
+      ctx.Writer.Indent <- ctx.Writer.Indent + 1
+      ctx
+
+    let decIndent (ctx:Context) = 
+      ctx.Writer.Indent <- ctx.Writer.Indent - 1
+      ctx
+
+    /// Output string as a valid F# identifier
+    let (-!) (ctx:Context -> Context) (str:String) x =
+      let c = (ctx x)
+      c.Writer.Write(makeValidIdentifier str);
+      c;
+      
+    //---------------------------------------------------------------------------------------------
+    // Default values, types, generic parameters
+    
+    
+    
+    
+    
+    
+    let generateDefaultValue (t:CodeTypeReference) = 
+      if (t.ArrayElementType <> null) then
+        id -- "Unchecked.defaultof<_>"
+      else
+        match t.BaseType with 
+          | "System.Single" -> id -- "0.0f"
+          | "System.Double" -> id -- "0.0"
+          | "System.Char" -> id -- "'\000'"
+          | "System.Int16" -> id -- "0s"
+          | "System.Int32" -> id -- "0"
+          | "System.Int64" -> id -- "0L"
+          | "System.Byte" -> id -- "0uy"
+          | "System.SByte" -> id -- "0y"
+          | "System.UInt16" -> id -- "0us"
+          | "System.UInt32" -> id -- "0u"
+          | "System.UInt64" -> id -- "0UL"
+          | "System.String" -> id -- "\"\""
+          | "System.Boolean" -> id -- "false"
+          | _ -> id -- "Unchecked.defaultof<_>" 
+    
+    /// Get System.Type of know type (either standard type or resolved)  
+    let tryGetSystemType (cr:CodeTypeReference option) =
+      match cr with 
+        | None -> None
+        | Some cr when (cr.ArrayRank = 0) ->
+          match cr.BaseType with 
+          | "System.Single" -> Some (typeof<float32>)
+          | "System.Double" -> Some (typeof<float>)
+          | "System.Char" -> Some (typeof<char>)
+          | "System.Int16" -> Some (typeof<int16>)
+          | "System.Int32" -> Some (typeof<int>)
+          | "System.Int64" -> Some (typeof<int64>)
+          | "System.UInt16" -> Some (typeof<uint16>)
+          | "System.UInt32" -> Some (typeof<uint32>)
+          | "System.UInt64" -> Some (typeof<uint64>)
+          | "System.String" -> Some (typeof<string>)
+          | "System.Boolean" -> Some (typeof<bool>)
+          | FoundSystemType t -> Some t
+          | _ -> None;      
+        | _ -> None
+
+    /// Tries to resolve type of a variable and adds it to the Context dictionary
+    let tryAddVariableType (name:string) (cr:CodeTypeReference) (varTypes:Map<string,Type>) =
+      let ret t = Map.add name t varTypes
+      match tryGetSystemType (Some cr) with 
+        | Some t -> ret t; 
+        | _ -> varTypes
+
+    // Returns string with type arguments
+    let rec getTypeArgs (tya:CodeTypeReferenceCollection) renames ns tyParams fsSyntax =
+      if (tya.Count > 0) then
+        let sb = new StringBuilder()
+        sb.Append("<") |> ignore
+        for a in tya do
+          let str = (getTypeRef a renames ns tyParams fsSyntax):string
+          sb.Append(str).Append(", ") |> ignore
+        let s = sb.ToString()
+        s.Substring(0, s.Length - 2) + ">"
+      else
+        ""
+        
+        // Several standard renaming tricks      
+              
+    and isKnownSealedType (t:CodeTypeReference) = 
+        t.ArrayRank = 0 &&
+        match t.BaseType with 
+        | "System.String" 
+        | "System.Single" 
+        | "System.Double" 
+        | "System.DateTime" 
+        | "System.TimeSpan" 
+        | "System.Decimal" 
+        | "System.Char" 
+        | "System.SByte" 
+        | "System.Byte" 
+        | "System.Int16" 
+        | "System.Int32" 
+        | "System.Int64" 
+        | "System.UInt16" 
+        | "System.UInt32" 
+        | "System.UInt64" 
+        | "System.Boolean" -> true
+        | _ -> false;
+    /// Generates type reference (not for arrays)
+    and getBaseTypeRef (cr:CodeTypeReference) renames (ns:string) (tyParams:Set<string>) fsSyntax =
+      let s = 
+      
+        // Remove current namespace name, because it can't be used in this scope
+        let bst = 
+          if (cr.BaseType.StartsWith(ns+".")) then 
+            cr.BaseType.Substring(ns.Length+1) 
+          elif cr.Options &&& CodeTypeReferenceOptions.GlobalReference <> enum 0 then 
+            "global."+cr.BaseType
+          else 
+            cr.BaseType
+      
+        // Several standard renaming tricks      
+        match Map.tryFind bst renames with
+          // Renamed type (former nested type)
+          | Some nn -> nn
+          
+          // It is a type paramter - rename T to 'T
+          | None when Set.contains cr.BaseType tyParams ->
+              "'" + cr.BaseType
+              
+          // Try if it's standard F# type
+          // This also renames Void to unit, which may not be completly correct, 
+          // but it works much better than if we don't do it
+          | None when fsSyntax ->
+              match cr.BaseType with 
+              | "System.Void" -> "unit"
+              | "System.Object" -> "obj"
+              | "System.String" -> "string"
+              | "System.Single" -> "float32"
+              | "System.Double" -> "float"
+              | "System.Char" -> "char"
+              | "System.Int16" -> "int16" 
+              | "System.Int32" -> "int" 
+              | "System.Int64" -> "int64" 
+              | "System.UInt16" -> "uint16" 
+              | "System.UInt32" -> "uint32" 
+              | "System.UInt64" -> "uint64" 
+              | "System.Boolean" -> "bool"
+              | _ -> bst;
+          | _ -> bst;          
+      // drop `xyz, replace "+" for nested classes with "."
+      let sb = new StringBuilder()
+      let mutable i = 0 
+      while i < s.Length do
+        let c = s.[i]
+        match c with
+          | _ when c = '+' || c = '.' -> sb.Append('.') |> ignore;
+          | '`' -> i <- i + 1;
+                   while (i<s.Length && s.[i]>='0' && s.[i]<='9') do 
+                     i <- i + 1
+          | _ -> sb.Append(c) |> ignore
+        i <- i + 1      
+      // generate type arguments
+      sb.Append(getTypeArgs cr.TypeArguments renames ns tyParams fsSyntax).ToString()
+      
+    /// Generate type reference with empty context
+    and getBaseTypeRefString (s:string) =
+      getBaseTypeRef (CodeTypeReference(s)) Map.empty "" Set.empty true
+    
+    
+    /// Get full type reference using information from context  
+    and getTypeRef (c:CodeTypeReference) (rens:Map<string,string>) (ns:string) (tyParams:Set<string>) (fsSyntax:bool) =
+      if (c = null) then  
+        ""
+      elif (c.ArrayRank = 0) then 
+        getBaseTypeRef c rens ns tyParams fsSyntax
+      else      
+        let baseType = (getTypeRef c.ArrayElementType rens ns tyParams fsSyntax)
+        baseType + "[" + (System.String.Concat (Array.create (c.ArrayRank - 1) ",")) + "]"
+
+    /// Get full type reference string using empty context
+    and getTypeRefSimple (c:CodeTypeReference) = getTypeRef c Map.empty "" Set.empty true
+    
+    /// Get type reference, but don't rename .NET types to F# types
+    /// (this is only needed when calling static methods on the type)
+    let generateTypeRefNet (c:CodeTypeReference) =
+      id +> withCtxt ( fun ctx -> id -- getTypeRef c ctx.TypeRenames ctx.CurrentNamespace ctx.TypeArgumentNames false )
+    
+    /// Generate type reference using context
+    /// (this is most commonly used method)  
+    let generateTypeRef (c:CodeTypeReference) =
+      id +> withCtxt ( fun ctx -> id -- getTypeRef c ctx.TypeRenames ctx.CurrentNamespace ctx.TypeArgumentNames true )
+             
+    /// Generate type arguments using context
+    let generateTypeArgs (c:CodeTypeReferenceCollection) =
+      id +> withCtxt ( fun ctx -> id -- getTypeArgs c ctx.TypeRenames ctx.CurrentNamespace ctx.TypeArgumentNames true )
+             
+    
+    /// Record specified type parameters in the context, call generating function
+    /// and then restore the original type parameters
+    /// (this works if someone uses nested type parameters with the same name)
+    let usingTyParams tyArgs f (x:Context) =
+      let o = x.TypeArgumentNames
+      let n = Array.foldBack Set.add (Array.ofSeq tyArgs) o
+      let x = f { x with TypeArgumentNames = n }
+      { x with TypeArgumentNames = o }      
+
+
+    /// Preprocess collection with type parameters
+    /// Returns array to be used with <c>usingTyParams</c> and
+    /// function to be called to generate < ... > code
+    let processTypeArgs (args:CodeTypeParameterCollection) =     
+      let tyargs = seq { for (p:CodeTypeParameter) in args -> p.Name }       
+      let genTyArgs =
+        if (args.Count = 0) then id else
+        let s = tyargs |> Seq.fold (fun ctx s -> ctx + ", '" + s) ""
+        id 
+        -- "<" -- s.Substring(2, s.Length-2)
+        +> if (args.Count = 0) then id -- ">" else
+             let argsWithConstr = args |> Seq.cast |> Seq.filter (fun (p:CodeTypeParameter) -> 
+               p.Constraints.Count <> 0 || p.HasConstructorConstraint) |> Seq.cast |> Seq.toList
+             if (argsWithConstr.Length <> 0) then
+               id -- " when " +>
+               col sepWordAnd argsWithConstr (fun (p:CodeTypeParameter) -> 
+                 col sepWordAnd p.Constraints (fun impl ->
+                   id -- "'" -- p.Name -- " :> " +> generateTypeRef impl)
+                 +> if (not p.HasConstructorConstraint) then id else
+                      if (p.Constraints.Count <> 0) then id -- " and " else id
+                      -- "'" -- p.Name -- " : (new:unit->'" -- p.Name -- ")")
+               -- ">"
+             else id -- ">"
+      tyargs, genTyArgs
+    
+    //---------------------------------------------------------------------------------------------
+    // Binary operators and numeric functions
+    
+    /// Generates code for binary operator using function for left and right operand
+    let binaryOp (op:CodeBinaryOperatorType) fleft fright =
+      id -- "(" +>
+      match op with    
+        | CodeBinaryOperatorType.Add -> fleft -- " + " +> fright;
+        | CodeBinaryOperatorType.BitwiseAnd -> fleft -- " &&& " +> fright;
+        | CodeBinaryOperatorType.BitwiseOr -> fleft -- " ||| " +> fright;
+        | CodeBinaryOperatorType.BooleanAnd -> fleft -- " && " +> fright;
+        | CodeBinaryOperatorType.BooleanOr -> fleft -- " || " +> fright;
+        | CodeBinaryOperatorType.Divide -> fleft -- " / " +> fright;
+        | CodeBinaryOperatorType.GreaterThan -> fleft -- " > " +> fright;
+        | CodeBinaryOperatorType.GreaterThanOrEqual -> fleft -- " >= " +> fright;
+        | CodeBinaryOperatorType.LessThan -> fleft -- " < " +> fright;
+        | CodeBinaryOperatorType.LessThanOrEqual -> fleft -- " <= " +> fright;
+        | CodeBinaryOperatorType.Modulus -> fleft -- " % " +> fright;
+        | CodeBinaryOperatorType.Multiply -> fleft -- " * " +> fright;
+        | CodeBinaryOperatorType.Subtract -> fleft -- " - " +> fright;
+        
+        // REVIEW: this is not used in any tests and it is not sure what it means
+        | CodeBinaryOperatorType.Assign -> fleft -- " <- " +> fright; 
+        
+        // REVIEW: reference and value equality use C# semantics, so it is not sure what we should generate
+        | CodeBinaryOperatorType.ValueEquality -> fleft -- " = " +> fright;  
+        | CodeBinaryOperatorType.IdentityEquality -> id -- "System.Object.ReferenceEquals(" +> fleft -- ", " +> fright -- ")"; 
+        | CodeBinaryOperatorType.IdentityInequality -> id -- "not (System.Object.ReferenceEquals(" +> fleft -- ", " +> fright -- "))"; 
+        | _ -> failwithf "unimplemented binary operator type '%A'" op;
+      -- ")"
+    
+    /// Are both types numerical types where numeric conversion function can be applied?
+    let rec isNumericConversion (src:Type) (target:Type) = 
+      convertFunc src <> "" && convertFunc target <> ""
+    
+    
+    /// Returns F# conversion function for the specified type (or empty string)
+    and convertFunc (ty:Type) = 
+      if (ty = (typeof<int16>)) then "int16"
+      elif (ty = (typeof<int32>)) then "int32"
+      elif (ty = (typeof<int64>)) then "int64"
+      elif (ty = (typeof<int16>)) then "uint16"
+      elif (ty = (typeof<int32>)) then "uint32"
+      elif (ty = (typeof<int64>)) then "uint64"
+      elif (ty = (typeof<float>)) then "float"
+      elif (ty = (typeof<float32>)) then "float32"
+      elif (ty = (typeof<decimal>)) then "decimal"
+      elif (ty = (typeof<byte>)) then "byte"
+      elif (ty = (typeof<sbyte>)) then "sbyte"
+      else ""
+    
+    
+    /// Generate value of primitive expression  
+    let generatePrimitiveExpr (reqty:Type option) (c:CodePrimitiveExpression) =
+      let (value, typ) = 
+        match c.Value with
+          | :? Char as c -> (sprintf "%A" c, Some(typeof<Char>))
+          | :? String as s -> (sprintf "\"%s\"" (s.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\t", "\\t").Replace("\r", "\\r").Replace("\b", "\\b")), Some(typeof<string>)) 
+          | :? Boolean as b -> ((if (b) then "true" else "false"), Some(typeof<bool>))
+          | :? Single as f -> (sprintf "%A" f, Some(typeof<float32>))
+          | :? Double as f -> (sprintf "%A" f, Some(typeof<float>))
+          | :? Byte as i -> (sprintf "%A" i, Some(typeof<Byte>))
+          | :? SByte as i -> (sprintf "%A" i, Some(typeof<SByte>))
+          | :? Int16 as i -> (sprintf "%A" i, Some(typeof<int16>))
+          | :? Int32 as i -> (sprintf "%A" i, Some(typeof<int>))
+          | :? Int64 as i -> (sprintf "%A" i, Some(typeof<int64>))
+          | :? UInt16 as i -> (sprintf "%A" i, Some(typeof<uint16>))
+          | :? UInt32 as i -> (sprintf "%A" i, Some(typeof<uint32>))
+          | :? UInt64 as i -> (sprintf "%A" i, Some(typeof<uint64>))
+          | null -> ("(Unchecked.defaultof<_>)", None)
+          | _ -> ("(* Unknown primitive value '"+c.Value.ToString()+"' of type '"+
+                  c.Value.GetType().Name+"'. Please report this to the F# team. *)", None) 
+      match typ, reqty with        
+        | Some t, Some rt when t <> rt -> id -- convertFunc rt -- " (" -- value -- ")"
+        | _, _ ->  id -- value
+        
+        
+    /// Generate array initializer. Checks generator options for ASP.NET workaround.
+    let rec generateArrayCreateExpr (c:CodeArrayCreateExpression) =
+      if (c.Initializers<>null && c.Initializers.Count>0) then
+        id
+        -- "([| " +> col sepArgsSemi c.Initializers generateExpression -- " |] : "
+        +> withCtxt (fun ctx -> 
+            generateTypeRef c.CreateType          
+            -- if (ctx.Options &&& AdditionalOptions.AspNetArrays <> enum 0) then "[]" else "")
+        -- ")" 
+      else
+        id
+        -- "(Array.zeroCreate "
+        +> if (c.SizeExpression <> null) then
+              id -- "(" +> generateExpression c.SizeExpression -- ")"
+           else
+              id +> str c.Size
+        -- ":"
+        +> withCtxt (fun ctx -> 
+            generateTypeRef c.CreateType          
+            -- if (ctx.Options &&& AdditionalOptions.AspNetArrays <> enum 0) then "[]" else "")
+        -- ")";
+    
+    /// Tries to resolve if type is an array, so we can generate 
+    /// appropriate code (it can be either indexer or array, but we need to generate
+    /// .Item call for indexers (no overloading is supported by .[]).
+    /// Returns: "None" - can't resolve, "Some" resovled (true/false - is it an array?)
+    and tryIsExpressionArray c (ctx:Context) = 
+      match (c :> CodeExpression) with
+        | :? CodeFieldReferenceExpression as ce when 
+             (ce.TargetObject :? CodeThisReferenceExpression) -> 
+             match Map.tryFind ce.FieldName ctx.FieldTypes with 
+               | Some t -> Some (t.ArrayRank > 0)
+               | None -> None
+        | :? CodePropertyReferenceExpression as ce when 
+             (ce.TargetObject :? CodeThisReferenceExpression) -> 
+             match Map.tryFind ce.PropertyName ctx.PropertyTypes with 
+               | Some t -> Some (t.ArrayRank > 0)
+               | None -> None
+        | _ -> None    
+    
+    
+    /// Tries to resolve type of an expression using a few tricks:
+    /// * Fields of current type may have known type
+    /// * Properties of current type as well
+    /// * We can also try to resolve other properties (sometimes it helps)
+    /// * Resolve type for local variables or argument reference 
+    and tryGetExpressionType c (ctx:Context) = 
+      match (c :> CodeExpression) with
+        | :? CodeFieldReferenceExpression as ce when 
+             (ce.TargetObject :? CodeThisReferenceExpression) -> 
+             tryGetSystemType (Map.tryFind ce.FieldName ctx.FieldTypes)
+        | :? CodePropertyReferenceExpression as ce when 
+             (ce.TargetObject :? CodeThisReferenceExpression) -> 
+             tryGetSystemType (Map.tryFind ce.PropertyName ctx.PropertyTypes)
+        | :? CodePropertyReferenceExpression as ce ->
+               match (tryGetExpressionType ce.TargetObject ctx) with
+                 | None -> None
+                 | Some t ->
+                     try 
+                       Some (t.GetProperty(ce.PropertyName).PropertyType)
+                     with _ ->
+                       None
+        | :? CodeArgumentReferenceExpression as ce ->                              
+               Map.tryFind ce.ParameterName ctx.LocalVariableTypes  
+               // NOTE:
+               // XSD generates incorrect referenece (uses argument ref where it should be variable ref)
+               // and unfortunately it is followed by wrong numeric type, so we need to workaround this
+        | :? CodeVariableReferenceExpression as ce ->
+               Map.tryFind ce.VariableName ctx.LocalVariableTypes 
+        | _ -> None
+      
+    //---------------------------------------------------------------------------------------------
+    // Generating code for expressions
+          
+    /// Generates a "this" or "CurrentType" reference depending on whether a reference
+    /// is static or not. Used for "ambiguous" references without a type or object qualifier.
+    ///
+    /// Unfortunately the Code tree isn't so kind as to tell us whether a reference is static
+    /// or not up front. Instead we predetermine a set of some static members and 
+    /// assume all other references are instance references. 
+    ///
+    and generateExpressionDefaultThis isKnownStatic c = 
+      withCtxt (fun ctx -> 
+          match c with 
+          | null -> 
+              // REVIEW: this is still incorrect if the reference is static and it is a reference from an inherited type
+              id -- (if isKnownStatic then ctx.CurrentType.Name else "this" )  
+          | _ -> generateExpression c)
+        
+    /// Matches array or indexer expression and corrects it if the generated CodeDOM is incorrect
+    and (|CodeArrayAccessOrIndexer|_|) (ctx:Context) (c:CodeExpression) =
+      let noneT b = match b with Some v -> v | _ -> true
+      let noneF b = match b with Some v -> v | _ -> false
+      match c with 
+        | :? CodeArrayIndexerExpression as ce -> 
+             Some(true && (noneT (tryIsExpressionArray ce.TargetObject ctx)), ce.TargetObject, ce.Indices)
+        | :? CodeIndexerExpression as ce -> 
+             Some(false || (noneF (tryIsExpressionArray ce.TargetObject ctx)), ce.TargetObject, ce.Indices)
+        | _ -> None
+      
+    /// Generate expression - with unkonw type
+    and generateExpression c = generateExpressionTyped None c    
+ 
+    // Generates code for CodeExpression
+    // If the caller knows the expected type of the expression it can be given as an argument,
+    // but currently it is used only when generating primitve expression to convert value to the right type
+    and generateExpressionTyped ty c ctx = 
+      (match c with 
+        | :? CodeArgumentReferenceExpression as ce ->
+              id -! ce.ParameterName
+        | :? CodeArrayCreateExpression as ce ->
+              id +> generateArrayCreateExpr ce              
+        
+        // for indexers we generate get_Item to handle overloading
+        | CodeArrayAccessOrIndexer ctx (isArray, target, indices) ->
+              id
+              +> generateExpression target -- "."
+              +> id -- "[" +> col sepArgs indices generateExpression -- "]" 
+              
+        | :? CodeBaseReferenceExpression as ce ->
+              id -- "base"
+              
+        | :? CodeBinaryOperatorExpression as ce ->
+              binaryOp ce.Operator (generateExpressionTyped ty ce.Left) (generateExpressionTyped ty ce.Right)
+        
+        // casting can also represent numeric conversion - we try to detect that case      
+        | :? CodeCastExpression as ce -> 
+              id 
+              +> withCtxt (fun ctx -> 
+                  match tryGetExpressionType (ce.Expression) ctx, tryGetSystemType (Some ce.TargetType) with
+                  | Some(t1), Some(t2) when isNumericConversion t1 t2 ->
+                      id
+                      -- "(" -- (convertFunc t2)
+                      -- "(" +> generateExpression ce.Expression -- "))"
+                  | _ ->
+                    id
+                    -- "((" +> generateExpression ce.Expression -- " :> obj) :?> " +> generateTypeRef ce.TargetType -- ")" )
+        
+        // argument for "ref" or "out" C# parameter - both generated as byref in F#
+        | :? CodeDirectionExpression as ce ->
+              match ce.Direction with 
+              | FieldDirection.Out 
+              | FieldDirection.Ref -> 
+                  id -- "&" +> generateExpression ce.Expression
+              | _ -> 
+                  id +> generateExpression ce.Expression
+        
+        // for delegates, we use 'FuncFromTupled' to get the right function type      
+        | :? CodeDelegateCreateExpression as ce ->
+              id 
+              -- "new " +> generateTypeRef ce.DelegateType -- "(FuncConvert.FuncFromTupled " 
+              +> generateExpression ce.TargetObject 
+              -- "." -- ce.MethodName -- ")";
+        
+        | :? CodeDelegateInvokeExpression as ce ->
+              id
+              +> match ce.TargetObject with 
+                  // "this.<DeclaredEventName>( ... )" - will be translated to a raise function returned
+                  // by create_DelegateEvent
+                  | :? CodeEventReferenceExpression as eref when  
+                      (eref.TargetObject :? CodeThisReferenceExpression) 
+                      && ((ctx.DeclaredEvents |> List.tryFind (fun e -> e.Name = eref.EventName)) <> None) -> 
+                      // F# declared event..
+                      id
+                      -- "this._invoke_" -- eref.EventName -- " [| "
+                      +> col sepArgsSemi ce.Parameters (fun (e:CodeExpression) ->
+                           id
+                           -- " box (" 
+                           +> generateExpression e
+                           -- ")" ) -- " |]"
+                  // other than this.<Event>(). This may not be correct (but works on cases in test suite)
+                  | _ -> 
+                      generateExpression ce.TargetObject 
+                      -- ".Invoke(" +> col sepArgs ce.Parameters generateExpression -- ")"
+        
+        // this prevents using mutable variable in a way it would escape its scope
+        | :? CodeEventReferenceExpression as ce ->
+              id -- "let __e = " +> generateExpression ce.TargetObject -- " in __e." -- ce.EventName
+                          
+        | :? CodeFieldReferenceExpression as ce -> 
+              withCtxt (fun ctx ->  
+              
+                // if 'UnknownFieldsAsLocals' is set than the code will generate
+                // "fld" instead of "this.fld" when accessing field that is not known
+                let sft =
+                  match ce.TargetObject with
+                  | :? CodeThisReferenceExpression as t when 
+                       (ctx.Options &&& AdditionalOptions.UnknonwFieldsAsLocals <> enum 0) ->
+                       Option.isNone (Map.tryFind ce.FieldName ctx.FieldTypes)
+                  | _ -> false
+                if sft then
+                  id -! ce.FieldName
+                else
+                  id 
+                  +> match ce.TargetObject with 
+                       | :? CodeTypeReferenceExpression as ct ->
+                             id +> generateTypeRefNet ct.Type
+                       | _ -> 
+                           let isKnownStatic = 
+                               match ce.TargetObject, ctx.AllFields.TryFind ce.FieldName with 
+                               | null, Some m -> 
+                                  (m.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static) 
+                               | _ -> false
+                           generateExpressionDefaultThis isKnownStatic ce.TargetObject
+                 -- "." -- ce.FieldName )
+              
+        | :? CodeMethodInvokeExpression as ce ->
+              id 
+              +> generateExpression (ce.Method :> CodeExpression) 
+              -- "(" +> col sepArgs ce.Parameters generateExpression -- ")" 
+              
+        | :? CodeMethodReferenceExpression as ce ->
+              id 
+              +> match ce.TargetObject with 
+                   | :? CodeTypeReferenceExpression as ct ->
+                         id +> generateTypeRefNet ct.Type
+                   | _ -> 
+                       let isKnownStatic = 
+                           match ce.TargetObject, ctx.AllMeths.TryFind ce.MethodName with 
+                           | null, Some m -> 
+                              (m.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static) 
+                           | _ -> false
+                       generateExpressionDefaultThis isKnownStatic ce.TargetObject
+              -- "." -- ce.MethodName 
+              +> generateTypeArgs ce.TypeArguments
+              
+        | :? CodeObjectCreateExpression as ce ->
+              id
+              -- "new " +> generateTypeRef ce.CreateType 
+              -- "(" +> col sepArgs ce.Parameters generateExpression -- ")" 
+              
+        | :? CodePrimitiveExpression as ce -> 
+              id +> generatePrimitiveExpr ty ce 
+              
+        | :? CodePropertyReferenceExpression as ce ->
+              id 
+              +> match ce.TargetObject with 
+                   | :? CodeTypeReferenceExpression as ct ->
+                         id +> generateTypeRefNet ct.Type
+                   | _ -> 
+                       let isKnownStatic = 
+                           match ce.TargetObject, ctx.AllProps.TryFind ce.PropertyName with 
+                           | null, Some m -> 
+                              (m.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static) 
+                           | _ -> false
+                       generateExpressionDefaultThis isKnownStatic ce.TargetObject
+              -- "." -- ce.PropertyName 
+              
+        | :? CodePropertySetValueReferenceExpression as ce ->  
+              id -- "value"
+              
+        // we move all lines of "snippets" by 100 columns so it isn't violating #light rules
+        | :? CodeSnippetExpression as ce ->
+              let strs = 
+                ce.Value.Split([| '\r'; '\n' |], StringSplitOptions.RemoveEmptyEntries)
+                |> Array.map (fun s -> String(' ',100) + s )
+              colT sepNone strs (fun s -> id ++ s)
+
+        | :? CodeThisReferenceExpression as ce ->  
+              id -- "this"
+              
+        | :? CodeTypeOfExpression as ce ->  
+              id -- "(typeof<" +> generateTypeRef ce.Type -- ">)"
+              
+        | :? CodeTypeReferenceExpression as ce ->  
+              id +> generateTypeRef ce.Type 
+              
+        | :? CodeVariableReferenceExpression as ce ->            
+              match ty with 
+              | Some t when (convertFunc t) <> "" -> id -- "(" -- (convertFunc t) -- " " -! ce.VariableName -- ")"
+              | _ -> id -! ce.VariableName
+              
+        | null ->
+            id 
+            
+        | _ -> id 
+               -- "(* Unknown expression type '" -- (c.GetType().Name) 
+               -- "' please report this to the F# team. *)") ctx
+    
+    //---------------------------------------------------------------------------------------------
+    // Generating code for statements
+      
+    and generateVariableDeclStmt (c:CodeVariableDeclarationStatement) =
+      id
+      +> (fun ctx -> { ctx with LocalVariableTypes = tryAddVariableType c.Name c.Type ctx.LocalVariableTypes } )
+      ++ "let mutable (" -! c.Name -- ":" +> generateTypeRef c.Type -- ") = "
+      +> if (c.InitExpression <> null) then 
+           (generateExpressionTyped (tryGetSystemType (Some c.Type))) c.InitExpression 
+         else 
+           (generateDefaultValue c.Type);
+    
+    // REVIEW: Line pragmas don't work with the #light syntax
+    let generateLinePragma (l:CodeLinePragma) = 
+      if (l = null) then id else
+        id 
+        ++ "# " +> str l.LineNumber -- " \"" -- l.FileName -- "\""
+        
+    let rec generateCatchClause (c:CodeCatchClause) =
+      id
+      ++ "| :? " +> generateTypeRef c.CatchExceptionType 
+      -- " as " -- c.LocalName -- " ->" +> incIndent
+      +> generateStatements c.Statements +> decIndent
+
+    and generateStatements (sts:CodeStatementCollection) = 
+      let fix = 
+        if (sts.Count = 0 || (sts.[sts.Count - 1] :? CodeVariableDeclarationStatement))
+          then id ++ "()" else id
+      col sepNone sts generateStatement +> fix      
+
+    // Generates block of statements which can return a value
+    and generateStatementBlock typ (statements:CodeStatementCollection) =        
+      // determine if the block uses only "safe" return statements
+      // that can be translated to functional returns without using exceptions
+      let safeReturns = 
+        statements 
+        |> codeDomCallbackWithScope (fun rcall safeScope res o -> 
+            match o with 
+            | :? CodeMethodReturnStatement as ret -> safeScope && res
+            | :? CodeTryCatchFinallyStatement as tfs -> rcall (safeScope && (tfs.CatchClauses.Count = 0)) res o
+            | :? CodeStatementCollection -> rcall safeScope res o
+            | _ -> rcall false res o ) true true
+    
+      id
+      +> incIndent
+      +> (fun ctx -> { ctx with CurrentMethodReturnType=typ; 
+                                LocalVariableTypes = Map.empty; 
+                                ReturnUsingException = not safeReturns })
+      // if returning using exception - wrap inside try .. catch
+      +> if (not safeReturns) then id ++ "try" +> incIndent else id
+      +> generateStatements statements
+      +> if (safeReturns) then id else
+           match typ with 
+           | Some t when t.BaseType <> "System.Void" -> 
+               id ++ "failwith \"Code branch didn't return any value!\";"
+               +> decIndent
+               ++ "with" ++ "    | ReturnException" +> uniqid -- " v -> (v :?> " +> generateTypeRef t -- ")"
+           | _ ->  
+               id ++ "raise ReturnNoneException" +> uniqid 
+               +> decIndent
+               ++ "with" ++ "    | ReturnNoneException" +> uniqid -- " -> ()"
+      +> (fun ctx -> {ctx with CurrentMethodReturnType=None; 
+                               LocalVariableTypes = Map.empty; 
+                               ReturnUsingException = false })
+      +> decIndent
+
+    and generateComment (c:CodeComment) =
+      id 
+      -- if c.DocComment then "/// " else "// " 
+      -- (c.Text);
+
+    and generateExpressionThenUpCast e (t: CodeTypeReference) = 
+        if isKnownSealedType t then 
+            generateExpression e
+        else
+            id -- "((" +> generateExpression e -- " :> obj) :?> " +> generateTypeRef t -- ")" 
+          
+    and generateStatement (c:CodeStatement) = 
+      (generateLinePragma c.LinePragma) +>
+      (match c with 
+        | :? CodeAssignStatement as cs -> 
+              match cs.Left with 
+                | :? CodeIndexerExpression as ci ->
+                    id ++ "" 
+                    +> generateExpressionDefaultThis false ci.TargetObject -- ".set_Item(" 
+                    +> col sepArgs ci.Indices generateExpression -- ", "
+                    +> withCtxt (fun ctx -> generateExpressionTyped (tryGetExpressionType cs.Left ctx) cs.Right)
+                    -- ")"
+                | _ ->
+                    id ++ "" +> generateExpression cs.Left 
+                    -- " <- " 
+                    +> withCtxt (fun ctx -> generateExpressionTyped (tryGetExpressionType cs.Left ctx) cs.Right)
+                    
+        | :? CodeAttachEventStatement as cs ->
+              id ++ "" +> generateExpression (cs.Event :> CodeExpression) 
+              -- ".AddHandler(" +> generateExpression cs.Listener -- ")"
+              
+        | :? CodeCommentStatement as cs -> 
+              id ++ "" +> generateComment cs.Comment 
+              
+        | :? CodeConditionStatement as cs ->
+              id 
+              ++ "if " +> generateExpression cs.Condition -- " then"
+              +> incIndent +> col sepNone cs.TrueStatements generateStatement +> decIndent
+              +> if (cs.FalseStatements<>null && cs.FalseStatements.Count>0) then 
+                   id 
+                   ++ "else" +> incIndent 
+                   +> col sepNone cs.FalseStatements generateStatement +> decIndent else id                
+                   
+        | :? CodeExpressionStatement as cs -> 
+              id ++ "" +> generateExpression cs.Expression -- " |> ignore";
+              
+        | :? CodeIterationStatement as cs ->
+              id 
+              +> generateStatement cs.InitStatement
+              ++ "while " +> generateExpression cs.TestExpression -- " do"
+              +> incIndent
+              +> col sepNone cs.Statements generateStatement 
+              +> generateStatement cs.IncrementStatement
+              +> decIndent
+              
+        // Return - either throw "ReturnException" or just generate F# expression with the value
+        | :? CodeMethodReturnStatement as cs -> 
+              id
+              +> withCtxt (fun ctx -> 
+                   if (ctx.ReturnUsingException) then
+                       id 
+                       ++ "raise ("
+                       +> match ctx.CurrentMethodReturnType with
+                          | Some t when t.BaseType <> "System.Void" -> 
+                              id -- "ReturnException" +> uniqid -- "(" +> generateExpressionThenUpCast cs.Expression t -- ")"
+                          | _ -> 
+                              id -- "ReturnNoneException" +> uniqid
+                       -- ")"
+                   else 
+                       match ctx.CurrentMethodReturnType with
+                       | Some t when t.BaseType <> "System.Void" -> 
+                           id 
+                           ++ "" +> generateExpressionThenUpCast cs.Expression t
+                       | _ ->      id ++ "")
+                     
+        | :? CodeSnippetStatement as cs ->
+              let strs = cs.Value.Split([| '\r'; '\n' |], StringSplitOptions.RemoveEmptyEntries);
+              colT sepNone strs (fun s -> id ++ s)
+              
+        | :? CodeVariableDeclarationStatement as cs -> 
+              id +> generateVariableDeclStmt cs
+              
+        | :? CodeThrowExceptionStatement as cs ->            
+              id ++ "raise (" +> generateExpression cs.ToThrow -- ")"
+        
+        // try .. catch .. finaly is generated as try (try .. catch) finally      
+        | :? CodeTryCatchFinallyStatement as cs -> 
+              let hasCatch = (cs.CatchClauses<>null && cs.CatchClauses.Count>0) 
+              let hasFinally = (cs.FinallyStatements<>null && cs.FinallyStatements.Count>0) 
+              id 
+              ++ "try" +> incIndent
+              +> if (hasCatch && hasFinally) then id ++ "try" +> incIndent else id
+              +> generateStatements cs.TryStatements 
+              +> if (cs.CatchClauses<>null && cs.CatchClauses.Count>0) then 
+                   decIndent 
+                   ++ "with" +> incIndent 
+                   +> col sepNone cs.CatchClauses generateCatchClause
+                   +> decIndent else id;
+              +> if (cs.FinallyStatements<>null && cs.FinallyStatements.Count>0) then 
+                   decIndent
+                   ++ "finally" +> incIndent 
+                   +> col sepNone cs.FinallyStatements generateStatement
+                   +> decIndent else id;
+                   
+        | _ -> id 
+               -- "(* Unknown statement type '" -- (c.GetType().Name) 
+               -- "' please report this to the F# team. *)")
+
+    //---------------------------------------------------------------------------------------------
+    // Support for class members (Custom attributes, paramters, etc..)
+        
+    let generateAttributeArg (c:CodeAttributeArgument) =
+      id
+      +> if (c.Name<> null && c.Name.Length>0) then 
+          id -- c.Name -- "=" else id
+      +> generateExpression c.Value;
+      
+    let generateCustomAttrDecl (c:CodeAttributeDeclaration) =
+      id
+      -- (getBaseTypeRefString c.Name)
+      +> if (c.Arguments.Count = 0) then id else
+           id -- "(" +> (col sepArgs c.Arguments generateAttributeArg) -- ")" 
+          
+    let generateCustomAttrDeclsList (c:CodeAttributeDeclaration list) =
+      id 
+      +> if (c.Length = 0) then id else 
+           id ++ "[<" +> (colT sepNlnSemiSpace c generateCustomAttrDecl) -- ">]"
+          
+    let generateCustomAttrDeclsForType (c:CodeAttributeDeclaration list) (a:Reflection.TypeAttributes) =
+      id 
+      +> if (c.Length = 0)
+            && (a &&& TypeAttributes.Abstract  = enum 0)
+            && (a &&& TypeAttributes.Sealed  = enum 0) then id 
+         else 
+           id ++ "[<" 
+                 +> (colT sepNlnSemiSpace [ for x in c do yield generateCustomAttrDecl x
+                                            if a &&& TypeAttributes.Abstract <> enum 0 then yield (id -- "Microsoft.FSharp.Core.AbstractClassAttribute" +> sepNlnSemiSpace)
+                                            if a &&& TypeAttributes.Sealed   <> enum 0 then yield (id -- "Microsoft.FSharp.Core.SealedAttribute" +> sepNlnSemiSpace) ]
+                                          (fun c -> c) )                                           
+              -- ">]"
+          
+(*
+VisibilityMask Specifies type visibility information. 
+ NotPublic Specifies that the class is not public. 
+ Public Specifies that the class is public. 
+ NestedPublic Specifies that the class is nested with public visibility. 
+ NestedPrivate Specifies that the class is nested with private visibility. 
+ NestedFamily Specifies that the class is nested with family visibility, and is thus accessible only by methods within its own type and any subtypes. 
+ NestedAssembly Specifies that the class is nested with assembly visibility, and is thus accessible only by methods within its assembly. 
+ NestedFamANDAssem Specifies that the class is nested with assembly and family visibility, and is thus accessible only by methods lying in the intersection of its family and assembly. 
+ NestedFamORAssem Specifies that the class is nested with family or assembly visibility, and is thus accessible only by methods lying in the union of its family and assembly. 
+ LayoutMask Specifies class layout information. 
+ AutoLayout Specifies that class fields are automatically laid out by the common language runtime. 
+ SequentialLayout Specifies that class fields are laid out sequentially, in the order that the fields were emitted to the metadata. 
+ ExplicitLayout Specifies that class fields are laid out at the specified offsets. 
+ ClassSemanticsMask Specifies class semantics information; the current class is contextful (else agile). 
+ Class Specifies that the type is a class. 
+ Interface Specifies that the type is an interface. 
+    DONE: Abstract Specifies that the type is abstract. 
+    DONE: Sealed Specifies that the class is concrete and cannot be extended. 
+ SpecialName Specifies that the class is special in a way denoted by the name. 
+ Import Specifies that the class or interface is imported from another module. 
+ Serializable Specifies that the class can be serialized. 
+ StringFormatMask Used to retrieve string information for native interoperability. 
+ AnsiClass LPTSTR is interpreted as ANSI. 
+ UnicodeClass LPTSTR is interpreted as UNICODE. 
+ AutoClass LPTSTR is interpreted automatically. 
+ CustomFormatClass LPSTR is interpreted by some implementation-specific means, which includes the possibility of throwing a NotSupportedException. 
+ CustomFormatMask Used to retrieve non-standard encoding information for native interop. The meaning of the values of these 2 bits is unspecified. 
+ BeforeFieldInit Specifies that calling static methods of the type does not force the system to initialize the type. 
+ ReservedMask Attributes reserved for runtime use. 
+ RTSpecialName Runtime should check name encoding. 
+ HasSecurity 
+*)
+
+    let generateCustomAttrDecls (c:CodeAttributeDeclarationCollection) = 
+      generateCustomAttrDeclsList (c |> Seq.cast |> Seq.toList)
+      
+    // NOTE: may contain custom attributes - this isn't supported
+    let generateParamDecl (c:CodeParameterDeclarationExpression) =
+      let dir = if (c.Direction <> FieldDirection.In) then " byref" else ""
+      id 
+      -! c.Name -- ":" +> generateTypeRef c.Type -- dir;
+
+    // NOTE: may contain custom attributes - this isn't supported
+    let generateAbstractParamDecl (c:CodeParameterDeclarationExpression) =
+      let dir = if (c.Direction <> FieldDirection.In) then " byref" else ""
+      id +> generateTypeRef c.Type -- dir
+
+    // Find all overloads of the method, so we can produce [<OverloadID>]
+    let getMethodOverloads (membs:CodeTypeMemberCollection) = 
+      let getMethodOverload map (n:CodeMemberMethod) = 
+        let n = (n.Name, getTypeRefSimple n.PrivateImplementationType)
+        match Map.tryFind n map with 
+          | Some v -> v 
+          | None -> 0
+      let incMethodOverload (n:CodeMemberMethod) map = 
+        let n = (n.Name, getTypeRefSimple n.PrivateImplementationType)
+        match Map.tryFind n map with 
+          | Some v -> Map.add n (v+1) map
+          | None -> Map.add n 1 map          
+      let m,a = 
+        membs 
+        |> codeDomCallBackNoScope 
+            (fun rcall (res,mlst) o -> 
+                match o with 
+                  | :? CodeMemberMethod as meth when meth.GetType() = (typeof<CodeMemberMethod>) -> 
+                      // we have found another method
+                      (incMethodOverload meth res, 
+                       ( meth, 
+                         getMethodOverload res meth,
+                         getTypeRefSimple meth.PrivateImplementationType
+                       )::mlst)
+                  | :? CodeTypeMemberCollection -> 
+                       // recursively walk through member collection
+                       rcall (res,mlst) o
+                  | _ -> (res,mlst))
+            (Map.empty, [])
+      getMethodOverload m, a
+      
+    //---------------------------------------------------------------------------------------------
+    // Fields, properties, constructors, methods
+    
+    /// fields 
+    let generateField (c:CodeMemberField) =    
+      id
+      +> generateCustomAttrDecls c.CustomAttributes
+      +> if ((c.Attributes &&& MemberAttributes.ScopeMask) = MemberAttributes.Static) then
+            id
+            ++ "[<Microsoft.FSharp.Core.DefaultValueAttribute(false)>]"
+            ++ "static val mutable private " -- c.Name -- ":" +> generateTypeRef c.Type
+            //++ (match c.InitExpression with
+                 
+         elif ((c.Attributes &&& MemberAttributes.ScopeMask) = MemberAttributes.Const) then
+            id
+            ++ "static member " -- c.Name -- " = " +> generateExpression c.InitExpression // should have initial value!
+         else
+             id ++ "[<Microsoft.FSharp.Core.DefaultValueAttribute(false)>]"
+                ++ "val mutable " -- c.Name -- ":" +> generateTypeRef c.Type
+    
+    /// Abstract property in the interface 
+    let generateInterfaceMemberProperty (c:CodeMemberProperty) =    
+      id 
+      ++ "abstract " -- c.Name -- " : " 
+      +> (if c.Parameters.Count  > 0 then col sepStar c.Parameters generateAbstractParamDecl -- " -> " else id) 
+      +> generateTypeRef c.Type -- " with " -- (if c.HasGet && not c.HasSet then "get" elif c.HasGet && c.HasSet then "get,set" else "set")
+
+    // REVIEW: this is not correct, it should follow same abstract/default/override logic
+    // as methods. Unfortunately it isn't possible to declare "abstract" property with "default" implementation
+    let generateClassProperty (typ:MemberGenerateType)  (p:CodeMemberProperty) =    
+    
+      (if typ = MemberGenerateType.InsideStruct ||
+          p.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Override ||
+          p.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static 
+       then id
+       else (id 
+             ++ ""
+             +> generateInterfaceMemberProperty p))
+      +> generateCustomAttrDecls p.CustomAttributes
+      ++ if typ = MemberGenerateType.InsideStruct then "member this."
+         elif (p.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Override) then "override  this." 
+         elif (p.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static) then "static member " 
+         else "default this."
+      -- p.Name  
+
+      +> if (not p.HasGet) then id else 
+         incIndent
+         ++ "with get("
+         +> col sepArgs p.Parameters generateParamDecl
+         -- ") : " +> generateTypeRef p.Type -- " =" 
+         +> generateStatementBlock (Some p.Type) p.GetStatements 
+         +> decIndent
+      +> if (not p.HasSet) then id else 
+         incIndent
+         ++ (if p.HasGet then "and" else "with") -- " set(" 
+         +> col sepNone p.Parameters (fun p -> (generateParamDecl p) -- ", ")
+         -- "value:" +> generateTypeRef p.Type 
+         -- ") : unit =" 
+         +> generateStatementBlock None p.SetStatements 
+         +> decIndent
+    
+    // The argument 'c' can be null when generating default ctor 
+    // (which is not generated by the compiler as in C#)
+    let generateConstructor (c:CodeConstructor) =    
+      // Find all (non-static) fields
+      withCtxt (fun ctx -> 
+          let fields = 
+            ctx.CurrentType.Members
+              |> codeDomFlatFilter (fun o -> 
+                   match o with 
+                     | :? CodeMemberField as fld -> 
+                       let keep = 
+                         (fld.Attributes &&& MemberAttributes.ScopeMask <> MemberAttributes.Static) &&
+                         (fld.Attributes &&& MemberAttributes.ScopeMask <> MemberAttributes.Const)  &&
+                         (match fld.InitExpression with null -> false | _ -> true)
+
+                       (keep, false) 
+                     | _ -> 
+                       (false, false) )
+              |> List.map ( fun f -> f :?> CodeMemberField )
+          id
+          +> (if c <> null then generateCustomAttrDecls c.CustomAttributes else id)
+          ++ "new(" 
+          +> if (c <> null) then (col sepArgs c.Parameters generateParamDecl) else id
+          -- ") as this ="
+          +> incIndent
+          ++ "{"
+          +> incIndent
+          // Calling base constructor?
+          +> if (c = null || c.BaseConstructorArgs = null || c.BaseConstructorArgs.Count = 0) then id else
+                 let (b, i) = ctx.BaseTypes
+                 match b with 
+                   | None -> failwith "Calling constructor of nonexisting base?"
+                   | Some t -> 
+                      id 
+                      ++ "inherit " +> generateTypeRef t -- "("
+                      +> col sepArgs c.BaseConstructorArgs generateExpression
+                      --");"; 
+          // Generate events
+          +> decIndent
+          ++ "}"
+          +> if ((c <> null && c.Statements.Count > 0) || not fields.IsEmpty || not ctx.DeclaredEvents.IsEmpty) then
+               id
+               -- " then"
+               +> incIndent
+               +> incIndent
+               // Initialize events
+               +> colT sepNone ctx.DeclaredEvents ( fun e -> 
+                           id 
+                           ++ "let t_event_" -- e.Name -- " = new DelegateEvent<" +> generateTypeRef e.Type -- ">();"
+                           ++ "this._event_" -- e.Name -- " <- t_event_" -- e.Name -- ".Publish;"
+                           ++ "this._invoke_" -- e.Name -- " <- t_event_" -- e.Name -- ".Trigger;" ) 
+               // Initialize fields
+               +> colT sepNone fields (fun fld -> 
+                        id ++ "this." -- fld.Name -- " <- " +> generateExpression fld.InitExpression-- ";" )
+               // Run other initialization code
+               +> (if c <> null && c.Statements.Count > 0 then 
+                     id
+                     ++ "begin"
+                     +> generateStatementBlock (None) c.Statements 
+                     ++ "end"
+                   else 
+                      id)
+               +> decIndent
+               +> decIndent
+             else 
+               id
+          +> decIndent)
+
+    /// Abstract method in the interface
+    let generateInterfaceMemberMethod (c:CodeMemberMethod, overloadId:int) =
+      let custAttrs = (c.CustomAttributes |> Seq.cast |> Seq.toList)
+
+      let tyargs, genTyArgs = processTypeArgs c.TypeParameters       
+      usingTyParams tyargs 
+        (id
+        +> col sepNone c.Comments generateStatement
+        +> generateCustomAttrDeclsList custAttrs
+        ++ "abstract "
+        -- c.Name 
+        +> genTyArgs
+        -- " : "
+        +> if (c.Parameters.Count > 0) then
+             id +> col sepStar c.Parameters generateAbstractParamDecl
+           else
+             id -- "unit"
+        -- " -> "
+        +> generateTypeRef c.ReturnType)
+      
+    /// By default all CodeDOM generated methods are 'virtual' which means that 
+    /// we have to generate "abstract and default" (unless we're in struct or
+    /// we're implementing an interface, or the method is overriden)
+    /// (NOTE: the same logic isn't properly implemented for properties)
+    let generateMethod (typ:MemberGenerateType) (c:CodeMemberMethod) genAttrFunc =    
+      
+      let prefx, mnm =
+        if (typ = MemberGenerateType.InsideInterface) then
+          id, "member this."
+        elif (typ = MemberGenerateType.InsideStruct) then
+          id, "member this."
+        elif (c.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Static) then 
+          id, "static member "
+        elif (c :? CodeEntryPointMethod) then
+          id, "static member "
+        elif (c.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Abstract) then 
+          (id +> generateInterfaceMemberMethod (c, -1)),
+          ""
+        elif (c.Attributes &&& MemberAttributes.ScopeMask = MemberAttributes.Override) then 
+          id, "override this." 
+        else
+          (id +> generateInterfaceMemberMethod (c, -1)),
+          "default this."
+
+      //REVIEW: This is mutating the CodeMemberMethod which is a little questionable
+      if c.Name = "" then c.Name <- freshName ()
+      if (mnm = "") then prefx else
+      let tyargs, genTyArgs = processTypeArgs c.TypeParameters       
+      usingTyParams tyargs 
+        (prefx
+        +> genAttrFunc
+        ++ mnm -- c.Name +> genTyArgs -- " "
+        -- " (" +> col sepArgs c.Parameters generateParamDecl -- ")"
+        -- " ="
+        
+        // We need to create mutable copy of all arguments except for "byref" arguments which are mutable
+        +> incIndent
+        +> col sepNone c.Parameters (fun (c:CodeParameterDeclarationExpression) ->  
+             if (c.Direction <> FieldDirection.In) then id else
+               id ++ "let mutable " -- c.Name -- " = " -- c.Name ) 
+        +> decIndent     
+        +> generateStatementBlock (Some c.ReturnType) c.Statements)
+
+    /// Generates method code
+    /// Generates comments and than calls 'generatMethod'
+    let generateClassMemberMethod (typ:MemberGenerateType) (c:CodeMemberMethod, overloadId:int) =
+      let custAttrs = (c.CustomAttributes |> Seq.cast |> Seq.toList)
+      id
+      +> col sepNone c.Comments generateStatement
+      +> generateMethod typ c (generateCustomAttrDeclsList custAttrs)
+    
+    let generateEntryPointMethod (typ:MemberGenerateType) (c:CodeEntryPointMethod)  = 
+      id
+      +> (fun ctx -> {ctx with MainMethodForCurrentNamespace = Some (c, ctx.CurrentType)})
+      +> (generateClassMemberMethod typ ((c :> CodeMemberMethod), -1))
+    
+    let generateEvent (c:CodeMemberEvent) = 
+      id
+      +> generateCustomAttrDecls c.CustomAttributes
+      ++ "[<CLIEvent>]"
+      ++ "member this." -- c.Name -- " ="
+      +> incIndent
+      ++ "this._event_" -- c.Name
+      +> decIndent
+    
+    let generateEventField (c:CodeMemberEvent) =
+      id
+      +> (fun ctx -> { ctx with DeclaredEvents = c::ctx.DeclaredEvents })
+      ++ "[<Microsoft.FSharp.Core.DefaultValueAttribute(false)>]"
+      ++ "val mutable _event_" -- c.Name -- " : IDelegateEvent<" +> generateTypeRef c.Type -- ">;"
+      ++ "[<Microsoft.FSharp.Core.DefaultValueAttribute(false)>]"
+      ++ "val mutable _invoke_" -- c.Name -- " : obj[] -> unit;";
+    
+
+    let generateCodeSnippetMember (c:CodeSnippetTypeMember) =
+      
+      // Remove additional spaces to make sure that the code aligns with the rest
+      // CONSIDER: what to do with '\t' ?
+      let countSpaces (s:string) =
+        let rec countSpacesAux (s:string) i n = 
+          if i >= s.Length then n
+          elif s.[i] = ' ' then countSpacesAux s (i + 1) (n + 1)
+          else n
+        countSpacesAux s 0 0
+              
+      let lines = c.Text.Split([| '\n'; '\r' |], StringSplitOptions.RemoveEmptyEntries)
+      if lines.Length > 0 then 
+          let spaces = Array.foldBack (countSpaces >> min) lines Int32.MaxValue
+          let lines = lines |> Array.map (fun s -> s.[spaces..])
+          
+          // ASP.NET doesn�t use any comments or custom attributes, 
+          // but I assume this would be the right order
+          id 
+          +> col sepNone c.Comments generateStatement
+          +> generateLinePragma c.LinePragma
+          +> generateCustomAttrDecls c.CustomAttributes
+          +> colT sepNone lines ((++) id)
+      else 
+          id
+
+            
+    //---------------------------------------------------------------------------------------------
+    // Interfaces and classes and other types
+
+    let generateInterfaceImplementation (ifcnfo:KeyValuePair<_, _>) =
+      let name = ifcnfo.Key
+      let membs = ifcnfo.Value
+      id 
+      ++ "interface " -- name -- " with"
+      +> incIndent
+      +> colT sepNln membs (generateClassMemberMethod MemberGenerateType.InsideInterface)
+      +> decIndent
+      ++ "end"
+
+    let generateClassMember typ (c:CodeTypeMember) =
+      match c with 
+      | :? CodeTypeDeclaration -> id 
+      | :? CodeMemberField 
+      | :? CodeMemberEvent 
+      | :? CodeConstructor 
+      | :? CodeMemberProperty ->
+            id
+            +> col sepNone c.Comments generateStatement
+            +> match c with 
+                 | :? CodeMemberField as cm -> generateField cm
+                 | :? CodeMemberEvent as cm -> generateEvent cm
+                 | :? CodeConstructor as cm -> generateConstructor cm
+                 | :? CodeMemberProperty as cm -> generateClassProperty typ cm
+                 | _ -> failwithf "unimplemented CodeTypeMember '%A'" c
+      | _ ->
+            id ++ "(* Member of type '" +> str (c.GetType().Name) --  "' is not supported by the CodeDOM provider and was omitted *)" 
+
+      
+    let generateClassOrStruct structOrCls (scope:string list) (c:CodeTypeDeclaration) ctx =
+      // affects members
+      let typ = 
+        if (structOrCls = "struct") then MemberGenerateType.InsideStruct 
+          else MemberGenerateType.InsideClass
+        
+      // Find all constructors
+      let ctors = c |> codeDomFlatFilter (fun o -> 
+            match o with 
+              | :? CodeTypeDeclaration as dc -> (false, dc = c)
+              | :? CodeConstructor as c -> (true, true)
+              | _ -> (false, true); ) 
+      let anyCtor = ctors.Length > 0;
+      
+      // Find base classes
+      let (baseClass, interfaces) = resolveHierarchy c ctx
+      
+      // Find fields and their types
+      let (ft, pt, flds, props, meths, events) = 
+          c.Members |> codeDomCallBackNoScope (fun rcall ((ft, pt,flds, props, meths, events) as acc) o -> 
+              match o with 
+                | :? CodeMemberField as fld -> (Map.add fld.Name fld.Type ft, pt, Map.add fld.Name  fld flds, props, meths, events)
+                | :? CodeMemberProperty as prop -> (ft, Map.add prop.Name prop.Type pt, flds, Map.add prop.Name prop props, meths, events)
+                | :? CodeMemberMethod as meth -> (ft, pt, flds, props, Map.add meth.Name meth meths, events)
+                | :? CodeMemberEvent as ev -> (ft, pt, flds, props, meths, Map.add ev.Name ev events)
+                | :? CodeTypeMemberCollection -> rcall acc o
+                | _ -> acc; ) (Map.empty, Map.empty, Map.empty, Map.empty, Map.empty, Map.empty)
+                          
+      // Find all overloads of the method, so we can produce [<OverloadID>]
+      let (getOverload, allmeths) = getMethodOverloads(c.Members)
+      
+      // Get tripple with method info, overload id and name of the interface where
+      // it belongs (if it's "PrivateImplementationType")
+      let allmeths = allmeths |> List.map ( fun (cm, ovIdx, intrfcName) -> 
+        match getOverload cm with | 1 -> (cm, -1, intrfcName) | _ -> (cm, ovIdx, intrfcName) )
+        
+      // Split between methods of the class
+      // and methods that implemnet some interface
+      let ifcTable = new Dictionary<string, ResizeArray<CodeMemberMethod*int>>()
+      let allmeths = 
+        allmeths |> mapFilter (fun (m, idx, ifn) -> 
+          match m.PrivateImplementationType, m.ImplementationTypes.Count with
+          | null, 0 -> Some((m,idx))
+          | _ , 0 -> 
+            let b,v = ifcTable.TryGetValue(ifn)
+            let v = 
+              if (not b) then 
+                let rs = new ResizeArray<CodeMemberMethod*int>()
+                ifcTable.Add(ifn, rs)
+                rs 
+              else v
+            v.Add((m,idx))
+            None
+          | null, n -> 
+            for implementedInterface in m.ImplementationTypes do
+                let b,v = ifcTable.TryGetValue(getTypeRefSimple implementedInterface)
+                let v =
+                  if (not b) then
+                    let rs = new ResizeArray<CodeMemberMethod*int>()
+                    ifcTable.Add(getTypeRefSimple implementedInterface, rs)
+                    rs
+                  else v
+                v.Add((m, idx))
+            Some((m,idx))
+          | _, _ -> failwith "CodeMethodMember must not have both ImplementationTypes and PrivateImplementationType set.")
+
+
+      // NOTE: we ignore class visibility and also IsPartial property
+      // Declare type arguments and generate class 
+      let tyargs, genTyArgs = processTypeArgs c.TypeParameters       
+      (usingTyParams tyargs 
+        (id  
+        +> (fun ctx -> { ctx with BaseTypes = (baseClass, interfaces); FieldTypes = ft; PropertyTypes = pt; AllFields=flds; AllProps=props; AllMeths=meths; AllEvents=events  })   
+        ++ ""    
+        ++ (if c.IsPartial then "(* partial *)" else "")    
+        +> col sepNone scope (fun s -> id -- s -- "_") -- c.Name 
+        +> genTyArgs
+        -- " = " -- structOrCls
+        +> incIndent
+        +> match (baseClass) with
+             | Some (bc) -> id ++ "inherit " +> generateTypeRef bc -- " "
+             | _ -> id
+        
+        // Filter and generate members
+        +> colFilterT<CodeMemberEvent>     sepNln c.Members generateEventField
+        +> colFilter<CodeMemberField>     sepNln c.Members (generateClassMember typ)
+        +> colFilter<CodeTypeConstructor> sepNln c.Members (generateClassMember typ)
+        +> colFilter<CodeMemberEvent>     sepNln c.Members (generateClassMember typ)
+        
+        // Generate default empty constructor for classes 
+        // without constructors (but not for structs!)
+        +> if (anyCtor) then
+             colFilter<CodeConstructor> sepNln c.Members (generateClassMember typ)
+           elif (structOrCls = "class" && not c.IsPartial) then
+             generateConstructor null
+           else
+            id 
+            
+        // User code
+        +> colFilterT<CodeSnippetTypeMember> sepNln c.Members generateCodeSnippetMember
+        // Properties, methods, interface implementations
+        +> colFilter<CodeMemberProperty> sepNln c.Members (generateClassMember typ)
+        +> colT sepNln allmeths (generateClassMemberMethod typ)
+        +> colT sepNln ifcTable generateInterfaceImplementation
+        +> colFilterT<CodeEntryPointMethod> sepNln c.Members (generateEntryPointMethod typ)
+        +> decIndent
+        ++ "end")) ctx
+        
+    let generateInterface (scope:string list) (c:CodeTypeDeclaration) =
+      // handle overloads
+      let (getOverload, allmeths) = getMethodOverloads c.Members 
+      let allmeths = allmeths |> List.map ( fun (cm, ovIdx, _) -> 
+        match getOverload cm with | 1 -> (cm, -1) | _ -> (cm, ovIdx) )
+
+      let castToProp (a:CodeTypeMember) = (a :?> CodeMemberProperty)        
+
+      // NOTE: visibility is ignored
+      let tyargs, genTyArgs = processTypeArgs c.TypeParameters       
+      usingTyParams tyargs 
+        (id  
+        ++ ""    
+        +> col sepNone scope (fun s -> id -- s -- "_") -- c.Name 
+        +> genTyArgs
+        -- " = interface" 
+        +> incIndent
+        +> col sepNln c.BaseTypes (fun (cr:CodeTypeReference) -> id ++ "inherit " +> generateTypeRef cr)
+        +> colFilter<CodeMemberProperty> sepNln c.Members (castToProp >> generateInterfaceMemberProperty)
+        ++ ""
+        +> colT sepNln allmeths generateInterfaceMemberMethod
+        +> decIndent
+        ++ "end")
+      
+    let generateDelegate (scope:string list) (c:CodeTypeDelegate) =
+      let tyargs, genTyArgs = processTypeArgs c.TypeParameters       
+      usingTyParams tyargs 
+        (id
+        ++ ""
+        +> col sepNone scope (fun s -> id -- s -- "_") -- c.Name 
+        +> genTyArgs
+        -- " = delegate of "
+        +> if (c.Parameters.Count = 0) then
+             id -- "unit"
+           else
+             col sepStar c.Parameters (fun (p:CodeParameterDeclarationExpression) ->
+               id +> generateTypeRef p.Type )
+        -- " -> "
+        +> match c.ReturnType with 
+             | null -> id -- "unit"
+             | rt -> generateTypeRef rt)
+      
+    let generateEnumField (index:int) (c:CodeMemberField) =    
+      id 
+      ++ "| " -- c.Name -- " = " 
+      +> match c.InitExpression with
+           | null -> str index
+           | :? CodePrimitiveExpression as p -> generatePrimitiveExpr None p
+           | _ -> failwith "Invalid enum !";
+                     
+    let generateEnum (scope:string list) (c:CodeTypeDeclaration) =
+      let counter = createCounter()
+      id     
+      ++ "" 
+      +> col sepNone scope (fun s -> id -- s -- "_") -- c.Name 
+      -- " =" 
+      +> incIndent
+      +> col sepNone c.Members (fun c -> generateEnumField (counter()) c)
+      +> decIndent
+    
+    let generateTypeDecl index (scope:string list, c:CodeTypeDeclaration) =      
+      id
+      ++ if (index = 0) then "type" else "and"
+      +> incIndent
+      +> col sepNone c.Comments generateStatement 
+      +> generateCustomAttrDeclsForType (c.CustomAttributes |> Seq.cast |> Seq.toList) c.TypeAttributes
+      +> (fun ctx -> { ctx with CurrentType = c })
+      +> match c with 
+           | :? CodeTypeDelegate as cd -> generateDelegate scope cd
+           | c when c.IsClass -> generateClassOrStruct "class" scope c
+           | c when c.IsInterface -> generateInterface scope c
+           | c when c.IsEnum -> generateEnum scope c
+           | c when c.IsStruct -> generateClassOrStruct "struct" scope c
+           | _ -> 
+            // NOTE: I believe this is full match..
+            id ++ "(* Type '" -- (c.Name) --  "' is not supported by the CodeDOM provider and was omitted. *)"
+      +> decIndent
+      +> (fun ctx -> { ctx with DeclaredEvents = []; CurrentType = null; BaseTypes = (None, []); FieldTypes = Map.empty; PropertyTypes = Map.empty; })
+      
+    /// Generates a main method.
+    let generateMainMethod (c:CodeEntryPointMethod, t:CodeTypeDeclaration) (ns:CodeNamespace) =
+      let retType = getTypeRefSimple c.ReturnType 
+      let custAttrs = 
+        CodeAttributeDeclaration("EntryPoint", [||]) :: (c.CustomAttributes |> Seq.cast |> Seq.toList)
+      
+      if ((c.Parameters.Count = 0) || (c.Parameters.Count = 1 && (getTypeRefSimple c.Parameters.[0].Type) = "string[]" ))
+         && (retType = "int" || retType = "unit")
+      then
+        id
+        ++ "[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]"
+        ++ "module __EntryPoint ="
+        +> incIndent
+        +>   (generateCustomAttrDeclsList custAttrs)  
+        ++   "let Main (args:string[]) ="
+        +> incIndent
+        // REVIEW: Do we need to pass this through the "rename" table?  Could use '(generateTypeRef t)', but we don't have a CodeTypeReference
+        ++ t.Name -- "." -- (c.Name) 
+        +> if c.Parameters.Count = 1 
+           then id -- "(args)"
+           else id -- "()"
+        // F# only supports main methods returning int.  If we're asked to emit one that returns unit, just return 1.
+        +> if retType = "unit" then id ++ "0" else id
+        +> decIndent 
+        +> decIndent
+      else
+        id ++ "(* Could not generate entry point for method '" -- (c.Name) -- "'. *)"
+      
+    //---------------------------------------------------------------------------------------------
+    // Namespaces and compilation units
+    
+    /// Returns CodeNamespace, list of classes with scope (which includes class names 
+    /// of containing classes and sequence of class renames)
+    let preprocessNamespace (c:CodeNamespace) =
+        
+        // Extract flat class structure
+        let flatClasses = 
+            c 
+            |> codeDomCallbackWithScope (fun rcall scope acc o -> 
+                  match o with 
+                    | :? CodeTypeDeclaration as dc -> 
+                        //sprintf "preprocessNamespace: rcall for type c.Name = %s\n" dc.Name |> System.Windows.Forms.MessageBox.Show |> ignore
+                        rcall (dc.Name::scope) ((scope, dc)::acc) (box dc.Members)
+                    | _ -> rcall scope acc o) [] [];
+        let flatClasses = flatClasses |> List.rev
+        
+        // Get all renamed classes - this changes file structure, but at least it works
+        let addNameWithScope n (scope:string list) acc = 
+            let scn = String.Join("_",Array.ofList scope) + "_" + n
+            let (_, res) = 
+                scope |> List.fold ( fun (prefix,st) e ->
+                  let npref = e + prefix
+                  let nmap = Map.add (npref + n) scn st 
+                  ("." + npref, nmap) ) (".", Map.add n scn acc)
+            res                
+
+        //sprintf "c.Name = %s, #flatClasses = %d\n" c.Name flatClasses.Length |> System.Windows.Forms.MessageBox.Show |> ignore
+
+        let renames = 
+            flatClasses 
+            |> List.fold ( fun acc ((scope:string list), ty) ->
+                  if (scope.Length = 0) then acc 
+                  else addNameWithScope ty.Name scope acc ) Map.empty
+
+        //if (renames |> Seq.length) > 0 then
+        //    sprintf "#renames = %d\n" (renames |> Seq.length) |> System.Windows.Forms.MessageBox.Show |> ignore
+
+        (c, flatClasses, renames |> Map.toSeq);        
+        
+    let generateImport (c:CodeNamespaceImport) = 
+      id  ++ "open " -- c.Namespace
+      
+    /// Generates namespace code - takes output from 'preprocessNamespace'
+    let generateNamespaceInternal ((c:CodeNamespace, flatClasses, _), containing) =
+      let counter = createCounter()
+      let ifcSet = 
+        flatClasses 
+          |> List.fold (fun st (scope, (c:CodeTypeDeclaration)) -> 
+                if (c.IsInterface) then 
+                  let st = Set.add c.Name st 
+                  Set.add (String.Join(".",Array.ofList(scope@[c.Name]))) st
+                else st) Set.empty
+      
+      id
+      +> ( fun ctx -> { ctx with CurrentNamespace = c.Name; DeclaredInterfaces = ifcSet } )
+      +> col sepNone c.Comments generateStatement
+      +> ((if String.IsNullOrEmpty c.Name then id ++ "namespace global" else id ++ "namespace " -! c.Name) +> incIndent) 
+      ++ "// Generated by F# CodeDom"
+      ++ "#nowarn \"49\" // uppercase argument names"
+      ++ "#nowarn \"67\" // this type test or downcast will always hold"
+      ++ "#nowarn \"66\" // this upcast is unnecessary - the types are identical"
+      ++ "#nowarn \"58\" // possible incorrect indentation.." // (when using CodeSnippets ie. in ASP.NET)
+      ++ "#nowarn \"57\" // do not use create_DelegateEvent"
+      ++ "#nowarn \"51\" // address-of operator can occur in the code"
+      ++ "#nowarn \"1183\" // unused 'this' reference"
+      +> colT sepNone containing (fun s -> id ++ "open " -- s)
+      +> col sepNone c.Imports generateImport
+      ++ ""              
+      ++ "exception ReturnException" +> uniqid -- " of obj"
+      ++ "exception ReturnNoneException" +> uniqid 
+
+      ++ "[<AutoOpen>]"
+      ++ "module FuncConvertFinalOverload" +> uniqid -- " ="
+      ++ "  // This extension member adds to the FuncConvert type and is the last resort member in the method overloading rules. "
+      ++ "  type global.Microsoft.FSharp.Core.FuncConvert with"
+      ++ "      /// A utility function to convert function values from tupled to curried form"
+      ++ "      static member FuncFromTupled (f:'T -> 'Res) = f"
+      ++ ""
+      +> colT sepNln flatClasses (fun c -> generateTypeDecl (counter()) c)
+      +> withCtxt (fun ctx -> match ctx.MainMethodForCurrentNamespace with None -> id | Some mainMethod -> (generateMainMethod mainMethod c))
+      +> if (c.Name<>null && c.Name.Length>0) then decIndent else id
+      +> ( fun ctx -> { ctx with CurrentNamespace = ""; MainMethodForCurrentNamespace = None } )
+    
+    
+    /// Generate code for namespace without compilation unit  
+    let generateNamespace (c:CodeNamespace) = 
+        generateNamespaceInternal ((preprocessNamespace c), [])
+        
+    /// Generate code for type declaration (not included in namespace)                 
+    let generateTypeDeclOnly (c:CodeTypeDeclaration) =
+        let ns = new CodeNamespace()
+        ns.Types.Add(c) |> ignore
+        let ((_, flatClasses, _), containing) = (preprocessNamespace ns, [])
+        let counter = createCounter()
+        id
+        ++ ""              
+        ++ "exception ReturnException" +> uniqid -- " of obj"
+        ++ "exception ReturnNoneException" +> uniqid 
+        ++ ""
+        +> colT sepNln flatClasses (fun c -> generateTypeDecl (counter()) c)
+
+    /// Generate code for compile unit (file)                
+    let generateCompileUnit (c:CodeCompileUnit) (preprocHacks:CodeCompileUnit -> unit) =
+      
+      // Generate code for the compilation unit
+      preprocHacks c;
+      match c with 
+        | :? CodeSnippetCompileUnit as cs -> 
+          id +> generateLinePragma cs.LinePragma ++ cs.Value
+        | _ -> 
+          let preprocNs = c.Namespaces |> Seq.cast |> Seq.map preprocessNamespace
+          let renames = preprocNs |> Seq.collect (fun (_, _, renames) -> renames) 
+          let getContainingNamespaces (c:CodeNamespace) nslist =
+            nslist |> List.filter ( fun (n:string) -> c.Name.StartsWith(n) )
+          let (namespacesWithPrev, _) = 
+            preprocNs |> Seq.fold (fun (res, tmpNames) (c, cls, renames) ->
+              (((c, cls, renames), getContainingNamespaces c tmpNames)::res, c.Name::tmpNames) ) ([], [])
+          let namespacesWithPrev = namespacesWithPrev |> Seq.toList |> List.rev
+
+          // renames |> Seq.map (fun (s, t) -> sprintf "%s --> %s\n" s t) |> Seq.toList |> String.concat "\n" |> System.Windows.Forms.MessageBox.Show |> ignore
+          
+          (fun ctx -> { ctx with TypeRenames = Map.ofSeq renames; } )        
+          ++ "//------------------------------------------------------------------------------"
+          ++ "// <autogenerated>"
+          ++ "//     This code was generated by a tool."
+          ++ "//     Runtime Version: " +> (str System.Environment.Version)
+          ++ "//"
+          ++ "//     Changes to this file may cause incorrect behavior and will be lost if "
+          ++ "//     the code is regenerated."
+          ++ "// </autogenerated>"
+          ++ "//------------------------------------------------------------------------------"
+          ++ ""
+          +> colT sepNln namespacesWithPrev generateNamespaceInternal;
+
+    //---------------------------------------------------------------------------------------------
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Assembly.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Assembly.fs
new file mode 100644
index 0000000..fb5d3a2
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Assembly.fs
@@ -0,0 +1,8 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp
+
+//[<assembly: System.Security.SecurityTransparent>]
+[<assembly: AutoOpen("Microsoft.FSharp")>]
+[<assembly: AutoOpen("Microsoft.FSharp")>]
+do()
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fs
new file mode 100644
index 0000000..b8458fd
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fs
@@ -0,0 +1,28 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Core
+    open System
+    open System.Linq
+
+    [<Sealed; AbstractClass>]
+    type FuncConvertExtensions = 
+
+        static member  ToFSharpFunc( f : Action<_,_>) = (fun a1 a2 -> f.Invoke(a1,a2))
+        static member  ToFSharpFunc( f : Func<_>) = (fun () -> f.Invoke())
+        static member  ToFSharpFunc( f : Func<_,_>) = (fun a1 -> f.Invoke(a1))
+        static member  ToFSharpFunc( f : Func<_,_,_>) = (fun a1 a2 -> f.Invoke(a1,a2))
+        static member  ToFSharpFunc( f : Action<_,_,_>) = (fun a1 a2 a3 -> f.Invoke(a1,a2,a3))
+        static member  ToFSharpFunc( f : Func<_,_,_,_>) = (fun a1 a2 a3 -> f.Invoke(a1,a2,a3))
+        static member  ToFSharpFunc( f : Action<_,_,_,_>) = (fun a1 a2 a3 a4 -> f.Invoke(a1,a2,a3,a4))
+        static member  ToFSharpFunc( f : Func<_,_,_,_,_>) = (fun a1 a2 a3 a4 -> f.Invoke(a1,a2,a3,a4))
+        static member  ToTupledFSharpFunc( f : Func<_>) = (fun () -> f.Invoke())
+        static member  ToTupledFSharpFunc( f : Func<_,_>) = (fun a1 -> f.Invoke(a1))
+        static member  ToTupledFSharpFunc( f : Action<_,_>) = (fun (a1,a2) -> f.Invoke(a1,a2))
+        static member  ToTupledFSharpFunc( f : Func<_,_,_>) = (fun (a1,a2) -> f.Invoke(a1,a2))
+        static member  ToTupledFSharpFunc( f : Action<_,_,_>) = (fun (a1,a2,a3) -> f.Invoke(a1,a2,a3))
+        static member  ToTupledFSharpFunc( f : Func<_,_,_,_>) = (fun (a1,a2,a3) -> f.Invoke(a1,a2,a3))
+        static member  ToTupledFSharpFunc( f : Action<_,_,_,_>) = (fun (a1,a2,a3,a4) -> f.Invoke(a1,a2,a3,a4))
+        static member  ToTupledFSharpFunc( f : Func<_,_,_,_,_>) = (fun (a1,a2,a3,a4) -> f.Invoke(a1,a2,a3,a4))
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fsi
new file mode 100644
index 0000000..6102c10
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/FuncConvertExtensions.fsi
@@ -0,0 +1,40 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Core
+    open System
+
+    [<Sealed; AbstractClass>]
+    type FuncConvertExtensions =
+
+        static member  ToFSharpFunc       : Func<'U>     -> (unit -> 'U)
+        
+        static member  ToFSharpFunc       : Func<'T1,'U>     -> ('T1 -> 'U)
+        
+        static member  ToFSharpFunc       : Action<'T1,'T2>           -> ('T1 -> 'T2 -> unit)
+        
+        static member  ToFSharpFunc       : Func<'T1,'T2,'U>     -> ('T1 -> 'T2 -> 'U)
+        
+        static member  ToFSharpFunc       : Action<'T1,'T2,'T3>       -> ('T1 -> 'T2 -> 'T3 -> unit)
+        
+        static member  ToFSharpFunc       : Func<'T1,'T2,'T3,'U> -> ('T1 -> 'T2 -> 'T3 -> 'U)
+
+        static member  ToFSharpFunc       : Action<'T1,'T2,'T3,'T4>       -> ('T1 -> 'T2 -> 'T3 -> 'T4 -> unit)
+        
+        static member  ToFSharpFunc       : Func<'T1,'T2,'T3,'T4,'U> -> ('T1 -> 'T2 -> 'T3 -> 'T4 -> 'U)
+
+        static member  ToTupledFSharpFunc : Func<'U>     -> (unit -> 'U)
+        
+        static member  ToTupledFSharpFunc : Func<'T1,'U>     -> ('T1 -> 'U)
+        
+        static member  ToTupledFSharpFunc : Action<'T1,'T2>           -> ('T1 * 'T2 -> unit)
+        
+        static member  ToTupledFSharpFunc : Func<'T1,'T2,'U>     -> ('T1 * 'T2 -> 'U)
+        
+        static member  ToTupledFSharpFunc : Action<'T1,'T2,'T3>       -> ('T1 * 'T2 * 'T3 -> unit)
+        
+        static member  ToTupledFSharpFunc : Func<'T1,'T2,'T3,'U> -> ('T1 * 'T2 * 'T3 -> 'U)
+
+        static member  ToTupledFSharpFunc : Action<'T1,'T2,'T3,'T4>       -> ('T1 * 'T2 * 'T3 * 'T4 -> unit)
+        
+        static member  ToTupledFSharpFunc : Func<'T1,'T2,'T3,'T4,'U> -> ('T1 * 'T2 * 'T3 * 'T4 -> 'U)
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fs
new file mode 100644
index 0000000..447ed4c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fs
@@ -0,0 +1,809 @@
+// Copyright (c) Microsoft Corporation 2005-2008.
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+//
+
+
+namespace Microsoft.FSharp.Linq
+
+open System
+open System.Linq
+open System.Collections.Generic
+open System.Linq.Expressions
+open System.Reflection
+open System.Reflection.Emit
+open Microsoft.FSharp
+open Microsoft.FSharp.Reflection
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+
+
+module QuotationEvaluation = 
+
+
+    let asExpr x = (x :> Expression)
+
+    let bindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic
+    let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly
+    let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+    let equivHeadTypes (ty1:Type) (ty2:Type) = 
+        isNamedType(ty1) &&
+        if ty1.IsGenericType then 
+          ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+        else 
+          ty1.Equals(ty2)
+
+    let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>)
+    let getFunctionType typ = 
+        if not (isFunctionType typ) then invalidArg "typ" "cannot convert recursion except for function types"
+        let tyargs = typ.GetGenericArguments()
+        tyargs.[0], tyargs.[1]
+    
+    let WhileHelper gd b : 'T = 
+        let rec loop () = if gd() then (b(); loop())
+        loop();
+        unbox (box ())
+
+    let ArrayAssignHelper (arr : 'T[]) (idx:int) (elem:'T) : 'unt = 
+        arr.[idx] <- elem;
+        unbox (box ())
+
+
+    let TryFinallyHelper e h = 
+        try e() 
+        finally h()
+
+    let TryWithHelper e filter handler = 
+        try e() 
+        with e when (filter e <> 0) -> handler e
+
+    let WhileMethod = match <@@ WhileHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let ArrayAssignMethod = match <@@ ArrayAssignHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let TryFinallyMethod = match <@@ TryFinallyHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let TryWithMethod = match <@@ TryWithHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+
+    module HelperTypes = 
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> unit
+
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> 'T6
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> 'T7 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> 'T8 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> 'T9 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> 'T10 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> 'T11 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> 'T12 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> 'T13 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> 'T14 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> 'T15 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> 'T16 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> 'T17 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> 'T18 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> 'T19 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> 'T20 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20, 'T21> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> 'T21 
+
+    open HelperTypes
+    
+    let GetActionType (args:Type[])  = 
+        if args.Length <= 4 then 
+            Expression.GetActionType args
+        else
+            match args.Length with 
+            | 5 -> typedefof<ActionHelper<_,_,_,_,_>>.MakeGenericType args
+            | 6 -> typedefof<ActionHelper<_,_,_,_,_,_>>.MakeGenericType args
+            | 7 -> typedefof<ActionHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+            | 8 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 9 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 10 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 11 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 12 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 13 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 14 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 15 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 16 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 17 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 18 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 19 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 20 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | _ -> raise <| new NotSupportedException("Quotation expressions with statements or closures containing more then 20 free variables may not be translated in this release of the F# PowerPack. This is due to limitations in the variable binding expression forms available in LINQ expression trees")
+
+    let GetFuncType (args:Type[])  = 
+        if args.Length <= 5 then 
+            Expression.GetFuncType args
+        else
+            match args.Length with 
+            | 6 -> typedefof<FuncHelper<_,_,_,_,_,_>>.MakeGenericType args
+            | 7 -> typedefof<FuncHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+            | 8 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 9 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 10 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 11 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 12 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 13 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 14 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 15 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 16 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 17 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 18 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 19 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 20 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 21 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | _ -> raise <| new NotSupportedException("Quotation expressions with statements or closures containing more then 20 free variables may not be translated in this release of the F# PowerPack. This is due to limitations in the variable binding expression forms available in LINQ expression trees")
+            
+
+    let LetRec1Helper (F1:System.Func<_,_,_>) (B:System.Func<_,_>) = 
+        let fhole = ref (Unchecked.defaultof<_>)
+        let f = new System.Func<_,_>(fun x -> F1.Invoke(fhole.Value,x))
+        fhole := f
+        B.Invoke f
+
+    let LetRec2Helper (F1:System.Func<_,_,_,_>) (F2:System.Func<_,_,_,_>) (B:System.Func<_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        B.Invoke(f1,f2)
+
+    let LetRec3Helper (F1:System.Func<_,_,_,_,_>) (F2:System.Func<_,_,_,_,_>) (F3:System.Func<_,_,_,_,_>) (B:System.Func<_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        B.Invoke(f1,f2,f3)
+
+    let LetRec4Helper 
+           (F1:FuncHelper<_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_>) 
+           (B:System.Func<_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        B.Invoke(f1,f2,f3,f4)
+
+
+    let LetRec5Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        B.Invoke(f1,f2,f3,f4,f5)
+
+    let LetRec6Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        B.Invoke(f1,f2,f3,f4,f5,f6)
+
+
+    let LetRec7Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F7:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f7hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        f7hole := f7
+        B.Invoke(f1,f2,f3,f4,f5,f6,f7)
+
+
+    let LetRec8Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F7:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F8:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f7hole = ref (Unchecked.defaultof<_>)
+        let f8hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f8 = new System.Func<_,_>(fun x -> F8.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        f7hole := f7
+        f8hole := f8
+        B.Invoke(f1,f2,f3,f4,f5,f6,f7,f8)
+
+
+    let IsVoidType (ty:System.Type)  = (ty = typeof<System.Void>)
+
+    let SequentialHelper (x:'T) (y:'U) = y
+ 
+    let LinqExpressionHelper (x:'T) : Expression<'T> = failwith ""
+    
+    let MakeFakeExpression (x:Expr) = 
+        let minfo = match <@@ LinqExpressionHelper @@> with Lambda(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find method info"
+        Expr.Call(minfo.GetGenericMethodDefinition().MakeGenericMethod [| x.Type |], [ x ])
+
+    let showAll = BindingFlags.Public ||| BindingFlags.NonPublic 
+
+    let WrapVoid b objOpt args (env: Map<Var,Expression>) (e:Expression) = 
+        if b then 
+            let frees (e:Expr) = e.GetFreeVars()
+            let addFrees e acc = List.foldBack Set.add (frees e |> Seq.toList) acc
+            let fvs = Option.foldBack addFrees objOpt (List.foldBack addFrees args Set.empty) |> Set.toArray
+            let fvsP = fvs |> Array.map (fun v -> (Map.find v env :?> ParameterExpression))
+            let fvtys = fvs |> Array.map (fun v -> v.Type) 
+
+            let dty = GetActionType fvtys 
+            let e = Expression.Lambda(dty,e,fvsP)
+            let d = e.Compile()
+
+            let argtys = Array.append fvtys [| dty |]
+            let delP = Expression.Parameter(dty, "del")
+
+            let m = new System.Reflection.Emit.DynamicMethod("wrapper",typeof<unit>,argtys)
+            let ilg = m.GetILGenerator()
+            
+            ilg.Emit(OpCodes.Ldarg ,fvs.Length)
+            fvs |> Array.iteri (fun i _ -> ilg.Emit(OpCodes.Ldarg ,int16 i))
+            ilg.EmitCall(OpCodes.Callvirt,dty.GetMethod("Invoke",instanceBindingFlags),null)
+            ilg.Emit(OpCodes.Ldnull)
+            ilg.Emit(OpCodes.Ret)
+            let args = Array.append (fvsP |> Array.map asExpr) [| (Expression.Constant(d) |> asExpr) |]
+            Expression.Call((null:Expression),(m:>MethodInfo),args) |> asExpr
+        else
+            e
+
+    let (|GenericEqualityQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.GenericEquality @>
+    let (|EqualsQ|_|)    = (|SpecificCall|_|) <@ ( = ) @>
+    let (|GreaterQ|_|)   = (|SpecificCall|_|) <@ ( > ) @>
+    let (|GreaterEqQ|_|) = (|SpecificCall|_|) <@ ( >=) @>
+    let (|LessQ|_|)      = (|SpecificCall|_|) <@ ( <)  @>
+    let (|LessEqQ|_|) = (|SpecificCall|_|) <@ ( <=) @>
+    let (|NotEqQ|_|) = (|SpecificCall|_|) <@ ( <>) @>
+    let (|NotQ|_|) =  (|SpecificCall|_|) <@ not   @>
+    let (|NegQ|_|) = (|SpecificCall|_|) <@ ( ~-) : int -> int @>
+    let (|PlusQ|_|)      = (|SpecificCall|_|) <@ ( + ) @>
+    let (|DivideQ|_|) = (|SpecificCall|_|) <@ ( / ) @> 
+    let (|MinusQ|_|) = (|SpecificCall|_|) <@ ( - ) @>
+    let (|MultiplyQ|_|) = (|SpecificCall|_|) <@ ( * ) @>
+    let (|ModuloQ|_|) = (|SpecificCall|_|) <@ ( % ) @>
+    let (|ShiftLeftQ|_|) = (|SpecificCall|_|) <@ ( <<< ) @>
+    let (|ShiftRightQ|_|) = (|SpecificCall|_|) <@ ( >>> ) @>
+    let (|BitwiseAndQ|_|) = (|SpecificCall|_|) <@ ( &&& ) @>
+    let (|BitwiseOrQ|_|) = (|SpecificCall|_|) <@ ( ||| ) @>
+    let (|BitwiseXorQ|_|) = (|SpecificCall|_|) <@ ( ^^^ ) @>
+    let (|BitwiseNotQ|_|) = (|SpecificCall|_|) <@ ( ~~~ ) @>
+    let (|CheckedNeg|_|) = (|SpecificCall|_|) <@ Checked.( ~-) : int -> int @>
+    let (|CheckedPlusQ|_|)      = (|SpecificCall|_|) <@ Checked.( + ) @>
+    let (|CheckedMinusQ|_|) = (|SpecificCall|_|) <@ Checked.( - ) @>
+    let (|CheckedMultiplyQ|_|) = (|SpecificCall|_|) <@ Checked.( * ) @>
+    let (|ConvCharQ|_|) = (|SpecificCall|_|) <@ char @>
+    let (|ConvDecimalQ|_|) = (|SpecificCall|_|) <@ decimal @>
+    let (|ConvFloatQ|_|) = (|SpecificCall|_|) <@ float @>
+    let (|ConvFloat32Q|_|) = (|SpecificCall|_|) <@ float32 @>
+    let (|ConvSByteQ|_|) = (|SpecificCall|_|) <@ sbyte @>
+    let (|ConvInt16Q|_|) = (|SpecificCall|_|) <@ int16 @>
+    let (|ConvInt32Q|_|) = (|SpecificCall|_|) <@ int32 @>
+    let (|ConvIntQ|_|) = (|SpecificCall|_|) <@ int @>
+    let (|ConvInt64Q|_|) = (|SpecificCall|_|) <@ int64 @>
+    let (|ConvByteQ|_|) = (|SpecificCall|_|) <@ byte @>
+    let (|ConvUInt16Q|_|) = (|SpecificCall|_|) <@ uint16 @>
+    let (|ConvUInt32Q|_|) = (|SpecificCall|_|) <@ uint32 @>
+    let (|ConvUInt64Q|_|) = (|SpecificCall|_|) <@ uint64 @>
+
+    let (|CheckedConvCharQ|_|) = (|SpecificCall|_|) <@ Checked.char @>
+    let (|CheckedConvSByteQ|_|) = (|SpecificCall|_|) <@ Checked.sbyte @>
+    let (|CheckedConvInt16Q|_|) = (|SpecificCall|_|) <@ Checked.int16 @>
+    let (|CheckedConvInt32Q|_|) = (|SpecificCall|_|) <@ Checked.int32 @>
+    let (|CheckedConvInt64Q|_|) = (|SpecificCall|_|) <@ Checked.int64 @>
+    let (|CheckedConvByteQ|_|) = (|SpecificCall|_|) <@ Checked.byte @>
+    let (|CheckedConvUInt16Q|_|) = (|SpecificCall|_|) <@ Checked.uint16 @>
+    let (|CheckedConvUInt32Q|_|) = (|SpecificCall|_|) <@ Checked.uint32 @>
+    let (|CheckedConvUInt64Q|_|) = (|SpecificCall|_|) <@ Checked.uint64 @>
+    let (|LinqExpressionHelperQ|_|) = (|SpecificCall|_|) <@ LinqExpressionHelper @>
+    let (|ArrayLookupQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray : int[] -> int -> int @>
+    let (|ArrayAssignQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.SetArray : int[] -> int -> int -> unit @>
+    let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some(ty.GetElementType()) else None
+    
+    /// Convert F# quotations to LINQ expression trees.
+    /// A more polished LINQ-Quotation translator will be published
+    /// concert with later versions of LINQ.
+    let rec ConvExpr env (inp:Expr) = 
+       //printf "ConvExpr : %A\n" e;
+        match inp with 
+
+        // Generic cases 
+        | Patterns.Var(v) -> Map.find v env
+        | DerivedPatterns.AndAlso(x1,x2)             -> Expression.AndAlso(ConvExpr env x1, ConvExpr env x2) |> asExpr
+        | DerivedPatterns.OrElse(x1,x2)              -> Expression.OrElse(ConvExpr env x1, ConvExpr env x2)  |> asExpr
+        | Patterns.Value(x,ty)                -> Expression.Constant(x,ty)              |> asExpr
+
+        // REVIEW: exact F# semantics for TypeAs and TypeIs
+        | Patterns.Coerce(x,toTy)             -> Expression.TypeAs(ConvExpr env x,toTy)     |> asExpr
+        | Patterns.TypeTest(x,toTy)           -> Expression.TypeIs(ConvExpr env x,toTy)     |> asExpr
+        
+        // Expr.*Get
+        | Patterns.FieldGet(objOpt,fieldInfo) -> 
+            Expression.Field(ConvObjArg env objOpt None, fieldInfo) |> asExpr
+
+        | Patterns.TupleGet(arg,n) -> 
+             let argP = ConvExpr env arg 
+             let rec build ty argP n = 
+                 match Reflection.FSharpValue.PreComputeTuplePropertyInfo(ty,n) with 
+                 | propInfo,None -> 
+                     Expression.Property(argP, propInfo)  |> asExpr
+                 | propInfo,Some(nestedTy,n2) -> 
+                     build nestedTy (Expression.Property(argP,propInfo) |> asExpr) n2
+             build arg.Type argP n
+              
+        | Patterns.PropertyGet(objOpt,propInfo,args) -> 
+            let coerceTo = 
+                if objOpt.IsSome && FSharpType.IsUnion propInfo.DeclaringType && FSharpType.IsUnion propInfo.DeclaringType.BaseType  then  
+                    Some propInfo.DeclaringType
+                else 
+                    None
+            match args with 
+            | [] -> 
+                Expression.Property(ConvObjArg env objOpt coerceTo, propInfo) |> asExpr
+            | _ -> 
+                let argsP = ConvExprs env args
+                Expression.Call(ConvObjArg env objOpt coerceTo, propInfo.GetGetMethod(true),argsP) |> asExpr
+
+        // Expr.*Set
+        | Patterns.PropertySet(objOpt,propInfo,args,v) -> 
+            let args = (args @ [v])
+            let argsP = ConvExprs env args 
+            let minfo = propInfo.GetSetMethod(true)
+            Expression.Call(ConvObjArg env objOpt None, minfo,argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env 
+
+        // Expr.(Call,Application)
+        | Patterns.Call(objOpt,minfo,args) -> 
+            match inp with 
+            // Special cases for this translation
+            |  PlusQ (_, [ty1;ty2;ty3],[x1;x2]) when (ty1 = typeof<string>) && (ty2 = typeof<string>) ->
+                 ConvExpr env (<@@  System.String.Concat( [| %%x1 ; %%x2 |] : string array ) @@>)
+
+            //| SpecificCall <@ LanguagePrimitives.GenericEquality @>([ty1],[x1;x2]) 
+            //| SpecificCall <@ ( = ) @>([ty1],[x1;x2]) when (ty1 = typeof<string>) ->
+            //     ConvExpr env (<@@  System.String.op_Equality(%%x1,%%x2) @@>)
+
+            | GenericEqualityQ (_, _,[x1;x2]) 
+            | EqualsQ (_, _,[x1;x2]) -> Expression.Equal(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+
+            | GreaterQ (_, _,[x1;x2]) -> Expression.GreaterThan(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | GreaterEqQ (_, _,[x1;x2]) -> Expression.GreaterThanOrEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | LessQ (_, _,[x1;x2]) -> Expression.LessThan(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | LessEqQ (_, _,[x1;x2]) -> Expression.LessThanOrEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | NotEqQ (_, _,[x1;x2]) -> Expression.NotEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | NotQ (_, _,[x1])    -> Expression.Not(ConvExpr env x1)                                   |> asExpr
+                 /// REVIEW: basic comparison with method witnesses
+
+            | NegQ (_, _,[x1])    -> Expression.Negate(ConvExpr env x1)                                |> asExpr
+            | PlusQ (_, _,[x1;x2]) -> Expression.Add(ConvExpr env x1, ConvExpr env x2)      |> asExpr
+            | DivideQ (_, _,[x1;x2]) -> Expression.Divide (ConvExpr env x1, ConvExpr env x2)  |> asExpr
+            | MinusQ (_, _,[x1;x2]) -> Expression.Subtract(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | MultiplyQ (_, _,[x1;x2]) -> Expression.Multiply(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | ModuloQ (_, _,[x1;x2]) -> Expression.Modulo (ConvExpr env x1, ConvExpr env x2) |> asExpr
+                 /// REVIEW: basic arithmetic with method witnesses
+                 /// REVIEW: negate,add, divide, multiply, subtract with method witness
+
+            | ShiftLeftQ (_, _,[x1;x2]) -> Expression.LeftShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | ShiftRightQ (_, _,[x1;x2]) -> Expression.RightShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseAndQ (_, _,[x1;x2]) -> Expression.And(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseOrQ (_, _,[x1;x2]) -> Expression.Or(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseXorQ (_, _,[x1;x2]) -> Expression.ExclusiveOr(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseNotQ (_, _,[x1]) -> Expression.Not(ConvExpr env x1) |> asExpr
+                 /// REVIEW: bitwise operations with method witnesses
+
+            | CheckedNeg (_, _,[x1]) -> Expression.NegateChecked(ConvExpr env x1)                                |> asExpr
+            | CheckedPlusQ (_, _,[x1;x2]) -> Expression.AddChecked(ConvExpr env x1, ConvExpr env x2)      |> asExpr
+            | CheckedMinusQ (_, _,[x1;x2]) -> Expression.SubtractChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | CheckedMultiplyQ (_, _,[x1;x2]) -> Expression.MultiplyChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+            | ConvCharQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<char>) |> asExpr
+            | ConvDecimalQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<decimal>) |> asExpr
+            | ConvFloatQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<float>) |> asExpr
+            | ConvFloat32Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<float32>) |> asExpr
+            | ConvSByteQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<sbyte>) |> asExpr
+            | ConvInt16Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int16>) |> asExpr
+            | ConvInt32Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+            | ConvIntQ (_, [ty],[x1])    -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+            | ConvInt64Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int64>) |> asExpr
+            | ConvByteQ (_, [ty],[x1])   -> Expression.Convert(ConvExpr env x1, typeof<byte>) |> asExpr
+            | ConvUInt16Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint16>) |> asExpr
+            | ConvUInt32Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint32>) |> asExpr
+            | ConvUInt64Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint64>) |> asExpr
+             /// REVIEW: convert with method witness
+
+            | CheckedConvCharQ (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<char>) |> asExpr
+            | CheckedConvSByteQ (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<sbyte>) |> asExpr
+            | CheckedConvInt16Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int16>) |> asExpr
+            | CheckedConvInt32Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int32>) |> asExpr
+            | CheckedConvInt64Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int64>) |> asExpr
+            | CheckedConvByteQ (_, [ty],[x1])   -> Expression.ConvertChecked(ConvExpr env x1, typeof<byte>) |> asExpr
+            | CheckedConvUInt16Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint16>) |> asExpr
+            | CheckedConvUInt32Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint32>) |> asExpr
+            | CheckedConvUInt64Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint64>) |> asExpr
+            | ArrayLookupQ (_, [ArrayTypeQ(elemTy);_;_],[x1;x2]) -> 
+                Expression.ArrayIndex(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+            | ArrayAssignQ (_, [ArrayTypeQ(elemTy);_;_],[arr;idx;elem]) -> 
+                let minfo = ArrayAssignMethod.GetGenericMethodDefinition().MakeGenericMethod [| elemTy;typeof<unit> |]
+                Expression.Call(minfo,[| ConvExpr env arr; ConvExpr env idx; ConvExpr env elem |]) |> asExpr
+            
+            // Throw away markers inserted to satisfy C#'s design where they pass an argument
+            // or type T to an argument expecting Expr<T>.
+            | LinqExpressionHelperQ (_, [_],[x1]) -> ConvExpr env x1
+             
+              /// ArrayLength
+              /// ListBind
+              /// ListInit
+              /// ElementInit
+            | _ -> 
+                let argsP = ConvExprs env args 
+                Expression.Call(ConvObjArg env objOpt None, minfo, argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env 
+
+        // f x1 x2 x3 x4 --> InvokeFast4
+        | Patterns.Application(Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3),arg4) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let domainTy3, rangeTy = getFunctionType rangeTy
+            let domainTy4, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 5)).MakeGenericMethod [| domainTy3; domainTy4; rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2;arg3; arg4]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 x2 x3 --> InvokeFast3
+        | Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let domainTy3, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 4)).MakeGenericMethod [| domainTy3; rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2;arg3]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 x2 --> InvokeFast2
+        | Patterns.Application(Patterns.Application(f,arg1),arg2) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 3)).MakeGenericMethod [| rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 --> Invoke
+        | Patterns.Application(f,arg) -> 
+            let fP = ConvExpr env f
+            let argP = ConvExpr env arg
+            let meth = f.Type.GetMethod("Invoke")
+            Expression.Call(fP, meth, [| argP |]) |> asExpr
+
+        // Expr.New*
+        | Patterns.NewRecord(recdTy,args) -> 
+            let ctorInfo = Reflection.FSharpValue.PreComputeRecordConstructorInfo(recdTy,showAll) 
+            Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+        | Patterns.NewArray(ty,args) -> 
+            Expression.NewArrayInit(ty,ConvExprs env args) |> asExpr
+
+        | Patterns.DefaultValue(ty) -> 
+            Expression.New(ty) |> asExpr
+
+        | Patterns.NewUnionCase(unionCaseInfo,args) -> 
+            let methInfo = Reflection.FSharpValue.PreComputeUnionConstructorInfo(unionCaseInfo,showAll)
+            let argsR = ConvExprs env args 
+            Expression.Call((null:Expression),methInfo,argsR) |> asExpr
+
+        | Patterns.UnionCaseTest(e,unionCaseInfo) -> 
+            let methInfo = Reflection.FSharpValue.PreComputeUnionTagMemberInfo(unionCaseInfo.DeclaringType,showAll)
+            let obj = ConvExpr env e 
+            let tagE = 
+                match methInfo with 
+                | :? PropertyInfo as p -> 
+                    Expression.Property(obj,p) |> asExpr
+                | :? MethodInfo as m -> 
+                    Expression.Call((null:Expression),m,[| obj |]) |> asExpr
+                | _ -> failwith "unreachable case"
+            Expression.Equal(tagE, Expression.Constant(unionCaseInfo.Tag)) |> asExpr
+
+        | Patterns.NewObject(ctorInfo,args) -> 
+            Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+        | Patterns.NewDelegate(dty,vs,b) -> 
+            let vsP = List.map ConvVar vs 
+            let env = List.foldBack2 (fun (v:Var) vP -> Map.add v (vP |> asExpr)) vs vsP env 
+            let bodyP = ConvExpr env b 
+            Expression.Lambda(dty, bodyP, vsP) |> asExpr 
+
+        | Patterns.NewTuple(args) -> 
+             let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType
+             let argsP = ConvExprs env args 
+             let rec build ty (argsP: Expression[]) = 
+                 match Reflection.FSharpValue.PreComputeTupleConstructorInfo(ty) with 
+                 | ctorInfo,None -> Expression.New(ctorInfo,argsP) |> asExpr 
+                 | ctorInfo,Some(nestedTy) -> 
+                     let n = ctorInfo.GetParameters().Length - 1
+                     Expression.New(ctorInfo, Array.append argsP.[0..n-1] [| build nestedTy argsP.[n..] |]) |> asExpr
+             build tupTy argsP
+
+        | Patterns.IfThenElse(g,t,e) -> 
+            Expression.Condition(ConvExpr env g, ConvExpr env t,ConvExpr env e) |> asExpr
+
+        | Patterns.Sequential (e1,e2) -> 
+            let e1P = ConvExpr env e1
+            let e2P = ConvExpr env e2
+            let minfo = match <@@ SequentialHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+            let minfo = minfo.GetGenericMethodDefinition().MakeGenericMethod [| e1.Type; e2.Type |]
+            Expression.Call(minfo,[| e1P; e2P |]) |> asExpr
+
+        | Patterns.Let (v,e,b) -> 
+            let vP = ConvVar v
+            let envinner = Map.add v (vP |> asExpr) env 
+            let bodyP = ConvExpr envinner b 
+            let eP = ConvExpr env e
+            let ty = GetFuncType [| v.Type; b.Type |] 
+            let lam = Expression.Lambda(ty,bodyP,[| vP |]) |> asExpr
+            Expression.Call(lam,ty.GetMethod("Invoke",instanceBindingFlags),[| eP |]) |> asExpr
+
+        | Patterns.Lambda(v,body) -> 
+            let vP = ConvVar v
+            let env = Map.add v (vP |> asExpr) env 
+            let tyargs = [| v.Type; body.Type |]
+            let bodyP = ConvExpr env body
+            let convType = typedefof<System.Converter<obj,obj>>.MakeGenericType tyargs
+            let convDelegate = Expression.Lambda(convType, bodyP, [| vP |]) |> asExpr
+            Expression.Call(typeof<FuncConvert>,"ToFSharpFunc",tyargs,[| convDelegate |]) |> asExpr
+    
+        | Patterns.WhileLoop(gd,b) -> 
+            let gdP = ConvExpr env <@@ (fun () -> (%%gd:bool)) @@>
+            let bP = ConvExpr env <@@ (fun () -> (%%b:unit)) @@>
+            let minfo = WhileMethod.GetGenericMethodDefinition().MakeGenericMethod [| typeof<unit> |]
+            Expression.Call(minfo,[| gdP; bP |]) |> asExpr
+        
+        | Patterns.TryFinally(e,h) -> 
+            let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+            let hP = ConvExpr env <@@ (fun () -> (%%h:unit)) @@>
+            let minfo = TryFinallyMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+            Expression.Call(minfo,[| eP; hP |]) |> asExpr
+        
+        | Patterns.TryWith(e,vf,filter,vh,handler) -> 
+            let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+            let filterP = ConvExpr env (Expr.Lambda(vf,filter))
+            let handlerP = ConvExpr env (Expr.Lambda(vh,handler))
+            let minfo = TryWithMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+            Expression.Call(minfo,[| eP; filterP; handlerP |]) |> asExpr
+
+        | Patterns.LetRecursive(binds,body) -> 
+
+            let vfs = List.map fst binds
+            
+            let pass1 = 
+                binds |> List.map (fun (vf,expr) -> 
+                    match expr with 
+                    | Lambda(vx,expr) -> 
+                        let domainTy,rangeTy = getFunctionType vf.Type
+                        let vfdTy = GetFuncType [| domainTy; rangeTy |]
+                        let vfd = new Var("d",vfdTy)
+                        (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd)
+                    | _ -> failwith "cannot convert recursive bindings that do not define functions")
+
+            let trans = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> (vf,vfd)) |> Map.ofList
+
+            // Rewrite uses of the recursively defined functions to be invocations of the delegates
+            // We do this because the delegate are allocated "once" and we can normally just invoke them efficiently
+            let rec rw t = 
+                match t with 
+                | Application(Var(vf),t) when trans.ContainsKey(vf) -> 
+                     let vfd = trans.[vf]
+                     Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[t])
+                | ExprShape.ShapeVar(vf) when trans.ContainsKey(vf)-> 
+                     let vfd = trans.[vf]
+                     let nv = new Var("nv",fst(getFunctionType vf.Type)) 
+                     Expr.Lambda(nv,Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[Expr.Var(nv)]))
+                | ExprShape.ShapeVar(_) -> t
+                | ExprShape.ShapeCombination(obj,args) -> ExprShape.RebuildShapeCombination(obj,List.map rw args)
+                | ExprShape.ShapeLambda(v,arg) -> Expr.Lambda(v,rw arg)
+
+            let vfdTys    = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfdTy) |> Array.ofList
+            let vfds      = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfd)
+
+            let FPs = 
+                [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+                      let expr = rw expr
+                      let tyF = GetFuncType (Array.append vfdTys [| vx.Type; expr.Type |])
+                      let F = Expr.NewDelegate(tyF,vfds@[vx],expr)
+                      let FP = ConvExpr env F
+                      yield FP |]
+
+            let body = rw body
+
+            let methTys   = 
+                [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+                      yield domainTy
+                      yield rangeTy
+                   yield body.Type |]
+
+            let B = Expr.NewDelegate(GetFuncType (Array.append vfdTys [| body.Type |]),vfds,body)
+            let BP = ConvExpr env B
+
+            let minfo = 
+                let q = 
+                    match vfds.Length with 
+                    | 1 -> <@@ LetRec1Helper @@>
+                    | 2 -> <@@ LetRec2Helper @@>
+                    | 3 -> <@@ LetRec3Helper @@>
+                    | 4 -> <@@ LetRec4Helper @@>
+                    | 5 -> <@@ LetRec5Helper @@>
+                    | 6 -> <@@ LetRec6Helper @@>
+                    | 7 -> <@@ LetRec7Helper @@>
+                    | 8 -> <@@ LetRec8Helper @@>
+                    | _ -> raise <| new NotSupportedException("In this release of the F# Power Pack, mutually recursive function groups involving 9 or more functions may not be converted to LINQ expressions")
+                match q with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+
+            let minfo = minfo.GetGenericMethodDefinition().MakeGenericMethod methTys
+            Expression.Call(minfo,Array.append FPs [| BP |]) |> asExpr
+
+        | Patterns.AddressOf _ -> raise <| new NotSupportedException("Address-of expressions may not be converted to LINQ expressions")
+        | Patterns.AddressSet _ -> raise <| new NotSupportedException("Address-set expressions may not be converted to LINQ expressions")
+        | Patterns.FieldSet _ -> raise <| new NotSupportedException("Field-set expressions may not be converted to LINQ expressions")
+
+        | _ -> 
+            raise <| new NotSupportedException(sprintf "Could not convert the following F# Quotation to a LINQ Expression Tree\n--------\n%A\n-------------\n" inp)
+
+    and ConvObjArg env objOpt coerceTo : Expression = 
+        match objOpt with
+        | Some(obj) -> 
+            let expr = ConvExpr env obj
+            match coerceTo with 
+            | None -> expr
+            | Some ty -> Expression.TypeAs(expr, ty) :> Expression
+        | None -> 
+            null
+
+    and ConvExprs env es : Expression[] = 
+        es |> List.map (ConvExpr env) |> Array.ofList 
+
+    and ConvVar (v: Var) = 
+        //printf "** Expression .Parameter(%a, %a)\n" output_any ty output_any nm;
+        Expression.Parameter(v.Type, v.Name)
+
+    let Conv (e: #Expr) = ConvExpr Map.empty (e :> Expr)
+
+    let Compile (e: #Expr) = 
+       let ty = e.Type
+       let e = Expr.NewDelegate(GetFuncType([|typeof<unit>; ty |]), [new Var("unit",typeof<unit>)],e)
+       let linqExpr = Conv e
+       let linqExpr = (linqExpr :?> LambdaExpression)
+       let d = linqExpr.Compile()
+       (fun () -> 
+           try 
+             d.DynamicInvoke [| box () |]
+           with :? System.Reflection.TargetInvocationException as exn -> 
+               raise exn.InnerException)
+
+    let Eval e = Compile e ()
+
+    type Microsoft.FSharp.Quotations.Expr with 
+        member x.ToLinqExpression() = Conv(x)
+        member x.CompileUntyped() = Compile(x)
+        member x.EvalUntyped() = Eval(x)
+
+    type Microsoft.FSharp.Quotations.Expr<'T> with 
+        member x.Compile() = 
+            let f = Compile(x)  
+            (fun () -> (f()) :?> 'T)
+        member x.Eval() = (Eval(x) :?> 'T)
+
+  
+    
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fsi
new file mode 100644
index 0000000..33f234a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Linq.fsi
@@ -0,0 +1,124 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Linq
+
+    open System
+    open System.Linq.Expressions
+
+    /// This module provides Compile and Eval extension members
+    /// for F# quotation values, implemented by translating to LINQ
+    /// expression trees and using the LINQ dynamic compiler.
+    module QuotationEvaluation =
+
+        
+        type Microsoft.FSharp.Quotations.Expr with 
+              /// Convert the quotation expression to LINQ expression trees
+              ///
+              /// This operation will only succeed for a subset of quotation expressions.
+              ///
+              /// Exceptions: InvalidArgumentException will be raised if the input expression is
+              /// not in the subset that can be converted to a LINQ expression tree
+              member ToLinqExpression : unit -> System.Linq.Expressions.Expression
+
+              /// Compile the quotation expression by first converting to LINQ expression trees
+              ///
+              /// Exceptions: InvalidArgumentException will be raised if the input expression is
+              /// not in the subset that can be converted to a LINQ expression tree
+              member CompileUntyped : unit -> (unit -> obj)
+
+              /// Compile the quotation expression by first converting to LINQ expression trees
+              ///
+              /// Exceptions: InvalidArgumentException will be raised if the input expression is
+              /// not in the subset that can be converted to a LINQ expression tree
+              member EvalUntyped : unit -> obj
+
+        type Microsoft.FSharp.Quotations.Expr<'T> with 
+              /// Compile the quotation expression by first converting to LINQ expression trees
+              ///
+              /// Exceptions: InvalidArgumentException will be raised if the input expression is
+              /// not in the subset that can be converted to a LINQ expression tree
+              member Compile : unit -> (unit -> 'T)
+
+              /// Evaluate the quotation expression by first converting to LINQ expression trees
+              ///
+              /// Exceptions: InvalidArgumentException will be raised if the input expression is
+              /// not in the subset that can be converted to a LINQ expression tree
+              member Eval : unit -> 'T
+
+        /// This function should not be called directly. 
+        //
+        // NOTE: when an F# expression tree is converted to a Linq expression tree using ToLinqExpression 
+        // the transformation of <c>LinqExpressionHelper(e)</c> is simple the same as the transformation of
+        // 'e'. This allows LinqExpressionHelper to be used as a marker to satisfy the C# design where 
+        // certain expression trees are constructed using methods with a signature that expects an
+        // expression tree of type <c>Expression<T></c> but are passed an expression tree of type T.
+        val LinqExpressionHelper : 'T -> Expression<'T>
+
+        /// A set of types used for implementing quotation conversions.
+        /// These are public only because targets of Linq Lambda expressions require them to be so
+        module HelperTypes = 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> unit
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> unit
+
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> 'T6
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> 'T7 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> 'T8 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> 'T9 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> 'T10 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> 'T11 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> 'T12 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> 'T13 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> 'T14 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> 'T15 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> 'T16 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> 'T17 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> 'T18 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> 'T19 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> 'T20 
+            [<System.Obsolete("This type is for use by the quotation to LINQ expression tree converter and is not for direct use from user code")>]
+            type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20, 'T21> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> 'T21 
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fs
new file mode 100644
index 0000000..4621543
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fs
@@ -0,0 +1,785 @@
+// Copyright (c) Microsoft Corporation 2005-2008.
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+//
+
+namespace Microsoft.FSharp.Linq
+
+open System
+open System.Linq
+open System.Collections.Generic
+open System.Linq.Expressions
+open System.Reflection
+open System.Reflection.Emit
+open Microsoft.FSharp
+open Microsoft.FSharp.Linq.QuotationEvaluation
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+
+#nowarn "57"
+#nowarn "44" //deprecation 
+  
+    
+module Query =
+
+    let debug = false
+        
+    let contains key source = 
+        System.Linq.Enumerable.Contains(source,key)
+
+    let minBy<'T1,'T2> keySelector source = 
+        System.Linq.Enumerable.Min(source,Func<'T1,'T2>(keySelector))
+
+    let maxBy<'T1,'T2> keySelector source = 
+        System.Linq.Enumerable.Max(source,Func<'T1,'T2>(keySelector))
+
+    let groupBy keySelector source = 
+        System.Linq.Enumerable.GroupBy(source,Func<_,_>(keySelector))
+
+    let join  outerSource innerSource outerKeySelector innerKeySelector resultSelector = 
+        System.Linq.Enumerable.Join(outerSource,innerSource,Func<_,_>(outerKeySelector),Func<_,_>(innerKeySelector),Func<_,_,_>(resultSelector))
+
+    let groupJoin  outerSource innerSource outerKeySelector innerKeySelector resultSelector = 
+        System.Linq.Enumerable.GroupJoin(outerSource,innerSource,Func<_,_>(outerKeySelector),Func<_,_>(innerKeySelector),Func<_,_,_>(resultSelector))
+
+    let ConvVar (v: Var) = 
+        Expression.Parameter(v.Type, v.Name)
+
+    let asExpr x = (x :> Expression)
+            
+    let (|Getter|_|) (prop: #PropertyInfo) =
+        match prop.GetGetMethod(true) with 
+        | null -> None
+        | v -> Some v
+
+    let (|CallPipe|_|) = (|SpecificCall|_|) <@ (|>) @>
+    // Match 'f x' or 'x |> f' or 'x |> (fun x -> f (x :> ty))'
+    let (|SpecificPipedCall0|_|) q = 
+       let (|CallQ|_|) = (|SpecificCall|_|) q
+       function
+       | CallPipe (None, [_;_],[arg1;Lambda(arg1v,CallQ (None, tyargs,[arg1E])) ]) -> 
+           let arg1 = arg1E.Substitute (Map.ofSeq [ (arg1v,arg1) ]).TryFind 
+           Some(tyargs,arg1)
+
+       | CallQ (None, tyargs,[arg1]) -> 
+           Some(tyargs,arg1)
+
+       | _ -> None           
+
+    // Match 
+    //     'f x y' or 
+    //     'y |> f x' or
+    //     'y |> (fun y -> f (x :> ty) (y :> ty))'
+    //     'y |> let x = e in (fun y -> f (x :> ty) (y :> ty))'
+    let (|SpecificPipedCall1|_|) q = 
+       let (|CallQ|_|) = (|SpecificCall|_|) q
+       function
+       // Encoded form of some uses of 'T1rg2 |> f arg1'
+       | CallPipe (None, [_;_],[arg2;Let(arg1v,arg1,Lambda(arg2v,CallQ (None, tyargs,[arg1E;arg2E]))) ]) -> 
+              let arg1 = arg1E.Substitute (Map.ofSeq [ (arg1v,arg1) ]).TryFind 
+              let arg2 = arg2E.Substitute (Map.ofSeq [ (arg2v,arg2) ]).TryFind 
+              Some(tyargs,arg1,arg2)
+
+       | CallPipe (None, [_;_],[arg2;Lambda(arg2v,CallQ (None, tyargs,[arg1;arg2E])) ]) -> 
+              let arg2 = arg2E.Substitute (Map.ofSeq [ (arg2v,arg2) ]).TryFind 
+              Some(tyargs,arg1,arg2)
+
+       | CallQ (None, tyargs,[arg1;arg2]) -> 
+              Some(tyargs,arg1,arg2)
+       | _ -> None           
+
+        
+    let GetGenericMethodDefinition (m:MethodInfo) = 
+        if m.IsGenericMethod then m.GetGenericMethodDefinition() else m
+
+    let FindGenericStaticMethodInfo mexpr =
+        match mexpr with 
+        | Lambdas(_,Call(None,methInfo,_)) -> GetGenericMethodDefinition methInfo
+        | _ -> failwithf "FindGenericStaticMethodInfo: %A is not a static method call lambda" mexpr
+
+    let CallGenericStaticMethod mexpr  =
+        let m = FindGenericStaticMethodInfo mexpr in
+        //printf "m = %A\n" m;
+        fun (tyargs,args) -> 
+            //printf "invoking %A\n" m;
+            
+            let m = 
+                if m.IsGenericMethod then 
+                    m.MakeGenericMethod(Array.ofList tyargs) 
+                else
+                    m
+            m.Invoke(null,Array.ofList args)
+
+    let FT1 = typedefof<System.Func<_,_>>
+    let FT2 = typedefof<System.Func<_,_,_>>
+    let boolTy = typeof<bool>
+    let MakeQueryFuncTy (dty,rty) = FT1.MakeGenericType([| dty; rty |])
+    let MakeQueryFunc2Ty (dty1,dty2,rty) = FT2.MakeGenericType([| dty1; dty2; rty |])
+
+    let IEnumerableTypeDef = typedefof<IEnumerable<_>>
+    let IQueryableTypeDef = typedefof<IQueryable<_>>
+    let MakeIEnumerableTy dty= IEnumerableTypeDef.MakeGenericType([| dty|])
+    let MakeIQueryableTy dty= IQueryableTypeDef.MakeGenericType([| dty|])
+
+    let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+    let equivHeadTypes (ty1:Type) (ty2:Type) = 
+        isNamedType(ty1) &&
+        if ty1.IsGenericType then 
+          ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+        else 
+          ty1.Equals(ty2)
+
+    let IsIQueryableTy ty = equivHeadTypes IQueryableTypeDef ty
+   
+
+    let CallSeqToList = 
+        let F = CallGenericStaticMethod <@ Seq.toList @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallSeqToArray = 
+        let F = CallGenericStaticMethod <@ Seq.toArray @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableContains = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Contains : _ * _ -> _ @> 
+        fun (srcTy,src,key:Expression) -> 
+            F ([srcTy],[src;box key])
+
+    let CallQueryableMinBy = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Min : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            F ([srcTy;destTy],[src;box predicate])
+
+    let CallQueryableMin = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Min : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableMaxBy = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Max : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            F ([srcTy;destTy],[src;box predicate])
+
+    let CallQueryableMax = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Max : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableAverageBy = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,float>> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,float32>> -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,decimal>> -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,int32>> -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,int64>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([destTy],[src;box predicate])
+            | ty when ty = typeof<float32> -> F_float32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<decimal> -> F_decimal ([destTy],[src;box predicate])
+            | ty when ty = typeof<int32> -> F_int32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<int64> -> F_int64 ([destTy],[src;box predicate])
+            | _ -> failwith "unrecognized use of 'Seq.averageBy'"
+
+
+    let CallQueryableAverage = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<float> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<float32>  -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<decimal>  -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<int32>  -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<int64>  -> _ @> 
+        fun (srcTy,src) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([],[src])
+            | ty when ty = typeof<float32> -> F_float32 ([],[src])
+            | ty when ty = typeof<decimal> -> F_decimal ([],[src])
+            | ty when ty = typeof<int32> -> F_int32 ([],[src])
+            | ty when ty = typeof<int64> -> F_int64 ([],[src])
+            | _ -> failwith "unrecognized use of 'Seq.average'"
+
+    let CallQueryableSumBy = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,float>> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,float32>> -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,decimal>> -> _ @> 
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,int32>> -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,int64>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([destTy],[src;box predicate])
+            | ty when ty = typeof<float32> -> F_float32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<decimal> -> F_decimal ([destTy],[src;box predicate])
+            | ty when ty = typeof<int32> -> F_int32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<int64> -> F_int64 ([destTy],[src;box predicate])
+            | _ -> failwith "unrecognized use of 'Seq.sumBy'"
+
+    let CallQueryableSum = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<float> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<float32>  -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<decimal>  -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<int32>  -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<int64>  -> _ @> 
+        fun (srcTy,src) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([],[src])
+            | ty when ty = typeof<float32> -> F_float32 ([],[src])
+            | ty when ty = typeof<decimal> -> F_decimal ([],[src])
+            | ty when ty = typeof<int32> -> F_int32 ([],[src])
+            | ty when ty = typeof<int64> -> F_int64 ([],[src])
+            | _ -> failwith "unrecognized use of 'Seq.sum"
+
+    let CallQueryableFirst = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.First : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableFirstFind = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.First : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,predicate:Expression) -> 
+            F ([srcTy],[src;box predicate])
+
+    let CallQueryableCount = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Count : _ -> _ @> 
+        fun (srcTy:Type,src:obj) -> 
+            F ([srcTy],[src])
+
+    let BindGenericMethod (methInfo:MethodInfo) tyargs = 
+        if methInfo.IsGenericMethod then 
+            methInfo.GetGenericMethodDefinition().MakeGenericMethod(Array.ofList tyargs)
+        else
+            methInfo
+
+    let minfo = match <@@ LinqExpressionHelper @@> with Lambda(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find method info"
+    let MakeFakeExpression (x:Expr) = 
+        Expr.Call(minfo.GetGenericMethodDefinition().MakeGenericMethod [| x.Type |], [ x ])
+
+            
+    let MakeGenericStaticMethod lam  =
+        // Nb. the SelectMany/Where/Select methods theoretically expects an expression, but the
+        // LINQ team decided to only pass it a delegate construction. The coercion from
+        // the delegate construction to the expression is effectively implicit in LINQ, but
+        // not in F# quotations, so we have to use 'Unchecked' version (see also FSBUGS #970)
+        let methInfo = FindGenericStaticMethodInfo lam 
+        (fun (tyargs,args) -> Expr.Call(BindGenericMethod methInfo tyargs,args))
+           
+
+    let MakeQueryableSelect = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Select : _ * Expression<Func<_,_>> -> _) @>
+        fun (srcTy,targetTy,src,v,f)  -> 
+            
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,targetTy), v,f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;targetTy],[src;selector])
+
+    let MakeQueryableAppend = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Concat ) @>
+        fun (srcTy,src1,src2)  -> 
+            F ([srcTy],[src1;src2])
+
+    let MakeQueryableContains = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Contains : _ * _ -> _ ) @>
+        fun (srcTy,src1,src2)  -> 
+            F ([srcTy],[src1;src2])
+
+    let MakeQueryableAsQueryable = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.AsQueryable : seq<_>  -> IQueryable<_>) @>
+        fun (ty,src)  -> 
+            F ([ty],[src])
+
+    let MakeEnumerableEmpty = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Enumerable.Empty : unit -> seq<_>) @>
+        fun (ty)  -> 
+            F ([ty],[])
+
+    let MakeQueryableEmpty = 
+        fun (ty)  -> 
+            MakeQueryableAsQueryable (ty,MakeEnumerableEmpty ty)
+
+    let MakeQueryableSelectMany = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.SelectMany : IQueryable<_> * Expression<Func<_,_>> -> IQueryable<_>) @>
+        fun (srcTy,targetTy,src,v,f)  -> 
+            // REVIEW: Previous notes in this file said that LINQ likes to see a coercion to an interface type
+            // at this point. 
+            //let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,MakeIEnumerableTy targetTy), [v],f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;targetTy],[src;selector])
+
+    let MakeQueryableWhere = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Where : _ * Expression<Func<_,_>> -> _) @>
+        fun (srcTy,src,v,f)  -> 
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,typeof<bool>), [v],f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy],[src;selector])
+
+
+
+    let MakeQueryableOrderBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.OrderBy : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;keyTy],[src;selector])
+
+    let MakeQueryableDistinct = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Distinct : _ -> _ @> 
+        fun (srcTy,src)  -> 
+            let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            F ([srcTy],[src])
+
+    let MakeQueryableTake = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Take @> 
+        fun (srcTy,src,count)  -> 
+            let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            F ([srcTy],[src;count])
+
+    let MakeQueryableGroupBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.GroupBy : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableMinBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Min : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableMaxBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Max : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableAny = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Any : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,boolTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy],[src;keySelector])
+
+    let MakeQueryableAll = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.All : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,boolTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy],[src;keySelector])
+
+    let MakeQueryableJoin = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Join : _ * _ * Expression<Func<_,_>> * Expression<Func<_,_>> * Expression<Func<_,_,_>> -> _ @> 
+        fun (outerSourceTy,innerSourceTy,keyTy,resultTy,outerSource,innerSource,outerKeyVar,outerKeySelector,innerKeyVar,innerKeySelector,outerResultKeyVar,innerResultKeyVar,resultSelector)  -> 
+            let outerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(outerSourceTy,keyTy), [outerKeyVar],outerKeySelector) |> MakeFakeExpression 
+            let innerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(innerSourceTy,keyTy), [innerKeyVar],innerKeySelector) |> MakeFakeExpression 
+            let resultSelector = Expr.NewDelegate(MakeQueryFunc2Ty(outerSourceTy,innerSourceTy,resultTy), [outerResultKeyVar;innerResultKeyVar],resultSelector) |> MakeFakeExpression 
+            F ([outerSourceTy;innerSourceTy;keyTy;resultTy],[outerSource;innerSource;outerKeySelector;innerKeySelector;resultSelector])
+
+
+    let MakeQueryableGroupJoin = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.GroupJoin : _ * _ * Expression<Func<_,_>> * Expression<Func<_,_>> * Expression<Func<_,_,_>> -> _ @> 
+        fun (outerSourceTy,innerSourceTy,keyTy,resultTy,outerSource,innerSource,outerKeyVar,outerKeySelector,innerKeyVar,innerKeySelector,outerResultKeyVar,innerResultKeyVar,resultSelector)  -> 
+            let outerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(outerSourceTy,keyTy), [outerKeyVar],outerKeySelector) |> MakeFakeExpression 
+            let innerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(innerSourceTy,keyTy), [innerKeyVar],innerKeySelector) |> MakeFakeExpression 
+            let resultSelector = Expr.NewDelegate(MakeQueryFunc2Ty(outerSourceTy,MakeIEnumerableTy(innerSourceTy),resultTy), [outerResultKeyVar;innerResultKeyVar],resultSelector) |> MakeFakeExpression 
+            F ([outerSourceTy;innerSourceTy;keyTy;resultTy],[outerSource;innerSource;outerKeySelector;innerKeySelector;resultSelector])
+
+
+
+    let MakeLambda = 
+        let F = CallGenericStaticMethod <@ (fun (a:Expression,b:ParameterExpression[]) -> System.Linq.Expressions.Expression.Lambda<_>(a,b)) @> 
+        fun (srcTy,targetTy,arg:Expression,p:ParameterExpression) -> 
+            (F ([MakeQueryFuncTy(srcTy,targetTy)],[box arg;box [| p |] ]) :?> Expression)
+
+    /// Project F# function expressions to Linq LambdaExpression nodes
+    let FuncExprToLinqFunc2Expression (srcTy,targetTy,v,body) = 
+        Expr.NewDelegate(Linq.Expressions.Expression.GetFuncType [| srcTy; targetTy |], [v],body).ToLinqExpression()
+
+
+    let MakeMapConcat = 
+        let F = MakeGenericStaticMethod <@ Seq.collect @>
+        fun (srcTy,targetTy,f,src)  -> 
+            F ([srcTy;MakeIEnumerableTy targetTy;targetTy],[f;src])
+
+    let MakeFilter = 
+        let F = MakeGenericStaticMethod <@ Seq.filter @>
+        fun (srcTy,f,src)  -> 
+            F ([srcTy],[f;src])
+
+    let (|MacroReduction|_|) (p : Expr) = 
+        match p with 
+        | Applications(Lambdas(vs,body),args) when vs.Length = args.Length && List.forall2 (fun vs arg -> List.length vs = List.length args) vs args -> 
+            let tab = Map.ofSeq (List.concat (List.map2 List.zip vs args))
+            let body = body.Substitute tab.TryFind 
+            Some body
+
+        // Macro
+        | PropertyGet(None,Getter(MethodWithReflectedDefinition(body)),[]) -> 
+            Some body
+
+        // Macro
+        | Call(None,MethodWithReflectedDefinition(Lambdas(vs,body)),args) -> 
+            let tab = Map.ofSeq (List.concat (List.map2 (fun (vs:Var list) arg -> match vs,arg with [v],arg -> [(v,arg)] | vs,NewTuple(args) -> List.zip vs args | _ -> List.zip vs [arg]) vs args))
+            let body = body.Substitute tab.TryFind 
+            Some body
+
+        // Macro
+        | Let(v,e,body) ->
+            let tab = Map.ofSeq [ (v,e) ]
+            let body = body.Substitute tab.TryFind 
+            Some body
+        | _ -> None
+
+    let rec MacroExpand (p : Expr) = 
+        match p with 
+        // Macro reduction
+        | MacroReduction(reduced) -> 
+            MacroExpand reduced
+        | ExprShape.ShapeCombination(comb,args) ->
+            ExprShape.RebuildShapeCombination(comb, List.map MacroExpand args)
+        | ExprShape.ShapeLambda(v,body) ->
+            Expr.Lambda(v, MacroExpand body)
+        | ExprShape.ShapeVar _ -> p
+
+    let (|PipedCallMapConcat|_|) = (|SpecificPipedCall1|_|) <@ Seq.collect @>
+    let (|CallSingleton|_|) = (|SpecificCall|_|) <@ Seq.singleton @>
+    let (|CallEmpty|_|) = (|SpecificCall|_|) <@ Seq.empty @>
+    let (|PipedCallSort|_|) = (|SpecificPipedCall0|_|) <@ Seq.sort @>
+    let (|PipedCallSortBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.sortBy @>
+    let (|PipedCallSeqGroupBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.groupBy @>
+    let (|PipedCallSeqMinBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.minBy @>
+    let (|PipedCallSeqMaxBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.maxBy @>
+    let (|PipedCallQueryGroupBy|_|) = (|SpecificPipedCall1|_|) <@ groupBy @>
+    let (|PipedCallQueryMinBy|_|) = (|SpecificPipedCall1|_|) <@ minBy @>
+    let (|PipedCallQueryMaxBy|_|) = (|SpecificPipedCall1|_|) <@ maxBy @>
+    let (|PipedCallSeqMap|_|) = (|SpecificPipedCall1|_|) <@ Seq.map @>
+    let (|PipedCallSeqAppend|_|) = (|SpecificPipedCall1|_|) <@ Seq.append @>
+    let (|PipedCallSeqFilter|_|) = (|SpecificPipedCall1|_|) <@ Seq.filter @>
+    let (|PipedCallSeqExists|_|) = (|SpecificPipedCall1|_|) <@ Seq.exists @>
+    let (|PipedCallSeqForAll|_|) = (|SpecificPipedCall1|_|) <@ Seq.forall @>
+    let (|PipedCallSeqDelay|_|) = (|SpecificPipedCall0|_|) <@ Seq.delay @>
+    let (|PipedCallSeqDistinct|_|) = (|SpecificPipedCall0|_|) <@ Seq.distinct @>
+    let (|PipedCallSeqToList|_|) = (|SpecificPipedCall0|_|) <@ Seq.toList @>
+    let (|PipedCallSeqTake|_|) = (|SpecificPipedCall1|_|) <@ Seq.take @>
+    let (|PipedCallSeqTruncate|_|) = (|SpecificPipedCall1|_|) <@ Seq.truncate @>
+    let (|PipedCallSeqToArray|_|) = (|SpecificPipedCall0|_|) <@ Seq.toArray @>
+    let (|PipedCallSeqMin|_|) = (|SpecificPipedCall0|_|) <@ Seq.min @>
+    let (|PipedCallSeqMax|_|) = (|SpecificPipedCall0|_|) <@ Seq.max @>
+    let (|PipedCallQueryContains|_|) = (|SpecificPipedCall1|_|) <@ contains @>
+    let (|CallSeq|_|) = (|SpecificCall|_|) <@ seq @>
+    let (|CallQueryJoin|_|) = (|SpecificCall|_|) <@ join @>
+    let (|CallQueryGroupJoin|_|) = (|SpecificCall|_|) <@ groupJoin @>
+    let (|PipedCallAverageBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.averageBy : (float -> float) -> seq<float> -> float @> 
+    let (|PipedCallAverage|_|) = (|SpecificPipedCall0|_|) <@ Seq.average: seq<float> -> float @>
+    let (|PipedCallSumBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.sumBy : (float -> float) -> seq<float> -> float @>
+    let (|PipedCallSum|_|) = (|SpecificPipedCall0|_|) <@ Seq.sum: seq<float> -> float @>
+    let (|PipedCallSeqLength|_|) = (|SpecificPipedCall0|_|) <@ Seq.length @>
+    let (|PipedCallSeqHead|_|) = (|SpecificPipedCall0|_|) <@ Seq.head @>
+    let (|PipedCallSeqFind|_|) = (|SpecificPipedCall1|_|) <@ Seq.find @>
+
+    let query (p : Expr<'T1>) : 'T1 = 
+
+        let body = (p :> Expr)
+        let rec TransInner (tm:Expr) = 
+            match tm with 
+            // Look through coercions, e.g. to IEnumerable 
+            | Coerce (expr,ty) -> 
+                TransInner expr
+            
+            // Seq.collect (fun x -> if P x then tgt else Seq.empty)  sq @> 
+            //    ~~> TRANS(Seq.collect (x -> tgt) (sq.Where(x -> P x))
+            | PipedCallMapConcat ([srcTy;_;targetTy],Lambda(selectorVar, selector),sq) ->
+                let rec TransMapConcatSelector t = 
+                    match t with 
+                    | CallSingleton(None, _,[res]) -> 
+
+                        MakeQueryableSelect(srcTy,targetTy, TransInner sq, [selectorVar],MacroExpand res)
+
+
+                    | IfThenElse(g,tgt,CallEmpty (None, [_],[])) ->
+
+                        let sq = MakeFilter(srcTy,Expr.Lambda(selectorVar,g),sq)
+                        let sq = TransInner (MakeMapConcat(srcTy,targetTy,Expr.Lambda(selectorVar,tgt),sq))
+                        sq
+
+                    | MacroReduction(reduced) -> 
+                        TransMapConcatSelector reduced
+
+                    | selectorBody ->
+                        let selectorBody = TransInner selectorBody
+                        // For some reason IQueryable.SelectMany expects an IEnumerable return
+                        // REVIEW: Previous notes in this file said that LINQ likes to see a coercion to an interface type at this point. 
+                        let selectorBody = Expr.Coerce(TransInner selectorBody,MakeIEnumerableTy targetTy)
+                        MakeQueryableSelectMany(srcTy,targetTy, TransInner sq, selectorVar,selectorBody)
+
+                TransMapConcatSelector selector
+            
+            | PipedCallSeqMap ([srcTy;targetTy],Lambda(v,res),sq) ->
+        
+                MakeQueryableSelect(srcTy,targetTy, TransInner sq, [v],MacroExpand res)
+
+            | PipedCallSeqAppend ([srcTy],sq1,sq2) ->
+        
+                MakeQueryableAppend(srcTy, TransInner sq1, TransInner sq2)
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | PipedCallSeqFilter ([srcTy],Lambda(v,res),sq) ->
+
+                MakeQueryableWhere(srcTy, TransInner sq, v,MacroExpand res)
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | PipedCallSeqDelay (_,Lambda(_,body)) ->
+        
+                TransInner body
+            
+            // These occur in the F# quotation form of F# sequence expressions            
+            | CallSeq (None, _,[body]) ->
+        
+                TransInner body
+
+                
+            | IfThenElse(g,t,e) ->
+
+                Expr.IfThenElse(g,TransInner t, TransInner e)
+
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | CallEmpty (None, [ty],[]) ->
+        
+                MakeQueryableEmpty ty
+
+
+            | PipedCallSortBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableOrderBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSort([ srcTy ],source) ->
+
+                let v = new Var("x",srcTy)
+                MakeQueryableOrderBy(srcTy,srcTy, TransInner source, v,Expr.Var v)
+
+            | PipedCallSeqGroupBy _ ->
+
+                failwithf "The operator Seq.groupBy may not be used in queries. Use Microsoft.FSharp.Linq.Query.groupNy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryGroupBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableGroupBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqMinBy _ ->
+
+                failwithf "The operator Seq.minBy may not be used in queries. Use Microsoft.FSharp.Linq.Query.minBy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryMinBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableMinBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqMaxBy _ ->
+
+                failwithf "The operator Seq.maxBy may not be used in queries. Use Microsoft.FSharp.Linq.Query.maxBy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryMaxBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableMaxBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqExists([ srcTy],Lambda(v,keySelector),source) ->
+
+                MakeQueryableAny(srcTy,TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqForAll([ srcTy],Lambda(v,keySelector),source) ->
+
+                MakeQueryableAll(srcTy,TransInner source, v,MacroExpand keySelector)
+
+            | CallQueryJoin(None, [ outerSourceTy;innerSourceTy;keyTy;resultTy ],[outerSource;innerSource;Lambda(outerKeyVar,outerKeySelector);Lambda(innerKeyVar,innerKeySelector);Lambdas([[outerResultKeyVar];[innerResultKeyVar]],resultSelector)])->
+
+                MakeQueryableJoin(outerSourceTy,innerSourceTy,keyTy,resultTy,TransInner outerSource,TransInner innerSource,outerKeyVar,MacroExpand outerKeySelector,innerKeyVar,MacroExpand innerKeySelector,outerResultKeyVar,innerResultKeyVar,MacroExpand resultSelector)  
+
+            | CallQueryGroupJoin(None, [ outerSourceTy;innerSourceTy;keyTy;resultTy ],[outerSource;innerSource;Lambda(outerKeyVar,outerKeySelector);Lambda(innerKeyVar,innerKeySelector);Lambdas([[outerResultKeyVar];[innerResultKeyVar]],resultSelector)])->
+
+                MakeQueryableGroupJoin(outerSourceTy,innerSourceTy,keyTy,resultTy,TransInner outerSource,TransInner innerSource,outerKeyVar,MacroExpand outerKeySelector,innerKeyVar,MacroExpand innerKeySelector,outerResultKeyVar,innerResultKeyVar,MacroExpand resultSelector)  
+
+            | PipedCallSeqDistinct([ srcTy ],source) ->
+                MakeQueryableDistinct(srcTy, TransInner source)
+
+
+            | PipedCallSeqTake([ srcTy ],count,sq) 
+            | PipedCallSeqTruncate([ srcTy ],count,sq) ->
+                MakeQueryableTake(srcTy, TransInner sq, MacroExpand count)
+
+            | MacroReduction(reduced) -> 
+                TransInner reduced
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            //
+            //       match i.Data with 
+            //       | 8 -> ...
+            //       | _ -> ()
+            | Sequential(Value( _, unitType), sq) when unitType  = typeof<unit> -> 
+        
+                TransInner sq
+
+            | expr when typeof<IQueryable>.IsAssignableFrom(expr.Type) ->
+                expr
+
+
+            // Error cases
+            | _  -> 
+                failwithf "The following construct was used in query but is not recognised by the F#-to-LINQ query translator:\n%A\nThis is not a valid query expression. Check the specification of permitted queries and consider moving some of the query out of the quotation" tm 
+
+        let EvalInner (tm:Expr) = (TransInner tm).EvalUntyped()
+
+        let rec EvalOuterWithPostProcess (tm:Expr) = 
+            match tm with
+            
+            // Allow SQL <@ [ for x in ... ] @>
+            | PipedCallSeqToList ([srcTy],sq) ->
+        
+                CallSeqToList (srcTy,EvalInner sq)
+
+            | PipedCallSeqToArray ([srcTy],sq) ->
+        
+                CallSeqToArray (srcTy,EvalInner sq)
+
+
+            | PipedCallSeqMin ([srcTy],sq) ->
+
+                CallQueryableMin(srcTy,EvalInner sq)
+
+            | PipedCallSeqMax ([srcTy],sq) ->
+
+                CallQueryableMax(srcTy,EvalInner sq)
+
+            | PipedCallQueryContains ([srcTy],v,sq) ->
+
+                CallQueryableContains(srcTy,EvalInner sq,(MacroExpand v).ToLinqExpression())
+
+            | PipedCallAverageBy([srcTy;destTy],Lambda(v,res),sq) ->
+
+                CallQueryableAverageBy(srcTy, destTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,destTy,v,MacroExpand  res))
+
+            | PipedCallAverage ([srcTy],sq) ->
+
+                CallQueryableAverage(srcTy, EvalInner sq)
+
+            | PipedCallSumBy ([srcTy;destTy],Lambda(v,res),sq) ->
+
+                CallQueryableSumBy(srcTy, destTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,destTy,v,MacroExpand  res))
+
+            | PipedCallSum ([srcTy],sq) ->
+
+                CallQueryableSum(srcTy, EvalInner sq)
+
+            | PipedCallSeqLength ([ srcTy ],sq) ->
+                CallQueryableCount(srcTy, EvalInner sq)
+
+            | PipedCallSeqHead ([ srcTy ],sq) ->
+                CallQueryableFirst(srcTy, EvalInner sq)
+
+            | PipedCallSeqFind([ srcTy ],sq, NewDelegate(_,[v],f)) ->
+                CallQueryableFirstFind(srcTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,boolTy,v,MacroExpand f))
+
+            | MacroReduction(reduced) -> 
+                EvalOuterWithPostProcess reduced
+
+            | _  -> 
+                EvalInner tm
+        
+        let res = EvalOuterWithPostProcess body 
+        unbox res
+
+
+    let SQL x = query x
+
+
+    
+    
+
+    //-------------------------------------------------------------------------
+    // Nullable utilities for F#
+
+(*
+
+    /// This operator compares Nullable values with non-Nullable values using
+    /// structural comparison
+    [<ReflectedDefinition>]
+    let (>=?!) (x : Nullable<'T1>) (y: 'T1) = 
+        x.HasValue && x.Value >= y
+
+    [<ReflectedDefinition>]
+    let (>?!) (x : Nullable<'T1>) (y: 'T1) = 
+        x.HasValue && x.Value > y
+
+    [<ReflectedDefinition>]
+    let (<=?!) (x : Nullable<'T1>) (y: 'T1) = 
+        not x.HasValue || x.Value <= y
+
+    [<ReflectedDefinition>]
+    let (<?!) (x : Nullable<'T1>) (y: 'T1) = 
+        not x.HasValue || x.Value < y
+
+    [<ReflectedDefinition>]
+    let (=?!) (x : Nullable<'T1>) (y: 'T1) = 
+        x.HasValue && x.Value = y
+
+    [<ReflectedDefinition>]
+    let (<>?!) (x : Nullable<'T1>) (y: 'T1) = 
+        not x.HasValue or x.Value <> y
+
+    /// This overloaded operator divides Nullable values by non-Nullable values
+    /// using the overloaded operator "/".  Inlined to allow use over any type,
+    /// as this resolves the overloading on "/".
+    [<ReflectedDefinition>]
+    let inline (/?!) (x : Nullable<'T1>) (y: 'T1) = 
+        if x.HasValue then new Nullable<'T1>(x.Value / y)
+        else x
+
+    /// This overloaded operator adds Nullable values by non-Nullable values
+    /// using the overloaded operator "+".  Inlined to allow use over any type,
+    /// as this resolves the overloading on "+".
+    [<ReflectedDefinition>]
+    let inline (+?!) (x : Nullable<'T1>) (y: 'T1) = 
+        if x.HasValue then new Nullable<'T1>(x.Value + y)
+        else x
+
+    /// This overloaded operator adds Nullable values by non-Nullable values
+    /// using the overloaded operator "-".  Inlined to allow use over any type,
+    /// as this resolves the overloading on "-".
+    [<ReflectedDefinition>]
+    let inline (-?!) (x : Nullable<'T1>) (y: 'T1) = 
+        if x.HasValue then new Nullable<'T1>(x.Value - y)
+        else x
+
+    /// This overloaded operator adds Nullable values by non-Nullable values
+    /// using the overloaded operator "*".  Inlined to allow use over any type,
+    /// as this resolves the overloading on "*".
+    [<ReflectedDefinition>]
+    let inline ( *?!) (x : Nullable<'T1>) (y: 'T1) = 
+        if x.HasValue then new Nullable<'T1>(x.Value * y)
+        else x
+
+    /// This overloaded operator adds Nullable values by non-Nullable values
+    /// using the overloaded operator "%".  Inlined to allow use over any type,
+    /// as this resolves the overloading on "%".
+    [<ReflectedDefinition>]
+    let inline ( %?!) (x : Nullable<'T1>) (y: 'T1) = 
+        if x.HasValue then new Nullable<'T1>(x.Value % y)
+        else x
+
+*)
+    
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fsi
new file mode 100644
index 0000000..76d3254
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/LinqQueries.fsi
@@ -0,0 +1,61 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Linq
+
+    open System
+
+    module Query =
+
+        /// Evaluate the quotation expression by first converting to a LINQ expression tree
+        /// making use of IQueryable operators and then executing expression tree
+        ///
+        /// Exceptions: <c>InvalidArgumentException</c> will be raised if the input expression is
+        /// not in the subset that can be converted to a LINQ expression tree
+        val query : Quotations.Expr<'T> -> 'T
+
+
+        /// When used in queries, this operator corresponds to the LINQ Contains operator and the <c>query</c> convertor recognises it as such
+        val contains : 
+            key:'T -> 
+            source:seq<'T> -> 
+               bool
+
+        /// When used in queries, this operator corresponds to the LINQ Min operator and the <c>query</c> convertor recognises it as such
+        /// It differs in return type from <c>Seq.minBy</c>
+        val minBy : 
+            keySelector:('T -> 'Key) -> 
+            source:seq<'T> -> 
+               'Key
+
+        /// When used in queries, this operator corresponds to the LINQ Max operator and the <c>query</c> convertor recognises it as such
+        /// It differs in return type from <c>Seq.maxBy</c>
+        val maxBy : 
+            keySelector:('T -> 'Key) -> 
+            source:seq<'T> -> 
+               'Key
+
+        /// When used in queries, this operator corresponds to the LINQ Join operator and the <c>query</c> convertor recognises it as such
+        val groupBy : 
+            keySelector:('T -> 'Key) -> 
+            source:seq<'T> -> 
+               seq<System.Linq.IGrouping<'Key,'T>>
+
+        /// This join operator corresponds to the LINQ Join operator and the <c>query</c> convertor recognises it as such
+        val join : 
+            outerSource:seq<'Outer> -> 
+            innerSource:seq<'Inner> -> 
+            outerKeySelector:('Outer -> 'Key) -> 
+            innerKeySelector:('Inner -> 'Key) -> 
+            resultSelector:('Outer -> 'Inner -> 'Result) ->
+               seq<'Result>
+
+
+        /// This join operator implements the LINQ GroupJoin operator and the <c>query</c> convertor recognises it as such
+        val groupJoin : 
+            outerSource:seq<'Outer> -> 
+            innerSource:seq<'Inner> -> 
+            outerKeySelector:('Outer -> 'Key) -> 
+            innerKeySelector:('Inner -> 'Key) -> 
+            resultSelector:('Outer -> seq<'Inner> -> 'Result) ->
+               seq<'Result>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Test.PowerPack.Linq.fsproj b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Test.PowerPack.Linq.fsproj
new file mode 100644
index 0000000..4ea094a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/Test.PowerPack.Linq.fsproj
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <FSharpPowerPackSourcesRoot>..</FSharpPowerPackSourcesRoot>
+    <Name>Test.PowerPack.Linq</Name>
+  </PropertyGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.Settings.targets" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{4c2ed03b-5ace-427b-8285-ad333e60f35e}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AssemblyName>Test.PowerPack.Linq</AssemblyName>
+    <AllowCrossTargeting>true</AllowCrossTargeting>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <DocumentationFile>Test.PowerPack.Linq.xml</DocumentationFile>
+    <NoWarn>$(NoWarn);9</NoWarn>
+  </PropertyGroup>
+  <!-- These dummy entries are needed for F# Beta2 -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  </PropertyGroup>
+  <!-- References -->
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+      <Name>System.Core</Name>
+      <Private>False</Private>
+      <AssemblyName>System.Core.dll</AssemblyName>
+    </Reference>
+    <Reference Include="FSharp.Core" />
+  </ItemGroup>
+  <!-- Files -->
+  <ItemGroup>
+    <Compile Include="..\assemblyinfo.Common.fs">
+      <Link>assemblyinfo.Common.fs</Link>
+    </Compile>
+    <Compile Include="assemblyinfo.FSharp.PowerPack.Linq.dll.fs">
+      <Link>assemblyinfo.FSharp.PowerPack.Linq.dll.fs</Link>
+    </Compile>
+    <Compile Include="FuncConvertExtensions.fsi" />
+    <Compile Include="FuncConvertExtensions.fs" />
+    <Compile Include="Linq.fsi" />
+    <Compile Include="Linq.fs" />
+    <Compile Include="LinqQueries.fsi" />
+    <Compile Include="LinqQueries.fs" />
+    <Compile Include="Assembly.fs" />
+  </ItemGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.targets" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets'))" />
+  <Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets'))" />
+</Project>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/assemblyinfo.FSharp.PowerPack.Linq.dll.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/assemblyinfo.FSharp.PowerPack.Linq.dll.fs
new file mode 100644
index 0000000..b5ab946
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack.Linq/assemblyinfo.FSharp.PowerPack.Linq.dll.fs
@@ -0,0 +1,8 @@
+namespace Microsoft.FSharp
+open System.Reflection
+[<assembly:AssemblyDescription("Test.PowerPack.Linq.dll")>]
+[<assembly:AssemblyCompany("Microsoft Corporation")>]
+[<assembly:AssemblyTitle("Test.PowerPack.Linq.dll")>]
+[<assembly:AssemblyCopyright("\169 Microsoft Corporation.  All rights reserved.")>]
+[<assembly:AssemblyProduct("Microsoft\174 F#")>]
+do()
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fs
new file mode 100644
index 0000000..92f0949
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fs
@@ -0,0 +1,167 @@
+// (c) Microsoft Corporation 2005-2009. 
+namespace Microsoft.FSharp.Control
+
+    open System
+    open System.Threading
+    open Microsoft.FSharp.Control
+
+    /// Represents the reified result of an asynchronous computation
+    [<NoEquality; NoComparison>]
+    type AsyncResult<'T>  =
+        |   AsyncOk of 'T
+        |   AsyncException of exn
+        |   AsyncCanceled of OperationCanceledException
+
+        static member Commit(res:AsyncResult<'T>) = 
+            Async.FromContinuations (fun (cont,econt,ccont) -> 
+                   match res with 
+                   | AsyncOk v -> cont v 
+                   | AsyncException exn -> econt exn 
+                   | AsyncCanceled exn -> ccont exn)
+
+    /// When using .NET 4.0 you can replace this type by Task<'T>
+    [<Sealed>]
+    type AsyncResultCell<'T>() =
+        let mutable result = None
+        // The continuation for the result, if any
+        let mutable savedConts = []
+        
+        let syncRoot = new obj()
+                
+
+        // Record the result in the AsyncResultCell.
+        // Ignore subsequent sets of the result. This can happen, e.g. for a race between 
+        // a cancellation and a success.
+        member x.RegisterResult (res:AsyncResult<'T>,?reuseThread) =
+            let grabbedConts = 
+                lock syncRoot (fun () ->
+                    if result.IsSome then  
+                        []
+                    else
+                        result <- Some res;
+                        // Invoke continuations in FIFO order 
+                        // Continuations that Async.FromContinuations provide do QUWI/SynchContext.Post, 
+                        // so the order is not overly relevant but still.                        
+                        List.rev savedConts)
+            // Run continuations outside the lock
+            let reuseThread = defaultArg reuseThread false
+            match grabbedConts with
+            |   [] -> ()
+            |   [cont] when reuseThread -> cont res
+            |   otherwise ->
+#if FX_NO_SYNC_CONTEXT
+                    let postOrQueue cont = ThreadPool.QueueUserWorkItem(fun _ -> cont res) |> ignore
+#else
+                    let synchContext = System.Threading.SynchronizationContext.Current
+                    let postOrQueue =
+                        match synchContext with
+                        |   null -> fun cont -> ThreadPool.QueueUserWorkItem(fun _ -> cont res) |> ignore
+                        |   sc -> fun cont -> sc.Post((fun _ -> cont res), state=null)
+#endif                        
+                    grabbedConts |> List.iter postOrQueue
+
+        /// Get the reified result 
+        member private x.AsyncPrimitiveResult =
+            Async.FromContinuations(fun (cont,_,_) -> 
+                let grabbedResult = 
+                    lock syncRoot (fun () ->
+                        match result with
+                        | Some res -> 
+                            result
+                        | None ->
+                            // Otherwise save the continuation and call it in RegisterResult
+                            savedConts <- cont::savedConts
+                            None)
+                // Run the action outside the lock
+                match grabbedResult with 
+                | None -> ()
+                | Some res -> cont res) 
+                           
+
+        /// Get the result and commit it
+        member x.AsyncResult =
+            async { let! res = x.AsyncPrimitiveResult
+                    return! AsyncResult.Commit(res) }
+
+
+    [<AutoOpen>]
+    module FileExtensions =
+
+        let UnblockViaNewThread f =
+            async { do! Async.SwitchToNewThread ()
+                    let res = f()
+                    do! Async.SwitchToThreadPool ()
+                    return res }
+
+
+        type System.IO.File with
+            static member AsyncOpenText(path)   = UnblockViaNewThread (fun () -> System.IO.File.OpenText(path))
+            static member AsyncAppendText(path) = UnblockViaNewThread (fun () -> System.IO.File.AppendText(path))
+            static member AsyncOpenRead(path)   = UnblockViaNewThread (fun () -> System.IO.File.OpenRead(path))
+            static member AsyncOpenWrite(path)  = UnblockViaNewThread (fun () -> System.IO.File.OpenWrite(path))
+#if FX_NO_FILE_OPTIONS
+            static member AsyncOpen(path,mode,?access,?share,?bufferSize) =
+#else
+            static member AsyncOpen(path,mode,?access,?share,?bufferSize,?options) =
+#endif
+                let access = match access with Some v -> v | None -> System.IO.FileAccess.ReadWrite
+                let share = match share with Some v -> v | None -> System.IO.FileShare.None
+#if FX_NO_FILE_OPTIONS
+#else
+                let options = match options with Some v -> v | None -> System.IO.FileOptions.None
+#endif
+                let bufferSize = match bufferSize with Some v -> v | None -> 0x1000
+                UnblockViaNewThread (fun () -> 
+#if FX_NO_FILE_OPTIONS
+                    new System.IO.FileStream(path,mode,access,share,bufferSize))
+#else
+                    new System.IO.FileStream(path,mode,access,share,bufferSize, options))
+#endif
+
+            static member OpenTextAsync(path)   = System.IO.File.AsyncOpenText(path)
+            static member AppendTextAsync(path) = System.IO.File.AsyncAppendText(path)
+            static member OpenReadAsync(path)   = System.IO.File.AsyncOpenRead(path)
+            static member OpenWriteAsync(path)  = System.IO.File.AsyncOpenWrite(path)
+#if FX_NO_FILE_OPTIONS
+            static member OpenAsync(path,mode,?access,?share,?bufferSize) = 
+                System.IO.File.AsyncOpen(path, mode, ?access=access, ?share=share,?bufferSize=bufferSize)
+#else
+            static member OpenAsync(path,mode,?access,?share,?bufferSize,?options) = 
+                System.IO.File.AsyncOpen(path, mode, ?access=access, ?share=share,?bufferSize=bufferSize,?options=options)
+#endif
+
+    [<AutoOpen>]
+    module StreamReaderExtensions =
+        type System.IO.StreamReader with
+
+            member s.AsyncReadToEnd () = FileExtensions.UnblockViaNewThread (fun () -> s.ReadToEnd())
+            member s.ReadToEndAsync () = s.AsyncReadToEnd ()
+
+#if FX_NO_WEB_REQUESTS
+#else
+    [<AutoOpen>]
+    module WebRequestExtensions =
+        open System
+        open System.Net
+        open Microsoft.FSharp.Control.WebExtensions
+
+        let callFSharpCoreAsyncGetResponse (req: System.Net.WebRequest) = req.AsyncGetResponse()
+        
+        type System.Net.WebRequest with
+            member req.AsyncGetResponse() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method
+            member req.GetResponseAsync() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method
+#endif
+     
+#if FX_NO_WEB_CLIENT
+#else
+    [<AutoOpen>]
+    module WebClientExtensions =
+        open System.Net
+        open Microsoft.FSharp.Control.WebExtensions
+        
+        let callFSharpCoreAsyncDownloadString (req: System.Net.WebClient) address = req.AsyncDownloadString address
+
+        type WebClient with
+            member this.AsyncDownloadString address = callFSharpCoreAsyncDownloadString this address
+#endif
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fsi
new file mode 100644
index 0000000..25d7946
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncOperations.fsi
@@ -0,0 +1,81 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Control
+
+    open System
+    open Microsoft.FSharp.Control
+    
+    /// Represents the reified result of an asynchronous computation
+    [<NoEquality; NoComparison>]
+    type AsyncResult<'T>  =
+        | AsyncOk of 'T
+        | AsyncException of exn
+        | AsyncCanceled of OperationCanceledException
+
+        /// Create an async whose result depends on the value of an AsyncResult.
+        static member Commit : AsyncResult<'T> -> Async<'T>
+
+    [<Sealed>]
+    /// A helper type to store a single result from an asynchronous computation and asynchronously
+    /// access its result.
+    type AsyncResultCell<'T> =
+        /// Record the result in the AsyncResultCell. Subsequent sets of the result are ignored. 
+        ///
+        /// This may result in the scheduled resumption of a waiting asynchronous operation  
+        member RegisterResult:AsyncResult<'T> * ?reuseThread:bool -> unit
+
+        /// Wait for the result and commit it
+        member AsyncResult : Async<'T>
+        /// Create a new result cell
+        new : unit -> AsyncResultCell<'T>
+        
+    [<AutoOpen>]
+    module StreamReaderExtensions =
+        open System.IO
+
+        type System.IO.StreamReader with 
+            /// Return an asynchronous computation that will read to the end of a stream via a fresh I/O thread.
+            member AsyncReadToEnd: unit -> Async<string>
+
+    [<AutoOpen>]
+    module FileExtensions =
+        open System.IO
+        type System.IO.File with 
+            /// Create an async that opens an existing file for reading, via a fresh I/O thread.
+            static member AsyncOpenText: path:string -> Async<StreamReader>
+
+            /// Create an async that opens a <c>System.IO.FileStream</c> on the specified path for read/write access, via a fresh I/O thread.
+            static member AsyncOpenRead: path:string -> Async<FileStream>
+
+            /// Create an async that opens an existing file writing, via a fresh I/O thread.
+            static member AsyncOpenWrite: path:string -> Async<FileStream>
+
+            /// Create an async that returns a <c>System.IO.StreamWriter</c> that appends UTF-8 text to an existing file, via a fresh I/O thread.
+            static member AsyncAppendText: path:string -> Async<StreamWriter>
+
+            /// Create an async that opens a <c>System.IO.FileStream</c> on the specified path, via a fresh I/O thread.
+            /// Pass <c>options=FileOptions.Asynchronous</c> to enable further asynchronous read/write operations
+            /// on the FileStream.
+#if FX_NO_FILE_OPTIONS
+            static member AsyncOpen: path:string * mode:FileMode * ?access: FileAccess * ?share: FileShare * ?bufferSize: int -> Async<FileStream>
+#else
+            static member AsyncOpen: path:string * mode:FileMode * ?access: FileAccess * ?share: FileShare * ?bufferSize: int * ?options: FileOptions -> Async<FileStream>
+#endif
+
+#if FX_NO_WEB_REQUESTS
+#else
+    [<AutoOpen>]
+    module WebRequestExtensions =
+        type System.Net.WebRequest with 
+            /// Return an asynchronous computation that, when run, will wait for a response to the given WebRequest.
+            [<System.Obsolete("The extension method now resides in the 'WebExtensions' module in the F# core library. Please add 'open Microsoft.FSharp.Control.WebExtensions' to access this method")>]
+            member AsyncGetResponse : unit -> Async<System.Net.WebResponse>
+#endif
+    
+#if FX_NO_WEB_CLIENT
+#else
+    [<AutoOpen>]
+    module WebClientExtensions =
+        type System.Net.WebClient with
+            [<System.Obsolete("The extension method now resides in the 'WebExtensions' module in the F# core library. Please add 'open Microsoft.FSharp.Control.WebExtensions' to access this method")>]
+            member AsyncDownloadString : address:System.Uri -> Async<string>
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fs
new file mode 100644
index 0000000..2ec2c1a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fs
@@ -0,0 +1,65 @@
+// (c) Microsoft Corporation 2005-2009. 
+namespace Microsoft.FSharp.Control
+
+    open System
+    open System.Threading
+    open System.IO
+    open Microsoft.FSharp.Control
+    open Microsoft.FSharp.Collections
+
+#if FX_NO_SYNC_CONTEXT
+#else
+    type AsyncWorker<'T>(p : Async<'T>,?cancellationToken) = 
+
+        let cts =
+            match cancellationToken with
+            | None -> new CancellationTokenSource()
+            | Some token ->
+                  let cts = new CancellationTokenSource()
+                  CancellationTokenSource.CreateLinkedTokenSource(token,cts.Token)
+
+        let mutable syncContext : SynchronizationContext = null
+
+        // A standard helper to raise an event on the GUI thread
+
+        let raiseEventOnGuiThread (event:Event<_>) args =
+            syncContext.Post((fun _ -> event.Trigger args),state=null)
+
+        // Trigger one of the following events when the iteration completes.
+        let completed = new Event<'T>()
+        let error     = new Event<_>()
+        let canceled   = new Event<_>()
+        let progress  = new Event<int>()
+
+        let doWork() = 
+            Async.StartWithContinuations
+                ( p, 
+                  (fun res -> raiseEventOnGuiThread completed res),
+                  (fun exn -> raiseEventOnGuiThread error exn),
+                  (fun exn -> raiseEventOnGuiThread canceled exn ),cts.Token)
+                                
+        member x.ReportProgress(progressPercentage) = 
+            raiseEventOnGuiThread progress progressPercentage
+        
+        member x.RunAsync()    = 
+            match syncContext with 
+            | null -> ()
+            | _ -> invalidOp "The operation is already in progress. RunAsync can't be called twice"
+
+            syncContext <- 
+                match SynchronizationContext.Current with 
+                | null -> new SynchronizationContext()
+                | ctxt -> ctxt
+
+            ThreadPool.QueueUserWorkItem(fun args -> doWork())
+
+        member x.CancelAsync(?message:string) = 
+            cts.Cancel()
+
+        member x.ProgressChanged     = progress.Publish
+        member x.Completed  = completed.Publish
+        member x.Canceled   = canceled.Publish
+        member x.Error      = error.Publish
+
+
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fsi
new file mode 100644
index 0000000..f15e988
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/AsyncWorker.fsi
@@ -0,0 +1,20 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Control
+
+    open System
+    open System.Threading
+    open Microsoft.FSharp.Control
+
+#if FX_NO_SYNC_CONTEXT
+#else
+    type AsyncWorker<'T> =
+        new : Async<'T> * ?asyncGroup: CancellationToken -> AsyncWorker<'T>
+        member ProgressChanged : IEvent<int> 
+        member Error : IEvent<exn> 
+        member Completed : IEvent<'T> 
+        member Canceled : IEvent<OperationCanceledException> 
+        member RunAsync : unit -> bool
+        member ReportProgress : int -> unit
+        member CancelAsync : ?message:string -> unit
+
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fs
new file mode 100644
index 0000000..deec536
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fs
@@ -0,0 +1,109 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#nowarn "9"
+#nowarn "51" // The address-of operator may result in non-verifiable code. Its use is restricted to passing byrefs to functions that require them
+   
+namespace Microsoft.FSharp.Compatibility
+
+module Array = 
+
+    open System.Runtime.InteropServices
+    
+    let invalidArg arg msg = raise (new System.ArgumentException((msg:string),(arg:string)))        
+    
+    let nonempty (arr: _[]) = (arr.Length <> 0)
+    
+    let inline pinObjUnscoped (obj: obj) =  GCHandle.Alloc(obj,GCHandleType.Pinned) 
+
+    let inline pinObj (obj: obj) f = 
+        let gch = pinObjUnscoped obj 
+        try f gch
+        finally
+            gch.Free()
+    
+    [<NoDynamicInvocation>]
+    let inline pin (arr: 'T []) (f : nativeptr<'T> -> 'U) = 
+        pinObj (box arr) (fun _ -> f (&&arr.[0]))
+    
+    [<NoDynamicInvocation>]
+    let inline pinUnscoped (arr: 'T []) : nativeptr<'T> * _ = 
+        let gch = pinObjUnscoped (box arr) 
+        &&arr.[0], gch
+
+    [<NoDynamicInvocation>]
+    let inline pin_unscoped arr= pinUnscoped arr 
+      
+    let inline contains x (arr: 'T []) =
+        let mutable found = false
+        let mutable i = 0
+        let eq = LanguagePrimitives.FastGenericEqualityComparer
+
+        while not found && i < arr.Length do
+            if eq.Equals(x,arr.[i]) then
+                found <- true
+            else
+                i <- i + 1
+        found
+
+    let inline mem x arr = contains x arr
+        
+    let scanSubRight f (arr : _[]) start fin initState = 
+        let mutable state = initState 
+        let res = Array.create (2+fin-start) initState 
+        for i = fin downto start do
+          state <- f arr.[i] state;
+          res.[i - start] <- state
+        done;
+        res
+
+    let scanSubLeft f  initState (arr : _[]) start fin = 
+        let mutable state = initState 
+        let res = Array.create (2+fin-start) initState 
+        for i = start to fin do
+          state <- f state arr.[i];
+          res.[i - start+1] <- state
+        done;
+        res
+
+    let scanReduce f (arr : _[]) = 
+        let arrn = arr.Length
+        if arrn = 0 then invalidArg "arr" "the input array is empty"
+        else scanSubLeft f arr.[0] arr 1 (arrn - 1)
+
+    let scanReduceBack f (arr : _[])  = 
+        let arrn = arr.Length
+        if arrn = 0 then invalidArg "arr" "the input array is empty"
+        else scanSubRight f arr 0 (arrn - 2) arr.[arrn - 1]
+
+    let createJaggedMatrix (n:int) (m:int) (x:'T) = 
+        let arr = (Array.zeroCreate n : 'T [][]) 
+        for i = 0 to n - 1 do 
+            let inner = (Array.zeroCreate m : 'T []) 
+            for j = 0 to m - 1 do 
+                inner.[j] <- x
+            arr.[i] <- inner
+        arr
+
+    let create_matrix n m x = createJaggedMatrix n m x
+
+    let isEmpty array = Array.isEmpty array
+
+    let zero_create n = Array.zeroCreate n 
+
+    let fold_left f z array = Array.fold f z array
+
+    let fold_right f array z = Array.foldBack f array z
+
+    let for_all f array = Array.forall f array
+
+
+    let split array = Array.unzip array
+
+    let combine array1 array2 = Array.zip array1 array2
+
+    let make (n:int) (x:'T) = Array.create n x
+
+    let to_list array = Array.toList array
+
+    let of_list list  = Array.ofList list
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fsi
new file mode 100644
index 0000000..06a2962
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array.fsi
@@ -0,0 +1,80 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+   
+namespace Microsoft.FSharp.Compatibility
+
+    open System
+
+    /// Compatibility operations on arrays.  
+    [<RequireQualifiedAccess>]
+    module Array = 
+
+        /// Create a jagged 2 dimensional array.
+        val createJaggedMatrix: int -> int -> 'T -> 'T array array
+
+        /// Is an element in the array, uses (=) equality.
+        val inline contains: 'T -> 'T array -> bool  when 'T : equality
+
+        /// Like reduce, but return both the intermediary and final results
+        val scanReduce : reduction:('T -> 'T -> 'T) -> 'T array -> 'T array
+
+        /// Like reduceBack, but return both the intermediary and final results
+        val scanReduceBack : reduction:('T -> 'T -> 'T) -> 'T array -> 'T array
+
+
+        /// Pin the given array for the duration of a single call to the given function.  A native pointer to
+        /// the first element in the array is passed to the given function.  Cleanup the GCHandle associated with the 
+        /// pin when the function completes, even if an exception is raised.
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        val inline pin: 'T[] -> (nativeptr<'T> -> 'Result) -> 'Result
+
+        /// As for Array.pin, except that the caller is responsible for calling Free on the returned GCHandle in order
+        /// to release the pin.
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        val inline pinUnscoped: 'T[] -> nativeptr<'T> *  System.Runtime.InteropServices.GCHandle
+
+
+        /// Create a jagged 2 dimensional array.  Synonym for createJaggedMatrix.
+        [<CompilerMessage("This construct is for ML compatibility. The F# name for this function is 'createJaggedMatrix'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val create_matrix: int -> int -> 'T -> 'T array array
+
+        [<CompilerMessage("This construct is for ML compatibility. The F# name for this function is 'contains'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val inline mem: 'T -> 'T array -> bool when 'T : equality
+
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        [<Obsolete("This function has been renamed to 'pinUnscoped'")>]
+        val inline pin_unscoped: 'T[] -> nativeptr<'T> *  System.Runtime.InteropServices.GCHandle
+
+        [<Obsolete("This function will be removed. Use 'not Array.isEmpty' instead")>]
+        val nonempty: 'T[] -> bool
+
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'zip' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val combine: array1:'T1 array -> array2:'T2 array -> ('T1 * 'T2) array
+
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'unzip' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val split: array:('T1 * 'T2) array -> ('T1 array * 'T2 array)
+
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'forall' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val for_all: predicate:('T -> bool) -> array:array<'T> -> bool
+
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'create' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val make: count:int -> value:'T -> array<'T>
+         
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'fold' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> array: array<'T> -> 'State
+
+        /// Apply a function to each element of the array, threading an accumulator argument
+        /// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> 
+        /// then computes <c>f i0 (...(f iN s))</c>
+        [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'foldBack' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val fold_right: folder:('T -> 'State -> 'State) -> array:array<'T> -> state:'State -> 'State
+
+        [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'Array.toList'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val to_list: array:'T[] -> 'T list
+
+        [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'Array.ofList'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+        val of_list: list:'T list -> 'T[]
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fs
new file mode 100644
index 0000000..07f694e
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fs
@@ -0,0 +1,32 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#nowarn "9"
+#nowarn "51" // The address-of operator may result in non-verifiable code. Its use is restricted to passing byrefs to functions that require them
+   
+namespace Microsoft.FSharp.Compatibility
+
+[<RequireQualifiedAccess>]
+module Array2D = 
+    
+    open System.Runtime.InteropServices
+    
+    let inline pinObjUnscoped (obj: obj) =  
+        GCHandle.Alloc(obj,GCHandleType.Pinned) 
+
+    let inline pinObj (obj: obj) f = 
+        let gch = pinObjUnscoped obj 
+        try f gch
+        finally
+            gch.Free()
+
+    [<NoDynamicInvocation>]
+    let inline pin (arr: 'T [,]) (f : nativeptr<'T> -> 'U) = 
+        pinObj (box arr) (fun _ -> f (&&arr.[0,0]))
+    
+    [<NoDynamicInvocation>]
+    let inline pinUnscoped (arr: 'T [,]) : nativeptr<'T> * _ = 
+        let gch = pinObjUnscoped (box arr) 
+        &&arr.[0,0], gch
+
+    [<NoDynamicInvocation>]
+    let inline pin_unscoped arr = pinUnscoped arr
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fsi
new file mode 100644
index 0000000..ec7c63f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Array2D.fsi
@@ -0,0 +1,26 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Compatibility
+
+    open System
+
+    [<RequireQualifiedAccess>]
+    module Array2D = 
+
+        /// Pin the given array for the duration of a single call to the given function.  A native pointer to
+        /// the first element in the array is passed to the given function.  Cleanup the GCHandle associated with the 
+        /// pin when the function completes, even if an exception is raised.
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        val inline pin: 'T[,] -> (nativeptr<'T> -> 'Result) -> 'Result
+
+        /// As for Array2D.pin, except that the caller is responsible for calling Free on the returned GCHandle in order
+        /// to release the pin.
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        val inline pinUnscoped: 'T[,] -> nativeptr<'T> *  System.Runtime.InteropServices.GCHandle
+        
+        [<Unverifiable>]
+        [<NoDynamicInvocation>]
+        [<Obsolete("This function has been renamed to 'pinUnscoped'")>]
+        val inline pin_unscoped: 'T[,] -> nativeptr<'T> *  System.Runtime.InteropServices.GCHandle
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fs
new file mode 100644
index 0000000..314eda0
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fs
@@ -0,0 +1,141 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#nowarn "62"
+
+namespace Microsoft.FSharp.Compatibility
+
+
+open Microsoft.FSharp.Core.OptimizedClosures
+open System.Collections.Generic
+open System.Diagnostics
+
+
+module List = 
+
+    let invalidArg arg msg = raise (new System.ArgumentException((msg:string),(arg:string)))        
+
+    let nonempty x = match x with [] -> false | _ -> true
+    let rec contains x l = match l with [] -> false | h::t -> x = h || contains x t
+    let mem x l = contains x l
+    let rec memq x l = 
+        match l with 
+        | [] -> false 
+        | h::t -> LanguagePrimitives.PhysicalEquality x h || memq x t
+
+    let rec rev_map2_acc (f:FSharpFunc<_,_,_>) l1 l2 acc =
+        match l1,l2 with 
+        | [],[] -> acc
+        | h1::t1, h2::t2 -> rev_map2_acc f t1 t2 (f.Invoke(h1,h2) :: acc)
+        | _ -> invalidArg "l2" "the lists have different lengths"
+
+    let rev_map2 f l1 l2 = 
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        rev_map2_acc f l1 l2 []
+
+    let rec rev_append l1 l2 = 
+        match l1 with 
+        | [] -> l2
+        | h::t -> rev_append t (h::l2)
+
+
+    let rec rev_map_acc f l acc =
+        match l with 
+        | [] -> acc
+        | h::t -> rev_map_acc f t (f h :: acc)
+
+    let rev_map f l = rev_map_acc f l []
+
+    let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+    let rec assoc x l = 
+        match l with 
+        | [] -> indexNotFound()
+        | ((h,r)::t) -> if x = h then r else assoc x t
+
+    let rec try_assoc x l = 
+        match l with 
+        | [] -> None
+        | ((h,r)::t) -> if x = h then Some(r) else try_assoc x t
+
+    let rec mem_assoc x l = 
+        match l with 
+        | [] -> false
+        | ((h,_)::t) -> x = h || mem_assoc x t
+
+    let rec remove_assoc x l = 
+        match l with 
+        | [] -> []
+        | (((h,_) as p) ::t) -> if x = h then t else p:: remove_assoc x t
+
+    let rec assq x l = 
+        match l with 
+        | [] -> indexNotFound()
+        | ((h,r)::t) -> if LanguagePrimitives.PhysicalEquality x h then r else assq x t
+
+    let rec try_assq x l = 
+        match l with 
+        | [] -> None
+        | ((h,r)::t) -> if LanguagePrimitives.PhysicalEquality x h then Some r else try_assq x t
+
+    let rec mem_assq x l = 
+        match l with 
+        | [] -> false
+        | ((h,_)::t) -> LanguagePrimitives.PhysicalEquality x h || mem_assq x t
+
+    let rec remove_assq x l = 
+        match l with 
+        | [] -> []
+        | (((h,_) as p) ::t) -> if LanguagePrimitives.PhysicalEquality x h then t else p:: remove_assq x t
+
+    let scanReduce f l = 
+        match l with 
+        | [] -> invalidArg "l" "the input list is empty"
+        | (h::t) -> List.scan f h t
+
+    let scanArraySubRight<'T,'State> (f:FSharpFunc<'T,'State,'State>) (arr:_[]) start fin initState = 
+        let mutable state = initState  
+        let mutable res = [state]  
+        for i = fin downto start do
+            state <- f.Invoke(arr.[i], state);
+            res <- state :: res
+        res
+
+    let scanReduceBack f l = 
+        match l with 
+        | [] -> invalidArg "l" "the input list is empty"
+        | _ -> 
+            let f = FSharpFunc<_,_,_>.Adapt(f)
+            let arr = Array.ofList l 
+            let arrn = Array.length arr 
+            scanArraySubRight f arr 0 (arrn - 2) arr.[arrn - 1]
+
+    let fold_left f z xs = List.fold f z xs
+
+    let fold_left2 f z xs1 xs2 = List.fold2 f z xs1 xs2
+
+    let fold_right f xs z = List.foldBack f xs z
+
+    let fold_right2 f xs1 xs2 z = List.foldBack2 f xs1 xs2 z
+
+    let for_all f xs = List.forall f xs
+
+    let for_all2 f xs1 xs2 = List.forall2 f xs1 xs2
+
+    let stable_sort f xs = List.sortWith f xs
+
+    let split x =  List.unzip x
+
+    let combine x1 x2 =  List.zip x1 x2
+
+    let find_all f x = List.filter f x
+
+    let flatten (list:seq<list<_>>) = List.concat list
+
+    let of_array (array:'T array) = List.ofArray array
+
+    let to_array (list:'T list) = List.toArray list
+
+    let hd list = List.head list
+
+    let tl list = List.tail list
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fsi
new file mode 100644
index 0000000..d005f99
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.List.fsi
@@ -0,0 +1,125 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+open System
+
+/// Compatibility operations on lists.  
+[<RequireQualifiedAccess>]
+module List = 
+
+    /// Like reduce, but return both the intermediary and final results
+    val scanReduce : reduction:('T -> 'T -> 'T) -> 'T list -> 'T list
+
+    /// Like reduceBack, but return both the intermediary and final results
+    val scanReduceBack : reduction:('T -> 'T -> 'T) -> 'T list -> 'T list
+
+    /// Is an element in the list. Elements are compared using generic equality.
+    val contains: 'T -> 'T list -> bool when 'T : equality
+
+    /// Is an element in the list. Elements are compared using generic equality.
+    [<CompilerMessage("This construct is for ML compatibility. The F# name for this function is 'contains'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val mem: 'T -> 'T list -> bool when 'T : equality
+
+    /// Lookup key's data in association list, uses (=) equality.
+    /// Raise <c>System.IndexOutOfRangeException</c> exception if key not found, in which case you should typically use <c>try_assoc</c> instead.
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val assoc: 'Key -> ('Key * 'Value) list -> 'Value when 'Key : equality
+
+    /// Lookup key's data in association list, uses (=) equality,
+    /// returning "Some data" or "None".  
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val try_assoc: 'Key -> ('Key * 'Value) list -> 'Value option when 'Key : equality
+
+    /// Does the key have pair in the association list?
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val mem_assoc: 'Key -> ('Key * 'Value) list -> bool when 'Key : equality
+
+    /// Remove pair for key from the association list (if it's there).
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val remove_assoc: 'Key -> ('Key * 'Value) list -> ('Key * 'Value) list when 'Key : equality
+
+    /// See <c>assoc</c>, but uses the physical equality operator (==) for equality tests
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val assq: 'Key -> ('Key * 'Value) list -> 'Value when 'Key : not struct
+      
+    /// See <c>try_assoc</c>, but uses the physical equality operator (==) for equality tests.    
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val try_assq: 'Key -> ('Key * 'Value) list -> 'Value option when 'Key : not struct
+
+    /// See <c>mem_assoc</c>, but uses the physical equality operator (==) for equality tests.      
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val mem_assq: 'Key -> ('Key * 'Value) list -> bool when 'Key : not struct
+
+    /// See <c>remove_assoc</c>, but uses the physical equality operator (==) for equality tests.        
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val remove_assq: 'Key -> ('Key * 'Value) list -> ('Key * 'Value) list when 'Key : not struct
+
+    /// See <c>mem</c>, but uses the physical equality operator (==) for equality tests.        
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val memq: 'T -> 'T list -> bool when 'T : not struct
+
+    /// Return true if the list is not empty.
+    [<Obsolete("This function will be removed. Use 'not List.isEmpty' instead")>]
+    val nonempty: 'T list -> bool
+
+    /// "rev_map f l1" evaluates to "map f (rev l1)"
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rev_map: mapping:('T -> 'U) -> 'T list -> 'U list
+
+    /// "rev_map2 f l1 l2" evaluates to "map2 f (rev l1) (rev l2)"
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rev_map2: mapping:('T1 -> 'T2 -> 'U) -> 'T1 list -> 'T2 list -> 'U list
+
+    /// "rev_append l1 l2" evaluates to "append (rev l1) l2"
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rev_append: 'T list -> 'T list -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'concat' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val flatten: lists:seq<'T list> -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'filter' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val find_all: predicate:('T -> bool) -> list:'T list -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'fold' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'fold2' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val fold_left2: folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'foldBack' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val fold_right: folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'foldBack2' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val fold_right2: folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'forall' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val for_all: predicate:('T -> bool) -> list:'T list -> bool
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'sortWith' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val stable_sort: list: ('T -> 'T -> int) -> 'T list -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'unzip' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val split: list:('T1 * 'T2) list -> ('T1 list * 'T2 list)
+
+    [<CompilerMessage("This construct is for ML compatibility. This F# library function has been renamed. Use 'zip' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val combine: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list
+    
+    [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'List.ofArray'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val of_array : array:'T[] -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'List.toArray'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val to_array: list:'T list -> 'T[]
+
+    /// Return the first element of the list.
+    ///
+    /// Raises <c>System.ArgumentException</c> if <c>list</c> is empty
+    [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'List.head'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val hd: list:'T list -> 'T
+
+    /// Return the tail of the list.  
+    ///
+    /// Raises <c>System.ArgumentException</c> if <c>list</c> is empty
+    [<CompilerMessage("This construct is for ML compatibility. The F# library name for this function is now 'List.tail'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val tl: list:'T list -> 'T list
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fs
new file mode 100644
index 0000000..64994a8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fs
@@ -0,0 +1,23 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#nowarn "9"
+   
+namespace Microsoft.FSharp.Compatibility
+
+open System.Collections.Generic
+
+[<RequireQualifiedAccess>]
+module Seq = 
+
+    let generate openf compute closef = 
+        seq { let r = openf() 
+              try 
+                let x = ref None
+                while (x := compute r; (!x).IsSome) do
+                    yield (!x).Value
+              finally
+                 closef r }
+    
+    let generate_using (openf : unit -> ('b :> System.IDisposable)) compute = 
+        generate openf compute (fun (s:'b) -> s.Dispose())
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fsi
new file mode 100644
index 0000000..eda5f1f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.Seq.fsi
@@ -0,0 +1,15 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Compatibility
+
+    open System
+
+    [<RequireQualifiedAccess>]
+    module Seq = 
+
+
+        [<Obsolete("This function will be removed in a future release. Use a sqeuence expression instead")>]
+        val generate   : opener:(unit -> 'b) -> generator:('b -> 'T option) -> closer:('b -> unit) -> seq<'T>
+
+        [<Obsolete("This function will be removed in a future release. If necessary, take a copy of its implementation from the F# PowerPack and copy it into your application")>]
+        val generate_using   : opener:(unit -> ('T :> IDisposable)) -> generator:('T -> 'b option) -> seq<'b>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fs
new file mode 100644
index 0000000..39dd38a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fs
@@ -0,0 +1,110 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+[<RequireQualifiedAccess>]
+module String = 
+    let test_null arg = match arg with null -> raise (new System.ArgumentNullException("arg")) | _ -> ()
+    let invalidArg arg msg = raise (new System.ArgumentException((msg:string),(arg:string)))        
+
+    let get (str:string) i =
+        test_null str
+        try str.[i]
+        with :? System.ArgumentException -> invalidArg "i" "index out of bounds" 
+
+    let length (str:string) =
+        test_null str
+        str.Length
+
+    let sub (s:string) (start:int) (len:int) =
+        test_null s
+        try s.Substring(start,len)
+        with :? System.ArgumentException -> failwith "String.sub" 
+
+    let compare (x:string) y = compare x y
+
+    let fast_get (s:string) n =
+        test_null s
+        s.[n]
+
+    let of_char (c:char) = System.Char.ToString(c)
+    let make (n: int) (c: char) : string = new System.String(c, n)
+
+    let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index for the character was not found in the string"))
+    
+    let index_from (s:string) (start:int) (c:char) =  
+        test_null s
+        try let r = s.IndexOf(c,start) in if r = -1 then indexNotFound() else r
+        with :? System.ArgumentException -> invalidArg "start" "String.index_from" 
+      
+    let rindex_from (s:string) (start:int) (c:char) =
+        test_null s
+        try let r =  s.LastIndexOf(c,start) in if r = -1 then indexNotFound() else r
+        with :? System.ArgumentException -> invalidArg "start" "String.rindex_from" 
+      
+
+    let index (s:string) (c:char) =
+        test_null s
+        index_from s 0 c
+
+    let rindex (s:string) (c:char) =
+        test_null s
+        rindex_from s (length s - 1) c
+
+    let contains_between (s:string) (start:int) (stop:int) (c:char) =
+        test_null s
+        try s.IndexOf(c,start,(stop-start+1)) <> -1
+        with :? System.ArgumentException -> invalidArg "start" "String.contains_between" 
+
+    let contains_from (s:string) (start:int) (c:char) =
+        test_null s
+        let stop = length s - 1 in 
+        try s.IndexOf(c,start,(stop-start+1)) <> -1
+        with :? System.ArgumentException -> invalidArg "start" "String.contains_from" 
+
+    let rcontains_from (s:string) (stop:int) (c:char) =
+        test_null s
+        let start = 0 in
+        try s.IndexOf(c,start,(stop-start+1)) <> -1
+        with :? System.ArgumentException -> invalidArg "stop" "String.rcontains_from" 
+      
+    let contains (s:string) (c:char) = contains_from s 0 c
+
+    let uppercase (s:string) =
+        test_null s
+#if FX_NO_TO_LOWER_INVARIANT
+        s.ToUpper(System.Globalization.CultureInfo.InvariantCulture)
+#else
+        s.ToUpperInvariant()
+#endif
+
+    let lowercase (s:string) =
+        test_null s
+#if FX_NO_TO_LOWER_INVARIANT
+        s.ToLower(System.Globalization.CultureInfo.InvariantCulture)
+#else
+        s.ToLowerInvariant()
+#endif
+
+    let capitalize (s:string) =
+        test_null s
+        if s.Length = 0 then "" 
+        else String.concat "" [uppercase (sub s 0 1); sub s 1 (length s - 1)]
+
+    let uncapitalize (s:string) =
+        test_null s
+        if s.Length = 0 then  ""
+        else String.concat "" [lowercase (sub s 0 1); sub s 1 (length s - 1)]
+
+#if FX_NO_STRING_SPLIT_OPTIONS
+#else
+    let split (c : char list) =
+        let ca = Array.ofList c 
+        fun (s:string) ->
+            test_null s
+            Array.toList(s.Split(ca, System.StringSplitOptions.RemoveEmptyEntries))
+#endif
+
+    let trim (c : char list) =
+        let ca = Array.ofList c 
+        fun (s:string) -> s.Trim(ca)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fsi
new file mode 100644
index 0000000..09452f2
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Compat.String.fsi
@@ -0,0 +1,98 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+/// Compatibility module for string processing.  Richer string operations
+/// are available via the member functions on strings and other functionality in
+/// the <c>System.String</c> type
+/// and the <c>System.Text.RegularExpressions</c> namespace.
+[<RequireQualifiedAccess>]
+module String = 
+
+    /// Return a string with the first character converted to uppercase.
+    val capitalize: string -> string
+
+    /// Return a string with the first character converted to lowercase.
+    val uncapitalize: string -> string
+
+#if FX_NO_STRING_SPLIT_OPTIONS
+#else
+    /// Split the string using the given list of separator characters.
+    /// Trimming is also performed at both ends of the string and any empty
+    /// strings that result from the split are discarded.
+    val split: char list -> (string -> string list)
+#endif
+
+    /// Removes all occurrences of a set of characters specified in a
+    /// list from the beginning and end of this instance.
+    val trim: char list -> (string -> string)
+
+    /// Compare the given strings using ordinal comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'Operators.compare' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val compare: string -> string -> int
+
+    /// Returns the character at the specified position in the string
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.[i]' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val get: string -> int -> char
+
+    /// Return a substring of length 'length' starting index 'start'.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.[i..j]' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val sub: string -> start:int -> length:int -> string
+
+    /// Return a new string with all characters converted to lowercase
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.ToLower()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val lowercase: string -> string
+
+    /// Return a string of the given length containing repetitions of the given character
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'String.replicate' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val make: int -> char -> string
+
+    /// Return s string of length 1 containing the given character
+    [<CompilerMessage("This construct is for ML compatibility. Consider using the overloaded 'string' operator instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val of_char: char -> string
+
+    /// Return true is the given string contains the given character
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.Contains' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val contains: string -> char -> bool
+
+    /// Return true is the given string contains the given character in the
+    /// range specified by the given start index and the given length
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.IndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val contains_between: string -> start:int -> length:int -> char -> bool
+
+    /// Return true is the given string contains the given character in the
+    /// range from the given start index to the end of the string.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.IndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val contains_from: string -> int -> char -> bool
+
+    /// Return the first index of the given character in the
+    /// string.  Raise <c>KeyNotFoundException</c> if
+    /// the string does not contain the given character.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.IndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val index: string -> char -> int
+
+    /// Return the first index of the given character in the
+    /// range from the given start position to the end of the string.  
+    /// Raise <c>KeyNotFoundException</c> if
+    /// the string does not contain the given character.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.IndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val index_from: string -> start:int -> char -> int
+
+    /// Return true if the string contains the given character prior to the given index
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.LastIndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rcontains_from: string -> start:int -> char -> bool
+
+    /// Return the index of the first occurrence of the given character 
+    /// from the end of the string proceeding backwards
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.LastIndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rindex: string -> char -> int
+
+    /// Return the index of the first occurrence of the given character 
+    /// starting from the given index proceeding backwards.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.LastIndexOf' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val rindex_from: string -> start:int -> char -> int
+
+    /// Return a string with all characters converted to uppercase.
+    [<CompilerMessage("This construct is for ML compatibility. Consider using 'str.ToUpper' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val uppercase: string -> string
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/CompilerLocationUtils.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/CompilerLocationUtils.fs
new file mode 100644
index 0000000..89f8e9f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/CompilerLocationUtils.fs
@@ -0,0 +1,213 @@
+namespace Internal.Utilities
+open System
+open System.IO
+open System.Configuration
+open System.Reflection
+open Microsoft.Win32
+open System.Runtime.InteropServices
+
+#nowarn "44" // ConfigurationSettings is obsolete but the new stuff is horribly complicated. 
+
+module internal FSharpEnvironment =
+
+    let FSharpCoreLibRunningVersion = 
+        try match (typeof<Microsoft.FSharp.Collections.List<int>>).Assembly.GetName().Version.ToString() with
+            | null -> None
+            | "" -> None
+            | s  -> Some(s)
+        with _ -> None
+
+    // The F# team version number. This version number is used for
+    //     - the F# version number reported by the fsc.exe and fsi.exe banners in the CTP release
+    //     - the F# version number printed in the HTML documentation generator
+    //     - the .NET DLL version number for all VS2008 DLLs
+    //     - the VS2008 registry key, written by the VS2008 installer
+    //         HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.FSharp-" + FSharpTeamVersionNumber
+    // Also
+    //     - for Beta2, the language revision number indicated on the F# language spec
+    //
+    // It is NOT the version number listed on FSharp.Core.dll
+    let FSharpTeamVersionNumber = "2.0.50727.0"
+
+    // The F# binary format revision number. The first three digits of this form the significant part of the 
+    // format revision number for F# binary signature and optimization metadata. The last digit is not significant.
+    //
+    // WARNING: Do not change this revision number unless you absolutely know what you're doing.
+    let FSharpBinaryMetadataFormatRevision = "2.0.0.0"
+
+    [<DllImport("Advapi32.dll", CharSet = CharSet.Unicode, BestFitMapping = false)>]
+    extern uint32 RegOpenKeyExW(UIntPtr _hKey, string _lpSubKey, uint32 _ulOptions, int _samDesired, UIntPtr & _phkResult);
+
+    [<DllImport("Advapi32.dll", CharSet = CharSet.Unicode, BestFitMapping = false)>]
+    extern uint32 RegQueryValueExW(UIntPtr _hKey, string _lpValueName, uint32 _lpReserved, uint32 & _lpType, IntPtr _lpData, int & _lpchData);
+
+    [<DllImport("Advapi32.dll")>]
+    extern uint32 RegCloseKey(UIntPtr _hKey)
+
+    module Option = 
+        /// Convert string into Option string where null and String.Empty result in None
+        let ofString s = 
+            if String.IsNullOrEmpty(s) then None
+            else Some(s)
+
+            
+        
+
+    // MaxPath accounts for the null-terminating character, for example, the maximum path on the D drive is "D:\<256 chars>\0". 
+    // See: ndp\clr\src\BCL\System\IO\Path.cs
+    let maxPath = 260;
+    let maxDataLength = (new System.Text.UTF32Encoding()).GetMaxByteCount(maxPath)
+    let KEY_WOW64_DEFAULT = 0x0000
+    let KEY_WOW64_32KEY = 0x0200
+    let HKEY_LOCAL_MACHINE = UIntPtr(0x80000002u)
+    let KEY_QUERY_VALUE = 0x1
+    let REG_SZ = 1u
+
+    let GetDefaultRegistryStringValueViaDotNet(subKey: string)  =
+        Option.ofString
+            (try
+                downcast Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\"+subKey,null,null)
+             with e->
+                System.Diagnostics.Debug.Assert(false, sprintf "Failed in GetDefaultRegistryStringValueViaDotNet: %s" (e.ToString()))
+                null)
+
+    let Get32BitRegistryStringValueViaPInvoke(subKey:string) = 
+        Option.ofString
+            (try 
+                // 64 bit flag is not available <= Win2k
+                let options = 
+                    match Environment.OSVersion.Version.Major with
+                    | major when major >= 5 -> KEY_WOW64_32KEY
+                    | _ -> KEY_WOW64_DEFAULT
+
+
+                let mutable hkey = UIntPtr.Zero;
+                let pathResult = Marshal.AllocCoTaskMem(maxDataLength);
+
+                try
+                    let res = RegOpenKeyExW(HKEY_LOCAL_MACHINE,subKey, 0u, KEY_QUERY_VALUE ||| options, & hkey)
+                    if res = 0u then
+                        let mutable uType = REG_SZ;
+                        let mutable cbData = maxDataLength;
+
+                        let res = RegQueryValueExW(hkey, null, 0u, &uType, pathResult, &cbData);
+
+                        if (res = 0u && cbData > 0 && cbData <= maxDataLength) then
+                            Marshal.PtrToStringUni(pathResult, (cbData - 2)/2);
+                        else 
+                            null
+                    else
+                        null
+                finally
+                    if hkey <> UIntPtr.Zero then
+                        RegCloseKey(hkey) |> ignore
+                
+                    if pathResult <> IntPtr.Zero then
+                        Marshal.FreeCoTaskMem(pathResult)
+             with e->
+                System.Diagnostics.Debug.Assert(false, sprintf "Failed in Get32BitRegistryStringValueViaPInvoke: %s" (e.ToString()))
+                null)
+
+    let is32Bit = IntPtr.Size = 4
+    
+    let tryRegKey(subKey:string) = 
+
+        if is32Bit then
+            let s = GetDefaultRegistryStringValueViaDotNet(subKey)
+            // If we got here AND we're on a 32-bit OS then we can validate that Get32BitRegistryStringValueViaPInvoke(...) works
+            // by comparing against the result from GetDefaultRegistryStringValueViaDotNet(...)
+#if DEBUG
+            let viaPinvoke = Get32BitRegistryStringValueViaPInvoke(subKey)
+            System.Diagnostics.Debug.Assert((s = viaPinvoke), sprintf "32bit path: pi=%A def=%A" viaPinvoke s)
+#endif
+            s
+        else
+            Get32BitRegistryStringValueViaPInvoke(subKey) 
+               
+
+    let internal tryCurrentDomain() = 
+        let pathFromCurrentDomain = System.AppDomain.CurrentDomain.BaseDirectory
+        if not(String.IsNullOrEmpty(pathFromCurrentDomain)) then 
+            Some pathFromCurrentDomain
+        else
+            None
+    
+    let internal tryAppConfig (appConfigKey:string) = 
+
+        let locationFromAppConfig = ConfigurationSettings.AppSettings.[appConfigKey]
+        System.Diagnostics.Debug.Print(sprintf "Considering appConfigKey %s which has value '%s'" appConfigKey locationFromAppConfig) 
+
+        if String.IsNullOrEmpty(locationFromAppConfig) then 
+            None
+        else
+            let exeAssemblyFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
+            let locationFromAppConfig = locationFromAppConfig.Replace("{exepath}", exeAssemblyFolder)
+            System.Diagnostics.Debug.Print(sprintf "Using path %s" locationFromAppConfig) 
+            Some locationFromAppConfig
+
+    // The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running
+    // Used for
+    //     - location of design-time copies of FSharp.Core.dll and FSharp.Compiler.Interactive.Settings.dll for the default assumed environment for scripts
+    //     - default ToolPath in tasks in FSharp.Build.dll (for Fsc tasks)
+    //     - default F# binaries directory in service.fs (REVIEW: check this)
+    //     - default location of fsi.exe in FSharp.VS.FSI.dll
+    //     - default location of fsc.exe in Test.Compiler.CodeDom.dll
+    let BinFolderOfDefaultFSharpCompiler = 
+        // Check for an app.config setting to redirect the default compiler location
+        // Like fsharp-compiler-location
+        try 
+            let result = tryAppConfig "fsharp-compiler-location"
+            match result with 
+            | Some _ ->  result 
+            | None -> 
+
+                // Note: If the keys below change, be sure to update code in:
+                // Property pages (ApplicationPropPage.vb)
+
+                let key20 = @"Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.FSharp-" + FSharpTeamVersionNumber 
+                let key40 = @"Software\Microsoft\FSharp\2.0\Runtime\v4.0"
+                let key1,key2 = 
+                    match FSharpCoreLibRunningVersion with 
+                    | None -> key20,key40 
+                    | Some v -> if v.Length > 1 && v.[0] <= '3' then key20,key40 else key40,key20
+                
+                let result = tryRegKey key1
+                match result with 
+                | Some _ ->  result 
+                | None -> 
+                    let result =  tryRegKey key2
+                    match result with 
+                    | Some _ ->  result 
+                    | None -> 
+
+            // This was failing on rolling build for staging because the prototype compiler doesn't have the key. Disable there.
+            #if FX_ATLEAST_40_COMPILER_LOCATION
+                        System.Diagnostics.Debug.Assert(result<>None, sprintf "Could not find location of compiler at '%s' or '%s'" key1 key2)
+            #endif                                
+                          
+                            // For the prototype compiler, we can just use the current domain
+                        tryCurrentDomain()
+        with e -> 
+            System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# compiler")
+            None
+
+    let BinFolderOfFSharpPowerPack = 
+        try 
+            // Check for an app.config setting to redirect the default compiler location
+            // Like fsharp-compiler-location
+            let result = tryAppConfig "fsharp-powerpack-location"
+            match result with 
+            | Some _ ->  result 
+            | None -> 
+
+                let key20 = @"Software\Microsoft\.NETFramework\AssemblyFolders\Test.PowerPack-" + FSharpTeamVersionNumber 
+                let result = tryRegKey key20
+                match result with 
+                | Some _ ->  result 
+                | None -> 
+                      
+                    tryCurrentDomain()
+
+        with e -> 
+            System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# power pack tools")
+            None
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fs
new file mode 100644
index 0000000..4560ee9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fs
@@ -0,0 +1,166 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections.Generic
+open Microsoft.FSharp.Collections
+                                 
+// Each entry in the HashMultiMap dictionary has at least one entry. Under normal usage each entry has _only_
+// one entry. So use two hash tables: one for the main entries and one for the overflow.
+[<Sealed>]
+type HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>) = 
+    let firstEntries = new Dictionary<_,_>(n,hasheq);
+    let rest = new Dictionary<_,_>(3,hasheq);
+ 
+    new (hasheq : IEqualityComparer<'Key>) = new HashMultiMap<'Key,'Value>(11, hasheq)
+    new (seq : seq<'Key * 'Value>, hasheq : IEqualityComparer<'Key>) as x = 
+        new HashMultiMap<'Key,'Value>(11, hasheq)
+        then seq |> Seq.iter (fun (k,v) -> x.Add(k,v))
+
+    new (seq : seq<'Key * 'Value>) =  failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    new (n:int) = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    new () = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+
+    static member Create (seq : seq<'Key * 'Value>) =  failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    static member Create (n:int) = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+    static member Create () = failwith "unreachable: obsolete and error"; new HashMultiMap<'Key,'Value>()
+
+
+    member x.GetRest(k) = 
+        let mutable res = []
+        let ok = rest.TryGetValue(k,&res)
+        if ok then res else []
+
+    member x.Add(y,z) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then 
+            rest.[y] <- res :: x.GetRest(y)
+        firstEntries.[y] <- z
+
+    member x.Clear() = 
+         firstEntries.Clear()
+         rest.Clear()
+
+    member x.FirstEntries = firstEntries
+    member x.Rest = rest
+    member x.Copy() = 
+        let res = new HashMultiMap<'Key,'Value>(firstEntries.Count,firstEntries.Comparer) 
+        for kvp in firstEntries do 
+             res.FirstEntries.Add(kvp.Key,kvp.Value)
+        for kvp in rest do 
+             res.Rest.Add(kvp.Key,kvp.Value)
+        res
+
+    member x.Item 
+        with get(y : 'Key) = 
+            let mutable res = Unchecked.defaultof<'Value>
+            let ok = firstEntries.TryGetValue(y,&res)
+            if ok then res else raise (new System.Collections.Generic.KeyNotFoundException("The item was not found in collection"))
+        and set (y:'Key) (z:'Value) = 
+            x.Replace(y,z)
+
+    member x.FindAll(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then res :: x.GetRest(y) else []
+
+    member x.Fold f acc = 
+        let mutable res = acc
+        for kvp in firstEntries do
+            res <- f kvp.Key kvp.Value res
+            match x.GetRest(kvp.Key)  with
+            | [] -> ()
+            | rest -> 
+                for z in rest do
+                    res <- f kvp.Key z res
+        res
+
+    member x.Iterate(f) =  
+        for kvp in firstEntries do
+            f kvp.Key kvp.Value
+            match x.GetRest(kvp.Key)  with
+            | [] -> ()
+            | rest -> 
+                for z in rest do
+                    f kvp.Key z
+
+    member x.Contains(y) = firstEntries.ContainsKey(y)
+
+    member x.ContainsKey(y) = firstEntries.ContainsKey(y)
+
+    member x.Remove(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        // Note, if not ok then nothing to remove - nop
+        if ok then 
+            // We drop the FirstEntry. Here we compute the new FirstEntry and residue MoreEntries
+            let mutable res = []
+            let ok = rest.TryGetValue(y,&res)
+            if ok then 
+                match res with 
+                | [h] -> 
+                    firstEntries.[y] <- h; 
+                    rest.Remove(y) |> ignore
+                | (h::t) -> 
+                    firstEntries.[y] <- h
+                    rest.[y] <- t
+                | _ -> 
+                    // note: broken invariant
+                    ()
+            else
+                firstEntries.Remove(y) |> ignore 
+
+    member x.Replace(y,z) = 
+        firstEntries.[y] <- z
+
+    member x.TryFind(y) = 
+        let mutable res = Unchecked.defaultof<'Value>
+        let ok = firstEntries.TryGetValue(y,&res)
+        if ok then Some(res) else None
+
+    member x.Count = firstEntries.Count
+
+    interface IEnumerable<KeyValuePair<'Key, 'Value>> with
+        member s.GetEnumerator() = 
+            let elems = new System.Collections.Generic.List<_>(firstEntries.Count + rest.Count)
+            for kvp in firstEntries do
+                elems.Add(kvp)
+                for z in s.GetRest(kvp.Key) do
+                   elems.Add(KeyValuePair(kvp.Key, z))
+            (elems.GetEnumerator() :> IEnumerator<_>)
+
+    interface System.Collections.IEnumerable with
+        member s.GetEnumerator() = ((s :> seq<_>).GetEnumerator() :> System.Collections.IEnumerator)
+
+    interface IDictionary<'Key, 'Value> with 
+        member s.Item 
+            with get x = s.[x]            
+            and  set x v = s.[x] <- v
+            
+        member s.Keys = ([| for kvp in s -> kvp.Key |] :> ICollection<'Key>)
+        member s.Values = ([| for kvp in s -> kvp.Value |] :> ICollection<'Value>)
+        member s.Add(k,v) = s.[k] <- v
+        member s.ContainsKey(k) = s.ContainsKey(k)
+        member s.TryGetValue(k,r) = if s.ContainsKey(k) then (r <- s.[k]; true) else false
+        member s.Remove(k:'Key) = 
+            let res = s.ContainsKey(k) in 
+            s.Remove(k); res
+
+    interface ICollection<KeyValuePair<'Key, 'Value>> with 
+        member s.Add(x) = s.[x.Key] <- x.Value
+        member s.Clear() = s.Clear()            
+        member s.Remove(x) = 
+            let res = s.ContainsKey(x.Key) 
+            if res && Unchecked.equals s.[x.Key] x.Value then 
+                s.Remove(x.Key); 
+            res
+        member s.Contains(x) = 
+            s.ContainsKey(x.Key) && 
+            Unchecked.equals s.[x.Key] x.Value
+        member s.CopyTo(arr,arrIndex) = s |> Seq.iteri (fun j x -> arr.[arrIndex+j] <- x)
+        member s.IsReadOnly = false
+        member s.Count = s.Count
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fsi
new file mode 100644
index 0000000..26bc031
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashMultiMap.fsi
@@ -0,0 +1,84 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+/// This namespace contains Test.PowerPack extensions for the F# collection types
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections.Generic
+
+
+/// Hash tables, by default based on F# structural "hash" and (=) functions. 
+/// The table may map a single key to multiple bindings.
+[<Sealed>]
+type HashMultiMap<'Key,'Value> =
+    /// Create a new empty mutable HashMultiMap with the given key hash/equality functions
+    new : comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
+    
+    /// Create a new empty mutable HashMultiMap with an internal bucket array of the given approximate size
+    /// and with the given key hash/equality functions
+    new : size:int * comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
+    
+    /// Build a map that contains the bindings of the given IEnumerable
+    new : entries:seq<'Key * 'Value> * comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
+
+    /// Make a shallow copy of the collection
+    member Copy    : unit    -> HashMultiMap<'Key,'Value>
+    
+    /// Add a binding for the element to the table
+    member Add     : 'Key * 'Value -> unit
+    
+    /// Clear all elements from the collection
+    member Clear   : unit    -> unit
+    
+    /// Test if the collection contains any bindings for the given element
+    member ContainsKey: 'Key -> bool
+
+    /// Remove the latest binding (if any) for the given element from the table
+    member Remove : 'Key -> unit
+
+    /// Replace the latest binding (if any) for the given element.
+    member Replace : 'Key * 'Value -> unit
+
+    /// Lookup or set the given element in the table. Set replaces all existing bindings for a value with a single
+    /// bindings. Raise <c>KeyNotFoundException</c> if the element is not found.
+    member Item : 'Key -> 'Value with get,set
+
+    /// Lookup the given element in the table, returning the result as an Option
+    member TryFind : 'Key      -> 'Value option
+    
+    /// Find all bindings for the given element in the table, if any
+    member FindAll : 'Key      -> 'Value list
+
+    /// Apply the given function to each element in the collection threading the accumulating parameter
+    /// through the sequence of function applications
+    member Fold    : ('Key -> 'Value -> 'State -> 'State) -> 'State -> 'State
+
+    /// The total number of keys in the hash table
+    member Count   : int
+
+    ///Apply the given function to each binding in the hash table 
+    member Iterate : ('Key -> 'Value -> unit) -> unit
+
+    interface IDictionary<'Key, 'Value>         
+    interface ICollection<KeyValuePair<'Key, 'Value>> 
+    interface IEnumerable<KeyValuePair<'Key, 'Value>>         
+    interface System.Collections.IEnumerable 
+    
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    new : unit -> HashMultiMap<'Key,'Value>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(size, HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    new : size:int -> HashMultiMap<'Key,'Value>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(entries, HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    new : entries:seq<'Key * 'Value> -> HashMultiMap<'Key,'Value>
+
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    static member Create : unit -> HashMultiMap<'Key,'Value>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(size, HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    static member Create : size:int -> HashMultiMap<'Key,'Value>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashMultiMap<_,_>(entries, HashIdentity.Structural) instead to create a HashMultiMap using F# generic hashing and equality", true)>]
+    static member Create : entries:seq<'Key * 'Value> -> HashMultiMap<'Key,'Value>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fs
new file mode 100644
index 0000000..2894cc4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fs
@@ -0,0 +1,54 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections
+open System.Collections.Generic
+
+// HashSets are currently implemented using the .NET Dictionary type. 
+[<Sealed>]
+type HashSet<'T>(t: Dictionary<'T,int>) = 
+
+    new (hasheq: IEqualityComparer<'T>) = 
+        new HashSet<_>(new Dictionary<_,_>(hasheq))
+
+    new (size:int,hasheq: IEqualityComparer<'T>) = 
+        new HashSet<_>(new Dictionary<_,_>(size,hasheq))
+
+    new (elements:seq<'T>, hasheq: IEqualityComparer<'T>) as t = 
+        new HashSet<_>(new Dictionary<_,_>(hasheq)) 
+        then 
+           for x in elements do t.Add x
+
+    new (size:int) = failwith "unreachable"; new HashSet<'T>(11)
+
+    new () = failwith "unreachable"; new HashSet<'T>(11)
+
+    new (seq:seq<'T>) = failwith "unreachable"; new HashSet<'T>(11)
+        
+    member x.Add(y)    = t.[y] <- 0
+
+    member x.Clear() = t.Clear()
+
+    member x.Copy() : HashSet<'T>  = 
+        let t2 = new Dictionary<'T,int>(t.Count,t.Comparer) in 
+        t |> Seq.iter (fun kvp -> t2.[kvp.Key] <- 0); 
+        new HashSet<'T>(t2)
+
+    member x.Fold f acc = 
+        let mutable res = acc
+        for kvp in t do
+            res <- f kvp.Key res
+        res
+
+    member x.Iterate(f) =  t |> Seq.iter (fun kvp -> f kvp.Key)
+
+    member x.Contains(y) = t.ContainsKey(y)
+    member x.Remove(y) = t.Remove(y) |> ignore
+    member x.Count = t.Count
+    interface IEnumerable<'T> with
+        member x.GetEnumerator() = t.Keys.GetEnumerator() :> IEnumerator<_>
+    interface System.Collections.IEnumerable with
+        member x.GetEnumerator() = t.Keys.GetEnumerator()  :> IEnumerator 
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fsi
new file mode 100644
index 0000000..e54bec6
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/HashSet.fsi
@@ -0,0 +1,59 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections.Generic
+
+/// Mutable hash sets based by default on F# structural "hash" and (=) functions. Implemented via a hash table and/or Dictionary.
+[<Sealed>]
+[<Obsolete("The HashSet<_> type from the F# Power Pack is now deprecated. Use the System.Collections.Generic.HashSet<_> type from System.Core.dll instead.")>]
+type HashSet<'T>  =
+
+    /// Create a new empty mutable hash set using the given key hash/equality functions 
+    new : comparer:IEqualityComparer<'T> -> HashSet<'T>
+
+    /// Create a new empty mutable hash set with an internal bucket array of the given approximate size
+    /// and with the given key hash/equality functions 
+    new : size:int * comparer:IEqualityComparer<'T> -> HashSet<'T>
+
+    /// Create a new mutable hash set with the given elements and using the given key hash/equality functions 
+    new : elements:seq<'T> * comparer:IEqualityComparer<'T>  -> HashSet<'T>
+    
+    /// Make a shallow copy of the set
+    member Copy    : unit -> HashSet<'T>
+    
+    /// Add an element to the collection
+    member Add     : 'T   -> unit
+    
+    /// Clear all elements from the set
+    member Clear   : unit -> unit
+    
+    /// Test if the set contains the given element
+    member Contains: 'T   -> bool
+    
+    /// Remove the given element from the set
+    member Remove  : 'T   -> unit
+    
+    /// Apply the given function to the set threading the accumulating parameter
+    /// through the sequence of function applications
+    member Fold    : ('T -> 'State -> 'State) -> 'State -> 'State
+
+    /// The total number of elements in the set
+    member Count   : int
+
+    /// Apply the given function to each binding in the hash table 
+    member Iterate : ('T -> unit) -> unit
+
+    interface IEnumerable<'T> 
+    interface System.Collections.IEnumerable 
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashSet<_>(HashIdentity.Structural) to create a HashSet using F# generic hashing and equality", true)>]
+    new : unit -> HashSet<'T>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashSet<_>(size, HashIdentity.Structural) to create a HashSet using F# generic hashing and equality", true)>]
+    new : size:int -> HashSet<'T>
+
+    [<System.Obsolete("This member has been redesigned. Use 'new HashSet<_>(elements, HashIdentity.Structural) to create a HashSet using F# generic hashing and equality", true)>]
+    new : elements:seq<'T> -> HashSet<'T>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fs
new file mode 100644
index 0000000..fb21c10
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fs
@@ -0,0 +1,15 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Math
+
+#nowarn "42"
+
+module Measure =
+
+    let infinity<[<Measure>] 'u> : float<'u> = LanguagePrimitives.FloatWithMeasure System.Double.PositiveInfinity
+    let nan<[<Measure>] 'u> : float<'u> = LanguagePrimitives.FloatWithMeasure System.Double.NaN
+
+    let infinityf<[<Measure>] 'u> : float32<'u> = LanguagePrimitives.Float32WithMeasure System.Single.PositiveInfinity
+    let nanf<[<Measure>] 'u> : float32<'u> = LanguagePrimitives.Float32WithMeasure System.Single.NaN
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fsi
new file mode 100644
index 0000000..64ab185
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Measure.fsi
@@ -0,0 +1,25 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Math
+
+#nowarn "42"
+
+module Measure =
+
+    /// <summary>Version of <c>System.Double.PositiveInfinity</c> that is generic in its units-of-measure</summary>
+    [<GeneralizableValue>]
+    val infinity<[<Measure>] 'u> : float<'u>
+
+    /// <summary>Version of <c>System.Double.NaN</c> that is generic in its units-of-measure</summary>
+    [<GeneralizableValue>]
+    val nan<[<Measure>] 'u> : float<'u> 
+
+    /// <summary>Version of <c>System.Single.PositiveInfinity</c> that is generic in its units-of-measure</summary>
+    [<GeneralizableValue>]
+    val infinityf<[<Measure>] 'u> : float32<'u> 
+
+    /// <summary>Version of <c>System.Single.NaN</c> that is generic in its units-of-measure</summary>
+    [<GeneralizableValue>]
+    val nanf<[<Measure>] 'u> : float32<'u>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fs
new file mode 100644
index 0000000..6e1a5c0
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fs
@@ -0,0 +1,105 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.NativeInterop
+
+#nowarn "44"
+#nowarn "9" // unverifiable constructs
+#nowarn "51" // The address-of operator may result in non-verifiable code. Its use is restricted to passing byrefs to functions that require them
+
+open System
+open System.Runtime.InteropServices
+open Microsoft.FSharp.NativeInterop
+
+module NativeOps = 
+    [<NoDynamicInvocation>]
+    let inline pinObjUnscoped (obj: obj) =  GCHandle.Alloc(obj,GCHandleType.Pinned) 
+    [<NoDynamicInvocation>]
+    let inline pinObj (obj: obj) f = 
+        let gch = pinObjUnscoped obj 
+        try f gch
+        finally
+            gch.Free()
+
+[<Sealed>]
+type NativeArray<'T when 'T : unmanaged>(ptr : nativeptr<'T>, len: int) =
+    member x.Ptr = ptr
+    [<NoDynamicInvocation>]
+    member inline x.Item 
+       with get n = NativePtr.get x.Ptr n
+       and  set n v = NativePtr.set x.Ptr n v
+    member x.Length = len
+
+[<Sealed>]
+type FortranMatrix<'T when 'T : unmanaged>(ptr : nativeptr<'T>, nrows: int, ncols:int) = 
+    member x.NumCols = ncols
+    member x.NumRows = nrows
+    member x.Ptr = ptr
+    [<NoDynamicInvocation>]
+    member inline x.Item 
+       with get (row,col) = NativePtr.get x.Ptr (row + col*x.NumRows)
+       and  set (row,col) v = NativePtr.set x.Ptr (row + col*x.NumRows) v
+    member x.NativeTranspose = new CMatrix<_>(ptr,ncols,nrows)
+  
+and 
+  [<Sealed>]
+  NativeArray2<'T when 'T : unmanaged>(ptr : nativeptr<'T>, nrows:int, ncols: int) = 
+    member x.Ptr = ptr
+    member x.NumRows = nrows
+    member x.NumCols = ncols
+    [<NoDynamicInvocation>]
+    member inline x.Item 
+       with get (row,col) = NativePtr.get x.Ptr (row*x.NumCols + col)
+       and  set (row,col) v = NativePtr.set x.Ptr (row*x.NumCols + col) v
+    member x.NativeTranspose = new FortranMatrix<_>(x.Ptr,ncols,nrows)
+  
+and CMatrix<'T when 'T : unmanaged> = NativeArray2<'T> 
+
+module Ref = 
+    [<NoDynamicInvocation>]
+    let inline pin (ref: 'T ref) (f : nativeptr<'T> -> 'b) = 
+        NativeOps.pinObj (box ref) (fun gch -> 
+            f (gch.AddrOfPinnedObject() |> NativePtr.ofNativeInt))
+
+open Microsoft.FSharp.Math
+
+[<Sealed>]
+type PinnedArray<'T when 'T : unmanaged>(narray: NativeArray<'T>, gch: GCHandle) =
+    [<NoDynamicInvocation>]
+    static member inline of_array(arr: 'T[]) =
+        let gch = NativeOps.pinObjUnscoped (box arr) 
+        let ptr = &&arr.[0]
+        new PinnedArray<'T>(new NativeArray<_>(ptr,Array.length arr),gch)
+
+    member x.Ptr = narray.Ptr
+    member x.Free() = gch.Free()
+    member x.Length = narray.Length
+    member x.NativeArray = narray
+    interface System.IDisposable with 
+        member x.Dispose() = gch.Free()
+        
+
+[<Sealed>]
+type PinnedArray2<'T when 'T : unmanaged>(narray: NativeArray2<'T>, gch: GCHandle) =
+
+    [<NoDynamicInvocation>]
+    static member inline of_array2(arr: 'T[,]) = 
+        let gch = NativeOps.pinObjUnscoped (box arr) 
+        let ptr = &&arr.[0,0]
+        new PinnedArray2<'T>(new NativeArray2<_>(ptr,Array2D.length1 arr,Array2D.length2 arr),gch)
+
+    [<NoDynamicInvocation>]
+    static member inline of_array2D(arr: 'T[,]) = 
+        let gch = NativeOps.pinObjUnscoped (box arr) 
+        let ptr = &&arr.[0,0]
+        new PinnedArray2<'T>(new NativeArray2<_>(ptr,Array2D.length1 arr,Array2D.length2 arr),gch)
+
+
+    member x.Ptr = narray.Ptr
+    member x.Free() = gch.Free()
+    member x.NumRows = narray.NumRows
+    member x.NumCols = narray.NumCols
+    member x.NativeArray = narray
+    interface System.IDisposable with 
+        member x.Dispose() = gch.Free()
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fsi
new file mode 100644
index 0000000..f87f846
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/NativeArray.fsi
@@ -0,0 +1,158 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.NativeInterop
+
+open System.Runtime.InteropServices
+
+/// This type wraps a pointer to a blob of unmanaged memory assumed to contain
+/// a C-style one-dimensional array of items compatible with the (presumably blittable) 
+/// type 'T.  The blob of memory must be allocated and managed externally, 
+/// e.g. by a computation routine written in C.
+///
+/// All operations on this type are marked inlined
+/// because the code used to implement the operations is not verifiable.  
+///
+/// Any code that uses these operations will be unverifiable and may 
+/// cause memory corruption if not used with extreme care.
+[<Sealed>]
+type NativeArray<'T when 'T : unmanaged> =
+
+    /// Creates a C-style one dimensional array from a native pointer and the length of the array
+    /// Nothing is actually copied.
+    new : startAddress: nativeptr<'T> * length: int -> NativeArray<'T>
+
+    /// Pointer to the C-style one-dimensional array
+    member Ptr: nativeptr<'T>
+
+    /// Get or set an entry in the array
+    [<Unverifiable>]
+    [<NoDynamicInvocation>]
+    member inline Item : int -> 'T with get,set
+
+    /// Length of the C-style one-dimensional array
+    member Length : int
+
+/// This type wraps a pointer to a blob of unmanaged memory assumed to contain
+/// a C-style row major two-dimensional matrix of items compatible with the (presumably blittable) 
+/// type 'T. The blob of memory must be allocated and managed externally, 
+/// e.g. by a computation routine written in C.
+///
+/// All operations on this type are marked inlined
+/// because the code used to implement the operations is not verifiable.  
+///
+/// Any code that uses these operations will be unverifiable and may 
+/// cause memory corruption if not used with extreme care.
+
+[<Sealed>]
+type NativeArray2<'T when 'T : unmanaged> =
+    /// Creates a C-style row major two-dimensional array from a native pointer, the number of rows and the number of columns.  
+    /// Nothing is actually copied.
+    new : nativeptr<'T> * nrows:int * ncols:int -> NativeArray2<'T>
+
+    /// Pointer to the C-style row major two-dimensional array 
+    member Ptr: nativeptr<'T>
+
+    /// Get the number of rows of the native array
+    member NumRows : int
+
+    /// Get the number of columns of the native array
+    member NumCols : int
+
+    /// Get or set an entry in the array
+    [<Unverifiable>]
+    [<NoDynamicInvocation>]
+    member inline Item : int * int -> 'T with get,set
+
+    /// View a CMatrix as a FortranMatrix.  Doesn't actually allocate
+    /// a new matirx - just gives a different label to the same bits, and swaps the
+    /// row/column count information associated with the bits.
+    member NativeTranspose : FortranMatrix<'T>
+
+/// See NativeArray2
+and CMatrix<'T  when 'T : unmanaged> = NativeArray2<'T> 
+
+/// This type wraps a pointer to a blob of unmanaged memory assumed to contain
+/// a Fortran-style column major two-dimensional matrix of items compatible with the (presumably blittable) 
+/// type 'T. The blob of memory must be allocated and managed externally, 
+/// e.g. by a computation routine written in C.
+///
+/// All operations on this type are marked inlined
+/// because the code used to implement the operations is not verifiable.  
+///
+/// Any code that uses these operations will be unverifiable and may 
+/// cause memory corruption if not used with extreme care.
+and 
+   [<Sealed>]
+   FortranMatrix<'T when 'T : unmanaged> =
+    new : nativeptr<'T> * nrows:int * ncols:int -> FortranMatrix<'T>
+
+    member Ptr: nativeptr<'T>
+
+    member NumRows : int
+    member NumCols : int
+
+    /// Get or set an entry in the array
+    [<Unverifiable>]
+    [<NoDynamicInvocation>]
+    member inline Item : int * int -> 'T with get,set
+    
+    /// View a FortranMatrix as a CMatrix.  Doesn't actually allocate
+    /// a new matirx - just gives a different label to the same bits, and swaps the
+    /// row/column count information associated with the bits.
+    member NativeTranspose : CMatrix<'T>
+  
+module Ref =
+    /// Pin the given ref for the duration of a single call to the given function.  A native pointer to
+    /// the contents of the ref is passed to the given function.  Cleanup the GCHandle associated with the 
+    /// pin when the function completes, even if an exception is raised.
+    [<Unverifiable>]
+    [<NoDynamicInvocation>]
+    val inline pin : 'T ref -> (nativeptr<'T> -> 'U) -> 'U
+
+/// Represents a pinned handle to a structure with an underlying 1D array, i.e. an underlying NativeArray.
+/// Used when interfacing with native code math libraries such as LAPACK.
+[<Sealed>]
+type PinnedArray<'T  when 'T : unmanaged> =
+
+    new : NativeArray<'T> * GCHandle -> PinnedArray<'T>
+
+    interface System.IDisposable 
+    member Ptr : nativeptr<'T> 
+
+    member Length : int 
+
+    member NativeArray : NativeArray<'T>
+
+    /// For native interop. Pin the given object
+    [<NoDynamicInvocation>]
+    static member inline of_array : 'T[] -> PinnedArray<'T>
+
+    member Free : unit -> unit
+
+/// Represents a pinned handle to a structure with an underlying 2D array, i.e. an underlying NativeArray2.
+/// Used when interfacing with native code math libraries such as LAPACK.
+[<Sealed>]
+type PinnedArray2<'T when 'T : unmanaged> =
+
+    interface System.IDisposable 
+    new : NativeArray2<'T> * GCHandle -> PinnedArray2<'T> 
+
+    member Ptr : nativeptr<'T> 
+
+    member NumRows : int 
+
+    member NumCols : int 
+
+    member NativeArray : NativeArray2<'T>
+
+    /// For native interop. Pin the given object
+    [<NoDynamicInvocation>]
+    [<System.Obsolete("This method has been renamed to of_array2D")>]
+    static member inline of_array2 : 'T[,] -> PinnedArray2<'T>
+
+    /// For native interop. Pin the given object
+    [<NoDynamicInvocation>]
+    static member inline of_array2D : 'T[,] -> PinnedArray2<'T>
+
+    member Free : unit -> unit
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PhysicalConstants.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PhysicalConstants.fs
new file mode 100644
index 0000000..7d0f556
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PhysicalConstants.fs
@@ -0,0 +1,91 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+open Microsoft.FSharp.Math.SI
+
+/// Fundamental physical constants, with units-of-measure
+// Selected from frequently used constants at http://physics.nist.gov/cuu/Constants/index.html
+module PhysicalConstants =
+
+  /// speed of light in vacuum
+  [<Literal>]
+  let c = 299792458.0<m/s>
+
+  /// magnetic constant
+  [<Literal>]
+  let mu0 = 12.566370614e-7<N A^-2>
+
+  /// electric constant = 1/(mu0 c^2)
+  [<Literal>]
+  let epsilon0 = 8.854187817e-12<F m^-1>
+
+  /// Newtonian constant of gravitation
+  [<Literal>]
+  let G = 6.6742867e-11<m^3 kg^-1 s^-2>
+  
+  /// Planck constant
+  [<Literal>]
+  let h = 6.6260689633e-34<J s>
+
+  /// Dirac constant, also known as the reduced Planck constant = h/2pi
+  [<Literal>]
+  let hbar = 1.05457162853e-34<J s>
+
+  /// Elementary charge
+  [<Literal>]
+  let e = 1.60217648740e-19<C>
+
+  /// Magnetic flux quantum h/2e
+  [<Literal>]
+  let Phi0 = 2.06783366752e-15<Wb>
+
+  /// Conductance quantum 2e^2/h
+  [<Literal>]
+  let G0 = 7.748091700453e-5<S>
+
+  /// Electron mass
+  [<Literal>]
+  let m_e = 9.1093821545e-31<kg>
+
+  /// Proton mass
+  [<Literal>]
+  let m_p = 1.67262163783e-27<kg>
+
+  /// Fine-structure constant
+  [<Literal>]
+  let alpha = 7.297352537650e-3
+
+  /// Rydberg constant
+  [<Literal>]
+  let R_inf = 10973731.56852773<m^-1>
+
+  /// Avogadro constant
+  [<Literal>]
+  let N_A = 6.0221417930e23<mol^-1>
+
+  /// Faraday constant
+  [<Literal>]
+  let F = 96485.339924<C/mol>
+
+  /// Molar gas constant
+  [<Literal>]
+  let R = 8.31447215<J mol^-1 K^-1> 
+ 
+  /// Boltzmann constant R/N_A
+  [<Literal>]
+  let k = 1.380650424e-23<J/K>
+
+  /// Stefan-Boltzmann constant
+  [<Literal>]
+  let sigma = 5.67040040e-8<W m^-2 K^-4>
+ 
+  /// Electron volt
+  [<Literal>]
+  let eV = 1.60217648740e-19<J>
+
+  /// Unified atomic mass unit
+  [<Literal>]
+  let u = 1.66053878283e-27<kg>
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PowerPack.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PowerPack.fs
new file mode 100644
index 0000000..f2a481e
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/PowerPack.fs
@@ -0,0 +1,33 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+module internal Microsoft.FSharp.AssemblyAttributes
+
+//[<assembly: System.Security.SecurityTransparent>]
+[<assembly: AutoOpen("Microsoft.FSharp.Compatibility")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Compatibility.OCaml.Pervasives")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Compatibility.OCaml")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Text")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Control")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Collections")>]
+[<assembly: AutoOpen("Microsoft.FSharp.Core")>]
+do()
+
+#if FX_NO_SECURITY_PERMISSIONS
+#else
+#if FX_SIMPLE_SECURITY_PERMISSIONS
+[<assembly: System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.RequestMinimum)>]
+#else
+#endif
+#endif
+
+[<assembly: System.Runtime.InteropServices.ComVisible(false)>]
+
+[<assembly: System.CLSCompliant(true)>]
+
+
+#if FX_NO_DEFAULT_DEPENDENCY_TYPE
+#else
+[<assembly: System.Runtime.CompilerServices.Dependency("FSharp.Core",System.Runtime.CompilerServices.LoadHint.Always)>] 
+#endif
+
+do ()
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/SI.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/SI.fs
new file mode 100644
index 0000000..8261c8d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/SI.fs
@@ -0,0 +1,112 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+
+// System Internationale. See http://www.bipm.org/en/si/si_brochure/general.html
+/// The International System of Units (SI)
+module SI =
+
+  [<Measure>] 
+  /// metre (or meter), SI unit of length
+  type m               
+
+  [<Measure>] 
+  /// kilogram, SI unit of mass
+  type kg
+
+  [<Measure>] 
+  /// second, SI unit of time
+  type s
+
+  [<Measure>] 
+  /// ampere, SI unit of electric current
+  type A             
+
+  [<Measure>] 
+  /// kelvin, SI unit of thermodynamic temperature
+  type K              
+
+  [<Measure>] 
+  /// mole, SI unit of amount of substance
+  type mol             
+
+  [<Measure>] 
+  /// candela, SI unit of luminous intensity
+  type cd              
+
+  [<Measure>] 
+  /// hertz, SI unit of frequency
+  type Hz = s^-1
+
+  [<Measure>] 
+  /// newton, SI unit of force
+  type N = kg m / s^2 
+
+  [<Measure>] 
+  /// pascal, SI unit of pressure, stress
+  type Pa = N / m^2
+
+  [<Measure>] 
+  /// joule, SI unit of energy, work, amount of heat
+  type J = N m
+
+  [<Measure>] 
+  /// watt, SI unit of power, radiant flux
+  type W = J / s       
+
+  [<Measure>] 
+  /// coulomb, SI unit of electric charge, amount of electricity
+  type C = s A 
+
+  [<Measure>] 
+  /// volt, SI unit of electric potential difference, electromotive force
+  type V = W/A        
+
+  [<Measure>] 
+  /// farad, SI unit of capacitance
+  type F = C/V
+
+  [<Measure>] 
+  /// ohm, SI unit of electric resistance
+  type ohm = V/A       
+
+  [<Measure>] 
+  /// siemens, SI unit of electric conductance
+  type S = A/V         
+
+  [<Measure>] 
+  /// weber, SI unit of magnetic flux
+  type Wb = V s        
+
+  [<Measure>] 
+  /// tesla, SI unit of magnetic flux density
+  type T = Wb/m^2      
+
+  [<Measure>] 
+  /// henry, SI unit of inductance
+  type H = Wb/A        
+
+  [<Measure>] 
+  /// lumen, SI unit of luminous flux
+  type lm = cd        
+
+  [<Measure>] 
+  /// lux, SI unit of illuminance
+  type lx = lm/m^2 
+
+  [<Measure>] 
+  /// becquerel, SI unit of activity referred to a radionuclide
+  type Bq = s^-1       
+
+  [<Measure>] 
+  /// gray, SI unit of absorbed dose
+  type Gy = J/kg       
+
+  [<Measure>] 
+  /// sievert, SI unit of does equivalent
+  type Sv = J/kg       
+
+  [<Measure>] 
+  /// katal, SI unit of catalytic activity
+  type kat = mol/s 
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fs
new file mode 100644
index 0000000..acbc7f8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fs
@@ -0,0 +1,1179 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+
+namespace Microsoft.FSharp.Collections.Tagged
+
+    #nowarn "51"
+    #nowarn "69" // interface implementations in augmentations
+    #nowarn "60" // override implementations in augmentations
+
+    open System
+    open System.Collections.Generic
+    open Microsoft.FSharp.Collections
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    [<NoEquality; NoComparison>]
+    type SetTree<'T> = 
+        | SetEmpty                                          // height = 0   
+        | SetNode of 'T * SetTree<'T> *  SetTree<'T> * int    // height = int 
+#if ONE
+        | SetOne  of 'T                                     // height = 1   
+#endif
+        // OPTIMIZATION: store SetNode(k,SetEmpty,SetEmpty,1) --->  SetOne(k) 
+
+
+    // CONSIDER: SetTree<'T> = SetEmpty | SetNode of 'T  * SetTree<'T> *  SetTree<'T> * int
+    //  with SetOne = SetNode of (x,null,null,1)
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module SetTree = 
+        let empty = SetEmpty
+
+        let height t = 
+            match t with 
+            | SetEmpty -> 0
+#if ONE
+            | SetOne _ -> 1
+#endif
+            | SetNode (_,_,_,h) -> h
+
+#if CHECKED
+        let rec checkInvariant t =
+            // A good sanity check, loss of balance can hit perf 
+            match t with 
+            | SetEmpty -> true
+            | SetOne _ -> true
+            | SetNode (k,t1,t2,h) ->
+                let h1 = height t1 in
+                let h2 = height t2 in
+                (-2 <= (h1 - h2) && (h1 - h2) <= 2) && checkInvariant t1 && checkInvariant t2
+#else
+        let inline SetOne(x) = SetNode(x,SetEmpty,SetEmpty,1)
+#endif
+
+        let tolerance = 2
+
+        let mk l hl k r hr = 
+#if ONE
+            if hl = 0 && hr = 0 then SetOne (k)
+            else
+#endif
+              let m = if hl < hr then hr else hl 
+              SetNode(k,l,r,m+1)
+
+        let rebalance t1 k t2 =
+            let t1h = height t1 
+            let t2h = height t2
+            if  t2h > t1h + tolerance then // right is heavier than left 
+                match t2 with 
+                | SetNode(t2k,t2l,t2r,_) -> 
+                    // one of the nodes must have height > height t1 + 1 
+                    let t2lh = height t2l
+                    if t2lh > t1h + 1 then  // balance left: combination 
+                        match t2l with 
+                        | SetNode(t2lk,t2ll,t2lr,_) ->
+                            let l = mk t1 t1h k t2ll (height t2ll)
+                            let r = mk t2lr (height t2lr) t2k t2r (height t2r)
+                            mk l (height l) t2lk r (height r)
+                        | _ -> failwith "rebalance"
+                    else // rotate left 
+                        let l = mk t1 t1h k t2l t2lh
+                        mk l (height l) t2k t2r (height t2r)
+                | _ -> failwith "rebalance"
+            else
+                if  t1h > t2h + tolerance then // left is heavier than right 
+                    match t1 with 
+                    | SetNode(t1k,t1l,t1r,_) -> 
+                        // one of the nodes must have height > height t2 + 1 
+                        let t1rh = height t1r
+                        if t1rh > t2h + 1 then 
+                            // balance right: combination 
+                            match t1r with 
+                            | SetNode(t1rk,t1rl,t1rr,_) ->
+                                let l = mk t1l (height t1l) t1k t1rl (height t1rl)
+                                let r = mk t1rr (height t1rr) k t2 t2h
+                                mk l (height l) t1rk r (height r)
+                            | _ -> failwith "rebalance"
+                        else
+                            let r = mk t1r t1rh k t2 t2h
+                            mk t1l (height t1l) t1k r (height r)
+                    | _ -> failwith "rebalance"
+                else mk t1 t1h k t2 t2h
+
+        let rec add (comparer: IComparer<'T>) k t = 
+            match t with 
+            | SetNode (k2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c < 0 then rebalance (add comparer k l) k2 r
+                elif c = 0 then t
+                else            rebalance l k2 (add comparer k r)
+#if ONE
+            | SetOne(k2) -> 
+                // nb. no check for rebalance needed for small trees, also be sure to reuse node already allocated 
+                let c = comparer.Compare(k,k2) 
+                if c < 0   then SetNode (k,SetEmpty,t,2)
+                elif c = 0 then t
+                else            SetNode (k,t,SetEmpty,2)                  
+#endif
+            | SetEmpty -> SetOne(k)
+
+        let rec balance comparer t1 k t2 =
+            // Given t1 < k < t2 where t1 and t2 are "balanced",
+            // return a balanced tree for <t1,k,t2>.
+            // Recall: balance means subtrees heights differ by at most "tolerance"
+            match t1,t2 with
+            | SetEmpty,t2  -> add comparer k t2 // drop t1 = empty 
+            | t1,SetEmpty  -> add comparer k t1 // drop t2 = empty 
+#if ONE
+            | SetOne k1,t2 -> add comparer k (add comparer k1 t2)
+            | t1,SetOne k2 -> add comparer k (add comparer k2 t1)
+#endif
+            | SetNode(k1,t11,t12,t1h),SetNode(k2,t21,t22,t2h) ->
+                // Have:  (t11 < k1 < t12) < k < (t21 < k2 < t22)
+                // Either (a) h1,h2 differ by at most 2 - no rebalance needed.
+                //        (b) h1 too small, i.e. h1+2 < h2
+                //        (c) h2 too small, i.e. h2+2 < h1 
+                if   t1h+tolerance < t2h then
+                    // case: b, h1 too small 
+                    // push t1 into low side of t2, may increase height by 1 so rebalance 
+                    rebalance (balance comparer t1 k t21) k2 t22
+                elif t2h+tolerance < t1h then
+                    // case: c, h2 too small 
+                    // push t2 into high side of t1, may increase height by 1 so rebalance 
+                    rebalance t11 k1 (balance comparer t12 k t2)
+                else
+                    // case: a, h1 and h2 meet balance requirement 
+                    mk t1 t1h k t2 t2h
+
+        let rec split (comparer : IComparer<'T>) pivot t =
+            // Given a pivot and a set t
+            // Return { x in t s.t. x < pivot }, pivot in t? , { x in t s.t. x > pivot } 
+            match t with
+            | SetNode(k1,t11,t12,_) ->
+                let c = comparer.Compare(pivot,k1)
+                if   c < 0 then // pivot t1 
+                    let t11_lo,havePivot,t11_hi = split comparer pivot t11
+                    t11_lo,havePivot,balance comparer t11_hi k1 t12
+                elif c = 0 then // pivot is k1 
+                    t11,true,t12
+                else            // pivot t2 
+                    let t12_lo,havePivot,t12_hi = split comparer pivot t12
+                    balance comparer t11 k1 t12_lo,havePivot,t12_hi
+#if ONE
+            | SetOne k1 ->
+                let c = comparer.Compare(k1,pivot)
+                if   c < 0 then t       ,false,SetEmpty // singleton under pivot 
+                elif c = 0 then SetEmpty,true ,SetEmpty // singleton is    pivot 
+                else            SetEmpty,false,t        // singleton over  pivot 
+#endif
+            | SetEmpty  -> 
+                SetEmpty,false,SetEmpty
+        
+        let rec spliceOutSuccessor t = 
+            match t with 
+            | SetEmpty -> failwith "internal error: Map.splice_out_succ_or_pred"
+#if ONE
+            | SetOne (k2) -> k2,empty
+#endif
+            | SetNode (k2,l,r,_) ->
+                match l with 
+                | SetEmpty -> k2,r
+                | _ -> let k3,l' = spliceOutSuccessor l in k3,mk l' (height l') k2 r (height r)
+
+        let rec remove (comparer: IComparer<'T>) k t = 
+            match t with 
+            | SetEmpty -> t
+#if ONE
+            | SetOne (k2) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c = 0 then empty
+                else            t
+#endif
+            | SetNode (k2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c < 0 then rebalance (remove comparer k l) k2 r
+                elif c = 0 then 
+                  match l,r with 
+                  | SetEmpty,_ -> r
+                  | _,SetEmpty -> l
+                  | _ -> 
+                      let sk,r' = spliceOutSuccessor r 
+                      mk l (height l) sk r' (height r')
+                else rebalance l k2 (remove comparer k r) 
+
+        let rec contains (comparer: IComparer<'T>) k t = 
+            match t with 
+            | SetNode(k2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c < 0 then contains comparer k l
+                elif c = 0 then true
+                else contains comparer k r
+#if ONE
+            | SetOne(k2) -> (comparer.Compare(k,k2) = 0)
+#endif
+            | SetEmpty -> false
+
+        let rec iter f t = 
+            match t with 
+            | SetNode(k2,l,r,_) -> iter f l; f k2; iter f r
+#if ONE
+            | SetOne(k2) -> f k2
+#endif
+            | SetEmpty -> ()            
+
+        // Fold, left-to-right. 
+        //
+        // NOTE: This differs from the behaviour of Map.fold which folds right-to-left.
+        let rec fold f m x = 
+            match m with 
+            | SetNode(k,l,r,_) -> fold f r (f k (fold f l x))
+#if ONE
+            | SetOne(k) -> f k x
+#endif
+            | SetEmpty -> x                
+
+        let rec forAll f m = 
+            match m with 
+            | SetNode(k2,l,r,_) -> f k2 && forAll f l && forAll f r
+#if ONE
+            | SetOne(k2) -> f k2
+#endif
+            | SetEmpty -> true          
+
+        let rec exists f m = 
+            match m with 
+            | SetNode(k2,l,r,_) -> f k2 || exists f l || exists f r
+#if ONE
+            | SetOne(k2) -> f k2
+#endif
+            | SetEmpty -> false         
+
+        let isEmpty m = match m with  | SetEmpty -> true | _ -> false
+
+        let subset comparer a b  = forAll (fun x -> contains comparer x b) a
+
+        let rec elementsAux m acc = 
+            match m with 
+            | SetNode(k2,l,r,_) -> k2 :: (elementsAux l (elementsAux r acc))
+#if ONE
+            | SetOne(k2) -> k2 :: acc
+#endif
+            | SetEmpty -> acc                
+
+        let elements a  = elementsAux a []
+
+        let rec filterAux comparer f s acc = 
+            match s with 
+            | SetNode(k,l,r,_) -> 
+                let acc = if f k then add comparer k acc else acc 
+                filterAux comparer f l (filterAux comparer f r acc)
+#if ONE
+            | SetOne(k) -> if f k then add comparer k acc else acc
+#endif
+            | SetEmpty -> acc           
+
+        let filter comparer f s = filterAux comparer f s empty
+
+        let rec diffAux comparer m acc = 
+            match m with 
+            | SetNode(k,l,r,_) -> diffAux comparer l (diffAux comparer r (remove comparer k acc))
+#if ONE
+            | SetOne(k) -> remove comparer k acc
+#endif
+            | SetEmpty -> acc           
+
+        let diff comparer a b = diffAux comparer b a
+
+        let rec countAux s acc = 
+            match s with 
+            | SetNode(_,l,r,_) -> countAux l (countAux r (acc+1))
+#if ONE
+            | SetOne(k) -> acc+1
+#endif
+            | SetEmpty -> acc           
+
+        let count s = countAux s 0
+
+        let rec union comparer t1 t2 =
+            // Perf: tried bruteForce for low heights, but nothing significant 
+            match t1,t2 with               
+            | SetNode(k1,t11,t12,h1),SetNode(k2,t21,t22,h2) -> // (t11 < k < t12) AND (t21 < k2 < t22) 
+                // Divide and Quonquer:
+                //   Suppose t1 is largest.
+                //   Split t2 using pivot k1 into lo and hi.
+                //   Union disjoint subproblems and then combine. 
+                if h1 > h2 then
+                  let lo,_,hi = split comparer k1 t2 in
+                  balance comparer (union comparer t11 lo) k1 (union comparer t12 hi)
+                else
+                  let lo,_,hi = split comparer k2 t1 in
+                  balance comparer (union comparer t21 lo) k2 (union comparer t22 hi)
+            | SetEmpty,t -> t
+            | t,SetEmpty -> t
+#if ONE
+            | SetOne k1,t2 -> add comparer k1 t2
+            | t1,SetOne k2 -> add comparer k2 t1
+#endif
+
+        let rec intersectionAux comparer b m acc = 
+            match m with 
+            | SetNode(k,l,r,_) -> 
+                let acc = intersectionAux comparer b r acc 
+                let acc = if contains comparer k b then add comparer k acc else acc 
+                intersectionAux comparer b l acc
+#if ONE
+            | SetOne(k) -> 
+                if contains comparer k b then add comparer k acc else acc
+#endif
+            | SetEmpty -> acc
+
+        let intersection comparer a b = intersectionAux comparer b a empty
+
+        let partition1 comparer f k (acc1,acc2) = 
+            if f k then (add comparer k acc1,acc2) 
+            else (acc1,add comparer k acc2) 
+        
+        let rec partitionAux comparer f s acc = 
+            match s with 
+            | SetNode(k,l,r,_) -> 
+                let acc = partitionAux comparer f r acc 
+                let acc = partition1 comparer f k acc
+                partitionAux comparer f l acc
+#if ONE
+            | SetOne(k) -> partition1 comparer f k acc
+#endif
+            | SetEmpty -> acc           
+
+        let partition comparer f s = partitionAux comparer f s (empty,empty)
+
+        // It's easier to get many less-important algorithms right using this active pattern
+        let (|MatchSetNode|MatchSetEmpty|) s = 
+            match s with 
+            | SetNode(k2,l,r,_) -> MatchSetNode(k2,l,r)
+#if ONE
+            | SetOne(k2) -> MatchSetNode(k2,SetEmpty,SetEmpty)
+#endif
+            | SetEmpty -> MatchSetEmpty
+        
+        let rec nextElemCont (comparer: IComparer<'T>) k s cont = 
+            match s with 
+            | MatchSetNode(k2,l,r) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c < 0 then nextElemCont comparer k l (function None -> cont(Some(k2)) | res -> res)
+                elif c = 0 then cont(minimumElementOpt r) 
+                else nextElemCont comparer k r cont
+            | MatchSetEmpty -> cont(None)
+
+        and nextElem comparer k s = nextElemCont comparer k s (fun res -> res)
+        
+        and prevElemCont (comparer: IComparer<'T>) k s cont = 
+            match s with 
+            | MatchSetNode(k2,l,r) -> 
+                let c = comparer.Compare(k,k2) 
+                if   c > 0 then prevElemCont comparer k r (function None -> cont(Some(k2)) | res -> res)
+                elif c = 0 then cont(maximumElementOpt r) 
+                else prevElemCont comparer k l cont
+            | MatchSetEmpty -> cont(None)
+
+        and prevElem comparer k s = prevElemCont comparer k s (fun res -> res)
+        
+        and minimumElementAux s n = 
+            match s with 
+            | SetNode(k,l,_,_) -> minimumElementAux l k
+#if ONE
+            | SetOne(k) -> k
+#endif
+            | SetEmpty -> n
+
+        and minimumElementOpt s = 
+            match s with 
+            | SetNode(k,l,_,_) -> Some(minimumElementAux l k)
+#if ONE
+            | SetOne(k) -> Some k
+#endif
+            | SetEmpty -> None
+
+        and maximumElementAux s n = 
+            match s with 
+            | SetNode(k,_,r,_) -> maximumElementAux r k
+#if ONE
+            | SetOne(k) -> k
+#endif
+            | SetEmpty -> n             
+
+        and maximumElementOpt s = 
+            match s with 
+            | SetNode(k,_,r,_) -> Some(maximumElementAux r k)
+#if ONE
+            | SetOne(k) -> Some(k)
+#endif
+            | SetEmpty -> None
+
+        let minimumElement s = 
+            match minimumElementOpt s with 
+            | Some(k) -> k
+            | None -> failwith "minimumElement"            
+
+        let maximumElement s = 
+            match maximumElementOpt s with 
+            | Some(k) -> k
+            | None -> failwith "maximumElement"
+
+
+        //--------------------------------------------------------------------------
+        // Imperative left-to-right iterators.
+        //--------------------------------------------------------------------------
+
+        type SetIterator<'T>(s:SetTree<'T>) = 
+
+            // collapseLHS:
+            // a) Always returns either [] or a list starting with SetOne.
+            // b) The "fringe" of the set stack is unchanged.
+            let rec collapseLHS stack =
+                match stack with
+                | []                       -> []
+                | SetEmpty         :: rest -> collapseLHS rest
+#if ONE
+                | SetOne k         :: rest -> stack
+#else
+                | SetNode(_,SetEmpty,SetEmpty,_) :: _ -> stack
+#endif
+                | SetNode(k,l,r,_) :: rest -> collapseLHS (l :: SetOne k :: r :: rest)
+
+            // invariant: always collapseLHS result 
+            let mutable stack = collapseLHS [s]
+            // true when MoveNext has been called   
+            let mutable started = false 
+
+            let notStarted() = raise (new System.InvalidOperationException("Enumeration has not started. Call MoveNext."))
+            let alreadyFinished() = raise (new System.InvalidOperationException("Enumeration already finished."))
+
+            member i.Current =
+                if started then
+                    match stack with
+#if ONE
+                      | SetOne k :: _ -> k
+#else
+                      | SetNode( k,_,_,_) :: _ -> k
+#endif
+                      | []            -> alreadyFinished()
+                      | _             -> failwith "Please report error: Set iterator, unexpected stack for current"
+                else
+                    notStarted()
+
+            member i.MoveNext() = 
+                if started then
+                    match stack with
+#if ONE
+                      | SetOne _ :: rest -> 
+#else
+                      | SetNode _ :: rest -> 
+#endif
+                            stack <- collapseLHS rest;
+                            not stack.IsEmpty
+                      | [] -> false
+                      | _ -> failwith "Please report error: Set iterator, unexpected stack for moveNext"
+                else
+                    started <- true;  // The first call to MoveNext "starts" the enumeration.
+                    not stack.IsEmpty
+
+        let toSeq s = 
+            let i = ref (SetIterator s) 
+            { new IEnumerator<_> with 
+                  member __.Current = (!i).Current
+              interface System.Collections.IEnumerator with 
+                  member __.Current = box (!i).Current
+                  member __.MoveNext() = (!i).MoveNext()
+                  member __.Reset() = i :=  SetIterator s
+              interface System.IDisposable with 
+                  member __.Dispose() = () }
+
+        //--------------------------------------------------------------------------
+        // Set comparison.  This can be expensive.
+        //--------------------------------------------------------------------------
+
+        let rec compareStacks (comparer: IComparer<'T>) l1 l2 =
+            match l1,l2 with 
+            | [],[] ->  0
+            | [],_  -> -1
+            | _ ,[] ->  1
+            | (SetEmpty  _ :: t1),(SetEmpty    :: t2) -> compareStacks comparer t1 t2
+#if ONE
+            | (SetOne(n1k) :: t1),(SetOne(n2k) :: t2) -> 
+                 let c = comparer.Compare(n1k,n2k) 
+                 if c <> 0 then c else compareStacks comparer t1 t2
+            | (SetOne(n1k) :: t1),(SetNode(n2k,SetEmpty,n2r,_) :: t2) -> 
+                 let c = comparer.Compare(n1k,n2k) 
+                 if c <> 0 then c else compareStacks comparer (empty :: t1) (n2r :: t2)
+            | (SetNode(n1k,(SetEmpty as emp),n1r,_) :: t1),(SetOne(n2k) :: t2) -> 
+                 let c = comparer.Compare(n1k,n2k) 
+                 if c <> 0 then c else compareStacks comparer (n1r :: t1) (emp :: t2)
+#endif
+            | (SetNode(n1k,SetEmpty,n1r,_) :: t1),(SetNode(n2k,SetEmpty,n2r,_) :: t2) -> 
+                 let c = comparer.Compare(n1k,n2k) 
+                 if c <> 0 then c else compareStacks comparer (n1r :: t1) (n2r :: t2)
+#if ONE
+            | (SetOne(n1k) :: t1),_ -> 
+                compareStacks comparer (empty :: SetOne(n1k) :: t1) l2
+#endif
+            | (SetNode(n1k,n1l,n1r,_) :: t1),_ -> 
+                compareStacks comparer (n1l :: SetNode(n1k,empty,n1r,0) :: t1) l2
+#if ONE
+            | _,(SetOne(n2k) :: t2) -> 
+                compareStacks comparer l1 (empty :: SetOne(n2k) :: t2)
+#endif
+            | _,(SetNode(n2k,n2l,n2r,_) :: t2) -> 
+                compareStacks comparer l1 (n2l :: SetNode(n2k,empty,n2r,0) :: t2)
+                
+        let compare comparer s1 s2 = 
+            match s1,s2 with 
+            | SetEmpty,SetEmpty -> 0
+            | SetEmpty,_ -> -1
+            | _,SetEmpty -> 1
+            | _ -> compareStacks comparer [s1] [s2]
+
+        let choose s = minimumElement s
+
+        let toList s = 
+            let rec loop m x = 
+                match m with 
+                | SetNode(k,l,r,_) -> loop l (k :: (loop r x))
+#if ONE
+                | SetOne(k) -> k :: x
+#endif
+                | SetEmpty -> x
+            loop s []            
+
+        let copyToArray s (arr: _[]) i =
+            let j = ref i 
+            iter (fun x -> arr.[!j] <- x; j := !j + 1) s
+
+        let toArray s = 
+            let n = (count s) 
+            let res = Array.zeroCreate n 
+            copyToArray s res 0;
+            res
+
+        let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = 
+            if e.MoveNext() then 
+              mkFromEnumerator comparer (add comparer e.Current acc) e
+            else acc
+          
+        let ofSeq comparer (c : IEnumerable<_>) =
+            use ie = c.GetEnumerator()
+            mkFromEnumerator comparer empty ie 
+
+        let ofArray comparer l = Array.fold (fun acc k -> add comparer k acc) empty l    
+
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+    [<System.Diagnostics.DebuggerDisplay ("Count = {Count}")>]
+#endif
+    [<Sealed>]
+    type Set<'T,'ComparerTag> when 'ComparerTag :> IComparer<'T>(comparer: IComparer<'T>, tree: SetTree<'T>) =
+
+        static let refresh (s:Set<_,_>) t =    Set<_,_>(comparer=s.ComparerUntyped, tree=t)
+
+        member s.Tree = tree
+        member s.ComparerUntyped : IComparer<'T> = comparer 
+        member s.Comparer = (comparer :?> 'ComparerTag)
+
+        static member Empty(comparer: 'ComparerTag) : Set<'T,'ComparerTag> =  
+            Set<_,_>(comparer=comparer, tree=SetTree.empty)
+
+
+        member s.Add(x) : Set<'T,'ComparerTag> = refresh s (SetTree.add comparer x tree)
+        member s.Remove(x) : Set<'T,'ComparerTag> = refresh s (SetTree.remove comparer x tree)
+        member s.Count = SetTree.count tree
+        member s.Contains(x) = SetTree.contains comparer  x tree
+        member s.Iterate(x) = SetTree.iter  x tree
+        member s.Fold f x  = SetTree.fold f tree x
+
+#if CHECKED
+        member s.CheckBalanceInvariant = checkInvariant tree // diagnostics...
+#endif
+        member s.IsEmpty  = SetTree.isEmpty tree
+
+        member s.Partition f  : Set<'T,'ComparerTag> *  Set<'T,'ComparerTag> = 
+            match tree with 
+            | SetEmpty -> s,s
+            | _ -> 
+                let t1,t2 = SetTree.partition comparer f tree 
+                refresh s t1, refresh s t2
+
+        member s.Filter f  : Set<'T,'ComparerTag> = 
+            match tree with 
+            | SetEmpty -> s
+            | _ -> SetTree.filter comparer f tree |> refresh s
+
+        member s.Exists f = SetTree.exists f tree
+
+        member s.ForAll f = SetTree.forAll f tree
+
+        static member (-) ((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) = Set<_,_>.Difference(a,b)
+
+        static member (+)  ((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) = Set<_,_>.Union(a,b)
+
+        static member Intersection((a: Set<'T,'ComparerTag>),(b: Set<'T,'ComparerTag>)) : Set<'T,'ComparerTag>  = 
+            match b.Tree with 
+            | SetEmpty -> b  (* A INTER 0 = 0 *)
+            | _ -> 
+               match a.Tree with 
+               | SetEmpty -> a (* 0 INTER B = 0 *)
+               | _ -> SetTree.intersection a.ComparerUntyped  a.Tree b.Tree |> refresh a
+           
+        static member Union(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) : Set<'T,'ComparerTag>  = 
+            match b.Tree with 
+            | SetEmpty -> a  (* A U 0 = A *)
+            | _ -> 
+               match a.Tree with 
+               | SetEmpty -> b  (* 0 U B = B *)
+               | _ -> SetTree.union a.ComparerUntyped  a.Tree b.Tree |> refresh a
+
+        static member Difference(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) : Set<'T,'ComparerTag>  = 
+            match a.Tree with 
+            | SetEmpty -> a (* 0 - B = 0 *)
+            | _ -> 
+                match b.Tree with 
+                | SetEmpty -> a (* A - 0 = A *)
+                | _ -> SetTree.diff a.ComparerUntyped  a.Tree b.Tree |> refresh a
+
+        static member Equality(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) = 
+            (SetTree.compare a.ComparerUntyped  a.Tree b.Tree = 0)
+
+        static member Compare(a: Set<'T,'ComparerTag>,b: Set<'T,'ComparerTag>) = 
+            SetTree.compare a.ComparerUntyped  a.Tree b.Tree
+
+        member s.Choose = SetTree.choose tree
+
+        member s.MinimumElement = SetTree.minimumElement tree
+
+        member s.MaximumElement = SetTree.maximumElement tree
+
+        member s.IsSubsetOf((y: Set<'T,'ComparerTag>)) = SetTree.subset comparer tree y.Tree 
+
+        member s.IsSupersetOf((y: Set<'T,'ComparerTag>)) = SetTree.subset comparer y.Tree tree
+
+        member s.ToList () = SetTree.toList tree
+
+        member s.ToArray () = SetTree.toArray tree
+
+        override this.Equals(that) = 
+            match that with
+            // Cast to the exact same type as this, otherwise not equal.
+            | :? Set<'T,'ComparerTag> as that -> ((this :> System.IComparable).CompareTo(that) = 0)
+            | _ -> false
+
+        interface System.IComparable with
+            // Cast s2 to the exact same type as s1, see 4884.
+            // It is not OK to cast s2 to seq<'T>, since different compares could permute the elements.
+            member s1.CompareTo(s2: obj) = SetTree.compare s1.ComparerUntyped s1.Tree ((s2 :?> Set<'T,'ComparerTag>).Tree)
+
+        member this.ComputeHashCode() = 
+                let combineHash x y = (x <<< 1) + y + 631 
+                let mutable res = 0
+                for x in this do
+                    res <- combineHash res (Unchecked.hash x)
+                abs res
+
+        override this.GetHashCode() = this.ComputeHashCode()
+          
+        interface ICollection<'T> with 
+            member s.Add(x) = raise (new System.NotSupportedException("ReadOnlyCollection"))
+            member s.Clear() = raise (new System.NotSupportedException("ReadOnlyCollection"))
+            member s.Remove(x) = raise (new System.NotSupportedException("ReadOnlyCollection"))
+            member s.Contains(x) = SetTree.contains comparer x tree
+            member s.CopyTo(arr,i) = SetTree.copyToArray tree arr i
+            member s.IsReadOnly = true
+            member s.Count = SetTree.count tree  
+
+        interface IEnumerable<'T> with
+            member s.GetEnumerator() = SetTree.toSeq tree
+
+        interface System.Collections.IEnumerable with
+            override s.GetEnumerator() = (SetTree.toSeq tree :> System.Collections.IEnumerator)
+
+        static member Singleton(comparer,x) : Set<'T,'ComparerTag>  = 
+            Set<_,_>.Empty(comparer).Add(x)
+
+        static member Create(comparer : 'ComparerTag,l : seq<'T>) : Set<'T,'ComparerTag> = 
+            Set<_,_>(comparer=comparer, tree=SetTree.ofSeq comparer l)
+
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    [<NoEquality; NoComparison>]
+    type MapTree<'Key,'T> = 
+        | MapEmpty 
+#if ONE 
+        | MapOne of 'Key * 'T
+#endif
+        // Note: performance rumour has it that the data held in this node should be
+        // exactly one cache line. It is currently ~7 words. Thus it might be better to
+        // move to a n-way tree.
+        | MapNode of 'Key * 'T * MapTree<'Key,'T> *  MapTree<'Key,'T> * int
+
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module MapTree = 
+
+        let empty = MapEmpty 
+
+        let inline height x  = 
+          match x with 
+          | MapEmpty -> 0
+#if ONE 
+          | MapOne _ -> 1
+#endif
+          | MapNode(_,_,_,_,h) -> h
+
+        let isEmpty m = 
+            match m with 
+            | MapEmpty -> true
+            | _ -> false
+
+        let mk l k v r = 
+#if ONE 
+            match l,r with 
+            | MapEmpty,MapEmpty -> MapOne(k,v)
+            | _ -> 
+#endif
+                let hl = height l 
+                let hr = height r 
+                let m = if hl < hr then hr else hl 
+                MapNode(k,v,l,r,m+1)
+
+        let rebalance t1 k v t2 =
+            let t1h = height t1 
+            if  height t2 > t1h + 2 then (* right is heavier than left *)
+                match t2 with 
+                | MapNode(t2k,t2v,t2l,t2r,_) -> 
+                   (* one of the nodes must have height > height t1 + 1 *)
+                   if height t2l > t1h + 1 then  (* balance left: combination *)
+                     match t2l with 
+                     | MapNode(t2lk,t2lv,t2ll,t2lr,_) ->
+                        mk (mk t1 k v t2ll) t2lk t2lv (mk t2lr t2k t2v t2r) 
+                     | _ -> failwith "rebalance"
+                   else (* rotate left *)
+                     mk (mk t1 k v t2l) t2k t2v t2r
+                | _ -> failwith "rebalance"
+            else
+                let t2h = height t2 
+                if  t1h > t2h + 2 then (* left is heavier than right *)
+                  match t1 with 
+                  | MapNode(t1k,t1v,t1l,t1r,_) -> 
+                    (* one of the nodes must have height > height t2 + 1 *)
+                      if height t1r > t2h + 1 then 
+                      (* balance right: combination *)
+                        match t1r with 
+                        | MapNode(t1rk,t1rv,t1rl,t1rr,_) ->
+                            mk (mk t1l t1k t1v t1rl) t1rk t1rv (mk t1rr k v t2)
+                        | _ -> failwith "rebalance"
+                      else
+                        mk t1l t1k t1v (mk t1r k v t2)
+                  | _ -> failwith "rebalance"
+                else mk t1 k v t2
+
+        let rec sizeAux acc m = 
+            match m with  
+            | MapEmpty -> acc
+#if ONE 
+            | MapOne _ -> acc + 1
+#endif
+            | MapNode(_,_,l,r,_) -> sizeAux (sizeAux (acc+1) l) r 
+
+#if ONE 
+#else
+        let MapOne(k,v) = MapNode(k,v,MapEmpty,MapEmpty,1)
+#endif
+        
+        let count x = sizeAux 0 x
+
+        let rec add (comparer: IComparer<'T>) k v m = 
+            match m with 
+            | MapEmpty -> MapOne(k,v)
+#if ONE 
+            | MapOne(k2,v2) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0   then MapNode (k,v,MapEmpty,m,2)
+                elif c = 0 then MapOne(k,v)
+                else            MapNode (k,v,m,MapEmpty,2)
+#endif
+            | MapNode(k2,v2,l,r,h) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0 then rebalance (add comparer k v l) k2 v2 r
+                elif c = 0 then MapNode(k,v,l,r,h)
+                else rebalance l k2 v2 (add comparer k v r) 
+
+        let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+        let rec find (comparer: IComparer<'T>) k m = 
+            match m with 
+            | MapEmpty -> indexNotFound()
+#if ONE 
+            | MapOne(k2,v2) -> 
+                let c = comparer.Compare(k,k2) 
+                if c = 0 then v2
+                else indexNotFound()
+#endif
+            | MapNode(k2,v2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0 then find comparer k l
+                elif c = 0 then v2
+                else find comparer k r
+
+        let rec tryFind (comparer: IComparer<'T>) k m = 
+            match m with 
+            | MapEmpty -> None
+#if ONE 
+            | MapOne(k2,v2) -> 
+                let c = comparer.Compare(k,k2) 
+                if c = 0 then Some v2
+                else None
+#endif
+            | MapNode(k2,v2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0 then tryFind comparer k l
+                elif c = 0 then Some v2
+                else tryFind comparer k r
+
+        let partition1 (comparer: IComparer<'T>) f k v (acc1,acc2) = 
+            if f k v then (add comparer k v acc1,acc2) else (acc1,add comparer k v acc2) 
+        
+        let rec partitionAux (comparer: IComparer<'T>) f s acc = 
+            match s with 
+            | MapEmpty -> acc
+#if ONE 
+            | MapOne(k,v) -> partition1 comparer f k v acc
+#endif
+            | MapNode(k,v,l,r,_) -> 
+                let acc = partitionAux comparer f r acc 
+                let acc = partition1 comparer f k v acc
+                partitionAux comparer f l acc
+
+        let partition (comparer: IComparer<'T>) f s = partitionAux comparer f s (empty,empty)
+
+        let filter1 (comparer: IComparer<'T>) f k v acc = if f k v then add comparer k v acc else acc 
+
+        let rec filterAux (comparer: IComparer<'T>) f s acc = 
+            match s with 
+            | MapEmpty -> acc
+#if ONE 
+            | MapOne(k,v) -> filter1 comparer f k v acc
+#endif
+            | MapNode(k,v,l,r,_) ->
+                let acc = filterAux comparer f l acc
+                let acc = filter1 comparer f k v acc
+                filterAux comparer f r acc
+
+        let filter (comparer: IComparer<'T>) f s = filterAux comparer f s empty
+
+        let rec spliceOutSuccessor m = 
+            match m with 
+            | MapEmpty -> failwith "internal error: Map.splice_out_succ_or_pred"
+#if ONE 
+            | MapOne(k2,v2) -> k2,v2,MapEmpty
+#endif
+            | MapNode(k2,v2,l,r,_) ->
+                match l with 
+                | MapEmpty -> k2,v2,r
+                | _ -> let k3,v3,l' = spliceOutSuccessor l in k3,v3,mk l' k2 v2 r
+
+        let rec remove (comparer: IComparer<'T>) k m = 
+            match m with 
+            | MapEmpty -> empty
+#if ONE 
+            | MapOne(k2,v2) -> 
+                let c = comparer.Compare(k,k2) 
+                if c = 0 then MapEmpty else m
+#endif
+            | MapNode(k2,v2,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0 then rebalance (remove comparer k l) k2 v2 r
+                elif c = 0 then 
+                  match l,r with 
+                  | MapEmpty,_ -> r
+                  | _,MapEmpty -> l
+                  | _ -> 
+                      let sk,sv,r' = spliceOutSuccessor r 
+                      mk l sk sv r'
+                else rebalance l k2 v2 (remove comparer k r) 
+
+        let rec containsKey (comparer: IComparer<'T>) k m = 
+            match m with 
+            | MapEmpty -> false
+#if ONE 
+            | MapOne(k2,v2) -> (comparer.Compare(k,k2) = 0)
+#endif
+            | MapNode(k2,_,l,r,_) -> 
+                let c = comparer.Compare(k,k2) 
+                if c < 0 then containsKey comparer k l
+                else (c = 0 || containsKey comparer k r)
+
+        let rec iter f m = 
+            match m with 
+            | MapEmpty -> ()
+#if ONE 
+            | MapOne(k2,v2) -> f k2 v2
+#endif
+            | MapNode(k2,v2,l,r,_) -> iter f l; f k2 v2; iter f r
+
+        let rec first f m = 
+            match m with 
+            | MapEmpty -> None
+#if ONE 
+            | MapOne(k2,v2) -> f k2 v2 
+#endif
+            | MapNode(k2,v2,l,r,_) -> 
+                match first f l with 
+                | Some _ as res -> res 
+                | None -> 
+                match f k2 v2 with 
+                | Some _ as res -> res 
+                | None -> first f r
+
+        let rec exists f m = 
+            match m with 
+            | MapEmpty -> false
+#if ONE 
+            | MapOne(k2,v2) -> f k2 v2
+#endif
+            | MapNode(k2,v2,l,r,_) -> f k2 v2 || exists f l || exists f r
+
+        let rec forAll f m = 
+            match m with 
+            | MapEmpty -> true
+#if ONE 
+            | MapOne(k2,v2) -> f k2 v2
+#endif
+            | MapNode(k2,v2,l,r,_) -> f k2 v2 && forAll f l && forAll f r
+
+        let rec map f m = 
+            match m with 
+            | MapEmpty -> empty
+#if ONE 
+            | MapOne(k,v) -> MapOne(k,f v)
+#endif
+            | MapNode(k,v,l,r,h) -> let v2 = f v in MapNode(k,v2,map f l, map f r,h)
+
+        let rec mapi f m = 
+            match m with
+            | MapEmpty -> empty
+#if ONE 
+            | MapOne(k,v) -> MapOne(k,f k v)
+#endif
+            | MapNode(k,v,l,r,h) -> let v2 = f k v in MapNode(k,v2, mapi f l, mapi f r,h)
+
+        // Fold, right-to-left. 
+        //
+        // NOTE: This differs from the behaviour of Set.fold which folds left-to-right.
+        let rec fold f m x = 
+            match m with 
+            | MapEmpty -> x
+#if ONE 
+            | MapOne(k,v) -> f k v x
+#endif
+            | MapNode(k,v,l,r,_) -> fold f l (f k v (fold f r x))
+
+        let foldSection (comparer: IComparer<'T>) lo hi f m x =
+            let rec fold_from_to f m x = 
+                match m with 
+                | MapEmpty -> x
+#if ONE 
+                | MapOne(k,v) ->
+                    let clo_k = comparer.Compare(lo,k)
+                    let ck_hi = comparer.Compare(k,hi)
+                    let x = if clo_k <= 0 && ck_hi <= 0 then f k v x else x
+                    x
+#endif
+                | MapNode(k,v,l,r,_) ->
+                    let clo_k = comparer.Compare(lo,k)
+                    let ck_hi = comparer.Compare(k,hi)
+                    let x = if clo_k < 0                then fold_from_to f l x else x
+                    let x = if clo_k <= 0 && ck_hi <= 0 then f k v x                     else x
+                    let x = if ck_hi < 0                then fold_from_to f r x else x
+                    x
+           
+            if comparer.Compare(lo,hi) = 1 then x else fold_from_to f m x
+
+        let rec foldMap (comparer: IComparer<'T>) f m z acc = 
+            match m with 
+            | MapEmpty -> acc,z
+#if ONE 
+            | MapOne(k,v) -> 
+                let v',z = f k v z
+                add comparer k v' acc,z
+#endif
+            | MapNode(k,v,l,r,_) -> 
+                let acc,z = foldMap comparer f r z acc
+                let v',z = f k v z
+                let acc = add comparer k v' acc 
+                foldMap comparer f l z acc
+
+        let toList m = fold (fun k v acc -> (k,v) :: acc) m []
+        let toArray m = m |> toList |> Array.ofList
+        let ofList comparer l = List.fold (fun acc (k,v) -> add comparer k v acc) empty l
+
+        
+        let rec mkFromEnumerator comparer acc (e : IEnumerator<_>) = 
+            if e.MoveNext() then 
+                let (x,y) = e.Current 
+                mkFromEnumerator comparer (add comparer x y acc) e
+            else acc
+          
+        let ofSeq comparer (c : seq<_>) =
+            use ie = c.GetEnumerator()
+            mkFromEnumerator comparer empty ie 
+          
+        let copyToArray s (arr: _[]) i =
+            let j = ref i 
+            s |> iter (fun x y -> arr.[!j] <- KeyValuePair(x,y); j := !j + 1)
+
+
+        /// Imperative left-to-right iterators.
+        type MapIterator<'Key,'T>(s:MapTree<'Key,'T>) = 
+            // collapseLHS:
+            // a) Always returns either [] or a list starting with SetOne.
+            // b) The "fringe" of the set stack is unchanged. 
+            let rec collapseLHS stack =
+                match stack with
+                | []                           -> []
+                | MapEmpty             :: rest -> collapseLHS rest
+#if ONE 
+                | MapOne _         :: _ -> stack
+#else
+                | (MapNode(_,_,MapEmpty,MapEmpty,_)) :: _ -> stack
+#endif
+                | (MapNode(k,v,l,r,_)) :: rest -> collapseLHS (l :: MapOne (k,v) :: r :: rest)
+          
+              /// invariant: always collapseLHS result 
+            let mutable stack = collapseLHS [s]
+               /// true when MoveNext has been called   
+            let mutable started = false
+
+            let notStarted() = raise (new System.InvalidOperationException("Enumeration has not started. Call MoveNext."))
+            let alreadyFinished() = raise (new System.InvalidOperationException("Enumeration already finished."))
+
+            member i.Current =
+                if started then
+                    match stack with
+#if ONE
+                      | MapOne (k,v) :: _ -> new KeyValuePair<_,_>(k,v)
+#else
+                      | (MapNode(k,v,MapEmpty,MapEmpty,_)) :: _ -> new KeyValuePair<_,_>(k,v)
+#endif
+                      | []            -> alreadyFinished()
+                      | _             -> failwith "Please report error: Map iterator, unexpected stack for current"
+                else
+                    notStarted()
+
+            member i.MoveNext() =
+              if started then
+                match stack with
+#if ONE
+                  | MapOne _ :: rest -> 
+#else
+                  | (MapNode(_,_,MapEmpty,MapEmpty,_)) :: rest -> 
+#endif
+                      stack <- collapseLHS rest;
+                      not stack.IsEmpty
+                  | [] -> false
+                  | _ -> failwith "Please report error: Map iterator, unexpected stack for moveNext"
+              else
+                  // The first call to MoveNext "starts" the enumeration. 
+                  started <- true;  
+                  not stack.IsEmpty
+
+        let toSeq s = 
+            let i = ref (MapIterator(s))
+            { new IEnumerator<_> with 
+                  member self.Current = (!i).Current
+              interface System.Collections.IEnumerator with
+                  member self.Current = box (!i).Current
+                  member self.MoveNext() = (!i).MoveNext()
+                  member self.Reset() = i :=  MapIterator(s)
+              interface System.IDisposable with 
+                  member self.Dispose() = ()}
+
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+    [<System.Diagnostics.DebuggerDisplay ("Count = {Count}")>]
+#endif
+    [<Sealed>]
+    type Map<'Key,'T,'ComparerTag> when 'ComparerTag :> IComparer<'Key>( comparer: IComparer<'Key>, tree: MapTree<'Key,'T>) =
+
+        static let refresh (m:Map<_,_,'ComparerTag>) t =    Map<_,_,'ComparerTag>(comparer=m.ComparerUntyped, tree=t)
+
+        member s.Tree = tree
+        member s.ComparerUntyped : IComparer<'Key> = comparer
+        member s.Comparer = (comparer :?> 'ComparerTag)
+
+        static member Empty(comparer : 'ComparerTag) = Map<'Key,'T,'ComparerTag>(comparer=comparer, tree=MapTree.empty)
+        member m.Add(k,v) = refresh m (MapTree.add comparer k v tree)
+        member m.IsEmpty = MapTree.isEmpty tree
+        member m.Item with get(k : 'Key) = MapTree.find comparer k tree
+        member m.First(f) = MapTree.first f tree 
+        member m.Exists(f) = MapTree.exists f tree 
+        member m.Filter(f) = MapTree.filter comparer f tree |> refresh m 
+        member m.ForAll(f) = MapTree.forAll f tree 
+        member m.Fold f acc = MapTree.fold f tree acc
+        member m.FoldSection lo hi f acc = MapTree.foldSection comparer lo hi f tree acc 
+        member m.FoldAndMap f z  = 
+            let tree,z = MapTree.foldMap comparer f tree z MapTree.empty 
+            refresh m tree, z
+        member m.Iterate f = MapTree.iter f tree
+        member m.MapRange f  = refresh m (MapTree.map f tree)
+        member m.Map f  = refresh m (MapTree.mapi f tree)
+        member m.Partition(f)  =
+            let r1,r2 = MapTree.partition comparer f tree  
+            refresh m r1, refresh m r2
+        member m.Count = MapTree.count tree
+        member m.ContainsKey(k) = MapTree.containsKey comparer k tree
+        member m.Remove(k)  = refresh m (MapTree.remove comparer k tree)
+        member m.TryFind(k) = MapTree.tryFind comparer k tree
+        member m.ToList() = MapTree.toList tree
+        member m.ToArray() = MapTree.toArray tree
+
+        static member FromList(comparer : 'ComparerTag,l) : Map<'Key,'T,'ComparerTag> = 
+            Map<_,_,_>(comparer=comparer, tree=MapTree.ofList comparer l)
+
+        static member Create(comparer : 'ComparerTag, ie : seq<_>) : Map<'Key,'T,'ComparerTag> = 
+            Map<_,_,_>(comparer=comparer, tree=MapTree.ofSeq comparer ie)
+    
+        interface IEnumerable<KeyValuePair<'Key, 'T>> with
+            member s.GetEnumerator() = MapTree.toSeq tree
+
+        interface System.Collections.IEnumerable with
+            override s.GetEnumerator() = (MapTree.toSeq tree :> System.Collections.IEnumerator)
+
+        override this.Equals(that) = 
+            match that with
+            // Cast to the exact same type as this, otherwise not equal.
+            | :? Map<'Key,'T,'ComparerTag> as that -> ((this :> System.IComparable).CompareTo(that) = 0)
+            | _ -> false
+
+        interface System.IComparable with 
+             member m1.CompareTo(m2: obj) = 
+                 Seq.compareWith 
+                   (fun (kvp1 : KeyValuePair<_,_>) (kvp2 : KeyValuePair<_,_>)-> 
+                       let c = m1.ComparerUntyped.Compare(kvp1.Key,kvp2.Key) in 
+                       if c <> 0 then c else Unchecked.compare kvp1.Value kvp2.Value)
+                   // Cast m2 to the exact same type as m1, see 4884.
+                   // It is not OK to cast m2 to seq<KeyValuePair<'Key,'T>>, since different compares could permute the KVPs.
+                   m1 (m2 :?> Map<'Key,'T,'ComparerTag>)
+
+        member this.ComputeHashCode() = 
+            let combineHash x y = (x <<< 1) + y + 631 
+            let mutable res = 0
+            for KeyValue(x,y) in this do
+                res <- combineHash res (Unchecked.hash x)
+                res <- combineHash res (Unchecked.hash y)
+            abs res
+
+        override this.GetHashCode() = this.ComputeHashCode()
+
+
+    type Map<'Key,'T> = Map<'Key, 'T, IComparer<'Key>>    
+    type Set<'T> = Set<'T, IComparer<'T>>    
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fsi
new file mode 100644
index 0000000..d5f11f5
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedCollections.fsi
@@ -0,0 +1,225 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+/// This namespace contains Test.PowerPack extensions for the F# collection types
+namespace Microsoft.FSharp.Collections.Tagged
+
+    open System
+    open System.Collections.Generic
+
+
+    /// Immutable sets based on binary trees, default tag
+
+    /// Immutable sets where a constraint tag carries information about the class of key-comparer being used.  
+    [<Sealed>]
+    type Set<'T,'ComparerTag> when 'ComparerTag :> IComparer<'T> =
+
+        /// Gets the comparer used for the set.
+        member Comparer : 'ComparerTag
+
+        /// A useful shortcut for Set.add.  Note this operation prodcues a new set
+        /// and does not mutate the original set.  The new set will share many storage
+        /// nodes with the original.  See the Set module for further operations on sets.
+        member Add : 'T -> Set<'T,'ComparerTag>
+        
+        /// A useful shortcut for Set.remove.  Note this operation produces a new set
+        /// and does not mutate the original set.  The new set will share many storage
+        /// nodes with the original.  See the Set module for further operations on sets.
+        member Remove : 'T -> Set<'T,'ComparerTag>
+        
+        /// Return the number of elements in the set
+        member Count : int
+        
+        /// A useful shortcut for Set.contains.  See the Set module for further operations on sets.
+        member Contains : 'T -> bool
+        
+        /// A useful shortcut for Set.isEmpty.  See the Set module for further operations on sets.
+        member IsEmpty  : bool
+
+        /// Apply the given function to each binding in the collection
+        member Iterate : ('T -> unit) -> unit
+
+        /// Apply the given accumulating function to all the elements of the set
+        member Fold    : ('T -> 'State -> 'State) -> 'State -> 'State
+
+        /// Build two new sets, one containing the elements for which the given predicate returns 'true',
+        /// and the other the remaining elements.
+        member Partition: predicate:('T -> bool) -> Set<'T,'ComparerTag> * Set<'T,'ComparerTag>
+
+        /// Return a new collection containing only the elements of the collection
+        /// for which the given predicate returns "true"
+        member Filter: predicate:('T -> bool) -> Set<'T,'ComparerTag> 
+
+        /// Test if any element of the collection satisfies the given predicate.
+        /// If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes 
+        /// <c>p i0 or ... or p iN</c>.
+        member Exists: predicate:('T -> bool) -> bool
+
+        /// Test if all elements of the collection satisfy the given predicate.
+        /// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and <c>j0...jN</c> then 
+        /// computes <c>p i0 && ... && p iN</c>.
+        member ForAll: predicate:('T -> bool) -> bool
+
+        /// A set based on the given comparer containing the given initial elements
+        static member Create: 'ComparerTag * seq<'T> -> Set<'T,'ComparerTag> 
+        
+        /// The empty set based on the given comparer
+        static member Empty: 'ComparerTag -> Set<'T,'ComparerTag> 
+        
+        /// A singleton set based on the given comparison operator
+        static member Singleton: 'ComparerTag * 'T -> Set<'T,'ComparerTag> 
+        
+        /// Compares two sets and returns true if they are equal or false otherwise
+        static member Equality : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> bool
+        
+        /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b        
+        static member Compare : a:Set<'T,'ComparerTag> * b:Set<'T,'ComparerTag> -> int
+
+        /// Return a new set with the elements of the second set removed from the first.
+        static member (-) : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag> 
+
+        /// Compute the union of the two sets.
+        static member (+) : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag> 
+
+        /// Compute the intersection of the two sets.
+        static member Intersection : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag> 
+
+        /// Compute the union of the two sets.
+        static member Union : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag>
+
+        /// Return a new set with the elements of the second set removed from the first.
+        static member Difference: Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag> 
+
+        /// The number of elements in the set
+        member Choose : 'T 
+
+        /// Returns the lowest element in the set according to the ordering being used for the set
+        member MinimumElement: 'T
+
+        /// Returns the highest element in the set according to the ordering being used for the set
+        member MaximumElement: 'T
+
+        /// Evaluates to "true" if all elements of the second set are in the first
+        member IsSubsetOf: Set<'T,'ComparerTag> -> bool
+
+        /// Evaluates to "true" if all elements of the first set are in the second
+        member IsSupersetOf: Set<'T,'ComparerTag> -> bool
+
+        /// The elements of the set as a list.
+        member ToList : unit -> 'T list
+        
+        /// The elements of the set as an array.
+        member ToArray: unit -> 'T array 
+
+        interface ICollection<'T> 
+        interface IEnumerable<'T> 
+        interface System.Collections.IEnumerable
+
+        interface System.IComparable
+        override Equals : obj -> bool
+
+    type Set<'T> = Set<'T, IComparer<'T>>    
+
+    /// Immutable maps.  Keys are ordered by construction function specified
+    /// when creating empty maps or by F# structural comparison if no
+    /// construction function is specified.
+    ///
+    /// <performance> 
+    ///   Maps based on structural comparison are  
+    ///   efficient for small keys. They are not a suitable choice if keys are recursive data structures 
+    ///   or require non-structural comparison semantics.
+    /// </performance>
+
+    /// Immutable maps.  A constraint tag carries information about the class of key-comparers being used.  
+    [<Sealed>]
+    type Map<'Key,'Value,'ComparerTag>  when 'ComparerTag :> IComparer<'Key> =
+        /// Return a new map with the binding added to the given map.
+        member Add: 'Key * 'Value -> Map<'Key,'Value,'ComparerTag>
+
+        /// Gets a value indicating whether there are no bindings in the map.
+        member IsEmpty: bool
+        
+        /// Gets the comparer used for the map.
+        member Comparer : 'ComparerTag
+
+        /// The empty map, and use the given comparer comparison function for all operations associated
+        /// with any maps built from this map.
+        static member Empty: 'ComparerTag -> Map<'Key,'Value,'ComparerTag>
+
+        static member FromList : 'ComparerTag * ('Key * 'Value) list -> Map<'Key,'Value,'ComparerTag>
+
+        /// Build a map that contains the bindings of the given IEnumerable
+        /// and where comparison of elements is based on the given comparison function
+        static member Create: 'ComparerTag * seq<'Key * 'Value> -> Map<'Key,'Value,'ComparerTag> 
+
+        /// Test is an element is in the domain of the map
+        member ContainsKey: 'Key -> bool
+
+        /// The number of bindings in the map
+        member Count: int
+
+        /// Lookup an element in the map. Raise <c>KeyNotFoundException</c> if no binding
+        /// exists in the map.
+        member Item : 'Key -> 'Value with get
+
+        /// Search the map looking for the first element where the given function returns a <c>Some</c> value
+        member First: ('Key -> 'Value -> 'T option) -> 'T option
+
+        /// Return true if the given predicate returns true for all of the
+        /// bindings in the map. Always returns true if the map is empty.
+        member ForAll: ('Key -> 'Value -> bool) -> bool
+
+        /// Return true if the given predicate returns true for one of the
+        /// bindings in the map. Always returns false if the map is empty.
+        member Exists: ('Key -> 'Value -> bool) -> bool
+
+        /// Build a new map containing the bindings for which the given predicate returns 'true'.
+        member Filter: ('Key -> 'Value -> bool) -> Map<'Key,'Value,'ComparerTag> 
+
+        /// Fold over the bindings in the map.  
+        member Fold: folder:('Key -> 'Value -> 'State -> 'State) -> 'State -> 'State
+
+        /// Given the start and end points of a key range,
+        /// Fold over the bindings in the map that are in the range,
+        /// and the end points are included if present (the range is considered a closed interval).
+        member FoldSection: 'Key -> 'Key -> ('Key -> 'Value -> 'State -> 'State) -> 'State -> 'State
+
+        /// Fold over the bindings in the map.  
+        member FoldAndMap: ('Key -> 'Value -> 'State -> 'T * 'State) -> 'State -> Map<'Key,'T,'ComparerTag> * 'State
+
+        /// Apply the given function to each binding in the dictionary
+        member Iterate: action:('Key -> 'Value -> unit) -> unit
+
+        /// Build a new collection whose elements are the results of applying the given function
+        /// to each of the elements of the collection. The index passed to the
+        /// function indicates the index of element being transformed.
+        member Map: mapping:('Key -> 'Value -> 'T) -> Map<'Key,'T,'ComparerTag>
+
+        /// Build a new collection whose elements are the results of applying the given function
+        /// to each of the elements of the collection.
+        member MapRange: mapping:('Value -> 'T) -> Map<'Key,'T,'ComparerTag>
+
+        /// Build two new maps, one containing the bindings for which the given predicate returns 'true',
+        /// and the other the remaining bindings.
+        member Partition: ('Key -> 'Value -> bool) -> Map<'Key,'Value,'ComparerTag> * Map<'Key,'Value,'ComparerTag>
+
+        /// Remove an element from the domain of the map.  No exception is raised if the element is not present.
+        member Remove: 'Key -> Map<'Key,'Value,'ComparerTag>
+
+        /// Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain 
+        /// of the map and <c>None</c> if not.
+        member TryFind: 'Key -> 'Value option
+
+        /// The elements of the set as a list.
+        member ToList : unit -> ('Key * 'Value) list
+    
+        /// The elements of the set as an array
+        member ToArray: unit -> ('Key * 'Value) array 
+
+        interface IEnumerable<KeyValuePair<'Key, 'Value>>
+        
+        interface System.Collections.IEnumerable 
+        interface System.IComparable
+        override Equals : obj -> bool
+
+    type Map<'Key,'Value> = Map<'Key, 'Value, IComparer<'Key>>    
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fs
new file mode 100644
index 0000000..822e5ac
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fs
@@ -0,0 +1,59 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections.Tagged
+
+    #nowarn "51"
+
+    open System
+    open System.Collections.Generic
+    open Microsoft.FSharp.Collections
+    type UntaggedHashMultiMap<'Key,'Value> = Microsoft.FSharp.Collections.HashMultiMap<'Key,'Value>
+
+    type HashMultiMap<'Key,'Value,'HashTag>
+         when 'HashTag :> IEqualityComparer<'Key> =
+        { t : UntaggedHashMultiMap<'Key,'Value> }
+
+        static member Create(hasheq: 'HashTag,n:int)  : HashMultiMap<'Key,'Value,'HashTag> = 
+            { t = new UntaggedHashMultiMap<_,_>(n,hasheq) }
+
+        member x.Add(y,z) = x.t.Add(y,z)
+        member x.Clear() = x.t.Clear()
+        member x.Copy() : HashMultiMap<'Key,'Value,'HashTag>  = { t = x.t.Copy() }
+        member x.Item with get(y) = x.t.[y]
+                      and  set y z = x.t.[y] <- z
+        member x.FindAll(y) = x.t.FindAll(y) 
+        member x.Fold f acc =  x.t.Fold f acc
+        member x.Iterate(f) =  x.t.Iterate(f)
+        member x.Contains(y) = x.t.ContainsKey(y)
+        member x.ContainsKey(y) = x.t.ContainsKey(y)
+        member x.Remove(y) = x.t.Remove(y)
+        member x.Replace(y,z) = x.t.Replace(y,z)
+        member x.TryFind(y) = x.t.TryFind(y)
+        member x.Count = x.t.Count
+
+    type HashMultiMap<'Key,'Value> = HashMultiMap<'Key,'Value, IEqualityComparer<'Key>>    
+
+
+    [<Sealed>]
+    type HashSet<'T,'HashTag when 'T : equality> 
+         when 'HashTag :> IEqualityComparer<'T>(t:  HashSet<'T>) =
+
+        static member Create(hasheq: ('HashTag :> IEqualityComparer<'T>),size:int) : HashSet<'T,'HashTag> = 
+            new HashSet<'T,'HashTag>(HashSet<_>(size,hasheq))
+
+        member x.Add(y)    = t.Add(y)
+        member x.Clear() = t.Clear()
+        member x.Copy() = new HashSet<'T,'HashTag>(t.Copy())
+        member x.Fold f acc = t.Fold f acc
+        member x.Iterate(f) =  t.Iterate(f)
+        member x.Contains(y) = t.Contains(y)
+        member x.Remove(y) = t.Remove(y)
+        member x.Count = t.Count
+
+        interface IEnumerable<'T> with
+            member x.GetEnumerator() = (t :> seq<_>).GetEnumerator() 
+
+        interface System.Collections.IEnumerable with 
+            member x.GetEnumerator() = (t :> System.Collections.IEnumerable).GetEnumerator()  
+
+    type HashSet<'T when 'T : equality> = HashSet<'T, IEqualityComparer<'T>>    
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fsi
new file mode 100644
index 0000000..04fe8a8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/TaggedHash.fsi
@@ -0,0 +1,89 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections.Tagged
+
+    open System
+    open System.Collections.Generic
+
+    /// HashMultiMap, but where a constraint tag tracks information about the hash/equality functions used
+    /// for the hashing. When the tag is Tags.StructuralHash this is identical to HashMultiMap.
+    [<Sealed>]
+    type HashMultiMap<'Key,'Value,'HashTag> when 'HashTag :> IEqualityComparer<'Key> =
+        /// Create a new empty mutable hash table with an internal bucket array of the given approximate size
+        /// and with the given key hash/equality functions
+        static member Create: 'HashTag * int             -> HashMultiMap<'Key,'Value,'HashTag>
+
+        /// Make a shallow copy of the collection
+        member Copy    : unit    -> HashMultiMap<'Key,'Value,'HashTag>
+
+        /// Add a binding for the element to the table
+        member Add     : 'Key * 'Value -> unit
+
+        /// Clear all elements from the collection
+        member Clear   : unit    -> unit
+
+        /// Test if the collection contains any bindings for the given element
+        [<System.Obsolete("This member has been renamed to ContainsKey")>]
+        member Contains: 'Key      -> bool
+
+        /// Test if the collection contains any bindings for the given element
+        member ContainsKey: 'Key      -> bool
+
+        /// Remove the latest binding (if any) for the given element from the table
+        member Remove  : 'Key      -> unit
+
+        /// Replace the latest binding (if any) for the given element.
+        member Replace : 'Key * 'Value -> unit
+
+        /// Lookup or set the given element in the table.  Raise <c>KeyNotFoundException</c> if the element is not found.
+        member Item : 'Key -> 'Value with get,set
+
+        /// Lookup the given element in the table, returning the result as an Option
+        member TryFind : 'Key      -> 'Value option
+        /// Find all bindings for the given element in the table, if any
+        member FindAll : 'Key      -> 'Value list
+
+        /// Apply the given function to each element in the collection threading the accumulating parameter
+        /// through the sequence of function applications
+        member Fold    : ('Key -> 'Value -> 'c -> 'c) -> 'c -> 'c
+
+        /// The number of bindings in the hash table
+        member Count   : int
+
+        /// Apply the given function to each binding in the hash table 
+        member Iterate : ('Key -> 'Value -> unit) -> unit
+
+    type HashMultiMap<'Key,'Value> = HashMultiMap<'Key,'Value, IEqualityComparer<'Key>>    
+
+    /// Mutable hash sets where a constraint tag tracks information about the hash/equality functions used
+    /// for the hashing. When the tag is Tags.StructuralHash this is identical to HashSet.
+    [<Sealed>]
+    type HashSet<'T,'HashTag> when 'T : equality and 'HashTag :> IEqualityComparer<'T>  =
+        /// Create a new empty mutable hash set with an internal bucket array of the given approximate size
+        /// and with the given key hash/equality functions 
+        static member Create: 'HashTag * int             -> HashSet<'T,'HashTag>
+
+        /// Make a shallow copy of the set
+        member Copy    : unit -> HashSet<'T,'HashTag>
+        /// Add an element to the collection
+        member Add     : 'T   -> unit
+        /// Clear all elements from the set
+        member Clear   : unit -> unit
+        /// Test if the set contains the given element
+        member Contains: 'T   -> bool
+        /// Remove the given element from the set
+        member Remove  : 'T   -> unit
+        /// Apply the given function to the set threading the accumulating parameter
+        /// through the sequence of function applications
+        member Fold    : ('T -> 'State -> 'State) -> 'State -> 'State
+        
+        /// The number of elements in the set
+        member Count   : int
+
+        /// Apply the given function to each binding in the hash table 
+        member Iterate : ('T -> unit) -> unit
+
+        interface IEnumerable<'T> 
+        interface System.Collections.IEnumerable 
+
+    type HashSet<'T when 'T : equality> = HashSet<'T, IEqualityComparer<'T>>    
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Test.PowerPack.fsproj b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Test.PowerPack.fsproj
new file mode 100644
index 0000000..8f4e7f7
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/Test.PowerPack.fsproj
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <FSharpPowerPackSourcesRoot>..</FSharpPowerPackSourcesRoot>
+    <Name>Test.PowerPack</Name>
+  </PropertyGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.Settings.targets" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{649FA588-F02E-457C-9FCF-87E46407481F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AssemblyName>Test.PowerPack</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <TreatWarningsAsErrors>
+    </TreatWarningsAsErrors>
+    <DocumentationFile>Test.PowerPack.xml</DocumentationFile>
+    <NoWarn>$(NoWarn);9;44;60;35;42;62;86;47;40;51</NoWarn>
+  </PropertyGroup>
+  <!-- These dummy entries are needed for F# Beta2 -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="..\assemblyinfo.Common.fs">
+      <Link>assemblyinfo.Common.fs</Link>
+    </Compile>
+    <Compile Include="assemblyinfo.FSharp.PowerPack.dll.fs">
+      <Link>assemblyinfo.FSharp.PowerPack.dll.fs</Link>
+    </Compile>
+    <Compile Include="sformat.fsi" />
+    <Compile Include="sformat.fs" />
+    <Compile Include="math\q.fsi">
+      <Link>q.fsi</Link>
+    </Compile>
+    <Compile Include="math\q.fs">
+      <Link>q.fs</Link>
+    </Compile>
+    <Compile Include="Compat.String.fsi" />
+    <Compile Include="Compat.String.fs" />
+    <Compile Include="Compat.List.fsi" />
+    <Compile Include="Compat.List.fs" />
+    <Compile Include="Compat.Array.fsi" />
+    <Compile Include="Compat.Array.fs" />
+    <Compile Include="Compat.Array2D.fsi" />
+    <Compile Include="Compat.Array2D.fs" />
+    <Compile Include="Compat.Seq.fsi" />
+    <Compile Include="Compat.Seq.fs" />
+    <Compile Include="resizearray.fsi" />
+    <Compile Include="resizearray.fs" />
+    <Compile Include="HashMultiMap.fsi" />
+    <Compile Include="HashMultiMap.fs" />
+    <Compile Include="AsyncOperations.fsi" />
+    <Compile Include="AsyncOperations.fs" />
+    <Compile Include="AsyncWorker.fsi" />
+    <Compile Include="AsyncWorker.fs" />
+    <Compile Include="HashSet.fsi" />
+    <Compile Include="HashSet.fs" />
+    <Compile Include="TaggedCollections.fsi" />
+    <Compile Include="TaggedCollections.fs" />
+    <Compile Include="TaggedHash.fsi" />
+    <Compile Include="TaggedHash.fs" />
+    <Compile Include="Measure.fsi" />
+    <Compile Include="Measure.fs" />
+    <Compile Include="SI.fs" />
+    <Compile Include="PhysicalConstants.fs" />
+    <Compile Include="lazy.fsi" />
+    <Compile Include="lazy.fs" />
+    <Compile Include="permutation.fsi" />
+    <Compile Include="permutation.fs" />
+    <Compile Include="math\INumeric.fsi">
+      <Link>INumeric.fsi</Link>
+    </Compile>
+    <Compile Include="math\INumeric.fs">
+      <Link>INumeric.fs</Link>
+    </Compile>
+    <Compile Include="math\complex.fsi">
+      <Link>complex.fsi</Link>
+    </Compile>
+    <Compile Include="math\complex.fs">
+      <Link>complex.fs</Link>
+    </Compile>
+    <Compile Include="math\associations.fsi">
+      <Link>associations.fsi</Link>
+    </Compile>
+    <Compile Include="math\associations.fs">
+      <Link>associations.fs</Link>
+    </Compile>
+    <Compile Include="math\matrix.fsi">
+      <Link>matrix.fsi</Link>
+    </Compile>
+    <Compile Include="math\matrix.fs">
+      <Link>matrix.fs</Link>
+    </Compile>
+    <Compile Include="NativeArray.fsi" />
+    <Compile Include="NativeArray.fs" />
+    <Compile Include="math\NativeArrayExtensions.fsi" />
+    <Compile Include="math\NativeArrayExtensions.fs" />
+    <Compile Include="prim-lexing.fsi">
+      <Link>prim-lexing.fsi</Link>
+    </Compile>
+    <Compile Include="prim-lexing.fs">
+      <Link>prim-lexing.fs</Link>
+    </Compile>
+    <Compile Include="prim-parsing.fsi">
+      <Link>prim-parsing.fsi</Link>
+    </Compile>
+    <Compile Include="prim-parsing.fs">
+      <Link>prim-parsing.fs</Link>
+    </Compile>
+    <Compile Include="byte.fsi">
+      <Link>byte.fsi</Link>
+    </Compile>
+    <Compile Include="byte.fs">
+      <Link>byte.fs</Link>
+    </Compile>
+    <Compile Include="char.fsi">
+      <Link>char.fsi</Link>
+    </Compile>
+    <Compile Include="char.fs">
+      <Link>char.fs</Link>
+    </Compile>
+    <Compile Include="sbyte.fs">
+      <Link>sbyte.fs</Link>
+    </Compile>
+    <Compile Include="int16.fs">
+      <Link>int16.fs</Link>
+    </Compile>
+    <Compile Include="int32.fsi">
+      <Link>int32.fsi</Link>
+    </Compile>
+    <Compile Include="int32.fs">
+      <Link>int32.fs</Link>
+    </Compile>
+    <Compile Include="int64.fsi">
+      <Link>int64.fsi</Link>
+    </Compile>
+    <Compile Include="int64.fs">
+      <Link>int64.fs</Link>
+    </Compile>
+    <Compile Include="uint32.fsi">
+      <Link>uint32.fsi</Link>
+    </Compile>
+    <Compile Include="uint32.fs">
+      <Link>uint32.fs</Link>
+    </Compile>
+    <Compile Include="uint64.fsi">
+      <Link>uint64.fsi</Link>
+    </Compile>
+    <Compile Include="uint64.fs">
+      <Link>uint64.fs</Link>
+    </Compile>
+    <Compile Include="float.fsi">
+      <Link>float.fsi</Link>
+    </Compile>
+    <Compile Include="float.fs">
+      <Link>float.fs</Link>
+    </Compile>
+    <Compile Include="hashtbl.fsi">
+      <Link>hashtbl.fsi</Link>
+    </Compile>
+    <Compile Include="hashtbl.fs">
+      <Link>hashtbl.fs</Link>
+    </Compile>
+    <Compile Include="arg.fsi">
+      <Link>arg.fsi</Link>
+    </Compile>
+    <Compile Include="arg.fs">
+      <Link>arg.fs</Link>
+    </Compile>
+    <Compile Include="sys.fsi">
+      <Link>sys.fsi</Link>
+    </Compile>
+    <Compile Include="sys.fs">
+      <Link>sys.fs</Link>
+    </Compile>
+    <Compile Include="obj.fsi">
+      <Link>obj.fsi</Link>
+    </Compile>
+    <Compile Include="obj.fs">
+      <Link>obj.fs</Link>
+    </Compile>
+    <Compile Include="filename.fsi">
+      <Link>filename.fsi</Link>
+    </Compile>
+    <Compile Include="filename.fs">
+      <Link>filename.fs</Link>
+    </Compile>
+    <Compile Include="map.fsi">
+      <Link>map.fsi</Link>
+    </Compile>
+    <Compile Include="map.fs">
+      <Link>map.fs</Link>
+    </Compile>
+    <Compile Include="set.fsi">
+      <Link>set.fsi</Link>
+    </Compile>
+    <Compile Include="set.fs">
+      <Link>set.fs</Link>
+    </Compile>
+    <Compile Include="printexc.fsi">
+      <Link>printexc.fsi</Link>
+    </Compile>
+    <Compile Include="printexc.fs">
+      <Link>printexc.fs</Link>
+    </Compile>
+    <Compile Include="pervasives.fsi">
+      <Link>pervasives.fsi</Link>
+    </Compile>
+    <Compile Include="pervasives.fs">
+      <Link>pervasives.fs</Link>
+    </Compile>
+    <Compile Include="buffer.fsi">
+      <Link>buffer.fsi</Link>
+    </Compile>
+    <Compile Include="buffer.fs">
+      <Link>buffer.fs</Link>
+    </Compile>
+    <Compile Include="lexing.fsi">
+      <Link>lexing.fsi</Link>
+    </Compile>
+    <Compile Include="lexing.fs">
+      <Link>lexing.fs</Link>
+    </Compile>
+    <Compile Include="parsing.fsi">
+      <Link>parsing.fsi</Link>
+    </Compile>
+    <Compile Include="parsing.fs">
+      <Link>parsing.fs</Link>
+    </Compile>
+    <Compile Include="lazylist.fsi">
+      <Link>lazylist.fsi</Link>
+    </Compile>
+    <Compile Include="lazylist.fs">
+      <Link>lazylist.fs</Link>
+    </Compile>
+    <Compile Include="PowerPack.fs" />
+    <Compile Include="uint16.fs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.Net" Condition="'$(targetCLIDir)' == 'Silverlight/2.0/' OR '$(targetCLIDir)' == 'Silverlight/3.5/' " />
+    <Reference Include="FSharp.Core" />
+  </ItemGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.targets" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets'))" />
+  <Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="(!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets')) And (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')) And (Exists('$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets'))" />
+</Project>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/UnitTestHelpers.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/UnitTestHelpers.fs
new file mode 100644
index 0000000..1166f4b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/UnitTestHelpers.fs
@@ -0,0 +1,12 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace UnitTestHelpers
+
+open System
+open Microsoft.Build.Framework
+open Microsoft.Build.Utilities
+
+// For unit testing (attaching a Logger listener)      
+type FsCustomBuildEventArgs(s:string) =
+    inherit CustomBuildEventArgs()
+    
+    member this.CommandLine = s
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fs
new file mode 100644
index 0000000..2a60eb8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fs
@@ -0,0 +1,111 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#if INTERNALIZED_POWER_PACK
+module internal Internal.Utilities.Arg
+#else
+module Microsoft.FSharp.Compatibility.Arg
+#endif
+
+
+type spec =
+  | Clear of (bool ref)       
+  | Float of (float -> unit)
+  | Int of (int -> unit)    
+  | Rest of (string -> unit)
+  | Set of (bool ref)
+  | String of (string -> unit)
+  | Unit of (unit -> unit)  
+
+let getUsage specs u =  
+  let sbuf = new System.Text.StringBuilder 100  
+  let pstring (s:string) = sbuf.Append s |> ignore 
+  let pendline s = pstring s; pstring "\n" 
+  pendline u;
+  List.iter (function 
+    | (s, (Unit _ | Set _ | Clear _), helpText) -> pstring "\t"; pstring s; pstring ": "; pendline helpText
+    | (s, String _, helpText) -> pstring "\t"; pstring s; pstring " <string>: "; pendline helpText
+    | (s, Int _, helpText) -> pstring "\t"; pstring s; pstring " <int>: "; pendline helpText
+    | (s, Float _, helpText) ->  pstring "\t"; pstring s; pstring " <float>: "; pendline helpText
+    | (s, Rest _, helpText) -> pstring "\t"; pstring s; pstring " ...: "; pendline helpText)
+    specs;
+  pstring "\t"; pstring "--help"; pstring ": "; pendline "display this list of options";
+  pstring "\t"; pstring "-help"; pstring ": "; pendline "display this list of options";
+  sbuf.ToString()
+
+let incr r = r := !r + 1
+let usage specs u = System.Console.Error.WriteLine (getUsage specs u)
+type argspec = (string * spec * string) 
+
+exception Help of string
+exception Bad of string
+
+let parse_argv cursor argv specs other usageText =
+  let nargs = Array.length argv in 
+  incr cursor;
+  while !cursor < nargs do
+    let arg = argv.[!cursor] in 
+    let rec findMatchingArg (l: argspec  list) = 
+      match l with 
+      | ((s, action, _) :: _) when s = arg -> 
+         let getSecondArg () = 
+           if !cursor + 1 >= nargs then 
+             raise(Bad("option "+s+" needs an argument.\n"+getUsage specs usageText));
+           argv.[!cursor+1] 
+           
+         match action with 
+         | Unit f -> 
+           f (); 
+           incr cursor
+         | Set f ->
+           f := true; 
+           incr cursor
+         | Clear f -> 
+           f := false; 
+           incr cursor
+         | String f-> 
+           let arg2 = getSecondArg() in 
+           f arg2; 
+           cursor := !cursor + 2
+         | Int f -> 
+           let arg2 = getSecondArg () in 
+           let arg2 = try int32 arg2 with _ -> raise(Bad(getUsage specs usageText)) in  
+           f arg2;
+           cursor := !cursor + 2;
+         | Float f -> 
+           let arg2 = getSecondArg() in 
+           let arg2 = try float arg2 with _ -> raise(Bad(getUsage specs usageText)) in 
+           f arg2; 
+           cursor := !cursor + 2;
+         | Rest f -> 
+           incr cursor;
+           while !cursor < nargs do
+               f (argv.[!cursor]);
+               incr cursor;
+
+      | (_ :: more)  -> findMatchingArg more 
+      | [] -> 
+          if arg = "-help" || arg = "--help" then
+              raise (Help (getUsage specs usageText))
+          elif arg.Length>0 && arg.[0] = '-' then
+              raise (Bad ("unrecognized argument: "+ arg + "\n" + getUsage specs usageText))
+          else 
+             other arg;
+             incr cursor
+    findMatchingArg specs 
+  done
+
+#if FX_NO_COMMAND_LINE_ARGS
+#else
+let current = ref 0
+let parse specs other usage = 
+  let argv = System.Environment.GetCommandLineArgs() in 
+  try parse_argv current argv specs other usage
+  with 
+    | Bad h 
+    | Help h -> 
+        System.Console.Error.WriteLine h; 
+        System.Console.Error.Flush();  
+        System.Environment.Exit(1); 
+    | e -> 
+        reraise()
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fsi
new file mode 100644
index 0000000..3ece3a4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/arg.fsi
@@ -0,0 +1,47 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+/// A simple command-line argument processor.
+#if INTERNALIZED_POWER_PACK
+module internal Internal.Utilities.Arg
+#else
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.Arg
+#endif
+
+/// The spec value describes the action of the argument,
+/// and whether it expects a following parameter.
+type spec = 
+  | Clear of bool ref
+  | Float of (float -> unit)
+  | Int of (int -> unit)
+  | Rest of (string -> unit)
+  | Set of bool ref
+  | String of (string -> unit)
+  | Unit of (unit -> unit)
+
+type argspec = (string * spec * string)
+
+/// "parse specs f use" parses the arguments given by Sys.argv
+/// according to the argument processing specifications "specs".
+/// Arguments begin with "-". Non-arguments are passed to "f" in
+/// order.  "use" is printed as part of the usage line if an error occurs.
+///
+/// Permitted arguments are specified using triples: (arg, action, help).
+/// Actions are:
+///   Unit(f): call f, no subseq. arg
+///   Set(br): set ref to 'true', no subseq. arg.
+///   Clear(br): set ref to 'false, no subseq. arg.
+///   String(f): pass the subseq. arg to f
+///   Int(f): pass the subseq. arg to f
+///   Float(f): pass the subseq. arg to f
+///   Rest(f): pass all subseq. args to f in order
+#if FX_NO_COMMAND_LINE_ARGS
+#else
+val parse: argspec list -> (string -> unit) -> string -> unit
+#endif
+val parse_argv: int ref -> string array -> argspec list -> (string -> unit) -> string -> unit
+
+/// "usage specs use" prints the help for each argument.
+val usage: argspec list -> string -> unit
+exception Bad of string
+exception Help of string
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/assemblyinfo.FSharp.PowerPack.dll.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/assemblyinfo.FSharp.PowerPack.dll.fs
new file mode 100644
index 0000000..5ceabf5
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/assemblyinfo.FSharp.PowerPack.dll.fs
@@ -0,0 +1,8 @@
+namespace Microsoft.FSharp
+open System.Reflection
+[<assembly:AssemblyDescription("Test.PowerPack.dll")>]
+[<assembly:AssemblyCompany("Microsoft Corporation")>]
+[<assembly:AssemblyTitle("Test.PowerPack.dll")>]
+[<assembly:AssemblyCopyright("\169 Microsoft Corporation.  All rights reserved.")>]
+[<assembly:AssemblyProduct("Microsoft\174 F#")>]
+do()
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fs
new file mode 100644
index 0000000..3eb1431
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fs
@@ -0,0 +1,32 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+module Microsoft.FSharp.Compatibility.OCaml.Buffer
+
+open Microsoft.FSharp.Compatibility.OCaml
+open Microsoft.FSharp.Compatibility.OCaml.Pervasives
+
+#nowarn "62" // use of ocaml compat functions from Pervasives
+
+type t = System.Text.StringBuilder
+
+let create (n:int) = new System.Text.StringBuilder(n)
+    
+let contents (t:t) = t.ToString()
+let length (t:t) = t.Length
+let clear (t:t) = ignore (t.Remove(0,length t))
+let reset (t:t) = ignore (t.Remove(0,length t))
+let add_char (t:t) (c:char) = ignore (t.Append(c))
+let add_string (t:t) (s:string) = ignore (t.Append(s))
+let add_substring (t:t) (s:string) n m = ignore (t.Append(s.[n..n+m-1]))
+let add_buffer (t:t) (t2:t) = ignore (t.Append(t2.ToString()))
+
+#if FX_NO_ASCII_ENCODING
+#else
+let add_channel (t:t) (c:in_channel) n = 
+  let b = Array.zeroCreate n  in 
+  really_input c b 0 n;
+  ignore (t.Append(System.Text.Encoding.ASCII.GetString(b, 0, n)))
+#endif
+
+let output_buffer (os:out_channel) (t:t) = 
+  output_string os (t.ToString())
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fsi
new file mode 100644
index 0000000..123700b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/buffer.fsi
@@ -0,0 +1,56 @@
+//==========================================================================
+// Buffer: StringBuilder operations for ML compatibility
+//
+// (c) Microsoft Corporation 2005-2008.  The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Imperative buffers for building strings, a shallow interface to <c>System.Text.StringBuilder</c>
+[<CompilerMessage("This module is for ML compatibility. The Buffer module is a thin wrapper over the type System.Text.StringBuilder. Consider using that type directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Buffer
+open Microsoft.FSharp.Compatibility.OCaml.Pervasives
+
+#nowarn "62" // use of ocaml compat types from Pervasives
+
+type t = System.Text.StringBuilder
+
+/// Add second buffer to the first.
+val add_buffer: t -> t -> unit
+
+/// Add character to the buffer.
+val add_char: t -> char -> unit
+
+/// Add string to the buffer.
+val add_string: t -> string -> unit
+
+/// Given a string, start position and length add that substring to the buffer.
+val add_substring: t -> string -> int -> int -> unit
+
+/// Clears the buffer.
+val clear: t -> unit
+
+/// Gets the string built from the buffer.
+val contents: t -> string
+
+/// Create a buffer with suggested size.
+val create: int -> t
+
+/// Number of characters in the buffer.
+val length: t -> int
+
+val output_buffer: out_channel -> t -> unit
+
+/// Clears the buffer (same as Buffer.clear).
+val reset: t -> unit
+
+#if FX_NO_ASCII_ENCODING
+#else
+/// Read the given number of bytes as ASCII and add the resulting string 
+/// to the buffer.  Warning: this assumes an ASCII encoding for the I/O channel, i.e. it uses 
+/// Pervasives.really_input and then use ascii_to_string to produce the string 
+/// to add.  
+val add_channel: t -> in_channel -> int -> unit
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fs
new file mode 100644
index 0000000..0eacd4b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fs
@@ -0,0 +1,44 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//==========================================================================
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module Byte= 
+
+    let compare (x:byte) y = compare x y
+
+    let zero = 0uy
+    let one = 1uy
+    let add (x:byte) (y:byte) = x + y
+    let sub (x:byte) (y:byte) = x - y
+    let mul (x:byte) (y:byte) = x * y
+    let div (x:byte) (y:byte) = x / y
+    let rem (x:byte) (y:byte) = x % y
+    let succ (x:byte) = x + 1uy
+    let pred (x:byte) = x - 1uy
+    let max_int = 0xFFuy
+    let min_int = 0uy
+    let logand (x:byte) (y:byte) = x &&& y
+    let logor (x:byte) (y:byte) = x ||| y
+    let logxor (x:byte) (y:byte) = x ^^^ y
+    let lognot (x:byte) = ~~~x
+    let shift_left (x:byte) (n:int) =  x <<< n
+    let shift_right (x:byte) (n:int) =  x >>> n
+    let of_int (n:int) =  byte n
+    let to_int (x:byte) = int x
+    let of_char (n:char) =  byte n
+    let to_char (x:byte) = char x
+    let of_string (s:string) = byte (int32 s)
+      
+    let to_string (x:byte) =  (box x).ToString()
+
+    let of_int32 (n:int32) = byte n
+    let to_int32 (x:uint8) = int32 x
+
+    let of_uint16 (n:uint16) = byte n
+    let to_uint16 (x:uint8)  = uint16 x
+
+    let of_uint32 (n:uint32) = byte n
+    let to_uint32 (x:uint8)  = uint32 x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fsi
new file mode 100644
index 0000000..c53475c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/byte.fsi
@@ -0,0 +1,76 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//==========================================================================
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using operators such as 'int' and 'uint32' and 'uint64' to convert numbers")>]
+/// Byte (8-bit) operations.
+module Byte = 
+
+    /// The value zero as a System.Byte
+    val zero: byte
+    /// The value one as a System.Byte
+    val one: byte
+    /// Returns the successor of the argument wrapped around 255uy
+    val succ: byte -> byte
+    /// Returns the predeccessor of the argument wrapped around 0uy
+    val pred: byte -> byte
+
+    /// Returns the sum of a and b
+    val add: a:byte -> b:byte -> byte
+    /// Returns a divided by b 
+    val div: a:byte -> b:byte -> byte
+    /// Returns a multiplied by b 
+    val mul: a:byte -> b:byte -> byte
+    /// Returns a minus b 
+    val sub: a:byte -> b:byte -> byte
+    /// Returns the remainder of a divided by b
+    val rem: a:byte -> b:byte -> byte
+
+    /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
+    val compare: a:byte -> b:byte -> int
+
+    /// Combines the binary representation of a and b by bitwise and
+    val logand: a:byte -> b:byte -> byte
+    /// Returns the bitwise logical negation of a
+    val lognot: a:byte -> byte
+    /// Combines the binary representation of a and b by bitwise or
+    val logor: a:byte -> b:byte -> byte
+    /// Combines the binary representation of a and b by bitwise xor
+    val logxor: a:byte -> b:byte -> byte
+    /// Shifts the binary representation a by n bits to the left
+    val shift_left: a:byte -> n:int -> byte
+    /// Shifts the binary representation a by n bits to the right
+    val shift_right: a:byte -> n:int -> byte
+
+    /// Converts a char to a byte
+    val of_char: c:char -> byte
+    /// Converts a byte to a char 
+    val to_char: b:byte -> char
+
+    /// Converts a 32-bit integer to a byte
+    val of_int: i:int -> byte
+    /// Converts a byte to a 32-bit integer 
+    val to_int: b:byte -> int
+
+    /// Converts a 32-bit integer to a byte
+    val of_int32: i:int32 -> byte
+    /// Converts a byte to a 32-bit integer 
+    val to_int32: b:byte -> int32
+
+    /// Converts a 16-bit integer to a byte
+    val of_uint16: ui:uint16 -> byte
+    /// Converts a byte to a 16-bit integer 
+    val to_uint16: b:byte -> uint16
+
+    /// Converts an unsigned 32-bit integer to a byte
+    val of_uint32: ui:uint32 -> byte
+    /// Converts a byte to an unsigned 32-bit integer 
+    val to_uint32: b:byte -> uint32
+
+    /// Converts a string to a byte
+    val of_string: s:string -> byte
+    /// Converts a byte to a string
+    val to_string: b:byte -> string
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fs
new file mode 100644
index 0000000..c8bf88a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fs
@@ -0,0 +1,21 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//==========================================================================
+
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module Char = 
+    let compare (x:char) y = Operators.compare x y
+
+    let code (c:char) = int c 
+    let chr (n:int) =  char n 
+
+#if FX_NO_TO_LOWER_INVARIANT
+    let lowercase (c:char) = System.Char.ToLower(c, System.Globalization.CultureInfo.InvariantCulture)
+    let uppercase (c:char) = System.Char.ToUpper(c, System.Globalization.CultureInfo.InvariantCulture)
+#else
+    let lowercase (c:char) = System.Char.ToLowerInvariant(c)
+    let uppercase (c:char) = System.Char.ToUpperInvariant(c)
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fsi
new file mode 100644
index 0000000..13627d1
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/char.fsi
@@ -0,0 +1,23 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//==========================================================================
+
+namespace Microsoft.FSharp.Compatibility
+
+/// Unicode characters, i.e. the <c>System.Char</c> type.  see also the operations
+/// in <c>System.Char</c> and the <c>System.Text.Encoding</c> interfaces if necessary.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<RequireQualifiedAccess>]
+[<CompilerMessage("This module is for ML compatibility. Consider using the F# overloaded operators such as 'char' and 'int' to convert basic types and System.Char.ToLower and System.Char.ToUpper to change case. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Char = 
+
+    /// Converts the value of the specified 32-bit signed integer to its equivalent Unicode character
+    val chr: i:int -> char
+    /// Converts the value of the specified Unicode character to the equivalent 32-bit signed integer
+    val code: c:char -> int
+    /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
+    val compare: a:char -> b:char -> int
+    /// Converts the value of a Unicode character to its lowercase equivalent
+    val lowercase: char -> char
+    /// Converts the value of a Unicode character to its uppercase equivalent
+    val uppercase: char -> char 
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fs
new file mode 100644
index 0000000..64cfb60
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fs
@@ -0,0 +1,51 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+module Microsoft.FSharp.Compatibility.OCaml.Filename
+
+open System.IO
+
+let current_dir_name = "."
+let parent_dir_name =  ".."
+let concat (x:string) (y:string) = Path.Combine (x,y)
+let is_relative (s:string) = not (Path.IsPathRooted(s))
+
+// Case sensitive (original behaviour preserved).
+let check_suffix (x:string) (y:string) = x.EndsWith(y,System.StringComparison.Ordinal) 
+
+let chop_suffix (x:string) (y:string) =
+    if not (check_suffix x y) then 
+        raise (System.ArgumentException("chop_suffix")) // message has to be precisely this, for OCaml compatibility, and no argument name can be set
+    x.[0..x.Length-y.Length-1]
+
+let has_extension (s:string) = 
+    (s.Length >= 1 && s.[s.Length - 1] = '.' && s <> ".." && s <> ".") 
+    || Path.HasExtension(s)
+
+let chop_extension (s:string) =
+    if s = "." then "" else // for OCaml compatibility
+    if not (has_extension s) then 
+        raise (System.ArgumentException("chop_extension")) // message has to be precisely this, for OCaml compatibility, and no argument name can be set
+    Path.Combine (Path.GetDirectoryName s,Path.GetFileNameWithoutExtension(s))
+
+
+let basename (s:string) = 
+    Path.GetFileName(s)
+
+let dirname (s:string) = 
+    if s = "" then "."
+    else 
+      match Path.GetDirectoryName(s) with 
+      | null -> if Path.IsPathRooted(s) then s else "."
+      | res -> if res = "" then "." else res
+
+let is_implicit (s:string) = 
+    is_relative s &&
+      match Path.GetDirectoryName(s) with 
+      | null -> true
+      | res -> (res <> current_dir_name && res <> parent_dir_name)
+
+
+let temp_file (_p:string) (_s:string) = Path.GetTempFileName()
+
+let quote s = "\'" ^ s ^ "\'"
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fsi
new file mode 100644
index 0000000..b517994
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/filename.fsi
@@ -0,0 +1,62 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.   The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Common filename operations.  This module is included to make it possible to cross-compile 
+/// code with other ML compilers.  See also <c>System.IO.Path</c>
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Filename
+
+/// "check_suffix f s" returns true if filename "f" ends in suffix "s",
+/// e.g. check_suffix "abc.fs" ".fs" returns true.
+val check_suffix: string -> string -> bool
+
+/// "chop_extension f" removes the extension from the given
+/// filename. Raises ArgumentException if no extension is present.
+val chop_extension: string -> string
+
+/// Assuming "check_suffix f s" holds, "chop_suffix f s" returns the
+/// filename "f" with the suffix "s" removed.
+val chop_suffix: string -> string -> string
+
+/// "concat a b" returns System.IO.Path.Combine(a,b), i.e. the
+/// two names conjoined by the appropriate directory separator character
+/// for this architecture.
+val concat: string -> string -> string
+
+/// "dirname" and "basename" decompose a filename into a directory name
+/// and a filename, i.e. "concat (dirname s) (basename s) = s"
+val dirname: string -> string
+
+/// "dirname" and "basename" decompose a filename into a directory name
+/// and a filename, i.e. "concat (dirname s) (basename s) = s"
+val basename: string -> string
+
+/// The name used for the current directory on this OS. 
+val current_dir_name: string
+
+/// "parent_dir_name" returns the name for the directory above the current directory on
+/// this OS.
+val parent_dir_name: string
+
+/// Return true if the filename has a "." extension
+val has_extension: string -> bool
+
+/// Is the path is relative to the current directory or absolute.
+val is_relative: string -> bool
+
+/// Returns true if the path is relative to the current directory but does not begin with 
+/// an explicit "." or ".."
+val is_implicit: string -> bool
+
+/// "quote s" is designed for use to quote a filename when using it
+/// for a system command.  It returns ("\'" ^ s ^ "\'").  
+val quote: string -> string
+
+/// "temp_file f s" returns a hitherto unused new file name.  "f" and "s"
+/// are hints as to a suitable file name and suffix for the file.
+val temp_file: string -> string -> string
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fs
new file mode 100644
index 0000000..64e40f8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fs
@@ -0,0 +1,56 @@
+
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+/// ML-like operations on 64-bit System.Double floating point numbers.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module Float = 
+
+    let add (x:float) (y:float) = x + y
+    let div (x:float) (y:float) = x / y
+    let mul (x:float) (y:float) = x * y
+    let sub (x:float) (y:float) = x - y
+    let neg (x:float)   = - x
+
+    let compare (x:float) y = compare x y
+
+    let of_int (x:int) = float x
+    let ceil      (x:float)           = System.Math.Ceiling(x)
+    let floor     (x:float)           = System.Math.Floor(x)
+    let to_int (x:float) = 
+#if FX_NO_TRUNCATE
+         System.Convert.ToInt32(x) // REVIEW: possible implications of not calling Trancate?
+#else
+         System.Convert.ToInt32(System.Math.Truncate(x))
+#endif
+
+    let of_int64 (x:int64) = float x
+    let to_int64 (x:float) = int64 x
+
+    let of_int32 (x:int32) = float x
+    let to_int32 (x:float) = int32 x
+
+    let of_float32 (x:float32) = float x
+    let to_float32 (x:float) = float32 x
+
+    let to_string (x:float) = (box x).ToString()
+    let of_string (s:string) = 
+      (* Note System.Double.Parse doesn't handle -0.0 correctly (it returns +0.0) *)
+      let s = s.Trim()  
+      let l = s.Length 
+      let p = 0 
+      let p,sign = if (l >= p + 1 && s.[p] = '-') then 1,false else 0,true 
+      let n = 
+        try 
+          if p >= l then raise (new System.FormatException()) 
+          System.Double.Parse(s.[p..],System.Globalization.CultureInfo.InvariantCulture)
+        with :? System.FormatException -> failwith "Float.of_string"
+      if sign then n else -n
+
+#if FX_NO_DOUBLE_BIT_CONVERTER
+#else
+    let to_bits (x:float) = System.BitConverter.DoubleToInt64Bits(x)
+    let of_bits (x:int64) = System.BitConverter.Int64BitsToDouble(x)
+#endif
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fsi
new file mode 100644
index 0000000..1727dbd
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/float.fsi
@@ -0,0 +1,55 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.   
+//=========================================================================
+
+namespace Microsoft.FSharp.Compatibility
+
+/// ML-like operations on 64-bit System.Double floating point numbers.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<CompilerMessage("This module is for ML compatibility. Consider using the F# overloaded operators such as 'int' and 'float' to convert numbers. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Float= 
+
+    /// Returns the sum of a and b
+    val add: a:float -> b:float -> float
+    /// Returns a divided by b 
+    val div: a:float -> b:float -> float
+    /// Returns a multiplied by b 
+    val mul: a:float -> b:float -> float
+    /// Returns -a
+    val neg: a:float -> float
+    /// Returns a minus b 
+    val sub: a:float -> b:float -> float
+    /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
+    val compare: a:float -> b:float -> int
+
+    /// Converts a 32-bit integer to a 64-bit float
+    val of_int: i:int -> float
+    /// Converts a 64-bit float to a 32-bit integer
+    val to_int: f:float -> int
+
+    /// Converts a 32-bit integer to a 64-bit float
+    val of_int32: i:int32 -> float
+    /// Converts a 64-bit float to a 32-bit integer
+    val to_int32: f:float -> int32
+
+    /// Converts a 64-bit integer to a 64-bit float
+    val of_int64: i:int64 -> float
+    /// Converts a 64-bit float to a 64-bit integer 
+    val to_int64: f:float -> int64
+
+    /// Converts a 32-bit float to a 64-bit float
+    val of_float32: f32:float32 -> float
+    /// Converts a 64-bit float to a 32-bit float
+    val to_float32: f:float -> float32
+
+    /// Converts a string to a 64-bit float
+    val of_string: s:string -> float
+    /// Converts a 64-bit float to a string
+    val to_string: f:float -> string
+#if FX_NO_DOUBLE_BIT_CONVERTER
+#else
+    /// Converts a raw 64-bit representation to a 64-bit float
+    val of_bits: i64:int64 -> float
+    /// Converts a 64-bit float to raw 64-bit representation 
+    val to_bits: f:float -> int64
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fs
new file mode 100644
index 0000000..5e56572
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fs
@@ -0,0 +1,79 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  
+//
+//===========================================================================
+
+module Microsoft.FSharp.Compatibility.OCaml.Hashtbl
+
+open Microsoft.FSharp.Collections
+open System.Collections.Generic
+open System.IO
+
+type HashTable<'Key,'Val> = HashMultiMap<'Key,'Val> 
+type ('Key,'Val) t = HashMultiMap<'Key,'Val> 
+
+let inline create (n:int) = new HashMultiMap<_,_>(n, HashIdentity.Structural)
+
+let add (t:HashMultiMap<'Key,'Val>) x y = t.Add(x,y)
+let of_list (l : _ list) = 
+     let t = create (List.length l) in 
+     List.iter (fun (x,y) -> add t x y) l; 
+     t
+
+let of_seq (l:seq<_>) = 
+    let arr = Array.ofSeq l in 
+    let t = create (Array.length arr) in Array.iter (fun (x,y) -> add t x y) arr; 
+    t
+
+let copy (t:HashMultiMap<'Key,'Val>)  = t.Copy()
+let find (t:HashMultiMap<'Key,'Val>)  x = t.[x]
+let tryfind (t:HashMultiMap<'Key,'Val>)  x = t.TryFind x
+let find_all (t:HashMultiMap<'Key,'Val>)  x = t.FindAll x
+let mem (t:HashMultiMap<'Key,'Val>)  x =  t.ContainsKey x
+let remove (t:HashMultiMap<'Key,'Val>)  x = t.Remove x
+let replace (t:HashMultiMap<'Key,'Val>)  x y = t.Replace(x,y)
+let fold f (t:HashMultiMap<'Key,'Val>)  c = t.Fold f c
+let clear (t:HashMultiMap<'Key,'Val>)  = t.Clear ()
+let iter f (t:HashMultiMap<'Key,'Val>)  = t.Iterate f
+
+let hash x = LanguagePrimitives.GenericHash x
+let hashq x = LanguagePrimitives.PhysicalHash x
+
+// Componentized Hash Tables
+type Provider<'Key,'Val,'Tag> 
+     when 'Tag :> IEqualityComparer<'Key> =
+  interface
+    abstract create  : int -> Tagged.HashMultiMap<'Key,'Val,'Tag>;
+    abstract clear   : Tagged.HashMultiMap<'Key,'Val,'Tag> -> unit;
+    abstract add     : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val -> unit;
+    abstract copy    : Tagged.HashMultiMap<'Key,'Val,'Tag> -> Tagged.HashMultiMap<'Key,'Val,'Tag>;
+    abstract find    : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val;
+    abstract find_all: Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val list;
+    abstract tryfind : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val option;
+    abstract mem     : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> bool;
+    abstract remove  : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> unit;
+    abstract replace : Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'Key -> 'Val -> unit;
+    abstract iter    : ('Key -> 'Val -> unit) -> Tagged.HashMultiMap<'Key,'Val,'Tag> -> unit;
+    abstract fold    : ('Key -> 'Val -> 'State -> 'State) -> Tagged.HashMultiMap<'Key,'Val,'Tag> -> 'State -> 'State;
+    
+  end
+
+type Provider<'Key,'Val> = Provider<'Key,'Val,IEqualityComparer<'Key>>
+
+let MakeTagged (ops : 'Tag) : Provider<'Key,'Val,'Tag> when 'Tag :> IEqualityComparer<'Key> = 
+  { new Provider<_,_,_> with 
+      member p.create n = Tagged.HashMultiMap<'Key,'Val,'Tag>.Create(ops,n);
+      member p.clear c = c.Clear();
+      member p.add c x y = c.Add(x,y);
+      member p.copy c = c.Copy();
+      member p.find  c x = c.[x];
+      member p.find_all c x = c.FindAll(x);
+      member p.tryfind c x = c.TryFind(x);
+      member p.mem c x = c.ContainsKey(x);
+      member p.remove c x = c.Remove(x);
+      member p.replace c x y = c.Replace(x,y);
+      member p.iter f c = c.Iterate(f);
+      member p.fold f c acc = c.Fold f acc; }
+
+let Make (hash,eq) = MakeTagged (HashIdentity.FromFunctions hash eq)
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fsi
new file mode 100644
index 0000000..7935e17
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/hashtbl.fsi
@@ -0,0 +1,138 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.   The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+
+/// Multi-entry hash tables using the structural "hash" and "equals" functions.  
+///
+///These tables can be used with keys of any type, but you should check that
+///structural hashing and equality are correct for your key type.  
+///Structural hashing is efficient but not a suitable choice in all circumstances, 
+///e.g. may not hash efficiently on non-reference types and deeply-structured types.
+///Better efficiency is typically achieved if key types are F#-generated
+///types.
+///
+///These hash tables may map items to multiple keys (see find_all).
+///
+///The implementations are not safe for concurrent reading/writing,
+///and so users of these tables should take an appropriate lock
+///before reading/writing if used in a concurrent setting.
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Hashtbl
+open Microsoft.FSharp.Collections
+
+open System
+open System.IO
+open System.Collections.Generic
+
+
+/// OCaml compatible type name, for use when not opening module, e.g. Hashtbl.t
+type t<'Key,'Value> = HashMultiMap<'Key,'Value> 
+
+/// Create a hash table with the suggested initial size.  
+///
+/// Inlined to enable generation of efficient hash routines for the key type in the common case.
+val inline create  : int -> HashMultiMap<'Key,'Value> when 'Key : equality
+
+/// Add key and data to the table.
+val add     : HashMultiMap<'Key,'Value> -> 'Key -> 'Value -> unit when 'Key : equality
+
+/// Create a hash table using the given data
+val of_list : ('Key * 'Value) list -> HashMultiMap<'Key,'Value>  when 'Key : equality
+
+/// Create hash table using the given data
+val of_seq : seq<'Key * 'Value>  -> HashMultiMap<'Key,'Value>  when 'Key : equality
+
+/// Empty the table.
+val clear   : HashMultiMap<'Key,'Value> -> unit
+
+/// Create a copy of the table. Remember they are imperative and get mutated. 
+val copy    : HashMultiMap<'Key,'Value> -> HashMultiMap<'Key,'Value>
+
+/// Lookup key's data in the table.
+/// Raises exception is key not in table, if this could happen you should be using tryFind.
+val find    : HashMultiMap<'Key,'Value> -> 'Key -> 'Value
+
+/// Return all bindings for the given key
+val find_all: HashMultiMap<'Key,'Value> -> 'Key -> 'Value list
+
+/// Fold over all bindings
+val fold    : ('Key -> 'Value -> 'State -> 'State) -> HashMultiMap<'Key,'Value> -> 'State -> 'State
+
+///Apply the given function to each binding in the hash table 
+val iter    : ('Key -> 'Value -> unit) -> HashMultiMap<'Key,'Value> -> unit
+
+/// Test for the existence of any bindings for the given key
+val mem    : HashMultiMap<'Key,'Value> -> 'Key -> bool
+
+/// Remove the latest binding for the given key
+val remove : HashMultiMap<'Key,'Value> -> 'Key -> unit
+
+/// Replace the latest binding for the given key
+val replace: HashMultiMap<'Key,'Value> -> 'Key -> 'Value -> unit
+
+/// Lookup the key's data in the table
+val tryfind: HashMultiMap<'Key,'Value> -> 'Key -> 'Value option
+
+/// Hash on the structure of a value according to the F# structural hashing
+/// conventions
+val hash : 'T -> int 
+
+/// Hash on the identity of an object. 
+val hashq: 'T -> int   when 'T : not struct
+
+///A collection of operations for creating and using hash tables based on particular type-tracked hash/equality functions.
+///Generated by the Hashtbl.Make and Hashtbl.MakeTagged functors. This type is for use when you wish to
+///specify a comparison function once and carry around an object that is a provider of (i.e. a factory for) hashtables 
+///that utilize that comparison function.
+///
+///The 'Tag' type parameter is used to track information about the comparison function, which helps ensure 
+///that you don't mixup maps created with different comparison functions
+type Provider<'Key,'Value,'Tag>  
+     when 'Tag :> IEqualityComparer<'Key> =
+  interface
+    abstract create  : int -> Tagged.HashMultiMap<'Key,'Value,'Tag>;
+    abstract clear   : Tagged.HashMultiMap<'Key,'Value,'Tag> -> unit;
+    abstract add     : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> 'Value -> unit;
+    abstract copy    : Tagged.HashMultiMap<'Key,'Value,'Tag> -> Tagged.HashMultiMap<'Key,'Value,'Tag>;
+    abstract find    : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> 'Value;
+    abstract find_all: Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> 'Value list;
+    abstract tryfind : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> 'Value option;
+    abstract mem     : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> bool;
+    abstract remove  : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> unit;
+    abstract replace : Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'Key -> 'Value -> unit;
+    abstract iter    : ('Key -> 'Value -> unit) -> Tagged.HashMultiMap<'Key,'Value,'Tag> -> unit;
+    abstract fold    : ('Key -> 'Value -> 'State -> 'State) -> Tagged.HashMultiMap<'Key,'Value,'Tag> -> 'State -> 'State;
+  end
+
+type Provider<'Key,'Value> = Provider<'Key,'Value,IEqualityComparer<'Key>>
+
+/// Same as Make, except track the comparison function being used through an additional type parameter.
+///
+/// To use this function accurately you need to define a new named class that implements IEqualityComparer and
+/// pass an instance of that class as the first argument. For example:
+///      type MyHasher = 
+///        class
+///          new() = { }
+///          interface IEqualityComparer<string> with 
+///            member self.GetHashCode(x) = ...
+///            member self.Equals(x,y) = ...
+///          end
+///        end
+///
+/// let MyStringHashProvider : Hashtbl.Provider<string,int> = Hashtbl.MakeTagged(new MyStringHasher())
+val MakeTagged: ('Tag :> IEqualityComparer<'Key>) -> Provider<'Key,'Value,'Tag>
+
+/// Build a collection of operations for creating and using 
+/// hashtables based on the given hash/equality functions. This returns a record
+/// that contains the functions you use to create and manipulate tables of
+/// this kind.  The returned value is much like an ML module. You should call Make once for 
+/// each new pair of key/value types.  You may need to constrain the result 
+/// to be an instantiation of Provider.
+///
+/// let MyStringHashProvider : Provider<string,int> = Hashtbl.Make(myStringHash,myStringEq)
+val Make: ('Key -> int) * ('Key -> 'Key -> bool) -> Provider<'Key,'Value>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int16.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int16.fs
new file mode 100644
index 0000000..655a644
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int16.fs
@@ -0,0 +1,39 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using operators such as 'int' and 'int64' to convert numbers")>]
+module Int16 = 
+
+    let compare (x:int16) y = compare x y
+
+    let zero = 0s
+    let one = 1s
+    let minus_one = - 1s
+    let neg (x:int16) =  - x
+    let add (x:int16) (y:int16) = x + y
+    let sub (x:int16) (y:int16) = x - y
+    let mul (x:int16) (y:int16) = x * y 
+    let div (x:int16) (y:int16) = x / y
+    let rem (x:int16) (y:int16) = x % y
+    let succ (x:int16) = x + 1s
+    let pred (x:int16) = x - 1s
+    let abs (x:int16) = if x < zero then neg x else x
+    let max_int = 0x7FFFs
+    let min_int = 0x8000s
+    let logand (x:int16) (y:int16) = x &&& y
+    let logor (x:int16) (y:int16) = x ||| y
+    let logxor (x:int16) (y:int16) = x ^^^ y
+    let lognot (x:int16) = ~~~ x
+    let shift_left (x:int16) (n:int) =  x <<< n
+    let shift_right (x:int16) (n:int) =  x >>> n
+
+    let of_int8 (n:int8)   = int16 n
+    let to_int8 (x:int16) = sbyte x
+
+    let of_int (n:int) =  int16 n
+    let to_int (x:int16) = int x
+
+    let of_int32 (n:int32) =  int16 n
+    let to_int32 (x:int16) = int32 x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fs
new file mode 100644
index 0000000..0c2bd41
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fs
@@ -0,0 +1,60 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module Int32 = 
+
+    let compare (x:int32) y = compare x y
+
+    let zero = 0
+    let one = 1
+    let minus_one = (-1)
+    let neg (x:int32) =  -x
+    let add (x:int32) (y:int32) = x + y
+    let sub (x:int32) (y:int32) = x - y
+    let mul (x:int32) (y:int32) = x * y
+    let div (x:int32) (y:int32) = x / y
+    let rem (x:int32) (y:int32) = x % y
+    let succ (x:int32) = x + 1
+    let pred (x:int32) = x - 1
+    let abs (x:int32) = if x < zero then neg x else x
+    let max_int = 0x7FFFFFFF
+    let min_int = 0x80000000
+    let logand (x:int32) (y:int32) = x &&& y
+    let logor (x:int32) (y:int32) = x ||| y
+    let logxor (x:int32) (y:int32) = x ^^^ y
+    let lognot (x:int32) = ~~~ x
+    let shift_left (x:int32) (n:int) =  x <<< n
+    let shift_right (x:int32) (n:int) =  x >>> n
+
+    let of_uint32 (x:uint32) =  int32 x
+    let to_uint32 (x:int32) =  uint32 x
+
+    let shift_right_logical (x:int32) (n:int) =  of_uint32 (to_uint32 x >>> n)
+    let of_int (n:int) =  n
+    let to_int (x:int32) = x
+    let of_float (x:float) =  int32 x
+    let to_float (x:int32) =  float x
+
+    let of_float32 (x:float32) =  int32 x
+    let to_float32 (x:int32) =  float32 x
+
+    let of_int64 (x:int64) =  int32 x
+    let to_int64 (x:int32) =  int64 x
+
+    let of_nativeint (x:nativeint) =  int32 x 
+    let to_nativeint (x:int32) =  nativeint x
+
+
+    let of_string (s:string) = try int32 s with _ -> failwith "Int32.of_string"
+    let to_string (x:int32) = (box x).ToString()
+
+    let bits_of_float32 (x:float32) = System.BitConverter.ToInt32(System.BitConverter.GetBytes(x),0)
+    let float32_of_bits (x:int32) = System.BitConverter.ToSingle(System.BitConverter.GetBytes(x),0)
+
+    let float32_to_float (x:float32) = float x
+    let float_to_float32 (x:float) = float32 x
+
+    let float_of_bits x = float32_to_float (float32_of_bits x)
+    let bits_of_float x = bits_of_float32 (float_to_float32 x)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fsi
new file mode 100644
index 0000000..a903d67
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int32.fsi
@@ -0,0 +1,105 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+/// Basic operations on 32-bit integers. The type int32 is identical to <c>System.Int32</c>. 
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<CompilerMessage("This module is for ML compatibility. Consider using the F# overloaded operators such as 'int' and 'float' to convert numbers. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Int32 = 
+
+    /// The value zero as a System.Int32
+    val zero: int32
+    /// The value one as a System.Int32
+    val one: int32
+    /// The value minus one as a System.Int32
+    val minus_one: int32
+    /// Returns the predeccessor of the argument 
+    val pred: int32 -> int32
+    /// Returns the largest 32-bit signed integer
+    val max_int: int32
+    /// Returns the smallest 32-bit signed integer
+    val min_int: int32
+    /// Returns the successor of the argument 
+    val succ: int32 -> int32
+
+    /// Returns the absolute value of the argument
+    val abs: int32 -> int32
+    /// Returns the sum of a and b
+    val add: a:int32 -> b:int32 -> int32
+    /// Returns a divided by b 
+    val div: a:int32 -> b:int32 -> int32
+    /// Returns a multiplied by b 
+    val mul: a:int32 -> b:int32 -> int32    
+    /// Returns -a
+    val neg: a:int32 -> int32
+    /// Returns the remainder of a divided by b
+    val rem: a:int32 -> b:int32 -> int32
+    /// Returns a minus b 
+    val sub: a:int32 -> b:int32 -> int32
+
+    /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
+    val compare: a:int32 -> b:int32 -> int
+
+    /// Combines the binary representation of a and b by bitwise and
+    val logand: a:int32 -> b:int32 -> int32
+    /// Returns the bitwise logical negation of a
+    val lognot: a:int32 -> int32
+    /// Combines the binary representation of a and b by bitwise or
+    val logor: a:int32 -> b:int32 -> int32
+    /// Combines the binary representation of a and b by bitwise xor
+    val logxor: int32 -> int32 -> int32
+    /// Shifts the binary representation a by n bits to the left
+    val shift_left: a:int32 -> n:int -> int32
+    /// Shifts the binary representation a by n bits to the right; high-order empty bits are set to the sign bit
+    val shift_right: a:int32 -> n:int -> int32
+    /// Shifts the binary representation a by n bits to the right; high-order bits are zero-filled
+    val shift_right_logical: a:int32 -> n:int -> int32
+
+    /// Converts a 64-bit float to a 32-bit integer
+    val of_float: float -> int32
+    /// Converts a 32-bit integer to a 64-bit float 
+    val to_float: int32 -> float
+
+    /// Converts a 32-bit float to a 32-bit integer
+    val of_float32: float32 -> int32
+    /// Converts a 32-bit integer to a 32-bit float 
+    val to_float32: int32 -> float32
+
+    (* In F#, type int32 is identical to int.  These operations are *)
+    (* included mostly for compatibility with other versions of ML *)
+    /// Converts a 32-bit integer to a 32-bit integer (included for ML compatability)
+    val of_int: int -> int32
+    /// Converts a 32-bit integer to a 32-bit integer (included for ML compatability)
+    val to_int: int32 -> int
+
+    (* Conversions to integers are to either the same size or same sign *)
+    /// Converts a 32-bit unsigned integer to a 32-bit integer 
+    val of_uint32: uint32 -> int32
+    /// Converts a 32-bit integer to a 32-bit unsigned integer 
+    val to_uint32: int32 -> uint32
+
+    /// Converts a 64-bit unsigned integer to a 32-bit integer 
+    val of_int64: int64 -> int32
+    /// Converts a 32-bit unsigned integer to a 64-bit integer 
+    val to_int64: int32 -> int64
+
+    /// Converts a 32-bit unsigned integer to a 32-bit integer 
+    val of_nativeint: nativeint -> int32
+    /// Converts a 32-bit unsigned integer to a 32-bit integer 
+    val to_nativeint: int32 -> nativeint
+
+    /// Converts a string to a 32-bit integer 
+    val of_string: string -> int32
+    /// Converts a 32-bit integer to a string 
+    val to_string: int32 -> string
+
+    /// Converts a raw 32-bit representation to a 64-bit float
+    val float_of_bits: int32 -> float
+    /// Converts a 64-bit float to a raw 32-bit representation 
+    val bits_of_float: float -> int32
+
+    /// Converts a raw 32-bit representation to a 32-bit float
+    val float32_of_bits: int32 -> float32
+    /// Converts a 32-bit float to a raw 32-bit representation 
+    val bits_of_float32: float32 -> int32
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fs
new file mode 100644
index 0000000..1b250b4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fs
@@ -0,0 +1,55 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module Int64 = 
+
+    let compare (x:int64) y = compare x y
+
+    let zero = 0L
+    let one = 1L
+    let minus_one = -1L
+    let neg (x:int64) =  -x
+    let add (x:int64) (y:int64) = x + y
+    let sub (x:int64) (y:int64) = x - y
+    let mul (x:int64) (y:int64) = x * y
+    let div (x:int64) (y:int64) = x / y
+    let rem (x:int64) (y:int64) = x % y
+    let succ (x:int64) = x + 1L
+    let pred (x:int64) = x - 1L
+    let abs (x:int64) = if x < zero then neg x else x
+    let max_int = 0x7FFFFFFFFFFFFFFFL
+    let min_int = 0x8000000000000000L
+    let logand (x:int64) (y:int64) = x &&& y
+    let logor (x:int64) (y:int64) = x ||| y
+    let logxor (x:int64) (y:int64) = x ^^^ y
+    let lognot (x:int64) = ~~~x
+    let shift_left (x:int64) (n:int) =  x <<< n
+    let shift_right (x:int64) (n:int) =  x >>> n
+    let of_int (n:int) =  int64 n
+    let to_int (x:int64) = int x
+    let of_int32 (n:int32) =  int64 n
+    let to_int32 (x:int64) = int32 x
+    let of_uint64 (n:uint64) =  int64 n
+    let to_uint64 (x:int64) = uint64 x
+    let shift_right_logical (x:int64) (n:int) =  of_uint64 (to_uint64 x >>> n)
+
+    let of_nativeint (n:nativeint) =  int64 n
+    let to_nativeint (x:int64) = nativeint x
+    let of_float (x:float) =  int64 x
+    let to_float (x:int64) =  float x
+
+    let of_string (s:string) = try int64 s with _ -> failwith "Int64.of_string"
+    let to_string (x:int64) = (box x).ToString()
+
+#if FX_NO_DOUBLE_BIT_CONVERTER
+#else
+    let bits_of_float (x:float) = System.BitConverter.DoubleToInt64Bits(x)
+    let float_of_bits (x:int64) = System.BitConverter.Int64BitsToDouble(x)
+#endif
+
+
+    let of_float32 (x:float32) =  int64 x
+    let to_float32 (x:int64) =  float32 x
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fsi
new file mode 100644
index 0000000..7d14734
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/int64.fsi
@@ -0,0 +1,100 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+/// Basic operations on 64-bit integers. The type int64 is identical to <c>System.Int64</c>. 
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<CompilerMessage("This module is for ML compatibility. Consider using the F# overloaded operators such as 'int' and 'float' to convert numbers. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Int64 = 
+
+    /// The value zero as a System.Int64
+    val zero: int64
+    /// The value one as a System.Int64
+    val one: int64
+    /// Returns the predeccessor of the argument 
+    val pred: int64 -> int64
+    /// Returns the successor of the argument 
+    val succ: int64 -> int64
+    /// Returns the largest 64-bit signed integer
+    val max_int: int64
+    /// Returns the smallest 64-bit signed integer
+    val min_int: int64
+    /// The value minus one as a System.Int64
+    val minus_one: int64
+
+    /// Returns the absolute value of the argument
+    val abs: int64 -> int64
+    /// Returns the sum of a and b
+    val add: a:int64 -> b:int64 -> int64
+    /// Returns a divided by b 
+    val div: a:int64 -> b:int64 -> int64
+    /// Returns a multiplied by b 
+    val mul: a:int64 -> b:int64 -> int64
+    /// Returns -a
+    val neg: a:int64 -> int64
+    /// Returns the remainder of a divided by b
+    val rem: a:int64 -> b:int64 -> int64
+    /// Returns a minus b 
+    val sub: a:int64 -> b:int64 -> int64
+
+    /// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
+    val compare: int64 -> int64 -> int
+
+    /// Combines the binary representation of a and b by bitwise and
+    val logand: int64 -> int64 -> int64
+    /// Returns the bitwise logical negation of a
+    val lognot: int64 -> int64
+    /// Combines the binary representation of a and b by bitwise or
+    val logor: int64 -> int64 -> int64
+    /// Combines the binary representation of a and b by bitwise xor
+    val logxor: int64 -> int64 -> int64
+    /// Shifts the binary representation a by n bits to the left
+    val shift_left: a:int64 -> n:int -> int64
+    /// Shifts the binary representation a by n bits to the right; high-order empty bits are set to the sign bit
+    val shift_right: a:int64 -> n:int -> int64
+    /// Shifts the binary representation a by n bits to the right; high-order bits are zero-filled
+    val shift_right_logical: a:int64 -> n:int -> int64
+
+    /// Converts a 32-bit float to a 64-bit integer
+    val of_float32: float32 -> int64
+    /// Converts a 64-bit integer to a 32-bit float 
+    val to_float32: int64 -> float32
+
+    /// Converts a 64-bit float to a 64-bit integer
+    val of_float: float -> int64
+    /// Converts a 64-bit integer to a 64-bit float 
+    val to_float: int64 -> float
+
+    (* Conversions to integers are to either the same size or same sign *)
+    /// Converts a 32-bit integer to a 64-bit integer
+    val of_int: int -> int64
+    /// Converts a 64-bit integer to a 32-bit integer
+    val to_int: int64 -> int
+
+    /// Converts a 32-bit integer to a 64-bit integer
+    val of_int32: int32 -> int64
+    /// Converts a 64-bit integer to a 32-bit integer
+    val to_int32: int64 -> int32
+
+    /// Converts an unsigned 64-bit integer to a 64-bit integer
+    val of_uint64: uint64 -> int64
+    /// Converts a 64-bit integer to an unsigned 64-bit integer
+    val to_uint64: int64 -> uint64
+
+    /// Converts a native integer to a 64-bit integer
+    val of_nativeint: nativeint -> int64
+    /// Converts a 64-bit integer to a native integer 
+    val to_nativeint: int64 -> nativeint
+
+    /// Converts a string to a 64-bit integer 
+    val of_string: string -> int64
+    /// Converts a 64-bit integer to a string
+    val to_string: int64 -> string
+
+#if FX_NO_DOUBLE_BIT_CONVERTER
+#else
+    /// Converts a raw 64-bit representation to a 64-bit float
+    val float_of_bits: int64 -> float
+    /// Converts a 64-bit float to a raw 64-bit representation 
+    val bits_of_float: float -> int64
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fs
new file mode 100644
index 0000000..9178ee9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fs
@@ -0,0 +1,12 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+module Microsoft.FSharp.Compatibility.Lazy
+
+type 'a t = 'a Microsoft.FSharp.Control.Lazy
+
+let force (x: Microsoft.FSharp.Control.Lazy<'T>) = x.Force()
+let force_val (x: Microsoft.FSharp.Control.Lazy<'T>) = x.Force()
+let lazy_from_fun f = Microsoft.FSharp.Control.Lazy.Create(f)
+let create f = Microsoft.FSharp.Control.Lazy.Create(f)
+let lazy_from_val v = Microsoft.FSharp.Control.Lazy.CreateFromValue(v)
+let lazy_is_val (x: Microsoft.FSharp.Control.Lazy<'T>) = x.IsValueCreated
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fsi
new file mode 100644
index 0000000..2c81d35
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazy.fsi
@@ -0,0 +1,31 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+module Microsoft.FSharp.Compatibility.Lazy
+
+open System
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type 'T t = Microsoft.FSharp.Control.Lazy<'T>
+
+/// See Lazy.Force
+val force: Microsoft.FSharp.Control.Lazy<'T> -> 'T
+
+/// See Lazy.Force.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'v.Force()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val force_val: Microsoft.FSharp.Control.Lazy<'T> -> 'T
+
+/// Build a lazy (delayed) value from the given computation
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'lazy' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val lazy_from_fun: (unit -> 'T) -> Microsoft.FSharp.Control.Lazy<'T>
+
+/// Build a lazy (delayed) value from the given pre-computed value.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'Lazy.CreateFromValue' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val lazy_from_val: 'T -> Microsoft.FSharp.Control.Lazy<'T>
+
+/// Check if a lazy (delayed) value has already been computed
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'Lazy.IsForced' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val lazy_is_val: Microsoft.FSharp.Control.Lazy<'T> -> bool
+
+/// Build a lazy (delayed) value from the given computation
+[<CompilerMessage("This construct is for ML compatibility. Consider using Lazy.Create instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val create : (unit -> 'T) -> Microsoft.FSharp.Control.Lazy<'T>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fs
new file mode 100644
index 0000000..cfb7e81
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fs
@@ -0,0 +1,261 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Collections
+
+open System
+open System.Collections.Generic
+
+#nowarn "21" // recursive initialization
+#nowarn "40" // recursive initialization
+
+exception UndefinedException
+
+[<NoEquality; NoComparison>]
+type LazyList<'T> =
+    { mutable status : LazyCellStatus< 'T > }
+    
+    member x.Value = 
+        match x.status with 
+        | LazyCellStatus.Value v -> v
+        | _ -> 
+            lock x (fun () -> 
+                match x.status with 
+                | LazyCellStatus.Delayed f -> 
+                    x.status <- Exception UndefinedException; 
+                    try 
+                        let res = f () 
+                        x.status <- LazyCellStatus.Value res; 
+                        res 
+                    with e -> 
+                        x.status <- LazyCellStatus.Exception(e); 
+                        reraise()
+                | LazyCellStatus.Value v -> v
+                | LazyCellStatus.Exception e -> raise e)
+    
+    member s.GetEnumeratorImpl() = 
+        let getCell (x : LazyList<'T>) = x.Value
+        let toSeq s = Seq.unfold (fun ll -> match getCell ll with CellEmpty -> None | CellCons(a,b) -> Some(a,b)) s 
+        (toSeq s).GetEnumerator()
+            
+    interface IEnumerable<'T> with
+        member s.GetEnumerator() = s.GetEnumeratorImpl()
+
+    interface System.Collections.IEnumerable with
+        override s.GetEnumerator() = (s.GetEnumeratorImpl() :> System.Collections.IEnumerator)
+
+
+and 
+    [<NoEquality; NoComparison>]
+    LazyCellStatus<'T> =
+    | Delayed of (unit -> LazyListCell<'T> )
+    | Value of LazyListCell<'T> 
+    | Exception of System.Exception
+
+
+and 
+    [<NoEquality; NoComparison>]
+    LazyListCell<'T> = 
+    | CellCons of 'T * LazyList<'T> 
+    | CellEmpty
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module LazyList = 
+
+    let lzy f = { status = Delayed f }
+    let force (x: LazyList<'T>) = x.Value
+
+    let notlazy v = { status = Value v }
+    
+    type EmptyValue<'T>() = 
+        static let value : LazyList<'T> = notlazy CellEmpty
+        static member Value : LazyList<'T> = value
+        
+    [<NoEquality; NoComparison>]
+    type LazyItem<'T> = Cons of 'T * LazyList<'T> | Empty
+    type 'T item = 'T LazyItem
+    let get (x : LazyList<'T>) = match force x with CellCons (a,b) -> Some(a,b) | CellEmpty -> None
+    let getCell (x : LazyList<'T>) = force x 
+    let empty<'T> : LazyList<'T> = EmptyValue<'T>.Value
+    let consc x l = CellCons(x,l)
+    let cons x l = lzy(fun () -> (consc x l))
+    let consDelayed x l = lzy(fun () -> (consc x (lzy(fun () ->  (force (l()))))))
+    let consf x l = consDelayed x l
+
+    let rec unfold f z = 
+      lzy(fun () -> 
+          match f z with
+          | None       -> CellEmpty
+          | Some (x,z) -> CellCons (x,unfold f z))
+
+    let rec append l1  l2 = lzy(fun () ->  (appendc l1 l2))
+    and appendc l1 l2 =
+      match getCell l1 with
+      | CellEmpty -> force l2
+      | CellCons(a,b) -> consc a (append b l2)
+
+    let delayed f = lzy(fun () ->  (getCell (f())))
+    let repeat x = 
+      let rec s = cons x (delayed (fun () -> s)) in s
+
+    let rec map f s = 
+      lzy(fun () ->  
+        match getCell s with
+        | CellEmpty -> CellEmpty
+        | CellCons(a,b) -> consc (f a) (map f b))
+
+    let rec map2 f s1 s2 =  
+      lzy(fun () -> 
+        match getCell s1, getCell s2  with
+        | CellCons(a1,b1),CellCons(a2,b2) -> consc (f a1 a2) (map2 f b1 b2)
+        | _ -> CellEmpty)
+
+    let rec zip s1 s2 = 
+      lzy(fun () -> 
+        match getCell s1, getCell s2  with
+        | CellCons(a1,b1),CellCons(a2,b2) -> consc (a1,a2) (zip b1 b2)
+        | _ -> CellEmpty)
+    let combine s1 s2 = zip s1 s2
+
+    let rec concat s1 = 
+      lzy(fun () -> 
+        match getCell s1 with
+        | CellCons(a,b) -> appendc a (concat b)
+        | CellEmpty -> CellEmpty)
+      
+    let rec filter p s1= lzy(fun () ->  filterc p s1)
+    and filterc p s1 =
+        match getCell s1 with
+        | CellCons(a,b) -> if p a then consc a (filter p b) else filterc p b
+        | CellEmpty -> CellEmpty
+      
+    let rec tryFind p s1 =
+        match getCell s1 with
+        | CellCons(a,b) -> if p a then Some a else tryFind p b
+        | CellEmpty -> None
+
+    let first p s1 = tryFind p s1
+
+    let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+    let find p s1 =
+        match tryFind p s1 with
+        | Some a -> a
+        | None   -> indexNotFound()
+
+    let rec scan f acc s1 = 
+      lzy(fun () -> 
+        match getCell s1 with
+        | CellCons(a,b) -> let acc' = f acc a in consc acc' (scan f acc' b)
+        | CellEmpty -> CellEmpty)
+
+    let folds f acc s1 = scan f acc s1 // deprecated
+
+    let head s = 
+      match getCell s with
+      | CellCons(a,_) -> a
+      | CellEmpty -> invalidArg "s" "the list is empty"
+
+    let tail s = 
+      match getCell s with
+      | CellCons(_,b) -> b
+      | CellEmpty -> invalidArg "s" "the list is empty"
+
+    let hd s = head s
+    let tl s = tail s
+
+    let isEmpty s =
+      match getCell s with
+      | CellCons _ -> false
+      | CellEmpty -> true
+
+    let nonempty s = not (isEmpty s)
+
+    let rec take n s = 
+      lzy(fun () -> 
+        if n < 0 then invalidArg "n" "the number must not be negative"
+        elif n = 0 then CellEmpty 
+        else
+          match getCell s with
+          | CellCons(a,s) -> consc a (take (n-1) s)
+          | CellEmpty -> invalidArg "n" "not enough items in the list" )
+
+    let rec skipc n s =
+      if n = 0 then force s 
+      else  
+        match getCell s with
+        | CellCons(_,s) -> skipc (n-1) s
+        | CellEmpty -> invalidArg "n" "not enough items in the list"
+
+    let rec skip n s = 
+      lzy(fun () -> 
+        if n < 0 then invalidArg "n" "the value must not be negative"
+        else skipc n s)
+
+    let drop n s = skip n s
+
+    let rec ofList l = 
+      lzy(fun () -> 
+        match l with [] -> CellEmpty | h :: t -> consc h (ofList t))
+      
+    let toList s = 
+      let rec loop s acc = 
+          match getCell s with
+          | CellEmpty -> List.rev acc
+          | CellCons(h,t) -> loop t (h::acc)
+      loop s []
+      
+    let rec iter f s = 
+      match getCell s with
+      | CellEmpty -> ()
+      | CellCons(h,t) -> f h; iter f t
+      
+    let rec copyFrom i a = 
+      lzy(fun () -> 
+        if i >= Array.length a then CellEmpty 
+        else consc a.[i] (copyFrom (i+1) a))
+      
+    let rec copyTo (arr: _[]) s i = 
+      match getCell s with
+      | CellEmpty -> ()
+      | CellCons(a,b) -> arr.[i] <- a; copyTo arr b (i+1)
+
+    let ofArray a = copyFrom 0 a
+    let toArray s = Array.ofList (toList s)
+      
+    let rec lengthAux n s = 
+      match getCell s with
+      | CellEmpty -> n
+      | CellCons(_,b) -> lengthAux (n+1) b
+
+    let length s = lengthAux 0 s
+
+    let toSeq (s: LazyList<'T>) = (s :> IEnumerable<_>)
+
+    // Note: this doesn't dispose of the IEnumerator if the iteration is not run to the end
+    let rec ofFreshIEnumerator (e : IEnumerator<_>) = 
+      lzy(fun () -> 
+        if e.MoveNext() then 
+          consc e.Current (ofFreshIEnumerator e)
+        else 
+           e.Dispose()
+           CellEmpty)
+      
+    let ofSeq (c : IEnumerable<_>) =
+      ofFreshIEnumerator (c.GetEnumerator()) 
+      
+    let (|Cons|Nil|) l = match getCell l with CellCons(a,b) -> Cons(a,b) | CellEmpty -> Nil
+
+
+    let of_list l = ofList l
+
+    let of_seq l = ofSeq l
+
+    let of_array l = ofArray l
+
+    let to_seq l = toSeq l
+
+    let to_list l = toList l
+
+    let to_array l = toArray l
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fsi
new file mode 100644
index 0000000..0023933
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lazylist.fsi
@@ -0,0 +1,189 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections
+
+open System.Collections.Generic
+
+/// LazyLists are possibly-infinite, cached sequences.  See also IEnumerable/Seq for
+/// uncached sequences. LazyLists normally involve delayed computations without 
+/// side-effects.  The results of these computations are cached and evaluations will be 
+/// performed only once for each element of the lazy list.  In contrast, for sequences 
+/// (IEnumerable) recomputation happens each time an enumerator is created and the sequence 
+/// traversed.
+///
+/// LazyLists can represent cached, potentially-infinite computations.  Because they are 
+/// cached they may cause memory leaks if some active code or data structure maintains a 
+/// live reference to the head of an infinite or very large lazy list while iterating it, 
+/// or if a reference is maintained after the list is no longer required.
+///
+/// Lazy lists may be matched using the LazyList.Cons and LazyList.Nil active patterns. 
+/// These may force the computation of elements of the list.
+
+[<Sealed>]
+type LazyList<'T> =
+    interface IEnumerable<'T>
+    interface System.Collections.IEnumerable
+    
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module LazyList =
+
+    /// Test if a list is empty.  Forces the evaluation of
+    /// the first element of the stream if it is not already evaluated.
+    val isEmpty: LazyList<'T> -> bool
+
+    /// Return the first element of the list.  Forces the evaluation of
+    /// the first cell of the list if it is not already evaluated.
+    val head       : LazyList<'T> -> 'T
+
+    /// Return the list corresponding to the remaining items in the sequence.  
+    /// Forces the evaluation of the first cell of the list if it is not already evaluated.
+    val tail       : LazyList<'T> -> LazyList<'T>
+
+    /// Get the first cell of the list.
+    val get      : LazyList<'T> -> ('T * LazyList<'T>) option  
+
+    /// Return the list which on consumption will consist of at most 'n' elements of 
+    /// the input list.  
+    val take     : count:int -> source:LazyList<'T> -> LazyList<'T>
+
+    /// Return the list which on consumption will skip the first 'n' elements of 
+    /// the input list.  
+    val skip     : count:int -> source:LazyList<'T> -> LazyList<'T>
+
+    /// Apply the given function to successive elements of the list, returning the first
+    /// result where function returns <c>Some(x)</c> for some x. If the function never returns
+    /// true, 'None' is returned.
+    val tryFind    : predicate:('T -> bool) -> source:LazyList<'T> -> 'T option
+
+    /// Return the first element for which the given function returns <c>true</c>.
+    /// Raise <c>KeyNotFoundException</c> if no such element exists.
+    val find     : predicate:('T -> bool) -> source:LazyList<'T> -> 'T 
+
+    /// Evaluates to the list that contains no items
+    [<GeneralizableValue>]
+    val empty<'T>    : LazyList<'T>
+
+    /// Return the length of the list
+    val length: list:LazyList<'T> -> int
+
+    /// Return a new list which contains the given item followed by the
+    /// given list.
+    val cons     : 'T -> LazyList<'T>               -> LazyList<'T>
+
+    /// Return a new list which on consumption contains the given item 
+    /// followed by the list returned by the given computation.  The 
+    val consDelayed    : 'T -> (unit -> LazyList<'T>)     -> LazyList<'T>
+
+    /// Return the list which on consumption will consist of an infinite sequence of 
+    /// the given item
+    val repeat   : 'T -> LazyList<'T>
+
+    /// Return a list that is in effect the list returned by the given computation.
+    /// The given computation is not executed until the first element on the list is
+    /// consumed.
+    val delayed  : (unit -> LazyList<'T>)           -> LazyList<'T>
+
+    /// Return a list that contains the elements returned by the given computation.
+    /// The given computation is not executed until the first element on the list is
+    /// consumed.  The given argument is passed to the computation.  Subsequent elements
+    /// in the list are generated by again applying the residual 'b to the computation.
+    val unfold   : ('State -> ('T * 'State) option) -> 'State -> LazyList<'T>
+
+    /// Return the list which contains on demand the elements of the first list followed
+    /// by the elements of the second list
+    val append   : LazyList<'T> -> source:LazyList<'T> -> LazyList<'T>
+
+    /// Return the list which contains on demand the pair of elements of the first and second list
+    val zip  : LazyList<'T1> -> LazyList<'T2> -> LazyList<'T1 * 'T2>
+
+    /// Return the list which contains on demand the list of elements of the list of lazy lists.
+    val concat   : LazyList< LazyList<'T>> -> LazyList<'T>
+
+    /// Return a new collection which on consumption will consist of only the elements of the collection
+    /// for which the given predicate returns "true"
+    val filter   : predicate:('T -> bool) -> source:LazyList<'T> -> LazyList<'T>
+
+    /// Apply the given function to each element of the collection. 
+    val iter: action:('T -> unit) -> list:LazyList<'T>-> unit
+
+    /// Return a new list consisting of the results of applying the given accumulating function
+    /// to successive elements of the list
+    val scan    : folder:('State -> 'T -> 'State) -> 'State -> source:LazyList<'T> -> LazyList<'State>  
+
+    /// Build a new collection whose elements are the results of applying the given function
+    /// to each of the elements of the collection.
+    val map      : mapping:('T -> 'U) -> source:LazyList<'T> -> LazyList<'U>
+
+    /// Build a new collection whose elements are the results of applying the given function
+    /// to the corresponding elements of the two collections pairwise.
+    val map2     : mapping:('T1 -> 'T2 -> 'U) -> LazyList<'T1> -> LazyList<'T2> -> LazyList<'U>
+
+    /// Build a collection from the given array. This function will eagerly evaluate all of the 
+    /// list (and thus may not terminate). 
+    val ofArray : 'T array -> LazyList<'T>
+
+    /// Build an array from the given collection
+    val toArray : LazyList<'T> -> 'T array
+
+    /// Build a collection from the given list. This function will eagerly evaluate all of the 
+    /// list (and thus may not terminate). 
+    val ofList  : list<'T> -> LazyList<'T>
+
+    /// Build a non-lazy list from the given collection. This function will eagerly evaluate all of the 
+    /// list (and thus may not terminate). 
+    val toList  : LazyList<'T> -> list<'T>
+
+    /// Return a view of the collection as an enumerable object
+    val toSeq: LazyList<'T> -> seq<'T>
+
+    /// Build a new collection from the given enumerable object
+    val ofSeq: seq<'T> -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.consDelayed' instead")>]
+    val consf    : 'T -> (unit -> LazyList<'T>)     -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.head' instead")>]
+    val hd: LazyList<'T> -> 'T
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.tail' instead")>]
+    val tl     : LazyList<'T> -> LazyList<'T>
+
+    [<System.Obsolete("This function will be removed. Use 'not (LazyList.isEmpty list)' instead")>]
+    val nonempty : LazyList<'T> -> bool
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.skip' instead")>]
+    val drop     : count:int -> source:LazyList<'T> -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed to 'tryFind'")>]
+    val first    : predicate:('T -> bool) -> source:LazyList<'T> -> 'T option
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.ofArray' instead")>]
+    val of_array : 'T array -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.toArray' instead")>]
+    val to_array : LazyList<'T> -> 'T array
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.ofList' instead")>]
+    val of_list  : list<'T> -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.toList' instead")>]
+    val to_list  : LazyList<'T> -> list<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.toSeq' instead")>]
+    val to_seq: LazyList<'T> -> seq<'T>
+
+    [<System.Obsolete("This function has been renamed. Use 'LazyList.ofSeq' instead")>]
+    val of_seq: seq<'T> -> LazyList<'T>
+
+    [<System.Obsolete("This function has been renamed to 'scan'")>]
+    val folds    : folder:('State -> 'T -> 'State) -> 'State -> source:LazyList<'T> -> LazyList<'State>  
+
+    [<System.Obsolete("This function has been renamed to 'zip'")>]
+    val combine  : LazyList<'T1> -> LazyList<'T2> -> LazyList<'T1 * 'T2>
+
+    //--------------------------------------------------------------------------
+    // Lazy list active patterns
+
+    val (|Cons|Nil|) : LazyList<'T> -> Choice<('T * LazyList<'T>),unit>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fs
new file mode 100644
index 0000000..8d8d802
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fs
@@ -0,0 +1,68 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.  
+//
+//=========================================================================
+
+module Microsoft.FSharp.Compatibility.OCaml.Lexing
+
+open Microsoft.FSharp.Text.Lexing
+open System.IO
+open System.Text
+
+type position = Position  
+
+type lexbuf =  LexBuffer<byte>
+
+let from_function (f: byte[] -> int -> int)  = 
+    LexBuffer<byte>.FromByteFunction f
+
+
+let from_text_reader (enc: System.Text.Encoding) (tr: TextReader) =
+  LexBuffer<byte>.FromFunction (fun (bytebuf,start,len) ->
+    /// Don't read too many characters!
+    let lenc = (len * 99) / enc.GetMaxByteCount(100) 
+    let charbuf : char[] = Array.zeroCreate lenc 
+    let nRead = tr.Read(charbuf,start,lenc) 
+    if nRead = 0 then 0 
+    else enc.GetBytes(charbuf,0,nRead,bytebuf,start))
+                 
+let defaultEncoding =
+#if FX_NO_DEFAULT_ENCODING
+        Encoding.UTF8
+#else
+        Encoding.Default
+#endif
+
+let from_channel (is:TextReader)  = from_text_reader defaultEncoding is
+
+let from_bytearray s  = 
+    LexBuffer<byte>.FromBytes(s)
+
+#if FX_NO_ASCII_ENCODING
+let from_string s  = from_channel (new StringReader(s))
+#else
+let from_string s  = from_bytearray (System.Text.Encoding.ASCII.GetBytes(s:string))
+#endif
+
+let from_binary_reader (sr: BinaryReader)  = LexBuffer<byte>.FromFunction(sr.Read)
+
+let lexeme_char (lb:lexbuf) n =  char (int32 (lb.LexemeChar n))
+let lexeme_start_p (lb:lexbuf) = lb.StartPos
+let lexeme_end_p (lb:lexbuf) = lb.EndPos
+let lexeme_start (lb:lexbuf) = (lexeme_start_p lb).pos_cnum
+let lexeme_end (lb:lexbuf) = (lexeme_end_p lb).pos_cnum
+#if FX_NO_ASCII_ENCODING
+let lexeme_utf8 (lb:lexbuf) = System.Text.Encoding.UTF8.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+#else
+let lexeme (lb:lexbuf) = System.Text.Encoding.ASCII.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+let lexeme_utf8 (lb:lexbuf) = System.Text.Encoding.UTF8.GetString(lb.Lexeme, 0, lb.Lexeme.Length)
+#endif
+
+let lexeme_bytes (lb:lexbuf) = lb.Lexeme
+let flush_input (lb: lexbuf) = lb.DiscardInput ()
+
+
+let lexbuf_curr_p lb = lexeme_end_p lb
+let lexbuf_set_curr_p (lb:lexbuf) (p : position) = lb.EndPos  <- p
+let lexbuf_set_start_p (lb:lexbuf) (p : position) = lb.StartPos <- p
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fsi
new file mode 100644
index 0000000..abef4b4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/lexing.fsi
@@ -0,0 +1,97 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.   The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Lexing: ML-like lexing support
+///
+/// This file maintains rough compatibility for lexbuffers used by some ML
+/// laxer generators.  The lexbuf carries an associated pair of positions.
+/// Beware that only the "cnum" (absolute character number) field is automatically 
+/// updated as each lexeme is matched.  Upon each successful match the prior end
+/// position is transferred to be the start position and a new start position
+/// is allocated with an updated pos_cnum field.
+//[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+[<CompilerMessage("This module is for ML compatibility. Consider using the Microsoft.FSharp.Text.Lexing namespace directly", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Lexing
+open Microsoft.FSharp.Text.Lexing
+
+     
+type position = Position
+
+/// ASCII LexBuffers 
+///
+/// The type "lexbuf" is opaque, but has an internal position information field 
+/// that can be updated by setting "lexbuf.EndPos", for example if you wish 
+/// to update the other fields in that position data before or during 
+/// lexing.  You will need to do this if you wish to maintain accurate 
+/// line-count information.  If you do this and wish to maintain strict 
+/// cross-compiling compatibility with OCamlLex and other tools you may need code 
+/// to conditionally use lexbuf_set_curr_p when compiling F# code.
+type lexbuf = LexBuffer<byte>
+
+/// Remove all input, though don't discard the  except the current lexeme 
+val flush_input: lexbuf -> unit
+
+/// Fuel a lexer using the given in_channel.  The bytes are read using Pervasives.input.
+/// If the in_channel is a textual channel the bytes are 
+/// presented to the lexer by decoding the characters using System.Text.Encoding.ASCII.
+val from_channel: System.IO.TextReader -> lexbuf
+
+/// Fuel a lexer using the given TextReader or StreamReader.
+/// The characters read are decoded to bytes using the given encoding (e.g. System.Text.Encoding.ASCII)
+/// and the bytes presented to the lexer.  The encoding used to decode the characters
+/// is associated with the expectations of the lexer (e.g. a lexer may be constructed to accept only 
+/// ASCII or pseudo-UTF8 bytes) and will typically be different to 
+/// the encoding used to decode the file.
+val from_text_reader: System.Text.Encoding -> System.IO.TextReader -> lexbuf
+
+/// Fuel a lexer using the given BinaryReader.  
+val from_binary_reader: System.IO.BinaryReader -> lexbuf
+
+/// Fuel a lexer from a string, converted to ascii using <c>System.Text.Encoding.ASCII.GetBytes</c>
+val from_string: string -> lexbuf
+
+/// Fuel a lexer from an array of bytes
+val from_bytearray: byte[] -> lexbuf
+
+/// Fuel a lexer from function that fills an array of bytes up to the given length, returning the
+/// number of bytes filled.
+val from_function: (byte[] -> int -> int) -> lexbuf
+
+#if FX_NO_ASCII_ENCODING
+#else
+/// Return the matched string 
+val lexeme: lexbuf -> string
+#endif
+
+/// Return the matched string interpreting the bytes using the given Unicode text encoding
+val lexeme_utf8: lexbuf -> string
+
+/// Return the bytes for the matched string 
+val lexeme_bytes:  lexbuf -> byte array
+
+/// Return a character from the matched string, innterpreting the bytes using an ASCII encoding
+val lexeme_char: lexbuf -> int -> char
+
+/// Return the positions stored in the lexbuf for the matched string 
+val lexeme_start_p: lexbuf -> position
+/// Return the positions stored in the lexbuf for the matched string 
+val lexeme_end_p: lexbuf -> position
+
+
+/// Return absolute positions into the entire stream of characters
+val lexeme_start: lexbuf -> int
+/// Return absolute positions into the entire stream of characters
+val lexeme_end: lexbuf -> int
+
+/// same as lexeme_end_p 
+[<System.Obsolete("Get the EndPos property in the lexbuf directly, e.g. 'lexbuf.EndPos'")>]
+val lexbuf_curr_p: lexbuf -> position 
+[<System.Obsolete("Set the EndPos property in the lexbuf directly, e.g. 'lexbuf.EndPos <- pos'")>]
+val lexbuf_set_curr_p: lexbuf -> position -> unit
+[<System.Obsolete("Set the StartPos property in the lexbuf directly, e.g. 'lexbuf.StartPos <- pos'")>]
+val lexbuf_set_start_p: lexbuf -> position -> unit
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fs
new file mode 100644
index 0000000..f6621d9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fs
@@ -0,0 +1,45 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+    open System.Collections.Generic
+
+    type TaggedMap<'Key,'Value,'Tag when 'Tag :> IComparer<'Key> > = Microsoft.FSharp.Collections.Tagged.Map<'Key,'Value,'Tag>
+    type TaggedMap<'Key,'Value> = Microsoft.FSharp.Collections.Tagged.Map<'Key,'Value>
+    module Map = 
+
+        type Provider<'Key,'T,'Tag> when 'Tag :> IComparer<'Key> =
+            interface
+              abstract empty: TaggedMap<'Key,'T,'Tag>;
+              abstract add: 'Key -> 'T -> TaggedMap<'Key,'T,'Tag> -> TaggedMap<'Key,'T,'Tag>;
+              abstract find: 'Key -> TaggedMap<'Key,'T,'Tag> -> 'T;
+              abstract first: ('Key -> 'T -> 'U option) -> TaggedMap<'Key,'T,'Tag> -> 'U option;
+              abstract tryfind: 'Key -> TaggedMap<'Key,'T,'Tag> -> 'T option;
+              abstract remove: 'Key -> TaggedMap<'Key,'T,'Tag> -> TaggedMap<'Key,'T,'Tag>;
+              abstract mem: 'Key -> TaggedMap<'Key,'T,'Tag> -> bool;
+              abstract iter: ('Key -> 'T -> unit) -> TaggedMap<'Key,'T,'Tag> -> unit;
+              abstract map:  ('T -> 'U) -> TaggedMap<'Key,'T,'Tag> -> TaggedMap<'Key,'U,'Tag>;
+              abstract mapi: ('Key -> 'T -> 'U) -> TaggedMap<'Key,'T,'Tag> -> TaggedMap<'Key,'U,'Tag>;
+              abstract fold: ('Key -> 'T -> 'State -> 'State) -> TaggedMap<'Key,'T,'Tag> -> 'State -> 'State
+            end
+
+        let MakeTagged (cf : 'Tag) : Provider<'Key,'Value,'Tag> when 'Tag :> IComparer<'Key> =
+            { new Provider<_,_,_> with 
+                 member p.empty = TaggedMap<_,_,_>.Empty(cf);
+                 member p.add k v m  = m.Add(k,v);
+                 member p.find x m = m.[x] 
+                 member p.first f m = m.First(f)
+                 member p.tryfind k m = m.TryFind(k)
+                 member p.remove x m = m.Remove(x)
+                 member p.mem x m = m.ContainsKey(x)
+                 member p.iter f m = m.Iterate(f)
+                 member p.map f m = m.MapRange(f)
+                 member p.mapi f m = m.Map(f)
+                 member p.fold f m z = m.Fold f z }
+
+        type Provider<'Key,'Value> = Provider<'Key,'Value,IComparer<'Key>>
+        let Make cf  = MakeTagged (ComparisonIdentity.FromFunction cf)
+
+
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fsi
new file mode 100644
index 0000000..60e6a85
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/map.fsi
@@ -0,0 +1,57 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+#nowarn "62" // compat
+
+module Map = 
+
+    open System
+    open System.Collections.Generic
+    open Microsoft.FSharp.Collections // Tagged.Map etc.
+
+    /// A provider for creating and using maps based on a particular comparison function.
+    /// The 'Tag type parameter is used to track information about the comparison function.
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type Provider<'Key,'T,'Tag> when 'Tag :> IComparer<'Key> =
+        interface
+          abstract empty: Tagged.Map<'Key,'T,'Tag>;
+          abstract add: 'Key -> 'T -> Tagged.Map<'Key,'T,'Tag> -> Tagged.Map<'Key,'T,'Tag>;
+          abstract find: 'Key -> Tagged.Map<'Key,'T,'Tag> -> 'T;
+          abstract first: ('Key -> 'T -> 'U option) -> Tagged.Map<'Key,'T,'Tag> -> 'U option;
+          abstract tryfind: 'Key -> Tagged.Map<'Key,'T,'Tag> -> 'T option;
+          abstract remove: 'Key -> Tagged.Map<'Key,'T,'Tag> -> Tagged.Map<'Key,'T,'Tag>;
+          abstract mem: 'Key -> Tagged.Map<'Key,'T,'Tag> -> bool;
+          abstract iter: ('Key -> 'T -> unit) -> Tagged.Map<'Key,'T,'Tag> -> unit;
+          abstract map:  ('T -> 'U) -> Tagged.Map<'Key,'T,'Tag> -> Tagged.Map<'Key,'U,'Tag>;
+          abstract mapi: ('Key -> 'T -> 'U) -> Tagged.Map<'Key,'T,'Tag> -> Tagged.Map<'Key,'U,'Tag>;
+          abstract fold: ('Key -> 'T -> 'State -> 'State) -> Tagged.Map<'Key,'T,'Tag> -> 'State -> 'State
+        end
+
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type Provider<'Key,'T> = Provider<'Key,'T,IComparer<'Key>>
+    
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val Make: ('Key -> 'Key -> int) -> Provider<'Key,'T>
+
+    /// A functor to build a collection of operations for creating and using 
+    /// maps based on the given comparison function. This returns a record that 
+    /// contains the functions you use to create and manipulate maps of
+    /// this kind.  The returned value is much like an ML module. 
+    ///
+    /// Language restrictions related to polymorphism may mean you
+    /// have to create a new instantiation of for each toplevel
+    /// key/value type pair.
+    ///
+    /// To use this function you need to define a new named class that implements IComparer and
+    /// pass an instance of that class as the first argument. For example:
+    ///      type MyComparer = 
+    ///          new() = { }
+    ///          interface IComparer<string> with 
+    ///            member self.Compare(x,y) = ...
+    ///
+    /// let MyStringMapProvider : Map.Provider < string,int > = Map.MakeTagged(new MyComparer())
+
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val MakeTagged: ('Tag :> IComparer<'Key>) -> Provider<'Key,'T,'Tag>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fs
new file mode 100644
index 0000000..cebc62b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fs
@@ -0,0 +1,241 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Math
+
+open Microsoft.FSharp.Math
+open System
+open System.Numerics
+open System.Globalization
+
+type INumeric<'T> =
+    abstract Zero: 'T
+    abstract One: 'T
+    abstract Add: 'T * 'T -> 'T
+    abstract Subtract: 'T * 'T -> 'T
+    abstract Multiply : 'T * 'T -> 'T
+    abstract Compare : 'T * 'T -> int
+    abstract Equals : 'T * 'T -> bool
+    abstract Negate : 'T -> 'T
+    abstract Sign : 'T -> int
+    abstract Abs : 'T -> 'T
+    abstract ToString : 'T * string * System.IFormatProvider -> string
+    abstract Parse : string * System.Globalization.NumberStyles * System.IFormatProvider -> 'T
+
+type IIntegral<'T> =
+    inherit INumeric<'T>
+    abstract Modulus: 'T * 'T -> 'T
+    abstract Divide : 'T * 'T -> 'T
+    abstract DivRem : 'T * 'T -> 'T * 'T
+    abstract ToBigInt : 'T -> BigInteger
+    abstract OfBigInt : BigInteger -> 'T
+  
+type IFractional<'T> =
+    inherit INumeric<'T>
+    abstract Reciprocal : 'T -> 'T
+    abstract Divide : 'T * 'T -> 'T
+
+type IFloating<'T> =
+    inherit IFractional<'T>
+    abstract Pi : 'T
+    abstract Exp : 'T -> 'T
+    abstract Log : 'T -> 'T
+    abstract Sqrt : 'T -> 'T
+    abstract LogN : 'T * 'T -> 'T
+    abstract Sin : 'T -> 'T
+    abstract Cos : 'T -> 'T
+    abstract Tan : 'T -> 'T
+    abstract Asin : 'T -> 'T
+    abstract Acos : 'T -> 'T
+    abstract Atan : 'T -> 'T
+    abstract Atan2 : 'T * 'T -> 'T
+    abstract Sinh : 'T -> 'T
+    abstract Cosh : 'T -> 'T
+    abstract Tanh : 'T -> 'T
+
+type IIEEE<'T> =
+    inherit IFloating<'T>
+    abstract PositiveInfinity : 'T
+    abstract NegativeInfinity : 'T
+    abstract NaN              : 'T
+    abstract EpsilonOne          : 'T
+    abstract IsNaN: 'T -> bool 
+    abstract IsInfinite : 'T -> bool 
+
+type INormFloat<'T> =
+    abstract Norm : 'T -> float
+ 
+module Instances = 
+  let Int32Numerics = 
+    { new IIntegral<int32> with 
+         member __.Zero = 0
+         member __.One = 1
+         member __.Add(a,b) = a + b
+         member __.Subtract(a,b) = a - b
+         member __.Multiply(a,b) = a * b
+         member __.Equals(a,b) = (a = b)
+         member __.Compare(a,b) = compare a b
+         member __.Negate(a) = - a 
+         member __.Abs(a) = a
+         member __.ToBigInt(a) = new BigInteger(a)
+         member __.OfBigInt(a) = int32 a
+         member __.Sign(a) = Math.Sign(a)
+         member __.Modulus(a,b) = a % b
+         member __.Divide(a,b) = a / b
+         member __.DivRem(a,b) = (a / b, a % b)
+         member __.ToString((x:int32),fmt,fmtprovider) = 
+                x.ToString(fmt,fmtprovider) 
+         member __.Parse(s,numstyle,fmtprovider) = 
+                System.Int32.Parse(s,numstyle,fmtprovider)
+      interface INormFloat<int32> with  
+         member __.Norm(x) = float (abs x)
+    }
+  let Int64Numerics = 
+    { new IIntegral<int64> with 
+         member __.Zero =0L
+         member __.One = 1L
+         member __.Add(a,b) = a + b
+         member __.Subtract(a,b) = a - b
+         member __.Multiply(a,b) = a * b
+         member __.Negate(a) = - a 
+         member __.Abs(a) = Math.Abs(a)
+         member __.ToBigInt(a) = new BigInteger(a)
+         member __.OfBigInt(a) = int64 a
+         member __.Sign(a) = Math.Sign(a)
+         member __.Modulus(a,b) = a % b
+         member __.Equals(a,b) = (a = b)
+         member __.Compare(a,b) = compare a b
+         member __.Divide(a,b) = a / b
+         member __.DivRem(a,b) = (a / b, a % b)
+         member __.ToString((x:int64),fmt,fmtprovider) = x.ToString(fmt,fmtprovider) 
+         member __.Parse(s,numstyle,fmtprovider) = System.Int64.Parse(s,numstyle,fmtprovider)
+      interface INormFloat<int64> with
+         member __.Norm(x) = float (Math.Abs x)
+    }
+  let FloatNumerics = 
+    { new IIEEE<float> with 
+         member __.Zero = 0.0
+         member __.One =  1.0
+         member __.Add(a,b) =  a + b
+         member __.Subtract(a,b) = a - b
+         member __.Multiply(a,b) = a * b
+         member __.Equals(a,b) = (a = b)
+         member __.Compare(a,b) = compare a b
+         member __.PositiveInfinity = Double.PositiveInfinity
+         member __.NegativeInfinity = Double.NegativeInfinity
+         member __.NaN = Double.NaN
+         member __.EpsilonOne = 0x3CB0000000000000LF
+         member __.IsInfinite(a) = Double.IsInfinity(a)
+         member __.IsNaN(a) = Double.IsNaN(a)
+         member __.Pi = Math.PI
+         member __.Reciprocal(a) = 1.0/a
+         member __.Abs(a) = Math.Abs(a)
+         member __.Sign(a) = Math.Sign(a)
+         member __.Asin(a) = Math.Asin(a)
+         member __.Acos(a) = Math.Acos(a)
+         member __.Atan(a) = Math.Atan(a)
+         member __.Atan2(a,b) = Math.Atan2(a,b)
+         member __.Tanh(a) = Math.Tanh(a)
+         member __.Tan(a) = Math.Tan(a)
+         member __.Sqrt(a) = Math.Sqrt(a)
+         member __.Sinh(a) = Math.Sinh(a)
+         member __.Cosh(a) = Math.Cosh(a)
+         member __.Sin(a) = Math.Sin(a)
+         member __.Cos(a) = Math.Cos(a)
+         member __.LogN(a,n) = 
+#if FX_NO_LOGN
+             raise (System.NotSupportedException("this operation is not supported on this platform"))
+#else
+             Math.Log(a,n)
+#endif
+         member __.Log(a) = Math.Log(a)
+         member __.Exp(a) = Math.Exp(a)
+         member __.Negate(a) = -a 
+         member __.Divide(a,b) = a / b
+         member __.ToString((x:float),fmt,fmtprovider) = x.ToString(fmt,fmtprovider) 
+         member __.Parse(s,numstyle,fmtprovider) = System.Double.Parse(s,numstyle,fmtprovider)
+      interface INormFloat<float> with
+          member __.Norm(x) = float (Math.Abs x)
+    }
+  let Float32Numerics = 
+    { new IFractional<float32> with
+           member __.Zero = 0.0f
+           member __.One =  1.0f
+           member __.Add(a,b) = a + b
+           member __.Subtract(a,b) = a - b
+           member __.Multiply(a,b) = a * b
+           member __.Equals(a,b) = (a = b)
+           member __.Compare(a,b) = compare a b
+           member __.Negate(a) = -a 
+           member __.Reciprocal(a) = 1.0f/a
+           member __.Sign(a) = Math.Sign(a)
+           member __.Abs(a) = Math.Abs(a)
+           member __.Divide(a,b) = a / b
+           member __.ToString((x:float32),fmt,fmtprovider) = x.ToString(fmt,fmtprovider) 
+           member __.Parse(s,numstyle,fmtprovider) = System.Single.Parse(s,numstyle,fmtprovider)
+       interface INormFloat<float32> with  
+           member __.Norm(x) = float (Math.Abs x)
+    }
+
+  let BigNumNumerics = 
+    { new IFractional<bignum> with 
+         member __.Zero = BigNum.Zero
+         member __.One = BigNum.One
+         member __.Add(a,b)      = a + b
+         member __.Subtract(a,b) = a - b
+         member __.Multiply(a,b) = a * b
+         member __.Equals(a,b) = (a = b)
+         member __.Compare(a,b) = compare a b
+         member __.Divide(a,b)   = a / b
+         member __.Abs(a) = BigNum.Abs a
+         member __.Sign(a) = a.Sign
+         member __.Negate(a) = - a 
+         member __.Reciprocal(a) = BigNum.One / a 
+         // Note, this ignores fmt, fmtprovider
+         member __.ToString((x:bignum),fmt,fmtprovider) = x.ToString()
+         // Note, this ignroes numstyle, fmtprovider
+         member __.Parse(s,numstyle,fmtprovider) = BigNum.Parse(s)
+
+      interface INormFloat<bignum> with
+         member __.Norm(x) = float (BigNum.Abs x)
+    }       
+
+  let BigIntNumerics = 
+    let ZeroI = new BigInteger(0)
+    { new IIntegral<_> with 
+         member __.Zero = BigInteger.Zero
+         member __.One =  BigInteger.One
+         member __.Add(a,b) = a + b
+         member __.Subtract(a,b) = a - b
+         member __.Multiply(a,b) = a * b
+         member __.Equals(a,b) = (a = b)
+         member __.Compare(a,b) = compare a b
+         member __.Divide(a,b) = a / b
+         member __.Negate(a) = -a 
+         member __.Modulus(a,b) = a % b
+         member __.DivRem(a,b) = 
+            let mutable r = new BigInteger(0)
+            (BigInteger.DivRem (a,b,&r),r)
+         member __.Sign(a) = a.Sign
+         member __.Abs(a) = abs a
+         member __.ToBigInt(a) = a 
+         member __.OfBigInt(a) = a 
+         
+         member __.ToString(x,fmt,fmtprovider) = 
+#if FX_ATLEAST_40
+             x.ToString(fmt,fmtprovider) 
+#else
+             // Note: this ignores fmt and fmtprovider
+             x.ToString() 
+#endif
+         // Note: this ignores fmt and fmtprovider
+         member __.Parse(s,numstyle,fmtprovider) = 
+#if FX_ATLEAST_40
+             BigInteger.Parse(s,numstyle,fmtprovider)
+#else
+             BigInteger.Parse(s)
+#endif
+
+      interface INormFloat<BigInteger> with  
+         member __.Norm(x) = float (abs x)
+    }       
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fsi
new file mode 100644
index 0000000..542a1a7
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/INumeric.fsi
@@ -0,0 +1,82 @@
+// (c) Microsoft Corporation 2005-2009. 
+namespace Microsoft.FSharp.Math
+
+open Microsoft.FSharp.Math
+open System.Numerics
+open System
+
+// A type-class for numeric types
+type INumeric<'T> =
+    abstract Zero: 'T
+    abstract One: 'T
+    abstract Add: 'T * 'T -> 'T
+    abstract Equals : 'T * 'T -> bool
+    abstract Compare : 'T * 'T -> int
+    abstract Subtract: 'T * 'T -> 'T
+    abstract Multiply : 'T * 'T -> 'T
+    abstract Negate : 'T -> 'T
+    abstract Sign : 'T -> int
+    abstract Abs : 'T -> 'T    
+    abstract ToString : 'T * string * System.IFormatProvider -> string
+    abstract Parse : string * System.Globalization.NumberStyles * System.IFormatProvider -> 'T
+
+type IIntegral<'T> =
+    inherit INumeric<'T>
+    abstract Modulus: 'T * 'T -> 'T
+    abstract Divide : 'T * 'T -> 'T
+    abstract DivRem : 'T * 'T -> 'T * 'T
+    abstract ToBigInt : 'T -> BigInteger
+    abstract OfBigInt : BigInteger -> 'T
+  
+type IFractional<'T> =
+    inherit INumeric<'T>
+    abstract Reciprocal : 'T -> 'T
+    abstract Divide : 'T * 'T -> 'T
+
+// Suggestion: IReal (since transcendentals are added here).
+type IFloating<'T> =
+    inherit IFractional<'T>
+    abstract Pi : 'T
+    abstract Exp : 'T -> 'T
+    abstract Log : 'T -> 'T
+    abstract Sqrt : 'T -> 'T
+    abstract LogN : 'T * 'T -> 'T
+    abstract Sin : 'T -> 'T
+    abstract Cos : 'T -> 'T
+    abstract Tan : 'T -> 'T
+    abstract Asin : 'T -> 'T
+    abstract Acos : 'T -> 'T
+    abstract Atan : 'T -> 'T
+    abstract Atan2 : 'T * 'T -> 'T
+    abstract Sinh : 'T -> 'T
+    abstract Cosh : 'T -> 'T
+    abstract Tanh : 'T -> 'T
+
+type INormFloat<'T> =
+    abstract Norm : 'T -> float
+  
+// Direct access to IEEE encoding not easy on .NET
+type IIEEE<'T> =
+    inherit IFloating<'T>
+    abstract PositiveInfinity : 'T
+    abstract NegativeInfinity : 'T
+    abstract NaN              : 'T
+    abstract EpsilonOne       : 'T
+
+    abstract IsNaN: 'T -> bool 
+    abstract IsInfinite : 'T -> bool 
+    //abstract IsDenormalized   : 'T -> bool 
+    //abstract IsNegativeZero   : 'T -> bool 
+    //abstract IsIEEE           : 'T -> bool 
+
+
+module Instances =
+    val Float32Numerics  : IFractional<float32> 
+    val FloatNumerics    : IIEEE<float>
+    val Int32Numerics    : IIntegral<int32>
+    val Int64Numerics    : IIntegral<int64>
+    val BigIntNumerics   : IIntegral<BigInteger>
+    val BigNumNumerics   : IFractional<bignum>  
+
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fs
new file mode 100644
index 0000000..6d0683b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fs
@@ -0,0 +1,52 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.NativeInterop
+
+#nowarn "44"
+#nowarn "9" // unverifiable constructs
+#nowarn "51" // unverifiable constructs
+
+open System
+open System.Runtime.InteropServices
+open Microsoft.FSharp.NativeInterop
+open Microsoft.FSharp.Math
+open Microsoft.FSharp.Compatibility
+
+[<AutoOpen>]
+module NativArrayExtensionsForMatrix =
+
+    [<NoDynamicInvocation>]
+    let inline pinObjUnscoped (obj: obj) =  GCHandle.Alloc(obj,GCHandleType.Pinned) 
+    [<NoDynamicInvocation>]
+    let inline pinObj (obj: obj) f = 
+        let gch = pinObjUnscoped obj 
+        try f gch
+        finally
+            gch.Free()
+
+    type Microsoft.FSharp.NativeInterop.PinnedArray<'T when 'T : unmanaged> with
+
+        [<NoDynamicInvocation>]
+        static member inline of_vector(m:Vector<'T>) = 
+            let gch = pinObjUnscoped (box m.InternalValues) 
+            let ptr = &&m.InternalValues.[0]
+            new PinnedArray<'T>(new NativeArray<_>(ptr,m.Length),gch)
+
+        [<NoDynamicInvocation>]
+        static member inline of_rowvec(m:RowVector<'T>) = 
+            let gch = pinObjUnscoped (box m.InternalValues) 
+            let ptr = &&m.InternalValues.[0]
+            new PinnedArray<'T>(new NativeArray<_>(ptr,m.Length),gch)
+            
+
+    type Microsoft.FSharp.NativeInterop.PinnedArray2<'T when 'T : unmanaged> with
+
+        [<NoDynamicInvocation>]
+        static member inline of_matrix(m:Matrix<'T>) = 
+            if m.IsDense then
+                let gch = pinObjUnscoped (box m.InternalDenseValues) 
+                let ptr = && m.InternalDenseValues.[0,0]
+                new PinnedArray2<'T>(new NativeArray2<_>(ptr,m.NumRows,m.NumCols),gch) 
+            else
+                invalidArg "m" "cannot pin sparse matrices"
+            
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fsi
new file mode 100644
index 0000000..e23855b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/NativeArrayExtensions.fsi
@@ -0,0 +1,27 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.NativeInterop
+
+open Microsoft.FSharp.Math
+open System.Runtime.InteropServices
+
+[<AutoOpen>]
+module NativArrayExtensionsForMatrix =
+
+    type Microsoft.FSharp.NativeInterop.PinnedArray<'T when 'T : unmanaged> with
+
+        /// For native interop. Pin the given object
+        [<NoDynamicInvocation>]
+        static member inline of_vector : Vector<'T> -> PinnedArray<'T>
+
+        /// For native interop. Pin the given object
+        [<NoDynamicInvocation>]
+        static member inline of_rowvec : RowVector<'T> -> PinnedArray<'T>
+
+
+    type Microsoft.FSharp.NativeInterop.PinnedArray2<'T when 'T : unmanaged> with
+
+        /// For native interop. Pin the given object
+        [<NoDynamicInvocation>]
+        static member inline of_matrix : Matrix<'T> -> PinnedArray2<'T>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fs
new file mode 100644
index 0000000..1c6156c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fs
@@ -0,0 +1,61 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+module GlobalAssociations =
+
+    open Microsoft.FSharp.Math
+    open Microsoft.FSharp.Math.Instances
+    open System
+    open System.Numerics
+
+    let ComplexNumerics = 
+      { new IFractional<_> with 
+          member __.Zero = Microsoft.FSharp.Math.Complex.Zero
+          member __.One = Microsoft.FSharp.Math.Complex.One
+          member __.Add(a,b) = a + b
+          member __.Subtract(a,b) = a - b
+          member __.Multiply(a,b) = a * b
+          member __.Equals(a,b) = (a = b)
+          member __.Compare(a,b) = compare a b
+          member __.Divide(a,b) = a / b
+          member __.Negate(a) = -a
+          member __.Abs(a)  = a // not signed
+          member __.Sign(a) = 1 // not signed
+          member __.Reciprocal(a) =  Microsoft.FSharp.Math.Complex.One / a 
+          member __.ToString((x:Microsoft.FSharp.Math.Complex),fmt,fmtprovider) = x.ToString(fmt,fmtprovider)
+          member __.Parse(s,numstyle,fmtprovider) = Microsoft.FSharp.Math.Complex.mkRect (System.Double.Parse(s,numstyle,fmtprovider),0.0) }
+
+    let ht = 
+        let ht = new System.Collections.Generic.Dictionary<Type,obj>() 
+        let optab =
+            [ typeof<float>,   (Some(FloatNumerics    :> INumeric<float>) :> obj);
+              typeof<int32>,   (Some(Int32Numerics    :> INumeric<int32>) :> obj);
+              typeof<int64>,   (Some(Int64Numerics    :> INumeric<int64>) :> obj);
+              typeof<BigInteger>,  (Some(BigIntNumerics   :> INumeric<BigInteger>) :> obj);
+              typeof<float32>, (Some(Float32Numerics  :> INumeric<float32>) :> obj);
+              typeof<Microsoft.FSharp.Math.Complex>, (Some(ComplexNumerics :> INumeric<Microsoft.FSharp.Math.Complex>) :> obj);
+              typeof<bignum>,  (Some(BigNumNumerics   :> INumeric<bignum>) :> obj); ]
+           
+        List.iter (fun (ty,ops) -> ht.Add(ty,ops)) optab;
+        ht
+        
+    let Put (ty: System.Type, d : obj)  =
+        lock ht (fun () -> 
+            if ht.ContainsKey(ty) then invalidArg "ty" ("the type "+ty.Name+" already has a registered numeric association");
+            ht.Add(ty, d))
+      
+    let TryGetNumericAssociation<'a>() = 
+        lock ht (fun () -> 
+            let ty = typeof<'a>  
+            if ht.ContainsKey(ty) then
+                match ht.[ty] with
+                | :? (INumeric<'a> option) as r -> r
+                | _ -> invalidArg "ty" ("The type "+ty.Name+" has a numeric association but it was not of the correct type")
+            else
+                None)
+
+    let GetNumericAssociation() = (TryGetNumericAssociation()).Value
+    let RegisterNumericAssociation (d : INumeric<'a>)  = Put(typeof<'a>, box(Some d))
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fsi
new file mode 100644
index 0000000..3296c2d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/associations.fsi
@@ -0,0 +1,28 @@
+// (c) Microsoft Corporation 2005-2009. 
+namespace Microsoft.FSharp.Math
+
+/// Associations are a way of associating dictionaries of
+/// operations with given types at runtime.  Associations are global to a 
+/// .NET application domain.  Once specified an association may not be deleted
+/// or modified.
+///
+/// In this release the system of associations is simply 
+/// limited to a registry of types that support dictionaries (i.e. interface objects)
+/// of numeric operations.  The following types are pre-registered with associated numeric
+/// operations: float, int32, int64, bigint, float32, Complex, bignum.  Other types must be
+/// registered explicitly by user code.
+///
+module GlobalAssociations =
+
+    open Microsoft.FSharp.Math
+
+    /// Attempt to determine a numeric association for the given type, i.e. a registered dictionary of
+    /// numeric operations.  The interface can be queried dynamically for additional functionality in the numerics
+    /// hierarchy.
+    val GetNumericAssociation : unit -> INumeric<'a> 
+
+    val TryGetNumericAssociation : unit -> INumeric<'a>  option
+    /// Record an AppDomain-wide association between the given type and the given dictionary of
+    /// numeric operations.  Raise an error if an existing association already exists. 
+    val RegisterNumericAssociation : INumeric<'a> -> unit
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fs
new file mode 100644
index 0000000..05c9bb4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fs
@@ -0,0 +1,130 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#nowarn "52" // defensive copy of structs warning
+
+namespace Microsoft.FSharp.Math
+
+    open Microsoft.FSharp.Math
+    open System
+    open System.Globalization
+
+    [<Struct>]
+    [<CustomEquality; CustomComparison>]
+    type Complex(real: float, imaginary: float) =
+        //new() = new Complex(0.0,0.0)
+        member x.r = real
+        member x.i = imaginary
+        override x.ToString() = x.ToString("g")
+        member x.ToString(fmt) = x.ToString(fmt,CultureInfo.InvariantCulture)
+        member x.ToString(fmt,fmtprovider:IFormatProvider) = 
+               x.r.ToString(fmt,fmtprovider)+"r"+(if x.i < 0.0 then "-" else "+")+(System.Math.Abs x.i).ToString(fmt,fmtprovider)+"i"
+        interface IComparable with 
+            member x.CompareTo(obj) = 
+                match obj with 
+                | :? Complex as y -> 
+                     let c = compare x.r y.r
+                     if c <> 0 then c else compare x.i y.i
+                | _ -> invalidArg "obj" "not a Complex number"
+        override x.Equals(obj) = 
+                match obj with 
+                | :? Complex as y -> x.r = y.r && x.i = y.i
+                | _ -> false
+        override x.GetHashCode() = 
+                (hash x.r >>> 5) ^^^  (hash x.r <<< 3) ^^^  (((hash x.i >>> 4) ^^^  (hash x.i <<< 4)) + 0x9e3779b9)
+
+                
+    type complex = Complex
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module Complex = 
+      let mkRect(a,b) = new Complex(a,b)
+      let conjugate (c:complex) = mkRect (c.r, -c.i)
+      let mkPolar(a,b) = mkRect (a * Math.Cos(b), a * Math.Sin(b))
+      let cis b = mkPolar(1.0,b)
+      let zero = mkRect(0.,0.)
+      let one = mkRect(1.,0.) 
+      let onei = mkRect(0.,1.) 
+      let magnitude (c:complex) = sqrt(c.r*c.r + c.i*c.i)
+      let phase (c:complex) = Math.Atan2(c.i,c.r)
+      let realPart (c:complex) = c.r
+      let imagPart (c:complex) = c.i  
+      let abs (a:complex) = sqrt (a.r**2.0 + a.i**2.0)
+      let add (a:complex) (b:complex) = mkRect(a.r + b.r, a.i+b.i)
+      let sub (a:complex) (b:complex) = mkRect(a.r - b.r, a.i-b.i)
+      let mul (a:complex) (b:complex) = mkRect(a.r * b.r - a.i * b.i, a.i*b.r + b.i*a.r)
+      let div (x:complex) (y:complex) = 
+          let a = x.r in let b = x.i in 
+          let c = y.r in let d = y.i in 
+          //(a+ib)/(c+id)=(ac+bd+i(bc-ad))/(c2+d2) 
+          let q = c*c + d*d in 
+          mkRect((a*c+b*d)/q, (b*c - a*d)/q)
+      let neg (a:complex) = mkRect(-a.r,-a.i)
+      let smul (a:float)(b:complex) = mkRect(a * b.r, a*b.i)
+      let muls (a:complex) (b:float) = mkRect(a.r *b, a.i*b)
+      let fmt_of_string numstyle fmtprovider (s:string) =
+        mkRect (System.Double.Parse(s,numstyle,fmtprovider),0.0) 
+      let of_string s = fmt_of_string NumberStyles.Any CultureInfo.InvariantCulture s
+
+      // ik.(r + i.th) = -k.th + i.k.r 
+      let iscale k (x:complex) = mkRect (-k * x.i , k * x.r)
+
+      // LogN : 'a * 'a -> 'a
+      // Asin : 'a -> 'a
+      // Acos : 'a -> 'a
+      // Atan : 'a -> 'a
+      // Atan2 : 'a * 'a -> 'a
+      // Sinh : 'a -> 'a
+      // Cosh : 'a -> 'a
+      // Tanh : 'a -> 'a
+
+      let pi    = mkRect (Math.PI,0.0)
+
+      // exp(r+it) = exp(r).(cos(t)+i.sin(t)) - De Moivre Theorem 
+      let exp (x:complex) = smul (exp(x.r)) (mkRect(cos(x.i), sin(x.i)))
+      // x = mag.e^(i.th) = e^ln(mag).e^(i.th) = e^(ln(mag) + i.th) 
+      let log x = mkRect (log(magnitude(x)),phase(x))
+
+      let sqrt x = mkPolar (sqrt(magnitude x),phase x / 2.0)
+
+      // cos(x) = (exp(i.x) + exp(-i.x))/2 
+      let cos x = smul 0.5 (add (exp(iscale 1.0 x)) (exp(iscale -1.0 x)))
+      // sin(x) = (exp(i.x) - exp(-i.x))/2 . (-i) 
+      let sin x = smul 0.5 (sub (exp(iscale 1.0 x)) (exp(iscale -1.0 x))) |> iscale (-1.0)
+      // tan(x) = (exp(i.x) - exp(-i.x)) . (-i) / (exp(i.x) + exp(-i.x)) 
+      //        = (exp(2i.x) - 1.0)      . (-i) / (exp(2i.x) + 1.0)      
+      let tan x = let exp2ix = exp(iscale 2.0 x) in
+                  (div (sub exp2ix one) (add exp2ix one)) |> iscale -1.0
+
+
+    type Complex with 
+        static member Create(a,b) = Complex.mkRect (a,b)
+        static member CreatePolar(a,b) = Complex.mkPolar (a,b)
+        member x.Magnitude = Complex.magnitude x
+        member x.Phase = Complex.phase x
+        member x.RealPart = x.r
+        member x.ImaginaryPart = x.i
+        member x.Conjugate = Complex.conjugate x
+
+        static member Sin(x) = Complex.sin(x)
+        static member Cos(x) = Complex.cos(x)
+        static member Abs(x) = Complex.abs(x)
+        static member Tan(x) = Complex.tan(x)
+        static member Log(x) = Complex.log(x)
+        static member Exp(x) = Complex.exp(x)
+        static member Sqrt(x) = Complex.sqrt(x)
+        
+        static member Zero = Complex.zero
+        static member One = Complex.one 
+        static member OneI = Complex.onei 
+        static member ( +  ) (a,b) = Complex.add a b
+        static member ( -  ) (a,b) = Complex.sub a b
+        static member ( *  ) (a,b) = Complex.mul a b
+        static member ( /  ) (a,b) = Complex.div a b
+        static member ( ~- ) a = Complex.neg a
+        static member ( * ) (a,b) = Complex.smul a b
+        static member ( * ) (a,b) = Complex.muls a b
+
+
+    module ComplexTopLevelOperators = 
+        let complex x y = Complex.mkRect (x,y)
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fsi
new file mode 100644
index 0000000..5245a4f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/complex.fsi
@@ -0,0 +1,136 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+    open System
+      
+    /// The type of complex numbers stored as pairs of 64-bit floating point numbers in rectangular coordinates
+    [<Struct>]
+    [<CustomEquality; CustomComparison>]
+    type Complex = 
+        /// The real part of a complex number
+        member r: float
+        /// The imaginary part of a complex number
+        member i: float
+        /// The polar-coordinate magnitude of a complex number
+        member Magnitude: float
+        /// The polar-coordinate phase of a complex number
+        member Phase: float
+        /// The real part of a complex number
+        member RealPart: float
+        /// The imaginary part of a complex number
+        member ImaginaryPart: float
+        /// The conjugate of a complex number, i.e. x-yi
+        member Conjugate: Complex
+        /// Create a complex number x+ij using rectangular coordinates
+        static member Create      : float * float -> Complex
+        /// Create a complex number using magnitude/phase polar coordinates
+        static member CreatePolar : float * float -> Complex
+        /// The complex number 0+0i
+        static member Zero   : Complex
+        /// The complex number 1+0i
+        static member One    : Complex
+        /// The complex number 0+1i
+        static member OneI   : Complex
+        /// Add two complex numbers
+        static member ( +  ) : Complex * Complex -> Complex
+        /// Subtract one complex number from another
+        static member ( -  ) : Complex * Complex -> Complex
+        /// Multiply two complex numbers
+        static member ( *  ) : Complex * Complex -> Complex
+        /// Complex division of two complex numbers
+        static member ( /  ) : Complex * Complex -> Complex
+        /// Unary negation of a complex number
+        static member ( ~- ) : Complex           -> Complex
+        /// Multiply a scalar by a complex number 
+        static member ( * ) : float   * Complex -> Complex
+        /// Multiply a complex number by a scalar
+        static member ( * ) : Complex * float   -> Complex
+
+        static member Sin : Complex -> Complex
+        static member Cos : Complex -> Complex
+        
+        /// Computes the absolute value of a complex number: e.g. Abs x+iy = sqrt(x**2.0 + y**2.0.)
+        /// Note: Complex.Abs(z) is the same as z.Magnitude
+        static member Abs : Complex -> float
+        static member Tan : Complex -> Complex
+        static member Log : Complex -> Complex
+        static member Exp : Complex -> Complex
+        static member Sqrt : Complex -> Complex
+        
+        override ToString : unit -> string
+        override Equals : obj -> bool
+        interface System.IComparable
+        member ToString : format:string -> string
+        member ToString : format:string * provider:System.IFormatProvider -> string
+
+    /// The type of complex numbers 
+    type complex = Complex
+
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    [<RequireQualifiedAccess>]
+    module Complex =
+
+        val mkRect: float * float -> complex
+
+          /// The polar-coordinate magnitude of a complex number
+        val magnitude: complex -> float
+          /// The polar-coordinate phase of a complex number
+        val phase     : complex -> float
+          /// The real part of a complex number
+        val realPart  : complex -> float
+          /// The imaginary part of a complex number
+        val imagPart  : complex -> float
+          /// Create a complex number using magnitude/phase polar coordinates
+        val mkPolar : float * float -> complex
+        /// A complex of magnitude 1 and the given phase and , i.e. cis x = mkPolar 1.0 x
+        val cis     : float -> complex
+        
+          /// The conjugate of a complex number, i.e. x-yi
+        val conjugate : complex -> complex
+
+          /// The complex number 0+0i
+        val zero    : complex
+          /// The complex number 1+0i
+        val one     : complex
+          /// The complex number 0+1i
+        val onei    : complex
+          /// Add two complex numbers
+        val add     : complex -> complex -> complex
+          /// Subtract one complex number from another
+        val sub     : complex -> complex -> complex
+          /// Multiply two complex numbers
+        val mul     : complex -> complex -> complex
+          /// Complex division of two complex numbers
+        val div     : complex -> complex -> complex
+          /// Unary negation of a complex number
+        val neg     : complex -> complex
+          /// Multiply a scalar by a complex number 
+        val smul    : float -> complex -> complex
+          /// Multiply a complex number by a scalar
+        val muls    : complex -> float -> complex
+
+          /// pi
+        val pi  : Complex
+          /// exp(x) = e^x
+        val exp : Complex -> Complex
+          /// log(x) is natural log (base e)
+        val log : Complex -> Complex
+          /// sqrt(x) and 0 <= phase(x) < pi
+        val sqrt : Complex -> Complex
+          /// Sine
+        val sin : Complex -> Complex    
+          /// Cosine
+        val cos : Complex -> Complex
+          /// Tagent
+        val tan : Complex -> Complex
+        
+
+    [<AutoOpen>]
+    module ComplexTopLevelOperators = 
+        /// Constructs a complex number from both the real and imaginary part.
+        val complex : float -> float -> complex
+
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/FSharp.PowerPack.Math.Providers.fsproj b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/FSharp.PowerPack.Math.Providers.fsproj
new file mode 100644
index 0000000..2bd285c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/FSharp.PowerPack.Math.Providers.fsproj
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <FSharpPowerPackSourcesRoot>..\..\..</FSharpPowerPackSourcesRoot>
+  </PropertyGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.Settings.targets"/>
+  <PropertyGroup>
+    <OutputType>Library</OutputType>
+    <SchemaVersion>2.0</SchemaVersion>
+    <AllowCrossTargeting>true</AllowCrossTargeting>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <DocumentationFile>Test.PowerPack.Math.Providers.xml</DocumentationFile>
+    <NoWarn>$(NoWarn);58;62</NoWarn>
+  </PropertyGroup>
+  <!-- These dummy entries are needed for F# Beta2 -->
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="service.fsi" />
+    <Compile Include="service.fs" />
+    <Compile Include="lapack_base.fs" />
+    <Compile Include="lapack_service_mkl.fsi" />
+    <Compile Include="lapack_service_mkl.fs" />
+    <Compile Include="lapack_service_netlib.fsi" />
+    <Compile Include="lapack_service_netlib.fs" />
+    <Compile Include="linear_algebra_service.fs" />
+    <Compile Include="linear_algebra_managed.fs" />
+    <Compile Include="linear_algebra.fsi" />
+    <Compile Include="linear_algebra.fs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <ProjectReference Include="..\..\Test.PowerPack.fsproj"  >
+      <Project>{DED3BBD7-53F4-428A-8C9F-27968E768605}</Project>
+      <Name>Test.PowerPack</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(FSharpPowerPackSourcesRoot)\CodePlex.targets"/>
+  <Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="!Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
+  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')"  />
+</Project>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/build.bat b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/build.bat
new file mode 100644
index 0000000..836f39c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/build.bat
@@ -0,0 +1,6 @@
+rem obsolete, pending delete
+rem call regen.bat
+rem ..\..\..\..\..\bin\fsc -a -o bin/FSharp.Math.LAPack.dll lapack_base.fs lapack.fsi lapack.fs lapack_service_mkl.fsi lapack_service_mkl.fs lapack_service_netlib.fsi lapack_service_netlib.fs
+
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/code_generator.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/code_generator.fs
new file mode 100644
index 0000000..b758ff2
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/code_generator.fs
@@ -0,0 +1,611 @@
+// CONTENTS-INDEX-REGEXP = FROM>^.?.?! <TO
+//----------------------------------------------------------------------------
+//CONTENTS-START-LINE: HERE=2 SEP=2
+// 24.    argument specification
+// 48.    generator
+// 335.   specifications
+// 457.   specifications list
+// 482.   generate netlib and MKL bindings
+//CONTENTS-END-LINE:
+//----------------------------------------------------------------------------
+
+#nowarn "51"
+
+open System
+open System.Runtime.InteropServices
+open Microsoft.FSharp.NativeInterop
+open Microsoft.FSharp.Math
+
+// Developed by Can Erten.
+// (c) Microsoft Corporation 2005-2009.
+
+//----------------------------------------------------------------------------
+//! argument specification
+//----------------------------------------------------------------------------
+
+type Arg =
+  // The first string is always the name of the argument.
+  | Dim    of string                            // "m"
+  | Matrix of string * string * string          // "a","m","k"
+  | Vector of string * string                   // "v","k"
+  | HW     of string * string                   // "lda","k"          -- HW meaning HardWired
+  | Array  of string * string                   // ipiv,n             -- also local workspace
+  | Array2 of string * string * string          // worko, "m", "n"    -- 2 dimension array with length m and n
+  | Out    of Arg
+  | In     of Arg
+  | InOut  of Arg
+  | Info   of string                            // "info"
+  | UserDefined of string                       // "joleft" -> it will have its own data type
+  | Trans  of string * string option            // "transId", (None, 'n' or (Some "a", 't' and no need to fix up matrix "a"))
+  | Work   of  Arg * string        // "var NAME   ARRAY - SIZE....  // TYPE!!!!"
+  // double *work, int *lwork,
+
+let mapLeafArg f = function Out arg -> f arg | InOut arg -> f arg | arg -> f arg
+
+
+//----------------------------------------------------------------------------
+//! generator
+//----------------------------------------------------------------------------
+
+open System.Collections.Generic
+open System.IO
+
+let mutable sw = null : StreamWriter
+let printf fmt = fprintf (sw :> TextWriter) fmt
+let start path = sw <- new StreamWriter(path:string); Printf.printf "Writing %s\n" path
+let stop()  = sw.Close()
+
+// let printf fmt = Printf.printf fmt
+
+let genFormal arg = 
+  let inputMatcher p = 
+    match p with 
+             | UserDefined(a) -> sprintf "(%s)"  a
+             | Matrix (a,m,n) -> sprintf "(%s:matrix)" a
+             | Vector (v,m)   -> sprintf "(%s:vector)" v
+             | Array (a,b)    -> sprintf "(%s)" a
+             | _ -> assert (false)  
+  match arg with
+    | In p1    -> Some (inputMatcher p1)
+    | InOut p1 -> Some (inputMatcher p1)
+    | _        -> None
+  //////////////////////////////////////////////
+  
+// This is overkill:
+let genInputCopies arg = 
+    let fixInput arg = 
+        match arg with 
+        | Matrix (a,_,_)  -> printf "  let %s = Matrix.copy %s\n" a a
+        | Vector(a,_)     -> printf "  let %s = Vector.copy %s\n" a a
+        | Array(a,_)      -> printf "  let %s = Array.copy %s\n" a a
+        | Array2(a,_,_)   -> printf "  let %s = Array2D.Copy %s\n" a a
+        | UserDefined (_) -> ()
+        | _ -> assert false
+    match arg with
+    | In a  | InOut a -> fixInput a
+    | _ -> () 
+  
+let rec genDimension f (knownDims:Dictionary<string,int>) arg =
+  let isExprNotId (str:string) = str.Contains(" ") // e.g. dgels function has a "max m n" dimension
+  let setDimension d (expr,exprDescription) =
+    if isExprNotId d then
+      // Some dimensions are related to other (prior) dims by formula. Assert it.
+      printf "  NativeUtilities.assertDimensions \"%s\" (\"%s\",\"%s\") (%s,%s);\n" f d exprDescription d expr
+      //printf "  assert(%s = %s);\n" d expr
+    else
+      if knownDims.ContainsKey(d) then
+        printf "  NativeUtilities.assertDimensions \"%s\" (\"%s\",\"%s\") (%s,%s);\n" f d exprDescription d expr
+        //printf "  assert(%s = %s);\n" d expr
+      else
+        printf "  let %s = %s in\n" d expr
+        knownDims.[d] <- 1
+  match arg with
+  | Dim n                      -> ()
+  | Matrix (a,m,n)             -> setDimension m (sprintf "NativeUtilities.matrixDim1 %s" a,sprintf "Dim1(%s)" a);
+                                  setDimension n (sprintf "NativeUtilities.matrixDim2 %s" a,sprintf "Dim2(%s)" a);
+  | Vector (v,m)               -> setDimension m (sprintf "NativeUtilities.vectorDim  %s" v,sprintf "Dim(%s)"  v);
+  | HW _                       -> ()
+  | Trans _                    -> ()
+  | Out _                      -> ()
+  | InOut p                    -> genDimension f knownDims p
+  | In p                       -> genDimension f knownDims p
+  | _ -> ()
+  
+let rec genAllocResult arg = 
+  match arg with
+  | Matrix (a,m,n)      -> printf "  let %s = Matrix.zero (%s) (%s)\n" a m n
+  | Array (ip, n)       -> printf "  let %s = Array.zeroCreate  (%s)\n" ip n
+  | Array2(work, ld, n) -> printf "  let %s = Array2D.zeroCreate (%s) (%s)\n" work ld n
+  | Vector (v,m)        -> printf "  let %s = Vector.zero (%s)\n"    v m
+  | Work (p,_)              -> genAllocResult p
+  | Out p -> genAllocResult p
+  | _ -> ()
+ 
+let preFixups args = 
+  // Matrices that must be transposed prior to calling.
+  let selectTransArgs  = function Trans (tv,Some a) -> Some a | _ -> None
+  let selectMatrixArgs = mapLeafArg (function Matrix (a,m,n) | In(Matrix (a,m,n)) | InOut(Matrix (a,m,n)) -> Some a |  _ -> None)
+  let matrices  = List.choose  selectMatrixArgs args |> Set.ofList
+  let transArgs = List.choose selectTransArgs  args |> Set.ofList
+  Set.diff matrices transArgs
+
+let postFixups args = 
+  // Matrices that must be transposed prior to calling.
+  let selectTransArgs = function Trans (tv,Some a) -> Some a | _ -> None
+  let selectMatrixOut = function Out (Matrix (a,m,n)) -> Some a | InOut (Matrix (a,m,n)) -> Some a | _ -> None
+  let matricesOut = List.choose selectMatrixOut args |> Set.ofList
+  let transArgs    = List.choose selectTransArgs args |> Set.ofList
+  Set.diff matricesOut transArgs
+
+let rec genTransposeFixup fixups arg = 
+  match arg with
+    | Matrix(a,m,n) when Set.contains a fixups -> printf "  let %s = Matrix.transpose %s\n" a a
+    | Out arg -> genTransposeFixup fixups arg
+    | InOut arg -> genTransposeFixup fixups arg
+    | In arg -> genTransposeFixup fixups arg
+    | _ -> ()
+
+let rec genActualDef arg = 
+  match arg with
+  | Dim n                  -> printf "  let mutable arg_%s = %s\n" n n
+  | Matrix (a,m,n)         -> printf "  let arg_%s = NativeUtilities.pinM %s\n" a a
+  | Vector (v,m)           -> printf "  let arg_%s = NativeUtilities.pinV %s\n" v v
+  | Array(a,i)             -> printf "  let arg_%s = NativeUtilities.pinA %s\n" a a
+  | Array2(a,m,n)          -> printf "  let arg_%s = NativeUtilities.pinA2 %s\n" a a
+  | Trans (tv,opt)         -> printf "  let mutable arg_%s = '%s'\n" tv (if opt.IsSome then "t" else "n")
+  | UserDefined(s)         -> printf "  let mutable arg_%s = %s\n" s s
+  | HW (n,x)               -> printf "  let mutable arg_%s = %s\n" n x
+  | Info(n)                -> printf "  let mutable arg_%s = 0\n" n
+  
+  | Work (p,_)             -> genActualDef p  
+  | Out p                  -> genActualDef p
+  | InOut p                -> genActualDef p
+  | In p                   -> genActualDef p
+  
+let rec genActualArg arg = 
+  match arg with
+  | Dim n                  -> sprintf "&&arg_%s" n
+  | Matrix (a,m,n)         -> sprintf "arg_%s.Ptr" a
+  | Vector (v,m)           -> sprintf "arg_%s.Ptr" v
+  | Array (a,i)            -> sprintf "arg_%s.Ptr" a
+  | Array2 (a,i,p)         -> sprintf "arg_%s.Ptr" a
+  | HW (n,x)               -> sprintf "&&arg_%s" n
+  | Trans (tv,x)           -> sprintf "&&arg_%s" tv
+  | Info (m)               -> sprintf "&&arg_%s" m
+  | UserDefined(s)         -> sprintf "&&arg_%s" s
+  
+  | Work (p,_) -> genActualArg p
+  | Out p -> genActualArg p
+  | InOut p ->  genActualArg p
+  | In  p   ->  genActualArg p
+
+let genWorkWorkaround f spec moduleName=
+    //find work args  Array(a,i)     ->      printf    "    NativeUtilities.freeA arg_%s\n" a
+    let selectWorkArrayName  = function Work (Array (aName,_),typ) -> Some(aName,typ) | _ -> None
+    let selectWorkHWSizeName = function Work (HW (sizeName,_),_) -> Some(sizeName) | _ -> None
+    
+    
+    let woNameList = List.choose selectWorkArrayName spec
+    let woSizeList = List.choose selectWorkHWSizeName spec
+    
+  
+    assert (woNameList.Length = woSizeList.Length)
+    
+    if woNameList.Length >0 then
+        // filteri
+ 
+        // Note: not tail recursive
+        let findall_i f xs =
+            let rec aux i xs = match xs with [] -> [] | y::ys -> if f i y then i :: aux (i+1) ys else aux (i+1) ys  
+            aux 0 xs
+                
+        let sizeIndexList = findall_i (fun i x -> match x with | Work((HW _),_) -> true | _ -> false) spec
+        printf "  // ask for work array size\n"
+        printf "  try\n";
+        printf "    %s.%s(%s)\n" moduleName f (String.Join(",", Array.ofList (List.map genActualArg spec)));
+        printf "  finally\n";
+        
+        // freeing all!!! start from here
+        
+        List.iter (fun x ->  printf "    NativeUtilities.freeA arg_%s\n" (fst x)) woNameList
+
+        printf "  if arg_info = 0  "
+        // this is returns +1 value be careful!!! it#s modified..
+        List.iter (fun (x : int) -> printf " or arg_info=(-%s) " ((x+1).ToString())) sizeIndexList
+        printf "then\n"
+        
+        List.iter2
+           (fun s n -> 
+                match (snd n) with
+                | "f" -> printf "    arg_%s <- int32 %s.[0]\n" s (fst n)
+                | "i" -> printf "    arg_%s <-  %s.[0]\n" s (fst n)
+                | _ -> assert(false) ) woSizeList woNameList
+        
+        printf "  else assert(false)\n"
+        
+        
+        List.iter2
+           (fun n s -> 
+                match (snd n) with
+                | "f" -> printf "  let arg_%s = NativeUtilities.pinA (Array.zeroCreate arg_%s : float[])\n" (fst n) s
+                | "i" -> printf "  let arg_%s = NativeUtilities.pinA (Array.zeroCreate arg_%s : int[])\n" (fst n) s
+                | _ -> assert(false) )   woNameList woSizeList 
+
+let  genInfo f spec = 
+    let rec genInfoHandle i arg = 
+        let argPrint i arg = printf "   | -%-2d -> invalid_arg \"%s: %s (argument %d)\"\n" (i+1) f arg (i+1)
+        match arg with
+        | Dim n               -> argPrint i n
+        | Matrix (a,_,_)      -> argPrint i a
+        | Vector (v,_)        -> argPrint i v
+        | Array (a,_)         -> argPrint i a
+        | Array2 (a,_,_)      -> argPrint i a
+        | HW (n,x)            -> argPrint i n
+        | Trans (tv,x)        -> argPrint i tv
+        | Info (m)            -> argPrint i m
+        | UserDefined(s)      -> argPrint i s
+        
+        | Work (p,_)          -> genInfoHandle i p
+        | Out p               -> genInfoHandle i p
+        | InOut p             -> genInfoHandle i p
+        | In p                -> genInfoHandle i p
+      // if info exist
+    //let info = try Some (List.find(fun x -> match x with  | Info _ -> true;  | _ -> false ) spec)
+      //         with Not_found -> None
+               
+    //let info2 = List.tryFind (fun x -> match x with | Info _ -> true | _ -> false) spec
+    let info = List.tryFind (function Info _ -> true | _ -> false) spec
+      
+    if (info.IsSome) then     
+      let name = match info.Value with | Info(s) -> s | _ -> assert(false)
+      printf "  match arg_%s with\n" name
+      List.iteri genInfoHandle spec
+      printf "   | 0   -> ()\n" 
+      printf "   | n   -> failwith (sprintf \"%s : returned %%d. The computation failed.\" n)\n" f
+    ()
+
+let rec genActualDispose arg = 
+  match arg with
+  | Dim n                -> ()
+  | Matrix (a,m,n)       -> printf "    NativeUtilities.freeM arg_%s\n" a
+  | Vector (v,m)         -> printf "    NativeUtilities.freeV arg_%s\n" v
+  | Array(a,i)           -> printf "    NativeUtilities.freeA arg_%s\n" a
+  | Array2(a,i,j)        -> printf "    NativeUtilities.freeA2 arg_%s\n" a
+  | HW (n,x)             -> ()
+  | Trans (tv,x)         -> ()
+  | Info _ -> ()
+  | UserDefined(s) -> ()
+  | Work (p,_) -> genActualDispose p
+  | InOut p -> genActualDispose p
+  | Out p -> genActualDispose p
+  | In p   -> genActualDispose p
+  
+let genResult arg = 
+  match arg with
+  | Out (Matrix (a,m,n)) -> Some (sprintf "%s" a)
+  | Out (Vector (v,m))   -> Some (sprintf "%s" v)
+  | Out (Array (a,_))    -> Some (sprintf "%s" a)
+  | Out (Array2 (a,_,_)) -> Some (sprintf "%s" a)
+  | Out (HW(a,_))        -> Some (sprintf "arg_%s" a)
+  | InOut (Matrix (a,m,n)) -> Some (sprintf "%s" a)
+  | InOut (Vector (v,m))   -> Some (sprintf "%s" v)
+  | InOut (Array (a,_))    -> Some (sprintf "%s" a)
+  | InOut (Array2 (a,_,_)) -> Some (sprintf "%s" a)
+  | Out _ -> assert false
+  | InOut _ -> assert false
+  | _ -> None
+
+let genFunction (f,spec) moduleName= 
+  printf "\n";
+  let args = List.choose genFormal spec
+  printf " member this.%s(%s) = \n" f (String.Join(",",Array.ofList args))
+  
+  printf "  // input copies\n";
+  List.iter genInputCopies spec
+  
+  printf "  // dimensions\n";
+  let knownDims = new System.Collections.Generic.Dictionary<_,_>()
+  List.iter (genDimension f knownDims) spec;
+  printf "  // allocate results\n";
+  List.iter genAllocResult spec;
+  printf "  // transpose\n";
+  List.iter (genTransposeFixup (preFixups spec)) spec
+  printf "  // setup actuals\n";
+  List.iter genActualDef spec;
+  
+   // work call if work exist
+  genWorkWorkaround f spec moduleName
+  /////////////////
+  printf "  // call function\n"
+  printf "  try\n";
+  printf "    %s.%s(%s)\n" moduleName f (String.Join(",", Array.ofList (List.map genActualArg spec)));
+  printf "  finally\n";
+  List.iter genActualDispose spec;
+
+  printf "  // INFO\n"
+  genInfo f spec
+  
+  printf "  // fixups\n";
+  List.iter (genTransposeFixup (postFixups spec)) spec   
+  printf "  // result tuple\n";
+  printf "  %s\n" (String.Join(",", Array.ofList (List.choose genResult spec)));
+  printf "\n";
+
+
+//----------------------------------------------------------------------------
+//! specifications
+//----------------------------------------------------------------------------
+    
+let sl = "Lapack"
+let sb = "Blas"
+
+let fspec_dgemm =
+  "Matrix-Matrix Multiplication", sb, "dgemm_",
+  [Trans ("transa",Some "a");Trans ("transb",Some "b");Dim "m";Dim "n";Dim "k";
+   HW ("alpha","1.0");In (Matrix("a","m","k"));HW ("ldk","k");In (Matrix("b","k","n"));
+   HW ("ldn","n");HW ("beta","1.0");Out (Matrix("c","m","n"));HW ("ldm","m")]
+
+let fspec_dgesv =
+  "Solve", sl ,"dgesv_" ,
+  [Dim "n"; Dim "NRHS"; InOut (Matrix("a","n","n")); HW("lda","max 1 n");Out (Array("ipiv", "n")); 
+   InOut (Matrix("b", "n", "NRHS")); HW("ldb","max 1 n"); Info "info"  ]       
+
+let fspec_dtrsv =
+  "Solve dtrsv", sb ,"dtrsv_" ,
+  [In (UserDefined("uplo")); 
+   Trans ("transa",Some "a");
+   HW ("diag","'N'");
+   Dim "n";
+   In (Matrix("a","n","n")); HW("lda","max 1 n");   
+   InOut (Vector("x", "n")); HW("incx","1"); ]       
+
+let fspec_dtrsm =
+  "Solve dtrsm", sb ,"dtrsm_" ,
+  [HW ("side","'L'");
+   In (UserDefined("uplo")); 
+   Trans ("transa",Some "a");
+   HW ("diag","'N'");
+   Dim "m";
+   Dim "n";
+   HW ("alpha","1.0");   
+   In    (Matrix("a","m","k")); HW("lda","m"); // assumes side=L
+   InOut (Matrix("b","m","n")); HW("ldb","m"); // assumes side=L
+  ]       
+
+// work is problematic with lapack, intel's OK
+let fspec_dgglse =
+  "Solve LSE using GRQ", sl, "dgglse_",
+  [Dim "m"; Dim "n"; Dim "p"; InOut (Matrix("a","m","n")); HW("lda","max 1 m"); In (Matrix("b","p","n"));
+   HW("ldb","max 1 p"); InOut (Vector("c","m")); In(Vector("d","p")); Out (Array("x","n"));
+   Work (Array("work","1"),"f"); Work (HW("lwork","-1"),"i"); Info "info" ]
+             
+let fspec_dgeev =
+  "EigenValue Non-Symetrix" , sl , "dgeev_",
+  [HW("jobvl","'N'");In(UserDefined("jobvr")); //In (HW("jobvl"));In (UserDefined("jobvr"))  ;
+   Dim "n";  In (Matrix("a","n","n")) ;     HW("lda","n"); 
+   Out (Array("wr","n"));Out (Array ("wi","n"));
+   Array2("vl","n","n");    (HW("ldvl","n")); 
+   Out (Array2("vr","n","n"));   (HW("ldvr","n")); 
+   Array("work","(4*n)"); HW("lwork","(4*n)");
+   Info("info")]
+                            
+let fspec_dposv =
+  "Solve Cholesky", sl,  "dposv_",
+  [HW("uplo","'U'"); Dim "n"; Dim "nrhs"; InOut (Matrix("a","n","n")); HW("lda","max 1 n"); InOut(Matrix("b","n","nrhs"));
+   HW("ldb","max 1 n");Info "info" ]     
+                        
+let fspec_dgels =
+  "Solve Upper" , sl, "dgels_",
+  [Trans ("transa",None) ; Dim "m"; Dim "n"; Dim "nrhs";
+   InOut  (Matrix("a","m","n"));               HW("lda","max 1 m") ;InOut  (Matrix ("b","(max m n)", "nrhs"));
+   HW("ldb","max m (max 1 n)") ; Work (Array("work","1"),"f"); Work (HW("lwork","-1"),"i");Info("info")]
+   
+       
+let fspec_dsyev =
+  "Eigen Value of Symetric Matrix",sl, "dsyev_",
+  [In (UserDefined("jobz")); In (UserDefined("uplo")); Dim "n"; InOut (Matrix("a","n","n")); HW("lda","max 1 n");
+   Out (Array("w","n")); Work (Array("work","1"),"f"); Work (HW("lwork", "-1"),"i"); Info ("info")]
+
+let fspec_dsyevd =
+  "Eigen Value of Symetric Matrix - Divide and Conquer",sl, "dsyevd_",
+  [In (UserDefined("jobz")); In (UserDefined("uplo")); Dim "n"; InOut (Matrix("a","n","n")); HW("lda","max 1 n");
+   Out (Array("w","n")); Work (Array("work","1"),"f");    Work (HW("lwork", "-1"),"i");
+   Work (Array("iwork","1"),"i"); Work (HW("liwork", "-1"),"i");Info ("info") ]
+
+let fspec_dgesvd =
+  "Singular Value Decomposition", sl,"dgesvd_",
+  [HW("jobu","'A'"); HW("jobvt","'A'"); Dim "m"; Dim "n";
+   In (Matrix ("a","m","n")); HW("lda","max 1 m");
+   Out (Array("s","min m n"));
+   Out (Matrix("u","m","min m n"));  HW("ldu","m"); 
+   Out (Matrix("vt","n","n"));       HW("ldvt","n");
+   Work (Array("work","1"),"f"); 
+   Work (HW("lwork", "-1"),"i");
+   Info ("info") ]
+
+let fspec_dgesdd =
+  "Singular Value Decomposition Divide- Conquer", sl, "dgesdd_",
+  [HW("JOBZ","'A'");  Dim "m"; Dim "n"; 
+   In (Matrix ("a","m","n")); HW("lda","max 1 m");
+   Out (Array("s","min m n"));
+   Out (Matrix("u" ,"m","m")); HW("ldu" ,"m");
+   Out (Matrix("vt","n","n")); HW("ldvt","n");
+   Work (Array("work","1"),"f");
+   Work (HW("lwork", "-1"),"i");
+   Array("iwork","8*(min m n)");  
+   Info ("info") ]
+
+let fspec_dsygv_ =
+  "Single Value Decomposition for Symetric Matrices", sl, "dsygv_",
+  [HW("itype","1");HW("JOBZ","'V'");HW("uplo","'U'");Dim "n"; InOut (Matrix ("a","n","n"));HW("lda","max 1 n");InOut (Matrix ("b","n","n"));
+   HW("ldb","max 1 n"); Out(Array("w","n")); Work (Array("work","1"),"f"); Work (HW("lwork", "-1"),"i");Info ("info") ]
+ 
+let fspec_dsygvd_ =
+  "Single Value Decomposition for Symetric Matrices Divide and Conquer", sl,"dsygvd_",
+  [HW("itype","1");HW("JOBZ","'V'");HW("uplo","'U'");Dim "n"; InOut (Matrix ("a","n","n"));HW("lda","max 1 n");InOut (Matrix ("b","n","n"));
+   HW("ldb","max 1 n"); Out(Array("w","n")); Work (Array("work","1"),"f"); Work (HW("lwork", "-1"),"i"); Work (Array("iwork","1"),"i"); Work (HW("liwork", "-1"),"i");Info ("info") ]
+ 
+let fspec_dgesvx_ =
+  "LU factorization to compute the solution to a real  system of linear equations ", sl, "dgesvx_",
+  [HW("fact","'E'");Trans ("transx",None);Dim "n";Dim "nrhs";InOut (Matrix ("a","n","n"));HW("lda","max 1 n");
+   Out (Matrix("af","n","n"));HW("ldaf","max 1 n");Out (Array("ipiv", "n")); Out (HW("equed","'n'")); Out (Array("r","n"));
+   Out (Array("c","n")); InOut (Matrix ("b","n","nrhs"));HW("ldb","max 1 n"); Out( Matrix("x","n","nrhs")); HW("ldx","max 1 n"); 
+   Out (HW("rcond","0.0")); Out (Array("ferr","nrhs")); Out (Array("berr","nrhs")); Array ("work", "4*n"); Array("iwork","n");Info ("info")]
+
+let fspec_dposvx_ =
+  "Cholesky Factorisation - Expert", sl , "dposvx_",
+  [HW("fact","'E'"); HW("uplo","'U'");Dim "n";Dim "nrhs";InOut (Matrix ("a","n","n"));HW("lda","max 1 n"); 
+   Out (Matrix("af","n","n"));HW("ldaf","max 1 n");Out (HW("equed","'n'"));  Out (Array("s","n"));
+   InOut (Matrix ("b","n","nrhs"));HW("ldb","max 1 n"); Out( Matrix("x","n","nrhs")); HW("ldx","max 1 n"); 
+   Out (HW("rcond","0.0")); Out (Array("ferr","nrhs")); Out (Array("berr","nrhs")); Array ("work", "3*n"); Array("iwork","n");Info ("info")]
+
+let fspec_dpotrf =
+  "Cholesky factorisation of a real symmetric positive definite matrix" , sl, "dpotrf_",
+  [In(UserDefined("uplo")); Dim "n"; InOut (Matrix("a", "n","n")); HW ("lda", "max 1 n"); Info ("info")]                                            
+
+let fspec_dgetrf =
+  "LU factorisation of general matrix using partial pivoting and row interchanges" , sl, "dgetrf_",
+  [ Dim "m"; Dim "n"; InOut (Matrix("a", "m","n")); HW ("lda", "max 1 m"); Out (Array("ipiv","min m n")); Info ("info")]                                            
+
+let fspec_dgeqrf_=
+  "QR Factorisation", sl, "dgeqrf_",
+  [ Dim "m"; Dim "n" ;InOut (Matrix ("a", "m","n")) ;HW ("lda", "max 1 m");Out (Array("tau", "min m n"));
+    Work (Array("work","1"),"f"); Work (HW("lwork", "-1"),"i"); Info ("info")]
+
+/// Do not use trans argument here.           
+let fspec_dgemv_ =
+  "Matrix Vector Multiplication", sb,"dgemv_" ,
+  [Trans("trans",None);Dim "m";Dim "n";HW ("alpha","1.0");In (Matrix("a", "m","n"));HW("lda","max 1 m");
+   In (Vector("x", "n"));
+   HW("incx","1"); HW ("beta","1.0"); Out (Vector("y", "m")); HW("incx","1")] 
+
+// dggev_( char *jobvl, char *jobvr, int *n, double *a, int *lda, double *b, int *ldb, 
+//double *alphar, double *alphai,double *beta,double *vl,int *ldvl,double *vr,int *ldvr,double *work, int *lwork,int *info);                            
+let fspec_dggev =
+  "EigenValues and Eigen Vectors for nonsymetruc matrices", sl, "dggev_", 
+  [HW("jobvl","'N'"); HW("jobvr", "'V'");  Dim "n" ;InOut (Matrix ("a", "n","n")); HW ("lda", "max 1 n");InOut (Matrix ("b", "n","n"));
+   HW ("ldb", "max 1 n"); Out (Array("alphar","n"));Out (Array("alphai","n")); Out (Array("beta","n"));
+   Array2("vl","n","n");    (HW("ldvl","n")); 
+   Out (Array2("vr","n","n"));   (HW("ldvr","n")); 
+   Array("work","(8*n)"); HW("lwork","(8*n)");
+   Info("info")]
+
+
+//----------------------------------------------------------------------------
+//! specifications list
+//----------------------------------------------------------------------------
+
+let fspecs = [fspec_dgemm;
+              fspec_dgesv;
+              fspec_dtrsv;
+              fspec_dtrsm;
+              fspec_dgglse;
+              fspec_dgeev;
+              fspec_dposv;
+              fspec_dgels;
+              fspec_dsyev;
+              fspec_dsyevd;
+              fspec_dgesvd;
+              fspec_dgesdd;
+              fspec_dsygv_;
+              fspec_dsygvd_;
+              fspec_dgesvx_;
+              fspec_dposvx_;
+              fspec_dpotrf;
+              fspec_dgetrf;
+              fspec_dgeqrf_;
+              fspec_dgemv_;
+              fspec_dggev;
+             ]
+
+
+//----------------------------------------------------------------------------
+//! generate netlib and MKL bindings
+//----------------------------------------------------------------------------
+
+let produceCode moduleName (comments,(library),funcName,spec) = 
+    printf "\n///%s" comments
+    genFunction (funcName,spec) moduleName
+    
+    
+let generateFile filename providerId blasDLLName lapackDLLName hyphen notices =  
+    let hyphenS = "[_]"
+    let hyphenReplace = if hyphen then "_" else ""
+    let quoted s = "\"" ^ s ^ "\""
+
+    let className  = sprintf "Lapack%sService" providerId
+    let moduleName = sprintf "Lapack%sStubs"   providerId
+    
+    let blasdllX    = "[BLASDLL]"
+    let lapackdllX  = "[LAPACKDLL]"
+    let moduleNameX = "[MODULENAME]"
+    let noticeX     = "[NOTICE]"
+
+    let notice = String.Join("\n", Array.ofList (List.map (fun s -> "/// " ^ s) notices))
+    
+    start (filename)
+    printfn "namespace Microsoft.FSharp.Math.Bindings.Internals"
+    printfn "#nowarn \"51\""
+    printfn "open Microsoft.FSharp.Math"
+    printfn "open Microsoft.FSharp.Math.Bindings.Internals"
+    
+    let templateFile = File.ReadAllText("lapack_service_template.fs")
+    printf "%s" (templateFile.Replace(blasdllX,blasDLLName)
+                             .Replace(lapackdllX,lapackDLLName)
+                             .Replace(moduleNameX,moduleName)
+                             .Replace(hyphenS,hyphenReplace)
+                             .Replace(noticeX,notice)
+                )
+    printfn "/// Internal provider of Lapack functionality, not for direct user usage."
+    printfn "type %s() = class" className
+    printfn " interface ILapack with "
+    List.iter (produceCode moduleName) fspecs
+    printfn " end"
+    printfn "end"
+    printfn "module Lapack%s = begin" providerId
+    printfn " let %sProvider = new Microsoft.FSharp.Math.Experimental.Provider<_>(%s,[|%s;%s|],fun () -> new %s() :> ILapack)"
+      providerId
+      (quoted providerId)
+      (quoted blasDLLName) (quoted lapackDLLName)
+      className
+    printfn "end"
+    stop()
+    start (filename ^ "i") 
+    printfn "namespace Microsoft.FSharp.Math.Bindings.Internals"       
+    printfn "module Lapack%s =" providerId
+    printfn "  val %sProvider : Microsoft.FSharp.Math.Experimental.Provider<Microsoft.FSharp.Math.Bindings.Internals.ILapack>" providerId
+    printfn "module %s = begin end" moduleName    
+    stop()
+
+let noticesMLK = ["Warning:";
+                  "IMPORTANT WARNING NOTICE:";
+                  "INTEL MATH KERNEL LIBRARY 9.1 FOR WINDOWS DOES NOT BELONG TO MICROSOFT - IT IS THIRD PARTY TECHNOLOGY.";
+                  "IT IS CLEARED ONLY FOR USE BY A SPECIFIC MSR RESEARCH TEAM.";
+                  "DO NOT USE IT UNTIL YOU HAVE CLEARED ITS USE FOR YOUR PROJECT WITH YOUR LEGAL CONTACT.";
+                  "";
+                  "The following stubs bind directly to Intel MKL functionality.";
+                  "You should not use them without:";
+                  "a) Intel MKL developer licenses.";
+                  "b) Seeking local legal approval.";
+                 ]    
+
+do
+  let filename   = "lapack_service_netlib.fs"
+  let providerId = "Netlib"
+  let blasdll    = "blas.dll"
+  let lapackdll  = "lapack.dll"
+  let typeHyphen = true  // true = underscore suffix 
+  let notices    = ["Notice: This file generates bindings for netlib.org BLAS/LAPACK DLLs"] 
+  generateFile filename providerId blasdll lapackdll typeHyphen notices
+
+do
+  let filename   = "lapack_service_mkl.fs"
+  let providerId = "MKL"
+  let blasdll    = "mkl_def.dll"
+  let lapackdll  = "mkl_lapack.dll"
+  let typeHyphen = false // false = no underscore suffix
+  let notices    = noticesMLK
+  generateFile filename providerId blasdll lapackdll typeHyphen notices
+
+
+(* scratch *)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.fsharpp b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.fsharpp
new file mode 100644
index 0000000..6ee8301
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.fsharpp
@@ -0,0 +1,92 @@
+"General"
+{
+"ProjectIdGuid" = "{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}"
+}
+"Configurations"
+{
+    "Debug|Win32"
+    {
+    "ProjectType" = "DLL"
+    "OptLevel" = "3"
+    "StrongNamingLevel" = "None"
+    "OutputPath" = ""
+    "SearchPath" = ""
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "TRUE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = ""
+    }
+    "Release|Win32"
+    {
+    "ProjectType" = "EXE"
+    "OptLevel" = "3"
+    "StrongNamingLevel" = "None"
+    "OutputPath" = ""
+    "SearchPath" = ""
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "FALSE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = ""
+    }
+}
+"Files"
+{
+    "service.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "service.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lapack_base.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lapack_service.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lapack_service_mkl.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lapack_service_netlib.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "linear_algebra_service.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "linear_algebra_managed.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "linear_algebra.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "linear_algebra.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+}
+"ProjStartupServices"
+{
+}
+"Globals"
+{
+}
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.sln b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.sln
new file mode 100644
index 0000000..7e8abee
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/la.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{94D665CA-D915-4DE1-AA53-913450A1AE2D}") = "la", "la.fsharpp", "{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}.Debug|Win32.Build.0 = Debug|Win32
+		{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}.Release|Win32.ActiveCfg = Release|Win32
+		{B21DA0EE-6F5A-47E5-BDD9-86CA13B1D3AF}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_base.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_base.fs
new file mode 100644
index 0000000..debfcac
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_base.fs
@@ -0,0 +1,131 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Bindings.Internals
+#nowarn "51"
+
+open System
+open System.Runtime.InteropServices
+open Microsoft.FSharp.NativeInterop
+open Microsoft.FSharp.Math
+
+///This is an internal interface and not for user usage.
+///It exposes a specialised subset of BLAS/LAPACK functionality.
+///This functionality is used by us to build the exposed APIs.
+///It is those exposed APIs that should be used.
+type ILapack = interface
+    //Matrix-Matrix Multiplication
+    abstract dgemm_ : Math.matrix * Math.matrix -> Math.matrix
+
+    //Matrix-Vector Multiplication
+    abstract dgemv_ : Math.matrix * Math.vector -> Math.vector
+
+    //Solve (linear equations)
+    abstract dgesv_ : Math.matrix * Math.matrix -> Math.matrix * int array * Math.matrix
+
+    //Solve symmetric positive definite matrix (linear equations)
+    abstract dposv_ : Math.matrix * Math.matrix -> Math.matrix * Math.matrix
+
+    //Solve triangular (linear equations)
+    abstract dtrsv_ : char * Math.matrix * Math.vector -> Math.vector
+
+    //Solve triangular (linear equations)
+    abstract dtrsm_ : char * Math.matrix * Math.matrix -> Math.matrix
+
+    //Solve (linear equations) using LU factorization
+    abstract dgesvx_ :
+      Math.matrix * Math.matrix ->
+      Math.matrix * Math.matrix * int array * char * double array * double array *
+      Math.matrix * Math.matrix * float * double array * double array
+
+    //Eigen Value Non-Symmetric
+    abstract dgeev_ : char * Math.matrix -> double array * double array * double [,]    
+
+    //Eigen Value of Symmetric Matrix
+    abstract dsyev_ : char * char * Math.matrix -> Math.matrix * double array
+
+    //Eigen Value of Symmetric Matrix - Divide and Conquer
+    abstract dsyevd_ : char * char * Math.matrix -> Math.matrix * double array
+
+    //Eigen Value for a pair of general matrices
+    abstract dggev_ :
+      Math.matrix * Math.matrix ->
+      Math.matrix * Math.matrix * double array * double array * double array *
+      double [,]
+
+    //Solve least-squares/min-norm.
+    //Note the dimension requirements on second input to match second output.
+    abstract dgels_ : Math.matrix * Math.matrix -> Math.matrix * Math.matrix
+
+    //Solve least-squares/min-norm (with linear equality constraint)
+    abstract dgglse_ :
+      Math.matrix * Math.matrix * Math.vector * Math.vector ->
+      Math.matrix * Math.vector * double array
+
+    //Singular Value Decomposition
+    abstract dgesvd_ :
+      Math.matrix -> double array * Math.matrix * Math.matrix
+
+    //Singular Value Decomposition Divide- Conquer
+    abstract dgesdd_ : Math.matrix -> double array * Math.matrix * Math.matrix
+
+    //Single Value Decomposition for Symmetric Matrices
+    abstract dsygv_ :
+      Math.matrix * Math.matrix -> Math.matrix * Math.matrix * double array
+
+    //Single Value Decomposition for Symetric Matrices Divide and Conquer
+    abstract dsygvd_ :
+      Math.matrix * Math.matrix -> Math.matrix * Math.matrix * double array
+
+    //Cholesky Factorisation
+    abstract dpotrf_ : char * Math.matrix -> Math.matrix
+    
+    abstract dgetrf_ : matrix -> matrix * int[]
+
+    //Cholesky Factorisation - Expert
+    abstract dposvx_ :
+      Math.matrix * Math.matrix ->
+      Math.matrix * Math.matrix * char * double array * Math.matrix * Math.matrix *
+      float * double array * double array
+
+    //QR Factorisation
+    abstract dgeqrf_ : Math.matrix -> Math.matrix * double array
+
+end
+
+
+module NativeUtilities = begin
+    let nativeArray_as_CMatrix_colvec (arr: 'T NativeArray) = new CMatrix<_>(arr.Ptr,arr.Length,1)
+    let nativeArray_as_FortranMatrix_colvec (arr: 'T NativeArray) = new FortranMatrix<_>(arr.Ptr,arr.Length,1)
+    let pinM m = PinnedArray2.of_matrix(m)
+    let pinV v = PinnedArray.of_vector(v)
+    let pinA arr = PinnedArray.of_array(arr)
+    
+    let pinA2 arr = PinnedArray2.of_array2D(arr)
+    
+    let pinMV m1 v2 = pinM m1,pinV v2
+    let pinVV v1 v2 = pinV v1,pinV v2
+    let pinAA v1 v2 = pinA v1,pinA v2
+    let pinMVV m1 v2 m3 = pinM m1,pinV v2,pinV m3
+    let pinMM m1 m2  = pinM m1,pinM m2
+    let pinMMM m1 m2 m3 = pinM m1,pinM m2,pinM m3
+    let freeM (pA: PinnedArray2<'T>) = pA.Free()
+    let freeV (pA: PinnedArray<'T>) = pA.Free()
+    let freeA (pA: PinnedArray<'T>) = pA.Free()
+    
+    let freeA2 a = freeM a
+    
+    let freeMV (pA: PinnedArray2<'T>,pB : PinnedArray<'T>) = pA.Free(); pB.Free()
+    let freeVV (pA: PinnedArray<'T>,pB : PinnedArray<'T>) = pA.Free(); pB.Free()
+    let freeAA (pA: PinnedArray<'T>,pB : PinnedArray<'T>) = pA.Free(); pB.Free()
+    let freeMM (pA: PinnedArray2<'T>,(pB: PinnedArray2<'T>)) = pA.Free();pB.Free()
+    let freeMMM (pA: PinnedArray2<'T>,(pB: PinnedArray2<'T>),(pC: PinnedArray2<'T>)) = pA.Free();pB.Free();pC.Free()
+    let freeMVV (pA: PinnedArray2<'T>,(pB: PinnedArray<'T>),(pC: PinnedArray<'T>)) = pA.Free();pB.Free();pC.Free()
+    
+    let matrixDims (m:Matrix<_>) = m.NumRows, m.NumCols
+    let matrixDim1 (m:Matrix<_>) = m.NumRows
+    let matrixDim2 (m:Matrix<_>) = m.NumCols
+    let vectorDim  (v:Vector<_>) = v.Length
+    
+    let assertDimensions functionName (aName,bName) (a,b) =
+      if a=b then () else
+      failwith (sprintf "Require %s = %s, but %s = %d and %s = %d in %s" aName bName aName a bName b functionName)
+end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service.fs
new file mode 100644
index 0000000..4eed4e1
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service.fs
@@ -0,0 +1,5 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Experimental
+// Code abstracted and moved to service.fs.
+// This file will either be removed, or ILapack move here, splitting up from native utilities.
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fs
new file mode 100644
index 0000000..abdaad4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fs
@@ -0,0 +1,1354 @@
+namespace Microsoft.FSharp.Math.Bindings.Internals
+#nowarn "51"
+open Microsoft.FSharp.Math
+open Microsoft.FSharp.Math.Bindings.Internals
+/// Warning:
+/// IMPORTANT WARNING NOTICE:
+/// INTEL MATH KERNEL LIBRARY 9.1 FOR WINDOWS DOES NOT BELONG TO MICROSOFT - IT IS THIRD PARTY TECHNOLOGY.
+/// IT IS CLEARED ONLY FOR USE BY A SPECIFIC MSR RESEARCH TEAM.
+/// DO NOT USE IT UNTIL YOU HAVE CLEARED ITS USE FOR YOUR PROJECT WITH YOUR LEGAL CONTACT.
+/// 
+/// The following stubs bind directly to Intel MKL functionality.
+/// You should not use them without:
+/// a) Intel MKL developer licenses.
+/// b) Seeking local legal approval.
+module LapackMKLStubs = begin
+  [<System.Runtime.InteropServices.DllImport(@"mkl_def.dll",EntryPoint="dgemm")>]
+  extern void dgemm_(char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc);
+
+  [<System.Runtime.InteropServices.DllImport(@"mkl_def.dll",EntryPoint="dtrsv")>]
+  extern void dtrsv_(char *uplo,char *trans,char *diag,int *n,double *a,int *lda,double *x,int *incx);
+
+  [<System.Runtime.InteropServices.DllImport(@"mkl_def.dll",EntryPoint="dtrsm")>]
+  extern void dtrsm_(char *side,char *uplo,char *trans,char *diag,int *m,int *n,double *alpha,double *a,int *lda,double *b,int *ldb);   
+   
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgesv")>]
+  extern void dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgeev")>]
+  extern void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info);
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dposv")>]
+  extern void dposv_(char *uplo, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgels")>]
+  extern void dgels_(char *trans, int *m,int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgglse")>]
+  extern void dgglse_(int *m, int *n, int *p, double *a, int *lda, double *b, int *ldb, double *c, double *d, double *x, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dsyev")>]
+  extern void dsyev_(char *jobz, char *uplo, int *n, double *a,int *lda, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dsyevd")>]
+  extern void dsyevd_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgesvd")>]
+  extern void dgesvd_(char *jobu, char *jobvt, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgesdd")>]
+  extern void dgesdd_(char *JOBZ, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork,int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dsygv")>]
+  extern void dsygv_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dsygvd")>]     
+  extern void dsygvd_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork,int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dggev")>]     
+  extern void dggev_( char *jobvl, char *jobvr, int *n, double *a, int *lda, double *b, int *ldb, double *alphar, double *alphai,double *beta,double *vl,int *ldvl,double *vr,int *ldvr,double *work, int *lwork,int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgesvx")>]     
+  extern void dgesvx_(char *fact, char *trans, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, int *ipiv, char *equed, double *r, double *c, double *b, int *ldb, double *x, int *ldx, double *rcond, double *ferr, double *berr, double *work, int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dposvx")>]     
+  extern void  dposvx_(char *fact, char *uplo, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, char *equed, double *s, double *b, int *ldb, double *x, int *ldx, double *rcond, double  *ferr, double *berr, double *work, int *iwork, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dpotrf")>]     
+  extern void  dpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgetrf")>]     
+  extern void  dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_lapack.dll",EntryPoint="dgeqrf")>]     
+  extern void dgeqrf_(int  *m, int *n, double *a, int *lda, double *tau, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"mkl_def.dll",EntryPoint="dgemv")>]
+  extern void dgemv_(char* trans, int* m, int* n,double* alpha, double* A, int* lda,double* x, int* incx, double* beta,double* y, int* incy);
+  
+end
+/// Internal provider of Lapack functionality, not for direct user usage.
+type LapackMKLService() = class
+ interface ILapack with 
+///Matrix-Matrix Multiplication
+ member this.dgemm_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let k = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgemm_" ("k","Dim1(b)") (k,NativeUtilities.matrixDim1 b);
+  let n = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let c = Matrix.zero (m) (n)
+  // transpose
+  let c = Matrix.transpose c
+  // setup actuals
+  let mutable arg_transa = 't'
+  let mutable arg_transb = 't'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_k = k
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_ldk = k
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldn = n
+  let mutable arg_beta = 1.0
+  let arg_c = NativeUtilities.pinM c
+  let mutable arg_ldm = m
+  // call function
+  try
+    LapackMKLStubs.dgemm_(&&arg_transa,&&arg_transb,&&arg_m,&&arg_n,&&arg_k,&&arg_alpha,arg_a.Ptr,&&arg_ldk,arg_b.Ptr,&&arg_ldn,&&arg_beta,arg_c.Ptr,&&arg_ldm)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_c
+  // INFO
+  // fixups
+  let c = Matrix.transpose c
+  // result tuple
+  c
+
+
+///Solve
+ member this.dgesv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgesv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dgesv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let NRHS = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let ipiv = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_n = n
+  let mutable arg_NRHS = NRHS
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dgesv_(&&arg_n,&&arg_NRHS,arg_a.Ptr,&&arg_lda,arg_ipiv.Ptr,arg_b.Ptr,&&arg_ldb,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_ipiv
+    NativeUtilities.freeM arg_b
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesv_: n (argument 1)"
+   | -2  -> invalid_arg "dgesv_: NRHS (argument 2)"
+   | -3  -> invalid_arg "dgesv_: a (argument 3)"
+   | -4  -> invalid_arg "dgesv_: lda (argument 4)"
+   | -5  -> invalid_arg "dgesv_: ipiv (argument 5)"
+   | -6  -> invalid_arg "dgesv_: b (argument 6)"
+   | -7  -> invalid_arg "dgesv_: ldb (argument 7)"
+   | -8  -> invalid_arg "dgesv_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,ipiv,b
+
+
+///Solve dtrsv
+ member this.dtrsv_((uplo),(a:matrix),(x:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let x = Vector.copy x
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dtrsv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dtrsv_" ("n","Dim(x)") (n,NativeUtilities.vectorDim  x);
+  // allocate results
+  // transpose
+  // setup actuals
+  let mutable arg_uplo = uplo
+  let mutable arg_transa = 't'
+  let mutable arg_diag = 'N'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_x = NativeUtilities.pinV x
+  let mutable arg_incx = 1
+  // call function
+  try
+    LapackMKLStubs.dtrsv_(&&arg_uplo,&&arg_transa,&&arg_diag,&&arg_n,arg_a.Ptr,&&arg_lda,arg_x.Ptr,&&arg_incx)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeV arg_x
+  // INFO
+  // fixups
+  // result tuple
+  x
+
+
+///Solve dtrsm
+ member this.dtrsm_((uplo),(a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let k = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dtrsm_" ("m","Dim1(b)") (m,NativeUtilities.matrixDim1 b);
+  let n = NativeUtilities.matrixDim2 b in
+  // allocate results
+  // transpose
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_side = 'L'
+  let mutable arg_uplo = uplo
+  let mutable arg_transa = 't'
+  let mutable arg_diag = 'N'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = m
+  // call function
+  try
+    LapackMKLStubs.dtrsm_(&&arg_side,&&arg_uplo,&&arg_transa,&&arg_diag,&&arg_m,&&arg_n,&&arg_alpha,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+  // INFO
+  // fixups
+  let b = Matrix.transpose b
+  // result tuple
+  b
+
+
+///Solve LSE using GRQ
+ member this.dgglse_((a:matrix),(b:matrix),(c:vector),(d:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  let c = Vector.copy c
+  let d = Vector.copy d
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  let p = NativeUtilities.matrixDim1 b in
+  NativeUtilities.assertDimensions "dgglse_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  NativeUtilities.assertDimensions "dgglse_" ("m","Dim(c)") (m,NativeUtilities.vectorDim  c);
+  NativeUtilities.assertDimensions "dgglse_" ("p","Dim(d)") (p,NativeUtilities.vectorDim  d);
+  // allocate results
+  let x = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_p = p
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 p
+  let arg_c = NativeUtilities.pinV c
+  let arg_d = NativeUtilities.pinV d
+  let arg_x = NativeUtilities.pinA x
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dgglse_(&&arg_m,&&arg_n,&&arg_p,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_c.Ptr,arg_d.Ptr,arg_x.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-12) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dgglse_(&&arg_m,&&arg_n,&&arg_p,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_c.Ptr,arg_d.Ptr,arg_x.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeV arg_c
+    NativeUtilities.freeV arg_d
+    NativeUtilities.freeA arg_x
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgglse_: m (argument 1)"
+   | -2  -> invalid_arg "dgglse_: n (argument 2)"
+   | -3  -> invalid_arg "dgglse_: p (argument 3)"
+   | -4  -> invalid_arg "dgglse_: a (argument 4)"
+   | -5  -> invalid_arg "dgglse_: lda (argument 5)"
+   | -6  -> invalid_arg "dgglse_: b (argument 6)"
+   | -7  -> invalid_arg "dgglse_: ldb (argument 7)"
+   | -8  -> invalid_arg "dgglse_: c (argument 8)"
+   | -9  -> invalid_arg "dgglse_: d (argument 9)"
+   | -10 -> invalid_arg "dgglse_: x (argument 10)"
+   | -11 -> invalid_arg "dgglse_: work (argument 11)"
+   | -12 -> invalid_arg "dgglse_: lwork (argument 12)"
+   | -13 -> invalid_arg "dgglse_: info (argument 13)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgglse_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,c,x
+
+
+///EigenValue Non-Symetrix
+ member this.dgeev_((jobvr),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgeev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let wr = Array.zeroCreate  (n)
+  let wi = Array.zeroCreate  (n)
+  let vl = Array2D.zeroCreate (n) (n)
+  let vr = Array2D.zeroCreate (n) (n)
+  let work = Array.zeroCreate  ((4*n))
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobvl = 'N'
+  let mutable arg_jobvr = jobvr
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = n
+  let arg_wr = NativeUtilities.pinA wr
+  let arg_wi = NativeUtilities.pinA wi
+  let arg_vl = NativeUtilities.pinA2 vl
+  let mutable arg_ldvl = n
+  let arg_vr = NativeUtilities.pinA2 vr
+  let mutable arg_ldvr = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = (4*n)
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dgeev_(&&arg_jobvl,&&arg_jobvr,&&arg_n,arg_a.Ptr,&&arg_lda,arg_wr.Ptr,arg_wi.Ptr,arg_vl.Ptr,&&arg_ldvl,arg_vr.Ptr,&&arg_ldvr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_wr
+    NativeUtilities.freeA arg_wi
+    NativeUtilities.freeA2 arg_vl
+    NativeUtilities.freeA2 arg_vr
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgeev_: jobvl (argument 1)"
+   | -2  -> invalid_arg "dgeev_: jobvr (argument 2)"
+   | -3  -> invalid_arg "dgeev_: n (argument 3)"
+   | -4  -> invalid_arg "dgeev_: a (argument 4)"
+   | -5  -> invalid_arg "dgeev_: lda (argument 5)"
+   | -6  -> invalid_arg "dgeev_: wr (argument 6)"
+   | -7  -> invalid_arg "dgeev_: wi (argument 7)"
+   | -8  -> invalid_arg "dgeev_: vl (argument 8)"
+   | -9  -> invalid_arg "dgeev_: ldvl (argument 9)"
+   | -10 -> invalid_arg "dgeev_: vr (argument 10)"
+   | -11 -> invalid_arg "dgeev_: ldvr (argument 11)"
+   | -12 -> invalid_arg "dgeev_: work (argument 12)"
+   | -13 -> invalid_arg "dgeev_: lwork (argument 13)"
+   | -14 -> invalid_arg "dgeev_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgeev_ : returned %d. The computation failed." n)
+  // fixups
+  // result tuple
+  wr,wi,vr
+
+
+///Solve Cholesky
+ member this.dposv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dposv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dposv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dposv_(&&arg_uplo,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dposv_: uplo (argument 1)"
+   | -2  -> invalid_arg "dposv_: n (argument 2)"
+   | -3  -> invalid_arg "dposv_: nrhs (argument 3)"
+   | -4  -> invalid_arg "dposv_: a (argument 4)"
+   | -5  -> invalid_arg "dposv_: lda (argument 5)"
+   | -6  -> invalid_arg "dposv_: b (argument 6)"
+   | -7  -> invalid_arg "dposv_: ldb (argument 7)"
+   | -8  -> invalid_arg "dposv_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dposv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b
+
+
+///Solve Upper
+ member this.dgels_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgels_" ("(max m n)","Dim1(b)") ((max m n),NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_transa = 'n'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max m (max 1 n)
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dgels_(&&arg_transa,&&arg_m,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-10) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dgels_(&&arg_transa,&&arg_m,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgels_: transa (argument 1)"
+   | -2  -> invalid_arg "dgels_: m (argument 2)"
+   | -3  -> invalid_arg "dgels_: n (argument 3)"
+   | -4  -> invalid_arg "dgels_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dgels_: a (argument 5)"
+   | -6  -> invalid_arg "dgels_: lda (argument 6)"
+   | -7  -> invalid_arg "dgels_: b (argument 7)"
+   | -8  -> invalid_arg "dgels_: ldb (argument 8)"
+   | -9  -> invalid_arg "dgels_: work (argument 9)"
+   | -10 -> invalid_arg "dgels_: lwork (argument 10)"
+   | -11 -> invalid_arg "dgels_: info (argument 11)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgels_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b
+
+
+///Eigen Value of Symetric Matrix
+ member this.dsyev_((jobz),(uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsyev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobz = jobz
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dsyev_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-8) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dsyev_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsyev_: jobz (argument 1)"
+   | -2  -> invalid_arg "dsyev_: uplo (argument 2)"
+   | -3  -> invalid_arg "dsyev_: n (argument 3)"
+   | -4  -> invalid_arg "dsyev_: a (argument 4)"
+   | -5  -> invalid_arg "dsyev_: lda (argument 5)"
+   | -6  -> invalid_arg "dsyev_: w (argument 6)"
+   | -7  -> invalid_arg "dsyev_: work (argument 7)"
+   | -8  -> invalid_arg "dsyev_: lwork (argument 8)"
+   | -9  -> invalid_arg "dsyev_: info (argument 9)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsyev_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,w
+
+
+///Eigen Value of Symetric Matrix - Divide and Conquer
+ member this.dsyevd_((jobz),(uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsyevd_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobz = jobz
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_liwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dsyevd_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  if arg_info = 0   || arg_info=(-8)  || arg_info=(-10) then
+    arg_lwork <- int32 work.[0]
+    arg_liwork <-  iwork.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  let arg_iwork = NativeUtilities.pinA (Array.zeroCreate arg_liwork : int[])
+  // call function
+  try
+    LapackMKLStubs.dsyevd_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsyevd_: jobz (argument 1)"
+   | -2  -> invalid_arg "dsyevd_: uplo (argument 2)"
+   | -3  -> invalid_arg "dsyevd_: n (argument 3)"
+   | -4  -> invalid_arg "dsyevd_: a (argument 4)"
+   | -5  -> invalid_arg "dsyevd_: lda (argument 5)"
+   | -6  -> invalid_arg "dsyevd_: w (argument 6)"
+   | -7  -> invalid_arg "dsyevd_: work (argument 7)"
+   | -8  -> invalid_arg "dsyevd_: lwork (argument 8)"
+   | -9  -> invalid_arg "dsyevd_: iwork (argument 9)"
+   | -10 -> invalid_arg "dsyevd_: liwork (argument 10)"
+   | -11 -> invalid_arg "dsyevd_: info (argument 11)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsyevd_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,w
+
+
+///Singular Value Decomposition
+ member this.dgesvd_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let s = Array.zeroCreate  (min m n)
+  let u = Matrix.zero (m) (min m n)
+  let vt = Matrix.zero (n) (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // setup actuals
+  let mutable arg_jobu = 'A'
+  let mutable arg_jobvt = 'A'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_s = NativeUtilities.pinA s
+  let arg_u = NativeUtilities.pinM u
+  let mutable arg_ldu = m
+  let arg_vt = NativeUtilities.pinM vt
+  let mutable arg_ldvt = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dgesvd_(&&arg_jobu,&&arg_jobvt,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-13) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dgesvd_(&&arg_jobu,&&arg_jobvt,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_u
+    NativeUtilities.freeM arg_vt
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesvd_: jobu (argument 1)"
+   | -2  -> invalid_arg "dgesvd_: jobvt (argument 2)"
+   | -3  -> invalid_arg "dgesvd_: m (argument 3)"
+   | -4  -> invalid_arg "dgesvd_: n (argument 4)"
+   | -5  -> invalid_arg "dgesvd_: a (argument 5)"
+   | -6  -> invalid_arg "dgesvd_: lda (argument 6)"
+   | -7  -> invalid_arg "dgesvd_: s (argument 7)"
+   | -8  -> invalid_arg "dgesvd_: u (argument 8)"
+   | -9  -> invalid_arg "dgesvd_: ldu (argument 9)"
+   | -10 -> invalid_arg "dgesvd_: vt (argument 10)"
+   | -11 -> invalid_arg "dgesvd_: ldvt (argument 11)"
+   | -12 -> invalid_arg "dgesvd_: work (argument 12)"
+   | -13 -> invalid_arg "dgesvd_: lwork (argument 13)"
+   | -14 -> invalid_arg "dgesvd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesvd_ : returned %d. The computation failed." n)
+  // fixups
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // result tuple
+  s,u,vt
+
+
+///Singular Value Decomposition Divide- Conquer
+ member this.dgesdd_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let s = Array.zeroCreate  (min m n)
+  let u = Matrix.zero (m) (m)
+  let vt = Matrix.zero (n) (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (8*(min m n))
+  // transpose
+  let a = Matrix.transpose a
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // setup actuals
+  let mutable arg_JOBZ = 'A'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_s = NativeUtilities.pinA s
+  let arg_u = NativeUtilities.pinM u
+  let mutable arg_ldu = m
+  let arg_vt = NativeUtilities.pinM vt
+  let mutable arg_ldvt = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dgesdd_(&&arg_JOBZ,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-12) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dgesdd_(&&arg_JOBZ,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_u
+    NativeUtilities.freeM arg_vt
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesdd_: JOBZ (argument 1)"
+   | -2  -> invalid_arg "dgesdd_: m (argument 2)"
+   | -3  -> invalid_arg "dgesdd_: n (argument 3)"
+   | -4  -> invalid_arg "dgesdd_: a (argument 4)"
+   | -5  -> invalid_arg "dgesdd_: lda (argument 5)"
+   | -6  -> invalid_arg "dgesdd_: s (argument 6)"
+   | -7  -> invalid_arg "dgesdd_: u (argument 7)"
+   | -8  -> invalid_arg "dgesdd_: ldu (argument 8)"
+   | -9  -> invalid_arg "dgesdd_: vt (argument 9)"
+   | -10 -> invalid_arg "dgesdd_: ldvt (argument 10)"
+   | -11 -> invalid_arg "dgesdd_: work (argument 11)"
+   | -12 -> invalid_arg "dgesdd_: lwork (argument 12)"
+   | -13 -> invalid_arg "dgesdd_: iwork (argument 13)"
+   | -14 -> invalid_arg "dgesdd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesdd_ : returned %d. The computation failed." n)
+  // fixups
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // result tuple
+  s,u,vt
+
+
+///Single Value Decomposition for Symetric Matrices
+ member this.dsygv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_itype = 1
+  let mutable arg_JOBZ = 'V'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dsygv_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-11) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dsygv_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsygv_: itype (argument 1)"
+   | -2  -> invalid_arg "dsygv_: JOBZ (argument 2)"
+   | -3  -> invalid_arg "dsygv_: uplo (argument 3)"
+   | -4  -> invalid_arg "dsygv_: n (argument 4)"
+   | -5  -> invalid_arg "dsygv_: a (argument 5)"
+   | -6  -> invalid_arg "dsygv_: lda (argument 6)"
+   | -7  -> invalid_arg "dsygv_: b (argument 7)"
+   | -8  -> invalid_arg "dsygv_: ldb (argument 8)"
+   | -9  -> invalid_arg "dsygv_: w (argument 9)"
+   | -10 -> invalid_arg "dsygv_: work (argument 10)"
+   | -11 -> invalid_arg "dsygv_: lwork (argument 11)"
+   | -12 -> invalid_arg "dsygv_: info (argument 12)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsygv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,w
+
+
+///Single Value Decomposition for Symetric Matrices Divide and Conquer
+ member this.dsygvd_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_itype = 1
+  let mutable arg_JOBZ = 'V'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_liwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dsygvd_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  if arg_info = 0   || arg_info=(-11)  || arg_info=(-13) then
+    arg_lwork <- int32 work.[0]
+    arg_liwork <-  iwork.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  let arg_iwork = NativeUtilities.pinA (Array.zeroCreate arg_liwork : int[])
+  // call function
+  try
+    LapackMKLStubs.dsygvd_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsygvd_: itype (argument 1)"
+   | -2  -> invalid_arg "dsygvd_: JOBZ (argument 2)"
+   | -3  -> invalid_arg "dsygvd_: uplo (argument 3)"
+   | -4  -> invalid_arg "dsygvd_: n (argument 4)"
+   | -5  -> invalid_arg "dsygvd_: a (argument 5)"
+   | -6  -> invalid_arg "dsygvd_: lda (argument 6)"
+   | -7  -> invalid_arg "dsygvd_: b (argument 7)"
+   | -8  -> invalid_arg "dsygvd_: ldb (argument 8)"
+   | -9  -> invalid_arg "dsygvd_: w (argument 9)"
+   | -10 -> invalid_arg "dsygvd_: work (argument 10)"
+   | -11 -> invalid_arg "dsygvd_: lwork (argument 11)"
+   | -12 -> invalid_arg "dsygvd_: iwork (argument 12)"
+   | -13 -> invalid_arg "dsygvd_: liwork (argument 13)"
+   | -14 -> invalid_arg "dsygvd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsygvd_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,w
+
+
+///LU factorization to compute the solution to a real  system of linear equations 
+ member this.dgesvx_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgesvx_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dgesvx_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let af = Matrix.zero (n) (n)
+  let ipiv = Array.zeroCreate  (n)
+  let r = Array.zeroCreate  (n)
+  let c = Array.zeroCreate  (n)
+  let x = Matrix.zero (n) (nrhs)
+  let ferr = Array.zeroCreate  (nrhs)
+  let berr = Array.zeroCreate  (nrhs)
+  let work = Array.zeroCreate  (4*n)
+  let iwork = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // setup actuals
+  let mutable arg_fact = 'E'
+  let mutable arg_transx = 'n'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_af = NativeUtilities.pinM af
+  let mutable arg_ldaf = max 1 n
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let mutable arg_equed = 'n'
+  let arg_r = NativeUtilities.pinA r
+  let arg_c = NativeUtilities.pinA c
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_x = NativeUtilities.pinM x
+  let mutable arg_ldx = max 1 n
+  let mutable arg_rcond = 0.0
+  let arg_ferr = NativeUtilities.pinA ferr
+  let arg_berr = NativeUtilities.pinA berr
+  let arg_work = NativeUtilities.pinA work
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dgesvx_(&&arg_fact,&&arg_transx,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_af.Ptr,&&arg_ldaf,arg_ipiv.Ptr,&&arg_equed,arg_r.Ptr,arg_c.Ptr,arg_b.Ptr,&&arg_ldb,arg_x.Ptr,&&arg_ldx,&&arg_rcond,arg_ferr.Ptr,arg_berr.Ptr,arg_work.Ptr,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_af
+    NativeUtilities.freeA arg_ipiv
+    NativeUtilities.freeA arg_r
+    NativeUtilities.freeA arg_c
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_x
+    NativeUtilities.freeA arg_ferr
+    NativeUtilities.freeA arg_berr
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesvx_: fact (argument 1)"
+   | -2  -> invalid_arg "dgesvx_: transx (argument 2)"
+   | -3  -> invalid_arg "dgesvx_: n (argument 3)"
+   | -4  -> invalid_arg "dgesvx_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dgesvx_: a (argument 5)"
+   | -6  -> invalid_arg "dgesvx_: lda (argument 6)"
+   | -7  -> invalid_arg "dgesvx_: af (argument 7)"
+   | -8  -> invalid_arg "dgesvx_: ldaf (argument 8)"
+   | -9  -> invalid_arg "dgesvx_: ipiv (argument 9)"
+   | -10 -> invalid_arg "dgesvx_: equed (argument 10)"
+   | -11 -> invalid_arg "dgesvx_: r (argument 11)"
+   | -12 -> invalid_arg "dgesvx_: c (argument 12)"
+   | -13 -> invalid_arg "dgesvx_: b (argument 13)"
+   | -14 -> invalid_arg "dgesvx_: ldb (argument 14)"
+   | -15 -> invalid_arg "dgesvx_: x (argument 15)"
+   | -16 -> invalid_arg "dgesvx_: ldx (argument 16)"
+   | -17 -> invalid_arg "dgesvx_: rcond (argument 17)"
+   | -18 -> invalid_arg "dgesvx_: ferr (argument 18)"
+   | -19 -> invalid_arg "dgesvx_: berr (argument 19)"
+   | -20 -> invalid_arg "dgesvx_: work (argument 20)"
+   | -21 -> invalid_arg "dgesvx_: iwork (argument 21)"
+   | -22 -> invalid_arg "dgesvx_: info (argument 22)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesvx_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // result tuple
+  a,af,ipiv,arg_equed,r,c,b,x,arg_rcond,ferr,berr
+
+
+///Cholesky Factorisation - Expert
+ member this.dposvx_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dposvx_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dposvx_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let af = Matrix.zero (n) (n)
+  let s = Array.zeroCreate  (n)
+  let x = Matrix.zero (n) (nrhs)
+  let ferr = Array.zeroCreate  (nrhs)
+  let berr = Array.zeroCreate  (nrhs)
+  let work = Array.zeroCreate  (3*n)
+  let iwork = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // setup actuals
+  let mutable arg_fact = 'E'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_af = NativeUtilities.pinM af
+  let mutable arg_ldaf = max 1 n
+  let mutable arg_equed = 'n'
+  let arg_s = NativeUtilities.pinA s
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_x = NativeUtilities.pinM x
+  let mutable arg_ldx = max 1 n
+  let mutable arg_rcond = 0.0
+  let arg_ferr = NativeUtilities.pinA ferr
+  let arg_berr = NativeUtilities.pinA berr
+  let arg_work = NativeUtilities.pinA work
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dposvx_(&&arg_fact,&&arg_uplo,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_af.Ptr,&&arg_ldaf,&&arg_equed,arg_s.Ptr,arg_b.Ptr,&&arg_ldb,arg_x.Ptr,&&arg_ldx,&&arg_rcond,arg_ferr.Ptr,arg_berr.Ptr,arg_work.Ptr,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_af
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_x
+    NativeUtilities.freeA arg_ferr
+    NativeUtilities.freeA arg_berr
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dposvx_: fact (argument 1)"
+   | -2  -> invalid_arg "dposvx_: uplo (argument 2)"
+   | -3  -> invalid_arg "dposvx_: n (argument 3)"
+   | -4  -> invalid_arg "dposvx_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dposvx_: a (argument 5)"
+   | -6  -> invalid_arg "dposvx_: lda (argument 6)"
+   | -7  -> invalid_arg "dposvx_: af (argument 7)"
+   | -8  -> invalid_arg "dposvx_: ldaf (argument 8)"
+   | -9  -> invalid_arg "dposvx_: equed (argument 9)"
+   | -10 -> invalid_arg "dposvx_: s (argument 10)"
+   | -11 -> invalid_arg "dposvx_: b (argument 11)"
+   | -12 -> invalid_arg "dposvx_: ldb (argument 12)"
+   | -13 -> invalid_arg "dposvx_: x (argument 13)"
+   | -14 -> invalid_arg "dposvx_: ldx (argument 14)"
+   | -15 -> invalid_arg "dposvx_: rcond (argument 15)"
+   | -16 -> invalid_arg "dposvx_: ferr (argument 16)"
+   | -17 -> invalid_arg "dposvx_: berr (argument 17)"
+   | -18 -> invalid_arg "dposvx_: work (argument 18)"
+   | -19 -> invalid_arg "dposvx_: iwork (argument 19)"
+   | -20 -> invalid_arg "dposvx_: info (argument 20)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dposvx_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // result tuple
+  a,af,arg_equed,s,b,x,arg_rcond,ferr,berr
+
+
+///Cholesky factorisation of a real symmetric positive definite matrix
+ member this.dpotrf_((uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dpotrf_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dpotrf_(&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dpotrf_: uplo (argument 1)"
+   | -2  -> invalid_arg "dpotrf_: n (argument 2)"
+   | -3  -> invalid_arg "dpotrf_: a (argument 3)"
+   | -4  -> invalid_arg "dpotrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dpotrf_: info (argument 5)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dpotrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a
+
+
+///LU factorisation of general matrix using partial pivoting and row interchanges
+ member this.dgetrf_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let ipiv = Array.zeroCreate  (min m n)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dgetrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_ipiv.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_ipiv
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgetrf_: m (argument 1)"
+   | -2  -> invalid_arg "dgetrf_: n (argument 2)"
+   | -3  -> invalid_arg "dgetrf_: a (argument 3)"
+   | -4  -> invalid_arg "dgetrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dgetrf_: ipiv (argument 5)"
+   | -6  -> invalid_arg "dgetrf_: info (argument 6)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgetrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,ipiv
+
+
+///QR Factorisation
+ member this.dgeqrf_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let tau = Array.zeroCreate  (min m n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_tau = NativeUtilities.pinA tau
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackMKLStubs.dgeqrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_tau.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-7) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackMKLStubs.dgeqrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_tau.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_tau
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgeqrf_: m (argument 1)"
+   | -2  -> invalid_arg "dgeqrf_: n (argument 2)"
+   | -3  -> invalid_arg "dgeqrf_: a (argument 3)"
+   | -4  -> invalid_arg "dgeqrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dgeqrf_: tau (argument 5)"
+   | -6  -> invalid_arg "dgeqrf_: work (argument 6)"
+   | -7  -> invalid_arg "dgeqrf_: lwork (argument 7)"
+   | -8  -> invalid_arg "dgeqrf_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgeqrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,tau
+
+
+///Matrix Vector Multiplication
+ member this.dgemv_((a:matrix),(x:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let x = Vector.copy x
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgemv_" ("n","Dim(x)") (n,NativeUtilities.vectorDim  x);
+  // allocate results
+  let y = Vector.zero (m)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_trans = 'n'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_x = NativeUtilities.pinV x
+  let mutable arg_incx = 1
+  let mutable arg_beta = 1.0
+  let arg_y = NativeUtilities.pinV y
+  let mutable arg_incx = 1
+  // call function
+  try
+    LapackMKLStubs.dgemv_(&&arg_trans,&&arg_m,&&arg_n,&&arg_alpha,arg_a.Ptr,&&arg_lda,arg_x.Ptr,&&arg_incx,&&arg_beta,arg_y.Ptr,&&arg_incx)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeV arg_x
+    NativeUtilities.freeV arg_y
+  // INFO
+  // fixups
+  // result tuple
+  y
+
+
+///EigenValues and Eigen Vectors for nonsymetruc matrices
+ member this.dggev_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let alphar = Array.zeroCreate  (n)
+  let alphai = Array.zeroCreate  (n)
+  let beta = Array.zeroCreate  (n)
+  let vl = Array2D.zeroCreate (n) (n)
+  let vr = Array2D.zeroCreate (n) (n)
+  let work = Array.zeroCreate  ((8*n))
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_jobvl = 'N'
+  let mutable arg_jobvr = 'V'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_alphar = NativeUtilities.pinA alphar
+  let arg_alphai = NativeUtilities.pinA alphai
+  let arg_beta = NativeUtilities.pinA beta
+  let arg_vl = NativeUtilities.pinA2 vl
+  let mutable arg_ldvl = n
+  let arg_vr = NativeUtilities.pinA2 vr
+  let mutable arg_ldvr = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = (8*n)
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackMKLStubs.dggev_(&&arg_jobvl,&&arg_jobvr,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_alphar.Ptr,arg_alphai.Ptr,arg_beta.Ptr,arg_vl.Ptr,&&arg_ldvl,arg_vr.Ptr,&&arg_ldvr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_alphar
+    NativeUtilities.freeA arg_alphai
+    NativeUtilities.freeA arg_beta
+    NativeUtilities.freeA2 arg_vl
+    NativeUtilities.freeA2 arg_vr
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dggev_: jobvl (argument 1)"
+   | -2  -> invalid_arg "dggev_: jobvr (argument 2)"
+   | -3  -> invalid_arg "dggev_: n (argument 3)"
+   | -4  -> invalid_arg "dggev_: a (argument 4)"
+   | -5  -> invalid_arg "dggev_: lda (argument 5)"
+   | -6  -> invalid_arg "dggev_: b (argument 6)"
+   | -7  -> invalid_arg "dggev_: ldb (argument 7)"
+   | -8  -> invalid_arg "dggev_: alphar (argument 8)"
+   | -9  -> invalid_arg "dggev_: alphai (argument 9)"
+   | -10 -> invalid_arg "dggev_: beta (argument 10)"
+   | -11 -> invalid_arg "dggev_: vl (argument 11)"
+   | -12 -> invalid_arg "dggev_: ldvl (argument 12)"
+   | -13 -> invalid_arg "dggev_: vr (argument 13)"
+   | -14 -> invalid_arg "dggev_: ldvr (argument 14)"
+   | -15 -> invalid_arg "dggev_: work (argument 15)"
+   | -16 -> invalid_arg "dggev_: lwork (argument 16)"
+   | -17 -> invalid_arg "dggev_: info (argument 17)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dggev_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,alphar,alphai,beta,vr
+
+ end
+end
+module LapackMKL = begin
+ let MKLProvider = new Microsoft.FSharp.Math.Experimental.Provider<_>("MKL",[|"mkl_def.dll";"mkl_lapack.dll"|],fun () -> new LapackMKLService() :> ILapack)
+end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fsi
new file mode 100644
index 0000000..218657d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_mkl.fsi
@@ -0,0 +1,5 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Bindings.Internals
+module LapackMKL =
+  val MKLProvider : Microsoft.FSharp.Math.Experimental.Provider<Microsoft.FSharp.Math.Bindings.Internals.ILapack>
+module LapackMKLStubs = begin end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fs
new file mode 100644
index 0000000..d6c00b9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fs
@@ -0,0 +1,1345 @@
+namespace Microsoft.FSharp.Math.Bindings.Internals
+#nowarn "51"
+open Microsoft.FSharp.Math
+open Microsoft.FSharp.Math.Bindings.Internals
+/// Notice: This file generates bindings for netlib.org BLAS/LAPACK DLLs
+module LapackNetlibStubs = begin
+  [<System.Runtime.InteropServices.DllImport(@"blas.dll",EntryPoint="dgemm_")>]
+  extern void dgemm_(char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc);
+
+  [<System.Runtime.InteropServices.DllImport(@"blas.dll",EntryPoint="dtrsv_")>]
+  extern void dtrsv_(char *uplo,char *trans,char *diag,int *n,double *a,int *lda,double *x,int *incx);
+
+  [<System.Runtime.InteropServices.DllImport(@"blas.dll",EntryPoint="dtrsm_")>]
+  extern void dtrsm_(char *side,char *uplo,char *trans,char *diag,int *m,int *n,double *alpha,double *a,int *lda,double *b,int *ldb);   
+   
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgesv_")>]
+  extern void dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgeev_")>]
+  extern void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info);
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dposv_")>]
+  extern void dposv_(char *uplo, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgels_")>]
+  extern void dgels_(char *trans, int *m,int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgglse_")>]
+  extern void dgglse_(int *m, int *n, int *p, double *a, int *lda, double *b, int *ldb, double *c, double *d, double *x, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dsyev_")>]
+  extern void dsyev_(char *jobz, char *uplo, int *n, double *a,int *lda, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dsyevd_")>]
+  extern void dsyevd_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgesvd_")>]
+  extern void dgesvd_(char *jobu, char *jobvt, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgesdd_")>]
+  extern void dgesdd_(char *JOBZ, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork,int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dsygv_")>]
+  extern void dsygv_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dsygvd_")>]     
+  extern void dsygvd_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork,int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dggev_")>]     
+  extern void dggev_( char *jobvl, char *jobvr, int *n, double *a, int *lda, double *b, int *ldb, double *alphar, double *alphai,double *beta,double *vl,int *ldvl,double *vr,int *ldvr,double *work, int *lwork,int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgesvx_")>]     
+  extern void dgesvx_(char *fact, char *trans, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, int *ipiv, char *equed, double *r, double *c, double *b, int *ldb, double *x, int *ldx, double *rcond, double *ferr, double *berr, double *work, int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dposvx_")>]     
+  extern void  dposvx_(char *fact, char *uplo, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, char *equed, double *s, double *b, int *ldb, double *x, int *ldx, double *rcond, double  *ferr, double *berr, double *work, int *iwork, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dpotrf_")>]     
+  extern void  dpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgetrf_")>]     
+  extern void  dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"lapack.dll",EntryPoint="dgeqrf_")>]     
+  extern void dgeqrf_(int  *m, int *n, double *a, int *lda, double *tau, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"blas.dll",EntryPoint="dgemv_")>]
+  extern void dgemv_(char* trans, int* m, int* n,double* alpha, double* A, int* lda,double* x, int* incx, double* beta,double* y, int* incy);
+  
+end
+/// Internal provider of Lapack functionality, not for direct user usage.
+type LapackNetlibService() = class
+ interface ILapack with 
+///Matrix-Matrix Multiplication
+ member this.dgemm_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let k = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgemm_" ("k","Dim1(b)") (k,NativeUtilities.matrixDim1 b);
+  let n = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let c = Matrix.zero (m) (n)
+  // transpose
+  let c = Matrix.transpose c
+  // setup actuals
+  let mutable arg_transa = 't'
+  let mutable arg_transb = 't'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_k = k
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_ldk = k
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldn = n
+  let mutable arg_beta = 1.0
+  let arg_c = NativeUtilities.pinM c
+  let mutable arg_ldm = m
+  // call function
+  try
+    LapackNetlibStubs.dgemm_(&&arg_transa,&&arg_transb,&&arg_m,&&arg_n,&&arg_k,&&arg_alpha,arg_a.Ptr,&&arg_ldk,arg_b.Ptr,&&arg_ldn,&&arg_beta,arg_c.Ptr,&&arg_ldm)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_c
+  // INFO
+  // fixups
+  let c = Matrix.transpose c
+  // result tuple
+  c
+
+
+///Solve
+ member this.dgesv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgesv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dgesv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let NRHS = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let ipiv = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_n = n
+  let mutable arg_NRHS = NRHS
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dgesv_(&&arg_n,&&arg_NRHS,arg_a.Ptr,&&arg_lda,arg_ipiv.Ptr,arg_b.Ptr,&&arg_ldb,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_ipiv
+    NativeUtilities.freeM arg_b
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesv_: n (argument 1)"
+   | -2  -> invalid_arg "dgesv_: NRHS (argument 2)"
+   | -3  -> invalid_arg "dgesv_: a (argument 3)"
+   | -4  -> invalid_arg "dgesv_: lda (argument 4)"
+   | -5  -> invalid_arg "dgesv_: ipiv (argument 5)"
+   | -6  -> invalid_arg "dgesv_: b (argument 6)"
+   | -7  -> invalid_arg "dgesv_: ldb (argument 7)"
+   | -8  -> invalid_arg "dgesv_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,ipiv,b
+
+
+///Solve dtrsv
+ member this.dtrsv_((uplo),(a:matrix),(x:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let x = Vector.copy x
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dtrsv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dtrsv_" ("n","Dim(x)") (n,NativeUtilities.vectorDim  x);
+  // allocate results
+  // transpose
+  // setup actuals
+  let mutable arg_uplo = uplo
+  let mutable arg_transa = 't'
+  let mutable arg_diag = 'N'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_x = NativeUtilities.pinV x
+  let mutable arg_incx = 1
+  // call function
+  try
+    LapackNetlibStubs.dtrsv_(&&arg_uplo,&&arg_transa,&&arg_diag,&&arg_n,arg_a.Ptr,&&arg_lda,arg_x.Ptr,&&arg_incx)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeV arg_x
+  // INFO
+  // fixups
+  // result tuple
+  x
+
+
+///Solve dtrsm
+ member this.dtrsm_((uplo),(a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let k = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dtrsm_" ("m","Dim1(b)") (m,NativeUtilities.matrixDim1 b);
+  let n = NativeUtilities.matrixDim2 b in
+  // allocate results
+  // transpose
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_side = 'L'
+  let mutable arg_uplo = uplo
+  let mutable arg_transa = 't'
+  let mutable arg_diag = 'N'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = m
+  // call function
+  try
+    LapackNetlibStubs.dtrsm_(&&arg_side,&&arg_uplo,&&arg_transa,&&arg_diag,&&arg_m,&&arg_n,&&arg_alpha,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+  // INFO
+  // fixups
+  let b = Matrix.transpose b
+  // result tuple
+  b
+
+
+///Solve LSE using GRQ
+ member this.dgglse_((a:matrix),(b:matrix),(c:vector),(d:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  let c = Vector.copy c
+  let d = Vector.copy d
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  let p = NativeUtilities.matrixDim1 b in
+  NativeUtilities.assertDimensions "dgglse_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  NativeUtilities.assertDimensions "dgglse_" ("m","Dim(c)") (m,NativeUtilities.vectorDim  c);
+  NativeUtilities.assertDimensions "dgglse_" ("p","Dim(d)") (p,NativeUtilities.vectorDim  d);
+  // allocate results
+  let x = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_p = p
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 p
+  let arg_c = NativeUtilities.pinV c
+  let arg_d = NativeUtilities.pinV d
+  let arg_x = NativeUtilities.pinA x
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dgglse_(&&arg_m,&&arg_n,&&arg_p,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_c.Ptr,arg_d.Ptr,arg_x.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-12) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dgglse_(&&arg_m,&&arg_n,&&arg_p,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_c.Ptr,arg_d.Ptr,arg_x.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeV arg_c
+    NativeUtilities.freeV arg_d
+    NativeUtilities.freeA arg_x
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgglse_: m (argument 1)"
+   | -2  -> invalid_arg "dgglse_: n (argument 2)"
+   | -3  -> invalid_arg "dgglse_: p (argument 3)"
+   | -4  -> invalid_arg "dgglse_: a (argument 4)"
+   | -5  -> invalid_arg "dgglse_: lda (argument 5)"
+   | -6  -> invalid_arg "dgglse_: b (argument 6)"
+   | -7  -> invalid_arg "dgglse_: ldb (argument 7)"
+   | -8  -> invalid_arg "dgglse_: c (argument 8)"
+   | -9  -> invalid_arg "dgglse_: d (argument 9)"
+   | -10 -> invalid_arg "dgglse_: x (argument 10)"
+   | -11 -> invalid_arg "dgglse_: work (argument 11)"
+   | -12 -> invalid_arg "dgglse_: lwork (argument 12)"
+   | -13 -> invalid_arg "dgglse_: info (argument 13)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgglse_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,c,x
+
+
+///EigenValue Non-Symetrix
+ member this.dgeev_((jobvr),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgeev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let wr = Array.zeroCreate  (n)
+  let wi = Array.zeroCreate  (n)
+  let vl = Array2D.zeroCreate (n) (n)
+  let vr = Array2D.zeroCreate (n) (n)
+  let work = Array.zeroCreate  ((4*n))
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobvl = 'N'
+  let mutable arg_jobvr = jobvr
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = n
+  let arg_wr = NativeUtilities.pinA wr
+  let arg_wi = NativeUtilities.pinA wi
+  let arg_vl = NativeUtilities.pinA2 vl
+  let mutable arg_ldvl = n
+  let arg_vr = NativeUtilities.pinA2 vr
+  let mutable arg_ldvr = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = (4*n)
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dgeev_(&&arg_jobvl,&&arg_jobvr,&&arg_n,arg_a.Ptr,&&arg_lda,arg_wr.Ptr,arg_wi.Ptr,arg_vl.Ptr,&&arg_ldvl,arg_vr.Ptr,&&arg_ldvr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_wr
+    NativeUtilities.freeA arg_wi
+    NativeUtilities.freeA2 arg_vl
+    NativeUtilities.freeA2 arg_vr
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgeev_: jobvl (argument 1)"
+   | -2  -> invalid_arg "dgeev_: jobvr (argument 2)"
+   | -3  -> invalid_arg "dgeev_: n (argument 3)"
+   | -4  -> invalid_arg "dgeev_: a (argument 4)"
+   | -5  -> invalid_arg "dgeev_: lda (argument 5)"
+   | -6  -> invalid_arg "dgeev_: wr (argument 6)"
+   | -7  -> invalid_arg "dgeev_: wi (argument 7)"
+   | -8  -> invalid_arg "dgeev_: vl (argument 8)"
+   | -9  -> invalid_arg "dgeev_: ldvl (argument 9)"
+   | -10 -> invalid_arg "dgeev_: vr (argument 10)"
+   | -11 -> invalid_arg "dgeev_: ldvr (argument 11)"
+   | -12 -> invalid_arg "dgeev_: work (argument 12)"
+   | -13 -> invalid_arg "dgeev_: lwork (argument 13)"
+   | -14 -> invalid_arg "dgeev_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgeev_ : returned %d. The computation failed." n)
+  // fixups
+  // result tuple
+  wr,wi,vr
+
+
+///Solve Cholesky
+ member this.dposv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dposv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dposv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dposv_(&&arg_uplo,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dposv_: uplo (argument 1)"
+   | -2  -> invalid_arg "dposv_: n (argument 2)"
+   | -3  -> invalid_arg "dposv_: nrhs (argument 3)"
+   | -4  -> invalid_arg "dposv_: a (argument 4)"
+   | -5  -> invalid_arg "dposv_: lda (argument 5)"
+   | -6  -> invalid_arg "dposv_: b (argument 6)"
+   | -7  -> invalid_arg "dposv_: ldb (argument 7)"
+   | -8  -> invalid_arg "dposv_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dposv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b
+
+
+///Solve Upper
+ member this.dgels_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgels_" ("(max m n)","Dim1(b)") ((max m n),NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_transa = 'n'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max m (max 1 n)
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dgels_(&&arg_transa,&&arg_m,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-10) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dgels_(&&arg_transa,&&arg_m,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgels_: transa (argument 1)"
+   | -2  -> invalid_arg "dgels_: m (argument 2)"
+   | -3  -> invalid_arg "dgels_: n (argument 3)"
+   | -4  -> invalid_arg "dgels_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dgels_: a (argument 5)"
+   | -6  -> invalid_arg "dgels_: lda (argument 6)"
+   | -7  -> invalid_arg "dgels_: b (argument 7)"
+   | -8  -> invalid_arg "dgels_: ldb (argument 8)"
+   | -9  -> invalid_arg "dgels_: work (argument 9)"
+   | -10 -> invalid_arg "dgels_: lwork (argument 10)"
+   | -11 -> invalid_arg "dgels_: info (argument 11)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgels_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b
+
+
+///Eigen Value of Symetric Matrix
+ member this.dsyev_((jobz),(uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsyev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobz = jobz
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dsyev_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-8) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dsyev_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsyev_: jobz (argument 1)"
+   | -2  -> invalid_arg "dsyev_: uplo (argument 2)"
+   | -3  -> invalid_arg "dsyev_: n (argument 3)"
+   | -4  -> invalid_arg "dsyev_: a (argument 4)"
+   | -5  -> invalid_arg "dsyev_: lda (argument 5)"
+   | -6  -> invalid_arg "dsyev_: w (argument 6)"
+   | -7  -> invalid_arg "dsyev_: work (argument 7)"
+   | -8  -> invalid_arg "dsyev_: lwork (argument 8)"
+   | -9  -> invalid_arg "dsyev_: info (argument 9)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsyev_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,w
+
+
+///Eigen Value of Symetric Matrix - Divide and Conquer
+ member this.dsyevd_((jobz),(uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsyevd_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_jobz = jobz
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_liwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dsyevd_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  if arg_info = 0   || arg_info=(-8)  || arg_info=(-10) then
+    arg_lwork <- int32 work.[0]
+    arg_liwork <-  iwork.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  let arg_iwork = NativeUtilities.pinA (Array.zeroCreate arg_liwork : int[])
+  // call function
+  try
+    LapackNetlibStubs.dsyevd_(&&arg_jobz,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsyevd_: jobz (argument 1)"
+   | -2  -> invalid_arg "dsyevd_: uplo (argument 2)"
+   | -3  -> invalid_arg "dsyevd_: n (argument 3)"
+   | -4  -> invalid_arg "dsyevd_: a (argument 4)"
+   | -5  -> invalid_arg "dsyevd_: lda (argument 5)"
+   | -6  -> invalid_arg "dsyevd_: w (argument 6)"
+   | -7  -> invalid_arg "dsyevd_: work (argument 7)"
+   | -8  -> invalid_arg "dsyevd_: lwork (argument 8)"
+   | -9  -> invalid_arg "dsyevd_: iwork (argument 9)"
+   | -10 -> invalid_arg "dsyevd_: liwork (argument 10)"
+   | -11 -> invalid_arg "dsyevd_: info (argument 11)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsyevd_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,w
+
+
+///Singular Value Decomposition
+ member this.dgesvd_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let s = Array.zeroCreate  (min m n)
+  let u = Matrix.zero (m) (min m n)
+  let vt = Matrix.zero (n) (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // setup actuals
+  let mutable arg_jobu = 'A'
+  let mutable arg_jobvt = 'A'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_s = NativeUtilities.pinA s
+  let arg_u = NativeUtilities.pinM u
+  let mutable arg_ldu = m
+  let arg_vt = NativeUtilities.pinM vt
+  let mutable arg_ldvt = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dgesvd_(&&arg_jobu,&&arg_jobvt,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-13) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dgesvd_(&&arg_jobu,&&arg_jobvt,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_u
+    NativeUtilities.freeM arg_vt
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesvd_: jobu (argument 1)"
+   | -2  -> invalid_arg "dgesvd_: jobvt (argument 2)"
+   | -3  -> invalid_arg "dgesvd_: m (argument 3)"
+   | -4  -> invalid_arg "dgesvd_: n (argument 4)"
+   | -5  -> invalid_arg "dgesvd_: a (argument 5)"
+   | -6  -> invalid_arg "dgesvd_: lda (argument 6)"
+   | -7  -> invalid_arg "dgesvd_: s (argument 7)"
+   | -8  -> invalid_arg "dgesvd_: u (argument 8)"
+   | -9  -> invalid_arg "dgesvd_: ldu (argument 9)"
+   | -10 -> invalid_arg "dgesvd_: vt (argument 10)"
+   | -11 -> invalid_arg "dgesvd_: ldvt (argument 11)"
+   | -12 -> invalid_arg "dgesvd_: work (argument 12)"
+   | -13 -> invalid_arg "dgesvd_: lwork (argument 13)"
+   | -14 -> invalid_arg "dgesvd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesvd_ : returned %d. The computation failed." n)
+  // fixups
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // result tuple
+  s,u,vt
+
+
+///Singular Value Decomposition Divide- Conquer
+ member this.dgesdd_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let s = Array.zeroCreate  (min m n)
+  let u = Matrix.zero (m) (m)
+  let vt = Matrix.zero (n) (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (8*(min m n))
+  // transpose
+  let a = Matrix.transpose a
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // setup actuals
+  let mutable arg_JOBZ = 'A'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_s = NativeUtilities.pinA s
+  let arg_u = NativeUtilities.pinM u
+  let mutable arg_ldu = m
+  let arg_vt = NativeUtilities.pinM vt
+  let mutable arg_ldvt = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dgesdd_(&&arg_JOBZ,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-12) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dgesdd_(&&arg_JOBZ,&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_s.Ptr,arg_u.Ptr,&&arg_ldu,arg_vt.Ptr,&&arg_ldvt,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_u
+    NativeUtilities.freeM arg_vt
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesdd_: JOBZ (argument 1)"
+   | -2  -> invalid_arg "dgesdd_: m (argument 2)"
+   | -3  -> invalid_arg "dgesdd_: n (argument 3)"
+   | -4  -> invalid_arg "dgesdd_: a (argument 4)"
+   | -5  -> invalid_arg "dgesdd_: lda (argument 5)"
+   | -6  -> invalid_arg "dgesdd_: s (argument 6)"
+   | -7  -> invalid_arg "dgesdd_: u (argument 7)"
+   | -8  -> invalid_arg "dgesdd_: ldu (argument 8)"
+   | -9  -> invalid_arg "dgesdd_: vt (argument 9)"
+   | -10 -> invalid_arg "dgesdd_: ldvt (argument 10)"
+   | -11 -> invalid_arg "dgesdd_: work (argument 11)"
+   | -12 -> invalid_arg "dgesdd_: lwork (argument 12)"
+   | -13 -> invalid_arg "dgesdd_: iwork (argument 13)"
+   | -14 -> invalid_arg "dgesdd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesdd_ : returned %d. The computation failed." n)
+  // fixups
+  let u = Matrix.transpose u
+  let vt = Matrix.transpose vt
+  // result tuple
+  s,u,vt
+
+
+///Single Value Decomposition for Symetric Matrices
+ member this.dsygv_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dsygv_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_itype = 1
+  let mutable arg_JOBZ = 'V'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dsygv_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-11) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dsygv_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsygv_: itype (argument 1)"
+   | -2  -> invalid_arg "dsygv_: JOBZ (argument 2)"
+   | -3  -> invalid_arg "dsygv_: uplo (argument 3)"
+   | -4  -> invalid_arg "dsygv_: n (argument 4)"
+   | -5  -> invalid_arg "dsygv_: a (argument 5)"
+   | -6  -> invalid_arg "dsygv_: lda (argument 6)"
+   | -7  -> invalid_arg "dsygv_: b (argument 7)"
+   | -8  -> invalid_arg "dsygv_: ldb (argument 8)"
+   | -9  -> invalid_arg "dsygv_: w (argument 9)"
+   | -10 -> invalid_arg "dsygv_: work (argument 10)"
+   | -11 -> invalid_arg "dsygv_: lwork (argument 11)"
+   | -12 -> invalid_arg "dsygv_: info (argument 12)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsygv_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,w
+
+
+///Single Value Decomposition for Symetric Matrices Divide and Conquer
+ member this.dsygvd_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dsygvd_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let w = Array.zeroCreate  (n)
+  let work = Array.zeroCreate  (1)
+  let iwork = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_itype = 1
+  let mutable arg_JOBZ = 'V'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_w = NativeUtilities.pinA w
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_liwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dsygvd_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  if arg_info = 0   || arg_info=(-11)  || arg_info=(-13) then
+    arg_lwork <- int32 work.[0]
+    arg_liwork <-  iwork.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  let arg_iwork = NativeUtilities.pinA (Array.zeroCreate arg_liwork : int[])
+  // call function
+  try
+    LapackNetlibStubs.dsygvd_(&&arg_itype,&&arg_JOBZ,&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_w.Ptr,arg_work.Ptr,&&arg_lwork,arg_iwork.Ptr,&&arg_liwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_w
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dsygvd_: itype (argument 1)"
+   | -2  -> invalid_arg "dsygvd_: JOBZ (argument 2)"
+   | -3  -> invalid_arg "dsygvd_: uplo (argument 3)"
+   | -4  -> invalid_arg "dsygvd_: n (argument 4)"
+   | -5  -> invalid_arg "dsygvd_: a (argument 5)"
+   | -6  -> invalid_arg "dsygvd_: lda (argument 6)"
+   | -7  -> invalid_arg "dsygvd_: b (argument 7)"
+   | -8  -> invalid_arg "dsygvd_: ldb (argument 8)"
+   | -9  -> invalid_arg "dsygvd_: w (argument 9)"
+   | -10 -> invalid_arg "dsygvd_: work (argument 10)"
+   | -11 -> invalid_arg "dsygvd_: lwork (argument 11)"
+   | -12 -> invalid_arg "dsygvd_: iwork (argument 12)"
+   | -13 -> invalid_arg "dsygvd_: liwork (argument 13)"
+   | -14 -> invalid_arg "dsygvd_: info (argument 14)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dsygvd_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,w
+
+
+///LU factorization to compute the solution to a real  system of linear equations 
+ member this.dgesvx_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dgesvx_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dgesvx_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let af = Matrix.zero (n) (n)
+  let ipiv = Array.zeroCreate  (n)
+  let r = Array.zeroCreate  (n)
+  let c = Array.zeroCreate  (n)
+  let x = Matrix.zero (n) (nrhs)
+  let ferr = Array.zeroCreate  (nrhs)
+  let berr = Array.zeroCreate  (nrhs)
+  let work = Array.zeroCreate  (4*n)
+  let iwork = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // setup actuals
+  let mutable arg_fact = 'E'
+  let mutable arg_transx = 'n'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_af = NativeUtilities.pinM af
+  let mutable arg_ldaf = max 1 n
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let mutable arg_equed = 'n'
+  let arg_r = NativeUtilities.pinA r
+  let arg_c = NativeUtilities.pinA c
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_x = NativeUtilities.pinM x
+  let mutable arg_ldx = max 1 n
+  let mutable arg_rcond = 0.0
+  let arg_ferr = NativeUtilities.pinA ferr
+  let arg_berr = NativeUtilities.pinA berr
+  let arg_work = NativeUtilities.pinA work
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dgesvx_(&&arg_fact,&&arg_transx,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_af.Ptr,&&arg_ldaf,arg_ipiv.Ptr,&&arg_equed,arg_r.Ptr,arg_c.Ptr,arg_b.Ptr,&&arg_ldb,arg_x.Ptr,&&arg_ldx,&&arg_rcond,arg_ferr.Ptr,arg_berr.Ptr,arg_work.Ptr,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_af
+    NativeUtilities.freeA arg_ipiv
+    NativeUtilities.freeA arg_r
+    NativeUtilities.freeA arg_c
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_x
+    NativeUtilities.freeA arg_ferr
+    NativeUtilities.freeA arg_berr
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgesvx_: fact (argument 1)"
+   | -2  -> invalid_arg "dgesvx_: transx (argument 2)"
+   | -3  -> invalid_arg "dgesvx_: n (argument 3)"
+   | -4  -> invalid_arg "dgesvx_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dgesvx_: a (argument 5)"
+   | -6  -> invalid_arg "dgesvx_: lda (argument 6)"
+   | -7  -> invalid_arg "dgesvx_: af (argument 7)"
+   | -8  -> invalid_arg "dgesvx_: ldaf (argument 8)"
+   | -9  -> invalid_arg "dgesvx_: ipiv (argument 9)"
+   | -10 -> invalid_arg "dgesvx_: equed (argument 10)"
+   | -11 -> invalid_arg "dgesvx_: r (argument 11)"
+   | -12 -> invalid_arg "dgesvx_: c (argument 12)"
+   | -13 -> invalid_arg "dgesvx_: b (argument 13)"
+   | -14 -> invalid_arg "dgesvx_: ldb (argument 14)"
+   | -15 -> invalid_arg "dgesvx_: x (argument 15)"
+   | -16 -> invalid_arg "dgesvx_: ldx (argument 16)"
+   | -17 -> invalid_arg "dgesvx_: rcond (argument 17)"
+   | -18 -> invalid_arg "dgesvx_: ferr (argument 18)"
+   | -19 -> invalid_arg "dgesvx_: berr (argument 19)"
+   | -20 -> invalid_arg "dgesvx_: work (argument 20)"
+   | -21 -> invalid_arg "dgesvx_: iwork (argument 21)"
+   | -22 -> invalid_arg "dgesvx_: info (argument 22)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgesvx_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // result tuple
+  a,af,ipiv,arg_equed,r,c,b,x,arg_rcond,ferr,berr
+
+
+///Cholesky Factorisation - Expert
+ member this.dposvx_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dposvx_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dposvx_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  let nrhs = NativeUtilities.matrixDim2 b in
+  // allocate results
+  let af = Matrix.zero (n) (n)
+  let s = Array.zeroCreate  (n)
+  let x = Matrix.zero (n) (nrhs)
+  let ferr = Array.zeroCreate  (nrhs)
+  let berr = Array.zeroCreate  (nrhs)
+  let work = Array.zeroCreate  (3*n)
+  let iwork = Array.zeroCreate  (n)
+  // transpose
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // setup actuals
+  let mutable arg_fact = 'E'
+  let mutable arg_uplo = 'U'
+  let mutable arg_n = n
+  let mutable arg_nrhs = nrhs
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_af = NativeUtilities.pinM af
+  let mutable arg_ldaf = max 1 n
+  let mutable arg_equed = 'n'
+  let arg_s = NativeUtilities.pinA s
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_x = NativeUtilities.pinM x
+  let mutable arg_ldx = max 1 n
+  let mutable arg_rcond = 0.0
+  let arg_ferr = NativeUtilities.pinA ferr
+  let arg_berr = NativeUtilities.pinA berr
+  let arg_work = NativeUtilities.pinA work
+  let arg_iwork = NativeUtilities.pinA iwork
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dposvx_(&&arg_fact,&&arg_uplo,&&arg_n,&&arg_nrhs,arg_a.Ptr,&&arg_lda,arg_af.Ptr,&&arg_ldaf,&&arg_equed,arg_s.Ptr,arg_b.Ptr,&&arg_ldb,arg_x.Ptr,&&arg_ldx,&&arg_rcond,arg_ferr.Ptr,arg_berr.Ptr,arg_work.Ptr,arg_iwork.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_af
+    NativeUtilities.freeA arg_s
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeM arg_x
+    NativeUtilities.freeA arg_ferr
+    NativeUtilities.freeA arg_berr
+    NativeUtilities.freeA arg_work
+    NativeUtilities.freeA arg_iwork
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dposvx_: fact (argument 1)"
+   | -2  -> invalid_arg "dposvx_: uplo (argument 2)"
+   | -3  -> invalid_arg "dposvx_: n (argument 3)"
+   | -4  -> invalid_arg "dposvx_: nrhs (argument 4)"
+   | -5  -> invalid_arg "dposvx_: a (argument 5)"
+   | -6  -> invalid_arg "dposvx_: lda (argument 6)"
+   | -7  -> invalid_arg "dposvx_: af (argument 7)"
+   | -8  -> invalid_arg "dposvx_: ldaf (argument 8)"
+   | -9  -> invalid_arg "dposvx_: equed (argument 9)"
+   | -10 -> invalid_arg "dposvx_: s (argument 10)"
+   | -11 -> invalid_arg "dposvx_: b (argument 11)"
+   | -12 -> invalid_arg "dposvx_: ldb (argument 12)"
+   | -13 -> invalid_arg "dposvx_: x (argument 13)"
+   | -14 -> invalid_arg "dposvx_: ldx (argument 14)"
+   | -15 -> invalid_arg "dposvx_: rcond (argument 15)"
+   | -16 -> invalid_arg "dposvx_: ferr (argument 16)"
+   | -17 -> invalid_arg "dposvx_: berr (argument 17)"
+   | -18 -> invalid_arg "dposvx_: work (argument 18)"
+   | -19 -> invalid_arg "dposvx_: iwork (argument 19)"
+   | -20 -> invalid_arg "dposvx_: info (argument 20)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dposvx_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let af = Matrix.transpose af
+  let b = Matrix.transpose b
+  let x = Matrix.transpose x
+  // result tuple
+  a,af,arg_equed,s,b,x,arg_rcond,ferr,berr
+
+
+///Cholesky factorisation of a real symmetric positive definite matrix
+ member this.dpotrf_((uplo),(a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dpotrf_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  // allocate results
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_uplo = uplo
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dpotrf_(&&arg_uplo,&&arg_n,arg_a.Ptr,&&arg_lda,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dpotrf_: uplo (argument 1)"
+   | -2  -> invalid_arg "dpotrf_: n (argument 2)"
+   | -3  -> invalid_arg "dpotrf_: a (argument 3)"
+   | -4  -> invalid_arg "dpotrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dpotrf_: info (argument 5)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dpotrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a
+
+
+///LU factorisation of general matrix using partial pivoting and row interchanges
+ member this.dgetrf_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let ipiv = Array.zeroCreate  (min m n)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_ipiv = NativeUtilities.pinA ipiv
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dgetrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_ipiv.Ptr,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_ipiv
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgetrf_: m (argument 1)"
+   | -2  -> invalid_arg "dgetrf_: n (argument 2)"
+   | -3  -> invalid_arg "dgetrf_: a (argument 3)"
+   | -4  -> invalid_arg "dgetrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dgetrf_: ipiv (argument 5)"
+   | -6  -> invalid_arg "dgetrf_: info (argument 6)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgetrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,ipiv
+
+
+///QR Factorisation
+ member this.dgeqrf_((a:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  // allocate results
+  let tau = Array.zeroCreate  (min m n)
+  let work = Array.zeroCreate  (1)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_tau = NativeUtilities.pinA tau
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = -1
+  let mutable arg_info = 0
+  // ask for work array size
+  try
+    LapackNetlibStubs.dgeqrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_tau.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeA arg_work
+  if arg_info = 0   || arg_info=(-7) then
+    arg_lwork <- int32 work.[0]
+  else assert(false)
+  let arg_work = NativeUtilities.pinA (Array.zeroCreate arg_lwork : float[])
+  // call function
+  try
+    LapackNetlibStubs.dgeqrf_(&&arg_m,&&arg_n,arg_a.Ptr,&&arg_lda,arg_tau.Ptr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeA arg_tau
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dgeqrf_: m (argument 1)"
+   | -2  -> invalid_arg "dgeqrf_: n (argument 2)"
+   | -3  -> invalid_arg "dgeqrf_: a (argument 3)"
+   | -4  -> invalid_arg "dgeqrf_: lda (argument 4)"
+   | -5  -> invalid_arg "dgeqrf_: tau (argument 5)"
+   | -6  -> invalid_arg "dgeqrf_: work (argument 6)"
+   | -7  -> invalid_arg "dgeqrf_: lwork (argument 7)"
+   | -8  -> invalid_arg "dgeqrf_: info (argument 8)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dgeqrf_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  // result tuple
+  a,tau
+
+
+///Matrix Vector Multiplication
+ member this.dgemv_((a:matrix),(x:vector)) = 
+  // input copies
+  let a = Matrix.copy a
+  let x = Vector.copy x
+  // dimensions
+  let m = NativeUtilities.matrixDim1 a in
+  let n = NativeUtilities.matrixDim2 a in
+  NativeUtilities.assertDimensions "dgemv_" ("n","Dim(x)") (n,NativeUtilities.vectorDim  x);
+  // allocate results
+  let y = Vector.zero (m)
+  // transpose
+  let a = Matrix.transpose a
+  // setup actuals
+  let mutable arg_trans = 'n'
+  let mutable arg_m = m
+  let mutable arg_n = n
+  let mutable arg_alpha = 1.0
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 m
+  let arg_x = NativeUtilities.pinV x
+  let mutable arg_incx = 1
+  let mutable arg_beta = 1.0
+  let arg_y = NativeUtilities.pinV y
+  let mutable arg_incx = 1
+  // call function
+  try
+    LapackNetlibStubs.dgemv_(&&arg_trans,&&arg_m,&&arg_n,&&arg_alpha,arg_a.Ptr,&&arg_lda,arg_x.Ptr,&&arg_incx,&&arg_beta,arg_y.Ptr,&&arg_incx)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeV arg_x
+    NativeUtilities.freeV arg_y
+  // INFO
+  // fixups
+  // result tuple
+  y
+
+
+///EigenValues and Eigen Vectors for nonsymetruc matrices
+ member this.dggev_((a:matrix),(b:matrix)) = 
+  // input copies
+  let a = Matrix.copy a
+  let b = Matrix.copy b
+  // dimensions
+  let n = NativeUtilities.matrixDim1 a in
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim2(a)") (n,NativeUtilities.matrixDim2 a);
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim1(b)") (n,NativeUtilities.matrixDim1 b);
+  NativeUtilities.assertDimensions "dggev_" ("n","Dim2(b)") (n,NativeUtilities.matrixDim2 b);
+  // allocate results
+  let alphar = Array.zeroCreate  (n)
+  let alphai = Array.zeroCreate  (n)
+  let beta = Array.zeroCreate  (n)
+  let vl = Array2D.zeroCreate (n) (n)
+  let vr = Array2D.zeroCreate (n) (n)
+  let work = Array.zeroCreate  ((8*n))
+  // transpose
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // setup actuals
+  let mutable arg_jobvl = 'N'
+  let mutable arg_jobvr = 'V'
+  let mutable arg_n = n
+  let arg_a = NativeUtilities.pinM a
+  let mutable arg_lda = max 1 n
+  let arg_b = NativeUtilities.pinM b
+  let mutable arg_ldb = max 1 n
+  let arg_alphar = NativeUtilities.pinA alphar
+  let arg_alphai = NativeUtilities.pinA alphai
+  let arg_beta = NativeUtilities.pinA beta
+  let arg_vl = NativeUtilities.pinA2 vl
+  let mutable arg_ldvl = n
+  let arg_vr = NativeUtilities.pinA2 vr
+  let mutable arg_ldvr = n
+  let arg_work = NativeUtilities.pinA work
+  let mutable arg_lwork = (8*n)
+  let mutable arg_info = 0
+  // call function
+  try
+    LapackNetlibStubs.dggev_(&&arg_jobvl,&&arg_jobvr,&&arg_n,arg_a.Ptr,&&arg_lda,arg_b.Ptr,&&arg_ldb,arg_alphar.Ptr,arg_alphai.Ptr,arg_beta.Ptr,arg_vl.Ptr,&&arg_ldvl,arg_vr.Ptr,&&arg_ldvr,arg_work.Ptr,&&arg_lwork,&&arg_info)
+  finally
+    NativeUtilities.freeM arg_a
+    NativeUtilities.freeM arg_b
+    NativeUtilities.freeA arg_alphar
+    NativeUtilities.freeA arg_alphai
+    NativeUtilities.freeA arg_beta
+    NativeUtilities.freeA2 arg_vl
+    NativeUtilities.freeA2 arg_vr
+    NativeUtilities.freeA arg_work
+  // INFO
+  match arg_info with
+   | -1  -> invalid_arg "dggev_: jobvl (argument 1)"
+   | -2  -> invalid_arg "dggev_: jobvr (argument 2)"
+   | -3  -> invalid_arg "dggev_: n (argument 3)"
+   | -4  -> invalid_arg "dggev_: a (argument 4)"
+   | -5  -> invalid_arg "dggev_: lda (argument 5)"
+   | -6  -> invalid_arg "dggev_: b (argument 6)"
+   | -7  -> invalid_arg "dggev_: ldb (argument 7)"
+   | -8  -> invalid_arg "dggev_: alphar (argument 8)"
+   | -9  -> invalid_arg "dggev_: alphai (argument 9)"
+   | -10 -> invalid_arg "dggev_: beta (argument 10)"
+   | -11 -> invalid_arg "dggev_: vl (argument 11)"
+   | -12 -> invalid_arg "dggev_: ldvl (argument 12)"
+   | -13 -> invalid_arg "dggev_: vr (argument 13)"
+   | -14 -> invalid_arg "dggev_: ldvr (argument 14)"
+   | -15 -> invalid_arg "dggev_: work (argument 15)"
+   | -16 -> invalid_arg "dggev_: lwork (argument 16)"
+   | -17 -> invalid_arg "dggev_: info (argument 17)"
+   | 0   -> ()
+   | n   -> failwith (sprintf "dggev_ : returned %d. The computation failed." n)
+  // fixups
+  let a = Matrix.transpose a
+  let b = Matrix.transpose b
+  // result tuple
+  a,b,alphar,alphai,beta,vr
+
+ end
+end
+module LapackNetlib = begin
+ let NetlibProvider = new Microsoft.FSharp.Math.Experimental.Provider<_>("Netlib",[|"blas.dll";"lapack.dll"|],fun () -> new LapackNetlibService() :> ILapack)
+end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fsi
new file mode 100644
index 0000000..8edaa41
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_netlib.fsi
@@ -0,0 +1,5 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Bindings.Internals
+module LapackNetlib =
+  val NetlibProvider : Microsoft.FSharp.Math.Experimental.Provider<Microsoft.FSharp.Math.Bindings.Internals.ILapack>
+module LapackNetlibStubs = begin end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_template.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_template.fs
new file mode 100644
index 0000000..e85e253
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/lapack_service_template.fs
@@ -0,0 +1,66 @@
+// (c) Microsoft Corporation 2005-2009.
+[NOTICE]
+module [MODULENAME] = begin
+  [<System.Runtime.InteropServices.DllImport(@"[BLASDLL]",EntryPoint="dgemm[_]")>]
+  extern void dgemm_(char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *a, int *lda, double *b, int *ldb, double *beta, double *c, int *ldc);
+
+  [<System.Runtime.InteropServices.DllImport(@"[BLASDLL]",EntryPoint="dtrsv[_]")>]
+  extern void dtrsv_(char *uplo,char *trans,char *diag,int *n,double *a,int *lda,double *x,int *incx);
+
+  [<System.Runtime.InteropServices.DllImport(@"[BLASDLL]",EntryPoint="dtrsm[_]")>]
+  extern void dtrsm_(char *side,char *uplo,char *trans,char *diag,int *m,int *n,double *alpha,double *a,int *lda,double *b,int *ldb);   
+   
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgesv[_]")>]
+  extern void dgesv_(int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgeev[_]")>]
+  extern void dgeev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *wr, double *wi, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info);
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dposv[_]")>]
+  extern void dposv_(char *uplo, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgels[_]")>]
+  extern void dgels_(char *trans, int *m,int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgglse[_]")>]
+  extern void dgglse_(int *m, int *n, int *p, double *a, int *lda, double *b, int *ldb, double *c, double *d, double *x, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dsyev[_]")>]
+  extern void dsyev_(char *jobz, char *uplo, int *n, double *a,int *lda, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dsyevd[_]")>]
+  extern void dsyevd_(char *jobz, char *uplo, int *n, double *a, int *lda, double *w, double *work, int *lwork, int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgesvd[_]")>]
+  extern void dgesvd_(char *jobu, char *jobvt, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgesdd[_]")>]
+  extern void dgesdd_(char *JOBZ, int  *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork,int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dsygv[_]")>]
+  extern void dsygv_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dsygvd[_]")>]     
+  extern void dsygvd_(int *itype, char *jobz, char *uplo, int *n, double *a, int *lda, double *b, int *ldb, double *w, double *work, int *lwork,int *iwork, int *liwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dggev[_]")>]     
+  extern void dggev_( char *jobvl, char *jobvr, int *n, double *a, int *lda, double *b, int *ldb, double *alphar, double *alphai,double *beta,double *vl,int *ldvl,double *vr,int *ldvr,double *work, int *lwork,int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgesvx[_]")>]     
+  extern void dgesvx_(char *fact, char *trans, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, int *ipiv, char *equed, double *r, double *c, double *b, int *ldb, double *x, int *ldx, double *rcond, double *ferr, double *berr, double *work, int *iwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dposvx[_]")>]     
+  extern void  dposvx_(char *fact, char *uplo, int *n, int *nrhs, double *a, int *lda, double *af, int *ldaf, char *equed, double *s, double *b, int *ldb, double *x, int *ldx, double *rcond, double  *ferr, double *berr, double *work, int *iwork, int *info);
+
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dpotrf[_]")>]     
+  extern void  dpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgetrf[_]")>]     
+  extern void  dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[LAPACKDLL]",EntryPoint="dgeqrf[_]")>]     
+  extern void dgeqrf_(int  *m, int *n, double *a, int *lda, double *tau, double *work, int *lwork, int *info);
+  
+  [<System.Runtime.InteropServices.DllImport(@"[BLASDLL]",EntryPoint="dgemv[_]")>]
+  extern void dgemv_(char* trans, int* m, int* n,double* alpha, double* A, int* lda,double* x, int* incx, double* beta,double* y, int* incy);
+  
+end
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fs
new file mode 100644
index 0000000..a0fb9bc
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fs
@@ -0,0 +1,201 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Math.Experimental
+
+open Microsoft.FSharp.Math
+
+module LinearAlgebra = 
+  // This module is the dispatcher to BLAS/LAPACK service implementation vs managed implementation
+  // It is the user facing module.
+  open Microsoft.FSharp.Math.Bindings.Internals
+  open Microsoft.FSharp.Math.Experimental
+  
+  type Permutation = Microsoft.FSharp.Compatibility.permutation
+
+  let Lapack         = LinearAlgebraService.LAPACKService // The service/provider object
+  let MKLProvider    = LapackMKL.MKLProvider              // MKL provider
+  let NetlibProvider = LapackNetlib.NetlibProvider        // Netlib provider
+
+  module Locals = 
+    let HaveService() = Lapack.Available()
+  open Locals
+
+  let SolveTriangularLinearSystem (A:matrix) (b:vector) (isLower:bool) =
+    if HaveService() then LinearAlgebraService.solveTriangularForVector A b isLower
+                     else LinearAlgebraManaged.SolveTriangularLinearSystem A b isLower
+                   
+  let SolveTriangularLinearSystems (A:matrix) (B:matrix) (isLower:bool) =
+    if HaveService() then LinearAlgebraService.solveTriangularForMatrix A B isLower
+                     else LinearAlgebraManaged.SolveTriangularLinearSystems A B isLower
+  
+  let SolveLinearSystem (A:matrix) (b:vector) =
+    if HaveService() then LinearAlgebraService.preDivideByVector A b
+                     else LinearAlgebraManaged.SolveLinearSystem A b
+                   
+  let SolveLinearSystems (A:matrix) (B:matrix) =
+    if HaveService() then LinearAlgebraService.preDivideByMatrix A B
+                     else LinearAlgebraManaged.SolveLinearSystems A B
+
+  /// Given A[n,m] and B[n] solve for x[m] such that Ax = B
+  /// This call may fail.
+  let preDivideByVector A b = 
+    if HaveService() then LinearAlgebraService.preDivideByVector A b
+                     else LinearAlgebraManaged.SolveLinearSystem A b
+    
+
+  /// Given A[n,m] and B[n,k] solve for X[m,k] such that AX = B
+  /// This call may fail.
+  let preDivideByMatrix a b = 
+    if HaveService() then LinearAlgebraService.preDivideByMatrix a b
+                     else LinearAlgebraManaged.SolveLinearSystems a b
+    
+  /// Compute eigenvalue/eigenvector decomposition of a square real matrix.
+  /// Returns two arrays containing the eigenvalues and eigenvectors, which may be complex.
+  /// This call may fail.
+  let EigenSpectrum m = 
+    if HaveService() then let evals, evecs = LinearAlgebraService.eigenvectors m
+                          let n = evals.Length
+                          Vector.Generic.init n (fun i -> evals.[i]), Matrix.Generic.init n n (fun i j -> (evecs.[i]).[j])
+                     else LinearAlgebraManaged.eigenvectors m
+                           
+  /// Compute eigenvalues of a square real matrix.
+  /// Returns arrays containing the eigenvalues which may be complex.
+  /// This call may fail.
+  let EigenValues m =
+    if HaveService() then let evals = LinearAlgebraService.eigenvalues m
+                          let n = evals.Length
+                          Vector.Generic.init n (fun i -> evals.[i])
+                     else LinearAlgebraManaged.eigenvalues m
+
+  /// Compute eigenvalues for a real symmetric matrix.
+  /// Returns array of real eigenvalues.
+  /// This call may fail.
+  let EigenValuesWhenSymmetric a =
+    if HaveService() then let evals = LinearAlgebraService.symmetricEigenvalues a
+                          let n = evals.Length
+                          Vector.init n (fun i -> evals.[i])
+                     else LinearAlgebraManaged.symmetricEigenvalues a
+    
+  /// Compute eigenvalues and eigenvectors for a real symmetric matrix.
+  /// Returns arrays of the values and vectors (both based on reals).
+  /// This call may fail.
+  let EigenSpectrumWhenSymmetric a =
+    if HaveService() then let evals, evecs = LinearAlgebraService.symmetricEigenvectors a
+                          let n = evals.Length
+                          Vector.init n (fun i -> evals.[i]), Matrix.init n n (fun i j -> (evecs.[i]).[j])
+                     else LinearAlgebraManaged.symmetricEigenvectors a
+    
+  /// Given A[n,n] find it's inverse.
+  /// This call may fail.
+  let Inverse a = 
+    if HaveService() then LinearAlgebraService.inverse a
+                     else LinearAlgebraManaged.Inverse a
+
+  /// Given A[m,n] and B[m] solves AX = B for X[n].
+  /// When m=>n, have over constrained system, finds least squares solution for X.
+  /// When m<n, have under constrained system, finds least norm solution for X.
+  let LeastSquares a b =
+    if HaveService() then LinearAlgebraService.leastSquares a b
+                     else LinearAlgebraManaged.leastSquares a b
+    
+  /// Given A[n,n] real symmetric positive definite.
+  /// Finds the cholesky decomposition L such that L' * L = A.
+  /// May fail if not positive definite.
+  let Cholesky a = 
+    if HaveService() then LinearAlgebraService.Cholesky a
+                     else LinearAlgebraManaged.Cholesky a
+      
+  /// Given A[n,n] real matrix.
+  /// Finds P,L,U such that L*U = P*A with L,U lower/upper triangular.
+  let LU a = 
+    if HaveService() then LinearAlgebraService.LU a
+                     else LinearAlgebraManaged.LU a
+      
+
+  /// Given A[m,n] finds Q[m,m] and R[k,n] where k = min m n.
+  /// Have A = Q.R  when m<=n.
+  /// Have A = Q.RX when m>n and RX[m,n] is R[n,n] row extended with (m-n) zero rows.
+  let QR a = 
+    if HaveService() then LinearAlgebraService.QR a
+                     else LinearAlgebraManaged.QR a
+  
+  let SVD a = 
+    if HaveService() then let U,D,V = LinearAlgebraService.SVD a
+                          U,Vector.ofArray D,V
+                     else LinearAlgebraManaged.SVD a
+
+  let Hessenberg A =
+    if HaveService() then failwith "Not implemented yet."// REVIEW LinearAlgebraService.Hessenberg A
+                     else LinearAlgebraManaged.Hessenberg A
+
+  /// This method computes the condition number by just dividing the largest singular value
+  /// by the smallest.
+  let Condition (A:matrix) =
+    let _,D,_ = SVD A
+    D.[0] / D.[D.Length-1]
+
+  /// Compute the determinant of a matrix by performing an LU decomposition since if A = P'LU,
+  /// then det(A) = det(P') * det(L) * det(U).
+  let Determinant A =
+    let P,_,U = LU A
+    // Compute the sign of a permutation REVIEW maybe this should go into permutation?
+    let PermutationSign (len,p) =
+        let a = Array.init len (fun i -> p i)                        // Get an array representation of the permutation
+        let v = Array.init len                                         // Find the positions of all the positions in the permutation
+                            (fun i -> Array.findIndex (fun x -> x = i) a)
+        let mutable sign = 1.0                                              // Remember the sign
+        for i=0 to len-2 do                                            // Start transposing elements keeping track of how many
+            if a.[i] <> i then                                              // transpositions we have taken.
+                a.[v.[i]] <- a.[i]
+                a.[i] <- i
+                v.[a.[v.[i]]] <- v.[i]
+                v.[i] <- i
+                sign <- -sign
+        assert(a = [|0 .. len-1|])
+        assert(v = [|0 .. len-1|])
+        sign
+    let n = A.NumRows
+    let P = (fun i -> P i)
+    (PermutationSign (n,P)) * (Vector.prod U.Diagonal)
+        
+
+
+(*TESTING
+#load "lapack_base.fs";;
+#load "lapack.fs";;
+#load "lapack_service_mkl.fs";;
+//#r "fsharp.math.lapack.dll";;
+open Microsoft.FSharp.Math.Experimental.LinearAlgebra
+open Microsoft.FSharp.Math;;
+
+Microsoft.FSharp.Math.Bindings.Internals.LapackMKL.register();;
+verbose := true;;
+let A = (Matrix.of_list [[10.0; 1.0];[1.0;10.0]]);;
+let B = symmetricPositiveDefiniteCholeskyLU A
+let A = (Matrix.of_list [[10.0;  1.0; 0.0];
+                         [ 1.0; 10.0; 0.0];
+                         [ 1.0;  0.0; 2.0]])
+let r,vs,tau = QR A
+let h v tau = Matrix.iden
+
+#q;;
+
+let A = (Matrix.of_list [[10.0; 12.0; 0.3];
+                         [ 1.0; 13.0; 0.2];
+                         [99.0;-12.0; 2.0]])
+let m,n = matrixDims A
+// QR check
+let q,r = QR A
+q * r - A
+let [|h1;h2;h3|] = hs
+let Q = h1 * (h2 * h3)
+Q * r - A
+let h (v:vector) tau = Matrix.identity 3 - (tau:float) $* (v * v.Transpose)
+let hs = Array.map2 h vs tau
+
+// SVD check
+let vs,U,W = SVD A
+let VS = Matrix.init 3 3 (fun r c -> if r=c then vs.[r] else 0.0)
+U * VS * W - A
+
+*)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fsi
new file mode 100644
index 0000000..e6fc489
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra.fsi
@@ -0,0 +1,82 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Experimental
+
+open Microsoft.FSharp.Math
+open Microsoft.FSharp.Math.Experimental
+open Microsoft.FSharp.Math.Bindings.Internals
+open Microsoft.FSharp.Collections
+
+/// Attribution and acknowledgement:
+///
+/// These modules provide linear algebra functionality on F# matrix types.
+/// Some functionality is implemented using a provider model.
+/// The providers dynamic link to BLAS and Lapack DLLs.
+///
+/// There are currently providers for:
+/// a) blas.dll and lapack.dll which can be built from netlib.org sources.
+/// b) the High Performance Intel(R) Math Kernel Library (MKL) runtime DLLs.
+///
+/// For information on the Intel(R) MKL High Performance library, please see:
+/// http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm
+  
+module LinearAlgebra =
+    type Permutation = Microsoft.FSharp.Compatibility.permutation
+    
+    /// The LAPACK and BLAS service.
+    /// The default providers are already registered.
+    /// The service is primed to auto start on the first service request.
+    val Lapack         : Service<ILapack>
+
+    /// The MKL provider for the BLAS/LAPACK service
+    val MKLProvider    : Provider<ILapack>
+
+    /// The Netlib provider for the BLAS/LAPACK service
+    val NetlibProvider : Provider<ILapack>
+    
+    /// Computes the determinant of a matrix. Uses an LU factorization to compute the determinant.
+    val Determinant : matrix -> float
+    /// Estimates the condition number of matrix A in 2-norm using an SVD decomposition of A.
+    val Condition : A:matrix -> float
+    
+    /// Solves a system of linear equations for vector x when A is triangular: Ax=b. The isLower
+    /// flag specifies whether the input argument A is lower triangular. Uses BLAS *trsv if possible.
+    val SolveTriangularLinearSystem : A:matrix -> b:vector -> isLower:bool -> vector
+    /// Solves a system of linear equations for every column vector of B when A is triangular: AX=B. The isLower
+    /// flag specifies whether the input argument A is lower triangular. Uses BLAS *trsm if possible.
+    val SolveTriangularLinearSystems : A:matrix -> B:matrix -> isLower:bool -> matrix
+    
+    /// Solves the linear system Ax=b when given A and b with no particular structure for A assumed. The method may
+    /// fail when A is singular.
+    val SolveLinearSystem : A:matrix -> b:vector -> vector
+    /// Solves the linear system Ax=B when given A and B with no particular structure for A nor B assumed. The method may
+    /// fail when A is singular.
+    val SolveLinearSystems : A:matrix -> B:matrix -> matrix
+    
+    /// Compute the LU decomposition of matrix A: PA=LU. Uses LAPACK *getrf if possible.
+    val LU : A:matrix -> P:Microsoft.FSharp.Compatibility.permutation * L:matrix * U:matrix
+    /// Compute the cholesky decomposition of matrix A: A = C�C. Uses LAPACK *potrf if possible.
+    val Cholesky : A:matrix -> matrix
+    /// Computes the inverse of matrix A. Uses LAPACK *gesv on an identity matrix if possible.
+    val Inverse : A:matrix -> matrix
+    
+    /// Compute the QR factorization of matrix A: A=QR. Uses LAPACK *geqrf if possible.
+    val QR : A:matrix -> Q:matrix * R:matrix
+    
+    /// Compute the SVD of matrix A: A=UDV'. The singular values are returned in descending
+    /// order. Uses LAPACK *gesvd if possible.
+    val SVD : A:matrix -> U:matrix * D:Vector<float> * V:matrix
+    
+    /// Compute the eigenvalues of matrix A: A=UVU'. Uses LAPACK *geev if possible.
+    val EigenValues : A:matrix -> Vector<complex>
+    /// Compute the eigenvalue-eigenvector decomposition of matrix A: A=UVU'. Uses LAPACK *geev if possible.
+    val EigenSpectrum : A:matrix -> V:Vector<complex> * U:Matrix<complex>
+    /// Compute the eigenvalues of matrix A: A=UVU'. Uses LAPACK *syev if possible.
+    val EigenValuesWhenSymmetric : A:matrix -> vector
+    /// Compute the eigenvalue-eigenvector decomposition of matrix A: A=UVU'. Uses LAPACK *syev if possible.
+    val EigenSpectrumWhenSymmetric : A:matrix -> V:vector * U:matrix
+    /// Compute a Hessenberg form of the matrix A. Uses LAPACK *gehrd if possible.
+    val Hessenberg : A:matrix -> Q:matrix * H:matrix
+    
+    /// Computes a least squares solution using a QR factorization; e.g. min_x ||b - Ax||
+    /// using the 2-norm. Uses LAPACK *gels if possible.
+    val LeastSquares : A:matrix -> b:vector -> vector
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_managed.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_managed.fs
new file mode 100644
index 0000000..7454d63
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_managed.fs
@@ -0,0 +1,238 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Math.Experimental
+
+open Microsoft.FSharp.Math
+open Microsoft.FSharp.Math.Bindings.Internals.NativeUtilities
+
+/// This module is for internal use only.
+module LinearAlgebraManaged = 
+  
+    let NYI () = failwith "Not yet implemented, managed fallback linear algebra ops coming soon"
+    
+    type Permutation = Permutation of int * (int -> int)
+    
+    let SVD A = NYI()
+    let EigenSpectrum A = NYI()
+    let Condition A = NYI()
+
+    let eigenvectors m = NYI()
+    let eigenvalues m = NYI()
+    let symmetricEigenvalues a = NYI()
+    let symmetricEigenvectors a = NYI()
+
+    let SolveTriangularLinearSystems K B isLower =
+        if isLower then
+            let (nK,mK) = matrixDims K
+            let (nB,mB) = matrixDims B
+            if nK<>mK || nB<> nK then invalid_arg "Cannot do backward substitution on non-square matrices."
+            let X = Matrix.zero nK mK
+            for i=0 to nK-1 do
+                for k=0 to mB-1 do
+                    let s = ref B.[i,k]
+                    for j=0 to i-1 do
+                        s := !s - K.[i,j] * X.[j,k]
+                    done
+                    X.[i,k] <- !s / K.[i,i]
+                done
+            done
+            X
+        else
+            let (nK,mK) = matrixDims K
+            let (nB,mB) = matrixDims B
+            if nK<>mK || nB<> nK then invalid_arg "Cannot do backward substitution on non-square matrices."
+            let X = Matrix.zero nK mK
+            for i=0 to nK-1 do
+                for k=0 to mB-1 do
+                    let s = ref B.[nK-i-1,k]
+                    for j=0 to i-1 do
+                        s := !s - K.[nK-i-1,nK-j-1] * X.[nK-j-1,k]
+                    done
+                    X.[nK-i-1,k] <- !s / K.[nK-i-1,nK-i-1]
+                done
+            done
+            X
+
+    let SolveTriangularLinearSystem K v isLower = (SolveTriangularLinearSystems K (Matrix.ofVector v) isLower).Column 0
+
+    type range = int * int
+
+    let inline sumfR f ((a,b):range) =
+        let mutable res = 0.0 in
+        for i = a to b do
+            res <- res + f i
+        res
+      
+
+    let Cholesky (a: matrix) =
+        let nA,mA = a.Dimensions
+        if nA<>mA              then invalid_arg "choleskyFactor: not square";
+        let lres = Matrix.zero nA nA (* nA=mA *)
+        for j=0 to nA-1 do
+        for i=j to nA-1 do (* j <= i *)
+          (* Consider a_ij = sum(k=0...n-1)  (lres_ik . lresT_kj)
+           *               = sum(k=0...n-1)  (lres_ik . lres_jk)
+           *               = sum(k=0...j-1)  (lres_ik . lres_jk) + lres_ij . lres_jj + (0 when k>j)
+           *               = psum                                + lres_ij . lres_jj
+           * This determines lres_ij terms of preceeding terms.
+           * lres_ij depends on lres_ik and lres_jk (and maybe lres_ii) for k<i
+           *)
+          let psum = sumfR (fun k -> lres.[i,k] * lres.[j,k]) (0,j-1)
+          let a_ij = a.[i,j]
+          if i=j then
+            let t = (a_ij - psum)
+            if t >= 0.0 then lres.[i,i] <- (System.Math.Sqrt t) else invalid_arg "choleskyFactor: not symmetric postive definite"
+          else
+            lres.[i,j] <- ((a_ij - psum) / lres.[j,j])
+        done
+        done;
+        // if not (isLowerTriangular lres) then failwith "choleskyFactor: not lower triangular result";
+        lres.Transpose  // REVIEW optimize this so we don't have to take transpose ...
+    
+    let LU A =
+        let (nA,mA) = matrixDims A
+        if nA<>mA then invalid_arg "lu: not square";
+        let L = Matrix.zero nA nA
+        let U = Matrix.copy A
+        let P = [| 0 .. nA-1 |]
+        let abs (x:float) = System.Math.Abs x
+        let swapR X i j =                           //  REVIEW should we make this a general method?
+            let (nX,mX) = matrixDims X
+            let t = X.[i .. i,0 .. ]
+            for k=0 to mX-1 do
+                X.[i,k] <- X.[j,k]
+                X.[j,k] <- t.[0,k]
+            done
+            
+        for i=0 to nA-2 do
+            let mutable maxi = i        //  Find the biggest pivot element.
+            for k=i+1 to nA-1 do
+                if abs(U.[maxi,i]) < abs(U.[k,i]) then maxi <- k
+            done
+            //let maxi = maxIndex (i+1) (nA-1) (fun k -> abs(U.[k,i]))
+            
+            if maxi <> i then
+                swapR U i maxi     // Swap rows if needed.
+                swapR L i maxi     // REVIEW can be made more performant.
+                let t = P.[i]
+                P.[i] <- P.[maxi]
+                P.[maxi] <- t
+            
+            for j=i+1 to nA-1 do
+                L.[j,i] <- U.[j,i] / U.[i,i]
+                for k=i+1 to nA-1 do
+                    U.[j,k] <- U.[j,k] - L.[j,i] * U.[i,k]
+                done
+                U.[j,i] <- 0.0
+            done
+        done
+        (((*P.Length,*)Permutation.ofArray P),L + Matrix.identity nA,U)
+    
+    let SolveLinearSystem (A:matrix) (b:vector) =
+        let (n,m) = matrixDims A
+        if n <> m then invalid_arg "Matrix must be square." 
+        let P,L,U = LU A
+        (SolveTriangularLinearSystem U (SolveTriangularLinearSystem L (b.Permute P) true) false)
+        
+    let SolveLinearSystems (A:matrix) (B:matrix) =
+        let (n,m) = matrixDims A
+        if n <> m then invalid_arg "Matrix must be square." 
+        let P,L,U = LU A
+        (SolveTriangularLinearSystems U (SolveTriangularLinearSystems L (B.PermuteRows P) true) false)
+    
+    let Inverse A =
+        let (n,m) = matrixDims A
+        if n <> m then invalid_arg "Matrix must be square when computing its inverse." 
+        let P,L,U = LU A
+        (SolveTriangularLinearSystems U (SolveTriangularLinearSystems L ((Matrix.identity n).PermuteRows P) true) false)
+        
+    /// Generates a unit vector [1 0 .. 0 ].
+    let unitV k = let e = Vector.create k 0.0 in e.[0] <- 1.0; e
+
+    /// Computes the sign of a floating point number.
+    let sign (f: float) = float (System.Math.Sign f)                    // REVIEW put in float library.
+
+    /// This method computes and performs a Householder reflection. It will change the
+    /// input matrix and return the reflection vector.
+    let HouseholderTransform (A:matrix) (i:int) =
+        // REVIEW do this using views and get rid of the i.
+        let (n,m) = matrixDims A
+        let x = A.[i..,i..i].Column 0                       // Get part of the i'th column of the matrix.
+        let nx = Vector.norm x
+        let vu = x + sign(x.[0]) * nx * (unitV (n-i))               // Compute the reflector.
+        let v = 1.0/(Vector.norm vu) * vu                           // Normalize reflector.
+        
+        // Perform the reflection.
+        let v'A = RowVector.init (m-i) (fun j -> v.Transpose * (A.[i..,i+j..i+j].Column 0))
+        for l=i to n-1 do
+            for k=i to m-1 do
+                A.[l,k] <- A.[l,k] - 2.0 * v.[l-i] * v'A.[k-i]
+        v                                                              // Return reflection vector.
+            
+    let QR (A:matrix) =
+        let (n,m) = matrixDims A
+        let mutable Q = Matrix.identity n                                   // Keeps track of the orthogonal matrix.
+        let R = Matrix.copy A
+
+        // This method will update the orhogonal transformation fast when given a reflection vector.
+        let UpdateQ (Q:matrix) (v:vector) =
+            let n = Vector.length v
+            let (nQ,mQ) = matrixDims Q
+            
+            // Cache the computation of Q*v.
+            let Qv = Vector.init nQ (fun i -> (Q.[i..i,nQ-n..].Row 0) * v)
+
+            // Update the orthogonal transformation.
+            for i=0 to nQ-1 do
+                for j=nQ-n to nQ-1 do
+                    Q.[i,j] <- Q.[i,j] - 2.0 * Qv.[i] * v.[j-nQ+n]
+            ()
+        
+        // This QR implementation keeps the unreduced part of A in R. It computes reflectors one at a time
+        // and reduces R column by column. In the process it keeps track of the Q matrix.
+        for i=0 to (min n m)-1 do
+            let v = HouseholderTransform R i
+            UpdateQ Q v
+        Q,R
+
+    let Hessenberg (A:matrix) =
+        // REVIEW we can do with less copying here.
+        let (n,m) = matrixDims A
+        if n<>m then invalid_arg "Currently only implemented for square matrices."
+        let mutable Q = Matrix.identity n                                   // Keeps track of the orthogonal matrix.
+        let R = A.[1..,*]
+
+        // This method will update the orhogonal transformation fast when given a reflection vector.
+        let UpdateQ (Q:matrix) (v:vector) =
+            let n = Vector.length v
+            let (nQ,mQ) = matrixDims Q
+            
+            // Cache the computation of Q*v.
+            let Qv = Vector.init nQ (fun i -> (Q.[i..i,nQ-n..].Row 0) * v)
+
+            // Update the orthogonal transformation.
+            for i=0 to nQ-1 do
+                for j=nQ-n to nQ-1 do
+                    Q.[i,j] <- Q.[i,j] - 2.0 * Qv.[i] * v.[j-nQ+n]
+            ()
+        
+        // This QR implementation keeps the unreduced part of A in R. It computes reflectors one at a time
+        // and reduces R column by column. In the process it keeps track of the Q matrix.
+        for i=0 to n-2 do
+            let v = HouseholderTransform R i
+            UpdateQ Q v
+        Q,Matrix.init n m (fun i j -> if i = 0 then A.[i,j] else R.[i-1,j])
+        
+    let leastSquares A (b: vector) =
+        let (m,n) = matrixDims A
+        // Is this an overdetermined or underdetermined system?
+        if m > n then
+            let Q,R = QR A
+            let Qtb = Q.Transpose * b
+            SolveTriangularLinearSystem R.[0..n-1,0..n-1] Qtb.[0..n-1] false
+        else
+            let Q,R = QR A
+            let Qtb = Q.Transpose * b
+            let s = SolveTriangularLinearSystem R.[0..m-1,0..m-1] Qtb false
+            Vector.init n (fun i -> if i < m then s.[i] else 0.0)
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_service.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_service.fs
new file mode 100644
index 0000000..6dfc21a
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/linear_algebra_service.fs
@@ -0,0 +1,175 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Experimental
+
+/// This module is for internal use only.
+module LinearAlgebraService = 
+
+  /// Attribution and acknowledgement:
+  ///
+  /// These modules provide linear algebra functionality on F# matrix types.
+  /// The functionality is implemented using a provider model.
+  /// The providers dynamic link to BLAS and Lapack DLLs.
+  ///
+  /// There are currently providers for:
+  /// a) blas.dll and lapack.dll which can be built from netlib.org sources.
+  /// b) the High Performance Intel(R) Math Kernel Library (MKL) runtime DLLs.
+  ///
+  /// For information on the Intel(R) MKL High Performance library, please see:
+  /// http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm
+  ///
+
+  open Microsoft.FSharp.Math
+  open Microsoft.FSharp.Math.Bindings
+  open Microsoft.FSharp.Math.Bindings.Internals
+  open Microsoft.FSharp.Math.Bindings.Internals.NativeUtilities
+  open Microsoft.FSharp.Collections
+  open System.IO
+  
+  open Microsoft.FSharp.Math.Experimental
+
+  let MKLProvider    = LapackMKL.MKLProvider
+  let NetlibProvider = LapackNetlib.NetlibProvider    
+  let LAPACKService = new Service<ILapack>([MKLProvider;NetlibProvider])
+
+  let Service() = 
+    match LAPACKService.Service() with
+    | Some svc -> svc
+    | None     -> failwith "LAPACK service either not available, or not started"
+  
+  /// Compute eigenvalue/eigenvector decomposition of a square real matrix.
+  /// Returns two arrays containing the eigenvalues and eigenvectors, which may be complex.
+  /// This call may fail.
+  let eigenvectors m = 
+    let complex r = Complex.mkRect(r,0.0)
+    let makeEigenVectors (wr:float[],wi:float[],vr:float[,]) =
+      let n = wr.Length
+      let eigenValues  = Array.init n (fun i -> Complex.mkRect(wr.[i],wi.[i]))
+      let cvr = Array.init n (fun i -> Vector.Generic.init n (fun j -> complex vr.[i,j]))
+      let eigenVectors = Array.zeroCreate n : Vector<Complex> array // zeros....
+      let mutable i = 0
+      while (i < n) do      
+        if wi.[i] = 0.0 then
+          eigenVectors.[i] <-  cvr.[i]
+          i <- i + 1
+        else
+          assert(wi.[i] = -wi.[i+1]) // better error message?
+          eigenVectors.[i]   <- cvr.[i] + Complex.OneI * cvr.[i+1]
+          eigenVectors.[i+1] <- cvr.[i] - Complex.OneI * cvr.[i+1]
+          i <- i + 2
+      done
+      eigenValues,eigenVectors
+    Service().dgeev_ ('V',m) |> makeEigenVectors
+      
+  /// Compute eigenvalues of a square real matrix.
+  /// Returns arrays containing the eigenvalues which may be complex.
+  /// This call may fail.
+  let eigenvalues m = 
+    let complex r = Complex.mkRect(r,0.0)
+    let makeEigenValues (wr:float[],wi:float[],_) =
+      let n = wr.Length
+      let eigenValues  = Array.init n (fun i -> Complex.mkRect(wr.[i],wi.[i]))
+      eigenValues
+    Service().dgeev_ ('N',m) |> makeEigenValues
+
+  /// Compute eigenvalues for a real symmetric matrix.
+  /// Returns array of real eigenvalues.
+  /// This call may fail.
+  let symmetricEigenvalues a =
+    let a,lambdas = Service().dsyev_ ('N','U',a)
+    lambdas
+
+  /// Compute eigenvalues and eigenvectors for a real symmetric matrix.
+  /// Returns arrays of the values and vectors (both based on reals).
+  /// This call may fail.
+  let symmetricEigenvectors a =
+    let n,m = matrixDims a
+    let a,lambdas = Service().dsyev_ ('V','U',a)
+    let vs = Array.init n (fun j -> Vector.init n (fun i -> a.[i,j]))
+    lambdas,vs
+
+  /// Given A[n,m] and B[n] solve for x[m] such that Ax = B
+  /// This call may fail.
+  let preDivideByVector A b = 
+    let _,_,x  = Service().dgesv_(A,Matrix.ofVector b)
+    Matrix.toVector x
+
+  /// Given A[n,m] and B[n,k] solve for X[m,k] such that AX = B
+  /// This call may fail.
+  let preDivideByMatrix a b = 
+    let _,_,x  = Service().dgesv_(a,b)
+    x
+
+  let solveTriangularForVector a b isLower =
+    // NOTE: L and U transposed. Check. Is this the right away around?
+    Service().dtrsv_((if isLower then 'u' else 'l'),a,b) (* CHECK: parser error without brackets? *)
+
+  let solveTriangularForMatrix a b isLower = 
+    // NOTE: L and U transposed. Check. Is this the right away around?
+    Service().dtrsm_((if isLower then 'u' else 'l'),a,b) (* CHECK: parser error without brackets? *)
+
+  /// Given A[n,n] find it's inverse.
+  /// This call may fail.
+  let inverse a = 
+    let n,m = matrixDims a
+    NativeUtilities.assertDimensions "inverse" ("rows","columns") (n,m)
+    let _,_,x  = Service().dgesv_(a,Matrix.identity n)
+    x
+
+  /// Given A[m,n] and B[m] solves AX = B for X[n].
+  /// When m=>n, have over constrained system, finds least squares solution for X.
+  /// When m<n, have under constrained system, finds least norm solution for X.
+  let leastSquares a b =
+    let m,n = matrixDims a
+    let b = if m>n then Matrix.ofVector b else Matrix.init n 1 (fun i j -> if i<m then b.[i] else 0.0)
+    let a,b = Service().dgels_(a,b)
+    Vector.init n (fun i -> b.[i,0])
+
+  /// Given A[n,n] real symmetric positive definite.
+  /// Finds the cholesky decomposition L such that L' * L = A.
+  /// May fail if not positive definite.
+  let Cholesky a = 
+    let n,_ = matrixDims a  
+    let b = Service().dpotrf_('U',a)
+    let b = Matrix.init n n (fun i j -> if j>=i then b.[i,j] else 0.0)
+    b
+  
+  /// Given A[n,n] real matrix.
+  /// Finds P,L,U such that L*U = P*A with L,U lower/upper triangular.
+  let LU a = 
+    // This method translates a BLAS/LAPACK permutation into an FSharp.Collections.Permutation.
+    // The BLAS/LAPACK permutation (P: int array) encodes that in step i, row i and P.[i] were
+    // swapped. 
+    let TranslatePermutation P =
+        let n = Array.length P
+        let x = [|0 .. n-1|]
+        for l=0 to n-1 do
+            let t = x.[l]
+            x.[l] <- x.[P.[l]]
+            x.[P.[l]] <- t
+        ((*n,*)Permutation.ofArray(x))
+    let n,m = matrixDims a  
+    let lu,p = Service().dgetrf_(a)
+    let l = Matrix.init n m (fun i j -> if j<i then lu.[i,j] elif j = i then 1.0 else 0.0)
+    let u = Matrix.init n m (fun i j -> if j>=i then lu.[i,j] else 0.0)
+    p |> Array.map (fun i -> i-1) |> TranslatePermutation,l,u
+
+  /// Given A[m,n] finds Q[m,m] and R[k,n] where k = min m n.
+  /// Have A = Q.R  when m<=n.
+  /// Have A = Q.RX when m>n and RX[m,n] is R[n,n] row extended with (m-n) zero rows.
+  let QR a = 
+    let m,n = matrixDims a
+    let k = min m n 
+    let res,tau = Service().dgeqrf_(a)
+    let R  = Matrix.init k n (fun r c -> if r <= c then res.[r,c] else 0.0)
+    let ks = [| 0 .. (k-1) |]
+    let vs = ks |> Array.map (fun i -> Vector.init m (fun j -> if j < i then 0.0 else
+                                                               if j = i then 1.0 else
+                                                               res.[j,i]))
+    let h (v:vector) tau = Matrix.identity m - (tau:float) * (v * v.Transpose)
+    let hs = Array.map2 h vs tau
+    let Q  = Array.reduceBack ( * ) hs
+    Q,R (*,tau,vs,hs*)
+
+  let SVD a = 
+    let vs,u,w = Service().dgesvd_ a
+    u,vs,w
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/regen.bat b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/regen.bat
new file mode 100644
index 0000000..8fd34fd
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/regen.bat
@@ -0,0 +1,3 @@
+..\..\..\..\..\bin\fsc code_generator.fs
+code_generator.exe
+del code_generator.exe
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fs
new file mode 100644
index 0000000..10756fb
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fs
@@ -0,0 +1,165 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Experimental
+
+// NOTE: Abstractable code.
+//   This file is a Service/Provider model cache with pre-checks that supporting DLLs are available.
+//   This is not LAPACK specific, and is more generally useful.
+//   It has been abstracted over the underlying service type (ILapack becomes 'a).
+//   The providers could have other pre-conditions, e.g. machine architecture, OS, etc.
+
+open Microsoft.FSharp.Collections
+open System.IO
+open System.Collections.Generic
+ 
+/// Generic provider with unmanaged DLL dependencies.
+type Provider<'a>(name:string,requiredDLLs:string[],provide:unit -> 'a) = 
+    // NOTE: The dependencies could be extended to include architecture.
+    member this.Name         = name 
+    member this.RequiredDLLs = requiredDLLs
+    member this.Provide()    = provide()   
+  
+module Locals =     
+    let mkProvider (name,requireDLLs,provide) = Provider(name,requireDLLs,provide) 
+    
+    let noRepeats xs = xs |> Set.ofList |> Set.toList
+    let noLaterRepeats xs =
+      let collect (soFar,revXs) x =
+        if Set.contains x soFar then (soFar,revXs) else (Set.add x soFar,x::revXs)
+      let (_,revXs) = List.fold collect (Set.empty,[]) xs
+      List.rev revXs
+    
+    let searchPathsForDLLImports() =         
+      // The providers have DLL dependencies via their platform-invoke DLLImport attributes.
+      // The DLLs search procedure for those DLLs is described below. (follow links).
+      // Here, we compute those paths (a superset of them).
+      // 
+      // From: VC++ Programming Guide: Search Path Used by Windows to Locate a DLL
+      //   http://msdn2.microsoft.com/en-us/library/7d83bc18(VS.80).aspx
+      //
+      // Search order:
+      //   The directory where the executable module for the current process is located.
+      //   The current directory.
+      //   The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
+      //   The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
+      //   The directories listed in the PATH environment variable.
+      //
+      // From: Development Impacts of Security Changes in Windows Server 2003
+      //   http://msdn2.microsoft.com/en-us/library/ms972822.aspx
+      // This reports that system directories are now searched first.
+      //
+      let windowsSystemDir = System.Environment.SystemDirectory
+      let windowsDir       = System.IO.Path.GetDirectoryName(windowsSystemDir)
+      let currentExeDirs   =
+        // This includes EXE directory, and loaded DLL directories.
+        // It may be an over-estimate of the search path.
+        let proc = System.Diagnostics.Process.GetCurrentProcess()
+        let mods  : System.Diagnostics.ProcessModule list = proc.Modules |> Seq.cast |> Seq.toList
+        mods     |> List.map (fun m -> Path.GetDirectoryName m.FileName) |> noRepeats
+      let currentDir = System.Environment.CurrentDirectory 
+      let pathDirs =
+        match System.Environment.GetEnvironmentVariable("PATH") with
+        | null  -> []
+        | paths -> paths.Split([|';'|]) |> Array.toList      
+      let orderedSearchPaths = windowsSystemDir :: windowsDir :: (currentExeDirs @ [currentDir] @ pathDirs)
+      noLaterRepeats orderedSearchPaths
+    
+    let pathDLLs (path:string) = if not (Directory.Exists path) then [||] else Directory.GetFiles(path,"*.DLL")       
+    
+    let dllFilename (dll:string) = (Path.GetFileName dll).ToLower() // normalizes filename
+        
+    let loadableDLLPaths() =
+      // Makes a table of (DLL,availablePaths)
+      // This is reusable code...
+      let paths = searchPathsForDLLImports()
+      let dllPaths = new Dictionary<string,ResizeArray<string>>()
+      let add path dll = 
+        let dll = dllFilename dll
+        if not (dllPaths.ContainsKey(dll)) then dllPaths.[dll] <- new ResizeArray<_>()
+        dllPaths.[dll].Add(path)
+      List.iter (fun path -> Array.iter (add path) (pathDLLs path)) paths
+      dllPaths
+
+    let loadableProvider (dllPaths:Dictionary<_,_>) (provider:Provider<'a>) = 
+      let dllAvailable    (dll:string) = dllPaths.ContainsKey(dllFilename dll)
+      let availableReason (dll:string) = let quote s = "'" + s + "'"
+                                         let paths = dllPaths.[dllFilename dll] |> ResizeArray.toList
+                                         let pathNote path = sprintf "Required %s seen in %s" dll path
+                                         System.String.Join("\n", Array.ofList(List.map pathNote paths))
+      if Array.forall dllAvailable provider.RequiredDLLs then
+        let justification = System.String.Join("\n", Array.map availableReason provider.RequiredDLLs)
+        let justification = "Provider: " ^ provider.Name ^ "\n" ^ justification
+        Some (provider,justification)
+      else
+        None
+        
+    let checkProvider p = 
+      match loadableProvider (loadableDLLPaths()) p with
+      | None                   -> "Provider is not loadable"
+      | Some (p,justification) -> justification
+        
+    // This type is internal to Service (motivates nested types).
+    type 'a ServiceState =
+    | ServiceDisabled                          // service disabled, do not look for it.
+    | ServiceEnabledUninitialised              // service enabled, but no search made yet.
+    | ServiceEnabledOK     of 'a * string      // service enabled, and justification string for diagnostics.
+    | ServiceEnabledFailed                     // service enabled, but DLLs not found, or load failed.
+
+open Locals
+  
+type Provider<'a> with
+    member this.Check() = checkProvider this
+
+type Service<'a>(providers:Provider<'a> seq) =
+    let mutable providers = Seq.toArray providers                // possible providers configuration state
+    let mutable state = ServiceEnabledUninitialised               // service state
+    
+    /// Service Providers
+    member this.Providers with get()  = providers
+                           and set(x) = providers <- x
+    
+    /// Disable the service.
+    member this.Stop()       = state <- ServiceDisabled
+
+    /// Use the LAPACK service from the given provider.
+    /// If the supporting DLLs are not available, this may fail (now or later).
+    member this.StartWith(p:Provider<'a>) =
+      let justification = 
+          match loadableProvider (loadableDLLPaths()) p with
+          | None                   -> "The provider DLLs did not appear to be present, the service may fail"
+          | Some (p,justification) -> justification      
+      state <- ServiceEnabledOK (p.Provide(),justification)
+
+    /// Start the service with the first provider that looks loadable.     
+    member this.Start() =
+      let candidates = Array.choose (loadableProvider (loadableDLLPaths())) providers
+      if candidates.Length=0 then                                     // guard
+        state <- ServiceEnabledFailed
+        false
+      else
+        let provider,justification = candidates.[0]
+        state <- ServiceEnabledOK (provider.Provide(),justification)  // index covered by guard above
+        true
+
+    member this.Service() = 
+      match state with
+      | ServiceEnabledUninitialised -> this.Start() |> ignore
+      | _ -> ()
+      match state with
+        | ServiceDisabled                          
+        | ServiceEnabledUninitialised  // (The above initialisation call must have failed)
+        | ServiceEnabledFailed                     -> None
+        | ServiceEnabledOK (service,justification) -> Some service
+    
+    member this.Available() =         
+      match state with
+        | ServiceDisabled            
+        | ServiceEnabledFailed        
+        | ServiceEnabledUninitialised              -> false
+        | ServiceEnabledOK (service,justification) -> true
+                        
+    member this.Status() =         
+      match state with
+        | ServiceDisabled                          -> "Disabled"           
+        | ServiceEnabledFailed                     -> "Failed to start"
+        | ServiceEnabledUninitialised              -> "Will auto enable on demand"
+        | ServiceEnabledOK (service,justification) -> "Enabled\n" ^ justification
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fsi
new file mode 100644
index 0000000..e6fe1ef
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/lapack/service.fsi
@@ -0,0 +1,19 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Math.Experimental
+
+type Provider<'a> =
+    new : name:string * requiredDLLs:string [] * provide:(unit -> 'a) -> Provider<'a>
+    member Provide : unit -> 'a
+    member Name : string
+    member RequiredDLLs : string []
+    member Check : unit -> string  
+  
+type Service<'a> =
+    new : providers:seq<Provider<'a>> -> Service<'a>
+    member Start     : unit -> bool
+    member StartWith : p:Provider<'a> -> unit
+    member Stop      : unit -> unit
+    member Service   : unit -> 'a option
+    member Available : unit -> bool
+    member Status    : unit -> string
+    member Providers : Provider<'a> array with get,set
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fs
new file mode 100644
index 0000000..f6e7588
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fs
@@ -0,0 +1,2567 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+//----------------------------------------------------------------------------
+// An implementation of generic dense and sparse matrix types.
+//
+// Overview and suffix documentation
+//    _GU  = generic unspecialized (Matrix<T>, Vector<T> etc.) 
+//    _GUA = generic unspecialized op on (underlying) array
+//    _DS  = Double specialized (Matrix<float> = matrix, Vector<float> = vector etc.)
+//
+//    DM   = dense matrix
+//    SM   = sparse matrix
+//    V    = vector (dense)
+//    RV   = row vector (dense)
+
+
+namespace Microsoft.FSharp.Math
+
+    #nowarn "60" // implementations in augmentations
+    #nowarn "69" // implementations in augmentations
+
+    open Microsoft.FSharp.Math
+    open System
+    open System.Globalization
+    open System.Collections
+    open System.Collections.Generic
+    open System.Diagnostics
+    type permutation = int -> int
+
+
+//=========================================================================
+// (c) Microsoft Corporation 2005-2009. 
+//=========================================================================
+
+    module Helpers = 
+        let sparseNYI() = failwith "this operation is not supported on sparse matrices"
+        let sparseNotMutable() = failwith "sparse matrices are not mutable"
+        
+        [<RequiresExplicitTypeArguments>]
+        let opsdata<'T> = GlobalAssociations.TryGetNumericAssociation<'T>()
+    
+    open Helpers
+    
+    /// The value stored for the dictionary of numeric operations. If none is present then this indicates
+    /// no operations are known for this type.
+    type OpsData<'T> = INumeric<'T> option
+
+    type DenseMatrix<'T>(opsData : OpsData<'T>, values : 'T[,]) = 
+        member m.OpsData =  opsData
+        member m.Values =  values
+        member m.NumRows = values.GetLength(0)
+        member m.NumCols = values.GetLength(1)
+
+        member m.ElementOps = 
+            match opsData with 
+            | None -> raise (new System.NotSupportedException("The element type carried by this matrix does not support numeric operations"))
+            | Some a -> a
+
+        member m.Item
+           with get (i,j) = values.[i,j]
+           and  set (i,j) x = values.[i,j] <- x
+
+
+
+    type SparseMatrix<'T>(opsData : OpsData<'T>, sparseValues : 'T array, sparseRowOffsets : int array, ncols:int, columnValues: int array) = 
+        member m.OpsData = opsData; 
+        member m.NumCols = ncols
+        member m.NumRows = sparseRowOffsets.Length - 1
+        member m.SparseColumnValues = columnValues
+        member m.SparseRowOffsets =  sparseRowOffsets (* nrows + 1 elements *)
+        member m.SparseValues =  sparseValues
+
+        member m.ElementOps = 
+              match opsData with 
+              | None -> raise (new System.NotSupportedException("The element type carried by this matrix does not support numeric operations"))
+              | Some a -> a
+
+        member m.MinIndexForRow i = m.SparseRowOffsets.[i]
+        member m.MaxIndexForRow i = m.SparseRowOffsets.[i+1]
+              
+
+        member m.Item 
+            with get (i,j) = 
+                let imax = m.NumRows
+                let jmax = m.NumCols
+                if j < 0 || j >= jmax || i < 0 || i >= imax then raise (new System.ArgumentOutOfRangeException()) else
+                let kmin = m.MinIndexForRow i
+                let kmax = m.MaxIndexForRow i
+                let rec loopRow k =
+                    (* note: could do a binary chop here *)
+                    if k >= kmax then m.ElementOps.Zero else
+                    let j2 = columnValues.[k]
+                    if j < j2 then m.ElementOps.Zero else
+                    if j = j2 then sparseValues.[k] else 
+                    loopRow (k+1)
+                loopRow kmin
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+    [<System.Diagnostics.DebuggerDisplay("{DebugDisplay}")>]
+#endif
+    [<StructuredFormatDisplay("matrix {StructuredDisplayAsArray}")>]
+    [<CustomEquality; CustomComparison>]
+    //[<System.Diagnostics.DebuggerTypeProxy(typedefof<MatrixDebugView<_>>)>]
+    type Matrix<'T> = 
+        | DenseRepr of DenseMatrix<'T>
+        | SparseRepr of SparseMatrix<'T>
+        interface System.IComparable
+        interface IStructuralComparable
+        interface IStructuralEquatable
+        interface IEnumerable<'T> 
+        interface IEnumerable
+
+        member m.ElementOps = match m with DenseRepr mr -> mr.ElementOps | SparseRepr mr -> mr.ElementOps
+        member m.NumRows    = match m with DenseRepr mr -> mr.NumRows    | SparseRepr mr ->  mr.NumRows
+        member m.NumCols    = match m with DenseRepr mr -> mr.NumCols    | SparseRepr mr ->  mr.NumCols
+
+        member m.Item 
+            with get (i,j) = 
+                match m with 
+                | DenseRepr dm -> dm.[i,j]
+                | SparseRepr sm -> sm.[i,j]
+            and set (i,j) x = 
+              match m with 
+              | DenseRepr dm -> dm.[i,j] <- x
+              | SparseRepr _ -> sparseNotMutable()
+
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.IsDense = match m with DenseRepr _ -> true | SparseRepr _ -> false
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.IsSparse = match m with DenseRepr _ -> false | SparseRepr _ -> true
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.InternalSparseColumnValues = match m with DenseRepr _ -> invalidOp "not a sparse matrix" | SparseRepr mr -> mr.SparseColumnValues
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.InternalSparseRowOffsets = match m with DenseRepr _ -> invalidOp "not a sparse matrix" | SparseRepr mr -> mr.SparseRowOffsets
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.InternalSparseValues = match m with DenseRepr _ -> invalidOp "not a sparse matrix" | SparseRepr mr -> mr.SparseValues
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member m.InternalDenseValues = match m with DenseRepr mr -> mr.Values | SparseRepr _ -> invalidOp "not a dense matrix"
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+    [<System.Diagnostics.DebuggerDisplay("{DebugDisplay}")>]
+#endif
+#if FX_NO_DEBUG_PROXIES
+#else
+    [<System.Diagnostics.DebuggerTypeProxy(typedefof<RowVectorDebugView<_>>)>]
+#endif
+    [<StructuredFormatDisplay("rowvec {StructuredDisplayAsArray}")>]
+    [<Sealed>]
+    type RowVector<'T>(opsRV : INumeric<'T> option, arrRV : 'T array ) =
+        interface System.IComparable
+        interface IStructuralComparable
+        interface IStructuralEquatable 
+
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member x.InternalValues = arrRV
+        member x.Values = arrRV
+        member x.OpsData = opsRV
+        
+        
+        interface IEnumerable<'T> with 
+            member x.GetEnumerator() = (arrRV :> seq<_>).GetEnumerator()
+        interface IEnumerable  with 
+            member x.GetEnumerator() = (arrRV :> IEnumerable).GetEnumerator()
+
+        member x.Length = arrRV.Length
+        member x.NumCols = arrRV.Length
+        member x.ElementOps = 
+            match opsRV with 
+            | None -> raise (new System.NotSupportedException("The element type carried by this row vector does not support numeric operations"))
+            | Some a -> a
+
+        member v.Item
+           with get i = arrRV.[i]
+           and  set i x = arrRV.[i] <- x
+
+    and 
+        [<Sealed>]
+        RowVectorDebugView<'T>(v: RowVector<'T>)  =  
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+             [<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)>]
+#endif
+             member x.Items = v |> Seq.truncate 1000 |> Seq.toArray 
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+    [<System.Diagnostics.DebuggerDisplay("{DebugDisplay}")>]
+#endif
+#if FX_NO_DEBUG_PROXIES
+#else
+    [<System.Diagnostics.DebuggerTypeProxy(typedefof<VectorDebugView<_>>)>]
+#endif
+    [<StructuredFormatDisplay("vector {StructuredDisplayAsArray}")>]
+    [<Sealed>]
+    type Vector<'T>(opsV : INumeric<'T> option, arrV : 'T array) =
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member x.InternalValues = arrV
+        member x.Values = arrV
+        member x.OpsData = opsV
+        interface System.IComparable
+        interface IStructuralComparable
+        interface IStructuralEquatable 
+
+        interface IEnumerable<'T> with 
+            member x.GetEnumerator() = (arrV :> seq<_>).GetEnumerator()
+        interface IEnumerable  with 
+            member x.GetEnumerator() = (arrV :> IEnumerable).GetEnumerator()
+        
+
+        member m.Length = arrV.Length
+        member m.NumRows = arrV.Length
+        member m.ElementOps = 
+            match opsV with 
+            | None -> raise (new System.NotSupportedException("The element type carried by this vector does not support numeric operations"))
+            | Some a -> a
+        member v.Item
+           with get i = arrV.[i]
+           and  set i x = arrV.[i] <- x
+
+#if FX_NO_DEBUG_PROXIES
+#else
+    and 
+        [<Sealed>]
+        VectorDebugView<'T>(v: Vector<'T>)  =  
+
+             [<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)>]
+             member x.Items = v |> Seq.truncate 1000 |> Seq.toArray 
+#endif
+
+
+    /// Implementations of operations that will work for any type
+    module GenericImpl = 
+
+        type OpsData<'T> = INumeric<'T> option
+
+        let opsOfOpsData (d : OpsData<'T>)  =
+             match d with 
+             | None -> raise (new System.NotSupportedException("The element type '"+(typeof<'T>).ToString()+"' carried by this vector or matrix does not support numeric operations (i.e. does not have a registered numeric association)"))
+             | Some a -> a
+
+        let getNormOps (ops:INumeric<'T>) = 
+            match box ops with
+              | :? INormFloat<'T> as ops -> ops
+              | _ -> raise (new System.NotSupportedException("The element type '"+(typeof<'T>.ToString())+"' carried by this vector or matrix does not support the INormFloat<_> operation (i.e. does not have a registered numeric association that supports this type)"))
+
+        let mkDenseMatrixGU ops arr = DenseMatrix(ops,arr)
+        let mkRowVecGU ops arr = RowVector(ops, arr)
+        let mkVecGU ops arr = Vector(ops,arr)
+
+        let inline getArray2D  (arrDM : _[,]) i j   = arrDM.[i,j]
+        let inline setArray2D  (arrDM  : _[,]) i j x = arrDM.[i,j] <- x
+
+        let inline createArray m = Array.zeroCreate m
+
+        let inline createArray2D m n = Array2D.zeroCreate m n
+
+        let inline assignArray2D m n f arr =  
+            for i = 0 to m - 1 do 
+                for j = 0 to n - 1 do 
+                    (arr  : _[,]).[i,j] <- f i j
+
+        let inline assignConstArray2D m n x arr =  
+            for i = 0 to m - 1 do 
+                for j = 0 to n - 1 do 
+                    (arr  : _[,]).[i,j] <- x
+
+        let inline assignDenseMatrixGU f (a:DenseMatrix<_>) = 
+            assignArray2D a.NumRows a.NumCols f a.Values
+        
+        let inline assignArray m f (arr : _[]) = 
+            for i = 0 to m - 1 do 
+                arr.[i] <- f i
+
+        let inline assignConstArray m x (arr : _[]) = 
+            for i = 0 to m - 1 do 
+                arr.[i] <- x
+
+        let inline assignVecGU f (a:Vector<_>) = 
+            assignArray a.NumRows f a.Values
+        
+        let inline assignRowVecGU f (a:RowVector<_>) = 
+            assignArray a.NumCols f a.Values
+        
+        let createConstDenseMatrixGU ops m n x = 
+            let arr = createArray2D m n 
+            assignConstArray2D m n x arr;
+            DenseMatrix(ops,arr)
+        
+        let createConstRowVecGU ops m x = 
+            let arr = createArray m 
+            assignConstArray m x arr;
+            mkRowVecGU ops arr
+        
+        let createConstVecGU ops m x = 
+            let arr = createArray m 
+            assignConstArray m x arr;
+            mkVecGU ops arr
+
+
+        let inline createDenseMatrixGU ops m n f = (* inline eliminates unknown f call *)
+            let arr = createArray2D m n 
+            assignArray2D m n f arr;
+            DenseMatrix(ops,arr)
+        
+        let createRowVecGU ops m f = 
+            let arr = createArray m 
+            assignArray m f arr;
+            mkRowVecGU ops arr
+        
+        let inline createVecGU ops m f = (* inline eliminates unknown f call *)
+            let arr = createArray m 
+            assignArray m f arr;
+            mkVecGU ops arr
+
+        /// Create a matrix from a sparse sequence 
+        let initSparseMatrixGU maxi maxj ops s = 
+
+            (* nb. could use sorted dictionary but that is in System.dll *)
+            let tab = Array.create maxi null
+            let count = ref 0
+            for (i,j,v) in s do
+                if i < 0 || i >= maxi || j <0 || j >= maxj then failwith "initial value out of range";
+                count := !count + 1;
+                let tab2 = 
+                    match tab.[i] with 
+                    | null -> 
+                        let tab2 = new Dictionary<_,_>(3) 
+                        tab.[i] <- tab2;
+                        tab2
+                    | tab2 -> tab2
+                tab2.[j] <- v
+            // optimize this line....
+            let offsA =  
+               let rowsAcc = Array.zeroCreate (maxi + 1)
+               let mutable acc = 0 
+               for i = 0 to maxi-1 do 
+                  rowsAcc.[i] <- acc;
+                  acc <- match tab.[i] with 
+                          | null -> acc
+                          | tab2 -> acc+tab2.Count
+               rowsAcc.[maxi] <- acc;
+               rowsAcc
+               
+            let colsA,valsA = 
+               let colsAcc = new ResizeArray<_>(!count)
+               let valsAcc = new ResizeArray<_>(!count)
+               for i = 0 to maxi-1 do 
+                  match tab.[i] with 
+                  | null -> ()
+                  | tab2 -> tab2 |> Seq.toArray |> Array.sortBy (fun kvp -> kvp.Key) |> Array.iter (fun kvp -> colsAcc.Add(kvp.Key); valsAcc.Add(kvp.Value));
+               colsAcc.ToArray(), valsAcc.ToArray()
+
+            SparseMatrix(opsData=ops, sparseValues=valsA, sparseRowOffsets=offsA, ncols=maxj, columnValues=colsA)
+        
+        let zeroizeDenseMatrixGUA arr  m n : DenseMatrix<'T> = 
+            let opsData = opsdata<'T> 
+            let ops = opsOfOpsData opsData 
+            let zero = ops.Zero 
+            assignArray2D m n (fun _ _ -> zero) arr;
+            DenseMatrix(opsData,arr)
+
+        let zeroizeArray opsData arr m  = 
+            let ops = opsOfOpsData opsData 
+            let zero = ops.Zero 
+            assignArray m (fun _ -> zero) arr
+
+        let zeroizeVecGUA arr m  : Vector<'T> = 
+            let opsData = opsdata<'T> 
+            zeroizeArray opsData arr m;
+            mkVecGU opsData arr
+
+        let zeroizeRowVecGUA arr m  : RowVector<'T> = 
+            let opsData = opsdata<'T> 
+            zeroizeArray opsData arr m;
+            mkRowVecGU opsData arr
+
+        let listDenseMatrixGU ops xss =
+            let m = List.length xss
+            match xss with 
+            | [] -> invalidArg "xss" "unexpected empty list"
+            | h :: t -> 
+              let n = List.length h
+              if not (List.forall (fun xs -> List.length xs=n) t) then invalidArg "xss" "the lists are not all of the same length";
+              let values = Array2D.zeroCreate m n
+              List.iteri (fun i rw -> List.iteri (fun j x -> values.[i,j] <- x) rw) xss;
+              DenseMatrix(ops,values)
+        
+        let listRowVecGU ops xs = mkRowVecGU ops (Array.ofList xs) 
+        let listVecGU ops xs = mkVecGU ops (Array.ofList xs) 
+
+        let seqDenseMatrixGU ops xss = listDenseMatrixGU ops (xss |> Seq.toList |> List.map Seq.toList)
+        let seqVecGU  ops xss = listVecGU ops (xss |> Seq.toList)
+        let seqRowVecGU ops xss = listRowVecGU ops (xss |> Seq.toList)
+
+        let inline binaryOpDenseMatrixGU f (a:DenseMatrix<_>) (b:DenseMatrix<_>) = (* pointwise binary operator *)
+            let nA = a.NumCols
+            let mA = a.NumRows
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA<>nB || mA<>mB then invalidArg "a" "the two matrices do not have compatible dimensions";
+            let arrA = a.Values 
+            let arrB = b.Values 
+            createDenseMatrixGU a.OpsData mA nA (fun i j -> f (getArray2D arrA i j) (getArray2D arrB i j))
+
+
+        let nonZeroEntriesSparseMatrixGU  (a:SparseMatrix<_>) = 
+            // This is heavily used, and this version is much faster than
+            // the sequence operators.
+            let entries = new ResizeArray<_>(a.SparseColumnValues.Length)
+            let imax = a.NumRows
+            let ops = a.ElementOps 
+            let zero = ops.Zero
+            for i in 0 .. imax - 1 do
+              let kmin = a.MinIndexForRow i
+              let kmax = a.MaxIndexForRow i
+              for k in kmin .. kmax - 1 do
+                  let j = a.SparseColumnValues.[k]
+                  let v = a.SparseValues.[k]
+                  if not (ops.Equals(v,zero)) then
+                    entries.Add((i,j,v))
+            (entries :> seq<_>)
+
+        let nonzeroEntriesDenseMatrixGU  (a:DenseMatrix<_>) = 
+            let imax = a.NumRows
+            let jmax = a.NumCols
+            let ops = a.ElementOps 
+            let zero = ops.Zero
+            seq { for i in 0 .. imax - 1 do 
+                    for j in 0 .. jmax - 1 do 
+                        let v = a.[i,j] 
+                        if not (ops.Equals(v, zero)) then
+                             yield (i,j,v) }
+
+
+        // pointwise operation on two sparse matrices. f must be zero-zero-preserving, i.e. (f 0 0 = 0) 
+        let binaryOpSparseMatrixGU f (a:SparseMatrix<_>) (b:SparseMatrix<_>) = 
+            let ops = a.ElementOps 
+            let zero = ops.Zero
+            let imax1 = a.NumRows  
+            let imax2 = b.NumRows
+            let jmax1 = a.NumCols
+            let jmax2 = b.NumCols
+            if imax1 <> imax2 || jmax1 <> jmax2 then invalidArg "b" "the two matrices do not have compatible dimensions";
+            let imin = 0
+            let imax = imax1
+            let jmax = jmax1
+            let rowsR = Array.zeroCreate (imax+1)
+            let colsR = new ResizeArray<_>(max a.SparseColumnValues.Length b.SparseColumnValues.Length)
+            let valsR = new ResizeArray<_>(max a.SparseValues.Length b.SparseValues.Length)
+            let rec loopRows i  = 
+                rowsR.[i] <- valsR.Count;            
+                if i >= imax1 then () else
+                let kmin1 = a.MinIndexForRow i
+                let kmax1 = a.MaxIndexForRow i 
+                let kmin2 = b.MinIndexForRow i
+                let kmax2 = b.MaxIndexForRow i
+                let rec loopRow k1 k2  =
+                    if k1 >= kmax1 && k2 >= kmax2 then () else
+                    let j1 = if k1 >= kmax1 then jmax else a.SparseColumnValues.[k1]
+                    let j2 = if k2 >= kmax2 then jmax else b.SparseColumnValues.[k2]
+                    let v1 = if j1 <= j2 then a.SparseValues.[k1] else zero
+                    let v2 = if j2 <= j1 then b.SparseValues.[k2] else zero
+                    let jR = min j1 j2
+                    let vR = f v1 v2
+                    (* if vR <> zero then  *)
+                    colsR.Add(jR);
+                    valsR.Add(vR);
+                    loopRow (if j1 <= j2 then k1+1 else k1) (if j2 <= j1 then k2+1 else k2)
+                loopRow kmin1 kmin2;
+                loopRows (i+1) 
+            loopRows imin;
+            SparseMatrix(opsData= a.OpsData, 
+                         sparseRowOffsets=rowsR, 
+                         ncols= a.NumCols, 
+                         columnValues=colsR.ToArray(), 
+                         sparseValues=valsR.ToArray())
+
+        let inline binaryOpRowVecGU f (a:RowVector<_>) (b:RowVector<_>) = (* pointwise binary operator *)
+            let mA = a.NumCols
+            let mB = b.NumCols
+            if mA<>mB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            createRowVecGU a.OpsData mA (fun i -> f a.[i] b.[i])
+
+        let inline binaryOpVecGU f (a:Vector<_>) (b:Vector<_>) = (* pointwise binary operator *)
+            let mA = a.NumRows
+            let mB = b.NumRows
+            if mA<>mB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            createVecGU a.OpsData mA (fun i -> f a.[i] b.[i])
+
+        let inline unaryOpDenseMatrixGU f (a:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let arrA = a.Values 
+            createDenseMatrixGU a.OpsData mA nA (fun i j -> f (getArray2D arrA i j))
+
+        let inline unaryOpRowVecGU f (a:RowVector<_>) =
+            let mA = a.NumCols
+            let arrA = a.Values 
+            createRowVecGU a.OpsData mA (fun j -> f arrA.[j])
+
+        let inline unaryOpVectorGU f (a:Vector<_>) =
+            let mA = a.NumRows 
+            let arrA = a.Values 
+            createVecGU a.OpsData mA (fun i -> f arrA.[i])
+
+        let unaryOpSparseGU f (a:SparseMatrix<_>) = (* pointwise zero-zero-preserving binary operator (f 0 = 0) *)
+            SparseMatrix(opsData=a.OpsData,
+                         sparseRowOffsets=Array.copy a.SparseRowOffsets, 
+                         columnValues=Array.copy a.SparseColumnValues, 
+                         sparseValues=Array.map f a.SparseValues, 
+                         ncols=a.NumCols)
+
+        // Strictly speaking, sparse arrays are non mutable so no copy is ever needed. But implementing it *)
+        // anyway in case we move to mutability *)
+        let copySparseGU (a:SparseMatrix<_>) = 
+            SparseMatrix(opsData=a.OpsData,
+                         sparseRowOffsets=Array.copy a.SparseRowOffsets, 
+                         columnValues=Array.copy a.SparseColumnValues,
+                         sparseValues=Array.copy a.SparseValues, 
+                         ncols=a.NumCols)
+
+        let addDenseMatrixGU  (a:DenseMatrix<_>)  b = let ops = a.ElementOps in binaryOpDenseMatrixGU (fun x y -> ops.Add(x, y)) a b
+        let addSparseMatrixGU (a:SparseMatrix<_>) b = let ops = a.ElementOps in binaryOpSparseMatrixGU (fun x y -> ops.Add(x, y)) a b
+        let addRowVecGU       (a:RowVector<_>)    b = let ops = a.ElementOps in binaryOpRowVecGU (fun x y -> ops.Add(x, y)) a b
+        let addVecGU          (a:Vector<_>)       b = let ops = a.ElementOps in binaryOpVecGU  (fun x y -> ops.Add(x, y)) a b 
+
+        let subDenseMatrixGU  (a:DenseMatrix<_>)  b = let ops = a.ElementOps in binaryOpDenseMatrixGU (fun x y -> ops.Subtract(x, y)) a b
+        let subSparseMatrixGU (a:SparseMatrix<_>) b = let ops = a.ElementOps in binaryOpSparseMatrixGU (fun x y -> ops.Subtract(x, y)) a b
+        let subRowVecGU       (a:RowVector<_>)    b = let ops = a.ElementOps in binaryOpRowVecGU (fun x y -> ops.Subtract(x, y)) a b
+        let subVecGU          (a:Vector<_>)       b = let ops = a.ElementOps in binaryOpVecGU  (fun x y -> ops.Subtract(x, y)) a b 
+
+        ///Point-wise multiplication 
+        let cptMulDenseMatrixGU  (a:DenseMatrix<_>)  b = let ops = a.ElementOps in binaryOpDenseMatrixGU  (fun x y -> ops.Multiply(x, y)) a b
+        let cptMulSparseMatrixGU (a:SparseMatrix<_>) b = let ops = a.ElementOps in binaryOpSparseMatrixGU  (fun x y -> ops.Multiply(x, y)) a b
+        let cptMulRowVecGU       (a:RowVector<_>)    b = let ops = a.ElementOps in binaryOpRowVecGU (fun x y -> ops.Multiply(x, y)) a b
+        let cptMulVecGU          (a:Vector<_>)       b = let ops = a.ElementOps in binaryOpVecGU  (fun x y -> ops.Multiply(x, y)) a b
+
+        let cptMaxDenseMatrixGU  (a:DenseMatrix<_>) b = binaryOpDenseMatrixGU  max a b
+        let cptMinDenseMatrixGU  (a:DenseMatrix<_>) b = binaryOpDenseMatrixGU  min a b
+        let cptMaxSparseMatrixGU (a:SparseMatrix<_>) b = binaryOpSparseMatrixGU  max a b
+        let cptMinSparseMatrixGU (a:SparseMatrix<_>) b = binaryOpSparseMatrixGU  min a b
+
+        let cptMaxVecGU (a:Vector<_>) b = binaryOpVecGU max a b
+        let cptMinVecGU (a:Vector<_>) b = binaryOpVecGU min a b
+
+        let add (ops : INumeric<'T>) x y = ops.Add(x,y) 
+        let sub (ops : INumeric<'T>) x y = ops.Subtract(x,y) 
+        let mul (ops : INumeric<'T>) x y = ops.Multiply(x,y) 
+
+        let inline foldR f z (a,b) = 
+            let mutable res = z in
+            for i = a to b do
+                res <- f res i
+            res
+
+        let inline sumfR f (a,b) =
+            let mutable res = 0.0 
+            for i = a to b do
+                res <- res + f i
+            res
+          
+
+        let inline sumRGU (ops : INumeric<_>) f r = 
+            let zero = ops.Zero 
+            r |> foldR (fun z k -> add ops z (f k)) zero
+
+        let genericMulDenseMatrix (a:DenseMatrix<_>) (b:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA<>mB then invalidArg "b" "the two matrices do not have compatible dimensions"
+            let ops = a.ElementOps 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            createDenseMatrixGU a.OpsData mA nB
+              (fun i j -> (0,nA - 1) |> sumRGU ops (fun k -> mul ops (getArray2D arrA i k) (getArray2D arrB k j)))
+
+        let debug = false
+        
+        // SParse matrix multiplication algorithm. inline to get specialization at the 'double' type
+        let inline genericMulSparse zero add mul (a:SparseMatrix<_>) (b:SparseMatrix<_>) =
+            let nA = a.NumCols
+            let mA = a.NumRows
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA<>mB then invalidArg "b" "the two matrices do not have compatible dimensions"
+            let C = new ResizeArray<_>()
+            let jC = new ResizeArray<_>()
+            let MA1 = mA + 1 
+            let offsAcc = Array.zeroCreate MA1
+            let index = Array.zeroCreate mA
+            let temp = Array.create mA zero
+            let ptr = new Dictionary<_,_>(11)
+            if debug then printf "start, #items in result = %d, #offsAcc = %d, mA = %d\n" jC.Count offsAcc.Length mA;
+
+            let mutable mlast = 0
+            for i = 0 to mA-1 do
+                if debug then printf "i = %d, mlast = %d\n" i mlast;
+                offsAcc.[i] <- mlast
+                
+                let kmin1 = a.MinIndexForRow i
+                let kmax1 = a.MaxIndexForRow i
+                if kmin1 < kmax1 then 
+                    let mutable itemp = 0
+                    let mutable ptrNeedsClear = true // clear the ptr table on demand. 
+                    for j = kmin1 to kmax1 - 1 do
+                        if debug then printf "  j = %d\n" j;
+                        let ja_j = a.SparseColumnValues.[j]
+                        let kmin2 = b.MinIndexForRow ja_j
+                        let kmax2 = b.MaxIndexForRow ja_j
+                        for k = kmin2 to kmax2 - 1 do
+                            let jb_k = b.SparseColumnValues.[k]
+                            if debug then printf "    i = %d, j = %d, k = %d, ja_j = %d, jb_k = %d\n" i j k ja_j jb_k;
+                            let va = a.SparseValues.[j] 
+                            let vb = b.SparseValues.[k]
+                            if debug then printf "    va = %O, vb = %O\n" va vb;
+                            let summand = mul va vb
+                            if debug then printf "    summand = %O\n" summand;
+                            if ptrNeedsClear then (ptr.Clear();ptrNeedsClear <- false);
+
+                            if not (ptr.ContainsKey(jb_k)) then
+                                if debug then printf "    starting entry %d\n" jb_k;
+                                ptr.[jb_k] <- itemp
+                                let ptr_jb_k = itemp
+                                temp.[ptr_jb_k] <- summand
+                                index.[ptr_jb_k] <- jb_k
+                                itemp <- itemp + 1
+                            else
+                                if debug then printf "    adding to entry %d\n" jb_k;
+                                let ptr_jb_k = ptr.[jb_k]
+                                temp.[ptr_jb_k] <- add temp.[ptr_jb_k] summand
+                        done
+                    done
+                    if itemp > 0 then 
+                        // Sort by index. 
+                        // REVIEW: avoid the allocations here
+                        let sorted = (temp.[0..itemp-1],index.[0..itemp-1]) ||> Array.zip 
+                        Array.sortInPlaceBy (fun (_,idx) -> idx) sorted
+                        for s = 0 to itemp-1 do
+                            let (v,idx) = sorted.[s]
+                            if debug then printf "  writing value %O at index %d to result matrix\n" v idx;
+                            C.Add(v)
+                            jC.Add(idx)
+                        if debug then printf " itemp = %d, mlast = %d\n" itemp mlast;
+                        mlast <- mlast + itemp 
+            done
+            offsAcc.[mA] <- mlast;
+            if debug then printf "done, #items in result = %d, #offsAcc = %d, mA = %d\n" jC.Count offsAcc.Length mA;
+            SparseMatrix(opsData = a.OpsData,
+                         sparseRowOffsets=offsAcc,
+                         ncols= nB,
+                         columnValues=jC.ToArray(),
+                         sparseValues=C.ToArray())
+
+        let mulSparseMatrixGU (a: SparseMatrix<_>) b =
+            let ops = a.ElementOps 
+            let zero = ops.Zero
+            genericMulSparse zero (add ops) (mul ops) a b
+
+
+        let mulRowVecVecGU (a:RowVector<_>) (b:Vector<_>) =
+            let mA = a.NumCols 
+            let nB = b.NumRows 
+            if mA<>nB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            let ops = a.ElementOps 
+            (0,mA - 1) |> sumRGU ops (fun k -> mul ops a.[k] b.[k])
+
+        let rowvecDenseMatrixGU (x:RowVector<_>) = createDenseMatrixGU x.OpsData 1         x.NumCols (fun _ j -> x.[j]) 
+        let vectorDenseMatrixGU (x:Vector<_>)    = createDenseMatrixGU x.OpsData  x.NumRows 1         (fun i _ -> x.[i]) 
+
+        let mulVecRowVecGU a b = genericMulDenseMatrix (vectorDenseMatrixGU a) (rowvecDenseMatrixGU b)
+
+        let mulRowVecDenseMatrixGU (a:RowVector<_>) (b:DenseMatrix<_>) =
+            let    nA = a.NumCols 
+            let nB = b.NumCols
+            let mB = b.NumRows 
+            if nA<>mB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            let ops = a.ElementOps 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            createRowVecGU a.OpsData nB 
+              (fun j -> (0,nA - 1) |> sumRGU ops (fun k -> mul ops arrA.[k] (getArray2D arrB k j)))
+
+        let mulDenseMatrixVecGU (a:DenseMatrix<_>) (b:Vector<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let mB    = b.NumRows
+            if nA<>mB then invalidArg "b" "the two inputs do not have compatible dimensions"
+            let ops = b.ElementOps 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            createVecGU b.OpsData mA
+              (fun i -> (0,nA - 1) |> sumRGU ops (fun k -> mul ops (getArray2D arrA i k) arrB.[k]))
+
+        let mulSparseVecGU (a:SparseMatrix<_>) (b:Vector<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let mB    = b.NumRows 
+            if nA<>mB then invalidArg "b" "the two inputs do not have compatible dimensions"
+            let ops = b.ElementOps 
+            let zero = ops.Zero
+            createVecGU b.OpsData mA (fun i -> 
+                let mutable acc = zero
+                for k = a.MinIndexForRow i to a.MaxIndexForRow i - 1 do
+                    let j = a.SparseColumnValues.[k]
+                    let v = a.SparseValues.[k] 
+                    acc <- add ops acc (mul ops v b.[j]);
+                acc)
+
+        let mulRVSparseMatrixGU (a:RowVector<_>) (b:SparseMatrix<_>) =
+            let nA = b.NumCols
+            let mA = b.NumRows 
+            let mB    = a.NumCols 
+            if mA<>mB then invalidArg "b" "the two inputs do not have compatible dimensions"
+            let ops = b.ElementOps 
+            let arr = createArray nA 
+            zeroizeArray a.OpsData arr nA;
+            for i = 0 to mA - 1 do
+                for k = b.MinIndexForRow i to b.MaxIndexForRow i - 1 do
+                    let j = b.SparseColumnValues.[k]
+                    let v = b.SparseValues.[k] 
+                    arr.[j] <- add ops arr.[j] (mul ops a.[i] v)
+            mkRowVecGU a.OpsData arr
+
+
+        let scaleDenseMatrixGU  k (a:DenseMatrix<_>)  = let ops = a.ElementOps in unaryOpDenseMatrixGU (fun x -> ops.Multiply(k,x)) a
+        let scaleRowVecGU       k (a:RowVector<_>)    = let ops = a.ElementOps in unaryOpRowVecGU (fun x -> ops.Multiply(k,x)) a
+        let scaleVecGU          k (a:Vector<_>)       = let ops = a.ElementOps in unaryOpVectorGU  (fun x -> ops.Multiply(k,x)) a
+        let scaleSparseMatrixGU k (a:SparseMatrix<_>) = let ops = a.ElementOps in unaryOpSparseGU (fun x -> ops.Multiply(k,x)) a
+        let negDenseMatrixGU  (a:DenseMatrix<_>)  = let ops = a.ElementOps in unaryOpDenseMatrixGU (fun x -> ops.Negate(x)) a
+        let negRowVecGU       (a:RowVector<_>)    = let ops = a.ElementOps in unaryOpRowVecGU (fun x -> ops.Negate(x)) a
+        let negVecGU          (a:Vector<_>)       = let ops = a.ElementOps in unaryOpVectorGU  (fun x -> ops.Negate(x)) a
+        let negSparseMatrixGU (a:SparseMatrix<_>) = let ops = a.ElementOps in unaryOpSparseGU (fun x -> ops.Negate(x)) a
+
+        let mapDenseMatrixGU f (a : DenseMatrix<'T>) : DenseMatrix<'T> = 
+            let arrA = a.Values 
+            createDenseMatrixGU a.OpsData a.NumRows a.NumCols (fun i j -> f (getArray2D arrA i j))
+
+        let mapVecGU f (a:Vector<_>) = 
+            let mA= a.NumRows
+            createVecGU a.OpsData mA (fun i -> f a.[i])
+
+        let copyDenseMatrixGU (a : DenseMatrix<'T>) : DenseMatrix<'T> = 
+            let arrA = a.Values 
+            createDenseMatrixGU a.OpsData a.NumRows a.NumCols (fun i j -> getArray2D arrA i j)
+
+        let copyVecGU (a:Vector<_>) = 
+            createVecGU a.OpsData a.NumRows (fun i -> a.[i])
+
+        let copyRowVecGU (a:RowVector<_>) = 
+            createRowVecGU a.OpsData a.NumCols (fun i -> a.[i])
+
+        let toDenseSparseMatrixGU (a:SparseMatrix<_>) = 
+            createDenseMatrixGU a.OpsData a.NumRows a.NumCols  (fun i j -> a.[i,j])
+          
+        let mapiDenseMatrixGU f (a: DenseMatrix<'T>) : DenseMatrix<'T> = 
+            let arrA = a.Values 
+            createDenseMatrixGU a.OpsData a.NumRows a.NumCols (fun i j -> f i j (getArray2D arrA i j))
+
+        let mapiRowVecGU f (a:RowVector<_>) = 
+            createRowVecGU a.OpsData a.NumCols (fun i -> f i a.[i])
+
+        let mapiVecGU f (a:Vector<_>) = 
+            createVecGU a.OpsData a.NumRows (fun i -> f i a.[i])
+
+        let permuteVecGU (p:permutation) (a:Vector<_>) = 
+            createVecGU a.OpsData a.NumRows (fun i -> a.[p i])
+
+        let permuteRowVecGU (p:permutation) (a:RowVector<_>) = 
+            createRowVecGU a.OpsData a.NumCols (fun i -> a.[p i])
+
+        let inline inplace_mapiDenseMatrixGU f (a:DenseMatrix<_>) = 
+            let arrA = a.Values 
+            assignDenseMatrixGU (fun i j -> f i j (getArray2D arrA i j)) a
+
+        let inline inplace_mapiRowVecGU f (a:RowVector<_>) = 
+            assignRowVecGU (fun i -> f i a.[i]) a
+
+        let inline inplace_mapiVecGU f (a:Vector<_>) = 
+            assignVecGU (fun i -> f i a.[i]) a
+
+        let inline foldDenseMatrixGU f z (a:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let arrA = a.Values 
+            let mutable acc = z
+            for i = 0 to mA-1 do
+                for j = 0 to nA-1 do 
+                   acc <- f acc (getArray2D arrA i j)
+            acc
+        
+        let inline foldVecGU f z (a:Vector<_>) =
+            let mutable acc = z
+            for i = 0 to a.NumRows-1 do acc <- f acc a.[i]
+            acc
+        
+        let inline foldiDenseMatrixGU f z (a:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let arrA = a.Values 
+            let mutable acc = z
+            for i = 0 to mA-1 do
+                for j = 0 to nA-1 do 
+                   acc <- f i j acc (getArray2D arrA i j)
+            acc
+        
+        let inline foldiVecGU f z (a:Vector<_>) =
+            let mA = a.NumRows
+            let mutable acc = z
+            for i = 0 to mA-1 do acc <- f i acc a.[i]
+            acc
+        
+        let rec forallR f (n,m) = (n > m) || (f n && forallR f (n+1,m))
+        let rec existsR f (n,m) = (n <= m) && (f n || existsR f (n+1,m))
+        
+        let foralliDenseMatrixGU pred (a:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let arrA = a.Values 
+            (0,mA-1) |> forallR  (fun i ->
+            (0,nA-1) |> forallR  (fun j ->
+            pred i j (getArray2D arrA i j)))
+
+        let foralliVecGU pred (a:Vector<_>) =
+            let mA = a.NumRows
+            (0,mA-1) |> forallR  (fun i ->
+            pred i a.[i])
+
+        let existsiDenseMatrixGU pred (a:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let arrA = a.Values 
+            (0,mA-1) |> existsR (fun i ->
+            (0,nA-1) |> existsR (fun j ->
+            pred i j (getArray2D arrA i j)))
+
+        let existsiVecGU pred (a:Vector<_>) =
+            let mA = a.NumRows
+            (0,mA-1) |> existsR (fun i ->
+            pred i a.[i])
+
+        let sumDenseMatrixGU  (a:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            foldDenseMatrixGU (fun acc aij -> add ops acc aij) ops.Zero a
+
+        let sumSparseMatrixGU  (a:SparseMatrix<_>) = 
+            let ops = a.ElementOps 
+            a |> nonZeroEntriesSparseMatrixGU |> Seq.fold (fun acc (_,_,aij) -> add ops acc aij) ops.Zero
+
+        let sumVecGU (a:Vector<_>) = 
+            let ops = a.ElementOps 
+            foldVecGU (fun acc ai -> add ops acc ai) ops.Zero a
+
+        let prodDenseMatrixGU (a:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            foldDenseMatrixGU (fun acc aij -> mul ops acc aij) ops.One a
+
+        let prodSparseMatrixGU  (a:SparseMatrix<_>) = a |> toDenseSparseMatrixGU |> prodDenseMatrixGU
+
+        let inline fold2DenseMatrixGU f z (a:DenseMatrix<_>) (b:DenseMatrix<_>) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA <> nB || mA <> mB then invalidArg "b" "the two matrices do not have compatible dimensions"
+            let arrA = a.Values 
+            let arrB = b.Values 
+            let mutable acc = z
+            for i = 0 to mA-1 do
+                for j = 0 to nA-1 do 
+                   acc <- f acc (getArray2D arrA i j) (getArray2D arrB i j)
+            acc
+
+        let inline fold2VecGU f z (a:Vector<_>) (b:Vector<_>) =
+            let mA = a.NumRows
+            let mB = b.NumRows
+            if  mA <> mB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            let mutable acc = z
+            for i = 0 to mA-1 do acc <- f acc a.[i] b.[i]
+            acc
+
+        let dotDenseMatrixGU (a:DenseMatrix<_>) b =
+            let ops = a.ElementOps 
+            fold2DenseMatrixGU (fun z va vb -> add ops z (mul ops va vb)) ops.Zero a b
+
+        let dotVecGU (a:Vector<_>) b =
+            let ops =   a.ElementOps
+            let zero = ops.Zero 
+            fold2VecGU  (fun z va vb -> add ops z (mul ops va vb)) zero a b 
+
+        let normDenseMatrixGU (a:DenseMatrix<_>) = 
+            let normOps = getNormOps a.ElementOps
+            foldDenseMatrixGU (fun z aij -> z + ((normOps.Norm aij)**2.0)) 0.0 a |> sqrt
+
+        let normSparseMatrixGU (a:SparseMatrix<_>) = 
+            let normOps = getNormOps a.ElementOps
+            a |> nonZeroEntriesSparseMatrixGU |> Seq.fold (fun acc (_,_,aij) -> acc + ((normOps.Norm aij)**2.0)) 0.0 |> sqrt
+
+        let inplaceAddDenseMatrixGU  (a:DenseMatrix<_>) (b:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            let arrB = b.Values 
+            inplace_mapiDenseMatrixGU  (fun i j x -> add ops x (getArray2D arrB i j)) a
+        
+        let inplaceAddVecGU  (a:Vector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiVecGU  (fun i x   -> add ops x b.[i]) a
+
+        let inplaceAddRowVecGU (a:RowVector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiRowVecGU (fun i x   -> add ops x b.[i]) a
+
+        let inplaceSubDenseMatrixGU  (a:DenseMatrix<_>) (b:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            let arrB = b.Values 
+            inplace_mapiDenseMatrixGU  (fun i j x -> sub ops x (getArray2D  arrB i j)) a
+
+        let inplaceSubVecGU (a:Vector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps
+            inplace_mapiVecGU  (fun i x   -> sub ops x b.[i]) a
+
+        let inplaceSubRowVecGU (a:RowVector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiRowVecGU (fun i x   -> sub ops x b.[i]  ) a
+
+        let inplaceCptMulDenseMatrixGU  (a:DenseMatrix<_>) (b:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            let arrB = b.Values 
+            inplace_mapiDenseMatrixGU  (fun i j x -> mul ops x (getArray2D  arrB i j)) a
+
+        let inplaceCptMulVecGU (a:Vector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps  
+            inplace_mapiVecGU  (fun i x   -> mul ops x b.[i]) a
+
+        let inplaceCptMulRowVecGU (a:RowVector<_>) (b:Vector<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiRowVecGU (fun i x   -> mul ops x b.[i]  ) a
+
+        let inplaceScaleDenseMatrixGU  x (a:DenseMatrix<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiDenseMatrixGU  (fun _ _ y -> ops.Multiply(x,y)) a
+
+        let inplaceScaleVecGU  x (a:Vector<_>) = 
+            let ops = a.ElementOps  
+            inplace_mapiVecGU  (fun _ y   -> ops.Multiply(x,y)) a
+
+        let inplaceScaleRowVecGU x (a:RowVector<_>) = 
+            let ops = a.ElementOps 
+            inplace_mapiRowVecGU (fun _ y   -> ops.Multiply(x,y)) a
+
+
+        let wrapList (pre,mid,post,trim) show l = 
+            let post = if trim then "; ..." + post else post
+            match l with 
+            | []    -> [pre;post]
+            | [x]   -> [pre;show x;post]
+            | x::xs -> [pre;show x] @ (List.collect (fun x -> [mid;show x]) xs) @ [post]
+
+        let showItem opsData  x = 
+            try 
+              let ops = opsOfOpsData opsData 
+              ops.ToString(x,"g10",System.Globalization.CultureInfo.InvariantCulture) 
+            with :? System.NotSupportedException -> (box x).ToString()
+        
+        let mapR f (n,m) = if m < n then [] else List.init (m-n+1) (fun i -> f (n+i))
+
+        let primShowDenseMatrixGU (sepX,sepR) (a : DenseMatrix<'e>) =
+            let nA = min a.NumCols 50
+            let mA = min a.NumRows 50
+            let ops = a.OpsData 
+            let showLine i = wrapList ("[",";","]",a.NumCols > nA) (showItem ops) ((0,nA-1) |> mapR  (fun j -> a.[i,j])) |> Array.ofList |> System.String.Concat
+            wrapList ("matrix [",";"+sepX,"]"+sepR,a.NumRows > mA) showLine [0..mA-1] |> Array.ofList |> System.String.Concat
+
+        let showDenseMatrixGU     m = primShowDenseMatrixGU ("\n","\n") m
+        let debugShowDenseMatrixGU m = primShowDenseMatrixGU (""  ,""  ) m
+        
+        let showVecGU s (a : Vector<_>) =
+            let mA = min a.NumRows 100
+            let ops = a.OpsData 
+            wrapList (s+" [",";","]",a.NumRows > mA) (showItem ops) ((0,mA-1) |> mapR  (fun i -> a.[i])) |> Array.ofList |> System.String.Concat 
+
+        let showRowVecGU s (a : RowVector<_>) =
+            let mA = min a.NumCols 100
+            let ops = a.OpsData 
+            wrapList (s+" [",";","]",a.NumCols > mA) (showItem ops) ((0,mA-1) |> mapR  (fun i -> a.[i])) |> Array.ofList |> System.String.Concat 
+
+
+    /// Implementations of operations specific to floating point types
+    module DoubleImpl = 
+
+        module GU = GenericImpl
+        open Instances
+        
+        // Element type OpsData
+        //type elem = float
+        let zero = 0.0
+        let one  = 1.0
+        let inline sub (x:float) (y:float) = x - y
+        let inline add (x:float) (y:float) = x + y
+        let inline mul (x:float) (y:float) = x * y
+        let inline neg (x:float) = -x
+
+        // Specialized: these know the relevant set of 
+        // ops without doing a table lookup based on runtime type
+        let FloatOps = Some (FloatNumerics :> INumeric<float>)
+        let inline initDenseMatrixDS m n f = GU.createDenseMatrixGU FloatOps m n f
+        let inline createRowVecDS m f      = GU.createRowVecGU      FloatOps m f
+        let inline createVecDS m f         = GU.createVecGU         FloatOps m f
+        let inline mkDenseMatrixDS  arr    = GU.mkDenseMatrixGU     FloatOps arr
+        let inline mkRowVecDS arr          = GU.mkRowVecGU          FloatOps arr
+        let inline mkVecDS  arr            = GU.mkVecGU             FloatOps arr
+        let inline listDenseMatrixDS  ll   = GU.listDenseMatrixGU   FloatOps ll
+        let inline listRowVecDS l          = GU.listRowVecGU        FloatOps l
+        let inline listVecDS  l            = GU.listVecGU           FloatOps l
+        let inline seqDenseMatrixDS  ll    = GU.seqDenseMatrixGU    FloatOps ll
+        let inline seqRowVecDS l           = GU.seqRowVecGU         FloatOps l
+        let inline seqVecDS  l             = GU.seqVecGU            FloatOps l
+
+        let constDenseMatrixDS  m n x      = GU.createDenseMatrixGU  FloatOps m n (fun _ _ -> x)
+        let constRowVecDS m x              = GU.createRowVecGU FloatOps m   (fun _ -> x)
+        let constVecDS  m x                = GU.createVecGU  FloatOps m   (fun _ -> x)
+        let scalarDenseMatrixDS   x        = constDenseMatrixDS  1 1 x 
+        let scalarRowVecDS  x              = constRowVecDS 1   x 
+        let scalarVecDS   x                = constVecDS  1   x 
+
+        // Beware - when compiled with non-generic code createArray2D creates an array of null values,
+        // not zero values. Hence the optimized version can only be used when compiling with generics.
+        let inline zeroDenseMatrixDS m n = 
+          let arr = GU.createArray2D m n 
+          GU.mkDenseMatrixGU FloatOps arr
+        // Specialized: these inline down to the efficient loops we need
+        let addDenseMatrixDS     a b = GU.binaryOpDenseMatrixGU  add a b
+        let addSparseDS     a b = GU.binaryOpSparseMatrixGU  add a b
+        let addRowVecDS    a b = GU.binaryOpRowVecGU add a b
+        let addVecDS     a b = GU.binaryOpVecGU  add a b
+        let subDenseMatrixDS     a b = GU.binaryOpDenseMatrixGU  sub a b 
+        let subSparseDS     a b = GU.binaryOpSparseMatrixGU  sub a b 
+        let mulSparseDS     a b = GU.genericMulSparse zero add mul a b
+        let subRowVecDS    a b = GU.binaryOpRowVecGU sub a b 
+        let subVecDS     a b = GU.binaryOpVecGU  sub a b 
+        let cptMulDenseMatrixDS  a b = GU.binaryOpDenseMatrixGU  mul a b
+        let cptMulSparseDS  a b = GU.binaryOpSparseMatrixGU  mul a b
+        let cptMulRowVecDS a b = GU.binaryOpRowVecGU mul a b
+        let cptMulVecDS  a b = GU.binaryOpVecGU  mul a b
+        type smatrix = SparseMatrix<float>
+        type dmatrix = DenseMatrix<float>
+        type vector = Vector<float>
+        type rowvec = RowVector<float>
+        let cptMaxDenseMatrixDS  (a:dmatrix) (b:dmatrix) = GU.binaryOpDenseMatrixGU  max a b
+        let cptMinDenseMatrixDS  (a:dmatrix) (b:dmatrix) = GU.binaryOpDenseMatrixGU  min a b
+        let cptMaxSparseDS  (a:smatrix) (b:smatrix) = GU.binaryOpSparseMatrixGU  max a b
+        let cptMinSparseDS  (a:smatrix) (b:smatrix) = GU.binaryOpSparseMatrixGU  min a b
+        let cptMaxVecDS  (a:vector) (b:vector) = GU.binaryOpVecGU  max a b
+        let cptMinVecDS  (a:vector) (b:vector) = GU.binaryOpVecGU  min a b
+
+        // Don't make any mistake about these ones re. performance.
+        let mulDenseMatrixDS (a:dmatrix) (b:dmatrix) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA<>mB then invalidArg "b" "the two matrices do not have compatible dimensions"
+            let arr = GU.createArray2D mA nB 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            for i = 0 to mA - 1 do 
+                for j = 0 to nB - 1 do 
+                    let mutable r = 0.0 
+                    for k = 0 to mB - 1 do 
+                        r <- r + mul (GU.getArray2D arrA i k) (GU.getArray2D arrB k j)
+                    GU.setArray2D arr i j r
+            mkDenseMatrixDS arr
+
+        let mulRowVecDenseMatrixDS (a:rowvec) (b:dmatrix) =
+            let nA = a.NumCols 
+            let nB = b.NumCols 
+            let mB = b.NumRows
+            if nA<>mB then invalidArg "b" "the two inputs do not have compatible dimensions"
+            let arr = Array.zeroCreate nB 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            for j = 0 to nB - 1 do 
+                let mutable r = 0.0 
+                for k = 0 to mB - 1 do 
+                    r <- r + mul arrA.[k] (GU.getArray2D arrB k j)
+                arr.[j] <- r
+            mkRowVecDS arr
+
+        let mulDenseMatrixVecDS (a:dmatrix) (b:vector) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            let mB = b.NumRows 
+            if nA<>mB then invalidArg "b" "the two inputs do not have compatible dimensions"
+            let arr = Array.zeroCreate mA 
+            let arrA = a.Values 
+            let arrB = b.Values 
+            for i = 0 to mA - 1 do 
+                let mutable r = 0.0 
+                for k = 0 to nA - 1 do 
+                    r <- r + mul (GU.getArray2D arrA i k) arrB.[k]
+                arr.[i] <- r
+            mkVecDS arr
+
+        let mulRowVecVecDS (a:rowvec) (b:vector) =
+            let nA = a.NumCols 
+            let mB = b.NumRows 
+            if nA<>mB then invalidArg "b" "the two vectors do not have compatible dimensions"
+            let arrA = a.Values 
+            let arrB = b.Values 
+            let mutable r = 0.0 
+            for k = 0 to nA - 1 do 
+                r <- r + mul arrA.[k] arrB.[k]
+            r
+
+        let rowvecDenseMatrixDS (x:rowvec) = initDenseMatrixDS 1          x.NumCols (fun _ j -> x.[j]) 
+        let vectorDenseMatrixDS (x:vector) = initDenseMatrixDS x.NumRows  1         (fun i _ -> x.[i]) 
+        let mulVecRowVecDS a b = mulDenseMatrixDS (vectorDenseMatrixDS a) (rowvecDenseMatrixDS b) 
+
+        let scaleDenseMatrixDS   k m = GU.unaryOpDenseMatrixGU  (fun x -> mul k x) m
+        let scaleSparseDS   k m = GU.unaryOpSparseGU  (fun x -> mul k x) m
+        let scaleRowVecDS  k m = GU.unaryOpRowVecGU (fun x -> mul k x) m
+        let scaleVecDS   k m = GU.unaryOpVectorGU  (fun x -> mul k x) m
+        let negDenseMatrixDS     m   = GU.unaryOpDenseMatrixGU  (fun x -> neg x) m
+        let negSparseDS     m   = GU.unaryOpSparseGU  (fun x -> neg x) m
+        let negRowVecDS    m   = GU.unaryOpRowVecGU (fun x -> neg x) m
+        let negVecDS     m   = GU.unaryOpVectorGU  (fun x -> neg x) m
+
+        let traceDenseMatrixDS (a:dmatrix) =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            if nA<>mA then invalidArg "a" "expected a square matrix";
+            let arrA = a.Values 
+            (0,nA-1) |> GU.sumfR (fun i -> GU.getArray2D arrA i i) 
+
+        let sumDenseMatrixDS  a = GU.foldDenseMatrixGU add zero a
+        let sumVecDS   a = GU.foldVecGU  add zero a
+        let prodDenseMatrixDS a = GU.foldDenseMatrixGU mul one  a
+        let prodVecDS  a = GU.foldVecGU  mul one  a
+
+        let dotDenseMatrixDS a b = GU.fold2DenseMatrixGU (fun z va vb -> add z (mul va vb)) zero a b
+        let dotVecDS a b = GU.fold2VecGU (fun z va vb -> add z (mul va vb)) zero a b
+        let sumfDenseMatrixDS  f m = GU.foldDenseMatrixGU (fun acc aij -> add acc (f aij)) zero m
+        let normDenseMatrixDS m = sqrt (sumfDenseMatrixDS (fun x -> x*x) m)
+
+        let inplaceAddDenseMatrixDS  a (b:DenseMatrix<_>) = let arrB = b.Values  in GU.inplace_mapiDenseMatrixGU  (fun i j x -> x + GU.getArray2D arrB i j) a
+        let inplaceAddVecDS    a (b:Vector<_>) = let arrB = b.Values  in GU.inplace_mapiVecGU  (fun i x   -> x + arrB.[i]) a
+        let inplace_addRowVecDS a (b:RowVector<_>) = let arrB = b.Values in GU.inplace_mapiRowVecGU (fun i x   -> x + arrB.[i]) a
+        let inplaceSubDenseMatrixDS  a (b:DenseMatrix<_>) = let arrB = b.Values  in GU.inplace_mapiDenseMatrixGU  (fun i j x -> x - GU.getArray2D  arrB i j) a
+        let inplaceSubVecDS  a (b:Vector<_>) = let arrB = b.Values  in GU.inplace_mapiVecGU  (fun i x   -> x - arrB.[i]) a
+        let inplace_subRowVecDS a (b:RowVector<_>) = let arrB = b.Values in GU.inplace_mapiRowVecGU (fun i x   -> x - arrB.[i]) a
+        let inplaceCptMulDenseMatrixDS  a (b:DenseMatrix<_>) = let arrB = b.Values  in GU.inplace_mapiDenseMatrixGU  (fun i j x -> x * GU.getArray2D arrB i j) a
+        let inplaceCptMulVecDS  a (b:Vector<_>) = let arrB = b.Values  in GU.inplace_mapiVecGU  (fun i x   -> x * arrB.[i]) a
+        let inplace_cptMulRowVecDS a (b:RowVector<_>) = let arrB = b.Values in GU.inplace_mapiRowVecGU (fun i x   -> x * arrB.[i]) a
+        let inplaceScaleDenseMatrixDS  (a:float) b = GU.inplace_mapiDenseMatrixGU  (fun _ _ x -> a * x) b
+        let inplaceScaleVecDS  (a:float) b = GU.inplace_mapiVecGU  (fun _ x   -> a * x) b
+        let inplace_scaleRowVecDS (a:float) b = GU.inplace_mapiRowVecGU (fun _ x   -> a * x) b
+
+
+
+    /// Generic operations that, when used on floating point types, use the specialized versions in DoubleImpl
+    module SpecializedGenericImpl = 
+
+        open Microsoft.FSharp.Math.Instances
+        open Microsoft.FSharp.Math.GlobalAssociations
+
+        module GU = GenericImpl
+        module DS = DoubleImpl
+
+          
+        type smatrix = SparseMatrix<float>
+        type dmatrix = DenseMatrix<float>
+        type vector = Vector<float>
+        type rowvec = RowVector<float>
+        let inline dense x = DenseRepr(x)
+        let inline sparse x = SparseRepr(x)
+        let inline createMx  ops m n f = GU.createDenseMatrixGU ops m n f |> dense
+        let inline createVx  ops m f   = GU.createVecGU ops m f
+        let inline createRVx ops m f   = GU.createRowVecGU ops m f
+
+        let nonZeroEntriesM a   = 
+            match a with 
+            | DenseRepr a -> GU.nonzeroEntriesDenseMatrixGU a 
+            | SparseRepr a -> GU.nonZeroEntriesSparseMatrixGU a 
+
+        /// Merge two sorted sequences
+        let mergeSorted cf (s1: seq<'T>) (s2: seq<'b>) =
+            seq { use e1 = s1.GetEnumerator()
+                  use e2 = s2.GetEnumerator()
+                  let havee1 = ref (e1.MoveNext())
+                  let havee2 = ref (e2.MoveNext())
+                  while !havee1 || !havee2 do
+                    if !havee1 && !havee2 then
+                        let v1 = e1.Current
+                        let v2 = e2.Current
+                        let c = cf v1 v2 
+                        if c < 0 then 
+                            do havee1 := e1.MoveNext()
+                            yield Some(v1),None
+                        elif c = 0 then
+                            do havee1 := e1.MoveNext()
+                            do havee2 := e2.MoveNext()
+                            yield Some(v1),Some(v2)
+                        else 
+                            do havee2 := e2.MoveNext()
+                            yield (None,Some(v2))
+                    elif !havee1 then 
+                        let v1 = e1.Current
+                        do havee1 := e1.MoveNext()
+                        yield (Some(v1),None)
+                    else 
+                        let v2 = e2.Current
+                        do havee2 := e2.MoveNext()
+                        yield (None,Some(v2)) }
+
+        /// Non-zero entries from two sequences
+        let mergedNonZeroEntriesM  (a:Matrix<_>) (b:Matrix<_>) = 
+            let ops = a.ElementOps 
+            let zero = ops.Zero
+            mergeSorted (fun (i1,j1,_) (i2,j2,_) -> let c = compare i1 i2 in if c <> 0 then c else compare j1 j2) (nonZeroEntriesM a) (nonZeroEntriesM b)
+            |> Seq.map (function | Some(i,j,v1),Some(_,_,v2) -> (v1,v2)
+                                 | Some(i,j,v1),None         -> (v1,zero)
+                                 | None,        Some(i,j,v2) -> (zero,v2)
+                                 | None,        None          -> failwith "unreachable")
+
+
+        
+        // Creation
+        let listM    xss : Matrix<'T>    = GU.listDenseMatrixGU opsdata<'T> xss |> dense
+        let listV    xss : Vector<'T>    = GU.listVecGU         opsdata<'T> xss
+        let listRV   xss : RowVector<'T> = GU.listRowVecGU      opsdata<'T> xss
+
+        let arrayM    xss : Matrix<'T>    = GU.mkDenseMatrixGU  opsdata<'T> (Array2D.copy xss) |> dense
+        let arrayV    xss : Vector<'T>    = GU.mkVecGU          opsdata<'T> (Array.copy xss)
+        let arrayRV   xss : RowVector<'T> = GU.mkRowVecGU       opsdata<'T> (Array.copy xss)
+
+        let seqM    xss : Matrix<'T>    = GU.seqDenseMatrixGU   opsdata<'T> xss |> dense
+        let seqV    xss : Vector<'T>    = GU.seqVecGU           opsdata<'T> xss
+        let seqRV   xss : RowVector<'T> = GU.seqRowVecGU        opsdata<'T> xss
+
+        let initM  m n f : Matrix<'T>    = GU.createDenseMatrixGU opsdata<'T> m n f |> dense
+        let initRV m   f : RowVector<'T> = GU.createRowVecGU      opsdata<'T> m   f
+        let initV  m   f : Vector<'T>    = GU.createVecGU         opsdata<'T> m   f
+
+        let constM  m n x : Matrix<'T>    = GU.createConstDenseMatrixGU opsdata<'T> m n x |> dense
+        let constRV m   x : RowVector<'T> = GU.createConstRowVecGU      opsdata<'T> m   x
+        let constV  m   x : Vector<'T>    = GU.createConstVecGU         opsdata<'T> m   x
+
+        let inline inplaceAssignM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNotMutable()
+            | DenseRepr a -> GU.assignDenseMatrixGU  f a
+        let inline assignV  f a = GU.assignVecGU  f a
+
+        let coerce2 x = unbox(box(x))
+        let loosenDM (x: dmatrix) : DenseMatrix<_>  = coerce2 x
+        let loosenSM (x: smatrix) : SparseMatrix<_> = coerce2 x
+        let loosenV  (x: vector)  : Vector<_>       = coerce2 x
+        let loosenRV (x: rowvec)  : RowVector<_>    = coerce2 x
+        let loosenF  (x: float)   : 'T              = coerce2 x
+
+        let tightenDM (x: DenseMatrix<_>)  : dmatrix = coerce2 x
+        let tightenSM (x: SparseMatrix<_>) : smatrix = coerce2 x
+        let tightenV  (x: Vector<_>)       : vector  = coerce2 x
+        let tightenRV (x: RowVector<_>)    : rowvec  = coerce2 x
+        let tightenF  (x: 'T)              : float   = coerce2 x
+
+        let zeroM m n = 
+            let arr = GU.createArray2D m n
+            // This is quite performance critical
+            // Avoid assigining zeros into the array
+            match box arr with 
+            | :? (float[,])   as arr -> GU.mkDenseMatrixGU DS.FloatOps arr |> loosenDM |> dense
+            | _ -> 
+            GU.zeroizeDenseMatrixGUA arr m n  |> dense
+
+        let zeroV m  : Vector<'T> = 
+            let arr = GU.createArray m 
+            // Avoid assigining zeros into the array
+            match box (arr: 'T[]) with 
+            | :? (float[])   as arr -> GU.mkVecGU DS.FloatOps arr |> loosenV
+            | _ -> 
+            GU.zeroizeVecGUA arr m
+
+        let zeroRV m  : RowVector<'T> = 
+            let arr = GU.createArray m 
+            // Avoid assigining zeros into the array
+            match box (arr: 'T[]) with 
+            | :? (float[])   as arr -> GU.mkRowVecGU DS.FloatOps arr |> loosenRV
+            | _ -> 
+            GU.zeroizeRowVecGUA arr m
+            
+        let initNumericM m n f   = 
+            let arr = GU.createArray2D m n 
+            let opsData = opsdata<'T> 
+            let ops = GU.opsOfOpsData opsData 
+            GU.assignArray2D m n (f ops) arr;
+            GU.mkDenseMatrixGU opsData arr |> dense
+
+        let identityM m   = 
+            let arr = GU.createArray2D m m 
+            // This is quite performance critical
+            // Avoid assigining zeros into the array
+            match box arr with 
+            | :? (float[,])   as arr -> 
+                for i = 0 to m - 1 do 
+                   arr.[i,i] <- 1.0 
+                GU.mkDenseMatrixGU DS.FloatOps arr |> loosenDM |> dense
+            | _ -> 
+            let opsData = opsdata<'T> 
+            let ops = GU.opsOfOpsData opsData 
+            let zero = ops.Zero 
+            let one = ops.One 
+            GU.assignArray2D m m (fun i j -> if i = j then one else zero) arr;
+            GU.mkDenseMatrixGU opsData arr |> dense
+
+        let createNumericV m f  : Vector<'T> = 
+            let arr = GU.createArray m 
+            let opsData = opsdata<'T> 
+            let ops = GU.opsOfOpsData opsData 
+            GU.assignArray m (f ops) arr;
+            GU.mkVecGU opsData arr
+            
+        let scalarM   x = constM 1 1 x 
+        let scalarRV  x = constRV 1 x 
+        let scalarV   x = constV 1 x 
+
+        let diagnM (v:Vector<_>) n = 
+            let ops = v.ElementOps
+            let zero = ops.Zero 
+            let nV = v.NumRows + (if n < 0 then -n else n) 
+            createMx v.OpsData nV nV (fun i j -> if i+n=j then v.[i] else zero)
+
+        let diagM v = diagnM v 0
+
+        let constDiagM  n x : Matrix<'T> = 
+            let opsData = opsdata<'T> 
+            let ops = GU.opsOfOpsData opsData 
+            let zero = ops.Zero 
+            createMx opsData n n (fun i j -> if i=j then x else zero) 
+
+        // Note: we drop sparseness on pointwise multiplication of sparse and dense.
+        let inline binaryOpM opDenseDS opDenseGU opSparseDS opSparseMatrixGU a b = 
+            match a,b with 
+            | DenseRepr a,DenseRepr b -> 
+                match box a with 
+                | (:? dmatrix as a) -> opDenseDS   a (tightenDM b) |> loosenDM |> dense
+                | _                 -> opDenseGU a b                           |> dense
+            | SparseRepr a,SparseRepr b ->
+                match box a with 
+                | (:? smatrix as a) -> opSparseDS a (tightenSM b) |> loosenSM |> sparse
+                | _                 -> opSparseMatrixGU a b                         |> sparse
+            | SparseRepr a, DenseRepr b     -> opDenseGU (GU.toDenseSparseMatrixGU a) b         |> dense
+            | DenseRepr  a, SparseRepr b    -> opDenseGU a (GU.toDenseSparseMatrixGU b)         |> dense
+
+        let inline unaryOpM opDenseDS opDenseGU opSparseDS opSparseMatrixGU  b = 
+            match b with 
+            | DenseRepr b -> 
+                match box b with 
+                | (:? dmatrix as b)  -> opDenseDS b |> loosenDM |> dense
+                | _                  -> opDenseGU b             |> dense
+            | SparseRepr b ->             
+                match box b with 
+                | (:? smatrix as b) -> opSparseDS b |> loosenSM |> sparse
+                | _                 -> opSparseMatrixGU b             |> sparse
+
+        let inline floatUnaryOpM opDenseDS opDenseGU opSparseDS opSparseMatrixGU  b = 
+            match b with 
+            | DenseRepr b -> 
+                match box b with 
+                | (:? dmatrix as b)  -> opDenseDS b |> loosenF
+                | _                  -> opDenseGU b             
+            | SparseRepr b ->             
+                match box b with 
+                | (:? smatrix as b) -> opSparseDS b |> loosenF 
+                | _                 -> opSparseMatrixGU b             
+
+        let addM a b = binaryOpM DS.addDenseMatrixDS GU.addDenseMatrixGU DS.addSparseDS GU.addSparseMatrixGU a b
+        let subM a b = binaryOpM DS.subDenseMatrixDS GU.subDenseMatrixGU DS.subSparseDS GU.subSparseMatrixGU a b
+        let mulM a b = binaryOpM DS.mulDenseMatrixDS GU.genericMulDenseMatrix DS.mulSparseDS GU.mulSparseMatrixGU a b
+        let cptMulM a b = binaryOpM DS.cptMulDenseMatrixDS GU.cptMulDenseMatrixGU DS.cptMulSparseDS GU.cptMulSparseMatrixGU a b
+        let cptMaxM a b = binaryOpM DS.cptMaxDenseMatrixDS GU.cptMaxDenseMatrixGU DS.cptMaxSparseDS GU.cptMaxSparseMatrixGU a b
+        let cptMinM a b = binaryOpM DS.cptMinDenseMatrixDS GU.cptMinDenseMatrixGU DS.cptMinSparseDS GU.cptMinSparseMatrixGU a b
+
+        let addRV a b = 
+            match box a with 
+            | (:? rowvec as a) -> DS.addRowVecDS a (tightenRV b) |> loosenRV
+            | _                -> GU.addRowVecGU a b
+
+        let addV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.addVecDS a (tightenV b) |> loosenV
+            | _                -> GU.addVecGU a b
+
+        let subRV a b = 
+            match box a with 
+            | (:? rowvec as a) -> DS.subRowVecDS   a (tightenRV b) |> loosenRV
+            | _                -> GU.subRowVecGU a b
+
+        let subV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.subVecDS   a (tightenV b) |> loosenV
+            | _                -> GU.subVecGU a b
+
+        let mulRVM a b = 
+            match b with 
+            | DenseRepr b -> 
+                match box a with 
+                | (:? rowvec as a) -> DS.mulRowVecDenseMatrixDS   a (tightenDM b) |> loosenRV
+                | _                -> GU.mulRowVecDenseMatrixGU a b
+            | SparseRepr b -> GU.mulRVSparseMatrixGU a b
+
+        let mulMV a b = 
+            match a with 
+            | DenseRepr a -> 
+                match box a with 
+                | (:? dmatrix as a) -> DS.mulDenseMatrixVecDS   a (tightenV b) |> loosenV
+                | _                 -> GU.mulDenseMatrixVecGU a b
+            | SparseRepr a -> GU.mulSparseVecGU a b 
+
+        let mulRVV a b = 
+            match box a with 
+            | (:? rowvec as a) -> DS.mulRowVecVecDS   a (tightenV b) |> loosenF
+            | _                -> GU.mulRowVecVecGU a b
+
+        let mulVRV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.mulVecRowVecDS   a (tightenRV b) |> loosenDM |> dense
+            | _                -> GU.mulVecRowVecGU a b |> dense
+
+        let cptMulRV a b = 
+            match box a with 
+            | (:? rowvec as a) -> DS.cptMulRowVecDS   a (tightenRV b) |> loosenRV
+            | _                -> GU.cptMulRowVecGU a b
+
+        let cptMulV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.cptMulVecDS   a (tightenV b) |> loosenV
+            | _                -> GU.cptMulVecGU a b
+
+        let cptMaxV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.cptMaxVecDS   a (tightenV b) |> loosenV
+            | _                -> GU.cptMaxVecGU a b
+
+        let cptMinV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.cptMinVecDS   a (tightenV b) |> loosenV
+            | _                -> GU.cptMinVecGU a b
+
+        let scaleM a b = unaryOpM (fun b -> DS.scaleDenseMatrixDS (tightenF a) b) (GU.scaleDenseMatrixGU a)
+                                  (fun b -> DS.scaleSparseDS (tightenF a) b) (GU.scaleSparseMatrixGU a) b
+
+        let scaleRV a b = 
+            match box b with 
+            | (:? rowvec as b)  -> DS.scaleRowVecDS (tightenF a) b |> loosenRV 
+            | _                 -> GU.scaleRowVecGU a b
+
+        let scaleV a b = 
+            match box b with 
+            | (:? vector as b)  -> DS.scaleVecDS (tightenF a) b |> loosenV
+            | _                 -> GU.scaleVecGU a b
+
+        let dotM a b = 
+            match a,b with 
+            | DenseRepr a,DenseRepr b -> 
+                match box b with 
+                | (:? dmatrix as b)  -> DS.dotDenseMatrixDS   (tightenDM a) b |> loosenF
+                | _                  -> GU.dotDenseMatrixGU a b
+            | _ ->  
+                let ops = a.ElementOps 
+                mergedNonZeroEntriesM a b |> Seq.fold (fun z (va,vb) -> GU.add ops z (GU.mul ops va vb)) ops.Zero 
+
+        let dotV a b = 
+            match box b with 
+            | (:? vector as b)  -> DS.dotVecDS   (tightenV a) b |> loosenF
+            | _                 -> GU.dotVecGU a b
+
+        let negM a = unaryOpM DS.negDenseMatrixDS GU.negDenseMatrixGU DS.negSparseDS GU.negSparseMatrixGU a
+
+        let negRV a = 
+            match box a with 
+            | (:? rowvec as a) -> DS.negRowVecDS a |> loosenRV
+            | _               ->  GU.negRowVecGU a
+
+        let negV a = 
+            match box a with 
+            | (:? vector as a) -> DS.negVecDS a |> loosenV
+            | _               ->  GU.negVecGU a
+
+        let traceMGU (a:Matrix<_>) =
+            let nA = a.NumCols  
+            let mA = a.NumRows 
+            if nA<>mA then invalidArg "a" "expected a square matrix";
+            let ops = a.ElementOps 
+            (0,nA-1) |> GU.sumRGU ops (fun i -> a.[i,i]) 
+
+        let traceM a = floatUnaryOpM DS.traceDenseMatrixDS (dense >> traceMGU) (sparse >> traceMGU) (sparse >> traceMGU) a
+        let sumM a = floatUnaryOpM DS.sumDenseMatrixDS GU.sumDenseMatrixGU GU.sumSparseMatrixGU GU.sumSparseMatrixGU a
+        let prodM a = floatUnaryOpM DS.prodDenseMatrixDS GU.prodDenseMatrixGU GU.prodSparseMatrixGU GU.prodSparseMatrixGU a
+        let normM a = floatUnaryOpM DS.normDenseMatrixDS GU.normDenseMatrixGU GU.normSparseMatrixGU GU.normSparseMatrixGU a
+
+        let opsM a = 
+            match a with 
+            | DenseRepr a -> a.OpsData 
+            | SparseRepr a -> a.OpsData 
+        
+        let transM a = 
+            match a with 
+            | DenseRepr a -> 
+                createMx a.OpsData a.NumCols a.NumRows (fun i j -> a.[j,i])
+            | SparseRepr a -> 
+                a |> GU.nonZeroEntriesSparseMatrixGU  |> Seq.map (fun (i,j,v) -> (j,i,v)) |> GU.initSparseMatrixGU a.NumCols a.NumRows a.OpsData |> sparse
+        
+        let permuteRows (p: permutation) a =
+            match a with
+            | DenseRepr a ->
+                createMx a.OpsData a.NumCols a.NumRows (fun i j -> a.[p i,j])
+            | SparseRepr a ->
+                a |> GU.nonZeroEntriesSparseMatrixGU  |> Seq.map (fun (i,j,v) -> (p i,j,v)) |> GU.initSparseMatrixGU a.NumCols a.NumRows a.OpsData |> sparse
+
+        let permuteColumns (p: permutation) a =
+            match a with
+            | DenseRepr a ->
+                createMx a.OpsData a.NumCols a.NumRows (fun i j -> a.[i,p j])
+            | SparseRepr a ->
+                a |> GU.nonZeroEntriesSparseMatrixGU  |> Seq.map (fun (i,j,v) -> (i,p j,v)) |> GU.initSparseMatrixGU a.NumCols a.NumRows a.OpsData |> sparse
+
+        let transRV (a:RowVector<_>) = 
+            createVx a.OpsData  a.NumCols (fun i -> a.[i])
+
+        let transV (a:Vector<_>)  = 
+            createRVx a.OpsData a.NumRows (fun i -> a.[i])
+
+        let inplaceAddM a b = 
+            match a,b with 
+            | DenseRepr a,DenseRepr b -> 
+                match box a with 
+                | (:? dmatrix as a) -> DS.inplaceAddDenseMatrixDS   a (tightenDM b)
+                | _                 -> GU.inplaceAddDenseMatrixGU a b
+            | _ -> sparseNotMutable()
+
+        let inplaceAddV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.inplaceAddVecDS   a (tightenV b)
+            | _                -> GU.inplaceAddVecGU a b
+
+        let inplaceSubM a b = 
+            match a,b with 
+            | DenseRepr a,DenseRepr b -> 
+                match box a with 
+                | (:? dmatrix as a) -> DS.inplaceSubDenseMatrixDS   a (tightenDM b)
+                | _                -> GU.inplaceSubDenseMatrixGU a b
+            | _ -> sparseNotMutable()
+
+        let inplaceSubV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.inplaceSubVecDS   a (tightenV b)
+            | _                -> GU.inplaceSubVecGU a b
+
+
+        let inplaceCptMulM a b = 
+            match a,b with 
+            | DenseRepr a,DenseRepr b -> 
+                match box a with 
+                | (:? dmatrix as a) -> DS.inplaceCptMulDenseMatrixDS   a (tightenDM b)
+                | _                -> GU.inplaceCptMulDenseMatrixGU a b
+            | _ -> sparseNotMutable()
+
+        let inplaceCptMulV a b = 
+            match box a with 
+            | (:? vector as a) -> DS.inplaceCptMulVecDS   a (tightenV b)
+            | _                -> GU.inplaceCptMulVecGU a b
+
+        let inplaceScaleM a b = 
+            match b with 
+            | DenseRepr b -> 
+                match box b with 
+                | (:? dmatrix as b)  -> DS.inplaceScaleDenseMatrixDS   (tightenF a) b
+                | _                 -> GU.inplaceScaleDenseMatrixGU a b
+            | _ -> sparseNotMutable()
+
+        let inplaceScaleV a b = 
+            match box b with 
+            | (:? vector as b)  -> DS.inplaceScaleVecDS   (tightenF a) b
+            | _                 -> GU.inplaceScaleVecGU a b
+
+        let existsM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI() // note: martin says "run f on a token element if it's not full"
+            | DenseRepr a -> GU.existsiDenseMatrixGU  (fun _ _ -> f) a
+
+        let existsV  f a = GU.existsiVecGU  (fun _ -> f) a
+
+        let forallM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> GU.foralliDenseMatrixGU  (fun _ _ -> f) a
+
+        let forallV  f a = GU.foralliVecGU  (fun _ -> f) a
+
+        let existsiM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> GU.existsiDenseMatrixGU  f a
+
+        let existsiV  f a = GU.existsiVecGU  f a
+
+        let foralliM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> GU.foralliDenseMatrixGU  f a
+
+        let foralliV  f a = GU.foralliVecGU  f a
+
+        let mapM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> DenseRepr(GU.mapDenseMatrixGU f a)
+
+        let mapV  f a = GU.mapVecGU f a
+
+        let copyM  a = 
+            match a with 
+            | SparseRepr a -> SparseRepr (GU.copySparseGU a)
+            | DenseRepr a -> DenseRepr (GU.copyDenseMatrixGU a)
+
+        let copyV  a = GU.copyVecGU a
+
+        let copyRV  a = GU.copyRowVecGU a
+
+        let mapiM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> DenseRepr (GU.mapiDenseMatrixGU f a)
+
+        let mapiV  f a = GU.mapiVecGU f a
+        let permuteV p a = GU.permuteVecGU p a
+        let permuteRV p a = GU.permuteRowVecGU p a
+
+        let mapiRV  f a = GU.mapiRowVecGU f a
+
+        let toDenseM a = 
+            match a with 
+            | SparseRepr a -> GU.toDenseSparseMatrixGU a |> dense
+            | DenseRepr _ -> a
+
+        let initSparseM i j x : Matrix<'T> = 
+            let opsData = opsdata<'T> 
+            GU.initSparseMatrixGU i j opsData x |> sparse
+          
+        let initDenseM i j x : Matrix<'T> = 
+            let r = zeroM i j
+            x |> Seq.iter (fun (i,j,v) -> r.[i,j] <- v);
+            r
+
+        let getDiagnM (a:Matrix<_>) n =
+            let nA = a.NumCols 
+            let mA = a.NumRows
+            if nA<>mA then invalidArg "a" "expected a square matrix";
+            let ni = if n < 0 then -n else 0 
+            let nj = if n > 0 then  n else 0 
+            GU.createVecGU (opsM a) (max (nA-abs(n)) 0) (fun i -> a.[i+ni,i+nj]) 
+
+        let getDiagM  a = getDiagnM a 0
+
+        let inline inplace_mapiM  f a = 
+            match a with 
+            | SparseRepr _ -> sparseNotMutable()
+            | DenseRepr a -> GU.inplace_mapiDenseMatrixGU f a
+
+        let inline inplace_mapiV  f a = GU.inplace_mapiVecGU f a
+        
+        let inline foldM  f z a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> GU.foldDenseMatrixGU f z a
+
+        let inline foldV  f z a = GU.foldVecGU f z a
+
+        let inline foldiM  f z a = 
+            match a with 
+            | SparseRepr _ -> sparseNYI()
+            | DenseRepr a -> GU.foldiDenseMatrixGU f z a
+
+        let inline foldiV  f z a = GU.foldiVecGU f z a
+
+        let compareM (comp: IComparer) (a:Matrix<'T>) (b:Matrix<'T>) = 
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let nB = b.NumCols 
+            let mB = b.NumRows 
+            let c = compare mA mB 
+            if c <> 0 then c else
+            let c = compare nA nB 
+            if c <> 0 then c else
+            match a,b with 
+            | DenseRepr a, DenseRepr b -> 
+              let rec go2 i j = 
+                 if j < nA then 
+                   let c = comp.Compare( a.[i,j], b.[i,j])
+                   if c <> 0 then c else 
+                   go2 i (j+1) 
+                 else 0 
+              let rec go1 i = 
+                 if i < mA then 
+                   let c = go2 i 0 
+                   if c <> 0 then c 
+                   else go1 (i+1) 
+                 else 0 
+              go1 0
+            | _ -> 
+              match (mergedNonZeroEntriesM a b |> Seq.tryPick (fun (v1,v2) -> let c = comp.Compare(v1,v2) in if c = 0 then None else Some(c))) with
+              | None -> 0
+              | Some(c) -> c
+             
+        let equalsM (comp: IEqualityComparer) (a:Matrix<'T>) (b:Matrix<'T>) = 
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let nB = b.NumCols 
+            let mB = b.NumRows 
+            (mA = mB ) && (nA = nB) && 
+            match a,b with 
+            | DenseRepr a, DenseRepr b -> 
+                let rec go2 i j =  j >= nA || (comp.Equals( a.[i,j], b.[i,j]) && go2 i (j+1) )
+                let rec go1 i = i >= mA || (go2 i 0  && go1 (i+1))
+                go1 0
+            | _ -> 
+                mergedNonZeroEntriesM a b |> Seq.forall (fun (v1,v2) -> comp.Equals(v1,v2))
+             
+
+        let compareV (comp: IComparer) (a:Vector<'T>) (b:Vector<'T>) = 
+            let mA = a.NumRows
+            let mB = b.NumRows 
+            let c = compare mA mB 
+            if c <> 0 then c else
+            let rec go2 j = 
+               if j < mA then 
+                 let c = comp.Compare(a.[j],b.[j])
+                 if c <> 0 then c else go2 (j+1) 
+               else 0 
+            go2 0
+
+        let equalsV (comp: IEqualityComparer) (a:Vector<'T>) (b:Vector<'T>) = 
+            let mA = a.NumRows
+            let mB = b.NumRows 
+            (mA = mB) && 
+            let rec go2 j = (j >= mA) || (comp.Equals(a.[j],b.[j]) && go2 (j+1))
+            go2 0
+
+        let equalsRV (comp: IEqualityComparer) (a:RowVector<'T>) (b:RowVector<'T>) = 
+            let mA = a.NumCols 
+            let mB = b.NumCols 
+            (mA = mB) && 
+            let rec go2 j = (j >= mA) || (comp.Equals(a.[j],b.[j]) && go2 (j+1))
+            go2 0
+
+        let compareRV (comp: IComparer) (a:RowVector<'T>) (b:RowVector<'T>) = 
+            let mA = a.NumCols 
+            let mB = b.NumCols 
+            let c = compare mA mB 
+            if c <> 0 then c else
+            let rec go2 j = 
+               if j < mA then 
+                 let c = comp.Compare(a.[j],b.[j])
+                 if c <> 0 then c else go2 (j+1) 
+               else 0 
+            go2 0
+
+        let inline combineHash x y = (x <<< 1) + y + 631 
+
+        let hashM (comp:IEqualityComparer) (a:Matrix<_>) = 
+            let nA = a.NumCols 
+            let mA = a.NumRows 
+            let acc = hash mA + hash nA
+            a |> nonZeroEntriesM |> Seq.truncate 20 |> Seq.fold (fun z v -> combineHash z (comp.GetHashCode v)) acc
+          
+        let hashV (comp:IEqualityComparer) (a:Vector<_>) = 
+            let mA = a.NumRows 
+            hash mA +
+            (let mutable c = 0 
+             for i = 0 to mA - 1 do
+                 c <- combineHash c (comp.GetHashCode a.[i])
+             c)
+          
+        let hashRV (comp:IEqualityComparer) (a:RowVector<_>) = 
+            let mA = a.NumCols 
+            hash mA +
+            (let mutable c = 0 
+             for i = 0 to mA - 1 do
+                 c <- combineHash c (comp.GetHashCode a.[i])
+             c)
+          
+        type range = int * int
+
+        let startR ((a,_) : range)   = a
+        let countR ((a,b) : range)   = (b-a)+1
+        let idxR    ((a,_) : range) i = a+i
+        let inR    ((a,b) : range) i = a <= i && i <= b
+        
+        let getRowM  (a:Matrix<_>) i = createRVx (opsM a) a.NumCols (fun j -> a.[i,j])
+        let selColM  (a:Matrix<_>) j = createVx (opsM a) a.NumRows (fun i -> a.[i,j]) 
+        let getRegionV  (a:Vector<_>)    r      = createVx a.OpsData (countR r) (fun i -> a.[idxR r i]) 
+        let getRegionRV (a:RowVector<_>) r      = createRVx a.OpsData (countR r) (fun i -> a.[idxR r i]) 
+
+        let getRegionM  a ri rj    = 
+            match a with 
+            | DenseRepr a -> createMx a.OpsData (countR ri) (countR rj) (fun i j -> a.[idxR ri i, idxR rj j]) 
+            | _ -> nonZeroEntriesM a 
+                   |> Seq.filter (fun (i,j,_) -> inR ri i && inR rj j) 
+                   |> Seq.map (fun (i,j,v) -> (i-startR ri,j-startR rj,v)) 
+                   |> initSparseM (countR ri) (countR rj)
+
+        let getColsM (a:Matrix<_>) rj         = getRegionM a (0,a.NumRows - 1) rj
+        let getRowsM (a:Matrix<_>) ri         = getRegionM a ri (0,a.NumCols - 1)
+
+        let rowvecM (x:RowVector<_>) = initM 1         x.NumCols (fun _ j -> x.[j]) 
+        let vectorM (x:Vector<_>) = initM x.NumRows  1         (fun i _ -> x.[i])  
+        let toVectorM x = selColM x 0 
+        let toRowVectorM x = getRowM x 0 
+        let toScalarM (x:Matrix<_>) = x.[0,0]
+
+
+
+//----------------------------------------------------------------------------
+// type Matrix<'T> augmentation
+//--------------------------------------------------------------------------*)
+
+    type Matrix<'T> with
+        static member ( +  )(a: Matrix<'T>,b) = SpecializedGenericImpl.addM a b
+        static member ( -  )(a: Matrix<'T>,b) = SpecializedGenericImpl.subM a b
+        static member ( *  )(a: Matrix<'T>,b) = SpecializedGenericImpl.mulM a b
+        static member ( *  )(a: Matrix<'T>,b : Vector<'T>) = SpecializedGenericImpl.mulMV a b
+
+        static member ( * )((m: Matrix<'T>),k : 'T) = SpecializedGenericImpl.scaleM k m
+
+        static member ( .* )(a: Matrix<'T>,b) = SpecializedGenericImpl.cptMulM a b
+        static member ( * )(k,m: Matrix<'T>) = SpecializedGenericImpl.scaleM k m
+        static member ( ~- )(m: Matrix<'T>)     = SpecializedGenericImpl.negM m
+        static member ( ~+ )(m: Matrix<'T>)     = m
+
+        member m.GetSlice (start1,finish1,start2,finish2) = 
+            let start1 = match start1 with None -> 0 | Some v -> v 
+            let finish1 = match finish1 with None -> m.NumRows - 1 | Some v -> v 
+            let start2 = match start2 with None -> 0 | Some v -> v 
+            let finish2 = match finish2 with None -> m.NumCols - 1 | Some v -> v 
+            SpecializedGenericImpl.getRegionM m (start1,finish1) (start2,finish2)
+
+        member m.SetSlice (start1,finish1,start2,finish2,vs:Matrix<_>) = 
+            let start1 = match start1 with None -> 0 | Some v -> v 
+            let finish1 = match finish1 with None -> m.NumRows - 1 | Some v -> v 
+            let start2 = match start2 with None -> 0 | Some v -> v 
+            let finish2 = match finish2 with None -> m.NumCols - 1 | Some v -> v 
+            for i = start1 to finish1  do 
+               for j = start2 to finish2 do
+                   m.[i,j] <- vs.[i-start1,j-start2]
+
+        override m.ToString() = 
+           match m with 
+           | DenseRepr m -> GenericImpl.showDenseMatrixGU m
+           | SparseRepr _ -> "<sparse>"
+
+        member m.DebugDisplay = 
+           let txt = 
+               match m with 
+               | DenseRepr m -> GenericImpl.debugShowDenseMatrixGU m
+               | SparseRepr _ -> "<sparse>"
+           new System.Text.StringBuilder(txt)  // return an object with a ToString with the right value, rather than a string. (strings get shown using quotes)
+
+        member m.StructuredDisplayAsArray =  
+            let rec layout m = 
+                match m with 
+                | DenseRepr _ -> box (Array2D.init m.NumRows m.NumCols (fun i j -> m.[i,j]))
+                | SparseRepr _ -> (if m.NumRows < 20 && m.NumCols < 20 then layout (SpecializedGenericImpl.toDenseM m) else box(SpecializedGenericImpl.nonZeroEntriesM m))
+            layout m
+        member m.Dimensions = m.NumRows,m.NumCols
+
+        member m.Transpose = SpecializedGenericImpl.transM m
+        member m.PermuteRows (p: permutation) : Matrix<'T> = SpecializedGenericImpl.permuteRows p m
+        member m.PermuteColumns (p: permutation) : Matrix<'T> = SpecializedGenericImpl.permuteColumns p m
+
+        interface IEnumerable<'T> with 
+            member m.GetEnumerator() = 
+               (seq { for i in 0 .. m.NumRows-1 do
+                        for j in 0 .. m.NumCols - 1 do 
+                            yield m.[i,j] }).GetEnumerator()
+
+        interface IEnumerable with 
+            member m.GetEnumerator() =  ((m :> IEnumerable<_>).GetEnumerator() :> IEnumerator)
+                                    
+        interface System.IComparable with 
+             member m.CompareTo(yobj:obj) = SpecializedGenericImpl.compareM LanguagePrimitives.GenericComparer m (yobj :?> Matrix<'T>)
+             
+        interface IStructuralComparable with
+            member m.CompareTo(yobj:obj,comp:System.Collections.IComparer) = SpecializedGenericImpl.compareM comp m (yobj :?> Matrix<'T>)
+            
+        override m.GetHashCode() = SpecializedGenericImpl.hashM LanguagePrimitives.GenericEqualityComparer m 
+        override m.Equals(yobj:obj) = 
+            match yobj with 
+            | :? Matrix<'T> as m2 -> SpecializedGenericImpl.equalsM LanguagePrimitives.GenericEqualityComparer m m2
+            | _ -> false
+        
+        interface IStructuralEquatable with
+            member m.GetHashCode(comp:System.Collections.IEqualityComparer) = SpecializedGenericImpl.hashM comp m
+            member m.Equals(yobj:obj,comp:System.Collections.IEqualityComparer) = 
+                match yobj with 
+                | :? Matrix<'T> as m2 -> SpecializedGenericImpl.equalsM comp m m2
+                | _ -> false
+
+
+//----------------------------------------------------------------------------
+// type Vector<'T> augmentation
+//--------------------------------------------------------------------------*)
+
+    type Vector<'T> with
+        static member ( +  )(a: Vector<'T>,b) = SpecializedGenericImpl.addV a b
+        static member ( -  )(a: Vector<'T>,b) = SpecializedGenericImpl.subV a b
+        static member ( .* )(a: Vector<'T>,b) = SpecializedGenericImpl.cptMulV a b
+        
+        static member ( * )(k,m: Vector<'T>) = SpecializedGenericImpl.scaleV k m
+        
+        static member ( * )(a: Vector<'T>,b) = SpecializedGenericImpl.mulVRV a b
+        
+        static member ( * )(m: Vector<'T>,k) = SpecializedGenericImpl.scaleV k m
+        
+        static member ( ~- )(m: Vector<'T>)     = SpecializedGenericImpl.negV m
+        static member ( ~+ )(m: Vector<'T>)     = m
+
+        member m.GetSlice (start,finish) = 
+            let start = match start with None -> 0 | Some v -> v 
+            let finish = match finish with None -> m.NumRows - 1 | Some v -> v 
+            SpecializedGenericImpl.getRegionV m (start,finish)
+
+        member m.SetSlice (start,finish,vs:Vector<_>) = 
+            let start = match start with None -> 0 | Some v -> v 
+            let finish = match finish with None -> m.NumRows - 1 | Some v -> v 
+            for i = start to finish  do 
+                   m.[i] <- vs.[i-start]
+
+
+        override m.ToString() = GenericImpl.showVecGU "vector" m
+
+        member m.DebugDisplay = 
+            let txt = GenericImpl.showVecGU "vector" m
+            new System.Text.StringBuilder(txt)  // return an object with a ToString with the right value, rather than a string. (strings get shown using quotes)
+
+        member m.StructuredDisplayAsArray =  Array.init m.NumRows (fun i -> m.[i])
+
+        member m.Details = m.Values
+
+        member m.Transpose = SpecializedGenericImpl.transV m
+        
+        member m.Permute (p:permutation) = SpecializedGenericImpl.permuteV p m
+      
+        interface System.IComparable with 
+             member m.CompareTo(y:obj) = SpecializedGenericImpl.compareV LanguagePrimitives.GenericComparer m (y :?> Vector<'T>)
+        
+        interface IStructuralComparable with
+            member m.CompareTo(y:obj,comp:System.Collections.IComparer) = SpecializedGenericImpl.compareV comp m (y :?> Vector<'T>)
+
+        interface IStructuralEquatable with
+            member x.GetHashCode(comp) = SpecializedGenericImpl.hashV comp x
+            member x.Equals(yobj,comp) = 
+                match yobj with 
+                | :? Vector<'T> as v2 -> SpecializedGenericImpl.equalsV comp x v2
+                | _ -> false
+
+        override x.GetHashCode() = 
+            SpecializedGenericImpl.hashV LanguagePrimitives.GenericEqualityComparer x
+
+        override x.Equals(yobj) = 
+            match yobj with 
+            | :? Vector<'T> as v2 -> SpecializedGenericImpl.equalsV LanguagePrimitives.GenericEqualityComparer x v2
+            | _ -> false
+
+//----------------------------------------------------------------------------
+// type RowVector<'T> augmentation
+//--------------------------------------------------------------------------*)
+
+    type RowVector<'T> with
+        static member ( +  )(a: RowVector<'T>,b) = SpecializedGenericImpl.addRV a b
+        static member ( -  )(a: RowVector<'T>,b) = SpecializedGenericImpl.subRV a b
+        static member ( .* )(a: RowVector<'T>,b) = SpecializedGenericImpl.cptMulRV a b
+        static member ( * )(k,v: RowVector<'T>) = SpecializedGenericImpl.scaleRV k v
+        
+        static member ( * )(a: RowVector<'T>,b: Matrix<'T>) = SpecializedGenericImpl.mulRVM a b
+        static member ( * )(a: RowVector<'T>,b:Vector<'T>) = SpecializedGenericImpl.mulRVV a b
+        static member ( * )(v: RowVector<'T>,k:'T) = SpecializedGenericImpl.scaleRV k v
+        
+        static member ( ~- )(v: RowVector<'T>)     = SpecializedGenericImpl.negRV v
+        static member ( ~+ )(v: RowVector<'T>)     = v
+
+        member m.GetSlice (start,finish) = 
+            let start = match start with None -> 0 | Some v -> v
+            let finish = match finish with None -> m.NumCols - 1 | Some v -> v 
+            SpecializedGenericImpl.getRegionRV m (start,finish)
+
+        member m.SetSlice (start,finish,vs:RowVector<_>) = 
+            let start = match start with None -> 0 | Some v -> v 
+            let finish = match finish with None -> m.NumCols - 1 | Some v -> v 
+            for i = start to finish  do 
+                   m.[i] <- vs.[i-start]
+
+        override m.ToString() = GenericImpl.showRowVecGU "rowvec" m
+
+        member m.DebugDisplay = 
+            let txt = GenericImpl.showRowVecGU "rowvec" m
+            new System.Text.StringBuilder(txt)  // return an object with a ToString with the right value, rather than a string. (strings get shown using quotes)
+
+        member m.StructuredDisplayAsArray =  Array.init m.NumCols (fun i -> m.[i])
+
+        member m.Details = m.Values
+
+        member m.Transpose = SpecializedGenericImpl.transRV m
+        
+        member m.Permute (p:permutation) = SpecializedGenericImpl.permuteRV p m
+      
+        interface System.IComparable with 
+            member m.CompareTo(y) = SpecializedGenericImpl.compareRV LanguagePrimitives.GenericComparer m (y :?> RowVector<'T>)
+        
+        interface IStructuralComparable with
+            member m.CompareTo(y,comp) = SpecializedGenericImpl.compareRV comp m (y :?> RowVector<'T>)
+
+        interface IStructuralEquatable with
+            member x.GetHashCode(comp) = SpecializedGenericImpl.hashRV comp x
+            member x.Equals(yobj,comp) = 
+                match yobj with 
+                | :? RowVector<'T> as rv2 -> SpecializedGenericImpl.equalsRV comp x rv2
+                | _ -> false
+
+        override x.GetHashCode() = 
+            SpecializedGenericImpl.hashRV LanguagePrimitives.GenericEqualityComparer x
+
+        override x.Equals(yobj) = 
+            match yobj with 
+            | :? RowVector<'T> as rv2 -> SpecializedGenericImpl.equalsRV LanguagePrimitives.GenericEqualityComparer x rv2
+            | _ -> false
+
+    type matrix = Matrix<float>
+    type vector = Vector<float>
+    type rowvec = RowVector<float>
+
+    module MRandom = 
+        let seed = 99
+        let randomGen = new System.Random(seed)
+        let float f = randomGen.NextDouble() * f 
+
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module Matrix = begin
+        
+        module Generic = begin
+
+            module MS = SpecializedGenericImpl
+
+            // Accessors
+            let get (a:Matrix<_>) i j   = a.[i,j]
+            let set (a:Matrix<_>) i j x = a.[i,j] <- x
+            
+            // Creation
+            let ofList    xss      = MS.listM  xss
+            let ofSeq     xss      = MS.seqM  xss
+            let init  m n f       = MS.initM  m n f
+            let ofArray2D (arr: 'T[,])  : Matrix<'T>       = MS.arrayM arr
+            let toArray2D (m:Matrix<_>) = Array2D.init m.NumRows m.NumCols (fun i j -> get m i j)
+            let initNumeric m n f = MS.initNumericM m n f
+            let zero m n            = MS.zeroM m n
+            let identity m          = MS.identityM m
+            let create  m n x       = MS.constM m n x
+
+            let ofScalar   x        = MS.scalarM x
+
+            let diag v              = MS.diagM v
+            let initDiagonal v      = MS.diagM v
+            let constDiag   n x     = MS.constDiagM n x
+          
+            // Operators
+            let add a b = MS.addM a b
+            let sub a b = MS.subM a b
+            let mul a b = MS.mulM a b
+            let mulRV a b = MS.mulRVM a b
+            let mulV a b = MS.mulMV a b
+            let cptMul a b = MS.cptMulM a b
+            let cptMax a b = MS.cptMaxM a b
+            let cptMin a b = MS.cptMinM a b
+            let scale a b = MS.scaleM a b
+            let dot a b = MS.dotM a b
+            let neg a = MS.negM a 
+            let trace a = MS.traceM a
+            let sum a = MS.sumM a
+            let prod a = MS.prodM a
+            let norm a = MS.normM a
+            let transpose a = MS.transM a
+            let inplaceAdd a b = MS.inplaceAddM a b
+            let inplaceSub a b = MS.inplaceSubM a b
+
+            let exists  f a = MS.existsM  f a
+            let forall  f a = MS.forallM  f a
+            let existsi  f a = MS.existsiM  f a
+            let foralli  f a = MS.foralliM  f a
+            let map  f a = MS.mapM f a
+            let copy a = MS.copyM a
+            let mapi  f a = MS.mapiM f a
+            let getDiagN  a n = MS.getDiagnM a n
+            let getDiag  a = MS.getDiagnM a 0
+            let toDense a = MS.toDenseM a 
+
+            let initDense i j a = MS.initDenseM i j a 
+            let initSparse i j a = MS.initSparseM i j a 
+
+            let fold  f z a = MS.foldM f z a
+            let foldi f z a = MS.foldiM f z a
+          
+            let compare a b = MS.compareM LanguagePrimitives.GenericComparer a b
+            let hash a      = MS.hashM LanguagePrimitives.GenericEqualityComparer a
+            let getRow    a i           = MS.getRowM a i
+            let getCol    a j           = MS.selColM a j
+            let getCols   a i1 i2       = MS.getColsM a (i1,i1+i2-1)
+            let getRows   a j1 j2       = MS.getRowsM a (j1,j1+j2-1)
+            let getRegion a i1 j1 i2 j2 = MS.getRegionM a (i1,i1+i2-1) (j1,j1+j2-1)
+            
+            let ofRowVector x = MS.rowvecM x
+            let ofVector    x = MS.vectorM x
+            let toVector    x = MS.toVectorM x
+            let toRowVector x = MS.toRowVectorM x
+            let toScalar    x = MS.toScalarM x
+
+            let inplace_assign f a  = MS.inplaceAssignM  f a
+            let inplace_cptMul a b = MS.inplaceCptMulM a b
+            let inplace_scale a b = MS.inplaceScaleM a b
+            let inplace_mapi  f a = MS.inplace_mapiM f a
+            let of_rowvec x           = ofRowVector x
+            let of_vector x           = ofVector x
+            let to_vector x           = toVector x
+            let to_rowvec x           = toRowVector x
+            let to_scalar x           = toScalar x
+            let inplace_add a b       = inplaceAdd a b
+            let inplace_sub a b       = inplaceSub a b
+            let of_scalar   x         = ofScalar x
+            let of_list    xss        = ofList xss
+            let of_seq     xss        = ofSeq xss
+            let inline of_array2D arr = ofArray2D arr
+            let inline to_array2D m   = toArray2D m
+            let init_diagonal v       = initDiagonal v
+            let to_dense a            = toDense a
+            let init_dense i j a      = initDense i j a
+            let init_sparse i j a     = initSparse i j a
+            let nonzero_entries a     = MS.nonZeroEntriesM a 
+         
+        end
+
+        module MG = Generic
+        module DS = DoubleImpl
+        module GU = GenericImpl
+        module MS = SpecializedGenericImpl
+
+        // Element type OpsData
+        type elem = float
+
+        // Accessors
+        let get (a:matrix) i j   = MG.get a i j
+        let set (a:matrix) i j x = MG.set a i j x
+        
+        // Creation
+        let init  m n f = DS.initDenseMatrixDS  m n f |> MS.dense 
+        let ofList    xss   = DS.listDenseMatrixDS    xss |> MS.dense
+        let ofSeq     xss   = DS.seqDenseMatrixDS    xss |> MS.dense
+        let diag  (v:vector)   = MG.diag v 
+        let initDiagonal  (v:vector)   = MG.diag v 
+        let constDiag  n x : matrix  = MG.constDiag n x 
+        let create  m n x  = DS.constDenseMatrixDS  m n x |> MS.dense
+        let ofScalar x     = DS.scalarDenseMatrixDS x |> MS.dense
+
+        let ofArray2D arr : matrix = MG.ofArray2D arr
+        let toArray2D (m : matrix) = MG.toArray2D m
+
+        let getDiagN  (a:matrix) n = MG.getDiagN a n
+        let getDiag  (a:matrix) = MG.getDiag a
+
+        // Operators
+        let add (a:matrix) (b:matrix) = MS.addM   a b
+        let sub (a:matrix) (b:matrix) = MS.subM   a b
+        let mul (a:matrix) (b:matrix) = MS.mulM   a b
+        let mulV (a:matrix) (b:vector) = MS.mulMV   a b
+        let mulRV (a:rowvec) (b:matrix) = MS.mulRVM   a b
+        let cptMul (a:matrix) (b:matrix) = MS.cptMulM   a b
+        let cptMax (a:matrix) (b:matrix) = MS.cptMaxM a b
+        let cptMin (a:matrix) (b:matrix) = MS.cptMinM a b
+        let scale a (b:matrix) = MS.scaleM   a b
+        let neg (a:matrix)  = MS.negM a
+        let trace (a:matrix)  = MS.traceM a
+        let transpose  (a:matrix) = MG.transpose a
+        let forall f (a:matrix) = MG.forall f a
+        let exists  f (a:matrix) = MG.exists f a
+        let foralli f (a:matrix) = MG.foralli f a
+        let existsi  f (a:matrix) = MG.existsi f a
+        let map  f (a:matrix) = MG.map f a
+        let copy  (a:matrix) = MG.copy a
+        let mapi  f (a:matrix) : matrix = MG.mapi f a
+        let fold  f z (a:matrix) = MG.fold f z a
+        let foldi  f z (a:matrix) = MG.foldi f z a
+
+        let toDense (a:matrix) = MG.toDense a 
+        let initDense i j a : matrix = MG.initDense i j a 
+        let initSparse i j a : matrix = MG.initSparse i j a 
+        let nonzero_entries (a:matrix) = MG.nonzero_entries a 
+
+        let zero m n  = DS.zeroDenseMatrixDS m n |> MS.dense
+        let identity m  : matrix = MG.identity m 
+        
+        let ones m n  = create m n 1.0
+        
+        let getRow (a:matrix) i      = MG.getRow a i
+        let getCol (a:matrix) j      = MG.getCol a j
+        let getCols (a:matrix) i1 i2    = MG.getCols a i1 i2
+        let getRows (a:matrix) j1 j2    = MG.getRows a j1 j2
+        let getRegion (a:matrix) i1 j1 i2 j2    = MG.getRegion a i1 j1 i2 j2
+
+        let rowRange (a:Matrix<_>) = (0,a.NumRows - 1)
+        let colRange (a:Matrix<_>) = (0,a.NumCols - 1)
+        let wholeRegion a = (colRange a, rowRange a)
+        
+        let foldByRow f (z:Vector<'T>) (a:matrix) = 
+          colRange a |> GU.foldR (fun z j -> MS.mapiV (fun i z -> f z (get a i j)) z) z
+        let foldByCol f (z:RowVector<'T>) (a:matrix) = 
+          rowRange a |> GU.foldR (fun z i -> MS.mapiRV (fun j z -> f z (get a i j)) z) z
+
+        let foldRow f (z:'T) (a:matrix) i = 
+          colRange a |> GU.foldR (fun (z:'T) j -> f z (get a i j)) z
+        let foldCol f (z:'T) (a:matrix) j = 
+          rowRange a |> GU.foldR (fun (z:'T) i -> f z (get a i j)) z
+
+        let sum (a:matrix)  = MS.sumM a
+        let prod (a:matrix)  = MS.prodM a
+        let norm  (a:matrix) = MS.normM  a
+        let dot (a:matrix) b = MS.dotM a b
+
+        let cptPow  a y = map (fun x -> x ** y) a
+        
+        // Functions that only make sense on this type
+        let randomize v = map (fun vij -> MRandom.float vij) v      (* res_ij = random [0,vij] values *)
+
+        let ofRowVector x : matrix = MS.rowvecM x
+        let ofVector    x : matrix = MS.vectorM x
+        let toVector    x : vector = MS.toVectorM x
+        let toRowVector x : rowvec = MS.toRowVectorM x
+        let toScalar    x : float  = MS.toScalarM x
+
+        let inplaceAdd  (a:matrix) b = MS.inplaceAddM a b
+        let inplaceSub  (a:matrix) b = MS.inplaceSubM a b
+
+        // Mutation
+        let inplace_assign  f (a:matrix) = MG.inplace_assign f a
+        let inplace_mapi  f (a:matrix) = MG.inplace_mapi f a
+        let inplace_cptMul (a:matrix) b = MS.inplaceCptMulM a b
+        let inplace_scale  a (b:matrix) = MS.inplaceScaleM a b
+
+        let inplace_add  a b = inplaceAdd a b
+        let inplace_sub  a b = inplaceSub a b
+        let of_rowvec x = ofRowVector x
+        let of_vector x = ofVector x
+        let to_vector x = toVector x
+        let to_rowvec x = toRowVector x
+        let to_scalar x = toScalar x
+        let inline of_array2D arr  = ofArray2D arr
+        let inline to_array2D m = toArray2D m
+        let of_list    xss   = ofList xss
+        let of_seq     xss   = ofSeq xss
+        let init_diagonal v   = initDiagonal   v
+        let of_scalar x     = ofScalar x
+        let to_dense x = toDense x
+        let init_dense i j a = initDense i j a
+        let init_sparse i j a = initSparse i j a
+
+
+    end
+
+
+//----------------------------------------------------------------------------
+// module Vector
+//--------------------------------------------------------------------------*)
+      
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module Vector = 
+
+        module Generic = 
+
+            module OpsS = SpecializedGenericImpl
+
+            let get (a:Vector<_>) i   = a.[i]
+            let set (a:Vector<_>) i x = a.[i] <- x
+            let length (v:Vector<_>) = v.Length
+            let ofList    xss   = OpsS.listV xss
+            let ofSeq    xss   = OpsS.seqV xss
+            let init  m   f = OpsS.initV m f
+            let initNumeric  m   f = OpsS.createNumericV m f
+            let ofArray arr       = OpsS.arrayV arr
+            let toArray (v:Vector<_>) = Array.init v.Length (get v)
+
+            let create  m x   = OpsS.constV m x
+            let zero n = OpsS.zeroV n
+            let ones n = OpsS.createNumericV n (fun ops _ -> ops.One)
+            let ofScalar   x = OpsS.scalarV x
+            let add a b = OpsS.addV a b
+            let sub a b = OpsS.subV a b
+            let mulRVV a b = OpsS.mulRVV a b
+            let mulVRV a b = OpsS.mulVRV a b
+            let cptMul a b = OpsS.cptMulV a b
+            let cptMax a b = OpsS.cptMaxV a b
+            let cptMin a b = OpsS.cptMinV a b
+            let scale a b = OpsS.scaleV a b
+            let dot a b = OpsS.dotV a b
+            let neg a = OpsS.negV a 
+            let transpose a = OpsS.transV a 
+            let inplaceAdd a b = OpsS.inplaceAddV a b
+            let inplaceSub a b = OpsS.inplaceSubV a b
+            let inplace_cptMul a b = OpsS.inplaceCptMulV a b
+            let inplace_scale a b = OpsS.inplaceScaleV a b
+
+
+
+            let exists  f a = OpsS.existsV  f a
+            let forall  f a = OpsS.forallV  f a
+            let existsi  f a = OpsS.existsiV  f a
+            let foralli  f a = OpsS.foralliV  f a
+            let map  f a = OpsS.mapV f a
+            let mapi f a = OpsS.mapiV f a
+            let copy a = OpsS.copyV a
+            let inplace_mapi  f a = OpsS.inplace_mapiV f a
+            let fold  f z a = OpsS.foldV f z a
+            let foldi  f z a = OpsS.foldiV f z a
+            let compare a b = OpsS.compareV a b
+            let hash a = OpsS.hashV a
+            let inplace_assign  f a = OpsS.assignV f a
+            let sum  (a:Vector<_>) = let ops = a.ElementOps in fold (fun x y -> ops.Add(x,y)) ops.Zero a
+            let prod (a:Vector<_>) = let ops = a.ElementOps in fold (fun x y -> ops.Multiply(x,y)) ops.One a
+            let norm (a:Vector<_>) = 
+                let normOps = GenericImpl.getNormOps a.ElementOps 
+                sqrt (fold (fun x y -> x + normOps.Norm(y)**2.0) 0.0 a)
+
+            let of_list    xss  = ofList xss
+            let of_seq    xss   = ofSeq xss
+            let of_array arr    = ofArray arr
+            let to_array v      = toArray v
+            let of_scalar   x   = ofScalar x
+            let inplace_add a b = inplaceAdd a b
+            let inplace_sub a b = inplaceSub a b
+
+        module VG = Generic
+        module VecDS = DoubleImpl
+        module VecGU = GenericImpl
+
+        let get (a:vector) j   = VG.get a j 
+        let set (a:vector) j x = VG.set a j x
+        let length (a:vector)     = VG.length a
+        let nrows (a:vector)   = VG.length a
+        let init  m   f = VecDS.createVecDS  m   f
+        let ofArray arr : vector = VG.ofArray arr
+        let toArray (m : vector) = VG.toArray m
+
+        type range = int * int
+        let countR ((a,b) : range)   = (b-a)+1
+        let idxR    ((a,_) : range) i = a+i
+        type rangef = float * float * float // start, skip, end
+        let countRF ((a,d,b) : rangef)   = System.Convert.ToInt32((b-a)/d) + 1
+        //let countRF ((a,d,b) : rangef)   = Float.to_int((b-a)/d) + 1
+        let idxRF  ((a,d,b) : rangef) i = System.Math.Min (a + d * float(i),b)
+
+        let range n1 n2    = let r = (n1,n2)   in init (countR  r) (fun i -> float(idxR r i)) 
+
+        let rangef a b c  = let r = (a,b,c) in init (countRF r) (fun i -> idxRF r i)
+
+        let ofList    xs    = VecDS.listVecDS    xs
+        let ofSeq    xs    = VecDS.seqVecDS    xs
+        let create  m   x  = VecDS.constVecDS  m   x
+        let ofScalar x     = VecDS.scalarVecDS x
+        let add a b = VecDS.addVecDS   a b
+        let sub a b = VecDS.subVecDS   a b
+        let mulRVV a b = VecDS.mulRowVecVecDS   a b
+        let mulVRV a b = VecDS.mulVecRowVecDS   a b 
+        let cptMul a b = VecDS.cptMulVecDS   a b
+        let cptMax a b = VecDS.cptMaxVecDS a b
+        let cptMin a b = VecDS.cptMinVecDS a b
+        let scale a b = VecDS.scaleVecDS   a b
+        let neg a  = VecDS.negVecDS a
+        let dot a b = VecDS.dotVecDS a b
+        let transpose  (a:vector) = VG.transpose a
+        let exists  f (a:vector) = VG.exists f a
+        let forall  f (a:vector) = VG.forall f a
+        let existsi  f (a:vector) = VG.existsi f a
+        let foralli  f (a:vector) = VG.foralli f a
+        let map  f (a:vector) = VG.map f a
+        let copy (a:vector) = VG.copy a
+        let mapi  f (a:vector) : vector = VG.mapi f a
+        let fold  f z (a:vector) = VG.fold f z a
+        let foldi  f z (a:vector) = VG.foldi f z a
+        let zero n = create n 0.0
+        let ones n = create n 1.0
+        let sum a  = VecDS.sumVecDS a
+        let prod a   = fold      (fun x y -> x * y) 1.0 a
+        let norm  (a:vector) = sqrt (fold (fun x y -> x + y * y) 0.0 a) (* fixed *)
+        let cptPow  a y = map  (fun x -> x ** y) a
+        let inplace_assign  f (a:vector) = VG.inplace_assign f a
+        let inplace_mapi f (a:vector) = VG.inplace_mapi f a
+        let inplace_add a b = VecDS.inplaceAddVecDS a b
+        let inplace_sub a b = VecDS.inplaceSubVecDS a b
+        let inplace_cptMul a b = VecDS.inplaceCptMulVecDS a b
+        let inplace_scale a b = VecDS.inplaceScaleVecDS a b  
+
+        let of_array arr   = ofArray arr
+        let to_array m     = toArray m
+        let of_list    xs  = ofList xs
+        let of_seq    xs   = ofSeq xs
+        let of_scalar x    = ofScalar x
+
+
+
+//----------------------------------------------------------------------------
+// module RowVector
+//--------------------------------------------------------------------------*)
+
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module RowVector = 
+
+        module Generic = 
+
+            module OpsS = SpecializedGenericImpl
+
+            let get (a:RowVector<_>) i          = a.[i]
+            let set (a:RowVector<_>) i x        = a.[i] <- x
+            let zero n           = OpsS.zeroRV n
+            let length (v:RowVector<_>) = v.Length
+            let init m   f       = OpsS.initRV m   f
+            let create  m x      = OpsS.constRV m x
+            let transpose a      = OpsS.transRV a
+            let copy a           = OpsS.copyRV a
+            let ofList a         = OpsS.listRV a
+            let ofArray a        = OpsS.arrayRV a
+            let ofSeq a          = OpsS.seqRV a
+            let toArray m        = Array.init (length m) (get m)
+
+            let of_list a        = ofList a
+            let of_array a       = ofArray a
+            let of_seq a         = ofSeq a
+            let to_array m       = toArray m
+
+
+        module RVG = Generic
+
+        let get (a:rowvec) i   = RVG.get a i 
+        let set (a:rowvec) i x = RVG.set a i x
+        let length (a:rowvec)  = RVG.length a
+        let ncols (a:rowvec)   = RVG.length a
+        let ofArray arr : rowvec = RVG.ofArray arr
+        let toArray (m : rowvec) = RVG.toArray m
+        
+        let init m   f : rowvec      = RVG.init m   f
+        let create m   f : rowvec    = RVG.create m   f
+        let zero n = create n 0.0
+        let ofList x : rowvec       = RVG.ofList x
+        let ofSeq x : rowvec       = RVG.ofSeq x
+        let transpose x : vector     = RVG.transpose x
+        let copy x : rowvec          = RVG.copy x
+
+        let of_list x    = ofList x
+        let of_seq x     = ofSeq x
+        let of_array arr = ofArray arr
+        let to_array m   = toArray m
+
+
+    type Matrix<'T> with 
+        member x.ToArray2()        = Matrix.Generic.toArray2D x
+        member x.ToArray2D()        = Matrix.Generic.toArray2D x
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+
+        member x.NonZeroEntries    = Matrix.Generic.nonzero_entries x
+        member x.ToScalar()        = Matrix.Generic.toScalar x
+        member x.ToRowVector()     = Matrix.Generic.toRowVector x               
+        member x.ToVector()        = Matrix.Generic.toVector x
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member x.Norm              = Matrix.Generic.norm x
+
+        member x.Column(n)         = Matrix.Generic.getCol x n
+        member x.Row(n)            = Matrix.Generic.getRow x n
+        member x.Columns (i,ni)    = Matrix.Generic.getCols x i ni
+        member x.Rows (j,nj)       = Matrix.Generic.getRows x j nj
+        member x.Region(i,j,ni,nj) = Matrix.Generic.getRegion x i j ni nj
+        member x.GetDiagonal(i)    = Matrix.Generic.getDiagN x i
+
+#if FX_NO_DEBUG_DISPLAYS
+#else
+        [<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
+#endif
+        member x.Diagonal          = Matrix.Generic.getDiag x
+
+        member x.Copy () = Matrix.Generic.copy x
+
+
+    type Vector<'T> with 
+        member x.ToArray() = Vector.Generic.toArray x
+        member x.Norm      = Vector.Generic.norm x
+        member x.Copy ()   = Vector.Generic.copy x
+
+
+    type RowVector<'T> with 
+        member x.ToArray() = RowVector.Generic.toArray x
+        member x.Copy ()   = RowVector.Generic.copy x
+
+
+namespace Microsoft.FSharp.Core
+
+    /// The type of floating-point matrices. See Microsoft.FSharp.Math
+    type matrix = Microsoft.FSharp.Math.matrix
+    /// The type of floating-point vectors. See Microsoft.FSharp.Math
+    type vector = Microsoft.FSharp.Math.vector
+    /// The type of floating-point row vectors. See Microsoft.FSharp.Math
+    type rowvec = Microsoft.FSharp.Math.rowvec
+
+    [<AutoOpen>]
+    module MatrixTopLevelOperators = 
+
+        let matrix ll = Microsoft.FSharp.Math.Matrix.ofSeq ll
+        let vector l  = Microsoft.FSharp.Math.Vector.ofSeq  l
+        let rowvec l  = Microsoft.FSharp.Math.RowVector.ofSeq l
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fsi
new file mode 100644
index 0000000..80f619d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/matrix.fsi
@@ -0,0 +1,1106 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+open Microsoft.FSharp.Math
+open System
+open System.Collections
+open System.Collections.Generic
+
+/// The type of matrices. The arithmetic operations on the element type are determined by inspection on the element type itself.
+/// Two representations are supported: sparse and dense. 
+[<Sealed>]
+type Matrix<'T> = 
+
+    /// Get the number of rows in a matrix
+    member NumRows : int
+
+    /// Get the number of columns in a matrix
+    member NumCols : int
+
+    /// Get the number of (rows,columns) in a matrix
+    member Dimensions : int * int
+
+    /// Get the item at the given position in a matrix
+    member Item : int * int -> 'T with get,set
+
+    /// Supports the slicing syntax 'A.[idx1..idx2,idx1..idx2]'
+    member GetSlice : start1:int option * finish1:int option * start2:int option * finish2:int option -> Matrix<'T>
+
+    /// Supports the slicing syntax 'A.[idx1..idx2,idx1..idx2] <- B'
+    member SetSlice : start1:int option * finish1:int option * start2:int option * finish2:int option * source:Matrix<'T> -> unit
+    
+    /// Retrieve the dictionary of numeric operations associated with the element
+    /// type of this matrix. Accessing the property may raise an NotSupportedException if the element
+    /// type doesn't support any numeric operations. The object returned
+    /// may support additional numeric operations such as IFractional: 
+    /// this can be determined by a dynamic type test against the object
+    /// returned.
+    member ElementOps : INumeric<'T>
+
+    /// Point-wise addition of two matrices. An InvalidArgument exception will be
+    /// raised if the dimensions do not match.
+    static member ( +  ) : Matrix<'T> * Matrix<'T> -> Matrix<'T>
+
+    /// Point-wise subtraction of two matrices. An InvalidArgument exception will be
+    /// raised if the dimensions do not match.
+    static member ( -  ) : Matrix<'T> * Matrix<'T> -> Matrix<'T>
+
+    /// Matrix negation. 
+    static member ( ~- ) : Matrix<'T>              -> Matrix<'T>
+
+    /// Prefix '+' operator. A nop.
+    static member ( ~+ ) : Matrix<'T>              -> Matrix<'T>
+
+    /// Matrix multiplication. An InvalidArgument exception will be
+    /// raised if the dimensions do not match.
+    static member ( * ) : Matrix<'T> * Matrix<'T> -> Matrix<'T>
+
+    /// Matrix-vector multiplication. 
+    static member ( * ) : Matrix<'T> * Vector<'T> -> Vector<'T>
+
+    /// Multiply each element of a matrix by the given scalar value
+    static member ( * ) : Matrix<'T> * 'T          -> Matrix<'T>
+
+    /// Point-wise matrix multiplication. An InvalidArgument exception will be
+    /// raised if the dimensions do not match.
+    static member ( .* ) : Matrix<'T> * Matrix<'T>  -> Matrix<'T>
+
+    /// Multiply each element of a matrix by a scalar value
+    static member ( * ) : 'T          * Matrix<'T> -> Matrix<'T>
+    
+    /// Get the transpose of a matrix.
+    member Transpose : Matrix<'T>
+    
+    /// Permutes the rows of a matrix.
+    member PermuteRows : permutation:(int -> int) -> Matrix<'T>
+    
+    /// Permutes the columns of a matrix.
+    member PermuteColumns : permutation:(int -> int) -> Matrix<'T>
+
+
+    //interface IMatrix<'T>
+    interface IComparable
+    interface IStructuralComparable
+    interface IStructuralEquatable
+    interface IEnumerable<'T>
+    override GetHashCode : unit -> int
+    override Equals : obj -> bool
+  
+    /// Return a new array containing the elements of a matrix
+    member ToArray2D : unit -> 'T[,]  
+
+    /// Return the non-zero entries of a sparse or dense matrix
+    member NonZeroEntries: seq<int * int * 'T> 
+
+    /// Convert a matrix to a row vector
+    member ToRowVector : unit -> RowVector<'T>                 
+
+    /// Convert a matrix to a column vector
+    member ToVector : unit -> Vector<'T> 
+
+    /// Returns sqrt(sum(norm(x)*(norm(x))) of all the elements of a matrix.
+    /// The element type of a matrix must have an associated instance of INormFloat<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+    member Norm : float
+
+    /// Select a column from a matrix
+    member Column : index:int -> Vector<'T>
+
+    /// Select a row from a matrix
+    member Row :  index:int -> RowVector<'T>
+
+    /// Select a range of columns from a matrix
+    member Columns : start:int  * length:int -> Matrix<'T>
+
+    /// Select a range of rows from a matrix
+    member Rows : start:int * length:int -> Matrix<'T>
+
+    /// Select a region from a matrix
+    member Region : starti:int * startj:int * lengthi:int * lengthj:int -> Matrix<'T>
+
+
+    /// Return the nth diagonal of a matrix, as a vector. Diagonal 0 is the primary
+    /// diagonal, positive diagonals are further to the upper-right of a matrix.
+    member GetDiagonal : int -> Vector<'T>
+
+    /// Get the main diagonal of a matrix, as a vector
+    member Diagonal : Vector<'T>
+
+    /// Create a new matrix that is a copy of an array
+    member Copy : unit -> Matrix<'T>
+
+    /// Get the internal array of values for a dense matrix. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalDenseValues : 'T[,]
+    /// Get the internal array of values for a sparse matrix. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalSparseValues : 'T[]
+    /// Get the internal array of row offsets for a sparse matrix. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalSparseRowOffsets : int[]
+    /// Get the internal array of column values for a sparse matrix. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalSparseColumnValues : int[]
+
+    /// Indicates if a matrix uses the sparse representation.
+    member IsSparse : bool
+
+    /// Indicates if a matrix uses the dense representation.
+    member IsDense : bool
+
+    [<System.Obsolete("This member has been renamed to 'ToArray2D'")>]
+    member ToArray2 : unit -> 'T[,]  
+
+/// The type of column vectors. The arithmetic operations on the element type are determined by inspection 
+/// on the element type itself
+and 
+
+  [<Sealed>]
+  Vector<'T> = 
+
+
+    /// Get the underlying internal array of values for a vector. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalValues : 'T[]
+
+    /// Gets the number of entries in a vector
+    member Length : int
+
+    /// Gets the number of rows in a vector
+    member NumRows : int
+
+    /// Gets an item from a vector
+    member Item : int -> 'T with get,set
+
+    /// Gets the element operations for the element type of a vector, if any
+    member ElementOps : INumeric<'T>
+    
+    /// Supports the slicing syntax 'v.[idx1..idx2]'
+    member GetSlice      : start:int option * finish:int option -> Vector<'T>
+
+    /// Supports the slicing syntax 'v.[idx1..idx2] <- v2'
+    member SetSlice      : start:int option * finish:int option * source:Vector<'T> -> unit
+
+    /// Add two vectors, pointwise
+    static member ( +  ) : Vector<'T>    * Vector<'T> -> Vector<'T>
+
+    /// Subtract two vectors, pointwise
+    static member ( -  ) : Vector<'T>    * Vector<'T> -> Vector<'T>
+
+    /// Negate a vector
+    static member ( ~- ) : Vector<'T>                  -> Vector<'T>
+
+    /// Return the input vector 
+    static member ( ~+ ) : Vector<'T>                  -> Vector<'T>
+
+    /// Point-wise multiplication of two vectors.
+    static member ( .* ) : Vector<'T>    * Vector<'T> -> Vector<'T>
+
+    /// Multiply each element of a vector by a scalar value.
+    static member ( * ) : 'T             * Vector<'T> -> Vector<'T>
+
+    /// Multiply a column vector and a row vector to produce a matrix
+    static member ( * )   : Vector<'T>    * RowVector<'T> -> Matrix<'T>
+
+    /// Multiply a vector by a scalar
+    static member ( * )   : Vector<'T>    * 'T          -> Vector<'T>
+
+    /// Get the transpose of a vector.
+    member Transpose : RowVector<'T>
+    
+    /// Permute the elements of a vector.
+    member Permute : permutation:(int -> int) -> Vector<'T>    
+    
+    interface IComparable
+    interface IStructuralComparable
+    interface IStructuralEquatable
+    interface IEnumerable<'T>
+    override GetHashCode : unit -> int
+    override Equals : obj -> bool
+
+    /// Return a new array containing a copy of the elements of a vector
+    member ToArray : unit    -> 'T[]
+
+    /// Computes the 2-norm of a vector: sqrt(x.Transpose*x).
+    member Norm : float
+
+    /// Create a new matrix that is a copy of a array
+    member Copy : unit -> Vector<'T>
+
+
+
+
+
+/// The type of row vectors. 
+and [<Sealed>]
+    RowVector<'T> =
+
+    /// Get the underlying internal array of values for a vector. This property 
+    /// should only be used when interoperating with other matrix libraries.
+    member InternalValues : 'T[]
+
+    // Basic access
+    member Length : int
+    member NumCols : int
+    member Item : int -> 'T with get,set
+    member ElementOps : INumeric<'T>
+
+    /// Supports the slicing syntax 'rv.[idx1..idx2]'
+    member GetSlice      : start:int option * finish:int option -> RowVector<'T>
+
+    /// Supports the slicing syntax 'rv.[idx1..idx2] <- rv2'
+    member SetSlice      : start:int option * finish:int option * source:RowVector<'T> -> unit
+
+
+    /// Point-wise addition of two row vectors
+    static member ( +  )  : RowVector<'T>    * RowVector<'T> -> RowVector<'T>
+
+    /// Point-wise subtraction of two row vectors
+    static member ( -  )  : RowVector<'T>    * RowVector<'T> -> RowVector<'T>
+
+    /// Point-wise negation of a row vector
+    static member ( ~- )  : RowVector<'T>                  -> RowVector<'T>
+
+    /// Return a row vector, unchanged
+    static member ( ~+ )  : RowVector<'T>                  -> RowVector<'T>
+
+    /// Point-wise multiplication of two row vectors
+    static member ( .* )  : RowVector<'T> * RowVector<'T>    -> RowVector<'T>
+    
+    /// Multiply a row vector by a vector
+    static member ( * ) : RowVector<'T> * Vector<'T>    -> 'T
+
+    /// Multiply a row vector by a matrix
+    static member ( * )   : RowVector<'T> * Matrix<'T>    -> RowVector<'T>
+
+    /// Multiply a row vector by a scalar
+    static member ( * )   : RowVector<'T> * 'T            -> RowVector<'T>
+
+    /// Multiply a scalar by a row vector
+    static member ( * )  : 'T            * RowVector<'T>    -> RowVector<'T>
+
+    /// Get the transpose of the row vector.
+    member Transpose : Vector<'T>
+    
+    /// Permute the elements of the row vector.
+    member Permute : permutation:(int -> int) -> RowVector<'T>  
+
+    interface IComparable
+    interface IStructuralComparable
+    interface IStructuralEquatable
+    interface IEnumerable<'T>
+    override GetHashCode : unit -> int
+    override Equals : obj -> bool
+
+    /// Return a new array containing a copy of the elements of a vector
+    member ToArray : unit    -> 'T[]
+
+    /// Create a new matrix that is a copy of a array
+    member Copy : unit -> RowVector<'T>
+
+  
+/// The type of floating point matrices
+type matrix = Matrix<float>
+/// The type of floating point column vectors
+type vector = Vector<float>
+/// The type of floating point row vectors
+type rowvec = RowVector<float>
+
+/// Operations to manipulate floating
+/// point matrices. The submodule <c>Matrix.Generic</c> contains a 
+/// matching set of operations to manipulate matrix types carrying
+/// arbitrary element types.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<RequireQualifiedAccess>]
+module Matrix =
+
+
+    /// Get an element of a matrix
+    val get : matrix -> int -> int -> float
+
+    /// Set an element of a matrix
+    val set : matrix -> int -> int -> float -> unit
+
+    // Creation: general
+    val init  : int -> int -> (int -> int -> float) -> matrix
+
+    /// Create a matrix with all entries the given constant
+    val create : int -> int -> float -> matrix
+    
+    /// Create a dense representation matrix with the given entries. 
+    val initDense : int -> int -> seq<int * int * float> -> matrix
+
+    /// Create a sparse representation matrix with the given entries. Not all 
+    /// operations are available for sparse matrices, and mutation is not permitted.
+    /// If an operation on sparse matrices raises a runtime exception then consider 
+    /// converting to a dense matrix using to_dense.
+    val initSparse : int -> int -> seq<int * int * float> -> matrix
+
+    /// Create a matrix with all entries zero
+    val zero     : int -> int          -> matrix
+    
+    /// Create a square matrix with the constant 1.0 lying on diagonal
+    val identity      : int -> matrix
+
+    /// Create a square matrix with a vector lying on diagonal
+    val initDiagonal : vector -> matrix
+    
+    /// Create a matrix from the given data
+    val ofList   : float list list     -> matrix
+
+    /// Create a matrix from the given data
+    val ofSeq    : seq<#seq<float>>   -> matrix
+
+    /// Create a matrix from the given data
+    val ofArray2D : float[,]            -> matrix
+
+    /// Return a new array containing the elements of the given matrix
+    val toArray2D : matrix              -> float[,]
+
+
+    /// Create a 1x1 matrix containing the given value 
+    val ofScalar : float               -> matrix
+    /// Create a matrix with one row from the given row vector
+    val ofRowVector : rowvec              -> matrix
+    /// Create a matrix with one column from the given vector
+    val ofVector : vector              -> matrix
+
+    /// Return the element at row 0, column 0 of a matrix
+    val toScalar : matrix              -> float                
+    /// Return the first row of a matrix
+    val toRowVector : matrix              -> rowvec                
+    /// Return the first column of a matrix
+    val toVector : matrix              -> vector
+    /// Ensure that a matrix uses dense representation
+    val toDense  : matrix              -> matrix
+
+    /// Point-wise maximum element of two matrices
+    val cptMax    : matrix -> matrix -> matrix
+    
+    /// Point-wise minimum element of two matrices
+    val cptMin    : matrix -> matrix -> matrix
+    
+    /// Add two matrices (operator +)
+    val add       : matrix -> matrix -> matrix
+
+    /// Dot product
+    val dot       : matrix -> matrix -> float
+
+    /// Point-wise exponential of a matrix.
+    val cptPow       : matrix -> float -> matrix
+
+    /// Transpose of a matrix. Use also m.Transpose
+    val transpose     :           matrix -> matrix
+
+    /// Sum of the diagonal elements of a matrix
+    val trace     : matrix -> float
+    
+    /// Generate a new matrix of the same size as the input with random entries 
+    /// drawn from the range 0..aij. Random numbers are generated using a globally 
+    /// shared System.Random instance with the initial seed 99.
+    val randomize : matrix -> matrix
+
+    /// Sum all the elements of a matrix
+    val sum       : matrix -> float
+
+    ///Multiply all the elements of a matrix
+    val prod      : matrix -> float
+
+    ///sqrt(sum(x*x)) of all the elements of a matrix
+    val norm      : matrix -> float
+
+    /// Check if a predicate holds for all elements of a matrix
+    val forall  : (float -> bool) -> matrix -> bool
+
+    /// Check if a predicate holds for at least one element of a matrix
+    val exists  : (float -> bool) -> matrix -> bool 
+
+    /// Check if a predicate holds for all elements of a matrix
+    val foralli  : (int -> int -> float -> bool) -> matrix -> bool
+
+    /// Check if a predicate holds for at least one element of a matrix
+    val existsi  : (int -> int -> float -> bool) -> matrix -> bool 
+
+    /// Fold a function over all elements of a matrix
+    val fold      : ('T -> float -> 'T) -> 'T         -> matrix -> 'T
+
+    /// Fold an indexed function over all elements of a matrix
+    val foldi      : (int -> int -> 'T -> float -> 'T) -> 'T         -> matrix -> 'T
+
+    /// Fold a function down each column of a matrix
+    val foldByCol : ('T -> float -> 'T) -> RowVector<'T> -> matrix -> RowVector<'T>
+
+    /// Fold a function along each row of a matrix
+    val foldByRow : ('T -> float -> 'T) -> Vector<'T> -> matrix -> Vector<'T>
+
+    /// Fold a function along a particular column of a matrix
+    val foldCol   : ('T -> float -> 'T) -> 'T         -> matrix -> int -> 'T 
+
+    /// Fold a function down a particular row of a matrix
+    val foldRow   : ('T -> float -> 'T) -> 'T         -> matrix -> int -> 'T
+    
+    /// Map a function over each element of a matrix, producing a new matrix
+    val map  : (float -> float) -> matrix -> matrix
+   
+    /// Map the given indexed function over each element of a matrix, producing a new matrix
+    val mapi  : (int -> int -> float -> float) -> matrix -> matrix
+   
+    /// Create a new matrix that is a copy of the given array
+    val copy : matrix -> matrix
+   
+    /// In-place addition, mutating the first matrix argument.
+    val inplaceAdd    : matrix -> matrix -> unit
+
+    /// In-place subtraction, mutating the first matrix argument. 
+    val inplaceSub    : matrix -> matrix -> unit
+
+    [<Obsolete("Use the '.NonZeroEntries' property instead")>]
+    val nonzero_entries : matrix -> seq<int * int * float>         
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.inplaceAdd' instead")>]
+    val inplace_add    : matrix -> matrix -> unit
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.inplaceSub' instead")>]
+    val inplace_sub    : matrix -> matrix -> unit
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofList' instead")>]
+    val of_list   : float list list     -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofSeq' instead")>]
+    val of_seq    : seq<#seq<float>>   -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofArray2D' instead")>]
+    val inline of_array2D : float[,]            -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.toArray2D' instead")>]
+    val inline to_array2D : matrix              -> float[,]
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofScalar' instead")>]
+    val of_scalar : float               -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofRowVector' instead")>]
+    val of_rowvec : rowvec              -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.ofVector' instead")>]
+    val of_vector : vector              -> matrix
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.toScalar' instead")>]
+    val to_scalar : matrix              -> float                
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.toRowVector' instead")>]
+    val to_rowvec : matrix              -> rowvec                
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.toVector' instead")>]
+    val to_vector : matrix              -> vector
+    [<System.Obsolete("This function has been renamed. Use 'Matrix.toDense' instead")>]
+    val to_dense  : matrix              -> matrix
+    [<Obsolete("Use the '*' operator instead")>]
+    val mul       : matrix -> matrix -> matrix
+    [<Obsolete("This function has been renamed to 'initDiagonal'")>]
+    val init_diagonal : vector -> matrix
+    [<Obsolete("Use the 'Matrix.init' function instead")>]
+    val constDiag : int -> float        -> matrix
+    [<Obsolete("Use the 'initDiagonal' function instead")>]
+    val diag      : vector -> matrix
+    [<Obsolete("This function has been renamed to 'initDense'")>]
+    val init_dense : int -> int -> seq<int * int * float> -> matrix
+    [<Obsolete("This function has been renamed to 'initSparse'")>]
+    val init_sparse : int -> int -> seq<int * int * float> -> matrix
+    [<Obsolete("Use the '.*' operator instead")>]
+    val cptMul    : matrix -> matrix -> matrix
+    [<Obsolete("Use the '*' operator instead")>]
+    val mulV      : matrix -> vector -> vector
+    [<Obsolete("Use the '*' operator instead")>]
+    val mulRV     : rowvec -> matrix -> rowvec
+    [<Obsolete("Use the '-' operator instead")>]
+    val sub       : matrix -> matrix -> matrix
+    [<Obsolete("Use the '-' prefix operator instead")>]
+    val neg       :           matrix -> matrix
+    [<Obsolete("Use the '*' operator instead")>]
+    val scale     : float  -> matrix -> matrix
+    [<Obsolete("Use the '.Column' method instead")>]
+    val getCol  : matrix -> int -> vector
+    [<Obsolete("Use the '.Row' method instead")>]
+    val getRow  : matrix -> int -> rowvec
+    [<Obsolete("Use the '.Columns' method instead")>]
+    val getCols : matrix -> start:int -> length:int -> matrix
+    [<Obsolete("Use the '.Rows' method instead")>]
+    val getRows : matrix -> start:int -> length:int -> matrix
+    [<Obsolete("Use the '.Region' method instead")>]
+    val getRegion  : matrix -> starti:int -> startj:int -> lengthi:int -> lengthj:int -> matrix
+    [<Obsolete("Use the '.Diagonal' method instead")>]
+    val getDiagN : matrix -> int    -> vector
+    [<Obsolete("Use the '.Diagonal' property instead")>]
+    val getDiag  : matrix           -> vector
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+    val inplace_assign       : (int -> int -> float) -> matrix -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+    val inplace_mapi  : (int -> int -> float -> float) -> matrix -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+    val inplace_cptMul : matrix -> matrix -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+    val inplace_scale  : float -> matrix -> unit
+
+    /// Operations to manipulate matrix types carrying
+    /// arbitrary element types. The names and types of the operations match those
+    /// in the containing module Math.Matrix. 
+    ///
+    /// The numeric operations on the element type (add, zero etc.) are inferred from the type
+    /// argument itself. That is, for some operations 
+    /// the element type of a matrix must have an associated instance of INumeric<'T> 
+    /// or some more specific numeric association (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+    [<RequireQualifiedAccess>]
+    module Generic =
+
+        /// Get an element from a matrix. The indexes are given in row/column order.
+        val get   : Matrix<'T> -> int -> int -> 'T
+        /// Set an element in a matrix. The indexes are given in row/column order.
+        val set   : Matrix<'T> -> int -> int -> 'T -> unit
+
+        /// Create a matrix from the given data  
+        val ofList      : 'T list list       -> Matrix<'T>
+
+        /// Create a matrix from the given data  
+        val ofSeq       : seq<#seq<'T>>     -> Matrix<'T>
+
+        /// Create a matrix from the given data  
+        val ofArray2D    : 'T[,]              -> Matrix<'T>
+
+        /// Return a new array containing the elements of the given matrix
+        val toArray2D : Matrix<'T>         -> 'T[,]  
+
+        /// Create a matrix containing the given value at every element.
+        val create     : int -> int -> 'T   -> Matrix<'T>
+
+        /// Create a dense matrix from the given sequence of elements
+        val initDense : int -> int -> seq<int * int * 'T>  -> Matrix<'T>
+
+        /// Create a sparse matrix from the given sequence of elements
+        val initSparse : int -> int -> seq<int * int * 'T>  -> Matrix<'T>
+
+        /// Create a 1x1 matrix containing the given value 
+        val ofScalar    : 'T                 -> Matrix<'T>
+
+        /// Create a matrix from a row vector
+        val ofRowVector  : RowVector<'T>     -> Matrix<'T>
+        /// Create a matrix from a column vector
+        val ofVector  : Vector<'T>        -> Matrix<'T>
+
+        /// Get the element at column zero, row zero
+        val toScalar : Matrix<'T>         -> 'T                
+        /// Extract the first row of a matrix
+        val toRowVector : Matrix<'T>         -> RowVector<'T>                 
+        /// Extract the first column of a matrix
+        val toVector : Matrix<'T>         -> Vector<'T> 
+
+
+        /// Create a matrix using a function to compute the item at each index.
+        val init : int -> int -> (int -> int -> 'T) -> Matrix<'T>
+
+        /// Create a matrix using a function to compute the item at each index.
+        /// The element type of a matrix must have an associated instance of INumeric<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        /// The function is passed the dictionary of associated operations in addition to the index pair.
+        val initNumeric  : int -> int -> (INumeric<'T> -> int -> int -> 'T)        -> Matrix<'T>
+
+        /// Create a matrix containing the zero element at each index.
+        /// The element type of a matrix must have an associated instance of INumeric<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        val zero      : int -> int         -> Matrix<'T>
+
+        /// Create a square matrix with the one for the element type lying on diagonal
+        /// The element type of a matrix must have an associated instance of INumeric<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        val identity      : int -> Matrix<'T>
+
+        /// Create a matrix containing the given vector along the diagonal.
+        /// The element type of a matrix must have an associated instance of INumeric<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        val initDiagonal : Vector<'T>        -> Matrix<'T>
+
+        ///Take the pointwise maximum of two matrices
+        val cptMax    : Matrix<'T> -> Matrix<'T> -> Matrix<'T> when 'T : comparison
+
+        ///Take the pointwise maximum of two matrices
+        val cptMin    : Matrix<'T> -> Matrix<'T> -> Matrix<'T> when 'T : comparison
+
+        /// Sum of the point-wise multiple of the two matrices.
+        /// The element type of a matrix must have an associated instance of INumeric<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        val dot       : Matrix<'T> -> Matrix<'T> -> 'T
+
+
+        /// Return a new matrix which is the transpose of the input matrix
+        val transpose : Matrix<'T> -> Matrix<'T>
+
+        /// Compute the sum of the diagonal of a square matrix
+        val trace     : Matrix<'T> -> 'T
+        /// Compute the sum of the elements in a matrix
+        val sum       : Matrix<'T> -> 'T
+        /// Compute the product of the elements in a matrix
+        val prod      : Matrix<'T> -> 'T
+        /// Returns sqrt(sum(norm(x)*(norm(x))) of all the elements of a matrix.
+        /// The element type of a matrix must have an associated instance of INormFloat<'T> (see <c>GlobalAssociations</c>) ((else NotSupportedException)).
+        val norm      : Matrix<'T> -> float
+
+        /// Fold a function over all elements of a matrix
+        val fold  : folder:('State -> 'T -> 'State) -> 'State -> Matrix<'T> -> 'State
+
+        /// Fold an indexed function over all elements of a matrix
+        val foldi  : (int -> int -> 'State -> 'T -> 'State) -> 'State -> Matrix<'T> -> 'State
+
+        /// Return true if a predicate returns true for all values in a matrix
+        val forall: ('T -> bool)           -> Matrix<'T> -> bool
+
+        /// Return true if a predicate returns true for some value in a matrix
+        val exists: ('T -> bool)           -> Matrix<'T> -> bool 
+
+        /// Return true if an indexed predicate returns true for all values in a matrix
+        val foralli: (int -> int -> 'T -> bool)           -> Matrix<'T> -> bool
+
+        /// Return true if an indexed predicate returns true for some value in a matrix
+        val existsi: (int -> int -> 'T -> bool)           -> Matrix<'T> -> bool 
+
+        /// Create a new matrix that is a copy of the given array
+        val copy : Matrix<'T> -> Matrix<'T>
+   
+        /// Map a function over a matrix
+        val map   : ('T -> 'T) -> Matrix<'T> -> Matrix<'T>
+
+        /// Map the given position-indexed function over a matrix
+        val mapi  : (int -> int -> 'T -> 'T) -> Matrix<'T> -> Matrix<'T>
+
+        /// Add the second matrix to the first by, mutating the first
+        val inplaceAdd    : Matrix<'T> -> Matrix<'T> -> unit
+        /// Subtract the second matrix from the first, by mutating the first
+        val inplaceSub    : Matrix<'T> -> Matrix<'T> -> unit
+
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.inplaceAdd' instead")>]
+        val inplace_add    : Matrix<'T> -> Matrix<'T> -> unit
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.inplaceSub' instead")>]
+        val inplace_sub    : Matrix<'T> -> Matrix<'T> -> unit
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofList' instead")>]
+        val of_list      : 'T list list       -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofSeq' instead")>]
+        val of_seq       : seq<#seq<'T>>     -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofArray2D' instead")>]
+        val inline of_array2D    : 'T[,]              -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.toArray2D' instead")>]
+        val inline to_array2D : Matrix<'T>         -> 'T[,]  
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofScalar' instead")>]
+        val of_scalar    : 'T                 -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofRowVector' instead")>]
+        val of_rowvec  : RowVector<'T>     -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.ofVector' instead")>]
+        val of_vector  : Vector<'T>        -> Matrix<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.toScalar' instead")>]
+        val to_scalar : Matrix<'T>         -> 'T                
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.toRowVector' instead")>]
+        val to_rowvec : Matrix<'T>         -> RowVector<'T>                 
+        [<System.Obsolete("This function has been renamed. Use 'Matrix.Generic.toVector' instead")>]
+        val to_vector : Matrix<'T>         -> Vector<'T> 
+        [<Obsolete("This function has been renamed to 'initDiagonal'")>]
+        val init_diagonal : Vector<'T>        -> Matrix<'T>
+        [<Obsolete("This function has been renamed to 'initDense'")>]
+        val init_dense : int -> int -> seq<int * int * 'T>  -> Matrix<'T>
+        [<Obsolete("This function has been renamed to 'initSparse'")>]
+        val init_sparse : int -> int -> seq<int * int * 'T>  -> Matrix<'T>
+        [<Obsolete("Use the '.NonZeroEntries' property instead")>]
+        val nonzero_entries : Matrix<'T> -> seq<int * int * 'T> 
+        [<Obsolete("Use the 'Matrix.Generic.init' function instead")>]
+        val constDiag : int -> 'T          -> Matrix<'T>
+        [<Obsolete("Use the '+' operator instead")>]
+        val add       : Matrix<'T> -> Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the 'initDiagonal' function instead")>]
+        val diag      : Vector<'T>        -> Matrix<'T>
+        [<Obsolete("Use the '*' operator instead")>]
+        val mul       : Matrix<'T> -> Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the '*' operator instead")>]
+        val mulV      : Matrix<'T> -> Vector<'T> -> Vector<'T>
+        [<Obsolete("Use the '*' operator instead")>]
+        val mulRV     : RowVector<'T> -> Matrix<'T> -> RowVector<'T>
+        [<Obsolete("Use the '.*' operator instead")>]
+        val cptMul    : Matrix<'T> -> Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the '-' operator instead")>]
+        val sub       : Matrix<'T> -> Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the '-' prefix operator instead")>]
+        val neg       : Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the '*' operator instead")>]
+        val scale     : 'T  -> Matrix<'T> -> Matrix<'T>
+        [<Obsolete("Use the '.Column' method instead")>]
+        val getCol  : Matrix<'T> -> int -> Vector<'T>
+        [<Obsolete("Use the '.Row' method instead")>]
+        val getRow  : Matrix<'T> -> int -> RowVector<'T>
+        [<Obsolete("Use the '.Columns' method instead")>]
+        val getCols : Matrix<'T> -> start:int -> length:int -> Matrix<'T>
+        [<Obsolete("Use the '.Rows' method instead")>]
+        val getRows : Matrix<'T> -> start:int -> length:int -> Matrix<'T>
+        [<Obsolete("Use the '.Region' method instead")>]
+        val getRegion  : Matrix<'T> -> starti:int -> startj:int -> lengthi:int -> lengthj:int -> Matrix<'T>
+        [<Obsolete("Use the '.Diagonal' method instead")>]
+        val getDiagN : Matrix<'T> -> int    -> Vector<'T>
+        [<Obsolete("Use the '.Diagonal' property instead")>]
+        val getDiag  : Matrix<'T>           -> Vector<'T>
+        [<Obsolete("This function will be removed in a future revision of this library. Just use 'compare m1 m2' instead")>]
+        val compare  : Matrix<'T> -> Matrix<'T> -> int
+        [<Obsolete("This function will be removed in a future revision of this library. Just use 'hash m' instead")>]
+        val hash     : Matrix<'T> -> int
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+        val inplace_assign       : (int -> int -> 'T) -> Matrix<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+        val inplace_mapi  : (int -> int -> 'T -> 'T) -> Matrix<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+        val inplace_cptMul : Matrix<'T> -> Matrix<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the matrix directly instead using 'm.[i,j] <- v'")>]
+        val inplace_scale  : 'T -> Matrix<'T> -> unit
+
+
+/// Operations to manipulate floating
+/// point column vectors. The submodule VectorOps.Generic contains a 
+/// matching set of operations to manipulate column vectors carrying
+/// arbitrary element types.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<RequireQualifiedAccess>]
+module Vector =
+
+    /// Get an element of a column vector
+    val get   : vector -> int -> float
+
+    /// Set an element of a column vector
+    val set   : vector -> int -> float -> unit
+
+    /// Get the dimensions (number of rows) of a column vector. Identical to <c>nrows</c>
+    val length   : vector -> int 
+
+    /// Create a vector of a fixed length using a function to compute the initial element values
+    val init  : int ->        (int -> float)        -> vector
+
+    /// Create a vector from a list of numbers
+    val ofList   : float list          -> vector
+    
+    /// Create a vector from a sequence of numbers
+    val ofSeq    : seq<float>         -> vector
+
+    /// Create a vector from an array of double precision floats
+    val ofArray  : float array         -> vector
+
+    /// Return a new array containing a copy of the elements of the given vector
+    val toArray  : vector           -> float array
+    
+    /// Create a 1-element vector
+    val ofScalar  : float              -> vector
+
+    /// Generate a vector of the given length where each entry contains the given value
+    val create    : int        -> float -> vector
+    
+    /// Return a vector of the given length where every entry is zero.
+    val zero     : int                 -> vector
+    
+    /// Create a vector that represents a mesh over the given range
+    /// e.g. rangef (-1.0) 0.5 1.0 = vector [ -1.0; -0.5; 0.0; 0.5; 1.0]
+    val rangef : float -> float -> float -> vector
+    
+    /// Create a vector that represents a integral mesh over the given range
+    /// e.g. range 1 5 = vector [ 1.;2.;3.;4.;5. ]
+    val range  : int -> int              -> vector
+      
+    ///Dot product
+    val dot       : vector -> vector -> float
+
+    ///Point-wise exponential of a vector.
+    val cptPow    : vector -> float -> vector
+
+    ///Transpose of a matrix. Use also m.Transpose
+    val transpose     :           vector -> rowvec
+
+    ///Sum all the elements of a vector
+    val sum       : vector -> float
+
+    ///Multiply all the elements of a matrix
+    val prod      : vector -> float
+
+    /// Computes the 2-norm of a vector: sqrt(x.Transpose*x).
+    val norm      : vector -> float
+
+    /// Return true if a predicate returns true for all values in a vector
+    val forall  : (float -> bool) -> vector -> bool
+
+    /// Return true if a predicate returns true for some value in a vector
+    val exists  : (float -> bool) -> vector -> bool 
+
+    /// Return true if an indexed predicate returns true for all values in a vector
+    val foralli  : (int ->        float -> bool) -> vector -> bool
+
+    /// Return true if an indexed predicate returns true for some value in a vector
+    val existsi  : (int ->        float -> bool) -> vector -> bool 
+
+    /// Fold a function over all elements of a vector
+    val fold      : ('T -> float -> 'T) -> 'T         -> vector -> 'T
+
+    /// Fold an indexed function over all elements of a vector
+    val foldi      : (int -> 'T -> float -> 'T) -> 'T         -> vector -> 'T
+
+    /// Copy a vector
+    val copy : vector -> vector
+    
+    /// Map a function over each element of a vector
+    val map  : (float -> float) -> vector -> vector
+   
+    /// Map an indexed function over each element of a vector
+    val mapi  : (int        -> float -> float) -> vector -> vector
+   
+    [<System.Obsolete("This function has been renamed. Use 'Vector.ofList' instead")>]
+    val of_list   : float list          -> vector
+    [<System.Obsolete("This function has been renamed. Use 'Vector.ofSeq' instead")>]
+    val of_seq    : seq<float>         -> vector
+    [<System.Obsolete("This function has been renamed. Use 'Vector.ofArray' instead")>]
+    val of_array  : float array         -> vector
+    [<System.Obsolete("This function has been renamed. Use 'Vector.toArray' instead")>]
+    val to_array  : vector           -> float array
+    [<System.Obsolete("This function has been renamed. Use 'Vector.ofScalar' instead")>]
+    val of_scalar  : float              -> vector
+    [<Obsolete("Use the '+' operator instead")>]
+    val add       : vector -> vector -> vector
+    [<Obsolete("Use the '-' operator instead")>]
+    val sub       : vector -> vector -> vector
+    [<Obsolete("Use the '-' prefix operator instead")>]
+    val neg       :           vector -> vector
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_assign       : (int ->        float) -> vector -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_mapi  : (int ->        float -> float) -> vector -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_add    : vector -> vector -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_sub    : vector -> vector -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_cptMul : vector -> vector -> unit
+    [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+    val inplace_scale  : float -> vector -> unit
+    [<Obsolete("Use the '.*' operator instead")>]
+    val cptMul    : vector -> vector -> vector
+    [<Obsolete("Use the '*' operator instead")>]
+    val scale     : float  -> vector -> vector
+
+    
+    /// Operations to manipulate column vectors carrying
+    /// arbitrary element types. 
+    module Generic =
+        // Accessors
+
+        /// Get an element of a column vector
+        val get   : Vector<'T> -> int -> 'T
+
+        /// Set an element of a column vector
+        val set   : Vector<'T> -> int -> 'T -> unit
+
+        /// Get the dimensions (number of rows) of a column vector. Identical to <c>nrows</c>
+        val length   : Vector<'T> -> int 
+
+        /// Creation: general
+        val init  : int ->        (int -> 'T)        -> Vector<'T>
+
+        /// Creation: useful when the element type has associated operations.
+        val initNumeric  : int ->        (INumeric<'T> -> int -> 'T)        -> Vector<'T>
+
+        /// Create a vector from a list of numbers
+        val ofList   : 'T list          -> Vector<'T>
+      
+        /// Create a vector from a sequence of numbers
+        val ofSeq    : seq<'T>         -> Vector<'T>
+
+        /// Create a 1-element vector
+        val ofScalar  : 'T              -> Vector<'T>
+
+        /// Create a vector from an array of elements
+        val ofArray  : 'T[]         -> Vector<'T>
+
+        /// Return a new array containing a copy of the elements of the given vector
+        val toArray  : Vector<'T>    -> 'T[]
+
+        /// Generate a vector of the given length where each entry contains the given value
+        val create    : int        -> 'T -> Vector<'T>
+      
+        /// Return a vector of the given length where every entry is zero.
+        val zero     : int                 -> Vector<'T>
+      
+        ///Take the pointwise maximum of two vectors
+        val cptMax    : Vector<'T> -> Vector<'T> -> Vector<'T> when 'T : comparison
+
+        ///Take the pointwise minimum of two vectors
+        val cptMin    : Vector<'T> -> Vector<'T> -> Vector<'T> when 'T : comparison
+
+        ///Dot product
+        val dot       : Vector<'T> -> Vector<'T> -> 'T
+
+        ///Sum all the elements of a vector
+        val sum       : Vector<'T> -> 'T
+      
+        ///Multiply all the elements of a matrix
+        val prod      : Vector<'T> -> 'T
+
+        /// Computes the 2-norm of a vector: sqrt(x.Transpose*x).
+        val norm      : Vector<'T> -> float
+
+        /// Return true if a predicate returns true for all values in a vector
+        val forall  : predicate:('T -> bool) -> Vector<'T> -> bool
+
+        /// Return true if a predicate returns true for some value in a vector
+        val exists  : predicate:('T -> bool) -> Vector<'T> -> bool 
+
+        /// Return true if an indexed predicate returns true for all values in a vector
+        val foralli  : (int -> 'T -> bool) -> Vector<'T> -> bool
+
+        /// Return true if an indexed predicate returns true for some value in a vector
+        val existsi  : (int -> 'T -> bool) -> Vector<'T> -> bool 
+
+        /// Fold a function over all elements of a vector
+        val fold      : folder:('State -> 'T -> 'State) -> 'State -> Vector<'T> -> 'State
+
+        /// Fold an indexed function over all elements of a vector
+        val foldi      : (int -> 'State -> 'T -> 'State) -> 'State -> Vector<'T> -> 'State
+
+        /// Copy the vector
+        val copy: Vector<'T> -> Vector<'T>
+        
+        /// Map a function over each element of a vector
+        val map  : ('T -> 'T) -> Vector<'T> -> Vector<'T>
+     
+        /// Map an indexed function over each element of a vector
+        val mapi  : (int        -> 'T -> 'T) -> Vector<'T> -> Vector<'T>
+     
+
+        [<System.Obsolete("This function has been renamed. Use 'Vector.ofList' instead")>]
+        val of_list   : 'T list          -> Vector<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Vector.ofSeq' instead")>]
+        val of_seq    : seq<'T>         -> Vector<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Vector.ofScalar' instead")>]
+        val of_scalar  : 'T              -> Vector<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Vector.ofArray' instead")>]
+        val of_array  : 'T[]         -> Vector<'T>
+        [<System.Obsolete("This function has been renamed. Use 'Vector.toArray' instead")>]
+        val to_array  : Vector<'T>    -> 'T[]
+        [<Obsolete("Use the .* operator instead")>]
+        val cptMul    : Vector<'T> -> Vector<'T> -> Vector<'T>      
+        [<Obsolete("Use the 'vector.Transpose' property instead")>]
+        val transpose : Vector<'T> -> RowVector<'T>
+        [<Obsolete("Use the '+' operator instead")>]
+        val add       : Vector<'T> -> Vector<'T> -> Vector<'T>
+        [<Obsolete("Use the '-' operator instead")>]
+        val sub       : Vector<'T> -> Vector<'T> -> Vector<'T>
+        [<Obsolete("Use the '-' prefix operator instead")>]
+        val neg       : Vector<'T> -> Vector<'T>
+        [<Obsolete("Use the '*' operator instead")>]
+        val scale     : 'T  -> Vector<'T> -> Vector<'T>
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_assign : (int -> 'T) -> Vector<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_mapi  : (int -> 'T -> 'T) -> Vector<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_add    : Vector<'T> -> Vector<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_sub    : Vector<'T> -> Vector<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_cptMul : Vector<'T> -> Vector<'T> -> unit
+        [<Obsolete("This function will be removed in a future revision of this library. Set the elements of the vector directly instead using 'vec.[i] <- x'")>]
+        val inplace_scale  : 'T -> Vector<'T> -> unit
+
+
+
+/// Operations to manipulate floating
+/// point row vectors. These are included for completeness and are
+/// nearly always transposed to column vectors.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<RequireQualifiedAccess>]
+module RowVector =
+
+    /// Get an element of a column vector
+    val get   : rowvec -> int -> float
+
+    /// Set an element of a column rowvec
+    val set   : rowvec -> int -> float -> unit
+
+    /// Get the dimensions (number of rows) of a column rowvec. 
+    val length   : rowvec -> int 
+
+    /// Create by constant initialization
+    val create : int -> float  -> rowvec
+
+    /// Create by comprehension
+    val init : int ->  (int -> float) -> rowvec
+
+    /// Return a vector of the given length where every entry is zero.
+    val zero     : int -> rowvec
+
+    // Transpose the row vector
+    val transpose : rowvec -> vector
+
+    // Copy the row vector
+    val copy : rowvec -> rowvec
+
+    /// Create a vector from a list of numbers
+    val ofList   : float list          -> rowvec
+
+    /// Create a vector from a sequence of numbers
+    val ofSeq    : seq<float>         -> rowvec
+
+    /// Create a vector from an array of double precision floats
+    val ofArray  : float array         -> rowvec
+
+    /// Return a new array containing a copy of the elements of the given vector
+    val toArray  : rowvec              -> float array
+    
+    [<System.Obsolete("This function has been renamed. Use 'RowVector.ofList' instead")>]
+    val of_list   : float list          -> rowvec
+    [<System.Obsolete("This function has been renamed. Use 'RowVector.ofSeq' instead")>]
+    val of_seq    : seq<float>         -> rowvec
+    [<System.Obsolete("This function has been renamed. Use 'RowVector.ofArray' instead")>]
+    val of_array  : float array         -> rowvec
+    [<System.Obsolete("This function has been renamed. Use 'RowVector.toArray' instead")>]
+    val to_array  : rowvec              -> float array
+    
+    
+    /// Operations to manipulate row vectors types carrying
+    /// arbitrary element types. 
+    module Generic =
+        // Accessors
+
+        /// Get an element from a column vector. 
+        val get   : RowVector<'T> -> int -> 'T
+        /// Set an element in a column vector. 
+        val set   : RowVector<'T> -> int -> 'T -> unit
+        /// Get the number of rows in a column vector. 
+        val length: RowVector<'T> -> int 
+        /// Transpose the row vector
+        val transpose        : RowVector<'T>  -> Vector<'T> 
+        /// Create by comprehension
+        val init       : int ->        (int -> 'T)        -> RowVector<'T> 
+        /// Create by constant initialization
+        val create       : int ->      'T  -> RowVector<'T> 
+        /// Return a vector of the given length where every entry is zero.
+        val zero     : int                 -> RowVector<'T>
+        /// Create a row vector from a list of elements
+        val ofList   : 'T list          -> RowVector<'T> 
+        /// Create a row vector from a sequence of elements
+        val ofSeq    : seq<'T>         -> RowVector<'T> 
+
+        /// Create a row vector from an array of elements
+        val ofArray  : 'T[]         -> RowVector<'T>
+
+        /// Return a new array containing a copy of the elements of the given vector
+        val toArray  : RowVector<'T>    -> 'T[]         
+
+        // Copy the row vector
+        val copy    :   RowVector<'T> -> RowVector<'T>
+
+        [<System.Obsolete("This function has been renamed. Use 'RowVector.Generic.ofList' instead")>]
+        val of_list   : 'T list          -> RowVector<'T> 
+        [<System.Obsolete("This function has been renamed. Use 'RowVector.Generic.ofSeq' instead")>]
+        val of_seq    : seq<'T>         -> RowVector<'T> 
+        [<System.Obsolete("This function has been renamed. Use 'RowVector.Generic.ofArray' instead")>]
+        val of_array  : 'T[]         -> RowVector<'T>
+        [<System.Obsolete("This function has been renamed. Use 'RowVector.Generic.toArray' instead")>]
+        val to_array  : RowVector<'T>    -> 'T[]         
+
+namespace Microsoft.FSharp.Core
+
+    /// The type of floating-point matrices. See Microsoft.FSharp.Math
+    type matrix = Microsoft.FSharp.Math.matrix
+    /// The type of floating-point vectors. See Microsoft.FSharp.Math
+    type vector = Microsoft.FSharp.Math.vector
+    /// The type of floating-point row vectors. See Microsoft.FSharp.Math
+    type rowvec = Microsoft.FSharp.Math.rowvec
+
+
+    [<AutoOpen>]
+    module MatrixTopLevelOperators = 
+        /// Builds a matrix from a sequence of sequence of floats.
+        val matrix : seq<#seq<float>> -> matrix
+        /// Builds a (column) vector from a sequence of floats.
+        val vector : seq<float> -> vector
+        /// Builds a (row) vector from a sequence of floats.
+        val rowvec : seq<float> -> rowvec
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fs
new file mode 100644
index 0000000..2b32b4c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fs
@@ -0,0 +1,324 @@
+// (c) Microsoft Corporation. All rights reserved 
+
+#nowarn "44"  // OK to use the "compiler only" function RangeGeneric
+#nowarn "52"  // The value has been copied to ensure the original is not mutated by this operation
+
+namespace Microsoft.FSharp.Math
+
+    open System
+    open System.Numerics
+    open System.Globalization
+
+    module BigRationalLargeImpl = 
+        let ZeroI = new BigInteger(0)
+        let OneI = new BigInteger(1)
+        let bigint (x:int) = new BigInteger(x)
+        let ToDoubleI (x:BigInteger) =  double x
+        let ToInt32I (x:BigInteger) = int32 x
+
+    open BigRationalLargeImpl
+        
+    [<CustomEquality; CustomComparison>]
+    type BigRationalLarge = 
+        | Q of BigInteger * BigInteger // invariants: (p,q) in lowest form, q >= 0 
+
+        override n.ToString() =
+            let (Q(p,q)) = n 
+            if q.IsOne then p.ToString() 
+            else p.ToString() + "/" + q.ToString()
+
+
+        static member Hash (Q(ap,aq)) = 
+            // This hash code must be identical to the hash for BigInteger when the numbers coincide.
+            if aq.IsOne then ap.GetHashCode() else (ap.GetHashCode() <<< 3) + aq.GetHashCode()
+        
+
+        override x.GetHashCode()            = BigRationalLarge.Hash(x)
+        
+        static member Equals(Q(ap,aq), Q(bp,bq)) = 
+            BigInteger.(=)  (ap,bp) && BigInteger.(=) (aq,bq)   // normal form, so structural equality 
+        
+        static member LessThan(Q(ap,aq), Q(bp,bq)) = 
+            BigInteger.(<)  (ap * bq,bp * aq)
+        
+        // note: performance improvement possible here
+        static member Compare(p,q) = 
+            if BigRationalLarge.LessThan(p,q) then -1 
+            elif BigRationalLarge.LessThan(q,p)then  1 
+            else 0 
+
+        interface System.IComparable with 
+            member this.CompareTo(obj:obj) = 
+                match obj with 
+                | :? BigRationalLarge as that -> BigRationalLarge.Compare(this,that)
+                | _ -> invalidArg "obj" "the object does not have the correct type"
+
+        override this.Equals(that:obj) = 
+            match that with 
+            | :? BigRationalLarge as that -> BigRationalLarge.Equals(this,that)
+            | _ -> false
+
+        member x.IsNegative = let (Q(ap,_)) = x in sign ap < 0
+        member x.IsPositive = let (Q(ap,_)) = x in sign ap > 0
+
+        member x.Numerator = let (Q(p,_)) = x in p
+        member x.Denominator = let (Q(_,q)) = x in q
+        member x.Sign = (let (Q(p,_)) = x in sign p)
+
+        static member ToDouble (Q(p,q)) = 
+            ToDoubleI p / ToDoubleI q
+
+        static member Normalize (p:BigInteger,q:BigInteger) =
+            if q.IsZero then
+                raise (System.DivideByZeroException())  (* throw for any x/0 *)
+            elif q.IsOne then
+                Q(p,q)
+            else
+                let k = BigInteger.GreatestCommonDivisor(p,q)
+                let p = p / k 
+                let q = q / k 
+                if sign q < 0 then Q(-p,-q) else Q(p,q)
+
+        static member Rational  (p:int,q:int) = BigRationalLarge.Normalize (bigint p,bigint q)
+        static member RationalZ (p,q) = BigRationalLarge.Normalize (p,q)
+       
+        static member Parse (str:string) =
+          let len = str.Length 
+          if len=0 then invalidArg "str" "empty string";
+          let j = str.IndexOf '/' 
+          if j >= 0 then 
+              let p = BigInteger.Parse (str.Substring(0,j)) 
+              let q = BigInteger.Parse (str.Substring(j+1,len-j-1)) 
+              BigRationalLarge.RationalZ (p,q)
+          else
+              let p = BigInteger.Parse str 
+              BigRationalLarge.RationalZ (p,OneI)
+        
+        static member (~-) (Q(bp,bq))    = Q(-bp,bq)          // still coprime, bq >= 0 
+        static member (+) (Q(ap,aq),Q(bp,bq)) = BigRationalLarge.Normalize ((ap * bq) + (bp * aq),aq * bq)
+        static member (-) (Q(ap,aq),Q(bp,bq)) = BigRationalLarge.Normalize ((ap * bq) - (bp * aq),aq * bq)
+        static member (*) (Q(ap,aq),Q(bp,bq)) = BigRationalLarge.Normalize (ap * bp,aq * bq)
+        static member (/) (Q(ap,aq),Q(bp,bq)) = BigRationalLarge.Normalize (ap * bq,aq * bp)
+        static member ( ~+ )(n1:BigRationalLarge) = n1
+        
+ 
+    [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+    module BigRationalLarge = 
+        open System.Numerics
+    
+        let inv    (Q(ap,aq)) = BigRationalLarge.Normalize(aq,ap)    
+
+        let pown (Q(p,q)) (n:int) = Q(BigInteger.Pow(p,n),BigInteger.Pow  (q,n)) // p,q powers still coprime
+        
+        let equal (Q(ap,aq)) (Q(bp,bq)) = ap=bp && aq=bq   // normal form, so structural equality 
+        let lt    a b = BigRationalLarge.LessThan(a,b)
+        let gt    a b = BigRationalLarge.LessThan(b,a)
+        let lte   (Q(ap,aq)) (Q(bp,bq)) = BigInteger.(<=) (ap * bq,bp * aq)
+        let gte   (Q(ap,aq)) (Q(bp,bq)) = BigInteger.(>=) (ap * bq,bp * aq)
+
+        let of_bigint   z = BigRationalLarge.RationalZ(z,OneI )
+        let of_int n = BigRationalLarge.Rational(n,1)
+       
+        // integer part
+        let integer (Q(p,q)) =
+            let mutable r = BigInteger(0)
+            let d = BigInteger.DivRem (p,q,&r)          // have p = d.q + r, |r| < |q| 
+            if r < ZeroI
+            then d - OneI                 // p = (d-1).q + (r+q) 
+            else d                             // p =     d.q + r       
+      
+        
+    //----------------------------------------------------------------------------
+    // BigNum
+    //--------------------------------------------------------------------------
+
+    [<CustomEquality; CustomComparison>]
+    [<StructuredFormatDisplay("{StructuredDisplayString}N")>]
+    type BigNum =
+        | Z of BigInteger
+        | Q of BigRationalLarge
+
+        static member ( + )(n1,n2) = 
+            match n1,n2 with
+            | Z z ,Z zz -> Z (z + zz)
+            | Q q ,Q qq -> Q (q + qq)
+            | Z z ,Q qq -> Q (BigRationalLarge.of_bigint z + qq)
+            | Q q ,Z zz -> Q (q  + BigRationalLarge.of_bigint zz)
+
+        static member ( * )(n1,n2) = 
+            match n1,n2 with
+            | Z z ,Z zz -> Z (z * zz)
+            | Q q ,Q qq -> Q (q * qq)
+            | Z z ,Q qq -> Q (BigRationalLarge.of_bigint z * qq)
+            | Q q ,Z zz -> Q (q  * BigRationalLarge.of_bigint zz)
+
+        static member ( - )(n1,n2) = 
+            match n1,n2 with
+            | Z z ,Z zz -> Z (z - zz)
+            | Q q ,Q qq -> Q (q - qq)
+            | Z z ,Q qq -> Q (BigRationalLarge.of_bigint z - qq)
+            | Q q ,Z zz -> Q (q  - BigRationalLarge.of_bigint zz)
+
+        static member ( / )(n1,n2) = 
+            match n1,n2 with
+            | Z z ,Z zz -> Q (BigRationalLarge.RationalZ(z,zz))
+            | Q q ,Q qq -> Q (q / qq)
+            | Z z ,Q qq -> Q (BigRationalLarge.of_bigint z / qq)
+            | Q q ,Z zz -> Q (q  / BigRationalLarge.of_bigint zz)
+
+        static member ( ~- )(n1) = 
+            match n1 with
+            | Z z -> Z (-z)
+            | Q q -> Q (-q)
+
+        static member ( ~+ )(n1:BigNum) = n1
+
+        // nb. Q and Z hash codes must match up - see notes above
+        override n.GetHashCode() = 
+            match n with 
+            | Z z -> z.GetHashCode()
+            | Q q -> q.GetHashCode() 
+
+        override this.Equals(obj:obj) = 
+            match obj with 
+            | :? BigNum as that -> BigNum.(=)(this, that)
+            | _ -> false
+
+        interface System.IComparable with 
+            member n1.CompareTo(obj:obj) = 
+                match obj with 
+                | :? BigNum as n2 -> 
+                      if BigNum.(<)(n1, n2) then -1 elif BigNum.(=)(n1, n2) then 0 else 1
+                | _ -> invalidArg "obj" "the objects are not comparable"
+
+        static member FromInt (x:int) = Z (bigint x)
+        static member FromBigInt x = Z x
+
+        static member Zero = BigNum.FromInt(0) 
+        static member One = BigNum.FromInt(1) 
+
+
+        static member PowN (n,i:int) =
+            match n with
+            | Z z -> Z (BigInteger.Pow (z,i))
+            | Q q -> Q (BigRationalLarge.pown q i)
+
+        static member op_Equality (n,nn) = 
+            match n,nn with
+            | Z z ,Z zz -> BigInteger.(=) (z,zz)
+            | Q q ,Q qq -> (BigRationalLarge.equal q qq)
+            | Z z ,Q qq -> (BigRationalLarge.equal (BigRationalLarge.of_bigint z) qq)
+            | Q q ,Z zz -> (BigRationalLarge.equal q (BigRationalLarge.of_bigint zz))
+        static member op_Inequality (n,nn) = not (BigNum.op_Equality(n,nn))
+    
+        static member op_LessThan (n,nn) = 
+            match n,nn with
+            | Z z ,Z zz -> BigInteger.(<) (z,zz)
+            | Q q ,Q qq -> (BigRationalLarge.lt q qq)
+            | Z z ,Q qq -> (BigRationalLarge.lt (BigRationalLarge.of_bigint z) qq)
+            | Q q ,Z zz -> (BigRationalLarge.lt q (BigRationalLarge.of_bigint zz))
+        static member op_GreaterThan (n,nn) = 
+            match n,nn with
+            | Z z ,Z zz -> BigInteger.(>) (z,zz)
+            | Q q ,Q qq -> (BigRationalLarge.gt q qq)
+            | Z z ,Q qq -> (BigRationalLarge.gt (BigRationalLarge.of_bigint z) qq)
+            | Q q ,Z zz -> (BigRationalLarge.gt q (BigRationalLarge.of_bigint zz))
+        static member op_LessThanOrEqual (n,nn) = 
+            match n,nn with
+            | Z z ,Z zz -> BigInteger.(<=) (z,zz)
+            | Q q ,Q qq -> (BigRationalLarge.lte q qq)
+            | Z z ,Q qq -> (BigRationalLarge.lte (BigRationalLarge.of_bigint z) qq)
+            | Q q ,Z zz -> (BigRationalLarge.lte q (BigRationalLarge.of_bigint zz))
+        static member op_GreaterThanOrEqual (n,nn) = 
+            match n,nn with
+            | Z z ,Z zz -> BigInteger.(>=) (z,zz)
+            | Q q ,Q qq -> (BigRationalLarge.gte q qq)
+            | Z z ,Q qq -> (BigRationalLarge.gte (BigRationalLarge.of_bigint z) qq)
+            | Q q ,Z zz -> (BigRationalLarge.gte q (BigRationalLarge.of_bigint zz))
+        
+
+        member n.IsNegative = 
+            match n with 
+            | Z z -> sign z < 0 
+            | Q q -> q.IsNegative
+
+        member n.IsPositive = 
+            match n with 
+            | Z z -> sign z > 0
+            | Q q -> q.IsPositive
+            
+        member n.Numerator = 
+            match n with 
+            | Z z -> z
+            | Q q -> q.Numerator
+
+        member n.Denominator = 
+            match n with 
+            | Z _ -> OneI
+            | Q q -> q.Denominator
+
+        member n.Sign = 
+            if n.IsNegative then -1 
+            elif n.IsPositive then  1 
+            else 0
+
+        static member Abs(n:BigNum) = 
+            if n.IsNegative then -n else n
+
+        static member ToDouble(n:BigNum) = 
+            match n with
+            | Z z -> ToDoubleI z
+            | Q q -> BigRationalLarge.ToDouble q
+
+        static member ToBigInt(n:BigNum) = 
+            match n with 
+            | Z z -> z
+            | Q q -> BigRationalLarge.integer q 
+
+        static member ToInt32(n:BigNum) = 
+            match n with 
+            | Z z -> ToInt32I(z)
+            | Q q -> ToInt32I(BigRationalLarge.integer q )
+
+        static member op_Explicit (n:BigNum) = BigNum.ToInt32 n
+        static member op_Explicit (n:BigNum) = BigNum.ToDouble n
+        static member op_Explicit (n:BigNum) = BigNum.ToBigInt n
+
+
+        override n.ToString() = 
+            match n with 
+            | Z z -> z.ToString()
+            | Q q -> q.ToString()
+
+        member x.StructuredDisplayString = x.ToString()
+                   
+        static member Parse(s:string) = Q (BigRationalLarge.Parse s)
+
+    type BigRational = BigNum
+    type bignum = BigNum
+
+namespace Microsoft.FSharp.Core
+    open Microsoft.FSharp.Math
+    open System.Numerics    
+    type bignum = BigNum
+
+    // FxCop suppressions 
+    open System.Diagnostics.CodeAnalysis  
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_Addition(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_Division(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_GreaterThan(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_GreaterThanOrEqual(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_LessThan(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_LessThanOrEqual(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_Multiply(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_Subtraction(Microsoft.FSharp.Math.BigNum,Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_UnaryNegation(Microsoft.FSharp.Math.BigNum)")>]
+    [<assembly: SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Scope="member", Target="Microsoft.FSharp.Math.BigNum.#op_UnaryPlus(Microsoft.FSharp.Math.BigNum)")>]
+    do()
+
+    module NumericLiteralN = 
+        let FromZero () = BigNum.Zero 
+        let FromOne () = BigNum.One 
+        let FromInt32 i = BigNum.FromInt i
+        let FromInt64 (i64:int64) = BigNum.FromBigInt (new BigInteger(i64))
+        let FromString s = BigNum.Parse s
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fsi
new file mode 100644
index 0000000..dc1612d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/math/q.fsi
@@ -0,0 +1,93 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Math
+
+    open System
+    open System.Numerics
+      
+    /// The type of arbitrary-sized rational numbers
+    [<Sealed>]
+    type BigNum =
+        /// Return the sum of two rational numbers
+        static member ( + ) : BigNum * BigNum -> BigNum
+        /// Return the product of two rational numbers
+        static member ( * ) : BigNum * BigNum -> BigNum
+        /// Return the difference of two rational numbers
+        static member ( - ) : BigNum * BigNum -> BigNum
+        /// Return the ratio of two rational numbers
+        static member ( / ) : BigNum * BigNum -> BigNum
+        /// Return the negation of a rational number
+        static member ( ~- ): BigNum          -> BigNum
+        /// Return the given rational number
+        static member ( ~+ ): BigNum          -> BigNum
+
+        override ToString: unit -> string
+        override GetHashCode: unit -> int
+        interface System.IComparable
+
+        /// Get zero as a rational number
+        static member Zero : BigNum  
+        /// Get one as a rational number
+        static member One : BigNum  
+        /// This operator is for use from other .NET languages
+        static member op_Equality : BigNum * BigNum -> bool
+        /// This operator is for use from other .NET languages
+        static member op_Inequality : BigNum * BigNum -> bool
+        /// This operator is for use from other .NET languages
+        static member op_LessThan: BigNum * BigNum -> bool 
+        /// This operator is for use from other .NET languages
+        static member op_GreaterThan: BigNum * BigNum -> bool 
+        /// This operator is for use from other .NET languages
+        static member op_LessThanOrEqual: BigNum * BigNum -> bool 
+        /// This operator is for use from other .NET languages
+        static member op_GreaterThanOrEqual: BigNum * BigNum -> bool
+        
+        /// Return a boolean indicating if this rational number is strictly negative
+        member IsNegative: bool 
+        /// Return a boolean indicating if this rational number is strictly positive
+        member IsPositive: bool 
+
+        /// Return the numerator of the normalized rational number
+        member Numerator: BigInteger
+        /// Return the denominator of the normalized rational number
+        member Denominator: BigInteger
+
+        /// Return the absolute value of a rational number 
+        static member Abs : BigNum -> BigNum
+        /// Return the sign of a rational number; 0, +1 or -1
+        member Sign : int 
+        /// Return the result of raising the given rational number to the given power
+        static member PowN : BigNum * int -> BigNum
+        /// Return the result of converting the given integer to a rational number
+        static member FromInt : int         -> BigNum  
+        /// Return the result of converting the given big integer to a rational number
+        static member FromBigInt : BigInteger      -> BigNum  
+        /// Return the result of converting the given rational number to a floating point number
+        static member ToDouble: BigNum -> float 
+        /// Return the result of converting the given rational number to a big integer
+        static member ToBigInt: BigNum -> BigInteger
+        /// Return the result of converting the given rational number to an integer
+        static member ToInt32 : BigNum -> int
+        /// Return the result of converting the given rational number to a floating point number
+        static member op_Explicit : BigNum -> float 
+        /// Return the result of converting the given rational number to a big integer
+        static member op_Explicit : BigNum -> BigInteger
+        /// Return the result of converting the given rational number to an integer
+        static member op_Explicit : BigNum -> int
+        /// Return the result of converting the string to a rational number 
+        static member Parse: string -> BigNum
+
+    type BigRational = BigNum
+
+    type bignum = BigNum
+
+namespace Microsoft.FSharp.Core
+
+    type bignum = Microsoft.FSharp.Math.BigNum
+    [<RequireQualifiedAccess>]
+    module NumericLiteralN = 
+        val FromZero : unit -> bignum
+        val FromOne : unit -> bignum
+        val FromInt32 : int32 -> bignum
+        val FromInt64 : int64 -> bignum
+        val FromString : string -> bignum
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/mllib.fsharpp b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/mllib.fsharpp
new file mode 100644
index 0000000..0faf524
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/mllib.fsharpp
@@ -0,0 +1,318 @@
+"General"
+{
+"ProjectIdGuid" = "{C086298F-5158-43C9-88EB-FF85B09C762C}"
+}
+"Configurations"
+{
+    "Debug|Win32"
+    {
+    "ProjectType" = "DLL"
+    "OptLevel" = "Off"
+    "StrongNamingLevel" = "None"
+    "LanguageRestriction" = "None"
+    "OutputPath" = ""
+    "SearchPath" = " --compiling-mllib"
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "TRUE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = ""
+    }
+    "Release|Win32"
+    {
+    "ProjectType" = "EXE"
+    "OptLevel" = "3"
+    "StrongNamingLevel" = "None"
+    "LanguageRestriction" = "Fast F#"
+    "OutputPath" = ""
+    "SearchPath" = ""
+    "StrongNameFile" = ""
+    "OutputBase" = ""
+    "CustomCommandLine" = ""
+    "CustomCompiler" = ""
+    "DebugCheck" = "FALSE"
+    "CustomCompilationCheck" = "FALSE"
+    "DebugStartMode" = "0"
+    "StartApp" = ""
+    "StartAppPath" = ""
+    "CustomStartupArguments" = ""
+    }
+}
+"Files"
+{
+    "pervasives.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "pervasives.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lazy.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lazy.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lazylist.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lazylist.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "list.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "list.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "array.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "array.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "vector.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "vector.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "hashtbl.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "hashtbl.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "map.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "map.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "set.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "set.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "big_int.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "big_int.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "num.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "num.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "byte.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "byte.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "string.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "string.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "int32.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "int32.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "int64.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "int64.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "uint32.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "uint32.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "uint64.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "uint64.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "float.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "float.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "float32.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "float32.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "bytearray.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "bytearray.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "buffer.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "buffer.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "printf.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "printf.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "arg.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "arg.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "char.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "char.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "filename.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "filename.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lexing.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "lexing.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "obj.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "obj.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "parsing.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "parsing.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "printexc.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "printexc.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "sys.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "sys.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "ienumerable.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "ienumerable.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "ievent.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "ievent.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+    "nativeptr.fsi"
+    {
+    "ProjRelPath" = "T"
+    }
+    "nativeptr.fs"
+    {
+    "ProjRelPath" = "T"
+    }
+}
+"ProjStartupServices"
+{
+}
+"Globals"
+{
+}
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fs
new file mode 100644
index 0000000..8f6147b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fs
@@ -0,0 +1,15 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  
+//===========================================================================
+
+module Microsoft.FSharp.Compatibility.OCaml.Obj
+
+type t = obj
+let repr x = box x
+let obj (x:obj) = unbox x
+let magic x = obj (repr x)
+let nullobj = (null : obj)
+
+
+let eq (x: 'a)  (y: 'a) = LanguagePrimitives.PhysicalEquality x y
+let not_eq (x:'a) (y:'a) = not (LanguagePrimitives.PhysicalEquality x y)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fsi
new file mode 100644
index 0000000..68cb8fd
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/obj.fsi
@@ -0,0 +1,37 @@
+
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Obj
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'obj' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type t = obj
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'box' and/or 'unbox' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val magic: 'T -> 'U
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'null' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val nullobj: obj
+
+/// See Microsoft.FSharp.Core.Operators.unbox
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'unbox' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val obj: obj -> 'T
+
+/// See Microsoft.FSharp.Core.Operators.box
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'box' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val repr: 'T -> obj
+
+/// See Microsoft.FSharp.Core.LanguagePrimitives.PhysicalEquality
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'Microsoft.FSharp.Core.LanguagePrimitives.PhysicalEquality' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val eq: 'T -> 'T -> bool when 'T : not struct
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'not(Microsoft.FSharp.Core.LanguagePrimitives.PhysicalEquality(...))' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+/// Negation of Obj.eq (i.e. reference/physical inequality)
+val not_eq: 'T -> 'T -> bool when 'T : not struct
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fs
new file mode 100644
index 0000000..5325d40
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fs
@@ -0,0 +1,42 @@
+// (c) Microsoft Corporation 2005-2009.
+// Parsing: support fsyacc-generated parsers
+
+[<CompilerMessage("This module is for ML compatibility. Consider using the Microsoft.FSharp.Text.Parsing namespace directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Parsing
+open Microsoft.FSharp.Text.Lexing
+open Microsoft.FSharp.Text.Parsing
+open Microsoft.FSharp.Compatibility.OCaml
+
+let err _  = failwith "You must generate your parser using the '--ml-compatibility' option or call 'Parsing.set_parse_state parseState' in each action before using functions from the Parsing module.  This is because the module uses global state which must be set up for use in each parsing action. Review the notes in the 'Microsoft.FSharp.Compatibility.OCaml.Parsing' module if you are using parsers on multiple threads."
+let dummyProvider = 
+    { new IParseState with 
+        member x.InputRange(i) = err();
+        member p.InputStartPosition(n) = err();
+        member p.InputEndPosition(n) = err();
+        member x.ResultRange = err();
+        member x.GetInput(i) = err();
+        member x.ParserLocalStore = err();
+        member x.RaiseError() = err()  
+      }
+
+let mutable parse_information = dummyProvider
+let set_parse_state (x:IParseState) = parse_information <- x
+
+let enforce_nonnull_pos p = 
+  match (box p) with 
+  | null -> Position.Empty
+  | _ -> p
+
+let symbol_start_pos ()   = parse_information.ResultRange   |> fst |> enforce_nonnull_pos
+let symbol_end_pos ()     = parse_information.ResultRange   |> snd |> enforce_nonnull_pos
+let rhs_start_pos (n:int) = parse_information.InputRange(n) |> fst |> enforce_nonnull_pos
+let rhs_end_pos (n:int)   = parse_information.InputRange(n) |> snd |> enforce_nonnull_pos
+
+exception Parse_error  = RecoverableParseError
+let parse_error s = parse_information.RaiseError()(failwith s : unit)
+
+let symbol_start () = (symbol_start_pos()).pos_cnum
+let symbol_end () = (symbol_end_pos()).pos_cnum
+let rhs_start n = (rhs_start_pos n).pos_cnum
+let rhs_end n = (rhs_end_pos n).pos_cnum
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fsi
new file mode 100644
index 0000000..e3d70cb
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/parsing.fsi
@@ -0,0 +1,56 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.   The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Parsing: parser support for parsers produced by fsyacc.
+///
+/// Parsers generated by fsyacc provide location information within parser
+/// actions.  However that information is not available globally, but
+/// rather is accessed via the functions available on the following local
+/// variable which is available in all parser actions:
+///
+///    parseState : 'a Microsoft.FSharp.Text.Parsing.IParseState
+///
+/// However, this is not compatible with the parser specifications used
+/// with ocamlyacc and similar tools, which make a single parser state available
+/// globally.  If you wish to use a global parser state (e.g. so your code will
+/// cross-compile with OCaml) then you can use the functions in this file.
+/// You will need to either generate the parser with '--ml-compatibility' option 
+/// or add the code
+///
+///       Parsing.set_parse_state parseState;
+///
+/// at the start of each action of your grammar.  The functions below
+/// simply report the results of corresponding calls to the latest object
+/// specified by a call to set_parse_state.
+///
+/// Note that there could be unprotected multi-threaded concurrent access for the
+/// parser information, so you should not in general use these
+/// functions if there may be more than one parser active, and
+/// should instead use the functions directly available from the parseState
+/// object.
+[<CompilerMessage("This module is for ML compatibility. Consider using the Microsoft.FSharp.Text.Parsing namespace directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Parsing
+open Microsoft.FSharp.Text.Parsing
+open Microsoft.FSharp.Compatibility.OCaml
+
+val rhs_end: int -> int
+val rhs_end_pos: int -> Lexing.position
+val rhs_start: int -> int
+val rhs_start_pos: int -> Lexing.position
+val symbol_end: unit -> int
+val symbol_end_pos: unit -> Lexing.position
+val symbol_start: unit -> int
+val symbol_start_pos: unit -> Lexing.position
+
+val set_parse_state: IParseState -> unit
+
+/// You can initialize error recovery by raising the Parse_error exception. 
+
+exception Parse_error = Microsoft.FSharp.Text.Parsing.RecoverableParseError
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fs
new file mode 100644
index 0000000..e784d1e
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fs
@@ -0,0 +1,52 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Compatibility
+
+type permutation = int -> int
+
+module Permutation =
+
+    let invalidArg arg msg = raise (new System.ArgumentException((msg:string),(arg:string)))        
+
+    let ofFreshArray (arr:_[]) = 
+        let arr2 = Array.zeroCreate arr.Length
+        for i = 0 to arr.Length - 1 do 
+            let x = arr.[i] 
+            if x < 0 || x >= arr.Length then invalidArg "arr" "invalid permutation" 
+            arr2.[x] <- 1
+        for i = 0 to arr.Length - 1 do 
+            if arr2.[i] <> 1 then invalidArg "arr" "invalid permutation"
+        (fun k -> arr.[k])
+
+    let ofArray (arr:_[]) = arr |> Array.copy |> ofFreshArray
+
+    let of_array (arr:_[]) = ofArray arr
+
+    let ofPairs  (mappings: seq<int * int>) = 
+      let p = dict mappings 
+      (fun k -> if p.ContainsKey k then p.[k] else k)
+
+    let of_pairs  (mappings: seq<int * int>) =  ofPairs mappings
+
+    let swap (n:int) (m:int) = 
+      (fun k -> if k = n then m elif k = m then n else k)
+
+    let reversal size = 
+      if size <= 0 then invalidArg "size" "a permutation size must be positive";
+      (fun k -> (size - 1 - k))
+
+    let rotation size distance = 
+      if size <= 0 then invalidArg "size" "a permutation size must be positive";
+      if abs distance >= size then invalidArg "distance" "the absolute value of the distance must be less than the size of the permutation";
+      (fun k -> (k + size + distance) % size)
+
+    let identity (k:int) = k
+    
+    let inverse size p =
+        if size <= 0 then invalidArg "size" "a permutation size must be positive";
+        let arr2 = Array.zeroCreate size
+        for i = 0 to size - 1 do
+             arr2.[p i] <- i
+        ofFreshArray arr2
+
+    
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fsi
new file mode 100644
index 0000000..1f84367
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/permutation.fsi
@@ -0,0 +1,38 @@
+// (c) Microsoft Corporation 2005-2009.
+namespace Microsoft.FSharp.Compatibility
+
+type permutation = int -> int
+
+[<RequireQualifiedAccess>]
+module Permutation =
+    /// Create a permutation by specifying the result of permuting [| 0 .. n-1 |]. For example, 
+    /// Permutation.ofArray [| 1;2;0 |]  specifies a permutation that rotates all elements right one place.
+    val ofArray : destinations:int array -> permutation
+    [<System.Obsolete("This function has been renamed. Use 'Permutation.ofArray' instead")>]
+    val of_array : destinations:int array -> permutation
+
+    /// Create a permutation by specifying (source,destination) index pairs. For example,
+    /// Permutation(3,[ (0,2);(1,0); (2,1) ]) specifies a permutation that rotates 
+    /// all elements left one place. Not all elements need be given, e.g. 
+    /// Permutation(5,[ (1,2);(2,1) |]) specifies a permutation that swaps elements at indexes
+    /// 1 and 2.
+    val ofPairs : mappings: seq<int * int> -> permutation
+
+    [<System.Obsolete("This function has been renamed. Use 'Permutation.ofPairs' instead")>]
+    val of_pairs : mappings: seq<int * int> -> permutation
+    
+    /// Return a swaps the given two elements over any size
+    val swap: n:int -> m:int -> permutation
+
+    /// Return a permutation that, when applied, maps index 0 to size-1, size-1 to 0 etc.
+    val reversal: size:int -> permutation
+
+    /// Return a permutation that rotates right by the given distance. If the distance
+    /// is negative then a left rotation results.
+    val rotation: size:int -> distance:int -> permutation
+    
+    /// The identity permutation over any size
+    val identity : permutation
+    
+    val inverse : size: int -> p:permutation -> permutation
+    
\ No newline at end of file
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fs
new file mode 100644
index 0000000..98c0ba8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fs
@@ -0,0 +1,708 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+module Microsoft.FSharp.Compatibility.OCaml.Pervasives
+
+#nowarn "62" // compatibility warnings
+#nowarn "35"  // 'deprecated' warning about redefining '<' etc.
+#nowarn "86"  // 'deprecated' warning about redefining '<' etc.
+#nowarn "60"  // override implementations in intrinsic extensions
+#nowarn "69"  // interface implementations in intrinsic extensions
+
+open System.Collections.Generic
+
+exception Match_failure = Microsoft.FSharp.Core.MatchFailureException
+exception Assert_failure of string * int * int 
+
+exception Undefined 
+
+exception End_of_file      = System.IO.EndOfStreamException
+exception Out_of_memory    = System.OutOfMemoryException
+exception Division_by_zero = System.DivideByZeroException
+exception Stack_overflow   = System.StackOverflowException 
+
+let Not_found<'a> = (new KeyNotFoundException("The item was not found during a search or in a collection") :> exn)
+let (|Not_found|_|) (inp:exn) = match inp with :? KeyNotFoundException -> Some() | _ -> None
+
+let Invalid_argument (msg:string) = (new System.ArgumentException(msg) :> exn)
+let (|Invalid_argument|_|) (inp:exn) = match inp with :? System.ArgumentException as e -> Some(e.Message) | _ -> None
+
+let invalid_arg s = raise (System.ArgumentException(s))
+
+let not_found() = raise Not_found
+
+let inline (==)    (x:'a) (y:'a) = LanguagePrimitives.PhysicalEquality x y
+let inline (!=)    (x:'a) (y:'a) = not (LanguagePrimitives.PhysicalEquality x y)
+let inline (mod)  (x:int) (y:int)  = Operators.(%) x y
+let inline (land) (x:int) (y:int)  = Operators.(&&&) x y
+let inline (lor)  (x:int) (y:int)  = Operators.(|||) x y
+let inline (lxor) (x:int) (y:int)  = Operators.(^^^) x y
+let inline lnot   (x:int)          = Operators.(~~~) x
+let inline (lsl)  (x:int) (y:int)  = Operators.(<<<) x y
+let inline (lsr)  (x:int) (y:int)  = int32 (uint32 x >>> y)
+let inline (asr)  (x:int) (y:int)  = Operators.(>>>) x y
+
+let int_neg (x:int) = -x
+let (~-.)  (x:float)           =  -x
+let (~+.)  (x:float)           =  x
+let (+.)   (x:float) (y:float) =  x+y
+let (-.)   (x:float) (y:float) =  x-y
+let ( *.)  (x:float) (y:float) =  x*y
+let ( /.)  (x:float) (y:float) =  x/y
+
+let inline (.())   (arr: _[]) n = arr.[n]
+let inline (.()<-) (arr: _[]) n x = arr.[n] <- x
+
+let succ (x:int) = x + 1
+let pred (x:int) = x - 1
+let max_int = 0x7FFFFFFF // 2147483647 
+let min_int = 0x80000000 // -2147483648 
+
+(*  mod_float x y = x - y * q where q = truncate(a/b) and truncate x removes fractional part of x *)
+let truncate (x:float) : int = int32 x
+
+#if FX_NO_TRUNCATE
+let truncatef (x:float) = 
+    if x >= 0.0 then 
+        System.Math.Floor x
+    else
+        System.Math.Ceiling x
+#else
+let truncatef (x:float) = System.Math.Truncate x
+#endif
+let mod_float x y = x - y * truncatef(x/y)
+let float_of_int (x:int) =  float x
+let ldexp x (n:int) = x * (2.0 ** float n)
+let modf x = let integral = Operators.floor x in (integral, x - integral)
+let int_of_float x =  truncate x
+
+let neg_infinity = System.Double.NegativeInfinity
+let max_float    = System.Double.MaxValue 
+let min_float    =  0x0010000000000000LF
+let epsilon_float = 0x3CB0000000000000LF // Int64.float_of_bits 4372995238176751616L
+
+type fpclass = FP_normal (* | FP_subnormal *)  | FP_zero| FP_infinite | FP_nan      
+
+let classify_float (x:float) = 
+    if System.Double.IsNaN x then FP_nan
+    elif System.Double.IsNegativeInfinity x then FP_infinite
+    elif System.Double.IsPositiveInfinity x then FP_infinite
+    elif x = 0.0 then FP_zero
+    else FP_normal
+       
+let abs_float (x:float)           = Operators.abs x
+
+let int_of_char (c:char) = System.Convert.ToInt32(c)
+let char_of_int (x:int) = System.Convert.ToChar(x)
+
+let string_of_bool b = if b then "true" else "false"
+let bool_of_string s = 
+  match s with 
+  | "true" -> true 
+  | "false" -> false
+  | _ -> raise (System.ArgumentException("bool_of_string"))
+
+let string_of_int (x:int) = x.ToString()
+let int_of_string (s:string) = try int32 s with _ -> failwith "int_of_string"
+let string_of_float (x:float) = x.ToString()
+let float_of_string (s:string) = try float s with _ -> failwith "float_of_string"
+
+let string_to_int   x = int_of_string x
+
+
+//--------------------------------------------------------------------------
+// I/O
+//
+// OCaml-compatible channels conflate binary and text IO. It is very inconvenient to introduce
+// out_channel as a new abstract type, as this means functions like fprintf can't be used in 
+// conjunction with TextWriter values.  Hence we pretend that OCaml channels are TextWriters, and 
+// implement TextWriters in such a way the the implementation contains an optional binary stream
+// which is utilized by the OCaml binary I/O methods.
+//
+// Notes on the implementation: We discriminate between three kinds of 
+// readers/writers since various operations are possible on each kind.
+// StreamReaders/StreamWriters inherit from text readers/writers and
+// thus support more functionality.  We could just support two 
+// constructors (Binary and Text) and use dynamic type tests on the underlying .NET
+// objects to detect the cases where we have StreamWriters.
+//--------------------------------------------------------------------------
+open System.Text
+open System.IO
+
+type writer = 
+  | StreamW of StreamWriter
+  | TextW of (unit -> TextWriter)
+  | BinaryW of BinaryWriter
+
+
+[<assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", Scope="member", Target="Internal.Utilities.Pervasives+OutChannelImpl.#.ctor(Internal.Utilities.Pervasives+writer)", MessageId="System.IO.TextWriter.#ctor")>]
+do()
+
+let defaultEncoding =
+#if FX_NO_DEFAULT_ENCODING
+        // default encoding on Silverlight is UTF8 (to aling with e.g. System.IO.StreamReader)
+        Encoding.UTF8
+#else
+        Encoding.Default
+#endif
+
+type out_channel = TextWriter
+type OutChannelImpl(w: writer) = 
+    inherit TextWriter()
+    let mutable writer = w
+    member x.Writer with get() = writer and set(w) = writer <- w
+    
+    member x.Stream = 
+        match writer with 
+        | TextW _ -> failwith "cannot access a stream for this channel"
+        | BinaryW bw -> bw.BaseStream 
+        | StreamW sw -> sw.BaseStream
+    member x.TextWriter = 
+        match writer with 
+        | StreamW sw -> (sw :> TextWriter)
+        | TextW tw -> tw()
+        | _ -> failwith "binary channels created using the OCaml-compatible Pervasives.open_out_bin cannot be used as TextWriters.  Consider using 'System.IO.BinaryWriter' in preference to creating channels using open_out_bin."
+        
+    member x.StreamWriter = 
+        match writer with 
+        | StreamW sw -> sw
+        | _ -> failwith "cannot access a stream writer for this channel"
+    member x.BinaryWriter = 
+        match writer with 
+        | BinaryW w -> w
+        | _ -> failwith "cannot access a binary writer for this channel"
+
+type open_flag =
+  | Open_rdonly | Open_wronly | Open_append
+  | Open_creat | Open_trunc | Open_excl
+  | Open_binary | Open_text 
+#if FX_NO_NONBLOCK_IO
+#else
+  | Open_nonblock
+#endif
+  | Open_encoding of Encoding
+
+type reader = 
+  | StreamR of StreamReader
+  | TextR of (unit -> TextReader)
+  | BinaryR of BinaryReader
+
+/// See OutChannelImpl
+type in_channel = System.IO.TextReader
+type InChannelImpl(r : reader) = 
+    inherit TextReader()
+    let mutable reader = r
+    member x.Reader with get() = reader and set(r) = reader <- r
+    
+    member x.Stream =
+        match reader with 
+        | TextR _ -> failwith "cannot access a stream for this channel"
+        | BinaryR bw -> bw.BaseStream 
+        | StreamR sw -> sw.BaseStream
+    member x.TextReader = 
+        match reader with 
+        | StreamR sw -> (sw :> TextReader)
+        | TextR tw -> tw()
+        | _ -> failwith "binary channels created using the OCaml-compatible Pervasives.open_in_bin cannot be used as TextReaders  If necessary use the OCaml compatible binary input methods Pervasvies.input etc. to read from this channel. Consider using 'System.IO.BinaryReader' in preference to channels created using open_in_bin."
+        
+    member x.StreamReader = 
+        match reader with 
+        | StreamR sw -> sw
+        | _ -> failwith "cannot access a stream writer for this channel"
+    member x.BinaryReader = 
+        match reader with 
+        | BinaryR w -> w
+        | _ -> failwith "cannot access a binary writer for this channel"
+
+let (!!) (os : out_channel) = 
+    match os with 
+    | :? OutChannelImpl as os -> os.Writer
+    | :? StreamWriter as sw -> StreamW sw
+    | _ -> TextW (fun () -> os)
+let (<--) (os: out_channel) os' = 
+    match os with 
+    | :? OutChannelImpl as os -> os.Writer <- os'
+    | _ -> failwith "the mode may not be adjusted on a writer not created with one of the Pervasives.open_* functions"
+    
+let stream_to_BinaryWriter s    = BinaryW (new BinaryWriter(s))
+let stream_to_StreamWriter (encoding : Encoding) (s : Stream) =   StreamW (new StreamWriter(s,encoding))
+
+module OutChannel = 
+    let to_Stream (os:out_channel) =
+      match !!os with 
+      | BinaryW bw -> bw.BaseStream 
+      | StreamW sw -> sw.BaseStream
+      | TextW _ -> failwith "to_Stream: cannot access a stream for this channel"
+      
+    let to_StreamWriter (os:out_channel) =
+      match !!os with 
+      | StreamW sw -> sw
+      | _ -> failwith "to_StreamWriter: cannot access a stream writer for this channel"
+      
+    let to_TextWriter (os:out_channel) =
+      match !!os with 
+      | StreamW sw -> (sw :> TextWriter)
+      | TextW tw -> tw()
+      | _ -> os
+      
+    let of_StreamWriter w =
+      new OutChannelImpl(StreamW(w)) :> out_channel
+
+    let to_BinaryWriter (os:out_channel) =
+      match !!os with 
+      | BinaryW bw -> bw
+      | _ -> failwith "to_BinaryWriter: cannot access a binary writer for this channel"
+      
+    let of_BinaryWriter w =
+      new OutChannelImpl(BinaryW w) :> out_channel
+      
+    let of_TextWriter (w:TextWriter) =
+      let absw = 
+        match w with 
+        | :? StreamWriter as sw -> StreamW sw
+        | tw -> TextW (fun () -> tw) in
+      new OutChannelImpl(absw) :> out_channel
+        
+    let of_Stream encoding (s : Stream) =   new OutChannelImpl(stream_to_StreamWriter encoding s) :> out_channel
+      
+let listContains x l = List.exists (fun y -> x = y) l
+
+let open_out_gen flags (_perm:int) (s:string) = 
+    // permissions are ignored 
+    let app = listContains Open_append flags in 
+    let access = 
+        match listContains Open_rdonly flags, listContains Open_wronly flags with
+        | true, true -> invalidArg "flags" "invalid access for reading"
+        | true, false -> invalidArg "flags" "invalid access for writing" // FileAccess.Read 
+        | false, true ->  FileAccess.Write
+        | false, false -> (if app then FileAccess.Write else FileAccess.ReadWrite)  
+    let mode =
+        match (listContains Open_excl flags,app, listContains Open_creat flags, listContains Open_trunc flags) with
+        | (true,false,false,false) -> FileMode.CreateNew
+        | false,false,true,false -> FileMode.Create
+        | false,false,false,false -> FileMode.OpenOrCreate
+        | false,false,false,true -> FileMode.Truncate
+        | false,false,true,true -> FileMode.OpenOrCreate
+        | false,true,false,false -> FileMode.Append
+        | _ -> invalidArg "flags" "invalid mode" 
+    let share = FileShare.Read 
+    let bufferSize = 0x1000 
+#if FX_NO_NONBLOCK_IO
+    let stream = (new FileStream(s,mode,access,share,bufferSize)) 
+#else
+    let allowAsync = listContains Open_nonblock flags 
+    let stream = (new FileStream(s,mode,access,share,bufferSize,allowAsync)) 
+#endif
+    match listContains Open_binary flags, listContains Open_text flags with 
+    | true,true -> invalidArg "flags" "mixed text/binary flags"
+    | true,false -> (new OutChannelImpl(stream_to_BinaryWriter stream ) :> out_channel)
+    | false,_ ->
+        let encoding = List.tryPick (function Open_encoding e -> Some(e) | _ -> None) flags 
+        let encoding = match encoding with None -> defaultEncoding | Some e -> e 
+        OutChannel.of_Stream encoding (stream :> Stream)
+        
+let open_out (s:string) = open_out_gen [Open_text; Open_wronly; Open_creat] 777 s
+
+// NOTE: equiv to
+//       new BinaryWriter(new FileStream(s,FileMode.OpenOrCreate,FileAccess.Write,FileShare.Read ,0x1000,false)) 
+let open_out_bin (s:string) = open_out_gen [Open_binary; Open_wronly; Open_creat] 777 s
+
+
+let flush (os:out_channel) = 
+    match !!os with 
+    | TextW tw   -> (tw()).Flush() // the default method does not flush, is it overriden for the console? 
+    | BinaryW bw -> bw.Flush()
+    | StreamW sw -> sw.Flush()
+
+let close_out (os:out_channel) = 
+    match !!os with 
+    | TextW tw -> (tw()).Close()
+    | BinaryW bw -> bw.Close()
+    | StreamW sw -> sw.Close()
+
+let prim_output_newline (os:out_channel) = 
+    match !!os with 
+    | TextW tw -> (tw()).WriteLine()
+    | BinaryW _ -> invalidArg "os" "the channel is a binary channel"
+    | StreamW sw -> sw.WriteLine()
+
+let output_string (os:out_channel) (s:string) = 
+    match !!os with 
+    | TextW tw -> (tw()).Write(s)
+    | BinaryW bw -> 
+         // Write using a char array - writing a string writes it length-prefixed! 
+         bw.Write (Array.init s.Length (fun i -> s.[i]) )
+    | StreamW sw -> sw.Write(s)
+
+let prim_output_int (os:out_channel) (s:int) = 
+    match !!os with 
+    | TextW tw -> (tw()).Write(s)
+    | BinaryW _ -> invalidArg "os" "the channel is a binary channel"
+    | StreamW sw -> sw.Write(s)
+
+let prim_output_float (os:out_channel) (s:float) = 
+    match !!os with 
+    | TextW tw -> (tw()).Write(s)
+    | BinaryW _ -> invalidArg "os" "the channel is a binary channel"
+    | StreamW sw -> sw.Write(s)
+
+let output_char (os:out_channel) (c:char) = 
+    match !!os with 
+    | TextW tw -> 
+        (tw()).Write(c)
+    | BinaryW bw -> 
+        if int c > 255 then invalidArg "c" "unicode characters of value > 255 may not be written to binary channels"
+        bw.Write(byte c)
+    | StreamW sw -> 
+        sw.Write(c)
+
+let output_chars (os:out_channel) (c:char[]) start len  = 
+    match !!os with 
+    | TextW tw -> (tw()).Write(c,start,len)
+    | BinaryW bw -> bw.Write(c,start,len)
+    | StreamW sw -> sw.Write(c,start,len)
+
+let seek_out (os:out_channel) (n:int) = 
+    match !!os with 
+    | StreamW sw -> 
+        sw.Flush();   
+        (OutChannel.to_Stream os).Seek(int64 n,SeekOrigin.Begin) |> ignore
+    | TextW _ ->
+        (OutChannel.to_Stream os).Seek(int64 n,SeekOrigin.Begin) |> ignore
+    | BinaryW bw -> 
+        bw.Flush();
+        bw.Seek(n,SeekOrigin.Begin) |> ignore
+
+let pos_out (os:out_channel) = flush os; int32 ((OutChannel.to_Stream os).Position)
+let out_channel_length (os:out_channel) = flush os; int32 ((OutChannel.to_Stream os).Length)
+
+let output (os:out_channel) (buf: byte[]) (x:int) (len: int) = 
+    match !!os with 
+    | BinaryW bw -> bw.Write(buf,x,len)
+    | TextW _ | StreamW _ -> 
+        output_string os (defaultEncoding.GetString(buf,x,len))
+
+let output_byte (os:out_channel) (x:int) = 
+    match !!os with 
+    | BinaryW bw -> bw.Write(byte (x % 256))
+    | TextW _  | StreamW _ -> output_char os (char (x % 256))
+
+let output_binary_int (os:out_channel) (x:int) = 
+    match !!os with 
+    | BinaryW bw -> bw.Write x
+    | _ -> failwith "output_binary_int: not a binary stream"
+
+let set_binary_mode_out (os:out_channel) b = 
+    match !!os with 
+    | StreamW _ when not b -> ()
+    | BinaryW _ when b -> ()
+    | BinaryW bw -> 
+            os <--  stream_to_StreamWriter defaultEncoding (OutChannel.to_Stream os)
+    | StreamW bw -> os <-- stream_to_BinaryWriter (OutChannel.to_Stream os)
+    | TextW _ when b -> failwith "cannot set this stream to binary mode"
+    | TextW _ -> ()
+
+let print_int (x:int)        = prim_output_int stdout x
+let print_float (x:float)    = prim_output_float stdout x
+let print_string (x:string)  = output_string stdout x
+let print_newline ()         = prim_output_newline stdout
+let print_endline (x:string) = print_string x; print_newline ()
+let print_char (c:char)      = output_char stdout c
+
+let prerr_int (x:int)        = prim_output_int stderr x
+let prerr_float (x:float)    = prim_output_float stderr x
+let prerr_string (x:string)  = output_string stderr x
+let prerr_newline ()         = prim_output_newline stderr
+let prerr_endline (x:string) = prerr_string x; prerr_newline ()
+let prerr_char (c:char)      = output_char stderr c
+
+#if FX_NO_BINARY_SERIALIZATION
+#else
+let output_value (os:out_channel) (x: 'a) = 
+    let formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter() 
+    formatter.Serialize(OutChannel.to_Stream os,box [x]);
+    flush os
+#endif
+
+let (!!!) (c : in_channel) = 
+    match c with 
+    | :? InChannelImpl as c -> c.Reader
+    | :? StreamReader as sr -> StreamR sr
+    | _ -> TextR (fun () -> c)
+let (<---) (c: in_channel) r = 
+    match c with 
+    | :? InChannelImpl as c -> c.Reader<- r
+    | _ -> failwith "the mode may only be adjusted channels created with one of the Pervasives.open_* functions"
+
+let mk_BinaryReader (s: Stream) = BinaryR (new BinaryReader(s))
+let mk_StreamReader e (s: Stream) = StreamR (new StreamReader(s, e,false))
+module InChannel = 
+
+    let of_Stream (e:Encoding) (s: Stream) =   new InChannelImpl(mk_StreamReader e s) :> in_channel
+    let of_StreamReader w =
+      new InChannelImpl (StreamR w) :> in_channel
+
+    let of_BinaryReader r =
+      new InChannelImpl (BinaryR r) :> in_channel
+      
+    let of_TextReader (r: TextReader) =
+      let absr = 
+        match r with 
+        | :? StreamReader as sr -> StreamR sr
+        | tr -> TextR (fun () -> tr) 
+      new InChannelImpl(absr) :> in_channel
+
+    let to_StreamReader (c:in_channel) =
+      match !!!c with 
+      | StreamR sr -> sr
+      | _ -> failwith "to_StreamReader: cannot access a stream reader for this channel"
+      
+    let to_BinaryReader (is:in_channel) =
+      match !!!is with 
+      | BinaryR sr -> sr
+      | _ -> failwith "to_BinaryReader: cannot access a binary reader for this channel"
+      
+    let to_TextReader (is:in_channel) =
+      match !!!is with 
+      | TextR tr ->tr()
+      | _ -> is
+      
+    let to_Stream (is:in_channel) =
+      match !!!is with 
+      | BinaryR bw -> bw.BaseStream
+      | StreamR sw -> sw.BaseStream
+      | _ -> failwith "cannot seek, set position or calculate length of this stream"
+
+// permissions are ignored 
+let open_in_gen flags (_perm:int) (s:string) = 
+    let access = 
+      match listContains Open_rdonly flags, listContains Open_wronly flags with
+      | true, true -> invalidArg "flags" "invalid access"
+      | true, false -> FileAccess.Read 
+      | false, true -> invalidArg "flags" "invalid access for reading"
+      | false, false -> FileAccess.ReadWrite 
+    let mode = 
+      match listContains Open_excl flags,listContains Open_append flags, listContains Open_creat flags, listContains Open_trunc flags with
+      | false,false,false,false -> FileMode.Open
+      | _ -> invalidArg "flags" "invalid mode for reading" 
+    let share = FileShare.Read 
+    let bufferSize = 0x1000 
+#if FX_NO_NONBLOCK_IO
+    let stream = new FileStream(s,mode,access,share,bufferSize) :> Stream 
+#else
+    let allowAsync = listContains Open_nonblock flags 
+    let stream = new FileStream(s,mode,access,share,bufferSize,allowAsync) :> Stream 
+#endif
+    match listContains Open_binary flags, listContains Open_text flags with 
+    | true,true -> invalidArg "flags" "mixed text/binary flags specified"
+    | true,false -> new InChannelImpl (mk_BinaryReader stream ) :> in_channel
+    | false,_ ->
+        let encoding = List.tryPick (function Open_encoding e -> Some(e) | _ -> None) flags 
+        let encoding = match encoding with None -> defaultEncoding | Some e -> e 
+        InChannel.of_Stream encoding stream
+  
+let open_in_encoded (e:Encoding) (s:string) = open_in_gen [Open_text; Open_rdonly; Open_encoding e] 777 s
+let open_in (s:string) = open_in_gen [Open_text; Open_rdonly] 777 s
+
+// NOTE: equivalent to
+//     new BinaryReader(new FileStream(s,FileMode.Open,FileAccess.Read,FileShare.Read,0x1000,false))
+let open_in_bin (s:string) = open_in_gen [Open_binary; Open_rdonly] 777 s
+
+let close_in (is:in_channel) = 
+  match !!!is with 
+  | TextR tw -> (tw()).Close()
+  | BinaryR bw -> bw.Close()
+  | StreamR sw -> sw.Close()
+
+let input_line (is:in_channel) = 
+    match !!!is with 
+    | BinaryR _ -> failwith "input_line: binary mode"
+    | TextR tw -> match tw().ReadLine() with null -> raise End_of_file | res -> res
+    | StreamR sw -> match sw.ReadLine() with null -> raise End_of_file | res -> res
+
+let input_byte (is:in_channel) = 
+    match !!!is with 
+    | BinaryR bw ->  int (bw.ReadByte())
+    | TextR tr -> let b = (tr()).Read() in if b = -1 then raise End_of_file else int (byte b)
+    | StreamR sr -> let b = sr.Read() in if b = -1 then raise End_of_file else int (byte b)
+
+let prim_peek (is:in_channel) = 
+    match !!!is with 
+    | BinaryR bw ->  bw.PeekChar()
+    | TextR tr -> (tr()).Peek()
+    | StreamR sr -> sr.Peek()
+
+let prim_input_char (is:in_channel) = 
+    match !!!is with 
+    | BinaryR bw ->  (try int(bw.ReadByte()) with End_of_file -> -1)
+    | TextR tr -> (tr()).Read() 
+    | StreamR sr -> sr.Read()
+
+let input_char (is:in_channel) = 
+    match !!!is with 
+    | BinaryR _ ->  char_of_int (input_byte is)
+    | TextR tr -> let b = (tr()).Read() in if b = -1 then raise End_of_file else (char b)
+    | StreamR sr -> let b = sr.Read() in if b = -1 then raise End_of_file else (char b)
+
+let input_chars (is:in_channel) (buf:char[]) start len = 
+    match !!!is with 
+    | BinaryR bw ->  bw.Read(buf,start,len)
+    | TextR trf -> let tr = trf() in tr.Read(buf,start,len) 
+    | StreamR sr -> sr.Read(buf,start,len) 
+
+let seek_in (is:in_channel) (n:int) = 
+    begin match !!!is with 
+    | StreamR sw -> sw.DiscardBufferedData() 
+    | TextR _ | BinaryR _ -> ()
+    end;
+    ignore ((InChannel.to_Stream is).Seek(int64 n,SeekOrigin.Begin))
+
+let pos_in (is:in_channel)  = int32 ((InChannel.to_Stream is).Position)
+let in_channel_length (is:in_channel)  = int32 ((InChannel.to_Stream is).Length)
+
+let input_bytes_from_TextReader (tr : TextReader) (enc : Encoding) (buf: byte[]) (x:int) (len: int) = 
+    /// Don't read too many characters!
+    let lenc = (len * 99) / enc.GetMaxByteCount(100) 
+    let charbuf : char[] = Array.zeroCreate lenc 
+    let nRead = tr.Read(charbuf,x,lenc) 
+    let count = enc.GetBytes(charbuf,x,nRead,buf,x) 
+    count
+
+let input (is: in_channel) (buf: byte[]) (x:int) (len: int) = 
+    match !!!is with 
+    | StreamR _  ->  (InChannel.to_Stream is).Read(buf,x,len)
+    | TextR trf   -> 
+        input_bytes_from_TextReader (trf()) defaultEncoding buf x len  
+    | BinaryR br -> br.Read(buf,x,len)
+
+let really_input (is:in_channel) (buf: byte[]) (x:int) (len: int) = 
+    let mutable n = 0 
+    let mutable i = 1 
+    while (if i > 0 then n < len else false) do 
+        i <- input is buf (x+n) (len-n);
+        n <- n + i
+    
+let unsafe_really_input (is:in_channel) buf x len = really_input is buf x len
+
+let input_binary_int (is:in_channel) = 
+    match !!!is with 
+    | BinaryR bw -> bw.ReadInt32()
+    | _ -> failwith "input_binary_int: not a binary stream"
+
+let set_binary_mode_in (is:in_channel) b = 
+    match !!!is with 
+    | StreamR _ when not b -> ()
+    | BinaryR _ when b -> ()
+    | BinaryR bw -> is <---  mk_StreamReader defaultEncoding (InChannel.to_Stream is)
+    | StreamR bw -> is <--- mk_BinaryReader (InChannel.to_Stream is)
+    | TextR _ when b -> failwith "set_binary_mode_in: cannot set this stream to binary mode"
+    | TextR _ -> ()
+
+let read_line ()  = stdout.Flush(); input_line stdin
+let read_int ()   = int_of_string (read_line())
+let read_float () = float_of_string (read_line ())
+
+#if FX_NO_BINARY_SERIALIZATION
+#else
+let input_value (is:in_channel) = 
+    let formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter() 
+    let res = formatter.Deserialize(InChannel.to_Stream is) 
+    match ((unbox res) : 'a list) with 
+    | [x] -> x
+    | _ -> failwith "input_value: expected one item"
+#endif
+
+type InChannelImpl with 
+    override x.Dispose(deep:bool) = if deep then close_in (x :> in_channel)
+    override x.Peek() = prim_peek (x :> in_channel) 
+    override x.Read() = prim_input_char (x :> in_channel) 
+    override x.Read((buffer:char[]),(index:int),(count:int)) = input_chars (x :> in_channel) buffer index count
+    
+
+type OutChannelImpl with 
+    override x.Dispose(deep:bool) = if deep then close_out (x :> out_channel)
+    override x.Encoding = x.TextWriter.Encoding
+    override x.FormatProvider = x.TextWriter.FormatProvider
+    override x.NewLine = x.TextWriter.NewLine
+    override x.Write(s:string) = output_string (x :> out_channel) s
+    override x.Write(c:char) = output_char (x :> out_channel) c
+    override x.Write(c:char[]) = output_chars (x :> out_channel) c 0 c.Length
+    override x.Write((c:char[]),(index:int),(count:int)) = output_chars (x :> out_channel) c index count
+    
+type ('a,'b,'c,'d) format4 = Microsoft.FSharp.Core.Format<'a,'b,'c,'d>
+type ('a,'b,'c) format = Microsoft.FSharp.Core.Format<'a,'b,'c,'c>
+
+exception Exit
+
+
+module Pervasives = 
+
+    let hash  (x: 'a) = LanguagePrimitives.GenericHash x
+
+#if FX_NO_EXIT
+#else
+    let exit (n:int) = Operators.exit n
+#endif
+
+    let incr x = x.contents <- x.contents + 1
+    let decr x = x.contents <- x.contents - 1
+
+    let (@) l1 l2 = l1 @ l2
+    // NOTE: inline to call site since LanguagePrimitives.<funs> have static type optimisation 
+    let (=)     (x:'a) (y:'a) = Operators.(=) x y
+    let (<>)    (x:'a) (y:'a) = Operators.(<>) x y 
+    let (<)     (x:'a) (y:'a) = Operators.(<) x y
+    let (>)     (x:'a) (y:'a) = Operators.(>) x y
+    let (<=)    (x:'a) (y:'a) = Operators.(<=) x y
+    let (>=)    (x:'a) (y:'a) = Operators.(>=) x y
+    let min     (x:'a) (y:'a) = Operators.min x y
+    let max     (x:'a) (y:'a) = Operators.max x y
+    let compare (x:'a) (y:'a) = LanguagePrimitives.GenericComparison x y
+
+    let (~+) x = Operators.(~+) x
+    //  inline (~-) x = LanguagePrimitives.(~-) x 
+
+    let (+) (x:int) (y:int)   = Operators.(+) x y
+    let (-) (x:int) (y:int)   = Operators.(-) x y
+    let ( * ) (x:int) (y:int) = Operators.( * ) x y
+    let (/) (x:int) (y:int)   = Operators.(/) x y
+    let not (b:bool) = Operators.not b
+    type 'a ref = Microsoft.FSharp.Core.Ref<'a>
+    type 'a option = Microsoft.FSharp.Core.Option<'a>
+    type 'a list = Microsoft.FSharp.Collections.List<'a>
+    type exn = System.Exception
+    let raise (e:exn) = Operators.raise e
+    let failwith s = raise (Failure s)
+    let fst (x,_y) = x
+    let snd (_x,y) = y
+
+    let ref x = { contents=x }
+    let (!) x = x.contents
+    let (:=) x y = x.contents <- y
+
+    let float (x:int) =  Operators.float x
+    let float32 (n:int) =  Operators.float32 n
+    let abs (x:int) = Operators.abs x
+    let ignore _x = ()
+    let invalid_arg s = raise (System.ArgumentException(s))
+    let (^) (x:string) (y:string) = System.String.Concat(x,y)
+    let sqrt      (x:float)           = Operators.sqrt x
+    let exp       (x:float)           = Operators.exp x
+    let log       (x:float)           = Operators.log x
+    let log10     (x:float)           = Operators.log10 x
+    let cos       (x:float)           = Operators.cos x
+    let sin       (x:float)           = Operators.sin x
+    let tan       (x:float)           = Operators.tan x
+    let acos      (x:float)           = Operators.acos x
+    let asin      (x:float)           = Operators.asin x
+    let atan      (x:float)           = Operators.atan x
+    let atan2     (x:float) (y:float) = Operators.atan2 x y
+    let cosh      (x:float)           = Operators.cosh x
+    let sinh      (x:float)           = Operators.sinh x
+    let tanh      (x:float)           = Operators.tanh x
+    let ceil      (x:float)           = Operators.ceil x
+    let floor     (x:float)           = Operators.floor x
+
+    let ( ** ) (x:float) (y:float) = Operators.( ** ) x y
+    let truncate (x:float) = Operators.int32 x
+    let nan          = System.Double.NaN 
+    let infinity     = System.Double.PositiveInfinity
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fsi
new file mode 100644
index 0000000..6197863
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/pervasives.fsi
@@ -0,0 +1,855 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008. The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match. The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+///Pervasives: Additional OCaml-compatible bindings 
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Pervasives
+
+#nowarn "62" // compatibility warnings
+#nowarn "35"  // 'deprecated' warning about redefining '<' etc.
+#nowarn "86"  // 'deprecated' warning about redefining '<' etc.
+
+
+open System
+open System.IO
+open System.Collections.Generic
+
+#if COMPILER
+#endif
+ 
+//--------------------------------------------------------------------------
+//Pointer (physical) equality and hashing.
+
+///Reference/physical equality. 
+///True if boxed versions of the inputs are reference-equal, OR if
+///both are value types and the implementation of Object.Equals for the type
+///of the first argument returns true on the boxed versions of the inputs. 
+///
+///In normal use on reference types or non-mutable value types this function 
+///has the following properties:
+///   - returns 'true' for two F# values where mutation of data
+///     in mutable fields of one affects mutation of data in the other
+///   - will return 'true' if (=) returns true
+///   - hashq will return equal hashes if (==) returns 'true'
+///
+///The use on mutable value types is not recommended.
+[<CompilerMessage("This construct is for ML compatibility. Using the physical equality operator '==' is not recommended except in cross-compiled code. Consider using generic structural equality 'x = y' or 'LanguagePrimitives.PhysicalEquality x y'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (==): 'T -> 'T -> bool when 'T : not struct
+
+/// Negation of the '==' operator, see also Obj.eq
+[<CompilerMessage("This construct is for ML compatibility. Using the physical inequality operator '!=' is not recommended except in cross-compiled code. Consider using generic structual inequality 'x <> y' or 'not(LanguagePrimitives.PhysicalEquality x y)'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (!=): 'T -> 'T -> bool when 'T : not struct
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x % y' instead of 'x mod y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (mod): int -> int -> int 
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x &&& y' instead of 'x land y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+
+val inline (land): int -> int -> int 
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x ||| y' instead of 'x lor y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (lor) : int -> int -> int 
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x ^^^ y' instead of 'x lxor y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (lxor): int -> int -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator '~~~x' instead of 'lnot x'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline lnot  : int -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x <<< y' instead of 'x lsl y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (lsl): int -> int -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x >>> y' on an unsigned type instead of 'x lsr y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (lsr): int -> int -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x >>> y' instead of 'x asr y'. The precedence of these operators differs, so you may need to add parentheses. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline (asr): int -> int -> int
+
+/// 1D Array element get-accessor ('getter')
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'arr.[idx]' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline ( .() ) : 'T array -> int -> 'T
+
+/// 1D Array element set-accessor ('setter')
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'arr.[idx] <- v' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val inline ( .()<- ) : 'T array -> int -> 'T -> unit
+
+//--------------------------------------------------------------------------
+//Integer-specific arithmetic
+
+/// n-1 (no overflow checking)
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val pred: int -> int
+
+/// n+1 (no overflow checking)
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val succ: int -> int
+
+/// The lowest representable value in the 'int' type
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Int32.MinValue' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val min_int : int
+
+/// The highest representable value in the 'int' type
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Int32.MaxValue' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val max_int : int
+
+/// Negation on integers of the 'int' type
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator '-x' instead of 'int_neg x'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val int_neg : int -> int
+
+//--------------------------------------------------------------------------
+//Exceptions
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.EndOfStreamException instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception End_of_file = System.IO.EndOfStreamException
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.OutOfMemoryException instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Out_of_memory = System.OutOfMemoryException
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.DivideByZeroException instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Division_by_zero = System.DivideByZeroException
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.StackOverflowException instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Stack_overflow = System.StackOverflowException 
+
+[<CompilerMessage("This construct is for ML compatibility. This is a synonym for 'System.Collections.Generic.KeyNotFoundException'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val Not_found<'T> : exn
+
+[<CompilerMessage("This construct is for ML compatibility. This is a synonym for 'System.Collections.Generic.KeyNotFoundException'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val (|Not_found|_|) : exn -> unit option
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Exit 
+
+///  Non-exhaustive match failures will raise Match failures
+/// A future release of F# may map this exception to a corresponding .NET exception.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'MatchFailureException' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Match_failure = Microsoft.FSharp.Core.MatchFailureException
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Undefined 
+
+/// The exception thrown by 'assert' failures.
+/// A future release of F# may map this exception to a corresponding .NET exception.
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+exception Assert_failure of string * int * int 
+
+/// The exception thrown by <c>invalid_arg</c> and misues of F# library functions
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.ArgumentException' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val Invalid_argument : string -> exn
+
+[<CompilerMessage("This construct is for ML compatibility. Consider matching against 'System.ArgumentException' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val (|Invalid_argument|_|) : exn -> string option
+
+//--------------------------------------------------------------------------
+//Floating point.
+//
+//The following operators only manipulate 'float64' numbers. The operators  '+' etc. may also be used.
+
+/// This value is present primarily for compatibility with other versions of ML
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x * y' instead of 'x *. y'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( *. ): float -> float -> float
+
+/// This value is present primarily for compatibility with other versions of ML. In F#
+/// the overloaded operators may be used.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x + y' instead of 'x +. y'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( +. ): float -> float -> float
+
+/// This value is present primarily for compatibility with other versions of ML. In F#
+/// the overloaded operators may be used.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x - y' instead of 'x -. y'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( -. ): float -> float -> float
+
+/// This value is present primarily for compatibility with other versions of ML. In F#
+/// the overloaded operators may be used.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator '-x' instead of '-. x'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( ~-. ): float -> float
+
+/// This value is present primarily for compatibility with other versions of ML. In F#
+/// the overloaded operators may be used.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator '+x' instead of '+. x'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( ~+. ): float -> float
+
+/// This value is present primarily for compatibility with other versions of ML. In F#
+/// the overloaded operators may be used.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'x / y' instead of 'x /. y'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ( /. ): float -> float -> float
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the overloaded F# library function 'abs' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val abs_float: float -> float
+
+/// This value is present primarily for compatibility with other versions of ML
+/// The highest representable positive value in the 'float' type
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Double.MaxValue' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val max_float: float
+
+/// This value is present primarily for compatibility with other versions of ML
+/// The lowest non-denormalized positive IEEE64 float
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val min_float: float
+
+/// This value is present primarily for compatibility with other versions of ML
+/// The smallest value that when added to 1.0 gives a different value to 1.0
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val epsilon_float: float
+
+/// This value is present primarily for compatibility with other versions of ML
+[<CompilerMessage("This construct is for ML compatibility. Consider using the '%' operator instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val mod_float: float -> float -> float
+
+/// This value is present primarily for compatibility with other versions of ML
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val modf: float -> float * float
+
+/// This value is present primarily for compatibility with other versions of ML
+[<CompilerMessage("This construct is for ML compatibility. Consider using '-infinity' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val neg_infinity: float
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val ldexp: float -> int -> float
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type fpclass = 
+  | FP_normal
+  | FP_zero
+  | FP_infinite
+  | FP_nan
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val classify_float: float -> fpclass
+
+//--------------------------------------------------------------------------
+//Common conversions. See also conversions such as
+//Float32.to_int etc.
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val bool_of_string: string -> bool
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'char' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val char_of_int: int -> char
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'int' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val int_of_char: char -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'int' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val int_of_string: string -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'int' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val int_of_float: float -> int
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'string' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val string_of_bool: bool -> string
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'string' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val string_of_float: float -> string
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the operator 'string' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val string_of_int: int -> string
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the overloaded conversion function 'float' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val float_of_int: int -> float
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using the overloaded conversion function 'float' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val float_of_string: string -> float
+
+
+//--------------------------------------------------------------------------
+//I/O
+//
+//Caveat: These functions do not have precisely the same behaviour as 
+//corresponding functions in other ML implementations, e.g. OCaml. 
+//For example they may raise .NET exceptions rather than Sys_error.
+
+  
+/// This type is present primarily for compatibility with other versions of ML. When
+/// not cross-compiling we recommend using the .NET I/O libraries
+[<CompilerMessage("This construct is for ML compatibility. For advanced I/O consider using the System.IO namespace. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type open_flag = 
+  | Open_rdonly
+  | Open_wronly
+  | Open_append
+  | Open_creat
+  | Open_trunc
+  | Open_excl
+  | Open_binary
+  | Open_text
+#if FX_NO_NONBLOCK_IO
+#else
+  | Open_nonblock
+#endif
+  | Open_encoding of System.Text.Encoding
+
+//--------------------------------------------------------------------------
+
+
+/// A pseudo-abstraction over binary and textual input channels.
+/// OCaml-compatible channels conflate binary and text IO, and for this reasons their
+/// use from F# is somewhat deprecated (direct use of System.IO StreamReader, TextReader and 
+/// BinaryReader objects is preferred, e.g. see System.IO.File.OpenText). 
+/// Well-written OCaml-compatible code that simply opens either a channel in text or binary 
+/// mode and then does text or binary I/O using the OCaml-compatible functions below
+/// will work, though care must be taken with regard to end-of-line characters (see 
+/// input_char below).
+///
+/// This library pretends that an in_channel is just a System.IO.TextReader. Channel values
+/// created using open_in_bin maintain a private System.IO.BinaryReader, which will be used whenever
+/// you do I/O using this channel. 
+///
+/// InChannel.of_BinaryReader and InChannel.of_StreamReader allow you to build input 
+/// channels out of the corresponding .NET abstractions.
+[<CompilerMessage("This construct is for ML compatibility. Consider using one of the types System.IO.TextReader, System.IO.BinaryReader or System.IO.StreamReader instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type in_channel = System.IO.TextReader
+    
+
+/// Open the given file to read. 
+///
+///In the absence of an explicit encoding (e.g. using Open_encoding) open_in
+///uses the default text encoding (System.Text.Encoding.Default). If you want to read a file
+///regardless of encoding then you should use binary modes. Note that .NET's 
+///"new StreamReader" function defaults to use a utf8 encoding, and also attempts
+///to determine an automatic encoding by looking for "byteorder-marks" at the head
+///of a text file. This function does not do this.
+///
+/// No CR-LF translation is done on input.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.IO.File.OpenText(path)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_in: path:string -> in_channel
+
+/// Open the given file to read in binary-mode 
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'new System.IO.BinaryReader(System.IO.File.OpenRead(path))' and changing your type to be a BinaryReader instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_in_bin: path:string -> in_channel
+
+/// Open the given file in the mode specified by the given flags
+[<CompilerMessage("This construct is for ML compatibility. For advanced I/O consider using the System.IO namespace instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_in_gen: flags: open_flag list -> int -> path:string -> in_channel
+
+/// Close the channel
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Close()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val close_in: channel:in_channel -> unit
+
+/// Return the length of the input channel
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Length' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val in_channel_length: channel:in_channel -> int
+
+/// Attempt to input the given number of bytes from the channel, writing them into the
+/// buffer at the given start position. Does not block if the bytes are not available.
+///
+/// The use of this function with a channel performing byte-to-character translation (e.g. one
+/// created with open_in, open_in_utf8 or open_in_encoded, or one 
+/// or built from a StreamReader or TextReader) is not recommended.
+/// Instead, open the channel using open_in_bin or InChannel.of_BinaryReader.
+///
+/// If used with a StreamReader channel, i.e. one created using 
+/// open_in, open_in_utf8 or open_in_encoded, or one 
+/// or built from a StreamReader, this function reads bytes directly from the underlying
+/// BaseStream. This may not be appropriate if any other input techniques are being
+/// used on the channel.
+///
+/// If used with a TextReader channel (e.g. stdin), this function reads characters from the
+/// stream and then fills some of the byte array with the decoding of these into 
+/// bytes, where the decoding is performed using the System.Text.Encoding.Default encoding
+///
+/// Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Read(buffer,index,count)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input: channel:in_channel -> buffer:byte[] -> index:int -> count:int -> int
+
+/// Attempt to input characters from a channel. Does not block if inpout is not available.
+/// Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+///
+/// No CRLF translation is done on input, even in text mode. That is, if an input file
+/// has '\r\n' (CRLF) line terminators both characters will be seen in the input.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Read(buffer,index,count)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_chars: channel:in_channel -> buffer:char[] -> index:int -> count:int -> int
+
+/// Input a binary integer from a binary channel. Compatible with output_binary_int.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.ReadInt32()' on a BinaryReader instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_binary_int: channel:in_channel -> int
+
+/// Input a single byte. 
+/// For text channels this only accepts characters with a UTF16 encoding that fits in a byte, e.g. ASCII.
+/// Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the 'Read()' method on a 'BinaryReader' instead, which returns -1 if no byte is available. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_byte: channel:in_channel -> int
+
+/// Input a single character. Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the 'channel.Read()' method instead, which returns -1 if no character is available. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_char: channel:in_channel -> char
+
+/// Input a single line. Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider using the 'channel.ReadLine()' method instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_line: channel:in_channel -> string
+
+#if FX_NO_BINARY_SERIALIZATION
+#else
+/// Input a single serialized value from a binary stream. Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider deserializing using an object of type 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter' method instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val input_value: channel:in_channel -> 'T
+#endif
+/// Report the current position in the input channel
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Position' property instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val pos_in: channel:in_channel -> int
+
+/// Reads bytes from the channel. Blocks if the bytes are not available.
+/// See 'input' for treatment of text channels.
+/// Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val really_input: channel:in_channel -> buffer:byte[] -> index:int -> count:int -> unit
+
+/// Reads bytes from the channel. Blocks if the bytes are not available.
+/// For text channels this only accepts UTF-16 bytes with an encoding less than 256.
+/// Raise End_of_file (= System.IO.EndOfStreamException) if end of file reached.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Seek' method instead, or using a 'System.IO.BinaryReader' and related types for binary I/O. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val seek_in: channel:in_channel -> int -> unit
+
+/// Set the binary mode to true or false. If the binary mode is changed from "true" to 
+/// "false" then a StreamReader is created to read the binary stream. The StreamReader uses 
+/// the default text encoding System.Text.Encoding.Default
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.IO.BinaryReader' and related types for binary I/O. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val set_binary_mode_in: channel:in_channel -> bool -> unit
+
+[<Obsolete("For F# code unsafe_really_input is identical to really_input")>]
+val unsafe_really_input: channel:in_channel -> byte[] -> int -> int -> unit
+
+//--------------------------------------------------------------------------
+//Output channels (out_channel). 
+
+/// An pseudo-abstraction over binary and textual output channels.
+/// OCaml-compatible channels conflate binary and text IO, and for this reasons their
+/// use from F# is somewhat deprecated The direct use of System.IO StreamWriter, TextWriter and 
+/// BinaryWriter objects is preferred, e.g. see System.IO.File.CreateText). Well-written OCaml code 
+/// that simply opens either a channel in text or binary mode and then does text 
+/// or binary I/O using the OCaml functions will work, though care must 
+/// be taken with regard to end-of-line characters (see output_char below).
+///
+/// This library pretends that an out_channel is just a System.IO.TextWriter. Channels
+/// created using open_out_bin maintain a private System.IO.BinaryWriter, which will be used whenever
+/// do I/O using this channel. 
+[<CompilerMessage("This construct is for ML compatibility. Consider using one of the types 'System.IO.TextWriter', 'System.IO.StreamWriter' or 'System.IO.BinaryWriter' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type out_channel  = System.IO.TextWriter
+
+/// Open the given file to write in text-mode using the
+/// System.Text.Encoding.Default encoding
+///
+/// See output_char for a description of CR-LF translation
+/// done on output.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.IO.File.CreateText(path)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_out: path:string -> out_channel
+
+/// Open the given file to write in binary-mode 
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'new System.IO.BinaryWriter(System.IO.File.Create(path))' and changing your type to be a BinaryWriter instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_out_bin: path:string -> out_channel
+
+/// Open the given file to write in the mode according to the specified flags
+[<CompilerMessage("This construct is for ML compatibility. For advanced I/O consider using the System.IO namespace. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val open_out_gen: open_flag list -> int -> path:string -> out_channel
+
+/// Close the given output channel
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Close()' instead, or create the channel via a 'use' binding to ensure automatic cleanup. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val close_out: channel:out_channel -> unit
+
+/// Return the length of the output channel. 
+/// Raise an exception if not an app
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Length' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val out_channel_length: channel:out_channel -> int
+
+/// Write the given range of bytes to the output channel. 
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Write(buffer,index,count)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output: channel:out_channel -> bytes:byte[] -> index:int -> count:int -> unit
+
+/// Write the given integer to the output channel in binary format.
+/// Only valid on binary channels.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Write(int)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output_binary_int: channel:out_channel -> int:int -> unit
+
+/// Write the given byte to the output channel. No CRLF translation is
+/// performed.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Write(byte)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output_byte: channel:out_channel -> byte:int -> unit
+
+/// Write the given Unicode character to the output channel. 
+///
+/// If the output channel is a binary stream and the UTF-16 value of the Unicode character is greater
+/// than 255 then ArgumentException is thrown.
+///
+/// No CRLF translation is done on output. That is, if the output character is
+/// '\n' (LF) characters they will not be written as '\r\n' (CRLF) characters, regardless
+/// of whether the underlying operating system or output stream uses CRLF as the default
+/// line-feed character.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Write(char)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output_char: channel:out_channel -> char -> unit
+
+/// Write the given Unicode string to the output channel. See output_char for the treatment of
+/// '\n' characters within the string.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Write(string)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output_string: channel:out_channel -> string -> unit
+
+#if FX_NO_BINARY_SERIALIZATION
+#else
+/// Serialize the given value to the output channel.
+[<CompilerMessage("This construct is for ML compatibility. Consider serializing using an object of type 'System.Runtime.Serialization.Formatters.Binary.BinaryFormatter' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val output_value: channel:out_channel -> 'T -> unit
+#endif
+/// Return the current position in the output channel, measured from the
+/// start of the channel. Not valid on all channels.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Position' on a TextWriter or '.Position' on a Stream instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val pos_out: channel:out_channel -> int
+
+/// Set the current position in the output channel, measured from the
+/// start of the channel.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.BaseStream.Seek' on a TextReader or 'channel.Seek' on a Stream instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val seek_out: channel:out_channel -> int -> unit
+
+/// Set the binary mode. If the binary mode is changed from "true" to 
+/// "false" then a StreamWriter is created to write the binary stream. The StreamWriter uses 
+/// the default text encoding System.Text.Encoding.Default.
+[<CompilerMessage("This construct is for ML compatibility. For advanced I/O consider using the System.IO namespace. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val set_binary_mode_out: channel:out_channel -> bool -> unit
+
+/// Flush all pending output on the channel to the physical
+/// output device.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'channel.Flush()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val flush: channel:out_channel -> unit
+
+//--------------------------------------------------------------------------
+//Printing data to stdout/stderr
+
+
+/// Print a character to the stderr stream
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.Write(char)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_char: char -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.WriteLine(string)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_endline: string -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.Write(double)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_float: float -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.Write(int)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_int: int -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.WriteLine()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_newline: unit -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Error.Write(string)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val prerr_string: string -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Write(char)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_char: char -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.WriteLine(string)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_endline: string -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Write(double)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_float: float -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Write(int)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_int: int -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.WriteLine()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_newline: unit -> unit
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.Write(string)' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val print_string: string -> unit
+
+//--------------------------------------------------------------------------
+//Reading data from the console.
+
+
+///Read a floating point number from the console.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.ReadLine() |> float' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val read_float: unit -> float
+
+///Read an integer from the console.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.ReadLine() |> int' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val read_int: unit -> int
+
+///Read a line from the console, without the end-of-line character.
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'System.Console.ReadLine()' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val read_line: unit -> string
+
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using Microsoft.FSharp.Core.Format<_,_,_,_> instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type ('a,'b,'c,'d) format4 = Microsoft.FSharp.Core.Format<'a,'b,'c,'d>
+
+[<CompilerMessage("This construct is for ML compatibility. Consider using Microsoft.FSharp.Core.Format<_,_,_,_> instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+type ('a,'b,'c) format = Microsoft.FSharp.Core.Format<'a,'b,'c,'c>
+
+/// Throw an ArgumentException
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'invalidArg' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val invalid_arg: string -> 'T
+
+/// Throw an <c>KeyNotFoundException</c> exception
+[<CompilerMessage("This construct is for ML compatibility. Consider using 'raise (KeyNotFoundException(message))' instead. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val not_found : unit -> 'T 
+
+[<Obsolete("Use methods and properties on the corresponding type instead")>]
+module OutChannel =
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_BinaryWriter: System.IO.BinaryWriter -> out_channel
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_StreamWriter: System.IO.StreamWriter -> out_channel
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_TextWriter: System.IO.TextWriter -> out_channel
+
+    /// Wrap a stream by creating a StreamWriter for the 
+    /// stream and then wrapping is as an output channel.
+    /// A text encoding must be given, e.g. System.Text.Encoding.UTF8
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_Stream: System.Text.Encoding -> System.IO.Stream -> out_channel
+
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_Stream: out_channel -> System.IO.Stream
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_TextWriter: out_channel -> System.IO.TextWriter
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_StreamWriter: out_channel -> System.IO.StreamWriter
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_BinaryWriter: out_channel -> System.IO.BinaryWriter
+
+[<Obsolete("Use methods and properties on the corresponding type instead")>]
+module InChannel =
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_Stream: in_channel -> System.IO.Stream
+
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_TextReader: in_channel -> System.IO.TextReader
+
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_StreamReader: in_channel -> System.IO.StreamReader
+    /// Access the underlying stream-based objects for the channel
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val to_BinaryReader: in_channel -> System.IO.BinaryReader
+
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_BinaryReader: System.IO.BinaryReader -> in_channel
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_StreamReader: System.IO.StreamReader -> in_channel
+    ///Link .NET IO with the out_channel/in_channel model
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_TextReader: System.IO.TextReader -> in_channel
+    /// Wrap a stream by creating a StreamReader for the 
+    /// stream and then wrapping is as an input channel.
+    /// A text encoding must be given, e.g. System.Text.Encoding.UTF8
+    [<Obsolete("Use methods and properties on the corresponding type instead")>]
+    val of_Stream:  System.Text.Encoding -> System.IO.Stream -> in_channel
+
+//--------------------------------------------------------------------------
+// OCaml path-lookup compatibility. All these constructs are in scope already
+// for F# from Microsoft.FSharp.Operators and elsewhere. This module 
+// is Microsoft.FSharp.Compatibility.OCaml.Pervasives.Pervasives and is only included 
+// to resolve references in OCaml code written "compare" etc.
+// We hide these away in the sub-module called "Pervasives" because we don't
+// particularly want normal references such as "compare" to resolve to the 
+// values in Pervasives.
+
+
+[<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Pervasives = 
+    //--------------------------------------------------------------------------
+    // Comparison based on F# term structure and/or calls to System.IComparable
+
+    ///Structural less-than comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (<): 'T -> 'T -> bool when 'T : comparison
+
+    ///Structural less-than-or-equal comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (<=): 'T -> 'T -> bool when 'T : comparison
+
+    ///Structural inequality
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (<>): 'T -> 'T -> bool when 'T : equality
+
+    ///Structural equality
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (=): 'T -> 'T -> bool when 'T : equality
+
+    ///Structural greater-than
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (>): 'T -> 'T -> bool when 'T : comparison
+
+    ///Structural greater-than-or-equal
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (>=): 'T -> 'T -> bool when 'T : comparison
+
+    ///Structural comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val compare: 'T -> 'T -> int when 'T : comparison
+
+    ///Maximum based on structural comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val max: 'T -> 'T -> 'T when 'T : comparison
+
+    ///Minimum based on structural comparison
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val min: 'T -> 'T -> 'T when 'T : comparison
+
+    ///The "hash" function is a structural hash function. It is 
+    ///designed to return equal hash values for items that are 
+    ///equal according to the polymorphic equality 
+    ///function Pervasives.(=) (i.e. the standard "=" operator).
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val hash: 'T -> int
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (+)  : int -> int -> int
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (-)  : int -> int -> int
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val ( * ): int -> int -> int
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (/)  : int -> int -> int
+
+    ///Absolute value of the given integer
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val abs : int -> int
+
+    ///Dereference a mutable reference cell
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (!) : 'T ref -> 'T
+
+    ///Assign to a mutable reference cell
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (:=): 'T ref -> 'T -> unit
+
+    ///Create a mutable reference cell
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val ref : 'T -> 'T ref
+
+    /// Throw a 'Failure' exception
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val failwith: string -> 'T
+
+    /// Throw an exception
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val raise: exn -> 'T
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val fst: ('T1 * 'T2) -> 'T1
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val snd: ('T1 * 'T2) -> 'T2
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val ignore: 'T -> unit
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val not: bool -> bool
+
+    ///Decrement a mutable reference cell containing an integer
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val decr: int ref -> unit
+
+    ///Increment a mutable reference cell containing an integer
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val incr: int ref -> unit
+    
+#if FX_NO_EXIT
+#else
+    ///Exit the current hardware isolated process, if security settings permit,
+    ///otherwise raise an exception. Calls System.Environment.Exit.
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val exit: int -> 'T   
+#endif
+    /// Concatenate two strings. The overlaoded operator '+' may also be used.
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (^): string -> string -> string
+
+    /// Concatenate two lists.
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val (@): 'T list -> 'T list -> 'T list
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val float: int -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val acos: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val asin: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val atan: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val atan2: float -> float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val ceil: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val exp: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val floor: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val log: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val log10: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val sqrt: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val cos: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val cosh: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val sin: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val sinh: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val tan: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val tanh: float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val truncate: float -> int
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val ( **  ): float -> float -> float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val nan: float
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val infinity: float
+
+    ///The type of pointers to mutable reference cells
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type 'T ref = Microsoft.FSharp.Core.Ref<'T>
+
+    ///The type of None/Some options
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type 'T option = Microsoft.FSharp.Core.Option<'T>
+
+    ///The type of simple immutable lists 
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type 'T list = Microsoft.FSharp.Collections.List<'T>
+
+    [<CompilerMessage("This construct is for ML compatibility. Consider replacing uses of the functions accessible via Pervasives.* with their F# equivalents, usually by deleting 'Pervasives.'. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type exn = System.Exception
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fs
new file mode 100644
index 0000000..5bd5a8c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fs
@@ -0,0 +1,423 @@
+// (c) Microsoft Corporation 2005-2009.
+
+#nowarn "47" // recursive initialization of LexBuffer
+
+
+#if INTERNALIZED_POWER_PACK
+namespace Internal.Utilities.Text.Lexing
+
+#else
+namespace Microsoft.FSharp.Text.Lexing 
+#endif
+
+    open System.Collections.Generic
+
+    // REVIEW: This type showed up on a parsing-intensive performance measurement. Consider whether it can be a struct-record later when we have this feature. -jomo
+#if INTERNALIZED_POWER_PACK
+    type internal Position = 
+#else
+    type Position = 
+#endif
+        { pos_fname : string;
+          pos_lnum : int;
+#if INTERNALIZED_POWER_PACK
+          pos_orig_lnum : int;
+#endif
+          pos_bol : int;
+          pos_cnum : int; }
+        member x.FileName = x.pos_fname
+        member x.Line = x.pos_lnum
+#if INTERNALIZED_POWER_PACK
+        member x.OriginalLine = x.pos_orig_lnum
+#endif
+        member x.Char = x.pos_cnum
+        member x.AbsoluteOffset = x.pos_cnum
+        member x.StartOfLine = x.pos_bol
+        member x.StartOfLineAbsoluteOffset = x.pos_bol
+        member x.Column = x.pos_cnum - x.pos_bol
+        member pos.NextLine = 
+            { pos with 
+#if INTERNALIZED_POWER_PACK
+                    pos_orig_lnum = pos.OriginalLine + 1;
+#endif
+                    pos_lnum = pos.Line+1; 
+                    pos_bol = pos.AbsoluteOffset }
+        member pos.EndOfToken(n) = {pos with pos_cnum=pos.pos_cnum + n }
+        member pos.AsNewLinePos() = pos.NextLine
+        member pos.ShiftColumnBy(by) = {pos with pos_cnum = pos.pos_cnum + by}
+        static member Empty = 
+            { pos_fname=""; 
+              pos_lnum= 0; 
+#if INTERNALIZED_POWER_PACK
+              pos_orig_lnum = 0;
+#endif
+              pos_bol= 0; 
+              pos_cnum=0 }
+        static member FirstLine(filename) = 
+            { pos_fname=filename; 
+#if INTERNALIZED_POWER_PACK
+              pos_orig_lnum = 1;
+#endif
+              pos_lnum= 1; 
+              pos_bol= 0; 
+              pos_cnum=0 }
+
+#if INTERNALIZED_POWER_PACK
+    type internal LexBufferFiller<'char> = 
+#else
+    type LexBufferFiller<'char> = 
+#endif
+        { fillSync : (LexBuffer<'char> -> unit) option
+          fillAsync : (LexBuffer<'char> -> Async<unit>) option } 
+        
+    and [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+        internal LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = 
+#else
+        LexBuffer<'char>(filler: LexBufferFiller<'char>) as this = 
+#endif
+        let context = new Dictionary<string,obj>(1) in 
+        let extendBufferSync = (fun () -> match filler.fillSync with Some refill -> refill this | None -> invalidOp "attempt to read synchronously from an asynchronous lex buffer")
+        let extendBufferAsync = (fun () -> match filler.fillAsync with Some refill -> refill this | None -> invalidOp "attempt to read asynchronously from a synchronous lex buffer")
+        let mutable buffer=[||];
+        /// number of valid charactes beyond bufferScanStart 
+        let mutable bufferMaxScanLength=0;
+        /// count into the buffer when scanning 
+        let mutable bufferScanStart=0;
+        /// number of characters scanned so far 
+        let mutable bufferScanLength=0;
+        /// length of the scan at the last accepting state 
+        let mutable lexemeLength=0;
+        /// action related to the last accepting state 
+        let mutable bufferAcceptAction=0;
+        let mutable eof = false;
+        let mutable startPos = Position.Empty ;
+        let mutable endPos = Position.Empty
+
+        // Throw away all the input besides the lexeme 
+              
+        let discardInput () = 
+            let keep = Array.sub buffer bufferScanStart bufferScanLength
+            let nkeep = keep.Length 
+            Array.blit keep 0 buffer 0 nkeep;
+            bufferScanStart <- 0;
+            bufferMaxScanLength <- nkeep
+                 
+              
+        member lexbuf.EndOfScan () : int =
+            // Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength;
+            if bufferAcceptAction < 0 then 
+                failwith "unrecognized input"
+
+            //  Printf.printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp;
+            //   Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer); 
+            lexbuf.StartPos <- endPos;
+            lexbuf.EndPos <- endPos.EndOfToken(lexbuf.LexemeLength);
+            bufferAcceptAction
+
+        member lexbuf.StartPos
+           with get() = startPos
+           and  set(b) =  startPos <- b
+           
+        member lexbuf.EndPos 
+           with get() = endPos
+           and  set(b) =  endPos <- b
+
+        member lexbuf.Lexeme         = Array.sub buffer bufferScanStart lexemeLength
+        member lexbuf.LexemeChar(n)  = buffer.[n+bufferScanStart]
+        
+        member lexbuf.BufferLocalStore = (context :> IDictionary<_,_>)
+        member lexbuf.LexemeLength        with get() : int = lexemeLength    and set v = lexemeLength <- v
+        member internal lexbuf.Buffer              with get() : 'char[] = buffer              and set v = buffer <- v
+        member internal lexbuf.BufferMaxScanLength with get() = bufferMaxScanLength and set v = bufferMaxScanLength <- v
+        member internal lexbuf.BufferScanLength    with get() = bufferScanLength    and set v = bufferScanLength <- v
+        member internal lexbuf.BufferScanStart     with get() : int = bufferScanStart     and set v = bufferScanStart <- v
+        member internal lexbuf.BufferAcceptAction  with get() = bufferAcceptAction  and set v = bufferAcceptAction <- v
+        member internal lexbuf.RefillBuffer = extendBufferSync
+        member internal lexbuf.AsyncRefillBuffer = extendBufferAsync
+
+        static member LexemeString(lexbuf:LexBuffer<char>) = 
+            new System.String(lexbuf.Buffer,lexbuf.BufferScanStart,lexbuf.LexemeLength)
+
+        member lexbuf.IsPastEndOfStream 
+           with get() = eof
+           and  set(b) =  eof <- b
+
+        member lexbuf.DiscardInput() = discardInput ()
+
+        member x.BufferScanPos = bufferScanStart + bufferScanLength
+
+        member lexbuf.EnsureBufferSize n = 
+            if lexbuf.BufferScanPos + n >= buffer.Length then 
+                let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) 
+                Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength;
+                buffer <- repl
+
+        static member FromReadFunctions (syncRead : ('char[] * int * int -> int) option, asyncRead : ('char[] * int * int -> Async<int>) option) : LexBuffer<'char> = 
+            let extension= Array.zeroCreate 4096
+            let fillers = 
+                { fillSync = 
+                    match syncRead with 
+                    | None -> None
+                    | Some read -> 
+                         Some (fun lexBuffer -> 
+                             let n = read(extension,0,extension.Length)
+                             lexBuffer.EnsureBufferSize n;
+                             Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n;
+                             lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n); 
+                  fillAsync = 
+                    match asyncRead with 
+                    | None -> None
+                    | Some read -> 
+                         Some (fun lexBuffer -> 
+                                  async { 
+                                      let! n = read(extension,0,extension.Length)
+                                      lexBuffer.EnsureBufferSize n;
+                                      Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n;
+                                      lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n }) }
+            new LexBuffer<_>(fillers)
+
+        // A full type signature is required on this method because it is used at more specific types within its own scope
+        static member FromFunction (f : 'char[] * int * int -> int) : LexBuffer<'char> =  LexBuffer<_>.FromReadFunctions(Some(f),None)
+        static member FromAsyncFunction (f : 'char[] * int * int -> Async<int>) : LexBuffer<'char> =  LexBuffer<_>.FromReadFunctions(None,Some(f))
+              
+        static member FromCharFunction f : LexBuffer<char> = 
+            LexBuffer<char>.FromFunction(fun (buff,start,len) -> 
+                let buff2 = Array.zeroCreate len
+                let n = f buff2 len 
+                Array.blit buff2 0 buff start len
+                n)
+        static member FromByteFunction f : LexBuffer<byte> = 
+            LexBuffer<byte>.FromFunction(fun (buff,start,len) -> 
+                let buff2 = Array.zeroCreate len
+                let n = f buff2 len 
+                Array.blit buff2 0 buff start len
+                n)
+
+        // A full type signature is required on this method because it is used at more specific types within its own scope
+        static member FromArray (s: 'char[]) : LexBuffer<'char> = 
+            let lexBuffer = 
+                new LexBuffer<_> 
+                    { fillSync = Some (fun _ -> ()); 
+                      fillAsync = Some (fun _ -> async { return () }) }
+            let buffer = Array.copy s 
+            lexBuffer.Buffer <- buffer;
+            lexBuffer.BufferMaxScanLength <- buffer.Length;
+            lexBuffer
+
+        static member FromBytes    (arr) = LexBuffer<byte>.FromArray(arr)
+        static member FromChars    (arr) = LexBuffer<char>.FromArray(arr) 
+        static member FromString (s:string) = LexBuffer<char>.FromChars (s.ToCharArray())
+
+        static member FromTextReader (tr:System.IO.TextReader)  : LexBuffer<char> = 
+           LexBuffer<char>.FromFunction(tr.Read) 
+
+        static member FromBinaryReader (br:System.IO.BinaryReader)  : LexBuffer<byte> = 
+           LexBuffer<byte>.FromFunction(br.Read) 
+
+        static member FromStream (stream:System.IO.Stream)  : LexBuffer<byte> = 
+           LexBuffer<byte>.FromReadFunctions(Some(stream.Read),Some(fun (buf,offset,len) -> stream.AsyncRead(buf,offset=offset,count=len))) 
+
+    module GenericImplFragments = 
+        let startInterpret(lexBuffer:LexBuffer<_>)= 
+            lexBuffer.BufferScanStart <- lexBuffer.BufferScanStart + lexBuffer.LexemeLength;
+            lexBuffer.BufferMaxScanLength <- lexBuffer.BufferMaxScanLength - lexBuffer.LexemeLength;
+            lexBuffer.BufferScanLength <- 0;
+            lexBuffer.LexemeLength <- 0;
+            lexBuffer.BufferAcceptAction <- -1;
+
+        let afterRefill (trans: uint16[] array,sentinel,lexBuffer:LexBuffer<_>,scanUntilSentinel,endOfScan,state,eofPos) = 
+            // end of file occurs if we couldn't extend the buffer 
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then  
+                let snew = int trans.[state].[eofPos] // == EOF 
+                if snew = sentinel then 
+                    endOfScan()
+                else 
+                    if lexBuffer.IsPastEndOfStream then failwith "End of file on lexing stream";
+                    lexBuffer.IsPastEndOfStream <- true;
+                    // Printf.printf "state %d --> %d on eof\n" state snew;
+                    scanUntilSentinel(lexBuffer,snew)
+            else 
+                scanUntilSentinel(lexBuffer, state)
+
+        let onAccept (lexBuffer:LexBuffer<_>,a) = 
+            lexBuffer.LexemeLength <- lexBuffer.BufferScanLength;
+            lexBuffer.BufferAcceptAction <- a;
+
+    open GenericImplFragments
+
+    [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+    type internal AsciiTables(trans: uint16[] array, accept: uint16[]) =
+#else
+    type AsciiTables(trans: uint16[] array, accept: uint16[]) =
+#endif
+        let rec scanUntilSentinel(lexBuffer, state) =
+            let sentinel = 255 * 256 + 255 
+            // Return an endOfScan after consuming the input 
+            let a = int accept.[state] 
+            if a <> sentinel then 
+                onAccept (lexBuffer,a)
+            
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                lexBuffer.DiscardInput();
+                lexBuffer.RefillBuffer ();
+              // end of file occurs if we couldn't extend the buffer 
+                afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,lexBuffer.EndOfScan,state,256 (* == EOF *) )
+            else
+                // read a character - end the scan if there are no further transitions 
+                let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos])
+                let snew = int trans.[state].[inp] 
+                if snew = sentinel then 
+                    lexBuffer.EndOfScan()
+                else 
+                    lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                    // Printf.printf "state %d --> %d on '%c' (%d)\n" state snew (Char.chr inp) inp;
+                    scanUntilSentinel(lexBuffer, snew)
+            
+        /// Interpret tables for an ascii lexer generated by fslex. 
+        member tables.Interpret(initialState,lexBuffer : LexBuffer<byte>) = 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        /// Interpret tables for an ascii lexer generated by fslex. 
+        member tables.AsyncInterpret(initialState,lexBuffer : LexBuffer<byte>) = 
+        
+            let rec scanUntilSentinel(lexBuffer,state) : Async<int> = 
+                async {  
+                    let sentinel = 255 * 256 + 255 
+                    // Return an endOfScan after consuming the input 
+                    let a = int accept.[state] 
+                    if a <> sentinel then 
+                        onAccept (lexBuffer,a)
+                    
+                    if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                        lexBuffer.DiscardInput();
+                        do! lexBuffer.AsyncRefillBuffer ();
+                       // end of file occurs if we couldn't extend the buffer 
+                        return! afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,endOfScan,state,256 (* == EOF *) )
+                    else
+                        // read a character - end the scan if there are no further transitions 
+                        let inp = int(lexBuffer.Buffer.[lexBuffer.BufferScanPos])
+                        let snew = int trans.[state].[inp] 
+                        if snew = sentinel then 
+                            return! endOfScan()
+                        else 
+                            lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                            return! scanUntilSentinel(lexBuffer,snew)
+                }
+            and endOfScan() = 
+                async { return lexBuffer.EndOfScan() }
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+
+        static member Create(trans,accept) = new AsciiTables(trans,accept)
+
+    [<Sealed>]
+#if INTERNALIZED_POWER_PACK
+    type internal UnicodeTables(trans: uint16[] array, accept: uint16[]) = 
+#else
+    type UnicodeTables(trans: uint16[] array, accept: uint16[]) = 
+#endif
+        let sentinel = 255 * 256 + 255 
+        let numUnicodeCategories = 30 
+        let numLowUnicodeChars = 128 
+        let numSpecificUnicodeChars = (trans.[0].Length - 1 - numLowUnicodeChars - numUnicodeCategories)/2
+        let lookupUnicodeCharacters (state,inp) = 
+            let inpAsInt = int inp
+            // Is it a fast ASCII character?
+            if inpAsInt < numLowUnicodeChars then 
+                int trans.[state].[inpAsInt]
+            else 
+                // Search for a specific unicode character
+                let baseForSpecificUnicodeChars = numLowUnicodeChars
+                let rec loop i = 
+                    if i >= numSpecificUnicodeChars then 
+                        // OK, if we failed then read the 'others' entry in the alphabet,
+                        // which covers all Unicode characters not covered in other
+                        // ways
+                        let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2
+                        let unicodeCategory = System.Char.GetUnicodeCategory(inp)
+                        //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]);
+                        int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory]
+                    else 
+                        // This is the specific unicode character
+                        let c = char (int trans.[state].[baseForSpecificUnicodeChars+i*2])
+                        //System.Console.WriteLine("c = {0}, inp = {1}, i = {2}", [| box c; box inp; box i |]);
+                        // OK, have we found the entry for a specific unicode character?
+                        if c = inp
+                        then int trans.[state].[baseForSpecificUnicodeChars+i*2+1]
+                        else loop(i+1)
+                
+                loop 0
+        let eofPos    = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories 
+        
+        let rec scanUntilSentinel(lexBuffer,state) =
+            // Return an endOfScan after consuming the input 
+            let a = int accept.[state] 
+            if a <> sentinel then 
+                onAccept(lexBuffer,a)
+            
+            if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                lexBuffer.DiscardInput();
+                lexBuffer.RefillBuffer ();
+              // end of file occurs if we couldn't extend the buffer 
+                afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,lexBuffer.EndOfScan,state,eofPos)
+            else
+                // read a character - end the scan if there are no further transitions 
+                let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos]
+                
+                // Find the new state
+                let snew = lookupUnicodeCharacters (state,inp)
+
+                if snew = sentinel then 
+                    lexBuffer.EndOfScan()
+                else 
+                    lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                    // Printf.printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp;
+                    scanUntilSentinel(lexBuffer,snew)
+                          
+        // Each row for the Unicode table has format 
+        //      128 entries for ASCII characters
+        //      A variable number of 2*UInt16 entries for SpecificUnicodeChars 
+        //      30 entries, one for each UnicodeCategory
+        //      1 entry for EOF
+
+        member tables.Interpret(initialState,lexBuffer : LexBuffer<char>) = 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        member tables.AsyncInterpret(initialState,lexBuffer : LexBuffer<char>) = 
+
+            let rec scanUntilSentinel(lexBuffer, state) =
+                async {
+                    // Return an endOfScan after consuming the input 
+                    let a = int accept.[state] 
+                    if a <> sentinel then 
+                        onAccept(lexBuffer,a)
+                    
+                    if lexBuffer.BufferScanLength = lexBuffer.BufferMaxScanLength then 
+                        lexBuffer.DiscardInput();
+                        lexBuffer.RefillBuffer ();
+                        // end of file occurs if we couldn't extend the buffer 
+                        return! afterRefill (trans,sentinel,lexBuffer,scanUntilSentinel,endOfScan,state,eofPos)
+                    else
+                        // read a character - end the scan if there are no further transitions 
+                        let inp = lexBuffer.Buffer.[lexBuffer.BufferScanPos]
+                        
+                        // Find the new state
+                        let snew = lookupUnicodeCharacters (state,inp)
+
+                        if snew = sentinel then 
+                            return! endOfScan()
+                        else 
+                            lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
+                            return! scanUntilSentinel(lexBuffer, snew)
+                }
+            and endOfScan() = 
+                async { return lexBuffer.EndOfScan() } 
+            startInterpret(lexBuffer)
+            scanUntilSentinel(lexBuffer, initialState)
+
+        static member Create(trans,accept) = new UnicodeTables(trans,accept)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fsi
new file mode 100644
index 0000000..6ed3eaa
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-lexing.fsi
@@ -0,0 +1,151 @@
+//==========================================================================
+// LexBuffers are for use with automatically generated lexical analyzers,
+// in particular those produced by 'fslex'.
+//
+// (c) Microsoft Corporation 2005-2008.
+//===========================================================================
+
+#if INTERNALIZED_POWER_PACK
+namespace Internal.Utilities.Text.Lexing
+#else
+namespace Microsoft.FSharp.Text.Lexing 
+#endif
+
+open System.Collections.Generic
+
+/// Position information stored for lexing tokens
+//
+// Note: this is an OCaml compat record type. 
+#if INTERNALIZED_POWER_PACK
+type internal Position = 
+#else
+type Position = 
+#endif
+    { /// The file name for the position
+      pos_fname: string;
+      /// The line number for the position
+      pos_lnum: int;
+#if INTERNALIZED_POWER_PACK
+      /// The line number for the position in the original source file
+      pos_orig_lnum : int;
+#endif
+      /// The absolute offset of the beginning of the line
+      pos_bol: int;
+      /// The absolute offset of the column for the position
+      pos_cnum: int; }
+     /// The file name associated with the input stream.
+     member FileName : string
+     /// The line number in the input stream, assuming fresh positions have been updated 
+     /// using AsNewLinePos() and by modifying the EndPos property of the LexBuffer.
+     member Line : int
+#if INTERNALIZED_POWER_PACK
+     /// The line number for the position in the input stream, assuming fresh positions have been updated 
+     /// using AsNewLinePos()
+     member OriginalLine : int
+#endif
+     [<System.ObsoleteAttribute("Use the AbsoluteOffset property instead")>]
+     member Char : int
+     /// The character number in the input stream
+     member AbsoluteOffset : int
+     /// Return absolute offset of the start of the line marked by the position
+     member StartOfLineAbsoluteOffset : int
+     /// Return the column number marked by the position, i.e. the difference between the AbsoluteOffset and the StartOfLineAbsoluteOffset
+     member Column : int
+     // Given a position just beyond the end of a line, return a position at the start of the next line
+     member NextLine : Position     
+     
+     /// Given a position at the start of a token of length n, return a position just beyond the end of the token
+     member EndOfToken: n:int -> Position
+     /// Gives a position shifted by specified number of characters
+     member ShiftColumnBy: by:int -> Position
+     
+     [<System.ObsoleteAttribute("Consider using the NextLine property instead")>]
+     member AsNewLinePos : unit -> Position
+     
+     /// Get an arbitrary position, with the empty string as filename, and  
+     static member Empty : Position
+
+     /// Get a position corresponding to the first line (line number 1) in a given file
+     static member FirstLine : filename:string -> Position
+    
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal LexBuffer<'char> =
+#else
+/// Input buffers consumed by lexers generated by <c>fslex.exe </c>
+type LexBuffer<'char> =
+#endif
+    /// The start position for the lexeme
+    member StartPos: Position with get,set
+    /// The end position for the lexeme
+    member EndPos: Position with get,set
+    /// The matched string 
+    member Lexeme: 'char array
+    
+    /// Fast helper to turn the matched characters into a string, avoiding an intermediate array
+    static member LexemeString : LexBuffer<char> -> string
+    
+    /// The length of the matched string 
+    member LexemeLength: int
+    /// Fetch a particular character in the matched string 
+    member LexemeChar: int -> 'char
+
+    /// Dynamically typed, non-lexically scoped parameter table
+    member BufferLocalStore : IDictionary<string,obj>
+    
+    /// True if the refill of the buffer ever failed , or if explicitly set to true.
+    member IsPastEndOfStream: bool with get,set
+    /// Remove all input, though don't discard the current lexeme 
+    member DiscardInput: unit -> unit
+
+    /// Create a lex buffer suitable for byte lexing that reads characters from the given array
+    static member FromBytes: byte[] -> LexBuffer<byte>
+    /// Create a lex buffer suitable for Unicode lexing that reads characters from the given array
+    static member FromChars: char[] -> LexBuffer<char>
+    /// Create a lex buffer suitable for Unicode lexing that reads characters from the given string
+    static member FromString: string -> LexBuffer<char>
+    /// Create a lex buffer that reads character or byte inputs by using the given function
+    static member FromFunction: ('char[] * int * int -> int) -> LexBuffer<'char>
+    /// Create a lex buffer that asynchronously reads character or byte inputs by using the given function
+    static member FromAsyncFunction: ('char[] * int * int -> Async<int>) -> LexBuffer<'char>
+
+
+    [<System.Obsolete("Use LexBuffer<char>.FromFunction instead")>]
+    static member FromCharFunction: (char[] -> int -> int) -> LexBuffer<char>
+    [<System.Obsolete("Use LexBuffer<byte>.FromFunction instead")>]
+    static member FromByteFunction: (byte[] -> int -> int) -> LexBuffer<byte>
+
+    /// Create a lex buffer suitable for use with a Unicode lexer that reads character inputs from the given text reader
+    static member FromTextReader: System.IO.TextReader -> LexBuffer<char>
+    /// Create a lex buffer suitable for use with ASCII byte lexing that reads byte inputs from the given binary reader
+    static member FromBinaryReader: System.IO.BinaryReader -> LexBuffer<byte>
+
+
+/// The type of tables for an ascii lexer generated by fslex. 
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal AsciiTables =
+#else
+type AsciiTables =
+#endif
+    static member Create : uint16[] array * uint16[] -> AsciiTables
+    /// Interpret tables for an ascii lexer generated by fslex. 
+    member Interpret:  initialState:int * LexBuffer<byte>  -> int
+    /// Interpret tables for an ascii lexer generated by fslex, processing input asynchronously
+    member AsyncInterpret:  initialState:int * LexBuffer<byte> -> Async<int>
+
+
+/// The type of tables for an unicode lexer generated by fslex. 
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal UnicodeTables =
+#else
+type UnicodeTables =
+#endif
+    static member Create : uint16[] array * uint16[] -> UnicodeTables
+    /// Interpret tables for a unicode lexer generated by fslex. 
+    member Interpret:  initialState:int * LexBuffer<char> -> int
+
+    /// Interpret tables for a unicode lexer generated by fslex, processing input asynchronously
+    member AsyncInterpret:  initialState:int * LexBuffer<char> -> Async<int>
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fs
new file mode 100644
index 0000000..0ee0c51
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fs
@@ -0,0 +1,513 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+#if INTERNALIZED_POWER_PACK
+
+namespace  Internal.Utilities.Text.Parsing
+open Internal.Utilities
+open Internal.Utilities.Text.Lexing
+
+#else
+namespace Microsoft.FSharp.Text.Parsing
+open Microsoft.FSharp.Text.Lexing
+#endif
+
+
+
+open System
+open System.Collections.Generic
+
+#if INTERNALIZED_POWER_PACK
+type internal IParseState = 
+#else
+type IParseState = 
+#endif
+    abstract InputRange: int -> Position * Position
+    abstract InputEndPosition: int -> Position 
+    abstract InputStartPosition: int -> Position 
+    abstract ResultRange: Position * Position
+    abstract GetInput: int -> obj 
+    abstract ParserLocalStore : IDictionary<string,obj>
+    abstract RaiseError<'b> : unit -> 'b 
+
+//-------------------------------------------------------------------------
+// This context is passed to the error reporter when a syntax error occurs
+
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal ParseErrorContext<'tok>
+#else
+type ParseErrorContext<'tok>
+#endif
+         (//lexbuf: LexBuffer<_>,
+          stateStack:int list,
+          parseState: IParseState, 
+          reduceTokens: int list, 
+          currentToken: 'tok option, 
+          reducibleProductions: int list list, 
+          shiftableTokens: int list , 
+          message : string) =
+      //member x.LexBuffer = lexbuf
+      member x.StateStack  = stateStack
+      member x.ReduceTokens = reduceTokens
+      member x.CurrentToken = currentToken
+      member x.ParseState = parseState
+      member x.ReducibleProductions = reducibleProductions
+      member x.ShiftTokens = shiftableTokens
+      member x.Message = message
+
+
+//-------------------------------------------------------------------------
+// This is the data structure emitted as code by FSYACC.  
+
+#if INTERNALIZED_POWER_PACK
+type internal Tables<'tok> = 
+#else
+type Tables<'tok> = 
+#endif
+    { reductions: (IParseState -> obj) array;
+      endOfInputTag: int;
+      tagOfToken: 'tok -> int;
+      dataOfToken: 'tok -> obj; 
+      actionTableElements: uint16[];  
+      actionTableRowOffsets: uint16[];
+      reductionSymbolCounts: uint16[];
+      immediateActions: uint16[];
+      gotos: uint16[];
+      sparseGotoTableRowOffsets: uint16[];
+      stateToProdIdxsTableElements: uint16[];  
+      stateToProdIdxsTableRowOffsets: uint16[];  
+      productionToNonTerminalTable: uint16[];
+      /// For fsyacc.exe, this entry is filled in by context from the generated parser file. If no 'parse_error' function
+      /// is defined by the user then ParseHelpers.parse_error is used by default (ParseHelpers is opened
+      /// at the top of the generated parser file)
+      parseError:  ParseErrorContext<'tok> -> unit;
+      numTerminals: int;
+      tagOfErrorTerminal: int }
+
+//-------------------------------------------------------------------------
+// An implementation of stacks.
+
+// This type is in System.dll so for the moment we can't use it in FSharp.Core.dll
+//type Stack<'a> = System.Collections.Generic.Stack<'a>
+
+#if INTERNALIZED_POWER_PACK
+type Stack<'a>(n)  = 
+#else
+type internal Stack<'a>(n)  = 
+#endif
+    let mutable contents = Array.zeroCreate<'a>(n)
+    let mutable count = 0
+
+    member buf.Ensure newSize = 
+        let oldSize = Array.length contents
+        if newSize > oldSize then 
+            let old = contents
+            contents <- Array.zeroCreate (max newSize (oldSize * 2));
+            Array.blit old 0 contents 0 count;
+    
+    member buf.Count = count
+    member buf.Pop() = count <- count - 1
+    member buf.Peep() = contents.[count - 1]
+    member buf.Top(n) = [ for x in contents.[max 0 (count-n)..count - 1] -> x ] |> List.rev
+    member buf.Push(x) =
+        buf.Ensure(count + 1); 
+        contents.[count] <- x; 
+        count <- count + 1
+        
+    member buf.IsEmpty = (count = 0)
+    member buf.PrintStack() = 
+        for i = 0 to (count - 1) do 
+            System.Console.Write("{0}{1}",(contents.[i]),if i=count-1 then ":" else "-") 
+          
+exception RecoverableParseError
+exception Accept of obj
+
+#if DEBUG
+module Flags = 
+    let mutable debug = false
+#endif
+
+#if INTERNALIZED_POWER_PACK
+module internal Implementation = 
+#else
+module Implementation = 
+#endif
+    
+    // Definitions shared with fsyacc 
+    let anyMarker = 0xffff
+    let shiftFlag = 0x0000
+    let reduceFlag = 0x4000
+    let errorFlag = 0x8000
+    let acceptFlag = 0xc000
+    let actionMask = 0xc000
+
+    let actionValue action = action &&& (~~~ actionMask)                                    
+    let actionKind action = action &&& actionMask
+    
+    //-------------------------------------------------------------------------
+    // Read the tables written by FSYACC.  
+
+    type AssocTable(elemTab:uint16[], offsetTab:uint16[]) =
+        let cache = new Dictionary<_,_>(2000)
+
+        member t.readAssoc (minElemNum,maxElemNum,defaultValueOfAssoc,keyToFind) =     
+            // do a binary chop on the table 
+            let elemNumber : int = (minElemNum+maxElemNum)/2
+            if elemNumber = maxElemNum 
+            then defaultValueOfAssoc
+            else 
+                let x = int elemTab.[elemNumber*2]
+                if keyToFind = x then 
+                    int elemTab.[elemNumber*2+1]
+                elif keyToFind < x then t.readAssoc (minElemNum ,elemNumber,defaultValueOfAssoc,keyToFind)
+                else                    t.readAssoc (elemNumber+1,maxElemNum,defaultValueOfAssoc,keyToFind)
+
+        member t.Read(rowNumber ,keyToFind) =
+        
+            // First check the sparse lookaside table
+            // Performance note: without this lookaside table the binary chop in readAssoc
+            // takes up around 10% of of parsing time 
+            // for parsing intensive samples such as the bootstrapped F# compiler.
+            //
+            // Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal.
+            // Some other better sparse lookup table may be better.
+            let mutable res = 0 
+            let cacheKey = (rowNumber <<< 16) ||| keyToFind
+            let ok = cache.TryGetValue(cacheKey, &res) 
+            if ok then res 
+            else
+                let headOfTable = int offsetTab.[rowNumber]
+                let firstElemNumber = headOfTable + 1           
+                let numberOfElementsInAssoc = int elemTab.[headOfTable*2]
+                let defaultValueOfAssoc = int elemTab.[headOfTable*2+1]          
+                let res = t.readAssoc (firstElemNumber,(firstElemNumber+numberOfElementsInAssoc),defaultValueOfAssoc,keyToFind)
+                cache.[cacheKey] <- res
+                res
+
+        // Read all entries in the association table
+        // Used during error recovery to find all valid entries in the table
+        member x.ReadAll(n) =       
+            let headOfTable = int offsetTab.[n]
+            let firstElemNumber = headOfTable + 1           
+            let numberOfElementsInAssoc = int32 elemTab.[headOfTable*2]           
+            let defaultValueOfAssoc = int elemTab.[headOfTable*2+1]          
+            [ for i in firstElemNumber .. (firstElemNumber+numberOfElementsInAssoc-1) -> 
+                (int elemTab.[i*2], int elemTab.[i*2+1]) ], defaultValueOfAssoc
+
+    type IdxToIdxListTable(elemTab:uint16[], offsetTab:uint16[]) =
+
+        // Read all entries in a row of the table
+        member x.ReadAll(n) =       
+            let headOfTable = int offsetTab.[n]
+            let firstElemNumber = headOfTable + 1           
+            let numberOfElements = int32 elemTab.[headOfTable]           
+            [ for i in firstElemNumber .. (firstElemNumber+numberOfElements-1) -> int elemTab.[i] ]
+
+    //-------------------------------------------------------------------------
+    // interpret the tables emitted by FSYACC.  
+
+    [<NoEquality; NoComparison>]
+    [<Struct>]
+    type ValueInfo = 
+        val value: obj
+        val startPos: Position
+        val endPos: Position
+        new(value,startPos,endPos) = { value=value; startPos=startPos;endPos=endPos }
+
+    let interpret (tables: Tables<'tok>) lexer (lexbuf : LexBuffer<_>) initialState =                                                                      
+        let localStore = new Dictionary<string,obj>() in
+        localStore.["LexBuffer"] <- lexbuf;
+#if DEBUG
+        if Flags.debug then System.Console.WriteLine("\nParser: interpret tables");
+#endif
+        let stateStack : Stack<int> = new Stack<_>(100)
+        stateStack.Push(initialState);
+        let valueStack = new Stack<ValueInfo>(100)
+        let mutable haveLookahead = false                                                                              
+        let mutable lookaheadToken = Unchecked.defaultof<'tok>
+        let mutable lookaheadEndPos = Unchecked.defaultof<Position>
+        let mutable lookaheadStartPos = Unchecked.defaultof<Position>
+        let mutable finished = false
+        // After an error occurs, we suppress errors until we've shifted three tokens in a row.
+        let mutable errorSuppressionCountDown = 0
+        
+        // When we hit the end-of-file we don't fail straight away but rather keep permitting shift
+        // and reduce against the last token in the token stream 20 times or until we've accepted
+        // or exhausted the stack. This allows error recovery rules of the form
+        //      input : realInput EOF | realInput error EOF | error EOF
+        // where consuming one EOF to trigger an error doesn't result in overall parse failure 
+        // catastrophe and the loss of intermediate results.
+        //
+        let mutable inEofCountDown = false
+        let mutable eofCountDown = 20 // Number of EOFs to supply at the end for error recovery
+        // The 100 here means a maximum of 100 elements for each rule
+        let ruleStartPoss = (Array.zeroCreate 100 : Position array)              
+        let ruleEndPoss   = (Array.zeroCreate 100 : Position array)              
+        let ruleValues    = (Array.zeroCreate 100 : obj array)              
+        let lhsPos        = (Array.zeroCreate 2 : Position array)                                            
+        let reductions = tables.reductions
+        let actionTable = new AssocTable(tables.actionTableElements, tables.actionTableRowOffsets)
+        let gotoTable = new AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets)
+        let stateToProdIdxsTable = new IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets)
+
+        let parseState =                                                                                            
+            { new IParseState with 
+                member p.InputRange(n) = ruleStartPoss.[n-1], ruleEndPoss.[n-1]; 
+                member p.InputStartPosition(n) = ruleStartPoss.[n-1]
+                member p.InputEndPosition(n) = ruleEndPoss.[n-1]; 
+                member p.GetInput(n)    = ruleValues.[n-1];        
+                member p.ResultRange    = (lhsPos.[0], lhsPos.[1]);  
+                member p.ParserLocalStore = (localStore :> IDictionary<_,_>); 
+                member p.RaiseError()  = raise RecoverableParseError  (* NOTE: this binding tests the fairly complex logic associated with an object expression implementing a generic abstract method *)
+            }       
+
+#if DEBUG
+        let report haveLookahead lookaheadToken = 
+            if haveLookahead then sprintf "%A" lookaheadToken 
+            else "[TBC]"
+#endif
+
+        // Pop the stack until we can shift the 'error' token. If 'tokenOpt' is given
+        // then keep popping until we can shift both the 'error' token and the token in 'tokenOpt'.
+        // This is used at end-of-file to make sure we can shift both the 'error' token and the 'EOF' token.
+        let rec popStackUntilErrorShifted(tokenOpt) =
+            // Keep popping the stack until the "error" terminal is shifted
+#if DEBUG
+            if Flags.debug then System.Console.WriteLine("popStackUntilErrorShifted");
+#endif
+            if stateStack.IsEmpty then 
+#if DEBUG
+                if Flags.debug then 
+                    System.Console.WriteLine("state stack empty during error recovery - generating parse error");
+#endif
+                failwith "parse error";
+            
+            let currState = stateStack.Peep()
+#if DEBUG
+            if Flags.debug then 
+                System.Console.WriteLine("In state {0} during error recovery", currState);
+#endif
+            
+            let action = actionTable.Read(currState, tables.tagOfErrorTerminal)
+            
+            if actionKind action = shiftFlag &&  
+                (match tokenOpt with 
+                 | None -> true
+                 | Some(token) -> 
+                    let nextState = actionValue action 
+                    actionKind (actionTable.Read(nextState, tables.tagOfToken(token))) = shiftFlag) then
+
+#if DEBUG
+                if Flags.debug then System.Console.WriteLine("shifting error, continuing with error recovery");
+#endif
+                let nextState = actionValue action 
+                // The "error" non terminal needs position information, though it tends to be unreliable.
+                // Use the StartPos/EndPos from the lex buffer
+                valueStack.Push(ValueInfo(box (), lexbuf.StartPos, lexbuf.EndPos));
+                stateStack.Push(nextState)
+            else
+                if valueStack.IsEmpty then 
+                    failwith "parse error";
+#if DEBUG
+                if Flags.debug then 
+                    System.Console.WriteLine("popping stack during error recovery");
+#endif
+                valueStack.Pop();
+                stateStack.Pop();
+                popStackUntilErrorShifted(tokenOpt)
+
+        while not finished do                                                                                    
+            if stateStack.IsEmpty then 
+                finished <- true
+            else
+                let state = stateStack.Peep()
+#if DEBUG
+                if Flags.debug then (Console.Write("{0} value(state), state ",valueStack.Count); stateStack.PrintStack())
+#endif
+                let action = 
+                    let immediateAction = int tables.immediateActions.[state]
+                    if not (immediateAction = anyMarker) then
+                        // Action has been pre-determined, no need to lookahead 
+                        // Expecting it to be a Reduce action on a non-fakeStartNonTerminal ? 
+                        immediateAction
+                    else
+                        // Lookahead required to determine action 
+                        if not haveLookahead then 
+                            if lexbuf.IsPastEndOfStream then 
+                                // When the input runs out, keep supplying the last token for eofCountDown times
+                                if eofCountDown>0 then
+                                    haveLookahead <- true
+                                    eofCountDown <- eofCountDown - 1
+                                    inEofCountDown <- true
+                                else 
+                                    haveLookahead <- false
+                            else 
+                                lookaheadToken <- lexer lexbuf
+                                lookaheadStartPos <- lexbuf.StartPos
+                                lookaheadEndPos <- lexbuf.EndPos
+                                haveLookahead <- true;
+
+                        let tag = 
+                            if haveLookahead then tables.tagOfToken lookaheadToken 
+                            else tables.endOfInputTag   
+                                    
+                        // Printf.printf "state %d\n" state  
+                        actionTable.Read(state,tag)
+                        
+                let kind = actionKind action 
+                if kind = shiftFlag then (
+                    if errorSuppressionCountDown > 0 then 
+                        errorSuppressionCountDown <- errorSuppressionCountDown - 1;
+#if DEBUG
+                        if Flags.debug then Console.WriteLine("shifting, reduced errorRecoverylevel to {0}\n", errorSuppressionCountDown);
+#endif
+                    let nextState = actionValue action                                     
+                    if not haveLookahead then failwith "shift on end of input!";
+                    let data = tables.dataOfToken lookaheadToken
+                    valueStack.Push(ValueInfo(data, lookaheadStartPos, lookaheadEndPos));
+                    stateStack.Push(nextState);                                                                
+#if DEBUG
+                    if Flags.debug then Console.WriteLine("shift/consume input {0}, shift to state {1}", report haveLookahead lookaheadToken, nextState);
+#endif
+                    haveLookahead <- false
+
+                ) elif kind = reduceFlag then
+                    let prod = actionValue action                                     
+                    let reduction = reductions.[prod]                                                             
+                    let n = int tables.reductionSymbolCounts.[prod]
+                       // pop the symbols, populate the values and populate the locations                              
+#if DEBUG
+                    if Flags.debug then Console.Write("reduce popping {0} values/states, lookahead {1}", n, report haveLookahead lookaheadToken);
+#endif
+                    for i = 0 to n - 1 do                                                                             
+                        if valueStack.IsEmpty then failwith "empty symbol stack";
+                        let topVal = valueStack.Peep()
+                        valueStack.Pop();
+                        stateStack.Pop();
+                        ruleValues.[(n-i)-1] <- topVal.value;  
+                        ruleStartPoss.[(n-i)-1] <- topVal.startPos;  
+                        ruleEndPoss.[(n-i)-1] <- topVal.endPos;  
+                        if i = 0 then lhsPos.[1] <- topVal.endPos;                                     
+                        if i = n - 1 then lhsPos.[0] <- topVal.startPos
+                    done;                                                                                             
+                    // Use the lookahead token to populate the locations if the rhs is empty                        
+                    if n = 0 then 
+                        if haveLookahead then 
+                           lhsPos.[0] <- lookaheadStartPos;                                                                     
+                           lhsPos.[1] <- lookaheadEndPos;                                                                       
+                        else 
+                           lhsPos.[0] <- lexbuf.StartPos;
+                           lhsPos.[1] <- lexbuf.EndPos;
+                    try                                                                                               
+                          // Printf.printf "reduce %d\n" prod;                                                       
+                        let redResult = reduction parseState                                                          
+                        valueStack.Push(ValueInfo(redResult, lhsPos.[0], lhsPos.[1]));
+                        let currState = stateStack.Peep()
+                        let newGotoState = gotoTable.Read(int tables.productionToNonTerminalTable.[prod], currState)
+                        stateStack.Push(newGotoState)
+#if DEBUG
+                        if Flags.debug then Console.WriteLine(" goto state {0}", newGotoState)
+#endif
+                    with                                                                                              
+                    | Accept res ->                                                                            
+                          finished <- true;                                                                             
+                          valueStack.Push(ValueInfo(res, lhsPos.[0], lhsPos.[1])) 
+                    | RecoverableParseError ->
+#if DEBUG
+                          if Flags.debug then Console.WriteLine("RecoverableParseErrorException...\n");
+#endif
+                          popStackUntilErrorShifted(None);
+                          // User code raised a Parse_error. Don't report errors again until three tokens have been shifted 
+                          errorSuppressionCountDown <- 3
+                elif kind = errorFlag then (
+#if DEBUG
+                    if Flags.debug then Console.Write("ErrorFlag... ");
+#endif
+                    // Silently discard inputs and don't report errors 
+                    // until three tokens in a row have been shifted 
+#if DEBUG
+                    if Flags.debug then printfn "error on token '%A' " (if haveLookahead then Some(lookaheadToken) else None);
+#endif
+                    if errorSuppressionCountDown > 0 then 
+                        // If we're in the end-of-file count down then we're very keen to 'Accept'.
+                        // We can only do this by repeatedly popping the stack until we can shift both an 'error' token
+                        // and an EOF token. 
+                        if inEofCountDown && eofCountDown < 10 then 
+#if DEBUG
+                            if Flags.debug then printfn "poppin stack, lokking to shift both 'error' and that token, during end-of-file error recovery" ;
+#endif
+                            popStackUntilErrorShifted(if haveLookahead then Some(lookaheadToken) else None);
+
+                        // If we don't haveLookahead then the end-of-file count down is over and we have no further options.
+                        if not haveLookahead then 
+                            failwith "parse error: unexpected end of file"
+                            
+#if DEBUG
+                        if Flags.debug then printfn "discarding token '%A' during error suppression" (if haveLookahead then Some(lookaheadToken) else None);
+#endif
+                        // Discard the token
+                        haveLookahead <- false
+                        // Try again to shift three tokens
+                        errorSuppressionCountDown <- 3
+                    else (
+
+                        let currentToken = if haveLookahead then Some(lookaheadToken) else None
+                        let actions,defaultAction = actionTable.ReadAll(state) 
+                        let explicit = Set.ofList [ for (tag,_action) in actions -> tag ]
+                        
+                        let shiftableTokens = 
+                           [ for (tag,action) in actions do
+                                 if (actionKind action) = shiftFlag then 
+                                     yield tag
+                             if actionKind defaultAction = shiftFlag  then
+                                 for tag in 0 .. tables.numTerminals-1 do  
+                                    if not (explicit.Contains(tag)) then 
+                                         yield tag ] in
+
+                        let stateStack = stateStack.Top(12) in
+                        let reducibleProductions = 
+                            [ for state in stateStack do 
+                               yield stateToProdIdxsTable.ReadAll(state)  ]
+
+                        let reduceTokens = 
+                           [ for (tag,action) in actions do
+                                if actionKind(action) = reduceFlag then
+                                    yield tag
+                             if actionKind(defaultAction) = reduceFlag  then
+                                 for tag in 0 .. tables.numTerminals-1 do  
+                                    if not (explicit.Contains(tag)) then 
+                                         yield tag ] in
+                        //let activeRules = stateStack |> List.iter (fun state -> 
+                        let errorContext = new ParseErrorContext<'tok>(stateStack,parseState, reduceTokens,currentToken,reducibleProductions, shiftableTokens, "syntax error")
+                        tables.parseError(errorContext);
+                        popStackUntilErrorShifted(None);
+                        errorSuppressionCountDown <- 3;
+#if DEBUG
+                        if Flags.debug then System.Console.WriteLine("generated syntax error and shifted error token, haveLookahead = {0}\n", haveLookahead);
+#endif
+                    )
+                ) elif kind = acceptFlag then 
+                    finished <- true
+#if DEBUG
+                else
+                  if Flags.debug then System.Console.WriteLine("ALARM!!! drop through case in parser");  
+#endif
+        done;                                                                                                     
+        // OK, we're done - read off the overall generated value
+        valueStack.Peep().value
+
+#if INTERNALIZED_POWER_PACK
+type internal Tables<'tok> with
+#else
+type Tables<'tok> with
+#endif
+    member tables.Interpret (lexer,lexbuf,initialState) = 
+        Implementation.interpret tables lexer lexbuf initialState
+    
+#if INTERNALIZED_POWER_PACK
+module internal ParseHelpers = 
+#else
+module ParseHelpers = 
+#endif
+    let parse_error (_s:string) = ()
+    let parse_error_rich = (None : (ParseErrorContext<_> -> unit) option)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fsi
new file mode 100644
index 0000000..d28dc0f
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/prim-parsing.fsi
@@ -0,0 +1,130 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2009.
+//=========================================================================
+
+#if INTERNALIZED_POWER_PACK
+namespace Internal.Utilities.Text.Parsing
+open Internal.Utilities
+open Internal.Utilities.Text.Lexing
+#else
+namespace Microsoft.FSharp.Text.Parsing
+open Microsoft.FSharp.Text.Lexing
+#endif
+
+open System.Collections.Generic
+
+#if INTERNALIZED_POWER_PACK
+type internal IParseState = 
+#else
+/// The information accessible via the <c>parseState</c> value within parser actions.
+type IParseState = 
+#endif
+    /// Get the start and end position for the terminal or non-terminal at a given index matched by the production
+    abstract InputRange: index:int -> Position * Position
+    /// Get the end position for the terminal or non-terminal at a given index matched by the production
+    abstract InputEndPosition: int -> Position 
+    /// Get the start position for the terminal or non-terminal at a given index matched by the production
+    abstract InputStartPosition: int -> Position 
+    /// Get the full range of positions matched by the production
+    abstract ResultRange: Position * Position
+    /// Get the value produced by the terminal or non-terminal at the given position
+    abstract GetInput   : int -> obj 
+    /// Get the store of local values associated with this parser
+    // Dynamically typed, non-lexically scoped local store
+    abstract ParserLocalStore : IDictionary<string,obj>
+    /// Raise an error in this parse context
+    abstract RaiseError<'b> : unit -> 'b 
+
+
+[<Sealed>]
+#if INTERNALIZED_POWER_PACK
+type internal ParseErrorContext<'tok> =
+#else
+/// The context provided when a parse error occurs
+type ParseErrorContext<'tok> =
+#endif
+      /// The stack of state indexes active at the parse error 
+      member StateStack  : int list
+      /// The state active at the parse error 
+      member ParseState : IParseState
+      /// The tokens that would cause a reduction at the parse error 
+      member ReduceTokens: int list
+      /// The stack of productions that would be reduced at the parse error 
+      member ReducibleProductions : int list list
+      /// The token that caused the parse error
+      member CurrentToken : 'tok option
+      /// The token that would cause a shift at the parse error
+      member ShiftTokens : int list
+      /// The message associated with the parse error
+      member Message : string
+
+/// Tables generated by fsyacc
+#if INTERNALIZED_POWER_PACK
+type internal Tables<'tok> = 
+#else
+/// The type of the tables contained in a file produced by the fsyacc.exe parser generator.
+type Tables<'tok> = 
+#endif
+    { /// The reduction table
+      reductions: (IParseState -> obj) array ;
+      /// The token number indicating the end of input
+      endOfInputTag: int;
+      /// A function to compute the tag of a token
+      tagOfToken: 'tok -> int;
+      /// A function to compute the data carried by a token
+      dataOfToken: 'tok -> obj; 
+      /// The sparse action table elements
+      actionTableElements: uint16[];
+      /// The sparse action table row offsets
+      actionTableRowOffsets: uint16[];
+      /// The number of symbols for each reduction
+      reductionSymbolCounts: uint16[];
+      /// The immediate action table
+      immediateActions: uint16[];      
+      /// The sparse goto table
+      gotos: uint16[];
+      /// The sparse goto table row offsets
+      sparseGotoTableRowOffsets: uint16[];
+      /// The sparse table for the productions active for each state
+      stateToProdIdxsTableElements: uint16[];  
+      /// The sparse table offsets for the productions active for each state
+      stateToProdIdxsTableRowOffsets: uint16[];  
+      /// This table is logically part of the Goto table
+      productionToNonTerminalTable: uint16[];
+      /// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions
+      parseError:  ParseErrorContext<'tok> -> unit;
+      /// The total number of terminals 
+      numTerminals: int;
+      /// The tag of the error terminal
+      tagOfErrorTerminal: int }
+
+    /// Interpret the parser table taking input from the given lexer, using the given lex buffer, and the given start state.
+    /// Returns an object indicating the final synthesized value for the parse.
+    member Interpret :  lexer:(LexBuffer<'char> -> 'tok) * lexbuf:LexBuffer<'char> * startState:int -> obj 
+
+#if INTERNALIZED_POWER_PACK
+exception internal Accept of obj
+exception internal RecoverableParseError
+#else
+/// Indicates an accept action has occured
+exception Accept of obj
+/// Indicates a parse error has occured and parse recovery is in progress
+exception RecoverableParseError
+#endif
+
+#if DEBUG
+module internal Flags =
+  val mutable debug : bool
+#endif
+
+#if INTERNALIZED_POWER_PACK
+module internal ParseHelpers = 
+#else
+/// Helpers used by generated parsers.
+module ParseHelpers = 
+#endif
+   /// The default implementation of the parse_error_rich function
+   val parse_error_rich: (ParseErrorContext<'tok> -> unit) option
+   /// The default implementation of the parse_error function
+   val parse_error: string -> unit
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fs
new file mode 100644
index 0000000..9c94841
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fs
@@ -0,0 +1,17 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008. The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.
+//===========================================================================
+
+module Microsoft.FSharp.Compatibility.OCaml.Printexc
+
+
+let to_string (e:exn) = 
+  match e with 
+  | Failure s -> s
+  | :? System.ArgumentException as e -> sprintf "invalid argument: %s" e.Message
+  | MatchFailureException(s,n,m) -> sprintf "match failure, file '%s', line %d, column %d" s n m
+  | _ -> sprintf "%A\n" e
+
+let print f x = try f x with e -> stderr.WriteLine (to_string e) ; raise e 
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fsi
new file mode 100644
index 0000000..af1865c
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/printexc.fsi
@@ -0,0 +1,15 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Compatibility module to display data about exceptions.
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Printexc
+
+val print: mapping:('a -> 'b) -> 'a -> 'b
+val to_string: exn -> string
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fs
new file mode 100644
index 0000000..07428cf
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fs
@@ -0,0 +1,319 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Collections
+
+open Microsoft.FSharp.Core.OptimizedClosures
+
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module ResizeArray =
+
+    let length (arr: ResizeArray<'T>) =  arr.Count
+    let get (arr: ResizeArray<'T>) (n: int) =  arr.[n]
+    let set (arr: ResizeArray<'T>) (n: int) (x:'T) =  arr.[n] <- x
+    let create  (n: int) x = new ResizeArray<_> (seq { for _ in 1 .. n -> x })
+    let init (n: int) (f: int -> 'T) =  new ResizeArray<_> (seq { for i in 0 .. n-1 -> f i })
+
+    let blit (arr1: ResizeArray<'T>) start1 (arr2: ResizeArray<'T>) start2 len =
+        if start1 < 0 then invalidArg "start1" "index must be positive"
+        if start2 < 0 then invalidArg "start2" "index must be positive"
+        if len < 0 then invalidArg "len" "length must be positive"
+        if start1 + len > length arr1 then invalidArg "start1" "(start1+len) out of range"
+        if start2 + len > length arr2 then invalidArg "start2" "(start2+len) out of range"
+        for i = 0 to len - 1 do 
+            arr2.[start2+i] <- arr1.[start1 + i]
+
+    let concat (arrs: ResizeArray<'T> list) = new ResizeArray<_> (seq { for arr in arrs do for x in arr do yield x })
+    let append (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T>) = concat [arr1; arr2]
+
+    let sub (arr: ResizeArray<'T>) start len =
+        if start < 0 then invalidArg "start" "index must be positive"
+        if len < 0 then invalidArg "len" "length must be positive"
+        if start + len > length arr then invalidArg "len" "length must be positive"
+        new ResizeArray<_> (seq { for i in start .. start+len-1 -> arr.[i] })
+
+    let fill (arr: ResizeArray<'T>) (start: int) (len: int) (x:'T) =
+        if start < 0 then invalidArg "start" "index must be positive"
+        if len < 0 then invalidArg "len" "length must be positive"
+        if start + len > length arr then invalidArg "len" "length must be positive"
+        for i = start to start + len - 1 do 
+            arr.[i] <- x
+
+    let copy      (arr: ResizeArray<'T>) = new ResizeArray<_>(arr)
+
+    let toList (arr: ResizeArray<_>) =
+        let mutable res = []
+        for i = length arr - 1 downto 0 do
+            res <- arr.[i] :: res
+        res
+
+    let ofList (l: _ list) =
+        let len = l.Length
+        let res = new ResizeArray<_>(len)
+        let rec add = function
+          | [] -> ()
+          | e::l -> res.Add(e); add l
+        add l
+        res
+
+    let iter f (arr: ResizeArray<_>) = 
+        for i = 0 to arr.Count - 1 do
+            f arr.[i]
+
+    let map f (arr: ResizeArray<_>) =
+        let len = length arr
+        let res = new ResizeArray<_>(len)
+        for i = 0 to len - 1 do
+            res.Add(f arr.[i])
+        res
+
+    let mapi f (arr: ResizeArray<_>) =
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        let len = length arr
+        let res = new ResizeArray<_>(len)
+        for i = 0 to len - 1 do
+            res.Add(f.Invoke(i, arr.[i]))
+        res
+        
+    let iteri f (arr: ResizeArray<_>) =
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        for i = 0 to arr.Count - 1 do
+            f.Invoke(i, arr.[i])
+
+    let exists (f: 'T -> bool) (arr: ResizeArray<'T>) =
+        let len = length arr 
+        let rec loop i = i < len && (f arr.[i] || loop (i+1))
+        loop 0
+
+    let forall f (arr: ResizeArray<_>) =
+        let len = length arr
+        let rec loop i = i >= len || (f arr.[i] && loop (i+1))
+        loop 0
+
+    let indexNotFound() = raise (new System.Collections.Generic.KeyNotFoundException("An index satisfying the predicate was not found in the collection"))
+
+    let find f (arr: ResizeArray<_>) = 
+        let rec loop i = 
+            if i >= length arr then indexNotFound()
+            elif f arr.[i] then arr.[i]
+            else loop (i+1)
+        loop 0
+
+    let tryPick f (arr: ResizeArray<_>) =
+        let rec loop i = 
+            if i >= length arr then None else
+            match f arr.[i] with 
+            | None -> loop(i+1)
+            | res -> res
+        loop 0
+
+    let tryFind f (arr: ResizeArray<_>) = 
+        let rec loop i = 
+            if i >= length arr then None
+            elif f arr.[i] then Some arr.[i]
+            else loop (i+1)
+        loop 0
+
+    let iter2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) = 
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        for i = 0 to len1 - 1 do 
+            f.Invoke(arr1.[i], arr2.[i])
+
+    let map2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) = 
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        let res = new ResizeArray<_>(len1)
+        for i = 0 to len1 - 1 do
+            res.Add(f.Invoke(arr1.[i], arr2.[i]))
+        res
+
+    let choose f (arr: ResizeArray<_>) = 
+        let res = new ResizeArray<_>() 
+        for i = 0 to length arr - 1 do
+            match f arr.[i] with 
+            | None -> ()
+            | Some b -> res.Add(b)
+        res
+
+    let filter f (arr: ResizeArray<_>) = 
+        let res = new ResizeArray<_>() 
+        for i = 0 to length arr - 1 do 
+            let x = arr.[i] 
+            if f x then res.Add(x)
+        res
+
+    let partition f (arr: ResizeArray<_>) = 
+      let res1 = new ResizeArray<_>()
+      let res2 = new ResizeArray<_>()
+      for i = 0 to length arr - 1 do 
+          let x = arr.[i] 
+          if f x then res1.Add(x) else res2.Add(x)
+      res1, res2
+
+    let rev (arr: ResizeArray<_>) = 
+      let len = length arr 
+      let res = new ResizeArray<_>(len)
+      for i = len - 1 downto 0 do 
+          res.Add(arr.[i])
+      res
+
+    let foldBack (f : 'T -> 'State -> 'State) (arr: ResizeArray<'T>) (acc: 'State) =
+        let mutable res = acc 
+        let len = length arr 
+        for i = len - 1 downto 0 do 
+            res <- f (get arr i) res
+        res
+
+    let fold (f : 'State -> 'T -> 'State) (acc: 'State) (arr: ResizeArray<'T>) =
+        let mutable res = acc 
+        let len = length arr 
+        for i = 0 to len - 1 do 
+            res <- f res (get arr i)
+        res
+
+    let toArray (arr: ResizeArray<'T>) = arr.ToArray()
+    let ofArray (arr: 'T[]) = new ResizeArray<_>(arr)
+    let toSeq (arr: ResizeArray<'T>) = Seq.readonly arr
+
+    let sort f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(f))
+    let sortBy f (arr: ResizeArray<'T>) = arr.Sort (System.Comparison(fun x y -> compare (f x) (f y)))
+
+
+    let exists2 f (arr1: ResizeArray<_>) (arr2: ResizeArray<_>) =
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        let rec loop i = i < len1 && (f arr1.[i] arr2.[i] || loop (i+1))
+        loop 0
+
+    let findIndex f (arr: ResizeArray<_>) =
+        let rec go n = if n >= length arr then indexNotFound() elif f arr.[n] then n else go (n+1)
+        go 0
+
+    let findIndexi f (arr: ResizeArray<_>) =
+        let rec go n = if n >= length arr then indexNotFound() elif f n arr.[n] then n else go (n+1)
+        go 0
+
+    let foldSub f acc (arr: ResizeArray<_>) start fin = 
+        let mutable res = acc
+        for i = start to fin do
+            res <- f res arr.[i] 
+        res
+
+    let foldBackSub f (arr: ResizeArray<_>) start fin acc = 
+        let mutable res = acc 
+        for i = fin downto start do
+            res <- f arr.[i] res
+        res
+
+    let reduce f (arr : ResizeArray<_>) =
+        let arrn = length arr
+        if arrn = 0 then invalidArg "arr" "the input array may not be empty"
+        else foldSub f arr.[0] arr 1 (arrn - 1)
+        
+    let reduceBack f (arr: ResizeArray<_>) = 
+        let arrn = length arr
+        if arrn = 0 then invalidArg "arr" "the input array may not be empty"
+        else foldBackSub f arr 0 (arrn - 2) arr.[arrn - 1]
+
+    let fold2 f (acc: 'T) (arr1: ResizeArray<'T1>) (arr2: ResizeArray<'T2>) =
+        let f = FSharpFunc<_,_,_,_>.Adapt(f)
+        let mutable res = acc 
+        let len = length arr1
+        if len <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        for i = 0 to len - 1 do
+            res <- f.Invoke(res,arr1.[i],arr2.[i])
+        res
+
+    let foldBack2 f (arr1: ResizeArray<'T1>) (arr2: ResizeArray<'T2>) (acc: 'b) =
+        let f = FSharpFunc<_,_,_,_>.Adapt(f)
+        let mutable res = acc 
+        let len = length arr1
+        if len <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        for i = len - 1 downto 0 do 
+            res <- f.Invoke(arr1.[i],arr2.[i],res)
+        res
+
+    let forall2 f (arr1: ResizeArray<_>) (arr2: ResizeArray<_>) = 
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        let rec loop i = i >= len1 || (f arr1.[i] arr2.[i] && loop (i+1))
+        loop 0
+        
+    let isEmpty (arr: ResizeArray<_>) = length (arr: ResizeArray<_>) = 0
+    
+    let iteri2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) =
+        let f = FSharpFunc<_,_,_,_>.Adapt(f)
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        for i = 0 to len1 - 1 do 
+            f.Invoke(i,arr1.[i], arr2.[i])
+
+    let mapi2 (f: int -> 'T -> 'b -> 'c) (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) = 
+        let f = FSharpFunc<_,_,_,_>.Adapt(f)
+        let len1 = length arr1
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        init len1 (fun i -> f.Invoke(i, arr1.[i], arr2.[i]))
+
+    let scanBackSub f (arr: ResizeArray<'T>) start fin acc = 
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        let mutable state = acc
+        let res = create (2+fin-start) acc
+        for i = fin downto start do
+            state <- f.Invoke(arr.[i], state)
+            res.[i - start] <- state
+        res
+
+    let scanSub f  acc (arr : ResizeArray<'T>) start fin = 
+        let f = FSharpFunc<_,_,_>.Adapt(f)
+        let mutable state = acc
+        let res = create (fin-start+2) acc
+        for i = start to fin do
+            state <- f.Invoke(state, arr.[i])
+            res.[i - start+1] <- state
+        res
+
+    let scan f acc (arr : ResizeArray<'T>) = 
+        let arrn = length arr
+        scanSub f acc arr 0 (arrn - 1)
+
+    let scanBack f (arr : ResizeArray<'T>) acc = 
+        let arrn = length arr
+        scanBackSub f arr 0 (arrn - 1) acc
+
+    let singleton x =
+        let res = new ResizeArray<_>(1)
+        res.Add(x)
+        res
+
+    let tryFindIndex f (arr: ResizeArray<'T>) = 
+        let rec go n = if n >= length arr then None elif f arr.[n] then Some n else go (n+1)
+        go 0
+        
+    let tryFindIndexi f (arr: ResizeArray<'T>) = 
+        let rec go n = if n >= length arr then None elif f n arr.[n] then Some n else go (n+1)
+        go 0
+    
+    let zip (arr1: ResizeArray<_>) (arr2: ResizeArray<_>) = 
+        let len1 = length arr1 
+        if len1 <> length arr2 then invalidArg "arr2" "the arrays have different lengths"
+        init len1 (fun i -> arr1.[i], arr2.[i])
+
+    let unzip (arr: ResizeArray<_>) = 
+        let len = length arr
+        let res1 = new ResizeArray<_>(len)
+        let res2 = new ResizeArray<_>(len)
+        for i = 0 to len - 1 do 
+            let x,y = arr.[i] 
+            res1.Add(x)
+            res2.Add(y)
+        res1,res2
+
+    let combine (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) = zip arr1 arr2
+    let split (arr: ResizeArray<_>) = unzip arr
+
+    let to_list arr = toList arr
+    let of_list l = ofList l
+    let to_seq arr = toSeq arr
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fsi
new file mode 100644
index 0000000..89994e8
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/resizearray.fsi
@@ -0,0 +1,239 @@
+//==========================================================================
+// ResizeArray
+// 
+// (c) Microsoft Corporation 2005-2008.  
+//===========================================================================
+
+namespace Microsoft.FSharp.Collections
+
+
+open System
+open System.Collections.Generic
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+/// Generic operations on the type System.Collections.Generic.List, which is called ResizeArray in the F# libraries.
+module ResizeArray =
+
+    /// Return the length of the collection.  You can also use property <c>arr.Length</c>.
+    val length: ResizeArray<'T> -> int
+
+    /// Fetch an element from the collection.  You can also use the syntax <c>arr.[idx]</c>.
+    val get: ResizeArray<'T> -> int -> 'T
+
+
+    /// Set the value of an element in the collection. You can also use the syntax <c>arr.[idx] <- e</c>.
+    val set: ResizeArray<'T> -> int -> 'T -> unit
+
+    /// Create an array whose elements are all initially the given value.
+    val create: int -> 'T -> ResizeArray<'T>
+     
+    /// Create an array by calling the given generator on each index.
+    val init: int -> (int -> 'T) -> ResizeArray<'T>
+
+    ///Build a new array that contains the elements of the first array followed by the elements of the second array
+    val append: ResizeArray<'T> -> ResizeArray<'T> -> ResizeArray<'T>
+
+    ///Build a new array that contains the elements of each of the given list of arrays
+    val concat: ResizeArray<'T> list -> ResizeArray<'T>
+
+    ///Build a new array that contains the given subrange specified by
+    ///starting index and length.
+    val sub: ResizeArray<'T> -> int -> int -> ResizeArray<'T>
+
+    ///Build a new array that contains the elements of the given array
+    val copy: ResizeArray<'T> -> ResizeArray<'T>
+
+    ///Fill a range of the collection with the given element
+    val fill: ResizeArray<'T> -> int -> int -> 'T -> unit
+
+    ///Read a range of elements from the first array and write them into the second.
+    val blit: ResizeArray<'T> -> int -> ResizeArray<'T> -> int -> int -> unit
+
+    ///Build a list from the given array
+    val toList: ResizeArray<'T> -> 'T list
+    [<System.Obsolete("This function has been renamed. Use 'ResizeArray.toList' instead")>]
+    val to_list: ResizeArray<'T> -> 'T list
+
+    ///Build an array from the given list
+    val ofList: 'T list -> ResizeArray<'T>
+    [<System.Obsolete("This function has been renamed. Use 'ResizeArray.ofList' instead")>]
+    val of_list: 'T list -> ResizeArray<'T>
+
+
+
+    /// Apply a function to each element of the collection, threading an accumulator argument
+    /// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> 
+    /// then computes <c>f (... (f s i0)...) iN</c>
+    val fold: ('T -> 'U -> 'T) -> 'T -> ResizeArray<'U> -> 'T
+
+    /// Apply a function to each element of the array, threading an accumulator argument
+    /// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then 
+    /// computes <c>f i0 (...(f iN s))</c>.
+    val foldBack: ('T -> 'U -> 'U) -> ResizeArray<'T> -> 'U -> 'U
+
+    ///Apply the given function to each element of the array. 
+    val iter: ('T -> unit) -> ResizeArray<'T> -> unit
+
+    ///Build a new array whose elements are the results of applying the given function
+    ///to each of the elements of the array.
+    val map: ('T -> 'U) -> ResizeArray<'T> -> ResizeArray<'U>
+
+    ///Apply the given function to two arrays simultaneously. The
+    ///two arrays must have the same lengths, otherwise an Invalid_argument exception is
+    ///raised.
+    val iter2: ('T -> 'U -> unit) -> ResizeArray<'T> -> ResizeArray<'U> -> unit
+
+    ///Build a new collection whose elements are the results of applying the given function
+    ///to the corresponding elements of the two collections pairwise.  The two input
+    ///arrays must have the same lengths.
+    val map2: ('T -> 'U -> 'c) -> ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'c>
+
+    ///Apply the given function to each element of the array.  The integer passed to the
+    ///function indicates the index of element.
+    val iteri: (int -> 'T -> unit) -> ResizeArray<'T> -> unit
+
+    ///Build a new array whose elements are the results of applying the given function
+    ///to each of the elements of the array. The integer index passed to the
+    ///function indicates the index of element being transformed.
+    val mapi: (int -> 'T -> 'U) -> ResizeArray<'T> -> ResizeArray<'U>
+
+    /// Test if any element of the array satisfies the given predicate.
+    /// If the input function is <c>f</c> and the elements are <c>i0...iN</c> 
+    /// then computes <c>p i0 or ... or p iN</c>.
+    val exists: ('T -> bool) -> ResizeArray<'T> -> bool
+
+    /// Test if all elements of the array satisfy the given predicate.
+    /// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and "j0...jN"
+    /// then computes <c>p i0 && ... && p iN</c>.
+    val forall: ('T -> bool) -> ResizeArray<'T> -> bool
+
+    ///Return a new collection containing only the elements of the collection
+    ///for which the given predicate returns <c>true</c>
+    val filter: ('T -> bool) -> ResizeArray<'T> -> ResizeArray<'T>
+
+    ///Split the collection into two collections, containing the 
+    ///elements for which the given predicate returns <c>true</c> and <c>false</c>
+    ///respectively 
+    val partition: ('T -> bool) -> ResizeArray<'T> -> ResizeArray<'T> * ResizeArray<'T>
+
+    ///Apply the given function to each element of the array. Return
+    ///the array comprised of the results "x" for each element where
+    ///the function returns Some(x)
+    val choose: ('T -> 'U option) -> ResizeArray<'T> -> ResizeArray<'U>
+
+    ///Return the first element for which the given function returns <c>true</c>.
+    ///Raise <c>KeyNotFoundException</c> if no such element exists.
+    val find: ('T -> bool) -> ResizeArray<'T> -> 'T
+
+    ///Return the first element for which the given function returns <c>true</c>.
+    ///Return None if no such element exists.
+    val tryFind: ('T -> bool) -> ResizeArray<'T> -> 'T option
+
+    ///Apply the given function to successive elements, returning the first
+    ///result where function returns "Some(x)" for some x.
+    val tryPick: ('T -> 'U option) -> ResizeArray<'T> -> 'U option
+
+    ///Combine the two arrays into an array of pairs. The two arrays must have equal lengths.
+    [<Obsolete("Use unzip instead")>]
+    val combine: ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<('T * 'U)>
+
+    ///Split a list of pairs into two lists
+    [<Obsolete("Use unzip instead")>]
+    val split: ResizeArray<('T * 'U)> -> (ResizeArray<'T> * ResizeArray<'U>)
+
+    ///Return a new array with the elements in reverse order
+    val rev: ResizeArray<'T> -> ResizeArray<'T>
+
+    /// Sort the elements using the given comparison function
+    val sort: ('T -> 'T -> int) -> ResizeArray<'T> -> unit
+
+    /// Sort the elements using the key extractor and generic comparison on the keys
+    val sortBy: ('T -> 'Key) -> ResizeArray<'T> -> unit when 'Key : comparison
+
+    /// Return a fixed-length array containing the elements of the input ResizeArray
+    val toArray : ResizeArray<'T> -> 'T[]
+    /// Build a ResizeArray from the given elements
+    val ofArray : 'T[] -> ResizeArray<'T>
+    /// Return a view of the array as an enumerable object
+    val toSeq : ResizeArray<'T> -> seq<'T>
+    [<System.Obsolete("This function has been renamed. Use 'ResizeArray.toSeq' instead")>]
+    val to_seq : ResizeArray<'T> -> seq<'T>
+
+    /// Test elements of the two arrays pairwise to see if any pair of element satisfies the given predicate.
+    /// Raise ArgumentException if the arrays have different lengths.
+    val exists2 : ('T -> 'U -> bool) -> ResizeArray<'T> -> ResizeArray<'U> -> bool
+
+    /// Return the index of the first element in the array
+    /// that satisfies the given predicate. Raise <c>KeyNotFoundException</c> if 
+    /// none of the elements satisfy the predicate.
+    val findIndex : ('T -> bool) -> ResizeArray<'T> -> int
+
+    /// Return the index of the first element in the array
+    /// that satisfies the given predicate. Raise <c>KeyNotFoundException</c> if 
+    /// none of the elements satisfy the predicate.
+    val findIndexi : (int -> 'T -> bool) -> ResizeArray<'T> -> int
+
+    /// Apply a function to each element of the array, threading an accumulator argument
+    /// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> 
+    /// then computes <c>f (... (f i0 i1)...) iN</c>. Raises ArgumentException if the array has size zero.
+    val reduce : ('T -> 'T -> 'T) -> ResizeArray<'T> -> 'T
+
+    /// Apply a function to each element of the array, threading an accumulator argument
+    /// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c> then 
+    /// computes <c>f i0 (...(f iN-1 iN))</c>. Raises ArgumentException if the array has size zero.
+    val reduceBack : ('T -> 'T -> 'T) -> ResizeArray<'T> -> 'T
+
+    /// Apply a function to pairs of elements drawn from the two collections, 
+    /// left-to-right, threading an accumulator argument
+    /// through the computation.  The two input
+    /// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is
+    /// raised.
+    val fold2: ('state -> 'b1 -> 'b2 -> 'state) -> 'state -> ResizeArray<'b1> -> ResizeArray<'b2> -> 'state
+
+    /// Apply a function to pairs of elements drawn from the two collections, right-to-left, 
+    /// threading an accumulator argument through the computation.  The two input
+    /// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is
+    /// raised.
+    val foldBack2 : ('a1 -> 'a2 -> 'U -> 'U) -> ResizeArray<'a1> -> ResizeArray<'a2> -> 'U -> 'U
+
+    /// Test elements of the two arrays pairwise to see if all pairs of elements satisfy the given predicate.
+    /// Raise ArgumentException if the arrays have different lengths.
+    val forall2 : ('T -> 'U -> bool) -> ResizeArray<'T> -> ResizeArray<'U> -> bool
+
+    /// Return true if the given array is empty, otherwise false
+    val isEmpty : ResizeArray<'T> -> bool
+
+    /// Apply the given function to pair of elements drawn from matching indices in two arrays,
+    /// also passing the index of the elements. The two arrays must have the same lengths, 
+    /// otherwise an <c>ArgumentException</c> is raised.
+    val iteri2 : (int -> 'T -> 'U -> unit) -> ResizeArray<'T> -> ResizeArray<'U> -> unit
+
+    /// Build a new collection whose elements are the results of applying the given function
+    /// to the corresponding elements of the two collections pairwise.  The two input
+    /// arrays must have the same lengths, otherwise an <c>ArgumentException</c> is
+    /// raised.
+    val mapi2 : (int -> 'T -> 'U -> 'c) -> ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'c>
+
+    /// Like <c>fold</c>, but return the intermediary and final results
+    val scan : ('U -> 'T -> 'U) -> 'U -> ResizeArray<'T> -> ResizeArray<'U>
+
+    /// Like <c>foldBack</c>, but return both the intermediary and final results
+    val scanBack : ('T -> 'c -> 'c) -> ResizeArray<'T> -> 'c -> ResizeArray<'c>
+
+    /// Return an array containing the given element
+    val singleton : 'T -> ResizeArray<'T>
+    
+    /// Return the index of the first element in the array
+    /// that satisfies the given predicate.
+    val tryFindIndex : ('T -> bool) -> ResizeArray<'T> -> int option
+
+    /// Return the index of the first element in the array
+    /// that satisfies the given predicate.
+    val tryFindIndexi : (int -> 'T -> bool) -> ResizeArray<'T> -> int option
+
+    /// Combine the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an <c>ArgumentException</c> is
+    /// raised..
+    val zip : ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'T * 'U>
+
+    /// Split an array of pairs into two arrays
+    val unzip : ResizeArray<'T * 'U> -> ResizeArray<'T> * ResizeArray<'U>
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sbyte.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sbyte.fs
new file mode 100644
index 0000000..d48d1d1
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sbyte.fs
@@ -0,0 +1,47 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+open System
+
+/// Simple operations on signed bytes
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using operators such as 'sbyte' and 'int32' to convert numbers")>]
+module SByte = 
+
+    let compare (x:int8) y = compare x y
+
+    let zero = 0y
+    let one = 1y
+    let minus_one = - 1y
+    let neg (x:int8) =  - x
+    let add (x:int8) (y:int8) = x + y
+    let sub (x:int8) (y:int8) = x - y
+    let mul (x:int8) (y:int8) = x * y
+    let div (x:int8) (y:int8) = x / y
+    let rem (x:int8) (y:int8) = x % y
+    let succ (x:int8) = x + 1y
+    let pred (x:int8) = x - 1y
+    let abs (x:int8) = if x < zero then neg x else x
+    let max_int = 0x7Fuy
+    let min_int = 0x80y
+    let logand (x:int8) (y:int8) = x &&& y
+    let logor (x:int8) (y:int8) = x ||| y
+    let logxor (x:int8) (y:int8) = x ^^^ y
+    let lognot (x:int8) = ~~~ x
+    let shift_left (x:int8) (n:int) =  x <<< n
+    let shift_right (x:int8) (n:int) =  x >>> n
+    let of_uint8 (n:byte)   = sbyte n
+    let to_uint8 (x:int8) = byte x
+
+    let of_byte (n:byte)   = sbyte n
+    let to_byte (x:int8) = byte x
+
+    let of_int (n:int)   = sbyte n
+    let to_int (x:int8) = int x
+
+    let of_int16 (n:int16) = sbyte n
+    let to_int16 (x:int8)  = int16 x
+
+    let of_int32 (n:int32) = sbyte n
+    let to_int32 (x:int8) = int32 x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fs
new file mode 100644
index 0000000..6e40626
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fs
@@ -0,0 +1,95 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+open System.Collections.Generic
+
+module Set = 
+    let cardinal (s : Set<'T>) = s.Count
+    let elements (s : Set<'T>) = Set.toList s
+
+        // Fold, left-to-right. 
+        //
+        // NOTE: This matches OCaml behaviour, though differs from the
+        // behaviour of Map.fold which folds right-to-left.
+    // let fold f m z = Set.fold_left (fun z x ->  f x z) z m
+    let inter s1 s2 = Set.intersect s1 s2
+
+
+
+    open Microsoft.FSharp.Collections
+
+    // Functor
+    type Provider<'T,'Tag> when 'Tag :> IComparer<'T> =
+       interface
+         //type t = Tagged.Set<'T,'Tag>
+         abstract empty    : Tagged.Set<'T,'Tag>;
+         abstract is_empty : Tagged.Set<'T,'Tag> -> bool;
+         abstract mem      : 'T -> Tagged.Set<'T,'Tag> -> bool;
+         abstract add      : 'T -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract singleton: 'T -> Tagged.Set<'T,'Tag>;
+         abstract remove   : 'T -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract union    : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract inter    : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract diff     : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract iter     : ('T -> unit) -> Tagged.Set<'T,'Tag> -> unit;
+         abstract elements : Tagged.Set<'T,'Tag> -> 'T list;
+         abstract equal    : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> bool;
+         abstract subset   : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> bool;
+         abstract compare  : Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> int;
+         abstract for_all  : ('T -> bool) -> Tagged.Set<'T,'Tag> -> bool;
+         abstract exists   : ('T -> bool) -> Tagged.Set<'T,'Tag> -> bool;
+         abstract filter   : ('T -> bool) -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract partition: ('T -> bool) -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> * Tagged.Set<'T,'Tag>;
+         abstract fold     : ('T -> 'b -> 'b) -> Tagged.Set<'T,'Tag> -> 'b -> 'b;
+         abstract cardinal : Tagged.Set<'T,'Tag> -> int;
+         abstract min_elt  : Tagged.Set<'T,'Tag> -> 'T;
+         abstract max_elt  : Tagged.Set<'T,'Tag> -> 'T;
+         abstract choose   : Tagged.Set<'T,'Tag> -> 'T 
+       end
+
+    let gen_inter (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>)  = Tagged.Set<_,_>.Intersection(s1,s2)
+    let gen_diff (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>)   = Tagged.Set<_,_>.Difference(s1,s2)
+    let gen_iter f (s : Tagged.Set<_,_>)  = s.Iterate(f)
+    let gen_elements (s : Tagged.Set<_,_>) = s.ToList()
+    let gen_equal (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>)  =  Tagged.Set<_,_>.Equality(s1,s2)
+    let gen_subset (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>)  = s1.IsSubsetOf(s2)
+    let gen_compare (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>) = Tagged.Set<_,_>.Compare(s1,s2)
+    let gen_for_all f (s : Tagged.Set<_,_>) = s.ForAll f
+    let gen_exists f (s : Tagged.Set<_,_>) = s.Exists f
+    let gen_filter f (s : Tagged.Set<_,_>) = s.Filter f
+    let gen_partition f (s : Tagged.Set<_,_>) = s.Partition f 
+    let gen_fold f (s : Tagged.Set<_,_>) acc = s.Fold f acc
+    let gen_cardinal (s : Tagged.Set<_,_>) = s.Count
+    let gen_size (s : Tagged.Set<_,_>) = s.Count
+    let gen_min_elt (s : Tagged.Set<_,_>) = s.MinimumElement
+    let gen_max_elt (s : Tagged.Set<_,_>) = s.MaximumElement
+
+    let MakeTagged (cf : 'Tag) : Provider<'T,'Tag> when 'Tag :> IComparer<'T> =
+       { new Provider<_,_> with 
+           member p.empty = Tagged.Set<_,_>.Empty(cf);
+           member p.is_empty s = s.IsEmpty;
+           member p.mem x s = s.Contains(x);
+           member p.add x s = s.Add(x);
+           member p.singleton x = Tagged.Set<'T,'Tag>.Singleton(cf,x);
+           member p.remove x s = s.Remove(x);
+           member p.union (s1 : Tagged.Set<_,_>)  (s2 : Tagged.Set<_,_>) = Tagged.Set<_,_>.Union(s1,s2);
+           member p.inter s1 s2 = gen_inter s1 s2 ;
+           member p.diff s1 s2 = gen_diff s1 s2;
+           member p.iter f s= gen_iter f s;
+           member p.elements s = gen_elements s;
+           member p.equal s1 s2= gen_equal s1 s2;
+           member p.subset s1 s2= gen_subset s1 s2;
+           member p.compare s1 s2 = gen_compare s1 s2;
+           member p.for_all f s = gen_for_all f s;
+           member p.fold f s z = gen_fold f s z;
+           member p.exists f s = gen_exists f s;
+           member p.filter f s = gen_filter f s;
+           member p.partition f s = gen_partition f s ;
+           member p.cardinal s = gen_cardinal s;
+           member p.min_elt s = s.MinimumElement;
+           member p.max_elt s = s.MaximumElement; 
+           member p.choose s  = s.Choose }
+
+    type Provider<'T> = Provider<'T, IComparer<'T>>
+    let Make cf  = MakeTagged (ComparisonIdentity.FromFunction cf)
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fsi
new file mode 100644
index 0000000..ca8ec2b
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/set.fsi
@@ -0,0 +1,85 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+#nowarn "62" // ocaml compat
+
+open System
+open System.Collections.Generic
+open Microsoft.FSharp.Collections
+
+/// Immutable sets implemented via binary trees
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+[<RequireQualifiedAccess>]
+module Set = 
+
+    [<Obsolete("Use Set.count instead")>]
+    val cardinal: Set<'T> -> int
+
+    [<Obsolete("Use Set.toList instead")>]
+    val elements: Set<'T> -> 'T list
+
+    [<Obsolete("Use Set.intersect instead")>]
+    val inter: Set<'T> -> Set<'T> -> Set<'T>
+
+    ///A collection of operations for creating and using sets based on a particular comparison function.
+    ///The 'Tag' type parameter is used to track information about the comparison function.
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type Provider<'T,'Tag> when 'Tag :> IComparer<'T> =
+       interface
+         abstract empty: Tagged.Set<'T,'Tag>;
+         abstract is_empty: Tagged.Set<'T,'Tag> -> bool;
+         abstract mem: 'T -> Tagged.Set<'T,'Tag> -> bool;
+         abstract add: 'T -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract singleton: 'T -> Tagged.Set<'T,'Tag>;
+         abstract remove: 'T -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract union: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract inter: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract diff: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract iter: ('T -> unit) -> Tagged.Set<'T,'Tag> -> unit;
+         abstract elements: Tagged.Set<'T,'Tag> -> 'T list;
+         abstract equal: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> bool;
+         abstract subset: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> bool;
+         abstract compare: Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> -> int;
+         abstract for_all: ('T -> bool) -> Tagged.Set<'T,'Tag> -> bool;
+         abstract exists: ('T -> bool) -> Tagged.Set<'T,'Tag> -> bool;
+         abstract filter: ('T -> bool) -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag>;
+         abstract partition: ('T -> bool) -> Tagged.Set<'T,'Tag> -> Tagged.Set<'T,'Tag> * Tagged.Set<'T,'Tag>;
+         abstract fold:  ('T -> 'State -> 'State) -> Tagged.Set<'T,'Tag> -> 'State -> 'State;
+         abstract cardinal: Tagged.Set<'T,'Tag> -> int;
+         abstract min_elt: Tagged.Set<'T,'Tag> -> 'T;
+         abstract max_elt: Tagged.Set<'T,'Tag> -> 'T;
+         abstract choose: Tagged.Set<'T,'Tag> -> 'T 
+       end
+         
+
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    type Provider<'T> = Provider<'T, IComparer<'T>>
+
+    /// Build a collection of operations for creating and using 
+    /// maps based on a single consistent comparison function. This returns a record
+    /// that contains the functions you use to create and manipulate maps all of which 
+    /// use this comparison function.  The returned value is much like an ML module. 
+    ///
+    /// Use MakeTagged if you want additional type safety that guarantees that two sets
+    /// based on different comparison functions can never be combined in inconsistent ways.
+    
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val Make: ('T -> 'T -> int) -> Provider<'T>
+
+    ///A functor to build a collection of operations for creating and using 
+    /// sets based on the given comparison function. This returns a record that 
+    /// contains the functions you use to create and manipulate maps of
+    /// this kind.  The returned value is much like an ML module. 
+    ///
+    /// To use this function you need to define a new named class that implements IComparer and
+    /// pass an instance of that class as the first argument. For example:
+    ///      type MyComparer() = 
+    ///          interface IComparer<string> with 
+    ///            member self.Compare(x,y) = ...
+    ///
+    /// let MyStringSetProvider = Set.MakeTagged(new MyComparer())
+    [<CompilerMessage("This construct is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+    val MakeTagged: ('Tag :> IComparer<'T>) -> Provider<'T,'Tag>
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fs
new file mode 100644
index 0000000..dac9716
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fs
@@ -0,0 +1,1018 @@
+//=========================================================================
+// (c) Microsoft Corporation 2005-2009. 
+//=========================================================================
+
+#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation
+
+namespace Microsoft.FSharp.Text.StructuredFormat
+
+    // Breakable block layout implementation.
+    // This is a fresh implementation of pre-existing ideas.
+
+    open System
+    open System.Diagnostics
+    open System.Text
+    open System.IO
+    open System.Reflection
+    open System.Globalization
+    open System.Collections.Generic
+    open Microsoft.FSharp.Reflection
+
+    /// A joint, between 2 layouts, is either:
+    ///  - unbreakable, or
+    ///  - breakable, and if broken the second block has a given indentation.
+    [<StructuralEquality; NoComparison>]
+    type Joint =
+     | Unbreakable
+     | Breakable of int
+     | Broken of int
+
+    /// Leaf juxt,data,juxt
+    /// Node juxt,left,juxt,right,juxt and joint
+    ///
+    /// If either juxt flag is true, then no space between words.
+    [<NoEquality; NoComparison>]
+    type Layout =
+     | Leaf of bool * obj * bool
+     | Node of bool * layout * bool * layout * bool * joint
+     | Attr of string * (string * string) list * layout
+
+    and layout = Layout
+
+    and joint = Joint
+
+    [<NoEquality; NoComparison>]
+    type IEnvironment = 
+        abstract GetLayout : obj -> layout
+        abstract MaxColumns : int
+        abstract MaxRows : int
+     
+    module LayoutOps = 
+        let rec juxtLeft = function
+          | Leaf (jl,_,_)         -> jl
+          | Node (jl,_,_,_,_,_) -> jl
+          | Attr (_,_,l)        -> juxtLeft l
+
+        let rec juxtRight = function
+          | Leaf (_,_,jr)         -> jr
+          | Node (_,_,_,_,jr,_) -> jr
+          | Attr (_,_,l)        -> juxtRight l
+
+        let mkNode l r joint =
+           let jl = juxtLeft  l 
+           let jm = juxtRight l || juxtLeft r 
+           let jr = juxtRight r 
+           Node(jl,l,jm,r,jr,joint)
+
+
+        // constructors
+
+
+        let objL   (obj:obj) = Leaf (false,obj,false)
+        let sLeaf  (l,(str:string),r) = Leaf (l,(str:>obj),r)
+        let wordL  str = sLeaf (false,str,false)
+        let sepL   str = sLeaf (true ,str,true)   
+        let rightL str = sLeaf (true ,str,false)   
+        let leftL  str = sLeaf (false,str,true)
+        let emptyL = sLeaf (true,"",true)
+        let isEmptyL = function 
+         | Leaf(true,s,true) -> 
+            match s with 
+            | :? string as s -> s = "" 
+            | _ -> false
+         | _ -> false
+         
+
+        let aboveL  l r = mkNode l r (Broken 0)
+
+        let joinN i l r = mkNode l r (Breakable i)                                      
+        let join  = joinN 0
+        let join1 = joinN 1
+        let join2 = joinN 2
+        let join3 = joinN 3
+
+        let tagAttrL tag attrs l = Attr(tag,attrs,l)
+
+        let apply2 f l r = if isEmptyL l then r else
+                           if isEmptyL r then l else f l r
+
+        let (^^)  l r  = mkNode l r (Unbreakable)
+        let (++)  l r  = mkNode l r (Breakable 0)
+        let (--)  l r  = mkNode l r (Breakable 1)
+        let (---) l r  = mkNode l r (Breakable 2)
+        let (@@)   l r = apply2 (fun l r -> mkNode l r (Broken 0)) l r
+        let (@@-)  l r = apply2 (fun l r -> mkNode l r (Broken 1)) l r
+        let (@@--) l r = apply2 (fun l r -> mkNode l r (Broken 2)) l r
+        let tagListL tagger = function
+            | []    -> emptyL
+            | [x]   -> x
+            | x::xs ->
+                let rec process' prefixL = function
+                    []    -> prefixL
+                  | y::ys -> process' ((tagger prefixL) ++ y) ys
+                in  process' x xs
+            
+        let commaListL x = tagListL (fun prefixL -> prefixL ^^ rightL ",") x
+        let semiListL x  = tagListL (fun prefixL -> prefixL ^^ rightL ";") x
+        let spaceListL x = tagListL (fun prefixL -> prefixL) x
+        let sepListL x y = tagListL (fun prefixL -> prefixL ^^ x) y
+        let bracketL l = leftL "(" ^^ l ^^ rightL ")"
+        let tupleL xs = bracketL (sepListL (sepL ",") xs)
+        let aboveListL = function
+          | []    -> emptyL
+          | [x]   -> x
+          | x::ys -> List.fold (fun pre y -> pre @@ y) x ys
+
+        let optionL xL = function
+            None   -> wordL "None"
+          | Some x -> wordL "Some" -- (xL x)
+
+        let listL xL xs = leftL "[" ^^ sepListL (sepL ";") (List.map xL xs) ^^ rightL "]"
+
+        let squareBracketL x = leftL "[" ^^ x ^^ rightL "]"    
+
+        let braceL         x = leftL "{" ^^ x ^^ rightL "}"
+
+        let boundedUnfoldL
+                    (itemL     : 'a -> layout)
+                    (project   : 'z -> ('a * 'z) option)
+                    (stopShort : 'z -> bool)
+                    (z : 'z)
+                    maxLength =
+          let rec consume n z =
+            if stopShort z then [wordL "..."] else
+            match project z with
+              | None       -> []  (* exhaused input *)
+              | Some (x,z) -> if n<=0 then [wordL "..."]               (* hit print_length limit *)
+                                      else itemL x :: consume (n-1) z  (* cons recursive... *)
+          consume maxLength z  
+
+        let unfoldL itemL project z maxLength = boundedUnfoldL  itemL project (fun _ -> false) z maxLength
+          
+    /// These are a typical set of options used to control structured formatting.
+    [<NoEquality; NoComparison>]
+    type FormatOptions = 
+        { FloatingPointFormat: string;
+          AttributeProcessor: (string -> (string * string) list -> bool -> unit);
+          FormatProvider: System.IFormatProvider;
+          BindingFlags: System.Reflection.BindingFlags
+          PrintWidth : int; 
+          PrintDepth : int; 
+          PrintLength : int;
+          PrintSize : int;        
+          ShowProperties : bool;
+          ShowIEnumerable: bool; }
+        static member Default =
+            { FormatProvider = (System.Globalization.CultureInfo.InvariantCulture :> System.IFormatProvider);
+              AttributeProcessor= (fun _ _ _ -> ());
+              BindingFlags = System.Reflection.BindingFlags.Public;
+              FloatingPointFormat = "g10";
+              PrintWidth = 80 ; 
+              PrintDepth = 100 ; 
+              PrintLength = 100;
+              PrintSize = 10000;
+              ShowProperties = false;
+              ShowIEnumerable = true; }
+
+
+
+    module ReflectUtils = 
+        open System
+        open System.Reflection
+
+        [<NoEquality; NoComparison>]
+        type TypeInfo =
+          | TupleType of Type list
+          | FunctionType of Type * Type
+          | RecordType of (string * Type) list
+          | SumType of (string * (string * Type) list) list
+          | UnitType
+          | ObjectType of Type
+
+             
+        let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+        let equivHeadTypes (ty1:Type) (ty2:Type) = 
+            isNamedType(ty1) &&
+            if ty1.IsGenericType then 
+              ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+            else 
+              ty1.Equals(ty2)
+
+        let option = typedefof<obj option>
+        let func = typedefof<(obj -> obj)>
+
+        let isOptionType typ = equivHeadTypes typ (typeof<int option>)
+        let isUnitType typ = equivHeadTypes typ (typeof<unit>)
+        let isListType typ = 
+            FSharpType.IsUnion typ && 
+            (let cases = FSharpType.GetUnionCases typ 
+             cases.Length > 0 && equivHeadTypes (typedefof<list<_>>) cases.[0].DeclaringType)
+
+        module Type =
+
+            let recdDescOfProps props = 
+               props |> Array.toList |> List.map (fun (p:PropertyInfo) -> p.Name, p.PropertyType) 
+
+            let getTypeInfoOfType (bindingFlags:BindingFlags) (typ:Type) = 
+                if FSharpType.IsTuple(typ)  then TypeInfo.TupleType (FSharpType.GetTupleElements(typ) |> Array.toList)
+                elif FSharpType.IsFunction(typ) then let ty1,ty2 = FSharpType.GetFunctionElements typ in  TypeInfo.FunctionType( ty1,ty2)
+                elif FSharpType.IsUnion(typ,bindingFlags) then 
+                    let cases = FSharpType.GetUnionCases(typ,bindingFlags) 
+                    match cases with 
+                    | [| |] -> TypeInfo.ObjectType(typ) 
+                    | _ -> 
+                        TypeInfo.SumType(cases |> Array.toList |> List.map (fun case -> 
+                            let flds = case.GetFields()
+                            case.Name,recdDescOfProps(flds)))
+                elif FSharpType.IsRecord(typ,bindingFlags) then 
+                    let flds = FSharpType.GetRecordFields(typ,bindingFlags) 
+                    TypeInfo.RecordType(recdDescOfProps(flds))
+                else
+                    TypeInfo.ObjectType(typ)
+
+            let IsOptionType (typ:Type) = isOptionType typ
+            let IsListType (typ:Type) = isListType typ
+            let IsUnitType (typ:Type) = isUnitType typ
+
+        [<NoEquality; NoComparison>]
+        type ValueInfo =
+          | TupleValue of obj list
+          | FunctionClosureValue of System.Type 
+          | RecordValue of (string * obj) list
+          | ConstructorValue of string * (string * obj) list
+          | ExceptionValue of System.Type * (string * obj) list
+          | UnitValue
+          | ObjectValue of obj
+
+        module Value = 
+       
+            // Analyze an object to see if it the representation
+            // of an F# value.
+            let GetValueInfoOfObject (bindingFlags:BindingFlags) (obj : obj) = 
+              match obj with 
+              | null -> ObjectValue(obj)
+              | _ -> 
+                let reprty = obj.GetType() 
+
+                // First a bunch of special rules for tuples
+                // Because of the way F# currently compiles tuple values 
+                // of size > 7 we can only reliably reflect on sizes up
+                // to 7.
+
+                if FSharpType.IsTuple reprty then 
+                    TupleValue (FSharpValue.GetTupleFields obj |> Array.toList)
+                elif FSharpType.IsFunction reprty then 
+                    FunctionClosureValue reprty
+                    
+                // It must be exception, abstract, record or union.
+                // Either way we assume the only properties defined on
+                // the type are the actual fields of the type.  Again,
+                // we should be reading attributes here that indicate the
+                // true structure of the type, e.g. the order of the fields.   
+                elif FSharpType.IsUnion(reprty,bindingFlags) then 
+                    let tag,vals = FSharpValue.GetUnionFields (obj,reprty,bindingFlags) 
+                    let props = tag.GetFields()
+                    let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,v)
+                    ConstructorValue(tag.Name, Array.toList pvals)
+
+                elif FSharpType.IsExceptionRepresentation(reprty,bindingFlags) then 
+                    let props = FSharpType.GetExceptionFields(reprty,bindingFlags) 
+                    let vals = FSharpValue.GetExceptionFields(obj,bindingFlags) 
+                    let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,v)
+                    ExceptionValue(reprty, pvals |> Array.toList)
+
+                elif FSharpType.IsRecord(reprty,bindingFlags) then 
+                    let props = FSharpType.GetRecordFields(reprty,bindingFlags) 
+                    RecordValue(props |> Array.map (fun prop -> prop.Name, prop.GetValue(obj,null)) |> Array.toList)
+                else
+                    ObjectValue(obj)
+
+            // This one is like the above but can make use of additional
+            // statically-known type information to aid in the
+            // analysis of null values. 
+
+            let GetValueInfo bindingFlags (x : 'a)  (* x could be null *) = 
+                let obj = (box x)
+                match obj with 
+                | null -> 
+                   let typ = typeof<'a>
+                   if isOptionType typ then  ConstructorValue("None", [])
+                   elif isUnitType typ then  UnitValue
+                   else ObjectValue(obj)
+                | _ -> 
+                  GetValueInfoOfObject bindingFlags (obj) 
+
+
+            let GetInfo bindingFlags (v:'a) = GetValueInfo bindingFlags (v:'a)
+
+    module Display = 
+
+        open ReflectUtils
+        open LayoutOps
+        let string_of_int (i:int) = i.ToString()
+
+        let typeUsesSystemObjectToString (typ:System.Type) =
+            try let methInfo = typ.GetMethod("ToString",BindingFlags.Public ||| BindingFlags.Instance,null,[| |],null)
+                methInfo.DeclaringType = typeof<System.Object>
+            with e -> false
+
+        /// If "str" ends with "ending" then remove it from "str", otherwise no change.
+        let trimEnding (ending:string) (str:string) =
+#if FX_NO_CULTURE_INFO_ARGS
+          if str.EndsWith(ending) then 
+#else
+          if str.EndsWith(ending,StringComparison.Ordinal) then 
+#endif
+              str.Substring(0,str.Length - ending.Length) 
+          else str
+
+        let catchExn f = try Choice1Of2 (f ()) with e -> Choice2Of2 e
+        
+        // An implementation of break stack.
+        // Uses mutable state, relying on linear threading of the state.
+
+        [<NoEquality; NoComparison>]
+        type Breaks = 
+            Breaks of
+                int *     // pos of next free slot 
+                int *     // pos of next possible "outer" break - OR - outer=next if none possible 
+                int array // stack of savings, -ve means it has been broken   
+
+        // next  is next slot to push into - aka size of current occupied stack.  
+        // outer counts up from 0, and is next slot to break if break forced.
+        // - if all breaks forced, then outer=next.
+        // - popping under these conditions needs to reduce outer and next.
+        
+
+        //let dumpBreaks prefix (Breaks(next,outer,stack)) = ()
+        //   printf "%s: next=%d outer=%d stack.Length=%d\n" prefix next outer stack.Length;
+        //   stdout.Flush() 
+             
+        let chunkN = 400      
+        let breaks0 () = Breaks(0,0,Array.create chunkN 0)
+
+        let pushBreak saving (Breaks(next,outer,stack)) =
+            //dumpBreaks "pushBreak" (next,outer,stack);
+            let stack = 
+                if next = stack.Length then
+                  Array.init (next + chunkN) (fun i -> if i < next then stack.[i] else 0) // expand if full 
+                else
+                  stack
+           
+            stack.[next] <- saving;
+            Breaks(next+1,outer,stack)
+
+        let popBreak (Breaks(next,outer,stack)) =
+            //dumpBreaks "popBreak" (next,outer,stack);
+            if next=0 then raise (Failure "popBreak: underflow");
+            let topBroke = stack.[next-1] < 0
+            let outer = if outer=next then outer-1 else outer  // if all broken, unwind 
+            let next  = next - 1
+            Breaks(next,outer,stack),topBroke
+
+        let forceBreak (Breaks(next,outer,stack)) =
+            //dumpBreaks "forceBreak" (next,outer,stack);
+            if outer=next then
+              // all broken 
+                None
+            else
+                let saving = stack.[outer]
+                stack.[outer] <- -stack.[outer];    
+                let outer = outer+1
+                Some (Breaks(next,outer,stack),saving)
+
+        // -------------------------------------------------------------------------
+        // fitting
+        // ------------------------------------------------------------------------
+          
+        let squashTo (maxWidth,leafFormatter) layout =
+            if maxWidth <= 0 then layout else 
+            let rec fit breaks (pos,layout) =
+                // breaks = break context, can force to get indentation savings.
+                // pos    = current position in line
+                // layout = to fit
+                //------
+                // returns:
+                // breaks
+                // layout - with breaks put in to fit it.
+                // pos    - current pos in line = rightmost position of last line of block.
+                // offset - width of last line of block
+                // NOTE: offset <= pos -- depending on tabbing of last block
+               
+                let breaks,layout,pos,offset =
+                    match layout with
+                    | Attr (tag,attrs,l) ->
+                        let breaks,layout,pos,offset = fit breaks (pos,l) 
+                        let layout = Attr (tag,attrs,layout) 
+                        breaks,layout,pos,offset
+                    | Leaf (jl,obj,jr) ->
+                        let text:string = leafFormatter obj 
+                        // save the formatted text from the squash
+                        let layout = Leaf(jl,(text :> obj),jr) 
+                        let textWidth = text.Length
+                        let rec fitLeaf breaks pos =
+                          if pos + textWidth <= maxWidth then
+                              breaks,layout,pos + textWidth,textWidth // great, it fits 
+                          else
+                              match forceBreak breaks with
+                              | None                 -> 
+                                  breaks,layout,pos + textWidth,textWidth // tough, no more breaks 
+                              | Some (breaks,saving) -> 
+                                  let pos = pos - saving 
+                                  fitLeaf breaks pos
+                       
+                        fitLeaf breaks pos
+                    | Node (jl,l,jm,r,jr,joint) ->
+                        let mid = if jm then 0 else 1
+                        match joint with
+                        | Unbreakable    ->
+                            let breaks,l,pos,offsetl = fit breaks (pos,l)    // fit left 
+                            let pos = pos + mid                              // fit space if juxt says so 
+                            let breaks,r,pos,offsetr = fit breaks (pos,r)    // fit right 
+                            breaks,Node (jl,l,jm,r,jr,Unbreakable),pos,offsetl + mid + offsetr
+                        | Broken indent ->
+                            let breaks,l,pos,offsetl = fit breaks (pos,l)    // fit left 
+                            let pos = pos - offsetl + indent                 // broken so - offset left + ident 
+                            let breaks,r,pos,offsetr = fit breaks (pos,r)    // fit right 
+                            breaks,Node (jl,l,jm,r,jr,Broken indent),pos,indent + offsetr
+                        | Breakable indent ->
+                            let breaks,l,pos,offsetl = fit breaks (pos,l)    // fit left 
+                            // have a break possibility, with saving 
+                            let saving = offsetl + mid - indent
+                            let pos = pos + mid
+                            if saving>0 then
+                                let breaks = pushBreak saving breaks
+                                let breaks,r,pos,offsetr = fit breaks (pos,r)
+                                let breaks,broken = popBreak breaks
+                                if broken then
+                                    breaks,Node (jl,l,jm,r,jr,Broken indent)   ,pos,indent + offsetr
+                                else
+                                    breaks,Node (jl,l,jm,r,jr,Breakable indent),pos,offsetl + mid + offsetr
+                            else
+                                // actually no saving so no break 
+                                let breaks,r,pos,offsetr = fit breaks (pos,r)
+                                breaks,Node (jl,l,jm,r,jr,Breakable indent)  ,pos,offsetl + mid + offsetr
+               
+               //Printf.printf "\nDone:     pos=%d offset=%d" pos offset;
+                breaks,layout,pos,offset
+           
+            let breaks = breaks0 ()
+            let pos = 0
+            let _,layout,_,_ = fit breaks (pos,layout)
+            layout
+
+        // -------------------------------------------------------------------------
+        // showL
+        // ------------------------------------------------------------------------
+
+        let combine strs = System.String.Concat(Array.ofList(strs) : string[])
+        let showL opts leafFormatter layout =
+            let push x rstrs = x::rstrs
+            let z0 = [],0
+            let addText (rstrs,i) (text:string) = push text rstrs,i + text.Length
+            let index   (_,i)               = i
+            let extract rstrs = combine(List.rev rstrs) 
+            let newLine (rstrs,_) n     = // \n then spaces... 
+                let indent = new System.String(' ', n)
+                let rstrs = push "\n"   rstrs
+                let rstrs = push indent rstrs
+                rstrs,n
+
+            // addL: pos is tab level 
+            let rec addL z pos layout = 
+                match layout with 
+                | Leaf (_,obj,_)                 -> 
+                    let text = leafFormatter obj 
+                    addText z text
+                | Node (_,l,_,r,_,Broken indent) 
+                     // Print width = 0 implies 1D layout, no squash
+                     when not (opts.PrintWidth = 0)  -> 
+                    let z = addL z pos l
+                    let z = newLine z (pos+indent)
+                    let z = addL z (pos+indent) r
+                    z
+                | Node (_,l,jm,r,_,_)             -> 
+                    let z = addL z pos l
+                    let z = if jm then z else addText z " "
+                    let pos = index z
+                    let z = addL z pos r
+                    z
+                | Attr (_,_,l) ->
+                    addL z pos l
+           
+            let rstrs,_ = addL z0 0 layout
+            extract rstrs
+
+
+        // -------------------------------------------------------------------------
+        // outL
+        // ------------------------------------------------------------------------
+
+        let outL outAttribute leafFormatter (chan : TextWriter) layout =
+            // write layout to output chan directly 
+            let write (s:string) = chan.Write(s)
+            // z is just current indent 
+            let z0 = 0
+            let index i = i
+            let addText z text  = write text;  (z + text.Length)
+            let newLine _ n     = // \n then spaces... 
+                let indent = new System.String(' ',n)
+                chan.WriteLine();
+                write indent;
+                n
+                
+            // addL: pos is tab level 
+            let rec addL z pos layout = 
+                match layout with 
+                | Leaf (_,obj,_)                 -> 
+                    let text = leafFormatter obj 
+                    addText z text
+                | Node (_,l,_,r,_,Broken indent) -> 
+                    let z = addL z pos l
+                    let z = newLine z (pos+indent)
+                    let z = addL z (pos+indent) r
+                    z
+                | Node (_,l,jm,r,_,_)             -> 
+                    let z = addL z pos l
+                    let z = if jm then z else addText z " "
+                    let pos = index z
+                    let z = addL z pos r
+                    z 
+                | Attr (tag,attrs,l) ->
+                let _ = outAttribute tag attrs true
+                let z = addL z pos l
+                let _ = outAttribute tag attrs false
+                z
+           
+            let _ = addL z0 0 layout
+            ()
+
+        // --------------------------------------------------------------------
+        // pprinter: using general-purpose reflection...
+        // -------------------------------------------------------------------- 
+          
+        let getValueInfo bindingFlags (x:'a) = Value.GetInfo bindingFlags (x:'a)
+
+        let unpackCons recd =
+            match recd with 
+            | [(_,h);(_,t)] -> (h,t)
+            | _             -> failwith "unpackCons"
+
+        let getListValueInfo bindingFlags (x:obj) =
+            match x with 
+            | null -> None 
+            | _ -> 
+                match getValueInfo bindingFlags x with
+                | ConstructorValue ("Cons",recd) -> Some (unpackCons recd)
+                | ConstructorValue ("Empty",[]) -> None
+                | _ -> failwith "List value had unexpected ValueInfo"
+
+        let compactCommaListL xs = sepListL (sepL ",") xs // compact, no spaces around "," 
+        let nullL = wordL "null"
+        let measureL = wordL "()"
+          
+        // --------------------------------------------------------------------
+        // pprinter: attributes
+        // -------------------------------------------------------------------- 
+
+        let makeRecordVerticalL nameXs =
+            let itemL (name,xL) = let labelL = wordL name in ((labelL ^^ wordL "=")) -- (xL  ^^ (rightL ";"))
+            let braceL xs = (leftL "{") ^^ xs ^^ (rightL "}")
+            braceL (aboveListL (List.map itemL nameXs))
+
+        let makeRecordHorizontalL nameXs = (* This is a more compact rendering of records - and is more like tuples *)
+            let itemL (name,xL) = let labelL = wordL name in ((labelL ^^ wordL "=")) -- xL
+            let braceL xs = (leftL "{") ^^ xs ^^ (rightL "}")
+            braceL (sepListL (rightL ";")  (List.map itemL nameXs))
+
+        let makeRecordL nameXs = makeRecordVerticalL nameXs (* REVIEW: switch to makeRecordHorizontalL ? *)
+
+        let makePropertiesL nameXs =
+            let itemL (name,v) = 
+               let labelL = wordL name 
+               (labelL ^^ wordL "=")
+               ^^ (match v with 
+                   | None -> wordL "?" 
+                   | Some xL -> xL)
+               ^^ (rightL ";")
+            let braceL xs = (leftL "{") ^^ xs ^^ (rightL "}")
+            braceL (aboveListL (List.map itemL nameXs))
+
+        let makeListL itemLs =
+            (leftL "[") 
+            ^^ sepListL (rightL ";") itemLs 
+            ^^ (rightL "]")
+
+        let makeArrayL xs =
+            (leftL "[|") 
+            ^^ sepListL (rightL ";") xs 
+            ^^ (rightL "|]")
+
+        let makeArray2L xs = leftL "[" ^^ aboveListL xs ^^ rightL "]"  
+
+        // --------------------------------------------------------------------
+        // pprinter: anyL - support functions
+        // -------------------------------------------------------------------- 
+
+        let getProperty (obj: obj) name =
+            let ty = obj.GetType()
+#if FX_NO_CULTURE_INFO_ARGS
+            ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |])
+#else
+            ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],CultureInfo.InvariantCulture)
+#endif
+
+        let formatChar isChar c = 
+            match c with 
+            | '\'' when isChar -> "\\\'"
+            | '\"' when not isChar -> "\\\""
+            //| '\n' -> "\\n"
+            //| '\r' -> "\\r"
+            //| '\t' -> "\\t"
+            | '\\' -> "\\\\"
+            | '\b' -> "\\b"
+            | _ when System.Char.IsControl(c) -> 
+                 let d1 = (int c / 100) % 10 
+                 let d2 = (int c / 10) % 10 
+                 let d3 = int c % 10 
+                 "\\" + d1.ToString() + d2.ToString() + d3.ToString()
+            | _ -> c.ToString()
+            
+        let formatString (s:string) =
+            let rec check i = i < s.Length && not (System.Char.IsControl(s,i)) && s.[i] <> '\"' && check (i+1) 
+            let rec conv i acc = if i = s.Length then combine (List.rev acc) else conv (i+1) (formatChar false s.[i] :: acc)  
+            "\"" + s + "\""
+            // REVIEW: should we check for the common case of no control characters? Reinstate the following?
+            //"\"" + (if check 0 then s else conv 0 []) + "\""
+
+        let formatStringInWidth (width:int) (str:string) =
+            // Return a truncated version of the string, e.g.
+            //   "This is the initial text, which has been truncat"+[12 chars]
+            //
+            // Note: The layout code forces breaks based on leaf size and possible break points.
+            //       It does not force leaf size based on width.
+            //       So long leaf-string width can not depend on their printing context...
+            //
+            // The suffix like "+[dd chars]" is 11 chars.
+            //                  12345678901
+            let suffixLength    = 11 // turning point suffix length
+            let prefixMinLength = 12 // arbitrary. If print width is reduced, want to print a minimum of information on strings...
+            let prefixLength = max (width - 2 (*quotes*) - suffixLength) prefixMinLength
+            "\"" + (str.Substring(0,prefixLength)) + "\"" + "+[" + (str.Length - prefixLength).ToString() + " chars]"
+
+        // --------------------------------------------------------------------
+        // pprinter: anyL
+        // -------------------------------------------------------------------- 
+                           
+        type Precedence = 
+            | BracketIfTupleOrNotAtomic = 2
+            | BracketIfTuple = 3
+            | NeverBracket = 4
+
+        // In fsi.exe, certain objects are not printed for top-level bindings.
+        [<StructuralEquality; NoComparison>]
+        type ShowMode = 
+            | ShowAll 
+            | ShowTopLevelBinding
+
+        // polymorphic and inner recursion limitations prevent us defining polyL in the recursive loop 
+        let polyL bindingFlags (objL: ShowMode -> int -> Precedence -> ValueInfo -> obj -> Layout) showMode i prec  (x:'a) (* x could be null *) =
+            objL showMode i prec (getValueInfo bindingFlags (x:'a))  (box x) 
+
+        let anyL showMode bindingFlags (opts:FormatOptions) (x:'a) =
+            // showMode = ShowTopLevelBinding on the outermost expression when called from fsi.exe,
+            // This allows certain outputs, e.g. objects that would print as <seq> to be suppressed, etc. See 4343.
+            // Calls to layout proper sub-objects should pass showMode = ShowAll.
+
+            // Precedences to ensure we add brackets in the right places
+            
+            // Keep a record of objects encountered along the way
+            let path = Dictionary<obj,int>(10,HashIdentity.Reference)
+
+            // Roughly count the "nodes" printed, e.g. leaf items and inner nodes, but not every bracket and comma.
+            let size = ref opts.PrintSize
+            let exceededPrintSize() = !size<=0
+            let countNodes n = if !size > 0 then size := !size - n else () (* no need to keep decrementing (and avoid wrap around) *)
+            let stopShort _ = exceededPrintSize() // for unfoldL
+
+            // Recursive descent
+            let rec objL depthLim prec (x:obj) = polyL bindingFlags objWithReprL ShowAll  depthLim prec x (* showMode for inner expr *)
+            and sameObjL depthLim prec (x:obj) = polyL bindingFlags objWithReprL showMode depthLim prec x (* showMode preserved *)
+
+            and objWithReprL showMode depthLim prec (info:ValueInfo) (x:obj) (* x could be null *) =
+                try
+                  if depthLim<=0 || exceededPrintSize() then wordL "..." else
+                  match x with 
+                  | null -> 
+                    reprL showMode (depthLim-1) prec info x
+                  | _    ->
+                    if (path.ContainsKey(x)) then 
+                       wordL "..."
+                    else 
+                        path.Add(x,0);
+                        let res = 
+                          // Lazy<T> values. VS2008 used StructuredFormatDisplayAttribute to show via ToString. Dev10 (no attr) needs a special case.
+                          let ty = x.GetType()
+                          if ty.IsGenericType && ty.GetGenericTypeDefinition() = typedefof<Lazy<_>> then
+                            Some (wordL (x.ToString()))
+                          else
+                            // Try the StructuredFormatDisplayAttribute extensibility attribute
+                            match x.GetType().GetCustomAttributes (typeof<StructuredFormatDisplayAttribute>, true) with
+                            | null | [| |] -> None
+                            | res -> 
+                               let attr = (res.[0] :?> StructuredFormatDisplayAttribute) 
+                               let txt = attr.Value
+                               if txt = null || txt.Length <= 1 then  
+                                   None
+                               else
+                                  let p1 = txt.IndexOf ("{", StringComparison.Ordinal)
+                                  let p2 = txt.LastIndexOf ("}", StringComparison.Ordinal)
+                                  if p1 < 0 || p2 < 0 || p1+1 >= p2 then 
+                                      None 
+                                  else
+                                      let preText = if p1 <= 0 then "" else txt.[0..p1-1]
+                                      let postText = if p2+1 >= txt.Length then "" else txt.[p2+1..]
+                                      let prop = txt.[p1+1..p2-1]
+                                      match catchExn (fun () -> getProperty x prop) with
+                                        | Choice2Of2 e -> Some (wordL ("<StructuredFormatDisplay exception: " + e.Message + ">"))
+                                        | Choice1Of2 alternativeObj ->
+                                            try 
+                                                let alternativeObjL = 
+                                                  match alternativeObj with 
+                                                      // A particular rule is that if the alternative property
+                                                      // returns a string, we turn off auto-quoting and esaping of
+                                                      // the string, i.e. just treat the string as display text.
+                                                      // This allows simple implementations of 
+                                                      // such as
+                                                      //
+                                                      //    [<StructuredFormatDisplay("{StructuredDisplayString}I")>]
+                                                      //    type BigInt(signInt:int, v : BigNat) =
+                                                      //        member x.StructuredDisplayString = x.ToString()
+                                                      //
+                                                      | :? string as s -> sepL s
+                                                      | _ -> sameObjL (depthLim-1) Precedence.BracketIfTuple alternativeObj
+                                                countNodes 0 (* 0 means we do not count the preText and postText *)
+                                                Some (leftL preText ^^ alternativeObjL ^^ rightL postText)
+                                            with _ -> 
+                                              None
+
+                        let res = 
+                            match res with 
+                            | Some res -> res
+                            | None     -> reprL showMode (depthLim-1) prec info x
+                        path .Remove(x) |> ignore;
+                        res
+                with
+                  e ->
+                    countNodes 1
+                    wordL ("Error: " + e.Message)
+
+            and recdAtomicTupleL depthLim recd =
+                // tuples up args to UnionConstruction or ExceptionConstructor. no node count.
+                match recd with 
+                | [(_,x)] -> objL depthLim Precedence.BracketIfTupleOrNotAtomic x 
+                | txs     -> leftL "(" ^^ compactCommaListL (List.map (snd >> objL depthLim Precedence.BracketIfTuple) txs) ^^ rightL ")" 
+
+            and bracketIfL b basicL =
+                if b then (leftL "(") ^^ basicL ^^ (rightL ")") else basicL
+
+            and reprL showMode depthLim prec repr x (* x could be null *) =
+                let showModeFilter lay = match showMode with ShowAll -> lay | ShowTopLevelBinding -> emptyL                                                             
+                match repr with 
+                | TupleValue vals -> 
+                    let basicL = sepListL (rightL ",") (List.map (objL depthLim Precedence.BracketIfTuple ) vals)
+                    bracketIfL (prec <= Precedence.BracketIfTuple) basicL 
+
+                | RecordValue items -> 
+                    let itemL (name,x) =
+                      countNodes 1 // record labels are counted as nodes. [REVIEW: discussion under 4090].
+                      (name,objL depthLim Precedence.BracketIfTuple x)
+                    makeRecordL (List.map itemL items)
+
+                | ConstructorValue (constr,recd) when (* x is List<T>. Note: "null" is never a valid list value. *)
+                                                      x<>null && Type.IsListType (x.GetType()) ->
+                    match constr with 
+                    | "Cons" -> 
+                        let (x,xs) = unpackCons recd
+                        let project xs = getListValueInfo bindingFlags xs
+                        let itemLs = objL depthLim Precedence.BracketIfTuple x :: boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) project stopShort xs (opts.PrintLength - 1)
+                        makeListL itemLs
+                    | _ ->
+                        countNodes 1
+                        wordL "[]" 
+
+                | ConstructorValue(nm,[])   ->
+                    countNodes 1
+                    (wordL nm)
+
+                | ConstructorValue(nm,recd) ->
+                    countNodes 1 (* e.g. Some (Some (Some (Some 2))) should count for 5 *)
+                    (wordL nm --- recdAtomicTupleL depthLim recd) |> bracketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic)
+
+                | ExceptionValue(ty,recd) ->
+                    countNodes 1
+                    let name = ty.Name 
+                    match recd with
+                      | []   -> (wordL name)
+                      | recd -> (wordL name --- recdAtomicTupleL depthLim recd) |> bracketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic)
+
+                | FunctionClosureValue ty ->
+                    // Q: should function printing include the ty.Name? It does not convey much useful info to most users, e.g. "clo at 0_123".    
+                    countNodes 1
+                    wordL ("<fun:"+ty.Name+">") |> showModeFilter
+
+                | ObjectValue(obj)  ->
+                    match obj with 
+                    | null -> (countNodes 1; nullL)
+                    | _ -> 
+                    let ty = obj.GetType()
+                    match obj with 
+                    | :? string as s ->
+                        countNodes 1
+                        wordL (formatString s)  
+                    | :? System.Array as arr -> 
+                        match arr.Rank with
+                        | 1 -> 
+                             let n = arr.Length
+                             let b1 = arr.GetLowerBound(0) 
+                             let project depthLim = if depthLim=(b1+n) then None else Some (box (arr.GetValue(depthLim)),depthLim+1)
+                             let itemLs = boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) project stopShort b1 opts.PrintLength
+                             makeArrayL (if b1 = 0 then itemLs else wordL("bound1="+string_of_int b1)::itemLs)
+                        | 2 -> 
+                             let n1 = arr.GetLength(0)
+                             let n2 = arr.GetLength(1)
+                             let b1 = arr.GetLowerBound(0) 
+                             let b2 = arr.GetLowerBound(1) 
+                             let project2 x y =
+                               if x>=(b1+n1) || y>=(b2+n2) then None
+                               else Some (box (arr.GetValue(x,y)),y+1)
+                             let rowL x = boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) (project2 x) stopShort b2 opts.PrintLength |> makeListL
+                             let project1 x = if x>=(b1+n1) then None else Some (x,x+1)
+                             let rowsL  = boundedUnfoldL rowL project1 stopShort b1 opts.PrintLength
+                             makeArray2L (if b1=0 && b2 = 0 then rowsL else wordL("bound1=" + string_of_int b1)::wordL("bound2=" + string_of_int b2)::rowsL)
+                          | n -> 
+                             makeArrayL [wordL("rank=" + string_of_int n)]
+                        
+                    // Format 'set' and 'map' nicely
+                    | _ when  
+                          (let ty = obj.GetType()
+                           ty.IsGenericType && (ty.GetGenericTypeDefinition() = typedefof<Map<int,int>> 
+                                                || ty.GetGenericTypeDefinition() = typedefof<Set<int>>) ) ->
+                         let ty = obj.GetType()
+                         let word = if ty.GetGenericTypeDefinition() = typedefof<Map<int,int>> then "map" else "set"
+                         let possibleKeyValueL v = 
+                             if word = "map" &&
+                                (match v with null -> false | _ -> true) && 
+                                v.GetType().IsGenericType && 
+                                v.GetType().GetGenericTypeDefinition() = typedefof<KeyValuePair<int,int>> then
+                                  objL depthLim Precedence.BracketIfTuple (v.GetType().GetProperty("Key").GetValue(v, [| |]), 
+                                                                           v.GetType().GetProperty("Value").GetValue(v, [| |]))
+                             else
+                                  objL depthLim Precedence.BracketIfTuple v
+                         let it = (obj :?>  System.Collections.IEnumerable).GetEnumerator() 
+                         try 
+                           let itemLs = boundedUnfoldL possibleKeyValueL (fun () -> if it.MoveNext() then Some(it.Current,()) else None) stopShort () (1+opts.PrintLength/12)
+                           (wordL word --- makeListL itemLs) |> bracketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic)
+                         finally 
+                            match it with 
+                            | :? System.IDisposable as e -> e.Dispose()
+                            | _ -> ()
+
+                    | :? System.Collections.IEnumerable as ie ->
+                         if opts.ShowIEnumerable then
+                           let word = "seq"
+                           let it = ie.GetEnumerator() 
+                           try 
+                             let itemLs = boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) (fun () -> if it.MoveNext() then Some(it.Current,()) else None) stopShort () (1+opts.PrintLength/30)
+                             (wordL word --- makeListL itemLs) |> bracketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic)
+                           finally 
+                              match it with 
+                              | :? System.IDisposable as e -> e.Dispose()
+                              | _ -> ()
+                             
+                         else
+                           // Sequence printing is turned off for declared-values, and maybe be disabled to users.
+                           // There is choice here, what to print? <seq> or ... or ?
+                           // Also, in the declared values case, if the sequence is actually a known non-lazy type (list, array etc etc) we could print it.  
+                           wordL "<seq>" |> showModeFilter
+                    | _ ->
+                         if showMode = ShowTopLevelBinding && typeUsesSystemObjectToString (obj.GetType()) then
+                           emptyL
+                         else
+                           countNodes 1
+                           let basicL = LayoutOps.objL obj  // This buries an obj in the layout, rendered at squash time via a leafFormatter.
+                                                            // If the leafFormatter was directly here, then layout leaves could store strings.
+                           match obj with 
+                           | _ when opts.ShowProperties ->
+                              let props = ty.GetProperties(BindingFlags.GetField ||| BindingFlags.Instance ||| BindingFlags.Public)
+                              // massively reign in deep printing of properties 
+                              let nDepth = depthLim/10
+                              System.Array.Sort((props:>System.Array),{ new System.Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> PropertyInfo).Name) ((p2 :?> PropertyInfo).Name) } );
+                              if props.Length = 0 || (nDepth <= 0) then basicL 
+                              else basicL --- 
+                                     (props 
+                                      |> Array.toList 
+                                      |> List.map (fun p -> (p.Name,(try Some (objL nDepth Precedence.BracketIfTuple (getProperty obj p.Name)) 
+                                                                     with _ -> None)))
+                                      |> makePropertiesL)
+                           | _ -> basicL 
+                | UnitValue -> countNodes 1; measureL
+
+            polyL bindingFlags objWithReprL showMode opts.PrintDepth Precedence.BracketIfTuple x
+
+        // --------------------------------------------------------------------
+        // pprinter: leafFormatter
+        // --------------------------------------------------------------------
+
+#if Suggestion4299
+        // See bug 4299. Suppress FSI_dddd+<etc> from fsi printer.
+        let fixupForInteractiveFSharpClassesWithNoToString obj (text:string) =
+              // Given obj:T.
+              // If T is a nested type inside a parent type called FSI_dddd, then it looks like an F# Interactive type.
+              // Further, if the .ToString() text starts with "FSI_dddd+T" then it looks like it's the default ToString.
+              // A better test: it is default ToString if the MethodInfo.DeclaringType is System.Object.
+              // In this case, replace "FSI_dddd+T" by "T".
+              // assert(obj <> null)
+              let fullName = obj.GetType().FullName // e.g. "FSI_0123+Name"
+              let name     = obj.GetType().Name     // e.g. "Name"
+              let T = obj.GetType()      
+              if text.StartsWith(fullName) then
+                  // text could be a default .ToString() since it starts with the FullName of the type. More checks...
+                  if T.IsNested &&
+                     T.DeclaringType.Name.StartsWith("FSI_") &&                             // Name has "FSI_" which is 
+                     T.DeclaringType.Name.Substring(4) |> Seq.forall System.Char.IsDigit    // followed by digits?
+                  then
+                      name ^ text.Substring(fullName.Length)    // replace fullName by name at start of text
+                  else
+                      text
+              else
+                text
+#endif
+
+        let leafFormatter (opts:FormatOptions) (obj :obj) =
+            match obj with 
+            | null -> "null"
+            | :? double as d -> 
+                let s = d.ToString(opts.FloatingPointFormat,opts.FormatProvider)
+                if System.Double.IsNaN(d) then "nan"
+                elif System.Double.IsNegativeInfinity(d) then "-infinity"
+                elif System.Double.IsPositiveInfinity(d) then "infinity"
+                elif opts.FloatingPointFormat.[0] = 'g'  && String.forall(fun c -> System.Char.IsDigit(c) || c = '-')  s
+                then s + ".0" 
+                else s
+            | :? single as d -> 
+                (if System.Single.IsNaN(d) then "nan"
+                 elif System.Single.IsNegativeInfinity(d) then "-infinity"
+                 elif System.Single.IsPositiveInfinity(d) then "infinity"
+                 elif opts.FloatingPointFormat.Length >= 1 && opts.FloatingPointFormat.[0] = 'g' 
+                  && float32(System.Int32.MinValue) < d && d < float32(System.Int32.MaxValue) 
+                  && float32(int32(d)) = d 
+                 then (System.Convert.ToInt32 d).ToString(opts.FormatProvider) + ".0"
+                 else d.ToString(opts.FloatingPointFormat,opts.FormatProvider)) 
+                + "f"
+            | :? System.Decimal as d -> d.ToString("g",opts.FormatProvider) + "M"
+            | :? uint64 as d -> d.ToString(opts.FormatProvider) + "UL"
+            | :? int64  as d -> d.ToString(opts.FormatProvider) + "L"
+            | :? int32  as d -> d.ToString(opts.FormatProvider)
+            | :? uint32 as d -> d.ToString(opts.FormatProvider) + "u"
+            | :? int16  as d -> d.ToString(opts.FormatProvider) + "s"
+            | :? uint16 as d -> d.ToString(opts.FormatProvider) + "us"
+            | :? sbyte  as d -> d.ToString(opts.FormatProvider) + "y"
+            | :? byte   as d -> d.ToString(opts.FormatProvider) + "uy"
+            | :? nativeint as d -> d.ToString() + "n"
+            | :? unativeint  as d -> d.ToString() + "un"
+            | :? bool   as b -> (if b then "true" else "false")
+            | :? char   as c -> "\'" + formatChar true c + "\'"
+            | _ -> try  let text = obj.ToString()
+                        text
+                   with e ->
+                     // If a .ToString() call throws an exception, catch it and use the message as the result.
+                     // This may be informative, e.g. division by zero etc...
+                     "<ToString exception: " + e.Message + ">" 
+
+        let any_to_layout opts x = anyL ShowAll BindingFlags.Public opts x
+
+        let squash_layout opts l = 
+            // Print width = 0 implies 1D layout, no squash
+            if opts.PrintWidth = 0 then 
+                l 
+            else 
+                l |> squashTo (opts.PrintWidth,leafFormatter opts)
+
+        let output_layout opts oc l = 
+            l |> squash_layout opts 
+              |> outL opts.AttributeProcessor (leafFormatter opts) oc
+
+        let layout_to_string opts l = 
+            l |> squash_layout opts 
+              |> showL opts (leafFormatter opts) 
+
+        let output_any_ex opts oc x = x |> any_to_layout opts |> output_layout opts oc
+
+        let output_any oc x = output_any_ex FormatOptions.Default oc x
+
+        let layout_as_string opts x = x |> any_to_layout opts |> layout_to_string opts
+
+        let any_to_string x = layout_as_string FormatOptions.Default x
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fsi
new file mode 100644
index 0000000..ca62cbd
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sformat.fsi
@@ -0,0 +1,186 @@
+//=========================================================================
+// (c) Microsoft Corporation 2005-2009. 
+//=========================================================================
+
+namespace Microsoft.FSharp.Text.StructuredFormat
+
+    open System
+    open System.IO
+
+    /// Data representing joints in structured layouts of terms.  The representation
+    /// of this data type is only for the consumption of formatting engines.
+    [<StructuralEquality; NoComparison>]
+    type Joint =
+        | Unbreakable
+        | Breakable of int
+        | Broken of int
+
+    /// Data representing structured layouts of terms.  The representation
+    /// of this data type is only for the consumption of formatting engines.
+    [<NoEquality; NoComparison>]
+    type Layout =
+     | Leaf of bool * obj * bool
+     | Node of bool * Layout * bool * Layout * bool * Joint
+     | Attr of string * (string * string) list * Layout
+
+
+    type IEnvironment = 
+        /// Return to the layout-generation 
+        /// environment to layout any otherwise uninterpreted object
+        abstract GetLayout : obj -> Layout
+        /// The maximum number of elements for which to generate layout for 
+        /// list-like structures, or columns in table-like 
+        /// structures.  -1 if no maximum.
+        abstract MaxColumns : int
+        /// The maximum number of rows for which to generate layout for table-like 
+        /// structures.  -1 if no maximum.
+        abstract MaxRows : int
+      
+    /// A layout is a sequence of strings which have been joined together.
+    /// The strings are classified as words, separators and left and right parenthesis.
+    /// This classification determines where spaces are inserted.
+    /// A joint is either unbreakable, breakable or broken.
+    /// If a joint is broken the RHS layout occurs on the next line with optional indentation.
+    /// A layout can be squashed to for given width which forces breaks as required.
+    module LayoutOps =
+
+        /// The empty layout
+        val emptyL     : Layout
+        /// Is it the empty layout?
+        val isEmptyL   : layout:Layout -> bool
+        
+        /// An uninterpreted leaf, to be interpreted into a string
+        /// by the layout engine. This allows leaf layouts for numbers, strings and
+        /// other atoms to be customized according to culture.
+        val objL       : value:obj -> Layout
+
+        /// An string leaf 
+        val wordL      : text:string -> Layout
+        /// An string which requires no spaces either side.
+        val sepL       : text:string -> Layout
+        /// An string which is right parenthesis (no space on the left).
+        val rightL     : text:string -> Layout
+        /// An string which is left  parenthesis (no space on the right).
+        val leftL      : text:string -> Layout
+
+        /// Join, unbreakable. 
+        val ( ^^ )     : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join, possible break with indent=0
+        val ( ++ )     : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join, possible break with indent=1
+        val ( -- )     : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join, possible break with indent=2 
+        val ( --- )    : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join broken with ident=0
+        val ( @@ )     : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join broken with ident=1 
+        val ( @@- )    : layout1:Layout -> layout2:Layout -> Layout   
+        /// Join broken with ident=2 
+        val ( @@-- )   : layout1:Layout -> layout2:Layout -> Layout   
+
+        /// Join layouts into a comma separated list.
+        val commaListL : layouts:Layout list -> Layout
+          
+        /// Join layouts into a space separated list.    
+        val spaceListL : layouts:Layout list -> Layout
+          
+        /// Join layouts into a semi-colon separated list.
+        val semiListL  : layouts:Layout list -> Layout
+
+        /// Join layouts into a list separated using the given Layout.
+        val sepListL   : layout1:Layout -> layouts:Layout list -> Layout
+
+        /// Wrap round brackets around Layout.
+        val bracketL   : Layout:Layout -> Layout
+        /// Wrap square brackets around layout.    
+        val squareBracketL   : layout:Layout -> Layout
+        /// Wrap braces around layout.        
+        val braceL     : layout:Layout -> Layout
+        /// Form tuple of layouts.            
+        val tupleL     : layouts:Layout list -> Layout
+        /// Layout two vertically.
+        val aboveL     : layout1:Layout -> layout2:Layout -> Layout
+        /// Layout list vertically.    
+        val aboveListL : layouts:Layout list -> Layout
+
+        /// Layout like an F# option.
+        val optionL    : selector:('T -> Layout) -> value:'T option -> Layout
+        /// Layout like an F# list.    
+        val listL      : selector:('T -> Layout) -> value:'T list   -> Layout
+
+        /// See tagL
+        val tagAttrL : text:string -> maps:(string * string) list -> layout:Layout -> Layout
+
+        /// For limitting layout of list-like sequences (lists,arrays,etc).
+        /// unfold a list of items using (project and z) making layout list via itemL.
+        /// If reach maxLength (before exhausting) then truncate.
+        val unfoldL : selector:('T -> Layout) -> folder:('State -> ('T * 'State) option) -> state:'State -> count:int -> Layout list
+
+    /// A record of options to control structural formatting.
+    /// For F# Interactive properties matching those of this value can be accessed via the 'fsi'
+    /// value.
+    /// 
+    /// Floating Point format given in the same format accepted by System.Double.ToString,
+    /// e.g. f6 or g15.
+    ///
+    /// If ShowProperties is set the printing process will evaluate properties of the values being
+    /// displayed.  This may cause additional computation.  
+    ///
+    /// The ShowIEnumerable is set the printing process will force the evalution of IEnumerable objects
+    /// to a small, finite depth, as determined by the printing parameters.
+    /// This may lead to additional computation being performed during printing.
+    ///
+    /// <example>
+    /// From F# Interactive the default settings can be adjusted using, for example, 
+    /// <pre>
+    ///   open Microsoft.FSharp.Compiler.Interactive.Settings;;
+    ///   setPrintWidth 120;;
+    /// </pre>
+    /// </example>
+    [<NoEquality; NoComparison>]
+    type FormatOptions = 
+        { FloatingPointFormat: string
+          AttributeProcessor: (string -> (string * string) list -> bool -> unit);
+          FormatProvider: System.IFormatProvider
+          BindingFlags: System.Reflection.BindingFlags
+          PrintWidth : int 
+          PrintDepth : int 
+          PrintLength : int
+          PrintSize : int  
+          ShowProperties : bool
+          ShowIEnumerable: bool  }
+        static member Default : FormatOptions
+
+    module Display = 
+
+
+        /// Convert any value to a string using a standard formatter
+        /// Data is typically formatted in a structured format, e.g.
+        /// lists are formatted using the "[1;2]" notation.
+        /// The details of the format are not specified and may change
+        /// from version to version and according to the flags given
+        /// to the F# compiler.  The format is intended to be human-readable,
+        /// not machine readable.  If alternative generic formats are required
+        /// you should develop your own formatter, using the code in the
+        /// implementation of this file as a starting point.
+        ///
+        /// Data from other .NET languages is formatted using a virtual
+        /// call to Object.ToString() on the boxed version of the input.
+        val any_to_string: value:'T -> string
+
+        /// Ouput any value to a channel using the same set of formatting rules
+        /// as any_to_string
+        val output_any: writer:TextWriter -> value:'T -> unit
+
+        val any_to_layout   : options:FormatOptions -> value:'T -> Layout
+        val squash_layout   : options:FormatOptions -> layout:Layout -> Layout
+        val output_layout   : options:FormatOptions -> writer:TextWriter -> layout:Layout -> unit
+        val layout_as_string: options:FormatOptions -> value:'T -> string
+
+        /// Convert any value to a layout using the given formatting options.  The
+        /// layout can then be processed using formatting display engines such as
+        /// those in the LayoutOps module.  any_to_string and output_any are
+        /// built using any_to_layout with default format options.
+        val layout_to_string: options:FormatOptions -> layout:Layout -> string
+
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fs
new file mode 100644
index 0000000..4b39975
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fs
@@ -0,0 +1,65 @@
+// (c) Microsoft Corporation 2005-2009. 
+module Microsoft.FSharp.Compatibility.OCaml.Sys
+
+#nowarn "52" // defensive value copy warning, only with warning level 4
+
+open System
+open System.Reflection
+open Microsoft.FSharp.Control
+
+#if FX_NO_COMMAND_LINE_ARGS
+#else
+let argv = System.Environment.GetCommandLineArgs()
+#endif
+let file_exists  (s:string) = System.IO.File.Exists(s)
+let remove (s:string) = System.IO.File.Delete(s)
+let rename (s:string) (s2:string) = System.IO.File.Move(s,s2)
+
+#if FX_NO_ENVIRONMENT
+#else
+let getenv (s:string) =
+    match System.Environment.GetEnvironmentVariable(s) with 
+    | null -> raise (System.Collections.Generic.KeyNotFoundException("the given environment variable was not found"))
+    | s -> s
+#endif
+
+#if FX_NO_PROCESS_START
+#else
+let command (s:string) = 
+    let psi = new System.Diagnostics.ProcessStartInfo("cmd","/c "^s) 
+    psi.UseShellExecute <- false;
+    let p = System.Diagnostics.Process.Start(psi) 
+    p.WaitForExit();
+    p.ExitCode
+#endif
+
+let chdir (s:string) = System.IO.Directory.SetCurrentDirectory(s)
+let getcwd () = System.IO.Directory.GetCurrentDirectory()
+
+let word_size = sizeof<int> * 8
+
+#if FX_NO_PROCESS_DIAGNOSTICS
+#else
+// Sys.time only returns the process time from the main thread
+// The documentation doesn't guarantee that thread 0 is the main thread, 
+// but it always appears to be.  
+let mainThread = 
+    lazy 
+      (let thisProcess = System.Diagnostics.Process.GetCurrentProcess() 
+       let threads = thisProcess.Threads 
+       threads.[0])
+
+
+let time() = 
+    try mainThread.Force().TotalProcessorTime.TotalSeconds
+    with _ -> 
+      // If the above failed, e.g. because main thread has exited, then do the following
+      System.Diagnostics.Process.GetCurrentProcess().UserProcessorTime.TotalSeconds
+#endif
+
+#if FX_NO_APP_DOMAINS
+#else
+let executable_name = 
+    System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,
+                           System.AppDomain.CurrentDomain.FriendlyName)  
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fsi
new file mode 100644
index 0000000..516966d
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/sys.fsi
@@ -0,0 +1,84 @@
+//==========================================================================
+// (c) Microsoft Corporation 2005-2008.  The interface to the module 
+// is similar to that found in versions of other ML implementations, 
+// but is not an exact match.  The type signatures in this interface
+// are an edited version of those generated automatically by running 
+// "bin\fsc.exe -i" on the implementation file.
+//===========================================================================
+
+/// Sys: Basic system operations (for ML compatibility)
+///
+/// This module is only included to make it possible to cross-compile 
+/// code with other ML compilers.  It may be deprecated and/or removed in 
+/// a future release. You may wish to use .NET functions directly instead. 
+[<CompilerMessage("This module is for ML compatibility. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+module Microsoft.FSharp.Compatibility.OCaml.Sys
+
+#if FX_NO_COMMAND_LINE_ARGS
+#else
+/// The array of command line options. Gives the command line arguments
+/// as returned by <c>System.Environment.GetCommandLineArgs</c>.
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.Environment.GetCommandLineArgs directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val argv: string array
+#endif
+
+/// Returns true if a file currently exists, using System.IO.File.Exists(s).
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.File.Exists directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val file_exists: string -> bool
+
+#if FX_NO_ENVIRONMENT
+#else
+/// Call System.Environment.GetEnvironmentVariable. Raise <c>KeyNotFoundException</c> if the variable is not defined.
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.Environment.GetEnvironmentVariable directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val getenv: string -> string
+#endif
+
+/// Deletes a file using <c>System.IO.File.Delete</c>.
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.File.Delete directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val remove: string -> unit
+
+/// Rename a file on disk using System.IO.File.Move  
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.File.Move directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val rename: string -> string -> unit
+
+/// Sets the current working directory for the process using <c>System.IO.Directory.SetCurrentDirectory</c> 
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.Directory.SetCurrentDirectory directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val chdir: string -> unit
+
+/// Returns the current working directory for the process using <c>System.IO.Directory.GetCurrentDirectory</c>
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.IO.Directory.GetCurrentDirectory directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val getcwd: unit -> string
+
+#if FX_NO_PROCESS_START
+#else
+/// Run the command and return it's exit code.
+///
+/// Warning: 'command' currently attempts to execute the string using 
+/// the 'cmd.exe' shell processor.  If it is not present on the system 
+/// then the operation will fail.  Use System.Diagnostics.Process 
+/// directly to run commands in a portable way, which involves specifying 
+/// the program to run and the arguments independently.
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.Diagnostics.Process directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val command: string -> int
+#endif
+
+#if FX_NO_APP_DOMAINS
+#else
+/// Path of the current executable, using
+/// <c>System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory,System.AppDomain.CurrentDomain.FriendlyName)</c>
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.AppDomain.CurrentDomain.FriendlyName directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val executable_name: string
+#endif
+
+/// The number of bits in the "int" type.
+[<CompilerMessage("This construct is for ML compatibility. Consider using sizeof<int> directly, where this returns a size in bytes. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val word_size: int
+
+#if FX_NO_PROCESS_DIAGNOSTICS
+#else
+/// Time consumed by the main thread. (for approximate timings).
+/// Generally returns only the processor time used by the main 
+/// thread of the application.
+[<CompilerMessage("This construct is for ML compatibility. Consider using System.Diagnostics.Process.GetCurrentProcess().UserProcessorTime.TotalSeconds directly. This message can be disabled using '--nowarn:62' or '#nowarn \"62\"'.", 62, IsHidden=true)>]
+val time: unit -> float
+#endif
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint16.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint16.fs
new file mode 100644
index 0000000..092d889
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint16.fs
@@ -0,0 +1,47 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+open Microsoft.FSharp.Core
+open Microsoft.FSharp.Collections
+open Microsoft.FSharp.Core.Operators
+open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using the F# overloaded operators such as 'int' and 'float' to convert numbers")>]
+module UInt16 = 
+
+    let compare (x:uint16) y = compare x y
+
+    let zero = 0us
+    let one = 1us
+    let add (x:uint16) (y:uint16) = x + y
+    let sub (x:uint16) (y:uint16) = x - y
+    let mul (x:uint16) (y:uint16) = x * y
+    let div (x:uint16) (y:uint16) = x / y
+    let rem (x:uint16) (y:uint16) = x % y
+    let succ (x:uint16) = x + 1us
+    let pred (x:uint16) = x - 1us
+    let max_int = 0xFFFFus
+    let min_int = 0us
+    let logand (x:uint16) (y:uint16) = x &&& y
+    let logor (x:uint16) (y:uint16) = x ||| y
+    let logxor (x:uint16) (y:uint16) = x ^^^ y
+    let lognot (x:uint16) = ~~~ x
+    let shift_left (x:uint16) (n:int) =  x <<< n
+    let shift_right (x:uint16) (n:int) =  x >>> n
+
+    let of_int (n:int)    = uint16 n
+    let to_int (x:uint16) = int x
+
+    let of_int16 (n:int16)  = uint16 n
+    let to_int16 (x:uint16) = int16 x
+
+    let of_int32 (n:int32)  = uint16 n
+    let to_int32 (x:uint16) = int32 x
+
+    let of_uint32 (n:uint32) = uint16 n
+    let to_uint32 (x:uint16) = uint32 x
+
+    let of_uint8 (n:uint8) = uint16 n
+    let to_uint8 (x:uint16) = byte x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fs
new file mode 100644
index 0000000..9aa416e
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fs
@@ -0,0 +1,59 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module UInt32 = 
+
+    let compare (x:uint32) y = compare x y
+
+    let zero = 0ul
+    let one = 1ul
+    let add (x:uint32) (y:uint32) = x + y
+    let sub (x:uint32) (y:uint32) = x - y
+    let mul (x:uint32) (y:uint32) = x * y
+    let div (x:uint32) (y:uint32) = x / y
+    let rem (x:uint32) (y:uint32) = x % y
+    let succ (x:uint32) = x + 1ul
+    let pred (x:uint32) = x - 1ul
+    let max_int = 0xFFFFFFFFul
+    let min_int = 0ul 
+    let logand (x:uint32) (y:uint32) = x &&& y
+    let logor (x:uint32) (y:uint32) = x ||| y
+    let logxor (x:uint32) (y:uint32) = x ^^^ y
+    let lognot (x:uint32) = ~~~x
+    let shift_left (x:uint32) (n:int) =  x <<< n
+    let shift_right (x:uint32) (n:int) =  x >>> n
+    let of_int (x:int) =  uint32 x
+    let to_int (x:uint32) = int x
+    let of_int32 (x:int32) =  uint32 x
+    let to_int32 (x:uint32) = int32 x
+
+    let of_float (x:float) =  uint32 x
+    let to_float (x:uint32) =  float x
+
+    let of_string (s:string) = try uint32 s with _ -> failwith "UInt32.of_string"
+    let to_string (x:uint32) = (box x).ToString()
+
+    let bits_of_float32 (x:float32) = 
+        System.BitConverter.ToUInt32(System.BitConverter.GetBytes(x),0)
+          
+    let float32_of_bits (x:uint32) = 
+        System.BitConverter.ToSingle(System.BitConverter.GetBytes(x),0)
+
+    let float32_to_float (x:float32) = float x
+    let float_to_float32 (x:float) = float32 x
+
+    let float_of_bits x = float32_to_float (float32_of_bits x)
+    let bits_of_float x = bits_of_float32 (float_to_float32 x)
+
+    let of_unativeint (x:unativeint) =  uint32 x
+    let to_unativeint (x:uint32) =  unativeint x
+
+    let of_uint64 (x:uint64) =  uint32 x
+    let to_uint64 (x:uint32) =  uint64 x
+
+
+
+    let of_float32 (x:float32) =  uint32 x
+    let to_float32 (x:uint32) =  float32 x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fsi
new file mode 100644
index 0000000..e368fa9
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint32.fsi
@@ -0,0 +1,61 @@
+// (c) Microsoft Corporation 2005-2009.
+
+namespace Microsoft.FSharp.Compatibility
+
+/// UInt32: ML-like operations on 32-bit System.UInt32 numbers.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using operators such as 'int32' and 'uint32' to convert numbers")>]
+module UInt32 = 
+
+    val zero: uint32
+    val one: uint32
+    val pred: uint32 -> uint32
+    val max_int: uint32
+    val min_int: uint32
+    val succ: uint32 -> uint32
+
+    val add: uint32 -> uint32 -> uint32
+    val div: uint32 -> uint32 -> uint32
+    val mul: uint32 -> uint32 -> uint32
+    val rem: uint32 -> uint32 -> uint32
+    val sub: uint32 -> uint32 -> uint32
+
+    val compare: uint32 -> uint32 -> int
+
+    val logand: uint32 -> uint32 -> uint32
+    val lognot: uint32 -> uint32
+    val logor: uint32 -> uint32 -> uint32
+    val logxor: uint32 -> uint32 -> uint32
+    val shift_left: uint32 -> int -> uint32
+    val shift_right: uint32 -> int -> uint32
+
+    val of_float: float -> uint32
+    val to_float: uint32 -> float
+
+    val of_float32: float32 -> uint32
+    val to_float32: uint32 -> float32
+
+    (* Conversions to int are included because int is the most convenient *)
+    (* integer type to use from F#.  Otherwise conversions are either to *)
+    (* integers of the same size or same sign *)
+    val of_int: int -> uint32
+    val to_int: uint32 -> int
+
+    val of_int32: int32 -> uint32
+    val to_int32: uint32 -> int32
+
+    val of_uint64: uint64 -> uint32
+    val to_uint64: uint32 -> uint64
+
+    val of_unativeint: unativeint -> uint32
+    val to_unativeint: uint32 -> unativeint
+
+    val of_string: string -> uint32
+    val to_string: uint32 -> string
+
+    val float_of_bits: uint32 -> float
+    val bits_of_float: float -> uint32
+
+    val float32_of_bits: uint32 -> float32
+    val bits_of_float32: float32 -> uint32
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fs
new file mode 100644
index 0000000..3287323
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fs
@@ -0,0 +1,44 @@
+// (c) Microsoft Corporation 2005-2009. 
+
+namespace Microsoft.FSharp.Compatibility
+
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+module UInt64 = 
+
+    let compare (x:uint64) y = compare x y
+
+    let zero = 0UL
+    let one = 1UL
+    let add (x:uint64) (y:uint64) = x + y
+    let sub (x:uint64) (y:uint64) = x - y
+    let mul (x:uint64) (y:uint64) = x * y
+    let div (x:uint64) (y:uint64) = x / y
+    let rem (x:uint64) (y:uint64) = x % y
+    let succ (x:uint64) = x + 1UL
+    let pred (x:uint64) = x - 1UL
+    let max_int = 0xFFFFFFFFFFFFFFFFUL
+    let min_int = 0x0UL
+    let logand (x:uint64) (y:uint64)   = x &&& y
+    let logor  (x:uint64) (y:uint64)   = x ||| y
+    let logxor (x:uint64) (y:uint64)   = x ^^^ y
+    let lognot (x:uint64)              = ~~~x
+    let shift_left  (x:uint64) (n:int) =  x <<< n
+    let shift_right (x:uint64) (n:int) =  x >>> n
+    let of_int        (n:int)             = uint64 n
+    let to_int        (x:uint64)          = int x
+    let of_uint32     (n:uint32)          = uint64 n
+    let to_uint32     (x:uint64)          = uint32 x
+    let of_int64      (n:int64)           = uint64 n
+    let to_int64      (x:uint64)          = int64 x
+    let of_unativeint (n:unativeint)      = uint64 n
+    let to_unativeint (x:uint64)          = unativeint x
+    let of_float      (f:float)           = uint64 f
+    let to_float      (x:uint64)          = float x
+
+    let of_string (s:string) = try uint64 s with _ -> failwith "UInt64.of_string"
+    let to_string (x:uint64) = (box x).ToString()
+    let bits_of_float (x:float) = System.BitConverter.ToUInt64(System.BitConverter.GetBytes(x),0)
+    let float_of_bits (x:uint64) = System.BitConverter.ToDouble(System.BitConverter.GetBytes(x),0)
+
+    let of_float32 (f:float32) =  uint64 f
+    let to_float32 (x:uint64) =  float32 x
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fsi b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fsi
new file mode 100644
index 0000000..8f533c4
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/FSharp.PowerPack/uint64.fsi
@@ -0,0 +1,55 @@
+// (c) Microsoft Corporation 2005-2009.  
+
+namespace Microsoft.FSharp.Compatibility
+
+/// UInt64: basic operations on 64-bit System.UInt64 numbers.
+[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
+[<System.Obsolete("Consider using operators such as 'int32' and 'uint64' to convert numbers")>]
+module UInt64 = 
+
+    val zero: uint64
+    val one: uint64
+    val pred: uint64 -> uint64
+    val succ: uint64 -> uint64
+    val max_int: uint64
+    val min_int: uint64
+
+    val add: uint64 -> uint64 -> uint64
+    val div: uint64 -> uint64 -> uint64
+    val mul: uint64 -> uint64 -> uint64
+    val rem: uint64 -> uint64 -> uint64
+    val sub: uint64 -> uint64 -> uint64
+
+    val compare: uint64 -> uint64 -> int
+
+    val logand: uint64 -> uint64 -> uint64
+    val lognot: uint64 -> uint64
+    val logor: uint64 -> uint64 -> uint64
+    val logxor: uint64 -> uint64 -> uint64
+    val shift_left: uint64 -> int -> uint64
+    val shift_right: uint64 -> int -> uint64
+
+    val of_float: float -> uint64
+    val to_float: uint64 -> float
+
+    val of_float32: float32 -> uint64
+    val to_float32: uint64 -> float32
+
+    val of_int: int -> uint64
+    val to_int: uint64 -> int
+
+    val of_uint32: uint32 -> uint64
+    val to_uint32: uint64 -> uint32
+
+    val of_int64: int64 -> uint64
+    val to_int64: uint64 -> int64
+
+    val of_unativeint: unativeint -> uint64
+    val to_unativeint: uint64 -> unativeint
+
+    val of_string: string -> uint64
+    val to_string: uint64 -> string
+
+    val float_of_bits: uint64 -> float
+    val bits_of_float: float -> uint64
+
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/assemblyinfo.Common.fs b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/assemblyinfo.Common.fs
new file mode 100644
index 0000000..f8ea9e0
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/assemblyinfo.Common.fs
@@ -0,0 +1,8 @@
+module Test.PowerPack.BuildSettings
+
+[<Literal>]
+let Version = "0.0.0.1"
+
+[<assembly:System.Reflection.AssemblyVersion(Version)>]
+[<assembly:System.Reflection.AssemblyFileVersion(Version)>]
+do()
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.pubkey b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.pubkey
new file mode 100644
index 0000000..1c49691
Binary files /dev/null and b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.pubkey differ
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.snk b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.snk
new file mode 100644
index 0000000..29c85e1
Binary files /dev/null and b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fs.snk differ
diff --git a/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fsppack.vs2008.sln b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fsppack.vs2008.sln
new file mode 100644
index 0000000..10701d2
--- /dev/null
+++ b/tests/fsharp/tools/FSharp.PowerPack/fsppack/src/fsppack.vs2008.sln
@@ -0,0 +1,44 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D78E3B57-DAD1-4FE1-9DC8-84F7847B0C77}"
+	ProjectSection(SolutionItems) = preProject
+		..\Makefile = ..\Makefile
+		fsppack-build.proj = fsppack-build.proj
+		setup\alternative-install-vs2008.bat = setup\alternative-install-vs2008.bat
+		source-build-version = source-build-version
+		version = version
+		version-redirect = version-redirect
+		wix\product.wxs = wix\product.wxs
+		wix\script.fsx = wix\script.fsx
+	EndProjectSection
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test.PowerPack", "FSharp.PowerPack\Test.PowerPack.fsproj", "{649FA588-F02E-457C-9FCF-87E46407481F}"
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test.Compiler.CodeDom", "FSharp.Compiler.CodeDom\Test.Compiler.CodeDom.fsproj", "{9EF49218-FD64-43A8-922B-84B1FF576773}"
+EndProject
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test.PowerPack.Linq", "FSharp.PowerPack.Linq\Test.PowerPack.Linq.fsproj", "{4C2ED03B-5ACE-427B-8285-AD333E60F35E}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = preSolution
+		{4C2ED03B-5ACE-427B-8285-AD333E60F35E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{4C2ED03B-5ACE-427B-8285-AD333E60F35E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{4C2ED03B-5ACE-427B-8285-AD333E60F35E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{4C2ED03B-5ACE-427B-8285-AD333E60F35E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{649FA588-F02E-457C-9FCF-87E46407481F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{649FA588-F02E-457C-9FCF-87E46407481F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{649FA588-F02E-457C-9FCF-87E46407481F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{649FA588-F02E-457C-9FCF-87E46407481F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9EF49218-FD64-43A8-922B-84B1FF576773}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9EF49218-FD64-43A8-922B-84B1FF576773}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9EF49218-FD64-43A8-922B-84B1FF576773}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9EF49218-FD64-43A8-922B-84B1FF576773}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/tests/fsharp/tools/bundle/build.bat b/tests/fsharp/tools/bundle/build.bat
new file mode 100644
index 0000000..b65761f
--- /dev/null
+++ b/tests/fsharp/tools/bundle/build.bat
@@ -0,0 +1,56 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+if EXIST build.ok DEL /f /q build.ok
+
+call %~d0%~p0..\..\..\config.bat
+
+
+if NOT "%FSC:NOTAVAIL=X%" == "%FSC%" ( 
+  REM Skipping test for FSI.EXE
+  goto Skip
+)
+
+
+"%FSC%" %fsc_flags% --progress --standalone -o:test-one-fsharp-module.exe -g test-one-fsharp-module.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%"  test-one-fsharp-module.exe
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:test_two_fsharp_modules_module_1.dll -g test_two_fsharp_modules_module_1.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%"  test_two_fsharp_modules_module_1.dll
+if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2.exe -g test_two_fsharp_modules_module_2.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%"  test_two_fsharp_modules_module_2.exe
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a --standalone -r:test_two_fsharp_modules_module_1.dll -o:test_two_fsharp_modules_module_2_as_dll.dll -g test_two_fsharp_modules_module_2.fs
+if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%"  test_two_fsharp_modules_module_2_as_dll.dll
+if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/tools/bundle/test-one-fsharp-module.fs b/tests/fsharp/tools/bundle/test-one-fsharp-module.fs
new file mode 100644
index 0000000..61998d2
--- /dev/null
+++ b/tests/fsharp/tools/bundle/test-one-fsharp-module.fs
@@ -0,0 +1,9 @@
+// #Misc #Modules 
+#indent "off"
+
+module Test_one_fsharp_module
+
+let _ = List.iter (fun s -> eprintf "%s" s) ["hello"; " "; "world"]
+let _ = eprintfn "%s" "."
+let _ = exit 0
+
diff --git a/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_1.fs b/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_1.fs
new file mode 100644
index 0000000..bdefc6d
--- /dev/null
+++ b/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_1.fs
@@ -0,0 +1,12 @@
+// #Misc #Modules 
+#indent "off"
+
+module Test_two_fsharp_modules_module_1
+
+let f () = 
+  for i = 1 to 10 do 
+    List.iter (fun s -> eprintf "%s" s) ["hello"; " "; "world"];
+    eprintfn "%s" "."
+  done
+
+
diff --git a/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_2.fs b/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_2.fs
new file mode 100644
index 0000000..1096e59
--- /dev/null
+++ b/tests/fsharp/tools/bundle/test_two_fsharp_modules_module_2.fs
@@ -0,0 +1,8 @@
+// #Misc #Modules 
+#indent "off"
+
+module Test_two_fsharp_modules_module_2
+
+let _ = Test_two_fsharp_modules_module_1.f()
+let _ = exit 0
+
diff --git a/tests/fsharp/tools/eval/build.bat b/tests/fsharp/tools/eval/build.bat
new file mode 100644
index 0000000..a6ff371
--- /dev/null
+++ b/tests/fsharp/tools/eval/build.bat
@@ -0,0 +1,6 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/tools/eval/run.bat b/tests/fsharp/tools/eval/run.bat
new file mode 100644
index 0000000..ceb0a61
--- /dev/null
+++ b/tests/fsharp/tools/eval/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/tools/eval/test.fsx b/tests/fsharp/tools/eval/test.fsx
new file mode 100644
index 0000000..2b6fd81
--- /dev/null
+++ b/tests/fsharp/tools/eval/test.fsx
@@ -0,0 +1,2511 @@
+// #Regression #Conformance #Quotations 
+// Copyright (c) Microsoft Corporation 2005-2007.
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+//
+
+#light
+
+#r @"System.Core.dll"
+#r @"System.Data.Linq.dll"
+
+#nowarn "57"
+
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+open Microsoft.FSharp.Quotations.ExprShape
+
+// Copyright (c) Microsoft Corporation 2005-2008.
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+//
+
+
+open System
+open System.Linq
+open System.Collections.Generic
+open System.Linq.Expressions
+open System.Reflection
+open System.Reflection.Emit
+open Microsoft.FSharp
+open Microsoft.FSharp.Reflection
+open Microsoft.FSharp.Quotations
+open Microsoft.FSharp.Quotations.Patterns
+open Microsoft.FSharp.Quotations.DerivedPatterns
+
+
+module QuotationEvaluation = 
+
+
+    let asExpr x = (x :> Expression)
+
+    let bindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic
+    let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly
+    let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+    let equivHeadTypes (ty1:Type) (ty2:Type) = 
+        isNamedType(ty1) &&
+        if ty1.IsGenericType then 
+          ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+        else 
+          ty1.Equals(ty2)
+
+    let isFunctionType typ = equivHeadTypes typ (typeof<(int -> int)>)
+    let getFunctionType typ = 
+        if not (isFunctionType typ) then invalidArg "typ" "cannot convert recursion except for function types"
+        let tyargs = typ.GetGenericArguments()
+        tyargs.[0], tyargs.[1]
+    
+    let WhileHelper gd b : 'T = 
+        let rec loop () = if gd() then (b(); loop())
+        loop();
+        unbox (box ())
+
+    let ArrayAssignHelper (arr : 'T[]) (idx:int) (elem:'T) : 'unt = 
+        arr.[idx] <- elem;
+        unbox (box ())
+
+
+    let TryFinallyHelper e h = 
+        try e() 
+        finally h()
+
+    let TryWithHelper e filter handler = 
+        try e() 
+        with e when (filter e <> 0) -> handler e
+
+    let WhileMethod = match <@@ WhileHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let ArrayAssignMethod = match <@@ ArrayAssignHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let TryFinallyMethod = match <@@ TryFinallyHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+    let TryWithMethod = match <@@ TryWithHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+
+    module HelperTypes = 
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> unit
+        type ActionHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> unit
+
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 -> 'T6
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> 'T7 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> 'T8 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 -> 'T9 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 -> 'T10 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 -> 'T11 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 -> 'T12 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 -> 'T13 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 -> 'T14 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 -> 'T15 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 -> 'T16 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 -> 'T17 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 -> 'T18 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 -> 'T19 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 -> 'T20 
+        type FuncHelper<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'T8,'T9,'T10, 'T11, 'T12, 'T13, 'T14, 'T15, 'T16, 'T17, 'T18, 'T19, 'T20, 'T21> = delegate of 'T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 * 'T8 * 'T9 * 'T10 * 'T11 * 'T12 * 'T13 * 'T14 * 'T15 * 'T16 * 'T17 * 'T18 * 'T19 * 'T20 -> 'T21 
+
+    open HelperTypes
+    
+    let GetActionType (args:Type[])  = 
+        if args.Length <= 4 then 
+            Expression.GetActionType args
+        else
+            match args.Length with 
+            | 5 -> typedefof<ActionHelper<_,_,_,_,_>>.MakeGenericType args
+            | 6 -> typedefof<ActionHelper<_,_,_,_,_,_>>.MakeGenericType args
+            | 7 -> typedefof<ActionHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+            | 8 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 9 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 10 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 11 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 12 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 13 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 14 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 15 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 16 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 17 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 18 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 19 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 20 -> typedefof<ActionHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | _ -> raise <| new NotSupportedException("Quotation expressions with statements or closures containing more then 20 free variables may not be translated in this release of the F# PowerPack. This is due to limitations in the variable binding expression forms available in LINQ expression trees")
+
+    let GetFuncType (args:Type[])  = 
+        if args.Length <= 5 then 
+            Expression.GetFuncType args
+        else
+            match args.Length with 
+            | 6 -> typedefof<FuncHelper<_,_,_,_,_,_>>.MakeGenericType args
+            | 7 -> typedefof<FuncHelper<_,_,_,_,_,_,_>>.MakeGenericType args
+            | 8 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 9 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 10 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 11 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 12 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 13 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 14 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 15 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 16 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 17 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 18 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 19 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 20 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | 21 -> typedefof<FuncHelper<_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_>>.MakeGenericType args
+            | _ -> raise <| new NotSupportedException("Quotation expressions with statements or closures containing more then 20 free variables may not be translated in this release of the F# PowerPack. This is due to limitations in the variable binding expression forms available in LINQ expression trees")
+            
+
+    let LetRec1Helper (F1:System.Func<_,_,_>) (B:System.Func<_,_>) = 
+        let fhole = ref (Unchecked.defaultof<_>)
+        let f = new System.Func<_,_>(fun x -> F1.Invoke(fhole.Value,x))
+        fhole := f
+        B.Invoke f
+
+    let LetRec2Helper (F1:System.Func<_,_,_,_>) (F2:System.Func<_,_,_,_>) (B:System.Func<_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        B.Invoke(f1,f2)
+
+    let LetRec3Helper (F1:System.Func<_,_,_,_,_>) (F2:System.Func<_,_,_,_,_>) (F3:System.Func<_,_,_,_,_>) (B:System.Func<_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        B.Invoke(f1,f2,f3)
+
+    let LetRec4Helper 
+           (F1:FuncHelper<_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_>) 
+           (B:System.Func<_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        B.Invoke(f1,f2,f3,f4)
+
+
+    let LetRec5Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        B.Invoke(f1,f2,f3,f4,f5)
+
+    let LetRec6Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        B.Invoke(f1,f2,f3,f4,f5,f6)
+
+
+    let LetRec7Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (F7:FuncHelper<_,_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f7hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        f7hole := f7
+        B.Invoke(f1,f2,f3,f4,f5,f6,f7)
+
+
+    let LetRec8Helper 
+           (F1:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F2:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F3:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F4:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F5:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F6:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F7:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (F8:FuncHelper<_,_,_,_,_,_,_,_,_,_>) 
+           (B:FuncHelper<_,_,_,_,_,_,_,_,_>) = 
+        let f1hole = ref (Unchecked.defaultof<_>)
+        let f2hole = ref (Unchecked.defaultof<_>)
+        let f3hole = ref (Unchecked.defaultof<_>)
+        let f4hole = ref (Unchecked.defaultof<_>)
+        let f5hole = ref (Unchecked.defaultof<_>)
+        let f6hole = ref (Unchecked.defaultof<_>)
+        let f7hole = ref (Unchecked.defaultof<_>)
+        let f8hole = ref (Unchecked.defaultof<_>)
+        let f1 = new System.Func<_,_>(fun x -> F1.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f2 = new System.Func<_,_>(fun x -> F2.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f3 = new System.Func<_,_>(fun x -> F3.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f4 = new System.Func<_,_>(fun x -> F4.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f5 = new System.Func<_,_>(fun x -> F5.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f6 = new System.Func<_,_>(fun x -> F6.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f7 = new System.Func<_,_>(fun x -> F7.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        let f8 = new System.Func<_,_>(fun x -> F8.Invoke(f1hole.Value,f2hole.Value,f3hole.Value,f4hole.Value,f5hole.Value,f6hole.Value,f7hole.Value,f8hole.Value,x))
+        f1hole := f1
+        f2hole := f2
+        f3hole := f3
+        f4hole := f4
+        f5hole := f5
+        f6hole := f6
+        f7hole := f7
+        f8hole := f8
+        B.Invoke(f1,f2,f3,f4,f5,f6,f7,f8)
+
+
+    let IsVoidType (ty:System.Type)  = (ty = typeof<System.Void>)
+
+    let SequentialHelper (x:'T) (y:'U) = y
+ 
+    let LinqExpressionHelper (x:'T) : Expression<'T> = failwith ""
+    
+    let MakeFakeExpression (x:Expr) = 
+        let minfo = match <@@ LinqExpressionHelper @@> with Lambda(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find method info"
+        Expr.Call(minfo.GetGenericMethodDefinition().MakeGenericMethod [| x.Type |], [ x ])
+
+    let showAll = BindingFlags.Public ||| BindingFlags.NonPublic 
+
+    let WrapVoid b objOpt args (env: Map<Var,Expression>) (e:Expression) = 
+        if b then 
+            let frees (e:Expr) = e.GetFreeVars()
+            let addFrees e acc = List.foldBack Set.add (frees e |> Seq.toList) acc
+            let fvs = Option.foldBack addFrees objOpt (List.foldBack addFrees args Set.empty) |> Set.toArray
+            let fvsP = fvs |> Array.map (fun v -> (Map.find v env :?> ParameterExpression))
+            let fvtys = fvs |> Array.map (fun v -> v.Type) 
+
+            let dty = GetActionType fvtys 
+            let e = Expression.Lambda(dty,e,fvsP)
+            let d = e.Compile()
+
+            let argtys = Array.append fvtys [| dty |]
+            let delP = Expression.Parameter(dty, "del")
+
+            let m = new System.Reflection.Emit.DynamicMethod("wrapper",typeof<unit>,argtys)
+            let ilg = m.GetILGenerator()
+            
+            ilg.Emit(OpCodes.Ldarg ,fvs.Length)
+            fvs |> Array.iteri (fun i _ -> ilg.Emit(OpCodes.Ldarg ,int16 i))
+            ilg.EmitCall(OpCodes.Callvirt,dty.GetMethod("Invoke",instanceBindingFlags),null)
+            ilg.Emit(OpCodes.Ldnull)
+            ilg.Emit(OpCodes.Ret)
+            let args = Array.append (fvsP |> Array.map asExpr) [| (Expression.Constant(d) |> asExpr) |]
+            Expression.Call((null:Expression),(m:>MethodInfo),args) |> asExpr
+        else
+            e
+
+    let (|GenericEqualityQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.GenericEquality @>
+    let (|EqualsQ|_|)    = (|SpecificCall|_|) <@ ( = ) @>
+    let (|GreaterQ|_|)   = (|SpecificCall|_|) <@ ( > ) @>
+    let (|GreaterEqQ|_|) = (|SpecificCall|_|) <@ ( >=) @>
+    let (|LessQ|_|)      = (|SpecificCall|_|) <@ ( <)  @>
+    let (|LessEqQ|_|) = (|SpecificCall|_|) <@ ( <=) @>
+    let (|NotEqQ|_|) = (|SpecificCall|_|) <@ ( <>) @>
+    let (|NotQ|_|) =  (|SpecificCall|_|) <@ not   @>
+    let (|NegQ|_|) = (|SpecificCall|_|) <@ ( ~-) : int -> int @>
+    let (|PlusQ|_|)      = (|SpecificCall|_|) <@ ( + ) @>
+    let (|DivideQ|_|) = (|SpecificCall|_|) <@ ( / ) @> 
+    let (|MinusQ|_|) = (|SpecificCall|_|) <@ ( - ) @>
+    let (|MultiplyQ|_|) = (|SpecificCall|_|) <@ ( * ) @>
+    let (|ModuloQ|_|) = (|SpecificCall|_|) <@ ( % ) @>
+    let (|ShiftLeftQ|_|) = (|SpecificCall|_|) <@ ( <<< ) @>
+    let (|ShiftRightQ|_|) = (|SpecificCall|_|) <@ ( >>> ) @>
+    let (|BitwiseAndQ|_|) = (|SpecificCall|_|) <@ ( &&& ) @>
+    let (|BitwiseOrQ|_|) = (|SpecificCall|_|) <@ ( ||| ) @>
+    let (|BitwiseXorQ|_|) = (|SpecificCall|_|) <@ ( ^^^ ) @>
+    let (|BitwiseNotQ|_|) = (|SpecificCall|_|) <@ ( ~~~ ) @>
+    let (|CheckedNeg|_|) = (|SpecificCall|_|) <@ Checked.( ~-) : int -> int @>
+    let (|CheckedPlusQ|_|)      = (|SpecificCall|_|) <@ Checked.( + ) @>
+    let (|CheckedMinusQ|_|) = (|SpecificCall|_|) <@ Checked.( - ) @>
+    let (|CheckedMultiplyQ|_|) = (|SpecificCall|_|) <@ Checked.( * ) @>
+    let (|ConvCharQ|_|) = (|SpecificCall|_|) <@ char @>
+    let (|ConvDecimalQ|_|) = (|SpecificCall|_|) <@ decimal @>
+    let (|ConvFloatQ|_|) = (|SpecificCall|_|) <@ float @>
+    let (|ConvFloat32Q|_|) = (|SpecificCall|_|) <@ float32 @>
+    let (|ConvSByteQ|_|) = (|SpecificCall|_|) <@ sbyte @>
+    let (|ConvInt16Q|_|) = (|SpecificCall|_|) <@ int16 @>
+    let (|ConvInt32Q|_|) = (|SpecificCall|_|) <@ int32 @>
+    let (|ConvIntQ|_|) = (|SpecificCall|_|) <@ int @>
+    let (|ConvInt64Q|_|) = (|SpecificCall|_|) <@ int64 @>
+    let (|ConvByteQ|_|) = (|SpecificCall|_|) <@ byte @>
+    let (|ConvUInt16Q|_|) = (|SpecificCall|_|) <@ uint16 @>
+    let (|ConvUInt32Q|_|) = (|SpecificCall|_|) <@ uint32 @>
+    let (|ConvUInt64Q|_|) = (|SpecificCall|_|) <@ uint64 @>
+
+    let (|CheckedConvCharQ|_|) = (|SpecificCall|_|) <@ Checked.char @>
+    let (|CheckedConvSByteQ|_|) = (|SpecificCall|_|) <@ Checked.sbyte @>
+    let (|CheckedConvInt16Q|_|) = (|SpecificCall|_|) <@ Checked.int16 @>
+    let (|CheckedConvInt32Q|_|) = (|SpecificCall|_|) <@ Checked.int32 @>
+    let (|CheckedConvInt64Q|_|) = (|SpecificCall|_|) <@ Checked.int64 @>
+    let (|CheckedConvByteQ|_|) = (|SpecificCall|_|) <@ Checked.byte @>
+    let (|CheckedConvUInt16Q|_|) = (|SpecificCall|_|) <@ Checked.uint16 @>
+    let (|CheckedConvUInt32Q|_|) = (|SpecificCall|_|) <@ Checked.uint32 @>
+    let (|CheckedConvUInt64Q|_|) = (|SpecificCall|_|) <@ Checked.uint64 @>
+    let (|LinqExpressionHelperQ|_|) = (|SpecificCall|_|) <@ LinqExpressionHelper @>
+    let (|ArrayLookupQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.GetArray : int[] -> int -> int @>
+    let (|ArrayAssignQ|_|) = (|SpecificCall|_|) <@ LanguagePrimitives.IntrinsicFunctions.SetArray : int[] -> int -> int -> unit @>
+    let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some(ty.GetElementType()) else None
+    
+    /// Convert F# quotations to LINQ expression trees.
+    /// A more polished LINQ-Quotation translator will be published
+    /// concert with later versions of LINQ.
+    let rec ConvExpr env (inp:Expr) = 
+       //printf "ConvExpr : %A\n" e;
+        match inp with 
+
+        // Generic cases 
+        | Patterns.Var(v) -> Map.find v env
+        | DerivedPatterns.AndAlso(x1,x2)             -> Expression.AndAlso(ConvExpr env x1, ConvExpr env x2) |> asExpr
+        | DerivedPatterns.OrElse(x1,x2)              -> Expression.OrElse(ConvExpr env x1, ConvExpr env x2)  |> asExpr
+        | Patterns.Value(x,ty)                -> Expression.Constant(x,ty)              |> asExpr
+
+        // REVIEW: exact F# semantics for TypeAs and TypeIs
+        | Patterns.Coerce(x,toTy)             -> Expression.TypeAs(ConvExpr env x,toTy)     |> asExpr
+        | Patterns.TypeTest(x,toTy)           -> Expression.TypeIs(ConvExpr env x,toTy)     |> asExpr
+        
+        // Expr.*Get
+        | Patterns.FieldGet(objOpt,fieldInfo) -> 
+            Expression.Field(ConvObjArg env objOpt None, fieldInfo) |> asExpr
+
+        | Patterns.TupleGet(arg,n) -> 
+             let argP = ConvExpr env arg 
+             let rec build ty argP n = 
+                 match Reflection.FSharpValue.PreComputeTuplePropertyInfo(ty,n) with 
+                 | propInfo,None -> 
+                     Expression.Property(argP, propInfo)  |> asExpr
+                 | propInfo,Some(nestedTy,n2) -> 
+                     build nestedTy (Expression.Property(argP,propInfo) |> asExpr) n2
+             build arg.Type argP n
+              
+        | Patterns.PropertyGet(objOpt,propInfo,args) -> 
+            let coerceTo = 
+                if objOpt.IsSome && FSharpType.IsUnion propInfo.DeclaringType && FSharpType.IsUnion propInfo.DeclaringType.BaseType  then  
+                    Some propInfo.DeclaringType
+                else 
+                    None
+            match args with 
+            | [] -> 
+                Expression.Property(ConvObjArg env objOpt coerceTo, propInfo) |> asExpr
+            | _ -> 
+                let argsP = ConvExprs env args
+                Expression.Call(ConvObjArg env objOpt coerceTo, propInfo.GetGetMethod(true),argsP) |> asExpr
+
+        // Expr.*Set
+        | Patterns.PropertySet(objOpt,propInfo,args,v) -> 
+            let args = (args @ [v])
+            let argsP = ConvExprs env args 
+            let minfo = propInfo.GetSetMethod(true)
+            Expression.Call(ConvObjArg env objOpt None, minfo,argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env 
+
+        // Expr.(Call,Application)
+        | Patterns.Call(objOpt,minfo,args) -> 
+            match inp with 
+            // Special cases for this translation
+            |  PlusQ (_, [ty1;ty2;ty3],[x1;x2]) when (ty1 = typeof<string>) && (ty2 = typeof<string>) ->
+                 ConvExpr env (<@@  System.String.Concat( [| %%x1 ; %%x2 |] : string array ) @@>)
+
+            //| SpecificCall <@ LanguagePrimitives.GenericEquality @>([ty1],[x1;x2]) 
+            //| SpecificCall <@ ( = ) @>([ty1],[x1;x2]) when (ty1 = typeof<string>) ->
+            //     ConvExpr env (<@@  System.String.op_Equality(%%x1,%%x2) @@>)
+
+            | GenericEqualityQ (_, _,[x1;x2]) 
+            | EqualsQ (_, _,[x1;x2]) -> Expression.Equal(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+
+            | GreaterQ (_, _,[x1;x2]) -> Expression.GreaterThan(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | GreaterEqQ (_, _,[x1;x2]) -> Expression.GreaterThanOrEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | LessQ (_, _,[x1;x2]) -> Expression.LessThan(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | LessEqQ (_, _,[x1;x2]) -> Expression.LessThanOrEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | NotEqQ (_, _,[x1;x2]) -> Expression.NotEqual(ConvExpr env x1, ConvExpr env x2)       |> asExpr
+            | NotQ (_, _,[x1])    -> Expression.Not(ConvExpr env x1)                                   |> asExpr
+                 /// REVIEW: basic comparison with method witnesses
+
+            | NegQ (_, _,[x1])    -> Expression.Negate(ConvExpr env x1)                                |> asExpr
+            | PlusQ (_, _,[x1;x2]) -> Expression.Add(ConvExpr env x1, ConvExpr env x2)      |> asExpr
+            | DivideQ (_, _,[x1;x2]) -> Expression.Divide (ConvExpr env x1, ConvExpr env x2)  |> asExpr
+            | MinusQ (_, _,[x1;x2]) -> Expression.Subtract(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | MultiplyQ (_, _,[x1;x2]) -> Expression.Multiply(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | ModuloQ (_, _,[x1;x2]) -> Expression.Modulo (ConvExpr env x1, ConvExpr env x2) |> asExpr
+                 /// REVIEW: basic arithmetic with method witnesses
+                 /// REVIEW: negate,add, divide, multiply, subtract with method witness
+
+            | ShiftLeftQ (_, _,[x1;x2]) -> Expression.LeftShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | ShiftRightQ (_, _,[x1;x2]) -> Expression.RightShift(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseAndQ (_, _,[x1;x2]) -> Expression.And(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseOrQ (_, _,[x1;x2]) -> Expression.Or(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseXorQ (_, _,[x1;x2]) -> Expression.ExclusiveOr(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | BitwiseNotQ (_, _,[x1]) -> Expression.Not(ConvExpr env x1) |> asExpr
+                 /// REVIEW: bitwise operations with method witnesses
+
+            | CheckedNeg (_, _,[x1]) -> Expression.NegateChecked(ConvExpr env x1)                                |> asExpr
+            | CheckedPlusQ (_, _,[x1;x2]) -> Expression.AddChecked(ConvExpr env x1, ConvExpr env x2)      |> asExpr
+            | CheckedMinusQ (_, _,[x1;x2]) -> Expression.SubtractChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+            | CheckedMultiplyQ (_, _,[x1;x2]) -> Expression.MultiplyChecked(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+            | ConvCharQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<char>) |> asExpr
+            | ConvDecimalQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<decimal>) |> asExpr
+            | ConvFloatQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<float>) |> asExpr
+            | ConvFloat32Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<float32>) |> asExpr
+            | ConvSByteQ (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<sbyte>) |> asExpr
+            | ConvInt16Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int16>) |> asExpr
+            | ConvInt32Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+            | ConvIntQ (_, [ty],[x1])    -> Expression.Convert(ConvExpr env x1, typeof<int32>) |> asExpr
+            | ConvInt64Q (_, [ty],[x1])  -> Expression.Convert(ConvExpr env x1, typeof<int64>) |> asExpr
+            | ConvByteQ (_, [ty],[x1])   -> Expression.Convert(ConvExpr env x1, typeof<byte>) |> asExpr
+            | ConvUInt16Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint16>) |> asExpr
+            | ConvUInt32Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint32>) |> asExpr
+            | ConvUInt64Q (_, [ty],[x1]) -> Expression.Convert(ConvExpr env x1, typeof<uint64>) |> asExpr
+             /// REVIEW: convert with method witness
+
+            | CheckedConvCharQ (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<char>) |> asExpr
+            | CheckedConvSByteQ (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<sbyte>) |> asExpr
+            | CheckedConvInt16Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int16>) |> asExpr
+            | CheckedConvInt32Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int32>) |> asExpr
+            | CheckedConvInt64Q (_, [ty],[x1])  -> Expression.ConvertChecked(ConvExpr env x1, typeof<int64>) |> asExpr
+            | CheckedConvByteQ (_, [ty],[x1])   -> Expression.ConvertChecked(ConvExpr env x1, typeof<byte>) |> asExpr
+            | CheckedConvUInt16Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint16>) |> asExpr
+            | CheckedConvUInt32Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint32>) |> asExpr
+            | CheckedConvUInt64Q (_, [ty],[x1]) -> Expression.ConvertChecked(ConvExpr env x1, typeof<uint64>) |> asExpr
+            | ArrayLookupQ (_, [ArrayTypeQ(elemTy);_;_],[x1;x2]) -> 
+                Expression.ArrayIndex(ConvExpr env x1, ConvExpr env x2) |> asExpr
+
+            | ArrayAssignQ (_, [ArrayTypeQ(elemTy);_;_],[arr;idx;elem]) -> 
+                let minfo = ArrayAssignMethod.GetGenericMethodDefinition().MakeGenericMethod [| elemTy;typeof<unit> |]
+                Expression.Call(minfo,[| ConvExpr env arr; ConvExpr env idx; ConvExpr env elem |]) |> asExpr
+            
+            // Throw away markers inserted to satisfy C#'s design where they pass an argument
+            // or type T to an argument expecting Expr<T>.
+            | LinqExpressionHelperQ (_, [_],[x1]) -> ConvExpr env x1
+             
+              /// ArrayLength
+              /// ListBind
+              /// ListInit
+              /// ElementInit
+            | _ -> 
+                let argsP = ConvExprs env args 
+                Expression.Call(ConvObjArg env objOpt None, minfo, argsP) |> asExpr |> WrapVoid (IsVoidType minfo.ReturnType) objOpt args env 
+
+        // f x1 x2 x3 x4 --> InvokeFast4
+        | Patterns.Application(Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3),arg4) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let domainTy3, rangeTy = getFunctionType rangeTy
+            let domainTy4, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 5)).MakeGenericMethod [| domainTy3; domainTy4; rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2;arg3; arg4]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 x2 x3 --> InvokeFast3
+        | Patterns.Application(Patterns.Application(Patterns.Application(f,arg1),arg2),arg3) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let domainTy3, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 4)).MakeGenericMethod [| domainTy3; rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2;arg3]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 x2 --> InvokeFast2
+        | Patterns.Application(Patterns.Application(f,arg1),arg2) -> 
+            let domainTy1, rangeTy = getFunctionType f.Type
+            let domainTy2, rangeTy = getFunctionType rangeTy
+            let (-->) ty1 ty2 = Reflection.FSharpType.MakeFunctionType(ty1,ty2)
+            let ty = domainTy1 --> domainTy2 
+            let meth = (ty.GetMethods() |> Array.find (fun minfo -> minfo.Name = "InvokeFast" && minfo.GetParameters().Length = 3)).MakeGenericMethod [| rangeTy |]
+            let argsP = ConvExprs env [f; arg1;arg2]
+            Expression.Call((null:Expression), meth, argsP) |> asExpr
+
+        // f x1 --> Invoke
+        | Patterns.Application(f,arg) -> 
+            let fP = ConvExpr env f
+            let argP = ConvExpr env arg
+            let meth = f.Type.GetMethod("Invoke")
+            Expression.Call(fP, meth, [| argP |]) |> asExpr
+
+        // Expr.New*
+        | Patterns.NewRecord(recdTy,args) -> 
+            let ctorInfo = Reflection.FSharpValue.PreComputeRecordConstructorInfo(recdTy,showAll) 
+            Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+        | Patterns.NewArray(ty,args) -> 
+            Expression.NewArrayInit(ty,ConvExprs env args) |> asExpr
+
+        | Patterns.DefaultValue(ty) -> 
+            Expression.New(ty) |> asExpr
+
+        | Patterns.NewUnionCase(unionCaseInfo,args) -> 
+            let methInfo = Reflection.FSharpValue.PreComputeUnionConstructorInfo(unionCaseInfo,showAll)
+            let argsR = ConvExprs env args 
+            Expression.Call((null:Expression),methInfo,argsR) |> asExpr
+
+        | Patterns.UnionCaseTest(e,unionCaseInfo) -> 
+            let methInfo = Reflection.FSharpValue.PreComputeUnionTagMemberInfo(unionCaseInfo.DeclaringType,showAll)
+            let obj = ConvExpr env e 
+            let tagE = 
+                match methInfo with 
+                | :? PropertyInfo as p -> 
+                    Expression.Property(obj,p) |> asExpr
+                | :? MethodInfo as m -> 
+                    Expression.Call((null:Expression),m,[| obj |]) |> asExpr
+                | _ -> failwith "unreachable case"
+            Expression.Equal(tagE, Expression.Constant(unionCaseInfo.Tag)) |> asExpr
+
+        | Patterns.NewObject(ctorInfo,args) -> 
+            Expression.New(ctorInfo,ConvExprs env args) |> asExpr
+
+        | Patterns.NewDelegate(dty,vs,b) -> 
+            let vsP = List.map ConvVar vs 
+            let env = List.foldBack2 (fun (v:Var) vP -> Map.add v (vP |> asExpr)) vs vsP env 
+            let bodyP = ConvExpr env b 
+            Expression.Lambda(dty, bodyP, vsP) |> asExpr 
+
+        | Patterns.NewTuple(args) -> 
+             let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType
+             let argsP = ConvExprs env args 
+             let rec build ty (argsP: Expression[]) = 
+                 match Reflection.FSharpValue.PreComputeTupleConstructorInfo(ty) with 
+                 | ctorInfo,None -> Expression.New(ctorInfo,argsP) |> asExpr 
+                 | ctorInfo,Some(nestedTy) -> 
+                     let n = ctorInfo.GetParameters().Length - 1
+                     Expression.New(ctorInfo, Array.append argsP.[0..n-1] [| build nestedTy argsP.[n..] |]) |> asExpr
+             build tupTy argsP
+
+        | Patterns.IfThenElse(g,t,e) -> 
+            Expression.Condition(ConvExpr env g, ConvExpr env t,ConvExpr env e) |> asExpr
+
+        | Patterns.Sequential (e1,e2) -> 
+            let e1P = ConvExpr env e1
+            let e2P = ConvExpr env e2
+            let minfo = match <@@ SequentialHelper @@> with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+            let minfo = minfo.GetGenericMethodDefinition().MakeGenericMethod [| e1.Type; e2.Type |]
+            Expression.Call(minfo,[| e1P; e2P |]) |> asExpr
+
+        | Patterns.Let (v,e,b) -> 
+            let vP = ConvVar v
+            let envinner = Map.add v (vP |> asExpr) env 
+            let bodyP = ConvExpr envinner b 
+            let eP = ConvExpr env e
+            let ty = GetFuncType [| v.Type; b.Type |] 
+            let lam = Expression.Lambda(ty,bodyP,[| vP |]) |> asExpr
+            Expression.Call(lam,ty.GetMethod("Invoke",instanceBindingFlags),[| eP |]) |> asExpr
+
+        | Patterns.Lambda(v,body) -> 
+            let vP = ConvVar v
+            let env = Map.add v (vP |> asExpr) env 
+            let tyargs = [| v.Type; body.Type |]
+            let bodyP = ConvExpr env body
+            let convType = typedefof<System.Converter<obj,obj>>.MakeGenericType tyargs
+            let convDelegate = Expression.Lambda(convType, bodyP, [| vP |]) |> asExpr
+            Expression.Call(typeof<FuncConvert>,"ToFSharpFunc",tyargs,[| convDelegate |]) |> asExpr
+    
+        | Patterns.WhileLoop(gd,b) -> 
+            let gdP = ConvExpr env <@@ (fun () -> (%%gd:bool)) @@>
+            let bP = ConvExpr env <@@ (fun () -> (%%b:unit)) @@>
+            let minfo = WhileMethod.GetGenericMethodDefinition().MakeGenericMethod [| typeof<unit> |]
+            Expression.Call(minfo,[| gdP; bP |]) |> asExpr
+        
+        | Patterns.TryFinally(e,h) -> 
+            let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+            let hP = ConvExpr env <@@ (fun () -> (%%h:unit)) @@>
+            let minfo = TryFinallyMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+            Expression.Call(minfo,[| eP; hP |]) |> asExpr
+        
+        | Patterns.TryWith(e,vf,filter,vh,handler) -> 
+            let eP = ConvExpr env (Expr.Lambda(new Var("unitVar",typeof<unit>), e))
+            let filterP = ConvExpr env (Expr.Lambda(vf,filter))
+            let handlerP = ConvExpr env (Expr.Lambda(vh,handler))
+            let minfo = TryWithMethod.GetGenericMethodDefinition().MakeGenericMethod [| e.Type |]
+            Expression.Call(minfo,[| eP; filterP; handlerP |]) |> asExpr
+
+        | Patterns.LetRecursive(binds,body) -> 
+
+            let vfs = List.map fst binds
+            
+            let pass1 = 
+                binds |> List.map (fun (vf,expr) -> 
+                    match expr with 
+                    | Lambda(vx,expr) -> 
+                        let domainTy,rangeTy = getFunctionType vf.Type
+                        let vfdTy = GetFuncType [| domainTy; rangeTy |]
+                        let vfd = new Var("d",vfdTy)
+                        (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd)
+                    | _ -> failwith "cannot convert recursive bindings that do not define functions")
+
+            let trans = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> (vf,vfd)) |> Map.ofList
+
+            // Rewrite uses of the recursively defined functions to be invocations of the delegates
+            // We do this because the delegate are allocated "once" and we can normally just invoke them efficiently
+            let rec rw t = 
+                match t with 
+                | Application(Var(vf),t) when trans.ContainsKey(vf) -> 
+                     let vfd = trans.[vf]
+                     Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[t])
+                | ExprShape.ShapeVar(vf) when trans.ContainsKey(vf)-> 
+                     let vfd = trans.[vf]
+                     let nv = new Var("nv",fst(getFunctionType vf.Type)) 
+                     Expr.Lambda(nv,Expr.Call(Expr.Var(vfd),vfd.Type.GetMethod("Invoke",instanceBindingFlags),[Expr.Var(nv)]))
+                | ExprShape.ShapeVar(_) -> t
+                | ExprShape.ShapeCombination(obj,args) -> ExprShape.RebuildShapeCombination(obj,List.map rw args)
+                | ExprShape.ShapeLambda(v,arg) -> Expr.Lambda(v,rw arg)
+
+            let vfdTys    = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfdTy) |> Array.ofList
+            let vfds      = pass1 |> List.map (fun (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) -> vfd)
+
+            let FPs = 
+                [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+                      let expr = rw expr
+                      let tyF = GetFuncType (Array.append vfdTys [| vx.Type; expr.Type |])
+                      let F = Expr.NewDelegate(tyF,vfds@[vx],expr)
+                      let FP = ConvExpr env F
+                      yield FP |]
+
+            let body = rw body
+
+            let methTys   = 
+                [| for (vf,vx,expr,domainTy,rangeTy,vfdTy,vfd) in pass1 do
+                      yield domainTy
+                      yield rangeTy
+                   yield body.Type |]
+
+            let B = Expr.NewDelegate(GetFuncType (Array.append vfdTys [| body.Type |]),vfds,body)
+            let BP = ConvExpr env B
+
+            let minfo = 
+                let q = 
+                    match vfds.Length with 
+                    | 1 -> <@@ LetRec1Helper @@>
+                    | 2 -> <@@ LetRec2Helper @@>
+                    | 3 -> <@@ LetRec3Helper @@>
+                    | 4 -> <@@ LetRec4Helper @@>
+                    | 5 -> <@@ LetRec5Helper @@>
+                    | 6 -> <@@ LetRec6Helper @@>
+                    | 7 -> <@@ LetRec7Helper @@>
+                    | 8 -> <@@ LetRec8Helper @@>
+                    | _ -> raise <| new NotSupportedException("In this release of the F# Power Pack, mutually recursive function groups involving 9 or more functions may not be converted to LINQ expressions")
+                match q with Lambdas(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find minfo"
+
+            let minfo = minfo.GetGenericMethodDefinition().MakeGenericMethod methTys
+            Expression.Call(minfo,Array.append FPs [| BP |]) |> asExpr
+
+        | Patterns.AddressOf _ -> raise <| new NotSupportedException("Address-of expressions may not be converted to LINQ expressions")
+        | Patterns.AddressSet _ -> raise <| new NotSupportedException("Address-set expressions may not be converted to LINQ expressions")
+        | Patterns.FieldSet _ -> raise <| new NotSupportedException("Field-set expressions may not be converted to LINQ expressions")
+
+        | _ -> 
+            raise <| new NotSupportedException(sprintf "Could not convert the following F# Quotation to a LINQ Expression Tree\n--------\n%A\n-------------\n" inp)
+
+    and ConvObjArg env objOpt coerceTo : Expression = 
+        match objOpt with
+        | Some(obj) -> 
+            let expr = ConvExpr env obj
+            match coerceTo with 
+            | None -> expr
+            | Some ty -> Expression.TypeAs(expr, ty) :> Expression
+        | None -> 
+            null
+
+    and ConvExprs env es : Expression[] = 
+        es |> List.map (ConvExpr env) |> Array.ofList 
+
+    and ConvVar (v: Var) = 
+        //printf "** Expression .Parameter(%a, %a)\n" output_any ty output_any nm;
+        Expression.Parameter(v.Type, v.Name)
+
+    let Conv (e: #Expr) = ConvExpr Map.empty (e :> Expr)
+
+    let Compile (e: #Expr) = 
+       let ty = e.Type
+       let e = Expr.NewDelegate(GetFuncType([|typeof<unit>; ty |]), [new Var("unit",typeof<unit>)],e)
+       let linqExpr = Conv e
+       let linqExpr = (linqExpr :?> LambdaExpression)
+       let d = linqExpr.Compile()
+       (fun () -> 
+           try 
+             d.DynamicInvoke [| box () |]
+           with :? System.Reflection.TargetInvocationException as exn -> 
+               raise exn.InnerException)
+
+    let Eval e = Compile e ()
+
+    type Microsoft.FSharp.Quotations.Expr with 
+        member x.ToLinqExpression() = Conv(x)
+        member x.CompileUntyped() = Compile(x)
+        member x.EvalUntyped() = Eval(x)
+
+    type Microsoft.FSharp.Quotations.Expr<'T> with 
+        member x.Compile() = 
+            let f = Compile(x)  
+            (fun () -> (f()) :?> 'T)
+        member x.Eval() = (Eval(x) :?> 'T)
+
+  
+open QuotationEvaluation
+
+let mutable failures = []
+let report_failure () = 
+  stderr.WriteLine " NO"; 
+
+
+let check  s v1 v2 = 
+   if v1 = v2 then 
+       printfn "test %s...passed " s 
+   else 
+       failures <- failures @ [(s, box v1, box v2)]
+       printfn "test %s...failed, expected %A got %A" s v2 v1
+
+let test s b = check s b true
+
+// The following hopefully is an identity function on quotations:
+let Id (x: Expr<'T>) : Expr<'T> = 
+    let rec conv x = 
+        match x with
+        | ShapeVar _ -> 
+            x
+        | ShapeLambda (head, body) -> 
+            Expr.Lambda (head, conv body)    
+        | ShapeCombination (head, tail) -> 
+            RebuildShapeCombination (head, List.map conv tail)
+    conv x |> Expr.Cast
+
+let Eval (q: Expr<_>) = 
+    q.ToLinqExpression() |> ignore 
+    q.Compile() |> ignore  
+    q.Eval()
+
+let checkEval nm (q : Expr<'T>) expected = 
+    check nm (Eval q) expected
+    check (nm + "(after applying Id)") (Eval (Id q)) expected
+    check (nm + "(after applying Id^2)")  (Eval (Id (Id q))) expected
+
+module EvaluationTests = 
+
+    let f () = () 
+
+    checkEval "cwe90wecmp" (<@ f ()  @> ) ()
+
+    checkEval "vlwjvrwe90" (<@ let f (x:int) (y:int) = x + y in f 1 2  @>) 3
+
+    //debug <- true
+
+
+    checkEval "slnvrwe90" (<@ let rec f (x:int) : int = f x in 1  @>) 1
+
+    checkEval "2ver9ewva" (<@ let rec f1 (x:int) : int = f2 x 
+                              and f2 x = f1 x 
+                              1  @>) 1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 x 
+          and f2 x = f3 x 
+          and f3 x = f1 x 
+          1  @>) 
+      1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = f6 (x-1) 
+          and f6 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+    checkEval "2ver9ewvq" 
+      (<@ let rec f1 (x:int) : int = f2 (x-1) 
+          and f2 x = f3 (x-1) 
+          and f3 x = f4 (x-1) 
+          and f4 x = f5 (x-1) 
+          and f5 x = f6 (x-1) 
+          and f6 x = f7 (x-1) 
+          and f7 x = fend (x-1) 
+          and fend x = if x < 0 then -1 else f1 (x-1) 
+          f1 100  @>) 
+      -1
+
+
+
+    checkEval "2ver9ewv1" (<@ let rec f (x:int) : int = x+x in f 2  @>) 4
+
+    Eval <@ let rec fib x = if x <= 2 then 1 else fib (x-1) + fib (x-2) in fib 36 @> 
+    //(let rec fib x = if x <= 2 then 1 else fib (x-1) + fib (x-2) in fib 36)
+
+    //2.53/0.35
+
+    checkEval "2ver9ewv2" (<@ if true then 1 else 0  @>) 1
+    checkEval "2ver9ewv3" (<@ if false then 1 else 0  @>) 0
+    checkEval "2ver9ewv4" (<@ true && true @>) true
+    checkEval "2ver9ewv5" (<@ true && false @>) false
+    check "2ver9ewv6" (try Eval <@ failwith "fail" : int @> with Failure "fail" -> 1 | _ -> 0) 1 
+    check "2ver9ewv7" (try Eval <@ true && (failwith "fail") @> with Failure "fail" -> true | _ -> false) true
+    checkEval "2ver9ewv8" (<@ 0x001 &&& 0x100 @>) (0x001 &&& 0x100)
+    checkEval "2ver9ewv9" (<@ 0x001 ||| 0x100 @>) (0x001 ||| 0x100)
+    checkEval "2ver9ewvq" (<@ 0x011 ^^^ 0x110 @>) (0x011 ^^^ 0x110)
+    checkEval "2ver9ewvw" (<@ ~~~0x011 @>) (~~~0x011)
+
+    let _ = 1
+    checkEval "2ver9ewve" (<@ () @>) ()
+    check "2ver9ewvr" (Eval <@ (fun x -> x + 1) @> (3)) 4
+    check "2ver9ewvt" (Eval <@ (fun (x,y) -> x + 1) @> (3,4)) 4
+    check "2ver9ewvy" (Eval <@ (fun (x1,x2,x3) -> x1 + x2 + x3) @> (3,4,5)) (3+4+5)
+    check "2ver9ewvu" (Eval <@ (fun (x1,x2,x3,x4) -> x1 + x2 + x3 + x4) @> (3,4,5,6)) (3+4+5+6)
+    check "2ver9ewvi" (Eval <@ (fun (x1,x2,x3,x4,x5) -> x1 + x2 + x3 + x4 + x5) @> (3,4,5,6,7)) (3+4+5+6+7)
+    check "2ver9ewvo" (Eval <@ (fun (x1,x2,x3,x4,x5,x6) -> x1 + x2 + x3 + x4 + x5 + x6) @> (3,4,5,6,7,8)) (3+4+5+6+7+8)
+    check "2ver9ewvp" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7) -> x1 + x2 + x3 + x4 + x5 + x6 + x7) @> (3,4,5,6,7,8,9)) (3+4+5+6+7+8+9)
+    check "2ver9ewva" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8) @> (3,4,5,6,7,8,9,10)) (3+4+5+6+7+8+9+10)
+    check "2ver9ewvs" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9) @> (3,4,5,6,7,8,9,10,11)) (3+4+5+6+7+8+9+10+11)
+    check "2ver9ewvd" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) @> (3,4,5,6,7,8,9,10,11,12)) (3+4+5+6+7+8+9+10+11+12)
+    check "2ver9ewvf" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11) @> (3,4,5,6,7,8,9,10,11,12,13)) (3+4+5+6+7+8+9+10+11+12+13)
+    check "2ver9ewvg" (Eval <@ (fun (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12) -> x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12) @> (3,4,5,6,7,8,9,10,11,12,13,14)) (3+4+5+6+7+8+9+10+11+12+13+14)
+
+    checkEval "2ver9ewvh" (<@ while false do ()  @>) ()
+    checkEval "2ver9ewvj" (<@ let rec f (x:int) : int = f x in 1  @>) 1
+
+    checkEval "2ver9ewvk" (<@ 1 + 1 @>) 2
+    checkEval "2ver9ewvl" (<@ 1 > 1 @>) false
+    checkEval "2ver9ewvz" (<@ 1 < 1 @>) false
+    checkEval "2ver9ewvx" (<@ 1 <= 1 @>) true
+    checkEval "2ver9ewvc" (<@ 1 >= 1 @>) true
+    Eval <@ System.DateTime.Now @>
+    checkEval "2ver9ewvv" (<@ System.Int32.MaxValue @>) System.Int32.MaxValue  // literal field!
+    checkEval "2ver9ewvb" (<@ None  : int option @>) None
+    checkEval "2ver9ewvn" (<@ Some(1)  @>) (Some(1))
+    checkEval "2ver9ewvm" (<@ [] : int list @>) []
+    checkEval "2ver9ewqq" (<@ [1] @>) [1]
+    checkEval "2ver9ewqq" (<@ ["1"] @>) ["1"]
+    checkEval "2ver9ewqq" (<@ ["1";"2"] @>) ["1";"2"]
+    check "2ver9ewww" (Eval <@ (fun x -> x + 1) @> 3) 4
+
+    let v = (1,2)
+    checkEval "2ver9ewer" (<@ v @>) (1,2)
+    checkEval "2ver9ewet" (<@ let x = 1 in x @>) 1
+    checkEval "2ver9ewed" (<@ let x = 1+1 in x+x @>) 4
+    let x = ref 0
+    let incrx () = incr x
+
+    checkEval "2ver9ewvec" (<@ !x @>) 0
+    checkEval "2ver9ewev" (<@ incrx() @>) ()
+    checkEval "2ver9eweb" (<@ !x @>) 3  // NOTE: checkEval evaluates the quotation three times :-)
+    checkEval "2ver9ewen" (<@ while !x < 10 do incrx() @>) ()
+    checkEval "2ver9ewem" (<@ !x @>) 10
+
+    let raise x = Operators.raise x
+    check "2ver9ewveq" (try Eval <@ raise (new System.Exception("hello")) : bool @> with :? System.Exception -> true | _ -> false) true
+
+    
+    check "2ver9ewrf" (let v2 = (3,4) in Eval <@ v2 @>) (3,4)
+    
+    check "2ver9ewrg" (let v2 = (3,4) in Eval <@ v2,v2 @>) ((3,4),(3,4))
+
+    checkEval "2ver9ewrt" (<@ (1,2) @>) (1,2)
+    checkEval "2ver9ewvk" (<@ (1,2,3) @>) (1,2,3)
+    checkEval "2ver9ewrh" (<@ (1,2,3,4) @>) (1,2,3,4)
+    checkEval "2ver9ewrj" (<@ (1,2,3,4,5) @>) (1,2,3,4,5)
+    checkEval "2ver9ewrk" (<@ (1,2,3,4,5,6) @>) (1,2,3,4,5,6)
+    checkEval "2ver9ewrl" (<@ (1,2,3,4,5,6,7) @>) (1,2,3,4,5,6,7)
+    checkEval "2ver9ewra" (<@ (1,2,3,4,5,6,7,8) @>) (1,2,3,4,5,6,7,8)
+    checkEval "2ver9ewrs" (<@ (1,2,3,4,5,6,7,8,9) @>) (1,2,3,4,5,6,7,8,9)
+    checkEval "2ver9ewrx" (<@ (1,2,3,4,5,6,7,8,9,10) @>) (1,2,3,4,5,6,7,8,9,10)
+    checkEval "2ver9ewrc" (<@ (1,2,3,4,5,6,7,8,9,10,11) @>) (1,2,3,4,5,6,7,8,9,10,11)
+    checkEval "2ver9ewrv" (<@ (1,2,3,4,5,6,7,8,9,10,11,12) @>) (1,2,3,4,5,6,7,8,9,10,11,12)
+    checkEval "2ver9ewrb" (<@ System.DateTime.Now.DayOfWeek @>) System.DateTime.Now.DayOfWeek
+    checkEval "2ver9ewrn" (<@ Checked.(+) 1 1 @>) 2
+    checkEval "2ver9ewrm" (<@ Checked.(-) 1 1 @>) 0
+    checkEval "2ver9ewrw" (<@ Checked.( * ) 1 1 @>) 1
+    // TODO (let) : let v2 = (3,4) in Eval <@ match v2 with (x,y) -> x + y @>
+    // TODO: Eval <@ "1" = "2" @>
+
+    module NonGenericRecdTests = 
+        type Customer = { mutable Name:string; Data: int }
+        let c1 = { Name="Don"; Data=6 }
+        let c2 = { Name="Peter"; Data=7 }
+        let c3 = { Name="Freddy"; Data=8 }
+        checkEval "2ver9e1rw1" (<@ c1.Name @>) "Don"
+        checkEval "2ver9e2rw2" (<@ c2.Name @>) "Peter"
+        checkEval "2ver9e3rw3" (<@ c2.Data @>) 7
+        checkEval "2ver9e7rw4" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+        checkEval "2ver9e7rw5" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+
+    module GenericRecdTests = 
+        type CustomerG<'a> = { mutable Name:string; Data: 'a }
+        let c1 : CustomerG<int> = { Name="Don"; Data=6 }
+        let c2 : CustomerG<int> = { Name="Peter"; Data=7 }
+        let c3 : CustomerG<string> = { Name="Freddy"; Data="8" }
+        checkEval "2ver9e4rw6" (<@ c1.Name @>) "Don"
+        checkEval "2ver9e5rw7" (<@ c2.Name @>) "Peter"
+        checkEval "2ver9e6rw8" (<@ c2.Data @>) 7
+        checkEval "2ver9e7rw9" (<@ c3.Data @>) "8"
+        checkEval "2ver9e7rwQ" (<@ { Name = "Don"; Data = 6 } @>) { Name="Don"; Data=6 }
+        checkEval "2ver9e7rwW" (<@ c1.Name <- "Ali Baba" @>) ()
+        checkEval "2ver9e7rwE" (<@ c1.Name  @>) "Ali Baba"
+
+    module ArrayTests = 
+        checkEval "2ver9e8rwR1" (<@ [| |]  @>) ([| |] : int array)
+        checkEval "2ver9e8rwR2" (<@ [| 0 |]  @>) ([| 0 |] : int array)
+        checkEval "2ver9e8rwR3" (<@ [| 0  |].[0]  @>) 0
+        checkEval "2ver9e8rwR4" (<@ [| 1; 2  |].[0]  @>) 1
+        checkEval "2ver9e8rwR5" (<@ [| 1; 2  |].[1]  @>) 2
+
+    module Array2DTests = 
+        checkEval "2ver9e8rwR6" (<@ (Array2D.init 3 4 (fun i j -> i + j)).[0,0] @>) 0
+        checkEval "2ver9e8rwR7" (<@ (Array2D.init 3 4 (fun i j -> i + j)).[1,2] @>) 3
+        checkEval "2ver9e8rwR8" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.base1 @>) 0
+        checkEval "2ver9e8rwR9" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.base2 @>) 0
+        checkEval "2ver9e8rwRQ" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.length1 @>) 3
+        checkEval "2ver9e8rwRW" (<@ (Array2D.init 3 4 (fun i j -> i + j)) |> Array2D.length2 @>) 4
+
+
+    module Array3DTests = 
+        checkEval "2ver9e8rwRE" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)).[0,0,0] @>) 0
+        checkEval "2ver9e8rwRR" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j + k)).[1,2,3] @>) 6
+        checkEval "2ver9e8rwRT" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length1 @>) 3
+        checkEval "2ver9e8rwRY" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length2 @>) 4
+        checkEval "2ver9e8rwRU" (<@ (Array3D.init 3 4 5 (fun i j k -> i + j)) |> Array3D.length3 @>) 5
+
+    module ExceptionTests = 
+        exception E0
+        exception E1 of string
+        let c1 = E0
+        let c2 = E1 "1"
+        let c3 = E1 "2"
+        checkEval "2ver9e8rwR" (<@ E0  @>) E0
+        checkEval "2ver9e8rwT" (<@ E1 "1"  @>) (E1 "1")
+        checkEval "2ver9eQrwY" (<@ match c1 with E0 -> 1 | _ -> 2  @>) 1
+        checkEval "2ver9eQrwU" (<@ match c2 with E0 -> 1 | _ -> 2  @>) 2
+        checkEval "2ver9eQrwI" (<@ match c2 with E0 -> 1 | E1 _  -> 2 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwO" (<@ match c2 with E1 _  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwP" (<@ match c2 with E1 "1"  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwA" (<@ match c2 with E1 "2"  -> 2 | E0 -> 1 | _ -> 3  @>) 3
+        checkEval "2ver9eQrwS" (<@ match c3 with E1 "2"  -> 2 | E0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwD1" (<@ try failwith "" with _ -> 2  @>) 2
+        checkEval "2ver9eQrwD2" (<@ let x = ref 0 in 
+                                    try 
+                                           try failwith "" 
+                                           finally incr x 
+                                    with _ -> !x @>) 1
+        checkEval "2ver9eQrwD3" (<@ let x = ref 0 in 
+                                    (try incr x; incr x
+                                     finally incr x )
+                                    x.Value @>) 3
+        checkEval "2ver9eQrwD4" (<@ try 3 finally () @>) 3
+        checkEval "2ver9eQrwD5" (<@ try () finally () @>) ()
+        checkEval "2ver9eQrwD6" (<@ try () with _ -> () @>) ()
+        checkEval "2ver9eQrwD7" (<@ try raise E0 with E0 -> 2  @>) 2
+        checkEval "2ver9eQrwF" (<@ try raise c1 with E0 -> 2  @>) 2
+        checkEval "2ver9eQrwG" (<@ try raise c2 with E0 -> 2 | E1 "1" -> 3 @>) 3
+        checkEval "2ver9eQrwH" (<@ try raise c2 with E1 "1" -> 3 | E0 -> 2  @>) 3
+
+    module TypeTests = 
+        type C0() = 
+            member x.P = 1
+        type C1(s:string) = 
+            member x.P = s
+        let c1 = C0()
+        let c2 = C1 "1"
+        let c3 = C1 "2"
+        checkEval "2ver9e8rwJ" (<@ C0().P  @>) 1
+        checkEval "2ver9e8rwK" (<@ C1("1").P  @>)  "1"
+        checkEval "2ver9eQrwL" (<@ match box c1 with :? C0 -> 1 | _ -> 2  @>) 1
+        checkEval "2ver9eQrwZ" (<@ match box c2 with :? C0 -> 1 | _ -> 2  @>) 2
+        checkEval "2ver9eQrwX" (<@ match box c2 with :? C0 -> 1 | :? C1   -> 2 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwC" (<@ match box c2 with :? C1   -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwV" (<@ match box c2 with :? C1  -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+        checkEval "2ver9eQrwN" (<@ match box c3 with :? C1  as c1 when c1.P = "2"  -> 2 | :? C0 -> 1 | _ -> 3  @>) 2
+
+    module NonGenericUnionTests0 = 
+        type Animal = Cat of string | Dog
+        let c1 = Cat "meow"
+        let c2 = Dog
+        checkEval "2ver9e8rw11" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw12" (<@ Dog @>) Dog
+        checkEval "2ver9eQrw13" (<@ match c1 with Cat _ -> 2 | Dog -> 1 @>) 2
+        checkEval "2ver9eWrw14" (<@ match c1 with Cat s -> s | Dog -> "woof" @>) "meow"
+        checkEval "2ver9eErw15" (<@ match c2 with Cat s -> s | Dog -> "woof" @>) "woof"
+
+    module NonGenericUnionTests1 = 
+        type Animal = Cat of string 
+        let c1 = Cat "meow"
+        checkEval "2ver9e8rw16" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9eQrw17" (<@ match c1 with Cat _ -> 2  @>) 2
+        checkEval "2ver9eWrw18" (<@ match c1 with Cat s -> s  @>) "meow"
+
+    module NonGenericUnionTests2 = 
+        type Animal = 
+           | Cat of string 
+           | Dog of string
+        let c1 = Cat "meow"
+        let c2 = Dog "woof"
+        checkEval "2ver9e8rw19" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw20" (<@ Dog "bowwow" @>) (Dog "bowwow")
+        checkEval "2ver9eQrw21" (<@ match c1 with Cat _ -> 2 | Dog  _ -> 1 @>) 2
+        checkEval "2ver9eWrw22" (<@ match c1 with Cat s -> s | Dog s -> s @>) "meow"
+        checkEval "2ver9eErw23" (<@ match c2 with Cat s -> s | Dog s -> s @>) "woof"
+
+    module NonGenericUnionTests3 = 
+        type Animal = 
+           | Cat of string 
+           | Dog of string
+           | Dog1 of string
+           | Dog2 of string
+           | Dog3 of string
+           | Dog4 of string
+           | Dog5 of string
+           | Dog6 of string
+           | Dog7 of string
+           | Dog8 of string
+           | Dog9 of string
+           | DogQ of string
+           | DogW of string
+           | DogE of string
+           | DogR of string
+           | DogT of string
+           | DogY of string
+           | DogU of string
+           | DogI of string
+        let c1 = Cat "meow"
+        let c2 = Dog "woof"
+        checkEval "2ver9e8rw24" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw25" (<@ Dog "bowwow" @>) (Dog "bowwow")
+        checkEval "2ver9eQrw26" (<@ match c1 with Cat _ -> 2 | _ -> 1 @>) 2
+        checkEval "2ver9eWrw27" (<@ match c1 with Cat s -> s | _ -> "woof" @>) "meow"
+        checkEval "2ver9eErw28" (<@ match c2 with Cat s -> s | Dog s -> s | _ -> "bark" @>) "woof"
+
+
+    module GenericUnionTests = 
+        type Animal<'a> = Cat of 'a | Dog
+        let c1 = Cat "meow"
+        let c2 = Dog
+        checkEval "2ver9e8rw29" (<@ Cat "sss" @>) (Cat "sss")
+        checkEval "2ver9e9rw30" (<@ Dog @>) Dog
+        checkEval "2ver9eQrw31" (<@ match c1 with Cat _ -> 2 | Dog -> 1 @>) 2
+        checkEval "2ver9eWrw32" (<@ match c1 with Cat s -> s | Dog -> "woof" @>) "meow"
+        checkEval "2ver9eErw33" (<@ match c2 with Cat s -> s | Dog -> "woof" @>) "woof"
+
+    module InlinedOperationsStillDynamicallyAvailableTests = 
+
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericZero<sbyte> @>)  0y
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int16> @>)  0s
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int32> @>)  0
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<int64> @>)  0L
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<nativeint> @>)  0n
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericZero<byte> @>)  0uy
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint16> @>)  0us
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint32> @>)  0u
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<uint64> @>)  0UL
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<unativeint> @>)  0un
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<float> @>)  0.0
+        checkEval "vroievr091" (<@ LanguagePrimitives.GenericZero<float32> @>)  0.0f
+        checkEval "vroievr092" (<@ LanguagePrimitives.GenericZero<decimal> @>)  0M
+
+
+
+        checkEval "vroievr093" (<@ LanguagePrimitives.GenericOne<sbyte> @>)  1y
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int16> @>)  1s
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int32> @>)  1
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<int64> @>)  1L
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<nativeint> @>)  1n
+        checkEval "vroievr193" (<@ LanguagePrimitives.GenericOne<byte> @>)  1uy
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint16> @>)  1us
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint32> @>)  1u
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<uint64> @>)  1UL
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<unativeint> @>)  1un
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<float> @>)  1.0
+        checkEval "vroievr191" (<@ LanguagePrimitives.GenericOne<float32> @>)  1.0f
+        checkEval "vroievr192" (<@ LanguagePrimitives.GenericOne<decimal> @>)  1M
+
+        check "vroievr0971" (LanguagePrimitives.AdditionDynamic 3y 4y) 7y
+        check "vroievr0972" (LanguagePrimitives.AdditionDynamic 3s 4s) 7s
+        check "vroievr0973" (LanguagePrimitives.AdditionDynamic 3 4) 7
+        check "vroievr0974" (LanguagePrimitives.AdditionDynamic 3L 4L) 7L
+        check "vroievr0975" (LanguagePrimitives.AdditionDynamic 3n 4n) 7n
+        check "vroievr0976" (LanguagePrimitives.AdditionDynamic 3uy 4uy) 7uy
+        check "vroievr0977" (LanguagePrimitives.AdditionDynamic 3us 4us) 7us
+        check "vroievr0978" (LanguagePrimitives.AdditionDynamic 3u 4u) 7u
+        check "vroievr0979" (LanguagePrimitives.AdditionDynamic 3UL 4UL) 7UL
+        check "vroievr0970" (LanguagePrimitives.AdditionDynamic 3un 4un) 7un
+        check "vroievr097q" (LanguagePrimitives.AdditionDynamic 3.0 4.0) 7.0
+        check "vroievr097w" (LanguagePrimitives.AdditionDynamic 3.0f 4.0f) 7.0f
+        check "vroievr097e" (LanguagePrimitives.AdditionDynamic 3.0M 4.0M) 7.0M
+
+        check "vroievr097r" (LanguagePrimitives.CheckedAdditionDynamic 3y 4y) 7y
+        check "vroievr097t" (LanguagePrimitives.CheckedAdditionDynamic 3s 4s) 7s
+        check "vroievr097y" (LanguagePrimitives.CheckedAdditionDynamic 3 4) 7
+        check "vroievr097u" (LanguagePrimitives.CheckedAdditionDynamic 3L 4L) 7L
+        check "vroievr097i" (LanguagePrimitives.CheckedAdditionDynamic 3n 4n) 7n
+        check "vroievr097o" (LanguagePrimitives.CheckedAdditionDynamic 3uy 4uy) 7uy
+        check "vroievr097p" (LanguagePrimitives.CheckedAdditionDynamic 3us 4us) 7us
+        check "vroievr097a" (LanguagePrimitives.CheckedAdditionDynamic 3u 4u) 7u
+        check "vroievr097s" (LanguagePrimitives.CheckedAdditionDynamic 3UL 4UL) 7UL
+        check "vroievr097d" (LanguagePrimitives.CheckedAdditionDynamic 3un 4un) 7un
+        check "vroievr097f" (LanguagePrimitives.CheckedAdditionDynamic 3.0 4.0) 7.0
+        check "vroievr097g" (LanguagePrimitives.CheckedAdditionDynamic 3.0f 4.0f) 7.0f
+        check "vroievr097h" (LanguagePrimitives.CheckedAdditionDynamic 3.0M 4.0M) 7.0M
+
+        check "vroievr0912q" (LanguagePrimitives.MultiplyDynamic 3y 4y) 12y
+        check "vroievr0912w" (LanguagePrimitives.MultiplyDynamic 3s 4s) 12s
+        check "vroievr0912e" (LanguagePrimitives.MultiplyDynamic 3 4) 12
+        check "vroievr0912r" (LanguagePrimitives.MultiplyDynamic 3L 4L) 12L
+        check "vroievr0912t" (LanguagePrimitives.MultiplyDynamic 3n 4n) 12n
+        check "vroievr0912y" (LanguagePrimitives.MultiplyDynamic 3uy 4uy) 12uy
+        check "vroievr0912u" (LanguagePrimitives.MultiplyDynamic 3us 4us) 12us
+        check "vroievr0912i" (LanguagePrimitives.MultiplyDynamic 3u 4u) 12u
+        check "vroievr0912o" (LanguagePrimitives.MultiplyDynamic 3UL 4UL) 12UL
+        check "vroievr0912p" (LanguagePrimitives.MultiplyDynamic 3un 4un) 12un
+        check "vroievr0912a" (LanguagePrimitives.MultiplyDynamic 3.0 4.0) 12.0
+        check "vroievr0912s" (LanguagePrimitives.MultiplyDynamic 3.0f 4.0f) 12.0f
+        check "vroievr0912d" (LanguagePrimitives.MultiplyDynamic 3.0M 4.0M) 12.0M
+
+
+        check "vroievr0912f" (LanguagePrimitives.CheckedMultiplyDynamic 3y 4y) 12y
+        check "vroievr0912g" (LanguagePrimitives.CheckedMultiplyDynamic 3s 4s) 12s
+        check "vroievr0912h" (LanguagePrimitives.CheckedMultiplyDynamic 3 4) 12
+        check "vroievr0912j" (LanguagePrimitives.CheckedMultiplyDynamic 3L 4L) 12L
+        check "vroievr0912k" (LanguagePrimitives.CheckedMultiplyDynamic 3n 4n) 12n
+        check "vroievr0912l" (LanguagePrimitives.CheckedMultiplyDynamic 3uy 4uy) 12uy
+        check "vroievr0912z" (LanguagePrimitives.CheckedMultiplyDynamic 3us 4us) 12us
+        check "vroievr0912x" (LanguagePrimitives.CheckedMultiplyDynamic 3u 4u) 12u
+        check "vroievr0912c" (LanguagePrimitives.CheckedMultiplyDynamic 3UL 4UL) 12UL
+        check "vroievr0912v" (LanguagePrimitives.CheckedMultiplyDynamic 3un 4un) 12un
+        check "vroievr0912b" (LanguagePrimitives.CheckedMultiplyDynamic 3.0 4.0) 12.0
+        check "vroievr0912n" (LanguagePrimitives.CheckedMultiplyDynamic 3.0f 4.0f) 12.0f
+        check "vroievr0912m" (LanguagePrimitives.CheckedMultiplyDynamic 3.0M 4.0M) 12.0M
+
+
+        let iarr = [| 0..1000 |]
+        let ilist = [ 0..1000 ]
+
+        let farr = [| 0.0 .. 1.0 .. 100.0 |]
+        let flist = [ 0.0 .. 1.0 .. 100.0 ]
+
+        Array.average farr
+
+        checkEval "vrewoinrv091" (<@ farr.[0] @>) 0.0
+        checkEval "vrewoinrv092" (<@ flist.[0] @>) 0.0
+        checkEval "vrewoinrv093" (<@ iarr.[0] @>) 0
+        checkEval "vrewoinrv094" (<@ ilist.[0] @>) 0
+
+        checkEval "vrewoinrv095" (<@ farr.[0] <- 0.0 @>) ()
+        checkEval "vrewoinrv096" (<@ iarr.[0] <- 0 @>) ()
+
+        checkEval "vrewoinrv097" (<@ farr.[0] <- 1.0 @>) ()
+        checkEval "vrewoinrv098" (<@ iarr.[0] <- 1 @>) ()
+
+        checkEval "vrewoinrv099" (<@ farr.[0] @>) 1.0
+        checkEval "vrewoinrv09q" (<@ iarr.[0] @>) 1
+
+        checkEval "vrewoinrv09w" (<@ farr.[0] <- 0.0 @>) ()
+        checkEval "vrewoinrv09e" (<@ iarr.[0] <- 0 @>) ()
+
+
+        checkEval "vrewoinrv09r" (<@ Array.average farr @>) (Array.average farr)
+        checkEval "vrewoinrv09t" (<@ Array.sum farr @>) (Array.sum farr)
+        checkEval "vrewoinrv09y" (<@ Seq.sum farr @>) (Seq.sum farr)
+        checkEval "vrewoinrv09u" (<@ Seq.average farr @>) (Seq.average farr) 
+        checkEval "vrewoinrv09i" (<@ Seq.average flist @>) (Seq.average flist)
+        checkEval "vrewoinrv09o" (<@ Seq.averageBy (fun x -> x) farr @> ) (Seq.averageBy (fun x -> x) farr )
+        checkEval "vrewoinrv09p" (<@ Seq.averageBy (fun x -> x) flist @>) (Seq.averageBy (fun x -> x) flist )
+        checkEval "vrewoinrv09a" (<@ Seq.averageBy float ilist @>) (Seq.averageBy float ilist)
+        checkEval "vrewoinrv09s" (<@ List.sum flist @>) (List.sum flist)
+        checkEval "vrewoinrv09d" (<@ List.average flist @>) (List.average flist)
+        checkEval "vrewoinrv09f" (<@ List.averageBy float ilist @>) (List.averageBy float ilist)
+
+        checkEval "vrewoinrv09g1" (<@ compare 0 0 = 0 @>) true
+        checkEval "vrewoinrv09g2" (<@ compare 0 1 < 0 @>) true
+        checkEval "vrewoinrv09g3" (<@ compare 1 0 > 0 @>) true
+        checkEval "vrewoinrv09g4" (<@ 0 < 1 @>) true
+        checkEval "vrewoinrv09g5" (<@ 0 <= 1 @>) true
+        checkEval "vrewoinrv09g6" (<@ 1 <= 1 @>) true
+        checkEval "vrewoinrv09g7" (<@ 2 <= 1 @>) false
+        checkEval "vrewoinrv09g8" (<@ 0 > 1 @>) false
+        checkEval "vrewoinrv09g9" (<@ 0 >= 1 @>) false
+        checkEval "vrewoinrv09g0" (<@ 1 >= 1 @>) true
+        checkEval "vrewoinrv09gQ" (<@ 2 >= 1 @>) true
+
+        checkEval "vrewoinrv09gw" (<@ compare 0.0 0.0 = 0 @>) true
+        checkEval "vrewoinrv09ge" (<@ compare 0.0 1.0 < 0 @>) true
+        checkEval "vrewoinrv09gr" (<@ compare 1.0 0.0 > 0 @>) true
+        checkEval "vrewoinrv09gt" (<@ 0.0 < 1.0 @>) true
+        checkEval "vrewoinrv09gy" (<@ 0.0 <= 1.0 @>) true
+        checkEval "vrewoinrv09gu" (<@ 1.0 <= 1.0 @>) true
+        checkEval "vrewoinrv09gi" (<@ 2.0 <= 1.0 @>) false
+        checkEval "vrewoinrv09go" (<@ 0.0 > 1.0 @>) false
+        checkEval "vrewoinrv09gp" (<@ 0.0 >= 1.0 @>) false
+        checkEval "vrewoinrv09ga" (<@ 1.0 >= 1.0 @>) true
+        checkEval "vrewoinrv09gs" (<@ 2.0 >= 1.0 @>) true
+
+        checkEval "vrewoinrv09gd" (<@ compare 0.0f 0.0f = 0 @>) true
+        checkEval "vrewoinrv09gf" (<@ compare 0.0f 1.0f < 0 @>) true
+        checkEval "vrewoinrv09gg" (<@ compare 1.0f 0.0f > 0 @>) true
+        checkEval "vrewoinrv09gh" (<@ 0.0f < 1.0f @>) true
+        checkEval "vrewoinrv09gk" (<@ 0.0f <= 1.0f @>) true
+        checkEval "vrewoinrv09gl" (<@ 1.0f <= 1.0f @>) true
+        checkEval "vrewoinrv09gz" (<@ 2.0f <= 1.0f @>) false
+        checkEval "vrewoinrv09gx" (<@ 0.0f > 1.0f @>) false
+        checkEval "vrewoinrv09gc" (<@ 0.0f >= 1.0f @>) false
+        checkEval "vrewoinrv09gv" (<@ 1.0f >= 1.0f @>) true
+        checkEval "vrewoinrv09gb" (<@ 2.0f >= 1.0f @>) true
+
+        checkEval "vrewoinrv09gn" (<@ compare 0L 0L = 0 @>) true
+        checkEval "vrewoinrv09gm" (<@ compare 0L 1L < 0 @>) true
+        checkEval "vrewoinrv09g11" (<@ compare 1L 0L > 0 @>) true
+        checkEval "vrewoinrv09g12" (<@ 0L < 1L @>) true
+        checkEval "vrewoinrv09g13" (<@ 0L <= 1L @>) true
+        checkEval "vrewoinrv09g14" (<@ 1L <= 1L @>) true
+        checkEval "vrewoinrv09g15" (<@ 2L <= 1L @>) false
+        checkEval "vrewoinrv09g16" (<@ 0L > 1L @>) false
+        checkEval "vrewoinrv09g17" (<@ 0L >= 1L @>) false
+        checkEval "vrewoinrv09g18" (<@ 1L >= 1L @>) true
+        checkEval "vrewoinrv09g19" (<@ 2L >= 1L @>) true
+
+        checkEval "vrewoinrv09g21" (<@ compare 0y 0y = 0 @>) true
+        checkEval "vrewoinrv09g22" (<@ compare 0y 1y < 0 @>) true
+        checkEval "vrewoinrv09g23" (<@ compare 1y 0y > 0 @>) true
+        checkEval "vrewoinrv09g24" (<@ 0y < 1y @>) true
+        checkEval "vrewoinrv09g25" (<@ 0y <= 1y @>) true
+        checkEval "vrewoinrv09g26" (<@ 1y <= 1y @>) true
+        checkEval "vrewoinrv09g27" (<@ 2y <= 1y @>) false
+        checkEval "vrewoinrv09g28" (<@ 0y > 1y @>) false
+        checkEval "vrewoinrv09g29" (<@ 0y >= 1y @>) false
+        checkEval "vrewoinrv09g30" (<@ 1y >= 1y @>) true
+        checkEval "vrewoinrv09g31" (<@ 2y >= 1y @>) true
+
+        checkEval "vrewoinrv09g32" (<@ compare 0M 0M = 0 @>) true
+        checkEval "vrewoinrv09g33" (<@ compare 0M 1M < 0 @>) true
+        checkEval "vrewoinrv09g34" (<@ compare 1M 0M > 0 @>) true
+        checkEval "vrewoinrv09g35" (<@ 0M < 1M @>) true
+        checkEval "vrewoinrv09g36" (<@ 0M <= 1M @>) true
+        checkEval "vrewoinrv09g37" (<@ 1M <= 1M @>) true
+        checkEval "vrewoinrv09g38" (<@ 2M <= 1M @>) false
+        checkEval "vrewoinrv09g39" (<@ 0M > 1M @>) false
+        checkEval "vrewoinrv09g40" (<@ 0M >= 1M @>) false
+        checkEval "vrewoinrv09g41" (<@ 1M >= 1M @>) true
+        checkEval "vrewoinrv09g42" (<@ 2M >= 1M @>) true
+
+        checkEval "vrewoinrv09g43" (<@ compare 0I 0I = 0 @>) true
+        checkEval "vrewoinrv09g44" (<@ compare 0I 1I < 0 @>) true
+        checkEval "vrewoinrv09g45" (<@ compare 1I 0I > 0 @>) true
+        checkEval "vrewoinrv09g46" (<@ 0I < 1I @>) true
+        checkEval "vrewoinrv09g47" (<@ 0I <= 1I @>) true
+        checkEval "vrewoinrv09g48" (<@ 1I <= 1I @>) true
+        checkEval "vrewoinrv09g49" (<@ 2I <= 1I @>) false
+        checkEval "vrewoinrv09g50" (<@ 0I > 1I @>) false
+        checkEval "vrewoinrv09g51" (<@ 0I >= 1I @>) false
+        checkEval "vrewoinrv09g52" (<@ 1I >= 1I @>) true
+        checkEval "vrewoinrv09g53" (<@ 2I >= 1I @>) true
+
+
+        checkEval "vrewoinrv09g" (<@ sin 0.0 @>) (sin 0.0)
+        checkEval "vrewoinrv09h" (<@ sinh 0.0 @>) (sinh 0.0)
+        checkEval "vrewoinrv09j" (<@ cos 0.0 @>) (cos 0.0)
+        checkEval "vrewoinrv09k" (<@ cosh 0.0 @>) (cosh 0.0)
+        checkEval "vrewoinrv09l" (<@ tan 1.0 @>) (tan 1.0)
+        checkEval "vrewoinrv09z" (<@ tanh 1.0 @>) (tanh 1.0)
+        checkEval "vrewoinrv09x" (<@ abs -2.0 @>) (abs -2.0)
+        checkEval "vrewoinrv09c" (<@ ceil 2.0 @>) (ceil 2.0)
+        checkEval "vrewoinrv09v" (<@ sqrt 2.0 @>) (sqrt 2.0)
+        checkEval "vrewoinrv09b" (<@ sign 2.0 @>) (sign 2.0)
+        checkEval "vrewoinrv09n" (<@ truncate 2.3 @>) (truncate 2.3)
+        checkEval "vrewoinrv09m" (<@ floor 2.3 @>) (floor 2.3)
+        checkEval "vrewoinrv09Q" (<@ round 2.3 @>) (round 2.3)
+        checkEval "vrewoinrv09W" (<@ log 2.3 @>) (log 2.3)
+        checkEval "vrewoinrv09E" (<@ log10 2.3 @>) (log10 2.3)
+        checkEval "vrewoinrv09R" (<@ exp 2.3 @>) (exp 2.3)
+        checkEval "vrewoinrv09T" (<@ 2.3 ** 2.4 @>) (2.3 ** 2.4)
+
+        checkEval "vrewoinrv09Y" (<@ sin 0.0f @>) (sin 0.0f)
+        checkEval "vrewoinrv09U" (<@ sinh 0.0f @>) (sinh 0.0f)
+        checkEval "vrewoinrv09I" (<@ cos 0.0f @>) (cos 0.0f)
+        checkEval "vrewoinrv09O" (<@ cosh 0.0f @>) (cosh 0.0f)
+        checkEval "vrewoinrv09P" (<@ tan 1.0f @>) (tan 1.0f)
+        checkEval "vrewoinrv09A" (<@ tanh 1.0f @>) (tanh 1.0f)
+        checkEval "vrewoinrv09S" (<@ abs -2.0f @>) (abs -2.0f)
+        checkEval "vrewoinrv09D" (<@ ceil 2.0f @>) (ceil 2.0f)
+        checkEval "vrewoinrv09F" (<@ sqrt 2.0f @>) (sqrt 2.0f)
+        checkEval "vrewoinrv09G" (<@ sign 2.0f @>) (sign 2.0f)
+        checkEval "vrewoinrv09H" (<@ truncate 2.3f @>) (truncate 2.3f)
+        checkEval "vrewoinrv09J" (<@ floor 2.3f @>) (floor 2.3f)
+        checkEval "vrewoinrv09K" (<@ round 2.3f @>) (round 2.3f)
+        checkEval "vrewoinrv09L" (<@ log 2.3f @>) (log 2.3f)
+        checkEval "vrewoinrv09Z" (<@ log10 2.3f @>) (log10 2.3f)
+        checkEval "vrewoinrv09X" (<@ exp 2.3f @>) (exp 2.3f)
+        checkEval "vrewoinrv09C" (<@ 2.3f ** 2.4f @>) (2.3f ** 2.4f)
+
+        checkEval "vrewoinrv09V" (<@ ceil 2.0M @>) (ceil 2.0M)
+        checkEval "vrewoinrv09B" (<@ sign 2.0M @>) (sign 2.0M)
+        checkEval "vrewoinrv09N" (<@ truncate 2.3M @>) (truncate 2.3M)
+        checkEval "vrewoinrv09M" (<@ floor 2.3M @>) (floor 2.3M)
+
+        checkEval "vrewoinrv09QQ" (<@ sign -2 @>) (sign -2)
+        checkEval "vrewoinrv09WW" (<@ sign -2y @>) (sign -2y)
+        checkEval "vrewoinrv09EE" (<@ sign -2s @>) (sign -2s)
+        checkEval "vrewoinrv09RR" (<@ sign -2L @>) (sign -2L)
+
+        checkEval "vrewoinrv09TT" (<@ [ 0 .. 10 ] @>) [ 0 .. 10 ]
+        checkEval "vrewoinrv09YY" (<@ [ 0y .. 10y ] @>) [ 0y .. 10y ]
+        checkEval "vrewoinrv09UU" (<@ [ 0s .. 10s ] @>) [ 0s .. 10s ]
+        checkEval "vrewoinrv09II" (<@ [ 0L .. 10L ] @>) [ 0L .. 10L ]
+        checkEval "vrewoinrv09OO" (<@ [ 0u .. 10u ] @>) [ 0u .. 10u ]
+        checkEval "vrewoinrv09PP" (<@ [ 0uy .. 10uy ] @>) [ 0uy .. 10uy ]
+        checkEval "vrewoinrv09AA" (<@ [ 0us .. 10us ] @>) [ 0us .. 10us ]
+        checkEval "vrewoinrv09SS" (<@ [ 0UL .. 10UL ] @>) [ 0UL .. 10UL ]
+        
+
+        
+        // Round dynamic dispatch on Decimal
+        checkEval "vrewoinrv09FF" (<@ round 2.3M @>) (round 2.3M)
+
+        // Measure stuff:
+        checkEval "vrewoinrv09GG" (<@ atan2 3.0 4.0 @>) (atan2 3.0 4.0 )
+        
+        [<Measure>]
+        type kg
+        checkEval "vrewoinrv09HH" (<@ 1.0<kg> @>) (1.0<kg>)
+
+        // Measure stuff:
+        checkEval "vrewoinrv09JJ" (<@ 1.0<kg> + 2.0<kg> @>) (3.0<kg>)
+
+
+        Eval <@ Array.average [| 0.0 .. 1.0 .. 10000.0 |] @> 
+
+    module LanguagePrimitiveCastingUnitsOfMeasure = 
+        [<Measure>]
+        type m
+
+        checkEval "castingunits1" (<@ 2.5 |> LanguagePrimitives.FloatWithMeasure<m> |> float @>) 2.5
+        checkEval "castingunits2" (<@ 2.5f |> LanguagePrimitives.Float32WithMeasure<m> |> float32 @>) 2.5f
+        checkEval "castingunits3" (<@ 2.0m |> LanguagePrimitives.DecimalWithMeasure<m> |> decimal @>) 2.0M
+        checkEval "castingunits4" (<@ 2 |> LanguagePrimitives.Int32WithMeasure<m> |> int @>) 2
+        checkEval "castingunits5" (<@ 2L |> LanguagePrimitives.Int64WithMeasure<m> |> int64 @>) 2L
+        checkEval "castingunits6" (<@ 2s |> LanguagePrimitives.Int16WithMeasure<m> |> int16 @>) 2s
+        checkEval "castingunits7" (<@ 2y |> LanguagePrimitives.SByteWithMeasure<m> |> sbyte @>) 2y
+
+module QuotationTests =
+    open Microsoft.FSharp.Quotations
+    open Microsoft.FSharp.Quotations.Patterns
+    open Microsoft.FSharp.Quotations.DerivedPatterns
+    let (|Seq|_|) = function SpecificCall <@ seq @>(_, [_],[e]) -> Some e | _ -> None
+    let (|Append|_|) = function SpecificCall <@ Seq.append @>(_, [_],[e1;e2]) -> Some (e1,e2) | _ -> None
+    let (|Delay|_|) = function SpecificCall <@ Seq.delay @>(_, [_],[Lambda(_,e)]) -> Some e | _ -> None
+    let (|FinalFor|_|) = function SpecificCall <@ Seq.map @>(_, [_;_],[Lambda(v,e);sq]) -> Some (v,sq,e) | _ -> None
+    let (|OuterFor|_|) = function SpecificCall <@ Seq.collect @>(_, [_;_;_],[Lambda(v,e);sq]) -> Some (v,sq,e) | _ -> None
+    let (|Yield|_|) = function SpecificCall <@ Seq.singleton @>(_, [_],[e]) -> Some (e) | _ -> None
+    let (|While|_|) = function SpecificCall <@ Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.EnumerateWhile @>(_, [_],[e1;e2]) -> Some (e1,e2) | _ -> None
+    let (|TryFinally|_|) = function SpecificCall <@ Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.EnumerateThenFinally @>(_, [_],[e1;e2]) -> Some (e1,e2) | _ -> None
+    let (|Using|_|) = function SpecificCall <@ Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.EnumerateUsing @>(_, _,[e1;Lambda(v1,e2)]) -> Some (v1,e1,e2) | _ -> None
+    let (|Empty|_|) = function SpecificCall <@ Seq.empty @>(_,_,_) -> Some () | _ -> None
+    test "vrenjkr90kj1" 
+       (match <@ seq { for x in [1] -> x } @> with 
+        | Seq(Delay(FinalFor(v,Coerce(sq,_),res))) when sq = <@@ [1] @@> && res = Expr.Var(v) -> true
+        | Seq(Delay(FinalFor(v,sq,res))) -> printfn "v = %A, res = %A, sq = %A" v res sq; false
+        | Seq(Delay(sq)) -> printfn "Seq(Delay(_)), tm = %A" sq; false
+        | Seq(sq) -> printfn "Seq(_), tm = %A" sq; false 
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj2" 
+       (match <@ seq { for x in [1] do yield x } @> with 
+        | Seq(Delay(FinalFor(v,Coerce(sq,_),res))) when sq = <@@ [1] @@> && res = Expr.Var(v) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj3" 
+       (match <@ seq { for x in [1] do for y in [2] do yield x } @> with 
+        | Seq(Delay(OuterFor(v1,Coerce(sq1,_),FinalFor(v2,Coerce(sq2,_),res)))) when sq1 = <@@ [1] @@> && sq2 = <@@ [2] @@> && res = Expr.Var(v1) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj4" 
+       (match <@ seq { if true then yield 1 else yield 2 } @> with 
+        | Seq(Delay(IfThenElse(_,Yield(Int32(1)),Yield(Int32(2))))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj5" 
+       (match <@ seq { for x in [1] do if true then yield x else yield 2 } @> with 
+        | Seq(Delay(OuterFor(vx,Coerce(sq,_),IfThenElse(_,Yield(res),Yield(Int32(2)))))) when sq = <@@ [1] @@>  && res = Expr.Var(vx) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj6" 
+       (match <@ seq { yield 1; yield 2 } @> with 
+        | Seq(Delay(Append(Yield(Int32(1)),Delay(Yield(Int32(2)))))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj7" 
+       (match <@ seq { while true do yield 1 } @> with 
+        | Seq(Delay(While(Lambda(_,Bool(true)),Delay(Yield(Int32(1)))))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj8" 
+       (match <@ seq { while true do yield 1 } @> with 
+        | Seq(Delay(While(Lambda(_,Bool(true)),Delay(Yield(Int32(1)))))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj9" 
+       (match <@ seq { try yield 1 finally () } @> with 
+        | Seq(Delay(TryFinally(Delay(Yield(Int32(1))), Lambda(_,Unit)))) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kj9" 
+       (match <@ seq { use ie = failwith "" in yield! Seq.empty } @> with 
+        | Seq(Delay(Using(v1,e1,Empty))) when v1.Name = "ie" -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kjA" 
+       (match <@ (3 :> obj) @> with 
+        | Coerce(Int32(3),ty) when ty = typeof<obj> -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kjB" 
+       (match <@ ("3" :> obj) @> with 
+        | Coerce(String("3"),ty) when ty = typeof<obj> -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kjC" 
+       (match <@ ("3" :> System.IComparable) @> with 
+        | Coerce(String("3"),ty) when ty = typeof<System.IComparable> -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+(*
+    test "vrenjkr90kjD" 
+       (match <@ (new obj() :?> System.IComparable) @> with 
+        | Coerce(NewObject(_),ty) when ty = typeof<System.IComparable> -> true
+        | sq -> printfn "tm = %A" sq; false) 
+
+    test "vrenjkr90kjE" 
+       (match <@ (new obj() :?> obj) @> with 
+        | NewObject(_) -> true
+        | sq -> printfn "tm = %A" sq; false) 
+*)
+
+
+module LargerAutomaticDiferentiationTest_FSharp_1_0_Bug_3498 = 
+
+    let q = 
+        <@ (fun (x1:double) -> 
+               let fwd6 = 
+                   let y3 = x1 * x1
+                   (y3, (fun yb4 -> yb4 * 2.0 * x1))
+               let rev5 = snd fwd6
+               let w0 = fst fwd6
+
+               let fwd14 = 
+                   let y11 = w0 + 1.0
+                   (y11, (fun yb12 -> yb12 * 1.0))
+               let rev13 = snd fwd14
+               let y8 = fst fwd14
+               (y8, (fun y8b10 -> 
+                          let w0b2 = 0.0 
+                          let x1b1 = 0.0 
+                          let dxs15 = rev13 y8b10 
+                          let w0b2 = w0b2 + dxs15 
+                          let dxs7 = rev5 w0b2 
+                          let x1b1 = x1b1 + dxs7 
+                          x1b1))) @>
+
+    let r,rd = (q.Eval()) 4.0
+    test "vrknlwerwe90" (r = 17.0)
+    test "cew90jkml0rv" (rd 0.1 = 0.8)
+
+module FunkyMethodRepresentations = 
+    let Eval (q: Expr<_>) = 
+        q.ToLinqExpression() |> ignore 
+        q.Compile() |> ignore  
+        q.Eval()
+    // The IsSome and IsNone properties are represented as static methods because
+    // option uses 'null' as a representation
+    checkEval "clkedw0" (<@ let x : int option = None in x.IsSome @>) false
+    checkEval "clkedw1" (<@ let x : int option = None in x.IsNone @>) true
+    checkEval "clkedw2" (<@ let x : int option = Some 1 in x.Value @>) 1
+    //checkEval "clkedw3" (<@ let x : int option = Some 1 in x.ToString() @> |> Eval  ) "Some(1)"
+
+module Extensions = 
+    let Eval (q: Expr<_>) = 
+        q.ToLinqExpression() |> ignore 
+        q.Compile() |> ignore  
+        q.Eval()
+    type System.Object with 
+        member x.ExtensionMethod0()  = 3
+        member x.ExtensionMethod1()  = ()
+        member x.ExtensionMethod2(y:int)  = y
+        member x.ExtensionMethod3(y:int)  = ()
+        member x.ExtensionMethod4(y:int,z:int)  = y + z
+        member x.ExtensionMethod5(y:(int*int))  = y 
+        member x.ExtensionProperty1 = 3
+        member x.ExtensionProperty2 with get() = 3
+        member x.ExtensionProperty3 with set(v:int) = ()
+        member x.ExtensionIndexer1 with get(idx:int) = idx
+        member x.ExtensionIndexer2 with set(idx:int) (v:int) = ()
+
+    type System.Int32 with 
+        member x.Int32ExtensionMethod0()  = 3
+        member x.Int32ExtensionMethod1()  = ()
+        member x.Int32ExtensionMethod2(y:int)  = y
+        member x.Int32ExtensionMethod3(y:int)  = ()
+        member x.Int32ExtensionMethod4(y:int,z:int)  = y + z
+        member x.Int32ExtensionMethod5(y:(int*int))  = y 
+        member x.Int32ExtensionProperty1 = 3
+        member x.Int32ExtensionProperty2 with get() = 3
+        member x.Int32ExtensionProperty3 with set(v:int) = ()
+        member x.Int32ExtensionIndexer1 with get(idx:int) = idx
+        member x.Int32ExtensionIndexer2 with set(idx:int) (v:int) = ()
+
+    let v = new obj()
+    checkEval "ecnowe0" (<@ v.ExtensionMethod0() @>)  3
+    checkEval "ecnowe1" (<@ v.ExtensionMethod1() @>)  ()
+    checkEval "ecnowe2" (<@ v.ExtensionMethod2(3) @>) 3
+    checkEval "ecnowe3" (<@ v.ExtensionMethod3(3) @>)  ()
+    checkEval "ecnowe4" (<@ v.ExtensionMethod4(3,4) @>)  7
+    checkEval "ecnowe5" (<@ v.ExtensionMethod5(3,4) @>)  (3,4)
+    checkEval "ecnowe6" (<@ v.ExtensionProperty1 @>) 3
+    checkEval "ecnowe7" (<@ v.ExtensionProperty2 @>) 3
+    checkEval "ecnowe8" (<@ v.ExtensionProperty3 <- 4 @>)  ()
+    checkEval "ecnowe9" (<@ v.ExtensionIndexer1(3) @>) 3
+    checkEval "ecnowea" (<@ v.ExtensionIndexer2(3) <- 4 @>)  ()
+
+    check "ecnoweb" (Eval (<@ v.ExtensionMethod0 @>) ()) 3 
+    check "ecnowec" (Eval (<@ v.ExtensionMethod1 @>) ()) ()
+    check "ecnowed" (Eval (<@ v.ExtensionMethod2 @>) 3) 3
+    check "ecnowee" (Eval (<@ v.ExtensionMethod3 @>) 3) ()
+    check "ecnowef" (Eval (<@ v.ExtensionMethod4 @>) (3,4)) 7
+    check "ecnoweg" (Eval (<@ v.ExtensionMethod5 @>) (3,4)) (3,4)
+
+    let v2 = 3
+    let mutable v2b = 3
+    checkEval "ecnweh0" (<@ v2.ExtensionMethod0() @>) 3
+    checkEval "ecnweh1" (<@ v2.ExtensionMethod1() @>) ()
+    checkEval "ecnweh2" (<@ v2.ExtensionMethod2(3) @>) 3
+    checkEval "ecnweh3" (<@ v2.ExtensionMethod3(3) @>) ()
+    checkEval "ecnweh4" (<@ v2.ExtensionMethod4(3,4) @>) 7
+    checkEval "ecnweh5" (<@ v2.ExtensionMethod5(3,4) @>) (3,4)
+    checkEval "ecnweh6" (<@ v2.ExtensionProperty1 @>) 3
+    checkEval "ecnweh7" (<@ v2.ExtensionProperty2 @>) 3
+    checkEval "ecnweh8" (<@ v2b.ExtensionProperty3 <- 4 @>)  ()
+    checkEval "ecnweh9" (<@ v2.ExtensionIndexer1(3) @>) 3
+    checkEval "ecnweha" (<@ v2b.ExtensionIndexer2(3) <- 4 @>)  ()
+
+module QuotationCompilation =
+    let Eval (q: Expr<_>) = 
+        q.ToLinqExpression() |> ignore 
+        q.Compile() |> ignore  
+        q.Eval()
+        
+    // This tried to use non-existent 'Action' delegate with 5 type arguments
+    let q =
+        <@  (fun () -> 
+                let a = ref 0
+                let b = 0
+                let c = 0
+                let d = 0
+                let e = 0
+                a := b + c + d + e ) @>
+    check "qceva0" ((Eval q) ()) ()
+
+
+
+
+    
+module Query =
+
+    open QuotationEvaluation
+
+    let debug = false
+        
+    let contains key source = 
+        System.Linq.Enumerable.Contains(source,key)
+
+    let minBy<'T1,'T2> keySelector source = 
+        System.Linq.Enumerable.Min(source,Func<'T1,'T2>(keySelector))
+
+    let maxBy<'T1,'T2> keySelector source = 
+        System.Linq.Enumerable.Max(source,Func<'T1,'T2>(keySelector))
+
+    let groupBy keySelector source = 
+        System.Linq.Enumerable.GroupBy(source,Func<_,_>(keySelector))
+
+    let join  outerSource innerSource outerKeySelector innerKeySelector resultSelector = 
+        System.Linq.Enumerable.Join(outerSource,innerSource,Func<_,_>(outerKeySelector),Func<_,_>(innerKeySelector),Func<_,_,_>(resultSelector))
+
+    let groupJoin  outerSource innerSource outerKeySelector innerKeySelector resultSelector = 
+        System.Linq.Enumerable.GroupJoin(outerSource,innerSource,Func<_,_>(outerKeySelector),Func<_,_>(innerKeySelector),Func<_,_,_>(resultSelector))
+
+    let ConvVar (v: Var) = 
+        Expression.Parameter(v.Type, v.Name)
+
+    let asExpr x = (x :> Expression)
+            
+    let (|Getter|_|) (prop: #PropertyInfo) =
+        match prop.GetGetMethod(true) with 
+        | null -> None
+        | v -> Some v
+
+    let (|CallPipe|_|) = (|SpecificCall|_|) <@ (|>) @>
+    // Match 'f x' or 'x |> f' or 'x |> (fun x -> f (x :> ty))'
+    let (|SpecificPipedCall0|_|) q = 
+       let (|CallQ|_|) = (|SpecificCall|_|) q
+       function
+       | CallPipe (None, [_;_],[arg1;Lambda(arg1v,CallQ (None, tyargs,[arg1E])) ]) -> 
+           let arg1 = arg1E.Substitute (Map.ofSeq [ (arg1v,arg1) ]).TryFind 
+           Some(tyargs,arg1)
+
+       | CallQ (None, tyargs,[arg1]) -> 
+           Some(tyargs,arg1)
+
+       | _ -> None           
+
+    // Match 
+    //     'f x y' or 
+    //     'y |> f x' or
+    //     'y |> (fun y -> f (x :> ty) (y :> ty))'
+    //     'y |> let x = e in (fun y -> f (x :> ty) (y :> ty))'
+    let (|SpecificPipedCall1|_|) q = 
+       let (|CallQ|_|) = (|SpecificCall|_|) q
+       function
+       // Encoded form of some uses of 'T1rg2 |> f arg1'
+       | CallPipe (None, [_;_],[arg2;Let(arg1v,arg1,Lambda(arg2v,CallQ (None, tyargs,[arg1E;arg2E]))) ]) -> 
+              let arg1 = arg1E.Substitute (Map.ofSeq [ (arg1v,arg1) ]).TryFind 
+              let arg2 = arg2E.Substitute (Map.ofSeq [ (arg2v,arg2) ]).TryFind 
+              Some(tyargs,arg1,arg2)
+
+       | CallPipe (None, [_;_],[arg2;Lambda(arg2v,CallQ (None, tyargs,[arg1;arg2E])) ]) -> 
+              let arg2 = arg2E.Substitute (Map.ofSeq [ (arg2v,arg2) ]).TryFind 
+              Some(tyargs,arg1,arg2)
+
+       | CallQ (None, tyargs,[arg1;arg2]) -> 
+              Some(tyargs,arg1,arg2)
+       | _ -> None           
+
+        
+    let GetGenericMethodDefinition (m:MethodInfo) = 
+        if m.IsGenericMethod then m.GetGenericMethodDefinition() else m
+
+    let FindGenericStaticMethodInfo mexpr =
+        match mexpr with 
+        | Lambdas(_,Call(None,methInfo,_)) -> GetGenericMethodDefinition methInfo
+        | _ -> failwithf "FindGenericStaticMethodInfo: %A is not a static method call lambda" mexpr
+
+    let CallGenericStaticMethod mexpr  =
+        let m = FindGenericStaticMethodInfo mexpr in
+        //printf "m = %A\n" m;
+        fun (tyargs,args) -> 
+            //printf "invoking %A\n" m;
+            
+            let m = 
+                if m.IsGenericMethod then 
+                    m.MakeGenericMethod(Array.ofList tyargs) 
+                else
+                    m
+            m.Invoke(null,Array.ofList args)
+
+    let FT1 = typedefof<System.Func<_,_>>
+    let FT2 = typedefof<System.Func<_,_,_>>
+    let boolTy = typeof<bool>
+    let MakeQueryFuncTy (dty,rty) = FT1.MakeGenericType([| dty; rty |])
+    let MakeQueryFunc2Ty (dty1,dty2,rty) = FT2.MakeGenericType([| dty1; dty2; rty |])
+
+    let IEnumerableTypeDef = typedefof<IEnumerable<_>>
+    let IQueryableTypeDef = typedefof<IQueryable<_>>
+    let MakeIEnumerableTy dty= IEnumerableTypeDef.MakeGenericType([| dty|])
+    let MakeIQueryableTy dty= IQueryableTypeDef.MakeGenericType([| dty|])
+
+    let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPointer)
+    let equivHeadTypes (ty1:Type) (ty2:Type) = 
+        isNamedType(ty1) &&
+        if ty1.IsGenericType then 
+          ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.GetGenericTypeDefinition())
+        else 
+          ty1.Equals(ty2)
+
+    let IsIQueryableTy ty = equivHeadTypes IQueryableTypeDef ty
+   
+
+    let CallSeqToList = 
+        let F = CallGenericStaticMethod <@ Seq.toList @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallSeqToArray = 
+        let F = CallGenericStaticMethod <@ Seq.toArray @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableContains = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Contains : _ * _ -> _ @> 
+        fun (srcTy,src,key:Expression) -> 
+            F ([srcTy],[src;box key])
+
+    let CallQueryableMin = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Min : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableMax = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Max : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableAverageBy = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,float>> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,float32>> -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,decimal>> -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,int32>> -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : _ * Expression<Func<_,int64>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([destTy],[src;box predicate])
+            | ty when ty = typeof<float32> -> F_float32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<decimal> -> F_decimal ([destTy],[src;box predicate])
+            | ty when ty = typeof<int32> -> F_int32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<int64> -> F_int64 ([destTy],[src;box predicate])
+            | _ -> failwith "unrecognized use of 'Seq.averageBy'"
+
+
+    let CallQueryableAverage = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<float> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<float32>  -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<decimal>  -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<int32>  -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Average : IQueryable<int64>  -> _ @> 
+        fun (srcTy,src) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([],[src])
+            | ty when ty = typeof<float32> -> F_float32 ([],[src])
+            | ty when ty = typeof<decimal> -> F_decimal ([],[src])
+            | ty when ty = typeof<int32> -> F_int32 ([],[src])
+            | ty when ty = typeof<int64> -> F_int64 ([],[src])
+            | _ -> failwith "unrecognized use of 'Seq.average'"
+
+    let CallQueryableSumBy = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,float>> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,float32>> -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,decimal>> -> _ @> 
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,int32>> -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : _ * Expression<Func<_,int64>> -> _ @> 
+        fun (srcTy,destTy,src,predicate:Expression) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([destTy],[src;box predicate])
+            | ty when ty = typeof<float32> -> F_float32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<decimal> -> F_decimal ([destTy],[src;box predicate])
+            | ty when ty = typeof<int32> -> F_int32 ([destTy],[src;box predicate])
+            | ty when ty = typeof<int64> -> F_int64 ([destTy],[src;box predicate])
+            | _ -> failwith "unrecognized use of 'Seq.sumBy'"
+
+    let CallQueryableSum = 
+        let F_float = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<float> -> _ @> 
+        let F_float32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<float32>  -> _ @> 
+        let F_decimal = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<decimal>  -> _ @> 
+        // Note these don't satisfy the F# constraints anyway
+        let F_int32 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<int32>  -> _ @> 
+        let F_int64 = CallGenericStaticMethod <@ System.Linq.Queryable.Sum : IQueryable<int64>  -> _ @> 
+        fun (srcTy,src) -> 
+            match srcTy with 
+            | ty when ty = typeof<float> -> F_float ([],[src])
+            | ty when ty = typeof<float32> -> F_float32 ([],[src])
+            | ty when ty = typeof<decimal> -> F_decimal ([],[src])
+            | ty when ty = typeof<int32> -> F_int32 ([],[src])
+            | ty when ty = typeof<int64> -> F_int64 ([],[src])
+            | _ -> failwith "unrecognized use of 'Seq.sum"
+
+    let CallQueryableFirst = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.First : _ -> _ @> 
+        fun (srcTy,src) -> 
+            F ([srcTy],[src])
+
+    let CallQueryableFirstFind = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.First : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,predicate:Expression) -> 
+            F ([srcTy],[src;box predicate])
+
+    let CallQueryableCount = 
+        let F = CallGenericStaticMethod <@ System.Linq.Queryable.Count : _ -> _ @> 
+        fun (srcTy:Type,src:obj) -> 
+            F ([srcTy],[src])
+
+    let BindGenericMethod (methInfo:MethodInfo) tyargs = 
+        if methInfo.IsGenericMethod then 
+            methInfo.GetGenericMethodDefinition().MakeGenericMethod(Array.ofList tyargs)
+        else
+            methInfo
+
+    let minfo = match <@@ QuotationEvaluation.LinqExpressionHelper @@> with Lambda(_,Call(_,minfo,_)) -> minfo | _ -> failwith "couldn't find method info"
+    let MakeFakeExpression (x:Expr) = 
+        Expr.Call(minfo.GetGenericMethodDefinition().MakeGenericMethod [| x.Type |], [ x ])
+
+            
+    let MakeGenericStaticMethod lam  =
+        // Nb. the SelectMany/Where/Select methods theoretically expects an expression, but the
+        // LINQ team decided to only pass it a delegate construction. The coercion from
+        // the delegate construction to the expression is effectively implicit in LINQ, but
+        // not in F# quotations, so we have to use 'Unchecked' version (see also FSBUGS #970)
+        let methInfo = FindGenericStaticMethodInfo lam 
+        (fun (tyargs,args) -> Expr.Call(BindGenericMethod methInfo tyargs,args))
+           
+
+    let MakeQueryableSelect = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Select : _ * Expression<Func<_,_>> -> _) @>
+        fun (srcTy,targetTy,src,v,f)  -> 
+            
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,targetTy), v,f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;targetTy],[src;selector])
+
+    let MakeQueryableAppend = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Concat ) @>
+        fun (srcTy,src1,src2)  -> 
+            F ([srcTy],[src1;src2])
+
+
+    let MakeQueryableAsQueryable = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.AsQueryable : seq<_>  -> IQueryable<_>) @>
+        fun (ty,src)  -> 
+            F ([ty],[src])
+
+    let MakeEnumerableEmpty = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Enumerable.Empty : unit -> seq<_>) @>
+        fun (ty)  -> 
+            F ([ty],[])
+
+    let MakeQueryableEmpty = 
+        fun (ty)  -> 
+            MakeQueryableAsQueryable (ty,MakeEnumerableEmpty ty)
+
+    let MakeQueryableSelectMany = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.SelectMany : IQueryable<_> * Expression<Func<_,_>> -> IQueryable<_>) @>
+        fun (srcTy,targetTy,src,v,f)  -> 
+            // REVIEW: Previous notes in this file said that LINQ likes to see a coercion to an interface type
+            // at this point. 
+            //let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,MakeIEnumerableTy targetTy), [v],f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;targetTy],[src;selector])
+
+    let MakeQueryableWhere = 
+        let F = MakeGenericStaticMethod <@ (System.Linq.Queryable.Where : _ * Expression<Func<_,_>> -> _) @>
+        fun (srcTy,src,v,f)  -> 
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,typeof<bool>), [v],f)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy],[src;selector])
+
+
+
+    let MakeQueryableOrderBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.OrderBy : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            
+            let selector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector)
+
+            let selector = MakeFakeExpression selector
+            F ([srcTy;keyTy],[src;selector])
+
+    let MakeQueryableDistinct = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Distinct : _ -> _ @> 
+        fun (srcTy,src)  -> 
+            let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            F ([srcTy],[src])
+
+    let MakeQueryableTake = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Take @> 
+        fun (srcTy,src,count)  -> 
+            let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
+            F ([srcTy],[src;count])
+
+    let MakeQueryableGroupBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.GroupBy : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableMinBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Min : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableMaxBy = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Max : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,keyTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,keyTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy;keyTy],[src;keySelector])
+
+    let MakeQueryableAny = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Any : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,boolTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy],[src;keySelector])
+
+    let MakeQueryableAll = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.All : _ * Expression<Func<_,_>> -> _ @> 
+        fun (srcTy,src,v,keySelector)  -> 
+            let keySelector = Expr.NewDelegate(MakeQueryFuncTy(srcTy,boolTy), [v],keySelector) 
+
+            let keySelector = MakeFakeExpression keySelector
+            F ([srcTy],[src;keySelector])
+
+    let MakeQueryableJoin = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Join : _ * _ * Expression<Func<_,_>> * Expression<Func<_,_>> * Expression<Func<_,_,_>> -> _ @> 
+        fun (outerSourceTy,innerSourceTy,keyTy,resultTy,outerSource,innerSource,outerKeyVar,outerKeySelector,innerKeyVar,innerKeySelector,outerResultKeyVar,innerResultKeyVar,resultSelector)  -> 
+            let outerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(outerSourceTy,keyTy), [outerKeyVar],outerKeySelector) |> MakeFakeExpression 
+            let innerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(innerSourceTy,keyTy), [innerKeyVar],innerKeySelector) |> MakeFakeExpression 
+            let resultSelector = Expr.NewDelegate(MakeQueryFunc2Ty(outerSourceTy,innerSourceTy,resultTy), [outerResultKeyVar;innerResultKeyVar],resultSelector) |> MakeFakeExpression 
+            F ([outerSourceTy;innerSourceTy;keyTy;resultTy],[outerSource;innerSource;outerKeySelector;innerKeySelector;resultSelector])
+
+
+    let MakeQueryableGroupJoin = 
+        let F = MakeGenericStaticMethod <@ System.Linq.Queryable.GroupJoin : _ * _ * Expression<Func<_,_>> * Expression<Func<_,_>> * Expression<Func<_,_,_>> -> _ @> 
+        fun (outerSourceTy,innerSourceTy,keyTy,resultTy,outerSource,innerSource,outerKeyVar,outerKeySelector,innerKeyVar,innerKeySelector,outerResultKeyVar,innerResultKeyVar,resultSelector)  -> 
+            let outerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(outerSourceTy,keyTy), [outerKeyVar],outerKeySelector) |> MakeFakeExpression 
+            let innerKeySelector = Expr.NewDelegate(MakeQueryFuncTy(innerSourceTy,keyTy), [innerKeyVar],innerKeySelector) |> MakeFakeExpression 
+            let resultSelector = Expr.NewDelegate(MakeQueryFunc2Ty(outerSourceTy,MakeIEnumerableTy(innerSourceTy),resultTy), [outerResultKeyVar;innerResultKeyVar],resultSelector) |> MakeFakeExpression 
+            F ([outerSourceTy;innerSourceTy;keyTy;resultTy],[outerSource;innerSource;outerKeySelector;innerKeySelector;resultSelector])
+
+
+
+    /// Project F# function expressions to Linq LambdaExpression nodes
+    let FuncExprToLinqFunc2Expression (srcTy,targetTy,v,body) = 
+        Expr.NewDelegate(Linq.Expressions.Expression.GetFuncType [| srcTy; targetTy |], [v],body).ToLinqExpression()
+
+
+    let MakeMapConcat = 
+        let F = MakeGenericStaticMethod <@ Seq.collect @>
+        fun (srcTy,targetTy,f,src)  -> 
+            F ([srcTy;MakeIEnumerableTy targetTy;targetTy],[f;src])
+
+    let MakeFilter = 
+        let F = MakeGenericStaticMethod <@ Seq.filter @>
+        fun (srcTy,f,src)  -> 
+            F ([srcTy],[f;src])
+
+    let (|MacroReduction|_|) (p : Expr) = 
+        match p with 
+        | Applications(Lambdas(vs,body),args) when vs.Length = args.Length && List.forall2 (fun vs arg -> List.length vs = List.length args) vs args -> 
+            let tab = Map.ofSeq (List.concat (List.map2 List.zip vs args))
+            let body = body.Substitute tab.TryFind 
+            Some body
+
+        // Macro
+        | PropertyGet(None,Getter(MethodWithReflectedDefinition(body)),[]) -> 
+            Some body
+
+        // Macro
+        | Call(None,MethodWithReflectedDefinition(Lambdas(vs,body)),args) -> 
+            let tab = Map.ofSeq (List.concat (List.map2 (fun (vs:Var list) arg -> match vs,arg with [v],arg -> [(v,arg)] | vs,NewTuple(args) -> List.zip vs args | _ -> List.zip vs [arg]) vs args))
+            let body = body.Substitute tab.TryFind 
+            Some body
+
+        // Macro
+        | Let(v,e,body) ->
+            let tab = Map.ofSeq [ (v,e) ]
+            let body = body.Substitute tab.TryFind 
+            Some body
+        | _ -> None
+
+    let rec MacroExpand (p : Expr) = 
+        match p with 
+        // Macro reduction
+        | MacroReduction(reduced) -> 
+            MacroExpand reduced
+        | ExprShape.ShapeCombination(comb,args) ->
+            ExprShape.RebuildShapeCombination(comb, List.map MacroExpand args)
+        | ExprShape.ShapeLambda(v,body) ->
+            Expr.Lambda(v, MacroExpand body)
+        | ExprShape.ShapeVar _ -> p
+
+    let (|PipedCallMapConcat|_|) = (|SpecificPipedCall1|_|) <@ Seq.collect @>
+    let (|CallSingleton|_|) = (|SpecificCall|_|) <@ Seq.singleton @>
+    let (|CallEmpty|_|) = (|SpecificCall|_|) <@ Seq.empty @>
+    let (|PipedCallSort|_|) = (|SpecificPipedCall0|_|) <@ Seq.sort @>
+    let (|PipedCallSortBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.sortBy @>
+    let (|PipedCallSeqGroupBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.groupBy @>
+    let (|PipedCallSeqMinBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.minBy @>
+    let (|PipedCallSeqMaxBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.maxBy @>
+    let (|PipedCallQueryGroupBy|_|) = (|SpecificPipedCall1|_|) <@ groupBy @>
+    let (|PipedCallQueryMinBy|_|) = (|SpecificPipedCall1|_|) <@ minBy @>
+    let (|PipedCallQueryMaxBy|_|) = (|SpecificPipedCall1|_|) <@ maxBy @>
+    let (|PipedCallSeqMap|_|) = (|SpecificPipedCall1|_|) <@ Seq.map @>
+    let (|PipedCallSeqAppend|_|) = (|SpecificPipedCall1|_|) <@ Seq.append @>
+    let (|PipedCallSeqFilter|_|) = (|SpecificPipedCall1|_|) <@ Seq.filter @>
+    let (|PipedCallSeqExists|_|) = (|SpecificPipedCall1|_|) <@ Seq.exists @>
+    let (|PipedCallSeqForAll|_|) = (|SpecificPipedCall1|_|) <@ Seq.forall @>
+    let (|PipedCallSeqDelay|_|) = (|SpecificPipedCall0|_|) <@ Seq.delay @>
+    let (|PipedCallSeqDistinct|_|) = (|SpecificPipedCall0|_|) <@ Seq.distinct @>
+    let (|PipedCallSeqToList|_|) = (|SpecificPipedCall0|_|) <@ Seq.toList @>
+    let (|PipedCallSeqTake|_|) = (|SpecificPipedCall1|_|) <@ Seq.take @>
+    let (|PipedCallSeqTruncate|_|) = (|SpecificPipedCall1|_|) <@ Seq.truncate @>
+    let (|PipedCallSeqToArray|_|) = (|SpecificPipedCall0|_|) <@ Seq.toArray @>
+    let (|PipedCallSeqMin|_|) = (|SpecificPipedCall0|_|) <@ Seq.min @>
+    let (|PipedCallSeqMax|_|) = (|SpecificPipedCall0|_|) <@ Seq.max @>
+    let (|PipedCallQueryContains|_|) = (|SpecificPipedCall1|_|) <@ contains @>
+    let (|CallSeq|_|) = (|SpecificCall|_|) <@ seq @>
+    let (|CallQueryJoin|_|) = (|SpecificCall|_|) <@ join @>
+    let (|CallQueryGroupJoin|_|) = (|SpecificCall|_|) <@ groupJoin @>
+    let (|PipedCallAverageBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.averageBy : (float -> float) -> seq<float> -> float @> 
+    let (|PipedCallAverage|_|) = (|SpecificPipedCall0|_|) <@ Seq.average: seq<float> -> float @>
+    let (|PipedCallSumBy|_|) = (|SpecificPipedCall1|_|) <@ Seq.sumBy : (float -> float) -> seq<float> -> float @>
+    let (|PipedCallSum|_|) = (|SpecificPipedCall0|_|) <@ Seq.sum: seq<float> -> float @>
+    let (|PipedCallSeqLength|_|) = (|SpecificPipedCall0|_|) <@ Seq.length @>
+    let (|PipedCallSeqHead|_|) = (|SpecificPipedCall0|_|) <@ Seq.head @>
+    let (|PipedCallSeqFind|_|) = (|SpecificPipedCall1|_|) <@ Seq.find @>
+
+    let query (p : Expr<'T1>) : 'T1 = 
+
+        let body = (p :> Expr)
+        let rec TransInner (tm:Expr) = 
+            match tm with 
+            // Look through coercions, e.g. to IEnumerable 
+            | Coerce (expr,ty) -> 
+                TransInner expr
+            
+            // Seq.collect (fun x -> if P x then tgt else Seq.empty)  sq @> 
+            //    ~~> TRANS(Seq.collect (x -> tgt) (sq.Where(x -> P x))
+            | PipedCallMapConcat ([srcTy;_;targetTy],Lambda(selectorVar, selector),sq) ->
+                let rec TransMapConcatSelector t = 
+                    match t with 
+                    | CallSingleton(None, _,[res]) -> 
+
+                        MakeQueryableSelect(srcTy,targetTy, TransInner sq, [selectorVar],MacroExpand res)
+
+
+                    | IfThenElse(g,tgt,CallEmpty (None, [_],[])) ->
+
+                        let sq = MakeFilter(srcTy,Expr.Lambda(selectorVar,g),sq)
+                        let sq = TransInner (MakeMapConcat(srcTy,targetTy,Expr.Lambda(selectorVar,tgt),sq))
+                        sq
+
+                    | MacroReduction(reduced) -> 
+                        TransMapConcatSelector reduced
+
+                    | selectorBody ->
+                        let selectorBody = TransInner selectorBody
+                        // For some reason IQueryable.SelectMany expects an IEnumerable return
+                        // REVIEW: Previous notes in this file said that LINQ likes to see a coercion to an interface type at this point. 
+                        let selectorBody = Expr.Coerce(TransInner selectorBody,MakeIEnumerableTy targetTy)
+                        MakeQueryableSelectMany(srcTy,targetTy, TransInner sq, selectorVar,selectorBody)
+
+                TransMapConcatSelector selector
+            
+            | PipedCallSeqMap ([srcTy;targetTy],Lambda(v,res),sq) ->
+        
+                MakeQueryableSelect(srcTy,targetTy, TransInner sq, [v],MacroExpand res)
+
+            | PipedCallSeqAppend ([srcTy],sq1,sq2) ->
+        
+                MakeQueryableAppend(srcTy, TransInner sq1, TransInner sq2)
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | PipedCallSeqFilter ([srcTy],Lambda(v,res),sq) ->
+
+                MakeQueryableWhere(srcTy, TransInner sq, v,MacroExpand res)
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | PipedCallSeqDelay (_,Lambda(_,body)) ->
+        
+                TransInner body
+            
+            // These occur in the F# quotation form of F# sequence expressions            
+            | CallSeq (None, _,[body]) ->
+        
+                TransInner body
+
+                
+            | IfThenElse(g,t,e) ->
+
+                Expr.IfThenElse(g,TransInner t, TransInner e)
+
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            | CallEmpty (None, [ty],[]) ->
+        
+                MakeQueryableEmpty ty
+
+
+            | PipedCallSortBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableOrderBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSort([ srcTy ],source) ->
+
+                let v = new Var("x",srcTy)
+                MakeQueryableOrderBy(srcTy,srcTy, TransInner source, v,Expr.Var v)
+
+            | PipedCallSeqGroupBy _ ->
+
+                failwithf "The operator Seq.groupBy may not be used in queries. Use Microsoft.FSharp.Query.groupNy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryGroupBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableGroupBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqMinBy _ ->
+
+                failwithf "The operator Seq.minBy may not be used in queries. Use Microsoft.FSharp.Query.minBy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryMinBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableMinBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqMaxBy _ ->
+
+                failwithf "The operator Seq.maxBy may not be used in queries. Use Microsoft.FSharp.Query.maxBy instead, which has a different return type to the standard F# operator" tm 
+
+            | PipedCallQueryMaxBy([ srcTy; keyTy ],Lambda(v,keySelector),source) ->
+
+                MakeQueryableMaxBy(srcTy,keyTy, TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqExists([ srcTy],Lambda(v,keySelector),source) ->
+
+                MakeQueryableAny(srcTy,TransInner source, v,MacroExpand keySelector)
+
+            | PipedCallSeqForAll([ srcTy],Lambda(v,keySelector),source) ->
+
+                MakeQueryableAll(srcTy,TransInner source, v,MacroExpand keySelector)
+
+            | CallQueryJoin(None, [ outerSourceTy;innerSourceTy;keyTy;resultTy ],[outerSource;innerSource;Lambda(outerKeyVar,outerKeySelector);Lambda(innerKeyVar,innerKeySelector);Lambdas([[outerResultKeyVar];[innerResultKeyVar]],resultSelector)])->
+
+                MakeQueryableJoin(outerSourceTy,innerSourceTy,keyTy,resultTy,TransInner outerSource,TransInner innerSource,outerKeyVar,MacroExpand outerKeySelector,innerKeyVar,MacroExpand innerKeySelector,outerResultKeyVar,innerResultKeyVar,MacroExpand resultSelector)  
+
+            | CallQueryGroupJoin(None, [ outerSourceTy;innerSourceTy;keyTy;resultTy ],[outerSource;innerSource;Lambda(outerKeyVar,outerKeySelector);Lambda(innerKeyVar,innerKeySelector);Lambdas([[outerResultKeyVar];[innerResultKeyVar]],resultSelector)])->
+
+                MakeQueryableGroupJoin(outerSourceTy,innerSourceTy,keyTy,resultTy,TransInner outerSource,TransInner innerSource,outerKeyVar,MacroExpand outerKeySelector,innerKeyVar,MacroExpand innerKeySelector,outerResultKeyVar,innerResultKeyVar,MacroExpand resultSelector)  
+
+            | PipedCallSeqDistinct([ srcTy ],source) ->
+                MakeQueryableDistinct(srcTy, TransInner source)
+
+
+            | PipedCallSeqTake([ srcTy ],count,sq) 
+            | PipedCallSeqTruncate([ srcTy ],count,sq) ->
+                MakeQueryableTake(srcTy, TransInner sq, MacroExpand count)
+
+            | MacroReduction(reduced) -> 
+                TransInner reduced
+
+            // These occur in the F# quotation form of F# sequence expressions            
+            //
+            //       match i.Data with 
+            //       | 8 -> ...
+            //       | _ -> ()
+            | Sequential(Value( _, unitType), sq) when unitType  = typeof<unit> -> 
+        
+                TransInner sq
+
+            | expr when typeof<IQueryable>.IsAssignableFrom(expr.Type) ->
+                expr
+
+
+            // Error cases
+            | _  -> 
+                failwithf "The following construct was used in query but is not recognised by the F#-to-LINQ query translator:\n%A\nThis is not a valid query expression. Check the specification of permitted queries and consider moving some of the query out of the quotation" tm 
+
+        let EvalInner (tm:Expr) = (TransInner tm).EvalUntyped()
+
+        let rec EvalOuterWithPostProcess (tm:Expr) = 
+            match tm with
+            
+            // Allow SQL <@ [ for x in ... ] @>
+            | PipedCallSeqToList ([srcTy],sq) ->
+        
+                CallSeqToList (srcTy,EvalInner sq)
+
+            | PipedCallSeqToArray ([srcTy],sq) ->
+        
+                CallSeqToArray (srcTy,EvalInner sq)
+
+
+            | PipedCallSeqMin ([srcTy],sq) ->
+
+                CallQueryableMin(srcTy,EvalInner sq)
+
+            | PipedCallSeqMax ([srcTy],sq) ->
+
+                CallQueryableMax(srcTy,EvalInner sq)
+
+            | PipedCallQueryContains ([srcTy],v,sq) ->
+
+                CallQueryableContains(srcTy,EvalInner sq,(MacroExpand v).ToLinqExpression())
+
+            | PipedCallAverageBy([srcTy;destTy],Lambda(v,res),sq) ->
+
+                CallQueryableAverageBy(srcTy, destTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,destTy,v,MacroExpand  res))
+
+            | PipedCallAverage ([srcTy],sq) ->
+
+                CallQueryableAverage(srcTy, EvalInner sq)
+
+            | PipedCallSumBy ([srcTy;destTy],Lambda(v,res),sq) ->
+
+                CallQueryableSumBy(srcTy, destTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,destTy,v,MacroExpand  res))
+
+            | PipedCallSum ([srcTy],sq) ->
+
+                CallQueryableSum(srcTy, EvalInner sq)
+
+            | PipedCallSeqLength ([ srcTy ],sq) ->
+                CallQueryableCount(srcTy, EvalInner sq)
+
+            | PipedCallSeqHead ([ srcTy ],sq) ->
+                CallQueryableFirst(srcTy, EvalInner sq)
+
+            | PipedCallSeqFind([ srcTy ],sq, NewDelegate(_,[v],f)) ->
+                CallQueryableFirstFind(srcTy, EvalInner sq, FuncExprToLinqFunc2Expression (srcTy,boolTy,v,MacroExpand f))
+
+            | MacroReduction(reduced) -> 
+                EvalOuterWithPostProcess reduced
+
+            | _  -> 
+                EvalInner tm
+        
+        let res = EvalOuterWithPostProcess body 
+        unbox res
+
+
+    let SQL x = query x
+
+open Query
+
+module IQueryableTests =
+    
+    type Customer = { mutable Name:string; Data: int; Cost:float; Sizes: int list }
+    let c1 = { Name="Don"; Data=6; Cost=6.2; Sizes=[1;2;3;4] }
+    let c2 = { Name="Peter"; Data=7; Cost=4.2; Sizes=[10;20;30;40] }
+    let c3 = { Name="Freddy"; Data=8; Cost=9.2; Sizes=[11;12;13;14] }
+    let c4 = { Name="Freddi"; Data=8; Cost=1.0; Sizes=[21;22;23;24] }
+    
+    let data = [c1;c2;c3;c4]
+    let db = System.Linq.Queryable.AsQueryable<Customer>(data |> List.toSeq)
+
+    printfn "db = %A" (Reflection.FSharpType.GetRecordFields (typeof<Customer>, System.Reflection.BindingFlags.Public ||| System.Reflection.BindingFlags.NonPublic))
+    let q1 = <@ seq { for i in db -> i.Name } @>
+    let q2 = <@ c1.Name @>
+    printfn "q2 = %A" q2
+    
+    printfn "db = %A" db.Expression
+
+    let checkCommuteSeq s q =
+        check s (query q |> Seq.toList) (q.Eval() |> Seq.toList)
+
+    let checkCommuteVal s q =
+        check s (query q) (q.Eval())
+
+    let q = <@ System.DateTime.Now - System.DateTime.Now @>
+    q.Eval()
+    
+    checkCommuteSeq "cnewnc01" <@ db @>
+    //debug <- true
+    checkCommuteSeq "cnewnc02" <@ seq { for i in db -> i }  @>
+    checkCommuteSeq "cnewnc03" <@ seq { for i in db -> i.Name }  @>
+    checkCommuteSeq "cnewnc04" <@ [ for i in db -> i.Name ]  @>
+    checkCommuteSeq "cnewnc05" <@ [ for i in db do yield i.Name ]  @>
+    checkCommuteSeq "cnewnc06" <@ [ for i in db do 
+                                      for j in db do 
+                                          yield (i.Name,j.Name) ] @>
+
+    checkCommuteSeq "cnewnc07" <@ [ for i in db do 
+                                      for j in db do 
+                                          if i.Data = j.Data then 
+                                              yield (i.Data,i.Name,j.Name) ] @>
+
+    checkCommuteSeq "cnewnc08"  <@ [ for i in db do 
+                                      if i.Data = 8 then 
+                                          for j in db do 
+                                              if i.Data = j.Data then 
+                                                  yield (i.Data,i.Name,j.Name) ] @>
+
+    checkCommuteSeq "cnewnc08"  <@ [ for i in db do 
+                                      match i.Data with 
+                                      | 8 -> 
+                                          for j in db do 
+                                              if i.Data = j.Data then 
+                                                  yield (i.Data,i.Name,j.Name) 
+                                      | _ -> 
+                                          () ] @>
+
+
+
+    // EXPECT PASS
+    checkCommuteSeq "cnewnc08"  <@  seq { for i in db do for j in db do yield (i.Data) }  @>
+    checkCommuteSeq "cnewnc08"  <@  db |> Seq.take 3 @>
+    checkCommuteVal "cnewnc08"  <@  db |> Seq.take 3 |> Seq.length @>
+    checkCommuteVal "cnewnc08"  <@  Seq.length (seq { for i in db do for j in db do yield (i.Data) })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.length (seq { for i in db do for j in db do yield (i.Data) })   @> 
+    checkCommuteVal "cnewnc08"  <@  (seq { for i in db do for j in db do yield (i.Data) })  |> Seq.length  @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.max (seq { for i in db do for j in db do yield (i.Data) })   @> 
+    checkCommuteVal "cnewnc08"  <@  seq { for i in db do for j in db do yield (i.Data) } |> Seq.max   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.min (seq { for i in db do for j in db do yield (i.Data) })   @> 
+    checkCommuteVal "cnewnc08"  <@  seq { for i in db do for j in db do yield (i.Data) } |> Seq.min  @> 
+    checkCommuteSeq "cnewnc08"  <@ Seq.distinct (seq { for i in db do for j in db do yield i }) @>
+    checkCommuteSeq "cnewnc08"  <@ seq { for i in db do for j in db do yield i } |> Seq.distinct @>
+    checkCommuteVal "cnewnc08"  <@  Seq.max (seq { for i in db do for j in db do yield float i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.max (seq { for i in db do for j in db do yield float32 i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.max (seq { for i in db do for j in db do yield decimal i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.min (seq { for i in db do for j in db do yield float i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.min (seq { for i in db do for j in db do yield float32 i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.min (seq { for i in db do for j in db do yield decimal i.Data })   @> 
+    checkCommuteVal "cnewnc08"  <@  Seq.average (seq { for i in db do for j in db do yield i.Cost })   @> 
+    checkCommuteVal "cnewnc08"  <@   (seq { for i in db do for j in db do yield i.Cost })  |> Seq.average @> 
+
+    checkCommuteSeq "cnewnc08"  (<@ Query.groupBy
+                                        (fun x -> x) 
+                                        (seq { for i in db do yield i.Data })  |> Seq.map Seq.toList |> Seq.toList @> ) 
+
+
+    checkCommuteSeq "cnewnc08"  (<@ Query.join 
+                                        (seq { for i in db do yield i.Data }) 
+                                        (seq { for i in db do yield i.Data })  
+                                        (fun x -> x) 
+                                        (fun x -> x) 
+                                        (fun x y -> x + y) @> ) 
+
+    checkCommuteSeq "cnewnc08"  (<@ Query.groupJoin 
+                                        (seq { for i in db do yield i.Data }) 
+                                        (seq { for i in db do yield i.Data }) 
+                                        (fun x -> x) 
+                                        (fun x -> x) 
+                                        (fun x y -> x + Seq.length y)  @> ) 
+
+    check "cnewnc08"  (query <@  Seq.average (seq { for i in db do for j in db do yield (i.Cost) })   @>  - 5.15 <= 0.0000001) true
+
+    // By design: no 'distinctBy', "maxBy", "minBy", "groupBy" support in queries
+    check "lcvkneio" (try let _ = query <@ Seq.distinctBy (fun x -> x) (seq { for i in db do for j in db do yield i })  @> in  false with _ -> true) true
+    check "lcvkneio" (try let _ = query <@ Seq.maxBy (fun x -> x) (seq { for i in db do for j in db do yield i })  @> in  false with _ -> true) true
+    check "lcvkneio" (try let _ = query <@ Seq.minBy (fun x -> x) (seq { for i in db do for j in db do yield i })  @> in  false with _ -> true) true
+    check "lcvkneio" (try let _ = query <@ Seq.groupBy (fun x -> x) (seq { for i in db do for j in db do yield i })  @> in  false with _ -> true) true
+    
+    
+
+let _ = 
+  if not failures.IsEmpty then 
+      printfn "Test Failed, failures = %A" failures; 
+      exit 1
+  else  
+      stdout.WriteLine "Test Passed"; 
+      System.IO.File.WriteAllText("test.ok","ok"); 
+      exit 0
+
diff --git a/tests/fsharp/tools/tdirs b/tests/fsharp/tools/tdirs
new file mode 100644
index 0000000..ecb2f0b
--- /dev/null
+++ b/tests/fsharp/tools/tdirs
@@ -0,0 +1,2 @@
+bundle
+eval
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/build-typeprovider-test.bat b/tests/fsharp/typeProviders/build-typeprovider-test.bat
new file mode 100644
index 0000000..c6938b7
--- /dev/null
+++ b/tests/fsharp/typeProviders/build-typeprovider-test.bat
@@ -0,0 +1,48 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\config.bat
+
+if EXIST provided.dll del provided.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided.dll -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+
+if EXIST providedJ.dll del providedJ.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedJ.dll -a ..\helloWorld\providedJ.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedK.dll del providedK.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedK.dll -a ..\helloWorld\providedK.fs
+if errorlevel 1 goto :Error
+
+
+
+if EXIST provider.dll del provider.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provider.dll -a provider.fsx
+if ERRORLEVEL 1 goto :Error
+
+call %~d0%~p0..\single-test-build.bat
+goto :Ok
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/AdventureWorksDev10.dbml b/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/AdventureWorksDev10.dbml
new file mode 100644
index 0000000..0e1803a
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/AdventureWorksDev10.dbml
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="utf-8"?><Database Name="AdventureWorks" Class="DataClasses1DataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
+  <Connection Mode="AppSettings" ConnectionString="Data Source=FSHARPSRV08;Initial Catalog=AdventureWorks;Integrated Security=True" Provider="System.Data.SqlClient" />
+  <Table Name="HumanResources.Department" Member="Departments">
+    <Type Name="Department">
+      <Column Name="DepartmentID" Type="System.Int16" DbType="SmallInt NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="Name" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="GroupName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Department_EmployeeDepartmentHistory" Member="EmployeeDepartmentHistories" ThisKey="DepartmentID" OtherKey="DepartmentID" Type="EmployeeDepartmentHistory" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.Employee" Member="Employees">
+    <Type Name="Employee">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="NationalIDNumber" Type="System.String" DbType="NVarChar(15) NOT NULL" CanBeNull="false" />
+      <Column Name="ContactID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="LoginID" Type="System.String" DbType="NVarChar(256) NOT NULL" CanBeNull="false" />
+      <Column Name="ManagerID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="Title" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="BirthDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="MaritalStatus" Type="System.Char" DbType="NChar(1) NOT NULL" CanBeNull="false" />
+      <Column Name="Gender" Type="System.Char" DbType="NChar(1) NOT NULL" CanBeNull="false" />
+      <Column Name="HireDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="SalariedFlag" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+      <Column Name="VacationHours" Type="System.Int16" DbType="SmallInt NOT NULL" CanBeNull="false" />
+      <Column Name="SickLeaveHours" Type="System.Int16" DbType="SmallInt NOT NULL" CanBeNull="false" />
+      <Column Name="CurrentFlag" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+      <Column Name="rowguid" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Employee_Employee" Member="Employees" ThisKey="EmployeeID" OtherKey="ManagerID" Type="Employee" />
+      <Association Name="Employee_EmployeeAddress" Member="EmployeeAddresses" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="EmployeeAddress" />
+      <Association Name="Employee_EmployeeDepartmentHistory" Member="EmployeeDepartmentHistories" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="EmployeeDepartmentHistory" />
+      <Association Name="Employee_EmployeePayHistory" Member="EmployeePayHistories" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="EmployeePayHistory" />
+      <Association Name="Employee_JobCandidate" Member="JobCandidates" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="JobCandidate" />
+      <Association Name="Employee_Employee" Member="Employee1" ThisKey="ManagerID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.EmployeeAddress" Member="EmployeeAddresses">
+    <Type Name="EmployeeAddress">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="AddressID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="rowguid" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Employee_EmployeeAddress" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.EmployeeDepartmentHistory" Member="EmployeeDepartmentHistories">
+    <Type Name="EmployeeDepartmentHistory">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="DepartmentID" Type="System.Int16" DbType="SmallInt NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="ShiftID" Type="System.Byte" DbType="TinyInt NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Department_EmployeeDepartmentHistory" Member="Department" ThisKey="DepartmentID" OtherKey="DepartmentID" Type="Department" IsForeignKey="true" />
+      <Association Name="Employee_EmployeeDepartmentHistory" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+      <Association Name="Shift_EmployeeDepartmentHistory" Member="Shift" ThisKey="ShiftID" OtherKey="ShiftID" Type="Shift" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.EmployeePayHistory" Member="EmployeePayHistories">
+    <Type Name="EmployeePayHistory">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="RateChangeDate" Type="System.DateTime" DbType="DateTime NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="Rate" Type="System.Decimal" DbType="Money NOT NULL" CanBeNull="false" />
+      <Column Name="PayFrequency" Type="System.Byte" DbType="TinyInt NOT NULL" CanBeNull="false" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Employee_EmployeePayHistory" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.JobCandidate" Member="JobCandidates">
+    <Type Name="JobCandidate">
+      <Column Name="JobCandidateID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="Resume" Type="System.Xml.Linq.XElement" DbType="Xml" CanBeNull="true" UpdateCheck="Never" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Employee_JobCandidate" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.Shift" Member="Shifts">
+    <Type Name="Shift">
+      <Column Name="ShiftID" Type="System.Byte" DbType="TinyInt NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="Name" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="StartTime" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="EndTime" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="ModifiedDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Association Name="Shift_EmployeeDepartmentHistory" Member="EmployeeDepartmentHistories" ThisKey="ShiftID" OtherKey="ShiftID" Type="EmployeeDepartmentHistory" />
+    </Type>
+  </Table>
+  <Table Name="HumanResources.vEmployee" Member="vEmployees">
+    <Type Name="vEmployee">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="Title" Type="System.String" DbType="NVarChar(8)" CanBeNull="true" />
+      <Column Name="FirstName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="MiddleName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="LastName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="Suffix" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
+      <Column Name="JobTitle" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="Phone" Type="System.String" DbType="NVarChar(25)" CanBeNull="true" />
+      <Column Name="EmailAddress" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="EmailPromotion" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="AddressLine1" Type="System.String" DbType="NVarChar(60) NOT NULL" CanBeNull="false" />
+      <Column Name="AddressLine2" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
+      <Column Name="City" Type="System.String" DbType="NVarChar(30) NOT NULL" CanBeNull="false" />
+      <Column Name="StateProvinceName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="PostalCode" Type="System.String" DbType="NVarChar(15) NOT NULL" CanBeNull="false" />
+      <Column Name="CountryRegionName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="AdditionalContactInfo" Type="System.Xml.Linq.XElement" DbType="Xml" CanBeNull="true" UpdateCheck="Never" />
+    </Type>
+  </Table>
+  <Function Name="dbo.uspGetBillOfMaterials" Method="uspGetBillOfMaterials">
+    <Parameter Name="StartProductID" Parameter="startProductID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="CheckDate" Parameter="checkDate" Type="System.DateTime" DbType="DateTime" />
+    <ElementType Name="uspGetBillOfMaterialsResult">
+      <Column Name="ProductAssemblyID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ComponentID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ComponentDesc" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="TotalQuantity" Type="System.Decimal" DbType="Decimal(38,2)" CanBeNull="true" />
+      <Column Name="StandardCost" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="ListPrice" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="BOMLevel" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
+      <Column Name="RecursionLevel" Type="System.Int32" DbType="Int" CanBeNull="true" />
+    </ElementType>
+  </Function>
+  <Function Name="HumanResources.uspUpdateEmployeePersonalInfo" Method="uspUpdateEmployeePersonalInfo">
+    <Parameter Name="EmployeeID" Parameter="employeeID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="NationalIDNumber" Parameter="nationalIDNumber" Type="System.String" DbType="NVarChar(15)" />
+    <Parameter Name="BirthDate" Parameter="birthDate" Type="System.DateTime" DbType="DateTime" />
+    <Parameter Name="MaritalStatus" Parameter="maritalStatus" Type="System.Char" DbType="NChar(1)" />
+    <Parameter Name="Gender" Parameter="gender" Type="System.Char" DbType="NChar(1)" />
+    <Return Type="System.Int32" />
+  </Function>
+  <Function Name="dbo.uspGetEmployeeManagers" Method="uspGetEmployeeManagers">
+    <Parameter Name="EmployeeID" Parameter="employeeID" Type="System.Int32" DbType="Int" />
+    <ElementType Name="uspGetEmployeeManagersResult">
+      <Column Name="RecursionLevel" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="FirstName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="LastName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="ManagerID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ManagerFirstName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="ManagerLastName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+    </ElementType>
+  </Function>
+  <Function Name="dbo.uspGetManagerEmployees" Method="uspGetManagerEmployees">
+    <Parameter Name="ManagerID" Parameter="managerID" Type="System.Int32" DbType="Int" />
+    <ElementType Name="uspGetManagerEmployeesResult">
+      <Column Name="RecursionLevel" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ManagerID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ManagerFirstName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="ManagerLastName" Type="System.String" DbType="NVarChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="FirstName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="LastName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+    </ElementType>
+  </Function>
+  <Function Name="dbo.uspGetWhereUsedProductID" Method="uspGetWhereUsedProductID">
+    <Parameter Name="StartProductID" Parameter="startProductID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="CheckDate" Parameter="checkDate" Type="System.DateTime" DbType="DateTime" />
+    <ElementType Name="uspGetWhereUsedProductIDResult">
+      <Column Name="ProductAssemblyID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ComponentID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="ComponentDesc" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="TotalQuantity" Type="System.Decimal" DbType="Decimal(38,2)" CanBeNull="true" />
+      <Column Name="StandardCost" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="ListPrice" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="BOMLevel" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
+      <Column Name="RecursionLevel" Type="System.Int32" DbType="Int" CanBeNull="true" />
+    </ElementType>
+  </Function>
+  <Function Name="dbo.uspLogError" Method="uspLogError">
+    <Parameter Name="ErrorLogID" Parameter="errorLogID" Type="System.Int32" DbType="Int" Direction="InOut" />
+    <Return Type="System.Int32" />
+  </Function>
+  <Function Name="dbo.uspPrintError" Method="uspPrintError">
+    <Return Type="System.Int32" />
+  </Function>
+  <Function Name="HumanResources.uspUpdateEmployeeHireInfo" Method="uspUpdateEmployeeHireInfo">
+    <Parameter Name="EmployeeID" Parameter="employeeID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="Title" Parameter="title" Type="System.String" DbType="NVarChar(50)" />
+    <Parameter Name="HireDate" Parameter="hireDate" Type="System.DateTime" DbType="DateTime" />
+    <Parameter Name="RateChangeDate" Parameter="rateChangeDate" Type="System.DateTime" DbType="DateTime" />
+    <Parameter Name="Rate" Parameter="rate" Type="System.Decimal" DbType="Money" />
+    <Parameter Name="PayFrequency" Parameter="payFrequency" Type="System.Byte" DbType="TinyInt" />
+    <Parameter Name="CurrentFlag" Parameter="currentFlag" Type="System.Boolean" DbType="Bit" />
+    <Return Type="System.Int32" />
+  </Function>
+  <Function Name="HumanResources.uspUpdateEmployeeLogin" Method="uspUpdateEmployeeLogin">
+    <Parameter Name="EmployeeID" Parameter="employeeID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="ManagerID" Parameter="managerID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="LoginID" Parameter="loginID" Type="System.String" DbType="NVarChar(256)" />
+    <Parameter Name="Title" Parameter="title" Type="System.String" DbType="NVarChar(50)" />
+    <Parameter Name="HireDate" Parameter="hireDate" Type="System.DateTime" DbType="DateTime" />
+    <Parameter Name="CurrentFlag" Parameter="currentFlag" Type="System.Boolean" DbType="Bit" />
+    <Return Type="System.Int32" />
+  </Function>
+  <Function Name="dbo.ufnGetAccountingEndDate" Method="ufnGetAccountingEndDate" IsComposable="true">
+    <Return Type="System.DateTime" />
+  </Function>
+  <Function Name="dbo.ufnLeadingZeros" Method="ufnLeadingZeros" IsComposable="true">
+    <Parameter Name="Value" Parameter="value" Type="System.Int32" DbType="Int" />
+    <Return Type="System.String" />
+  </Function>
+  <Function Name="dbo.ufnGetAccountingStartDate" Method="ufnGetAccountingStartDate" IsComposable="true">
+    <Return Type="System.DateTime" />
+  </Function>
+  <Function Name="dbo.ufnGetContactInformation" Method="ufnGetContactInformation" IsComposable="true">
+    <Parameter Name="ContactID" Parameter="contactID" Type="System.Int32" DbType="Int" />
+    <ElementType Name="ufnGetContactInformationResult">
+      <Column Name="ContactID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="FirstName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="LastName" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="JobTitle" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+      <Column Name="ContactType" Type="System.String" DbType="NVarChar(50)" CanBeNull="true" />
+    </ElementType>
+  </Function>
+  <Function Name="dbo.ufnGetDocumentStatusText" Method="ufnGetDocumentStatusText" IsComposable="true">
+    <Parameter Name="Status" Parameter="status" Type="System.Byte" DbType="TinyInt" />
+    <Return Type="System.String" />
+  </Function>
+  <Function Name="dbo.ufnGetProductDealerPrice" Method="ufnGetProductDealerPrice" IsComposable="true">
+    <Parameter Name="ProductID" Parameter="productID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="OrderDate" Parameter="orderDate" Type="System.DateTime" DbType="DateTime" />
+    <Return Type="System.Decimal" />
+  </Function>
+  <Function Name="dbo.ufnGetProductListPrice" Method="ufnGetProductListPrice" IsComposable="true">
+    <Parameter Name="ProductID" Parameter="productID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="OrderDate" Parameter="orderDate" Type="System.DateTime" DbType="DateTime" />
+    <Return Type="System.Decimal" />
+  </Function>
+  <Function Name="dbo.ufnGetProductStandardCost" Method="ufnGetProductStandardCost" IsComposable="true">
+    <Parameter Name="ProductID" Parameter="productID" Type="System.Int32" DbType="Int" />
+    <Parameter Name="OrderDate" Parameter="orderDate" Type="System.DateTime" DbType="DateTime" />
+    <Return Type="System.Decimal" />
+  </Function>
+  <Function Name="dbo.ufnGetPurchaseOrderStatusText" Method="ufnGetPurchaseOrderStatusText" IsComposable="true">
+    <Parameter Name="Status" Parameter="status" Type="System.Byte" DbType="TinyInt" />
+    <Return Type="System.String" />
+  </Function>
+  <Function Name="dbo.ufnGetSalesOrderStatusText" Method="ufnGetSalesOrderStatusText" IsComposable="true">
+    <Parameter Name="Status" Parameter="status" Type="System.Byte" DbType="TinyInt" />
+    <Return Type="System.String" />
+  </Function>
+  <Function Name="dbo.ufnGetStock" Method="ufnGetStock" IsComposable="true">
+    <Parameter Name="ProductID" Parameter="productID" Type="System.Int32" DbType="Int" />
+    <Return Type="System.Int32" />
+  </Function>
+</Database>
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/SqlNorthwindDev11.dbml b/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/SqlNorthwindDev11.dbml
new file mode 100644
index 0000000..5778bc6
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/DbmlFile/DbmlFiles/SqlNorthwindDev11.dbml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?><Database Name="Sql2kNorthwind" Class="DataClasses1DataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
+  <Connection Mode="AppSettings" ConnectionString="Data Source=FSHARPSRV08;Initial Catalog=Sql2kNorthwind;Integrated Security=True" Provider="System.Data.SqlClient" />
+  <Table Name="dbo.Categories" Member="Categories">
+    <Type Name="Category">
+      <Column Name="CategoryID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="CategoryName" Type="System.String" DbType="NVarChar(15) NOT NULL" CanBeNull="false" />
+      <Column Name="Description" Type="System.String" DbType="NText" CanBeNull="true" UpdateCheck="Never" />
+      <Column Name="Picture" Type="System.Data.Linq.Binary" DbType="Image" CanBeNull="true" UpdateCheck="Never" />
+      <Association Name="Category_Product" Member="Products" ThisKey="CategoryID" OtherKey="CategoryID" Type="Product" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Territories" Member="Territories">
+    <Type Name="Territory">
+      <Column Name="TerritoryID" Type="System.String" DbType="NVarChar(20) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="TerritoryDescription" Type="System.String" DbType="NChar(50) NOT NULL" CanBeNull="false" />
+      <Column Name="RegionID" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Association Name="Territory_EmployeeTerritory" Member="EmployeeTerritories" ThisKey="TerritoryID" OtherKey="TerritoryID" Type="EmployeeTerritory" />
+      <Association Name="Region_Territory" Member="Region" ThisKey="RegionID" OtherKey="RegionID" Type="Region" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.CustomerCustomerDemo" Member="CustomerCustomerDemos">
+    <Type Name="CustomerCustomerDemo">
+      <Column Name="CustomerID" Type="System.String" DbType="NChar(5) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="CustomerTypeID" Type="System.String" DbType="NChar(10) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Association Name="CustomerDemographic_CustomerCustomerDemo" Member="CustomerDemographic" ThisKey="CustomerTypeID" OtherKey="CustomerTypeID" Type="CustomerDemographic" IsForeignKey="true" />
+      <Association Name="Customer_CustomerCustomerDemo" Member="Customer" ThisKey="CustomerID" OtherKey="CustomerID" Type="Customer" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.CustomerDemographics" Member="CustomerDemographics">
+    <Type Name="CustomerDemographic">
+      <Column Name="CustomerTypeID" Type="System.String" DbType="NChar(10) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="CustomerDesc" Type="System.String" DbType="NText" CanBeNull="true" UpdateCheck="Never" />
+      <Association Name="CustomerDemographic_CustomerCustomerDemo" Member="CustomerCustomerDemos" ThisKey="CustomerTypeID" OtherKey="CustomerTypeID" Type="CustomerCustomerDemo" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Customers" Member="Customers">
+    <Type Name="Customer">
+      <Column Name="CustomerID" Type="System.String" DbType="NChar(5) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="CompanyName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
+      <Column Name="ContactName" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
+      <Column Name="ContactTitle" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
+      <Column Name="Address" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
+      <Column Name="City" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="Region" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="PostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
+      <Column Name="Country" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="Phone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Column Name="Fax" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Association Name="Customer_CustomerCustomerDemo" Member="CustomerCustomerDemos" ThisKey="CustomerID" OtherKey="CustomerID" Type="CustomerCustomerDemo" />
+      <Association Name="Customer_Order" Member="Orders" ThisKey="CustomerID" OtherKey="CustomerID" Type="Order" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Employees" Member="Employees">
+    <Type Name="Employee">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="LastName" Type="System.String" DbType="NVarChar(20) NOT NULL" CanBeNull="false" />
+      <Column Name="FirstName" Type="System.String" DbType="NVarChar(10) NOT NULL" CanBeNull="false" />
+      <Column Name="Title" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
+      <Column Name="TitleOfCourtesy" Type="System.String" DbType="NVarChar(25)" CanBeNull="true" />
+      <Column Name="BirthDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="HireDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="Address" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
+      <Column Name="City" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="Region" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="PostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
+      <Column Name="Country" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="HomePhone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Column Name="Extension" Type="System.String" DbType="NVarChar(4)" CanBeNull="true" />
+      <Column Name="Photo" Type="System.Data.Linq.Binary" DbType="Image" CanBeNull="true" UpdateCheck="Never" />
+      <Column Name="Notes" Type="System.String" DbType="NText" CanBeNull="true" UpdateCheck="Never" />
+      <Column Name="ReportsTo" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="PhotoPath" Type="System.String" DbType="NVarChar(255)" CanBeNull="true" />
+      <Association Name="Employee_Employee" Member="Employees" ThisKey="EmployeeID" OtherKey="ReportsTo" Type="Employee" />
+      <Association Name="Employee_EmployeeTerritory" Member="EmployeeTerritories" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="EmployeeTerritory" />
+      <Association Name="Employee_Order" Member="Orders" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Order" />
+      <Association Name="Employee_Employee" Member="Employee1" ThisKey="ReportsTo" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.EmployeeTerritories" Member="EmployeeTerritories">
+    <Type Name="EmployeeTerritory">
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="TerritoryID" Type="System.String" DbType="NVarChar(20) NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Association Name="Employee_EmployeeTerritory" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+      <Association Name="Territory_EmployeeTerritory" Member="Territory" ThisKey="TerritoryID" OtherKey="TerritoryID" Type="Territory" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.[Order Details]" Member="Order_Details">
+    <Type Name="Order_Detail">
+      <Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="UnitPrice" Type="System.Decimal" DbType="Money NOT NULL" CanBeNull="false" />
+      <Column Name="Quantity" Type="System.Int16" DbType="SmallInt NOT NULL" CanBeNull="false" />
+      <Column Name="Discount" Type="System.Single" DbType="Real NOT NULL" CanBeNull="false" />
+      <Association Name="Order_Order_Detail" Member="Order" ThisKey="OrderID" OtherKey="OrderID" Type="Order" IsForeignKey="true" />
+      <Association Name="Product_Order_Detail" Member="Product" ThisKey="ProductID" OtherKey="ProductID" Type="Product" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Orders" Member="Orders">
+    <Type Name="Order">
+      <Column Name="OrderID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="CustomerID" Type="System.String" DbType="NChar(5)" CanBeNull="true" />
+      <Column Name="EmployeeID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="OrderDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="RequiredDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="ShippedDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="ShipVia" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="Freight" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="ShipName" Type="System.String" DbType="NVarChar(40)" CanBeNull="true" />
+      <Column Name="ShipAddress" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
+      <Column Name="ShipCity" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="ShipRegion" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="ShipPostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
+      <Column Name="ShipCountry" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Association Name="Order_Order_Detail" Member="Order_Details" ThisKey="OrderID" OtherKey="OrderID" Type="Order_Detail" />
+      <Association Name="Customer_Order" Member="Customer" ThisKey="CustomerID" OtherKey="CustomerID" Type="Customer" IsForeignKey="true" />
+      <Association Name="Employee_Order" Member="Employee" ThisKey="EmployeeID" OtherKey="EmployeeID" Type="Employee" IsForeignKey="true" />
+      <Association Name="Shipper_Order" Member="Shipper" ThisKey="ShipVia" OtherKey="ShipperID" Type="Shipper" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Products" Member="Products">
+    <Type Name="Product">
+      <Column Name="ProductID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="ProductName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
+      <Column Name="SupplierID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="CategoryID" Type="System.Int32" DbType="Int" CanBeNull="true" />
+      <Column Name="QuantityPerUnit" Type="System.String" DbType="NVarChar(20)" CanBeNull="true" />
+      <Column Name="UnitPrice" Type="System.Decimal" DbType="Money" CanBeNull="true" />
+      <Column Name="UnitsInStock" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
+      <Column Name="UnitsOnOrder" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
+      <Column Name="ReorderLevel" Type="System.Int16" DbType="SmallInt" CanBeNull="true" />
+      <Column Name="Discontinued" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
+      <Association Name="Product_Order_Detail" Member="Order_Details" ThisKey="ProductID" OtherKey="ProductID" Type="Order_Detail" />
+      <Association Name="Category_Product" Member="Category" ThisKey="CategoryID" OtherKey="CategoryID" Type="Category" IsForeignKey="true" />
+      <Association Name="Supplier_Product" Member="Supplier" ThisKey="SupplierID" OtherKey="SupplierID" Type="Supplier" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Region" Member="Regions">
+    <Type Name="Region">
+      <Column Name="RegionID" Type="System.Int32" DbType="Int NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="RegionDescription" Type="System.String" DbType="NChar(50) NOT NULL" CanBeNull="false" />
+      <Association Name="Region_Territory" Member="Territories" ThisKey="RegionID" OtherKey="RegionID" Type="Territory" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Shippers" Member="Shippers">
+    <Type Name="Shipper">
+      <Column Name="ShipperID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="CompanyName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
+      <Column Name="Phone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Association Name="Shipper_Order" Member="Orders" ThisKey="ShipperID" OtherKey="ShipVia" Type="Order" />
+    </Type>
+  </Table>
+  <Table Name="dbo.Suppliers" Member="Suppliers">
+    <Type Name="Supplier">
+      <Column Name="SupplierID" Type="System.Int32" DbType="Int NOT NULL IDENTITY" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="CompanyName" Type="System.String" DbType="NVarChar(40) NOT NULL" CanBeNull="false" />
+      <Column Name="ContactName" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
+      <Column Name="ContactTitle" Type="System.String" DbType="NVarChar(30)" CanBeNull="true" />
+      <Column Name="Address" Type="System.String" DbType="NVarChar(60)" CanBeNull="true" />
+      <Column Name="City" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="Region" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="PostalCode" Type="System.String" DbType="NVarChar(10)" CanBeNull="true" />
+      <Column Name="Country" Type="System.String" DbType="NVarChar(15)" CanBeNull="true" />
+      <Column Name="Phone" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Column Name="Fax" Type="System.String" DbType="NVarChar(24)" CanBeNull="true" />
+      <Column Name="HomePage" Type="System.String" DbType="NText" CanBeNull="true" UpdateCheck="Never" />
+      <Association Name="Supplier_Product" Member="Products" ThisKey="SupplierID" OtherKey="SupplierID" Type="Product" />
+    </Type>
+  </Table>
+</Database>
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/builtin/DbmlFile/build.bat b/tests/fsharp/typeProviders/builtin/DbmlFile/build.bat
new file mode 100644
index 0000000..0eb327b
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/DbmlFile/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/DbmlFile/run.bat b/tests/fsharp/typeProviders/builtin/DbmlFile/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/DbmlFile/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/DbmlFile/test.fsx b/tests/fsharp/typeProviders/builtin/DbmlFile/test.fsx
new file mode 100644
index 0000000..03ca30e
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/DbmlFile/test.fsx
@@ -0,0 +1,212 @@
+// #Conformance #TypeProviders #DbmlFile
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+[<AutoOpen>]
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+module CheckDbmlFileTypeProvider = 
+
+    let checkHostedType (hostedType: System.Type) = 
+        test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+        test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+        check "ceklc09wlkm2" hostedType.DeclaringType null
+        check "ceklc09wlkm3" hostedType.DeclaringMethod null
+        check "ceklc09wlkm4" hostedType.FullName "Microsoft.FSharp.Data.TypeProviders.DbmlFileApplied"
+        check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+        check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
+        check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
+        check "ceklc09wlkm9" (hostedType.GetMethods()) [| |]
+        check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
+        check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 14
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+            (set ["DataClasses1DataContext"; "Department"; "Employee"; "EmployeeAddress"; "EmployeeDepartmentHistory"; "EmployeePayHistory"; "JobCandidate"; "Shift"; "vEmployee"; "uspGetBillOfMaterialsResult"; "uspGetEmployeeManagersResult"; "uspGetManagerEmployeesResult"; "uspGetWhereUsedProductIDResult"; "ufnGetContactInformationResult"])
+
+        // Note: DbmlFile TP does not organize (yet?)
+        //       so I do not need to verify the nested types under "ServiceTypes"
+        //       See other TP tests for an example
+
+        // Deep check on one type: Department [Table]
+        let departementType = (hostedType.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Department"))
+        check "ceklc09wlkm131"  (set [ for x in departementType.GetProperties() -> x.Name ]) (set [|"DepartmentID"; "EmployeeDepartmentHistories"; "GroupName"; "ModifiedDate"; "Name"|])
+        check "ceklc09wlkm133a"  (set [ for x in departementType.GetFields() -> x.Name ]) (set [| |])
+        check "ceklc09wlkm133b"  (set [ for x in departementType.GetFields(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public  ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ]) 
+                                 (set [ ] )
+        check "ceklc09wlkm134"  (set [ for x in departementType.GetMethods() -> x.Name ]) 
+            (set [
+                "get_DepartmentID";
+                "set_DepartmentID";
+                "set_Name";
+                "get_Name";
+                "set_GroupName";
+                "get_GroupName";
+                "set_ModifiedDate";
+                "get_ModifiedDate";
+                "get_EmployeeDepartmentHistories";
+                "set_EmployeeDepartmentHistories";
+                "add_PropertyChanging";
+                "remove_PropertyChanging";
+                "add_PropertyChanged";
+                "remove_PropertyChanged";
+                "ToString";
+                "Equals";
+                "GetHashCode";
+                "GetType"
+             ] )
+
+        check "ceklc09wlkm135"  (set [ for x in departementType.GetMethods(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public  ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ]) 
+                                (set [ "Equals"; "ReferenceEquals" ] )
+        check "ceklc09wlkm136"  (departementType.GetNestedTypes()) [||]
+
+        // Check on another type: uspGetBillOfMaterialsResult [Return value of a SP]
+        let uspGetBillOfMaterialsResultType = (hostedType.GetNestedTypes() |> Seq.find (fun t -> t.Name = "uspGetBillOfMaterialsResult"))
+        check "ceklc09wlkm147"  (set [ for x in uspGetBillOfMaterialsResultType.GetProperties() -> x.Name ]) (set [|"BOMLevel"; "ComponentDesc"; "ComponentID"; "ListPrice"; "ProductAssemblyID"; "RecursionLevel"; "StandardCost"; "TotalQuantity" |] )
+        check "ceklc09wlkm148"  (uspGetBillOfMaterialsResultType.GetFields()) [||]
+        check "ceklc09wlkm149"  (set [ for x in uspGetBillOfMaterialsResultType.GetMethods() -> x.Name ])
+                                (set [| 
+                                    "get_ProductAssemblyID"; "set_ProductAssemblyID";
+                                    "get_ComponentID"; "set_ComponentID";
+                                    "get_ComponentDesc"; "set_ComponentDesc";
+                                    "get_TotalQuantity"; "set_TotalQuantity";
+                                    "set_StandardCost"; "get_StandardCost";
+                                    "set_ListPrice"; "get_ListPrice";
+                                    "get_BOMLevel"; "set_BOMLevel";
+                                    "set_RecursionLevel"; "get_RecursionLevel";
+                                    "ToString"; "Equals"; "GetHashCode"; "GetType"
+                                    |])
+        check "ceklc09wlkm150"  (uspGetBillOfMaterialsResultType.GetNestedTypes()) [||]
+
+        // Check on another type: ufnGetContactInformationResult [Return value of a Function]
+        let ufnGetContactInformationResultType = (hostedType.GetNestedTypes() |> Seq.find (fun t -> t.Name = "ufnGetContactInformationResult"))
+        check "ceklc09wlkm151"  (set [ for x in ufnGetContactInformationResultType.GetProperties() -> x.Name ]) (set [| "ContactID"; "ContactType"; "FirstName"; "JobTitle"; "LastName" |] )
+        check "ceklc09wlkm152"  (ufnGetContactInformationResultType.GetFields()) [||]
+        check "ceklc09wlkm153"  (set [ for x in ufnGetContactInformationResultType.GetMethods() -> x.Name ])
+                                (set [| 
+                                    "get_ContactID"; "set_ContactID";
+                                    "get_FirstName"; "set_FirstName";
+                                    "get_LastName"; "set_LastName"; 
+                                    "get_JobTitle"; "set_JobTitle"; 
+                                    "get_ContactType"; "set_ContactType";
+                                    "ToString"; "Equals"; "GetHashCode"; "GetType"
+                                    |])
+        check "ceklc09wlkm154"  (ufnGetContactInformationResultType.GetNestedTypes()) [||]
+
+        // Check on another type: vEmployee [View]
+        let vEmployeeType = (hostedType.GetNestedTypes() |> Seq.find (fun t -> t.Name = "vEmployee"))
+        check "ceklc09wlkm141"  (set [ for x in vEmployeeType.GetProperties() -> x.Name ]) (set [| "EmployeeID"; "Title"; "FirstName"; "MiddleName"; "LastName"; "Suffix"; "JobTitle"; "Phone"; "EmailAddress"; "EmailPromotion"; "AddressLine1"; "AddressLine2"; "City"; "StateProvinceName"; "PostalCode"; "CountryRegionName"; "AdditionalContactInfo"|])
+        check "ceklc09wlkm142"  (vEmployeeType.GetFields()) [||]
+        check "ceklc09wlkm144"  (set [ for x in vEmployeeType.GetMethods() -> x.Name ])
+                                (set [|
+                                    "set_EmployeeID"; "get_EmployeeID";
+                                    "set_Title"; "get_Title";
+                                    "get_FirstName"; "set_FirstName";
+                                    "get_MiddleName"; "set_MiddleName";
+                                    "set_LastName"; "get_LastName";
+                                    "get_Suffix"; "set_Suffix";
+                                    "get_JobTitle"; "set_JobTitle";
+                                    "set_Phone"; "get_Phone";
+                                    "get_EmailAddress"; "set_EmailAddress";
+                                    "get_EmailPromotion"; "set_EmailPromotion";
+                                    "get_AddressLine1"; "set_AddressLine1";
+                                    "get_AddressLine2"; "set_AddressLine2";
+                                    "get_City"; "set_City";
+                                    "get_StateProvinceName"; "set_StateProvinceName";
+                                    "get_PostalCode"; "set_PostalCode";
+                                    "get_CountryRegionName"; "set_CountryRegionName";
+                                    "get_AdditionalContactInfo"; "set_AdditionalContactInfo";
+                                    "ToString";
+                                    "Equals";
+                                    "GetHashCode";
+                                    "GetType" |])
+        check "ceklc09wlkm146"  (vEmployeeType.GetNestedTypes()) [||]
+
+    let instantiateTypeProviderAndCheckOneHostedType( dbmlfile : string, fullPathName:string[] ) = 
+
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "CheckFSharpDataTypeProvidersDLLExist" (File.Exists assemblyFile) 
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=true, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        // Setup machinery to keep track of the "invalidate event" (see below)
+        let invalidateEventCount = ref 0
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "CheckAllTPsAreThere" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("DbmlFile")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "VerifyStaticParam" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set [ "File"; "ResolutionFolder"; "ContextTypeName"; "Serializable" ])
+
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "File" -> box dbmlfile  
+                 | _ -> box x.RawDefaultValue) |]
+        printfn "instantiating type... may take a while for code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, fullPathName, staticParameterValues)
+
+        checkHostedType hostedAppliedType1 
+
+        // Write replacement text into the file and check that the invalidation event is triggered....
+        let file1NewContents = System.IO.File.ReadAllText(dbmlfile).Replace("Employee", "Worker")       // Rename 'Employee' to 'Worker'
+        do File.WriteAllText(dbmlfile, file1NewContents)
+
+        // Wait for invalidate event to fire....
+        for i in 0 .. 30 do
+            if !invalidateEventCount = 0 then 
+                System.Threading.Thread.Sleep 100
+
+        check "VerifyInvalidateEventFired" !invalidateEventCount 1
+
+    // Test with absolute path
+    // Copy the .dbml used for tests to avoid trashing our original (we may overwrite it when testing the event)
+    let dbmlfile = Path.Combine(__SOURCE_DIRECTORY__, "AdventureWorksDev10.dbml")
+    System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"DbmlFiles\AdventureWorksDev10.dbml"), dbmlfile, true)
+    System.IO.File.SetAttributes(dbmlfile, System.IO.FileAttributes.Normal)
+    instantiateTypeProviderAndCheckOneHostedType(dbmlfile, [| "DbmlFileApplied" |])
+
+    // Test with relative path
+    // Copy the .dbml used for tests to avoid trashing our original (we may overwrite it when testing the event)
+    System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"DbmlFiles\AdventureWorksDev10.dbml"), dbmlfile, true)
+    System.IO.File.SetAttributes(dbmlfile, System.IO.FileAttributes.Normal)
+    instantiateTypeProviderAndCheckOneHostedType( System.IO.Path.GetFileName(dbmlfile), [| "DbmlFileApplied" |])
+
+let _ = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/EdmxFile/EdmxFiles/SampleModel01.edmx b/tests/fsharp/typeProviders/builtin/EdmxFile/EdmxFiles/SampleModel01.edmx
new file mode 100644
index 0000000..54de954
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/EdmxFile/EdmxFiles/SampleModel01.edmx
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
+  <!-- EF Runtime content -->
+  <edmx:Runtime>
+    <!-- SSDL content -->
+    <edmx:StorageModels>
+      <Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="SampleModel01.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">
+        <EntityContainer Name="SampleModel01TargetContainer" >
+        </EntityContainer>
+      </Schema>
+    </edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="SampleModel01" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
+        <EntityContainer Name="SampleModel01Container" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Orders" EntityType="SampleModel01.Orders" />
+          <EntitySet Name="Persons" EntityType="SampleModel01.Persons" />
+          <AssociationSet Name="CustomersOrders" Association="SampleModel01.CustomersOrders">
+            <End Role="Customers" EntitySet="Persons" />
+            <End Role="Orders" EntitySet="Orders" />
+          </AssociationSet>
+        </EntityContainer>
+        <EntityType Name="Customers" BaseType="SampleModel01.Persons">
+          <Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <NavigationProperty Name="Orders" Relationship="SampleModel01.CustomersOrders" FromRole="Customers" ToRole="Orders" />
+        </EntityType>
+        <EntityType Name="Orders">
+          <Key>
+            <PropertyRef Name="Id" />
+          </Key>
+          <Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Type="Int32" Name="CustomersId" Nullable="false" />
+          <NavigationProperty Name="Customer" Relationship="SampleModel01.CustomersOrders" FromRole="Orders" ToRole="Customers" />
+        </EntityType>
+        <EntityType Name="Persons">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Type="Int32" Name="ID" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Type="String" Name="FirstName" Nullable="false" />
+          <Property Type="String" Name="LastName" Nullable="false" />
+        </EntityType>
+        <Association Name="CustomersOrders">
+          <End Type="SampleModel01.Customers" Role="Customers" Multiplicity="1" />
+          <End Type="SampleModel01.Orders" Role="Orders" Multiplicity="*" />
+        </Association>
+      </Schema>
+    </edmx:ConceptualModels>
+    <!-- C-S mapping content -->
+    <edmx:Mappings>
+      <Mapping xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs" Space="C-S">
+        <Alias Key="Model" Value="SampleModel01" />
+        <Alias Key="Target" Value="SampleModel01.Store" />
+        <EntityContainerMapping CdmEntityContainer="SampleModel01Container" StorageEntityContainer="SampleModel01TargetContainer">
+        </EntityContainerMapping>
+      </Mapping>
+    </edmx:Mappings>
+  </edmx:Runtime>
+  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
+    <edmx:Connection>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
+      </DesignerInfoPropertySet>
+    </edmx:Connection>
+    <edmx:Options>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
+        <DesignerProperty Name="EnablePluralization" Value="True" />
+      </DesignerInfoPropertySet>
+    </edmx:Options>
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+      <Diagram Name="SampleModel01" >
+        <EntityTypeShape EntityType="SampleModel01.Customers" Width="1.5" PointX="3.3072142933063273" PointY="8.50035328068787" />
+        <InheritanceConnector EntityType="SampleModel01.Customers" />
+        <EntityTypeShape EntityType="SampleModel01.Orders" Width="1.5" PointX="3.25" PointY="6.5" Height="1.4279589843749996" />
+        <EntityTypeShape EntityType="SampleModel01.Persons" Width="1.5" PointX="8.4623833040065986" PointY="12.312999537360389" />
+        <AssociationConnector Association="SampleModel01.CustomersOrders" >
+          <ConnectorPoint PointX="2.25" PointY="5.9374994999999995" />
+          <ConnectorPoint PointX="4" PointY="5.9374994999999995" />
+          <ConnectorPoint PointX="4" PointY="6.5" />
+        </AssociationConnector>
+      </Diagram>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>
diff --git a/tests/fsharp/typeProviders/builtin/EdmxFile/build.bat b/tests/fsharp/typeProviders/builtin/EdmxFile/build.bat
new file mode 100644
index 0000000..0eb327b
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/EdmxFile/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/EdmxFile/run.bat b/tests/fsharp/typeProviders/builtin/EdmxFile/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/EdmxFile/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/EdmxFile/test.fsx b/tests/fsharp/typeProviders/builtin/EdmxFile/test.fsx
new file mode 100644
index 0000000..9b1f2c6
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/EdmxFile/test.fsx
@@ -0,0 +1,143 @@
+// #Conformance #TypeProviders #EdmxFile
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+[<AutoOpen>]
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+module CheckEdmxfileTypeProvider = 
+
+    let checkHostedType (hostedType: System.Type) = 
+        test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+        test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+        check "ceklc09wlkm2" hostedType.DeclaringType null
+        check "ceklc09wlkm3" hostedType.DeclaringMethod null
+        check "ceklc09wlkm4" hostedType.FullName "SampleModel01.EdmxFileApplied"
+        check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+        check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
+        check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
+        check "ceklc09wlkm9" (hostedType.GetMethods()) [| |]
+        check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
+        check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+            (set ["SampleModel01"])
+
+        let hostedServiceTypes = hostedType.GetNestedTypes().[0]
+        check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
+        check "ceklc09wlkm12c" 
+             (set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ])
+             (set ["Customers"; "Orders"; "Persons"; "SampleModel01Container"])
+
+        // Deep check on one type: Customers
+        let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customers"))
+        check "ceklc09wlkm131"  (set [ for x in customersType.GetProperties() -> x.Name ]) (set [| "Id"; "Orders"; "ID"; "FirstName"; "LastName"; "EntityState"; "EntityKey" |])
+        check "ceklc09wlkm133a"  (set [ for x in customersType.GetFields() -> x.Name ]) (set [| |])
+        check "ceklc09wlkm133b"  (set [ for x in customersType.GetFields(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public  ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ]) 
+                                 (set [ "EntityKeyPropertyName"] )
+        check "ceklc09wlkm134"  (set [ for x in customersType.GetMethods() -> x.Name ]) 
+            (set ["CreateCustomers"; "get_Id"; "set_Id"; "get_Orders"; "set_Orders"; "get_ID"; "set_ID"; "get_FirstName"; "set_FirstName"; "get_LastName"; "set_LastName"; 
+                  "get_EntityState"; "get_EntityKey"; "set_EntityKey"; "add_PropertyChanged"; "remove_PropertyChanged"; "add_PropertyChanging"; "remove_PropertyChanging"; "ToString"; "Equals"; 
+                  "GetHashCode"; "GetType"] )
+        check "ceklc09wlkm135"  (set [ for x in customersType.GetMethods(System.Reflection.BindingFlags.Static ||| System.Reflection.BindingFlags.Public  ||| System.Reflection.BindingFlags.FlattenHierarchy) -> x.Name ]) 
+                                (set [ "CreateCustomers"; "CreatePersons"; "Equals"; "ReferenceEquals" ] )
+        check "ceklc09wlkm136"  (customersType.GetNestedTypes()) [||]
+
+        // Not so deep check on another type: SampleModel01Container
+        let SampleModel01ContainerType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "SampleModel01Container"))
+        check "ceklc09wlkm141"  (set [ for x in SampleModel01ContainerType.GetProperties() -> x.Name ]) (set [|"Orders"; "Persons"; "Connection"; "DefaultContainerName"; "MetadataWorkspace"; "ObjectStateManager"; "CommandTimeout"; "ContextOptions"|])
+        check "ceklc09wlkm142"  (SampleModel01ContainerType.GetFields()) [||]
+        check "ceklc09wlkm144"  (set [ for x in SampleModel01ContainerType.GetMethods() -> x.Name ]) 
+                                (set [|"get_Orders"; "get_Persons"; "AddToOrders"; "AddToPersons"; "get_Connection"; "get_DefaultContainerName"; "set_DefaultContainerName"; "get_MetadataWorkspace"; "get_ObjectStateManager"; "get_CommandTimeout"; "set_CommandTimeout"; "get_ContextOptions"; "add_SavingChanges"; "remove_SavingChanges"; "add_ObjectMaterialized"; "remove_ObjectMaterialized"; "AcceptAllChanges"; "AddObject"; "LoadProperty"; "LoadProperty"; "LoadProperty"; "LoadProperty"; "Appl [...]
+        check "ceklc09wlkm146"  (SampleModel01ContainerType.GetNestedTypes()) [||]
+
+
+    let instantiateTypeProviderAndCheckOneHostedType( edmxfile : string, typeFullPath ) = 
+
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "CheckFSharpDataTypeProvidersDLLExist" (File.Exists assemblyFile) 
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        // Setup machinery to keep track of the "invalidate event" (see below)
+        let invalidateEventCount = ref 0
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "CheckAllTPsAreThere" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("EdmxFile")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "VerifyStaticParam" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set [ "File"; "ResolutionFolder" ])
+
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "File" -> box edmxfile  
+                 | _ -> box x.RawDefaultValue) |]
+        printfn "instantiating type... may take a while for code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
+
+        checkHostedType hostedAppliedType1 
+
+        // Write replacement text into the file and check that the invalidation event is triggered....
+        let file1NewContents = System.IO.File.ReadAllText(edmxfile).Replace("Customer", "Client")       // Rename 'Customer' to 'Client'
+        do File.WriteAllText(edmxfile, file1NewContents)
+
+        // Wait for invalidate event to fire....
+        for i in 0 .. 30 do
+            if !invalidateEventCount = 0 then 
+                System.Threading.Thread.Sleep 100
+
+        check "VerifyInvalidateEventFired" !invalidateEventCount 1
+
+    // Test with absolute path
+    // Copy the .edmx used for tests to avoid trashing our original (we may overwrite it when testing the event)
+    let edmxfile = Path.Combine(__SOURCE_DIRECTORY__, "SampleModel01.edmx")
+    System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"EdmxFiles\SampleModel01.edmx"), edmxfile, true)
+    System.IO.File.SetAttributes(edmxfile, System.IO.FileAttributes.Normal)
+    instantiateTypeProviderAndCheckOneHostedType(edmxfile, [| "EdmxFileApplied" |])
+
+    // Test with relative path
+    // Copy the .edmx used for tests to avoid trashing our original (we may overwrite it when testing the event)
+    System.IO.File.Copy(Path.Combine(__SOURCE_DIRECTORY__, @"EdmxFiles\SampleModel01.edmx"), edmxfile, true)
+    System.IO.File.SetAttributes(edmxfile, System.IO.FileAttributes.Normal)
+    instantiateTypeProviderAndCheckOneHostedType( System.IO.Path.GetFileName(edmxfile), [| "EdmxFileApplied" |])
+
+let _ = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/ODataService/build.bat b/tests/fsharp/typeProviders/builtin/ODataService/build.bat
new file mode 100644
index 0000000..0eb327b
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/ODataService/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/ODataService/run.bat b/tests/fsharp/typeProviders/builtin/ODataService/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/ODataService/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/ODataService/test.fsx b/tests/fsharp/typeProviders/builtin/ODataService/test.fsx
new file mode 100644
index 0000000..64a8755
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/ODataService/test.fsx
@@ -0,0 +1,144 @@
+// #Conformance #TypeProviders #ODataService
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+[<AutoOpen>]
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+module CheckODataServiceTypeProvider = 
+
+    let checkHostedType (hostedType: System.Type) = 
+        //let hostedType = hostedAppliedType1
+        test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+        test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+        check "ceklc09wlkm2" hostedType.DeclaringType null
+        check "ceklc09wlkm3" hostedType.DeclaringMethod null
+        check "ceklc09wlkm4" hostedType.FullName "Microsoft.FSharp.Data.TypeProviders.ODataServiceApplied"
+        check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+        check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
+        check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
+        check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ; "GetDataContext" ]
+        let m1 = hostedType.GetMethods().[0]
+        let m2 = hostedType.GetMethods().[1]
+        check "ceklc09wlkm9b" (m1.GetParameters().Length) 0
+        check "ceklc09wlkm9b" (m2.GetParameters().Length) 1
+        check "ceklc09wlkm9b" (m1.ReturnType.Name) "ODataServicesContainer"
+        check "ceklc09wlkm9c" (m1.ReturnType.FullName) ("Microsoft.FSharp.Data.TypeProviders.ODataServiceApplied+ServiceTypes+SimpleDataContextTypes+ODataServicesContainer")
+
+        check "ceklc09wlkm9d"  (m1.ReturnType.GetProperties().Length) 5
+        check "ceklc09wlkm9e"  (set [ for p in m1.ReturnType.GetProperties() -> p.Name ]) (set ["ODataConsumers"; "ODataProducerApplications"; "ODataProducerLiveServices"; "Credentials"; "DataContext"]) 
+        check "ceklc09wlkm9f"  (set [ for p in m1.ReturnType.GetProperties() -> p.PropertyType.Name ]) (set ["DataServiceQuery`1"; "DataServiceQuery`1";"DataServiceQuery`1";"ICredentials"; "DataServiceContext"])
+        
+        // We expose some getters and 1 setter on the simpler data context
+        check "ceklc09wlkm9g"  (m1.ReturnType.GetMethods().Length) 6
+        check "ceklc09wlkm9h" (set [ for p in m1.ReturnType.GetMethods() -> p.Name ]) (set ["get_DataContext"; "get_ODataConsumers"; "get_ODataProducerApplications"; "get_ODataProducerLiveServices"; "get_Credentials"; "set_Credentials"])
+
+        check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
+        check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+            (set ["ServiceTypes"])
+
+        let hostedServiceTypes = hostedType.GetNestedTypes().[0]
+
+        check "ceklc09wlkm11" (hostedServiceTypes.GetNestedTypes().Length) 5
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ]) 
+            (set ["ODataConsumer"; "ODataProducerApplication"; "ODataProducerLiveService";"ODataServicesContainer"; "SimpleDataContextTypes"])
+
+        let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "ODataConsumer"))
+        check "ceklc09wlkm13"  (customersType.GetProperties().Length) 4
+
+        check "ceklc09wlkm14" 
+            (set [ for x in customersType.GetProperties() -> x.Name ]) 
+            (set ["ApplicationUrl"; "Description"; "Id"; "Name"])
+
+    let instantiateTypeProviderAndCheckOneHostedType(useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath:string[]) = 
+        //let useLocalSchemaFile : string option = None
+        //let useForceUpdate : bool option = None
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "cnlkenkewe" (File.Exists assemblyFile)
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        let invalidateEventCount = ref 0
+
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("ODataService")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "eenewioinw2" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set ["ServiceUri"; "LocalSchemaFile"; "ForceUpdate"; "ResolutionFolder"; "DataServiceCollection"])
+
+        let serviceUri = "http://services.odata.org/website/odata.svc"
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "ServiceUri" -> box serviceUri
+                 | "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
+                 | "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
+                 | _ -> box x.RawDefaultValue) |]
+        printfn "instantiating service type... may take a while for OData service metadata to be downloaded, code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
+
+        checkHostedType hostedAppliedType1 
+
+    instantiateTypeProviderAndCheckOneHostedType(None, None, [| "ODataServiceApplied" |])
+
+    let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")
+    (try File.Delete schemaFile2 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(Some (Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")), Some true, [| "ODataServiceApplied" |])
+    // schemaFile2 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    // Reuse the CSDL just created
+    instantiateTypeProviderAndCheckOneHostedType(Some (Path.Combine(__SOURCE_DIRECTORY__, "svc.csdl")), Some false, [| "ODataServiceApplied" |])
+    // schemaFile2 should now still exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "svc2.csdl") 
+    (try File.Delete schemaFile3 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(Some schemaFile3, None, [| "ODataServiceApplied" |])
+    
+    // schemaFile3 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile3)
+
+let _ = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlDataConnection/DB/NORTHWND.MDF b/tests/fsharp/typeProviders/builtin/SqlDataConnection/DB/NORTHWND.MDF
new file mode 100644
index 0000000..9814217
Binary files /dev/null and b/tests/fsharp/typeProviders/builtin/SqlDataConnection/DB/NORTHWND.MDF differ
diff --git a/tests/fsharp/typeProviders/builtin/SqlDataConnection/build.bat b/tests/fsharp/typeProviders/builtin/SqlDataConnection/build.bat
new file mode 100644
index 0000000..0eb327b
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlDataConnection/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlDataConnection/run.bat b/tests/fsharp/typeProviders/builtin/SqlDataConnection/run.bat
new file mode 100644
index 0000000..62d7b7e
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlDataConnection/run.bat
@@ -0,0 +1,12 @@
+ at if "%_echo%"=="" echo off
+
+IF EXIST test.exe (
+   echo Running test.exe to warm up SQL
+   test.exe > nul 2> nul
+)
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlDataConnection/test.fsx b/tests/fsharp/typeProviders/builtin/SqlDataConnection/test.fsx
new file mode 100644
index 0000000..11cbfe0
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlDataConnection/test.fsx
@@ -0,0 +1,249 @@
+// #Conformance #TypeProviders #SqlDataConnection
+#r "FSharp.Data.TypeProviders.dll"
+#r "System.Management.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+[<AutoOpen>]
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+
+    do SetCulture()    
+
+module CheckSqlConnectionTypeProvider = 
+
+    let isSQLExpressInstalled =
+        let edition = "Express Edition"
+        let instance = "MSSQL$SQLEXPRESS"
+
+        try
+            let getSqlExpress = 
+                new System.Management.ManagementObjectSearcher("root\\Microsoft\\SqlServer\\ComputerManagement10",
+                                                               "select * from SqlServiceAdvancedProperty where SQLServiceType = 1 and ServiceName = '" + instance + "' and (PropertyName = 'SKUNAME' or PropertyName = 'SPLEVEL')")
+
+            // If nothing is returned, SQL Express isn't installed.
+            getSqlExpress.Get().Count <> 0
+        with
+        | _ -> false
+
+
+    let checkHostedType (hostedType: System.Type) = 
+        //let hostedType = hostedAppliedType1
+        test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+        test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+        check "ceklc09wlkm2" hostedType.DeclaringType null
+        check "ceklc09wlkm3" hostedType.DeclaringMethod null
+        check "ceklc09wlkm4" hostedType.FullName "Microsoft.FSharp.Data.TypeProviders.SqlDataConnectionApplied"
+        check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+        check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
+        check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
+        check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ; "GetDataContext" ]
+        let m0 = hostedType.GetMethods().[0]
+        let m1 = hostedType.GetMethods().[1]
+        check "ceklc09wlkm9b" (m0.GetParameters().Length) 0
+        check "ceklc09wlkm9b" (m1.GetParameters().Length) 1
+        check "ceklc09wlkm9b" (m0.ReturnType.Name) "Northwnd"
+        check "ceklc09wlkm9b" (m0.ReturnType.FullName) "Microsoft.FSharp.Data.TypeProviders.SqlDataConnectionApplied+ServiceTypes+SimpleDataContextTypes+Northwnd"
+        check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
+        check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+            (set ["ServiceTypes"])
+
+        let hostedServiceTypes = hostedType.GetNestedTypes().[0]
+        check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
+        check "ceklc09wlkm12c" (hostedServiceTypes.GetNestedTypes().Length) 38
+
+        let hostedSimpleDataContextTypes = hostedServiceTypes.GetNestedType("SimpleDataContextTypes")
+        check "ceklc09wlkm12d" (hostedSimpleDataContextTypes.GetMethods()) [| |]
+        check "ceklc09wlkm12e" (hostedSimpleDataContextTypes.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12e" [ for x in hostedSimpleDataContextTypes.GetNestedTypes() -> x.Name] ["Northwnd"]
+
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ]) 
+            (set ["Northwnd"; "SimpleDataContextTypes"; "AlphabeticalListOfProduct"; "Category"; "CategorySalesFor1997"; "CurrentProductList"; "CustomerAndSuppliersByCity"; 
+                  "CustomerCustomerDemo"; "CustomerDemographic"; "Customer"; "Employee"; "EmployeeTerritory"; 
+                  "Invoice"; "OrderDetail"; "OrderDetailsExtended"; "OrderSubtotal"; "Order"; "OrdersQry"; 
+                  "ProductSalesFor1997"; "Product"; "ProductsAboveAveragePrice"; "ProductsByCategory"; 
+                  "QuarterlyOrder"; "Region"; "SalesByCategory"; "SalesTotalsByAmount"; "Shipper"; 
+                  "SummaryOfSalesByQuarter"; "SummaryOfSalesByYear"; "Supplier"; "Territory"; "CustOrderHistResult"; 
+                  "CustOrdersDetailResult"; "CustOrdersOrdersResult"; "EmployeeSalesByCountryResult"; "SalesByYearResult"; 
+                  "SalesByCategoryResult"; "TenMostExpensiveProductsResult"])
+
+        let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customer"))
+        check "ceklc09wlkm13"  (customersType.GetProperties().Length) 13
+
+
+    let instantiateTypeProviderAndCheckOneHostedType(connectionStringName, configFile, useDataDirectory, dataDirectory, useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[], resolutionFolder:string option) = 
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "cnlkenkewe" (File.Exists assemblyFile) 
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        let invalidateEventCount = ref 0
+
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("SqlDataConnection")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "eenewioinw2" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set ["ConnectionString"; "ConnectionStringName"; "DataDirectory"; "ResolutionFolder"; "ConfigFile"; "LocalSchemaFile"; 
+                  "ForceUpdate"; "Pluralize"; "Views"; "Functions"; "StoredProcedures"; "Timeout"; 
+                  "ContextTypeName"; "Serializable" ])
+
+        let northwind = "NORTHWND.mdf"
+        let northwindLog = "NORTHWND_log.ldf"
+        let northwindFile = 
+            let baseFile = 
+                match dataDirectory with 
+                | None -> northwind
+                | Some dd -> System.IO.Path.Combine(dd,northwind)
+            match resolutionFolder with 
+            | None -> 
+                match dataDirectory with 
+                | None -> ()
+                | Some dd -> if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore
+                baseFile
+            | Some rf -> 
+                if not(System.IO.Directory.Exists rf) then System.IO.Directory.CreateDirectory rf |> ignore
+                match dataDirectory with 
+                | None -> ()
+                | Some dd -> let dd = System.IO.Path.Combine(rf,dd) in if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore                
+                System.IO.Path.Combine(rf,baseFile)
+
+
+        if not(System.IO.File.Exists(northwindFile)) then 
+            System.IO.File.Copy("DB\\northwnd.mdf", northwindFile, false)
+            System.IO.File.SetAttributes(northwindFile, System.IO.FileAttributes.Normal)
+
+
+        let connectionString = 
+            if useDataDirectory then
+                if isSQLExpressInstalled then
+                    @"AttachDBFileName = '|DataDirectory|\" + northwind + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
+                else
+                    "AttachDBFileName = '|DataDirectory|\\" + northwind + "';Server='(localdb)\\v11.0'"
+            else
+                if isSQLExpressInstalled then
+                    @"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
+                else
+                    "AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='(localdb)\\v11.0'"
+
+        match connectionStringName with 
+        | None -> ()
+        | Some connectionStringName -> 
+               let configFileName = match configFile with None -> "app.config" | Some nm -> nm
+               let configFileName = 
+                   match resolutionFolder with 
+                   | None -> configFileName
+                   | Some rf -> 
+                       System.IO.Path.Combine(rf,configFileName)
+               System.IO.File.WriteAllText(configFileName,
+                   sprintf """<?xml version="1.0"?>
+
+<configuration>
+  <connectionStrings>
+    <add name="%s"
+         connectionString="%s"
+         providerName="System.Data.SqlClient" />
+  </connectionStrings>
+
+  <system.webServer>
+     <modules runAllManagedModulesForAllRequests="true"/>
+  </system.webServer>
+</configuration>
+"""               
+                       connectionStringName
+                       connectionString)
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "ConnectionString" when connectionStringName.IsNone  -> box connectionString
+                 | "Pluralize" -> box true
+                 | "ConnectionStringName" when connectionStringName.IsSome -> box connectionStringName.Value
+                 | "ResolutionFolder" when resolutionFolder.IsSome -> box resolutionFolder.Value
+                 | "DataDirectory" when dataDirectory.IsSome -> box dataDirectory.Value
+                 | "ConfigFile"  when configFile.IsSome -> box configFile.Value
+                 | "ContextTypeName" -> box "Northwnd" 
+                 | "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
+                 | "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
+                 | "Timeout" -> box 60
+                 | _ -> box x.RawDefaultValue) |]
+        printfn "instantiating database type... may take a while for db to attach, code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
+
+        checkHostedType hostedAppliedType1 
+
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, None, [| "SqlDataConnectionApplied" |], None)
+
+    // Use an implied app.config config file, use the current directory as the DataDirectory
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString1", None, true, None, None, None, [| "SqlDataConnectionApplied" |], None)
+
+    // Use a config file, use an explicit relative DataDirectory
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, [| "SqlDataConnectionApplied" |], None)
+
+    // Use a config file, use an explicit relative DataDirectory and an explicit ResolutionFolder.
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, [| "SqlDataConnectionApplied" |], Some "ExampleResolutionFolder")
+
+    
+    // Use an absolute config file, use an absolute DataDirectory 
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString3", Some (__SOURCE_DIRECTORY__ + @"\test.config"), true, Some (__SOURCE_DIRECTORY__ + @"\DataDirectory"), None, None, [| "SqlDataConnectionApplied" |], None)
+
+    let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")
+    (try File.Delete schemaFile2 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")), Some true, [| "SqlDataConnectionApplied" |], None)
+    // schemaFile2 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    // Reuse the DBML just created
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.dbml")), Some false, [| "SqlDataConnectionApplied" |], None)
+    // schemaFile2 should now still exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    // // A relative path should work....
+    // instantiateTypeProviderAndCheckOneHostedType(Some "nwind2.dbml", Some false)
+    // // schemaFile2 should now still exist
+    // check "eoinew0c9e" (File.Exists schemaFile2)
+
+    let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "nwind3.dbml") 
+    (try File.Delete schemaFile3 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some schemaFile3, None, [| "SqlDataConnectionApplied" |], None)
+    
+    // schemaFile3 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile3)
+
+let _ = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlEntityConnection/DB/NORTHWND.MDF b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/DB/NORTHWND.MDF
new file mode 100644
index 0000000..9814217
Binary files /dev/null and b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/DB/NORTHWND.MDF differ
diff --git a/tests/fsharp/typeProviders/builtin/SqlEntityConnection/build.bat b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/build.bat
new file mode 100644
index 0000000..0eb327b
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlEntityConnection/run.bat b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/SqlEntityConnection/test.fsx b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/test.fsx
new file mode 100644
index 0000000..1b67860
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/SqlEntityConnection/test.fsx
@@ -0,0 +1,238 @@
+// #Conformance #TypeProviders #SqlEntityConnection
+#r "FSharp.Data.TypeProviders.dll"
+#r "System.Management.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+[<AutoOpen>]
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+module CheckSqlEntityConnectionTypeProvider = 
+
+    let isSQLExpressInstalled =
+        let edition = "Express Edition"
+        let instance = "MSSQL$SQLEXPRESS"
+
+        try
+            let getSqlExpress = 
+                new System.Management.ManagementObjectSearcher("root\\Microsoft\\SqlServer\\ComputerManagement10",
+                                                               "select * from SqlServiceAdvancedProperty where SQLServiceType = 1 and ServiceName = '" + instance + "' and (PropertyName = 'SKUNAME' or PropertyName = 'SPLEVEL')")
+
+            // If nothing is returned, SQL Express isn't installed.
+            getSqlExpress.Get().Count <> 0
+        with
+        | _ -> false
+
+    let checkHostedType (expectedContextTypeName, hostedType: System.Type) = 
+        //let hostedType = hostedAppliedType1
+        
+        test "ceklc09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+        test "ceklc09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+        check "ceklc09wlkm2" hostedType.DeclaringType null
+        check "ceklc09wlkm3" hostedType.DeclaringMethod null
+        check "ceklc09wlkm4" hostedType.FullName ("SqlEntityConnection1.SqlEntityConnectionApplied")
+        check "ceklc09wlkm5" (hostedType.GetConstructors()) [| |]
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+        check "ceklc09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+        check "ceklc09wlkm7" (hostedType.GetEvents()) [| |]
+        check "ceklc09wlkm8" (hostedType.GetFields()) [| |]
+        check "ceklc09wlkm9" [ for m in hostedType.GetMethods() -> m.Name ] [ "GetDataContext" ;"GetDataContext" ]
+        let m0 = hostedType.GetMethods().[0]
+        let m1 = hostedType.GetMethods().[1]
+        check "ceklc09wlkm9b" (m0.GetParameters().Length) 0
+        check "ceklc09wlkm9c" (m1.GetParameters().Length) 1
+        check "ceklc09wlkm9d" (m0.ReturnType.Name) expectedContextTypeName
+        check "ceklc09wlkm9e" (m0.ReturnType.FullName) ("SqlEntityConnection1.SqlEntityConnectionApplied+ServiceTypes+SimpleDataContextTypes+" + expectedContextTypeName)
+        check "ceklc09wlkm10" (hostedType.GetProperties()) [| |]
+        check "ceklc09wlkm11" (hostedType.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+            (set ["ServiceTypes"])
+
+        let hostedServiceTypes = hostedType.GetNestedTypes().[0]
+        check "ceklc09wlkm12b" (hostedServiceTypes.GetMethods()) [| |]
+        check "ceklc09wlkm12c" (hostedServiceTypes.GetNestedTypes().Length) 28
+
+        let hostedSimpleDataContextTypes = hostedServiceTypes.GetNestedType("SimpleDataContextTypes")
+        check "ceklc09wlkm12d" (hostedSimpleDataContextTypes.GetMethods()) [| |]
+        check "ceklc09wlkm12e" (hostedSimpleDataContextTypes.GetNestedTypes().Length) 1
+        check "ceklc09wlkm12e" [ for x in hostedSimpleDataContextTypes.GetNestedTypes() -> x.Name] [expectedContextTypeName]
+
+        check "ceklc09wlkm12" 
+            (set [ for x in hostedServiceTypes.GetNestedTypes() -> x.Name ]) 
+            (set 
+               (["Territory"; "Supplier"; "Summary_of_Sales_by_Year";
+                 "Summary_of_Sales_by_Quarter"; "Shipper"; "Sales_Totals_by_Amount";
+                 "Sales_by_Category"; "Region"; "Products_by_Category";
+                 "Products_Above_Average_Price"; "Product_Sales_for_1997"; "Product";
+                 "Orders_Qry"; "Order_Subtotal"; "Order_Details_Extended"; "Order_Detail";
+                 "Order"; "Invoice"; "Employee"; "CustomerDemographic";
+                 "Customer_and_Suppliers_by_City"; "Customer"; "Current_Product_List";
+                 "Category_Sales_for_1997"; "Category"; "Alphabetical_list_of_product"; ] @ 
+                [expectedContextTypeName] @ 
+                [ "SimpleDataContextTypes"]))
+
+        let customersType = (hostedServiceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "Customer"))
+        check "ceklc09wlkm13"  (customersType.GetProperties().Length) 15
+
+
+    let instantiateTypeProviderAndCheckOneHostedType(connectionStringName, configFile, useDataDirectory, dataDirectory, entityContainer: string option, localSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[]) = 
+        let expectedContextTypeName = match entityContainer with None -> "EntityContainer" | Some s -> s
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "cnlkenkewe" (File.Exists assemblyFile) 
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=false, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        let invalidateEventCount = ref 0
+
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("SqlEntityConnection")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "eenewioinw2" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set ["ConnectionString"; "ConnectionStringName"; "ResolutionFolder"; "DataDirectory"; "ConfigFile"; "ForceUpdate"; "Provider"; "EntityContainer"; "LocalSchemaFile"; "Pluralize"; "SuppressForeignKeyProperties"]   )
+
+
+        let northwind = "NORTHWND.mdf"
+        let northwindFile = 
+            match dataDirectory with 
+            | None -> northwind
+            | Some dd -> 
+                if not(System.IO.Directory.Exists dd) then System.IO.Directory.CreateDirectory dd |> ignore
+                System.IO.Path.Combine(dd,northwind)
+
+        if not(System.IO.File.Exists(northwindFile)) then 
+            System.IO.File.Copy("DB\\northwnd.mdf", northwindFile, false)
+            System.IO.File.SetAttributes(northwindFile, System.IO.FileAttributes.Normal)
+
+
+        let connectionString = 
+            if useDataDirectory then 
+                if isSQLExpressInstalled then
+                    @"AttachDBFileName = '|DataDirectory|\" + northwind + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
+                else
+                    "AttachDBFileName = '|DataDirectory|\\" + northwind + "';Server='(localdb)\\v11.0'"
+            else
+                if isSQLExpressInstalled then
+                    @"AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='.\SQLEXPRESS';User Instance=true;Integrated Security=SSPI"
+                else
+                    "AttachDBFileName = '" + System.IO.Path.Combine(__SOURCE_DIRECTORY__, northwindFile) + "';Server='(localdb)\\v11.0'"
+
+        match connectionStringName with 
+        | None -> ()
+        | Some connectionStringName -> 
+               let configFileName = match configFile with None -> "app.config" | Some nm -> nm
+               System.IO.File.WriteAllText(configFileName,
+                   sprintf """<?xml version="1.0"?>
+
+<configuration>
+  <connectionStrings>
+    <add name="%s"
+         connectionString="%s"
+         providerName="System.Data.SqlClient" />
+  </connectionStrings>
+
+  <system.webServer>
+     <modules runAllManagedModulesForAllRequests="true"/>
+  </system.webServer>
+</configuration>
+"""               
+                       connectionStringName
+                       connectionString)
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "ConnectionString" when connectionStringName.IsNone -> box connectionString  
+                 | "ConnectionStringName" when connectionStringName.IsSome -> box connectionStringName.Value
+                 |  "DataDirectory" when dataDirectory.IsSome -> box dataDirectory.Value
+                 |  "ConfigFile"  when configFile.IsSome -> box configFile.Value
+                 | "Pluralize" -> box true
+                 | "EntityContainer" when entityContainer.IsSome -> box entityContainer.Value
+                 | "SuppressForeignKeyProperties" -> box false
+                 | "LocalSchemaFile" when localSchemaFile.IsSome -> box localSchemaFile.Value
+                 | "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
+                 | _ -> box x.RawDefaultValue) |]
+        printfn "instantiating database type... may take a while for db to attach, code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
+
+        checkHostedType (expectedContextTypeName,hostedAppliedType1 )
+
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, None, None, [| "SqlEntityConnectionApplied" |])
+
+    // Use an implied app.config config file, use the current directory as the DataDirectory
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString1", None, true, None, None, None, None, [| "SqlEntityConnectionApplied" |])
+
+    // Use a config file, use an explicit relative DataDirectory
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString2", Some "app.config", true, Some "DataDirectory", None, None, None, [| "SqlEntityConnectionApplied" |])
+
+    // Use an absolute config file, use an absoltue DataDirectory
+    instantiateTypeProviderAndCheckOneHostedType(Some "ConnectionString3", Some (__SOURCE_DIRECTORY__ + @"\test.config"), true, Some (__SOURCE_DIRECTORY__ + @"\DataDirectory"), None, None, None, [| "SqlEntityConnectionApplied" |])
+
+
+    let schemaFile2 = Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")
+    (try File.Delete schemaFile2 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")), Some true, [| "SqlEntityConnectionApplied" |])
+    // schemaFile2 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    // Reuse the SSDL just created
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some (Path.Combine(__SOURCE_DIRECTORY__, "nwind2.ssdl")), Some false, [| "SqlEntityConnectionApplied" |])
+    // schemaFile2 should now still exist
+    check "eoinew0c9e" (File.Exists schemaFile2)
+
+    // // A relative path should work....
+    // instantiateTypeProviderAndCheckOneHostedType(Some "nwind2.ssdl", Some false)
+    // // schemaFile2 should now still exist
+    // check "eoinew0c9e" (File.Exists schemaFile2)
+
+    let schemaFile3 = Path.Combine(__SOURCE_DIRECTORY__, "nwind3.ssdl") 
+    (try File.Delete schemaFile3 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, None, Some schemaFile3, None, [| "SqlEntityConnectionApplied" |])
+    
+    // schemaFile3 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile3)
+
+    let schemaFile4 = Path.Combine(__SOURCE_DIRECTORY__, "nwind4.ssdl") 
+    (try File.Delete schemaFile4 with _ -> ())
+    instantiateTypeProviderAndCheckOneHostedType(None, None, false, None, Some "MyEntityContainer", Some schemaFile4, None, [| "SqlEntityConnectionApplied" |])
+    
+    // schemaFile4 should now exist
+    check "eoinew0c9e" (File.Exists schemaFile4)
+
+
+let _ = 
+    if !failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/WsdlService/build.bat b/tests/fsharp/typeProviders/builtin/WsdlService/build.bat
new file mode 100644
index 0000000..3e324d4
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/WsdlService/build.bat
@@ -0,0 +1,8 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\copyFSharpDataTypeProviderDLL.cmd
+                               
+call %~d0%~p0..\..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/builtin/WsdlService/run.bat b/tests/fsharp/typeProviders/builtin/WsdlService/run.bat
new file mode 100644
index 0000000..f1520df
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/WsdlService/run.bat
@@ -0,0 +1,7 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/builtin/WsdlService/test.fsx b/tests/fsharp/typeProviders/builtin/WsdlService/test.fsx
new file mode 100644
index 0000000..a28ba66
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/WsdlService/test.fsx
@@ -0,0 +1,210 @@
+// #Conformance #TypeProviders #WsdlService
+#r "FSharp.Data.TypeProviders.dll"
+
+open Microsoft.FSharp.Core.CompilerServices
+open System.IO
+
+module Infrastructure = 
+    let failures = ref false
+    let reportFailure () = stderr.WriteLine " NO"; failures := true
+    let test s b = stderr.Write(s:string);  if b then stderr.WriteLine " OK" else reportFailure() 
+    let check s v1 v2 = stderr.Write(s:string);  if v1 = v2 then stderr.WriteLine " OK" else eprintf "... FAILURE: expected %A, got %A  " v2 v1;  reportFailure() 
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+[<AbstractClass>]
+type WsdlServiceTest(serviceUri, prefix) =     
+    
+    let check caption a b = Infrastructure.check (prefix + caption) a b
+    let test caption v = Infrastructure.test (prefix + caption) v
+
+    abstract CheckHostedType: System.Type -> unit
+
+    member this.InstantiateTypeProviderAndPerformCheck(useLocalSchemaFile : string option, useForceUpdate : bool option, typeFullPath : string[], f) = 
+        let assemblyFile = typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly.CodeBase.Replace("file:///","").Replace("/","\\")
+        test "cnlkenkewe" (File.Exists assemblyFile) 
+
+        // If/when we care about the "target framework", this mock function will have to be fully implemented
+        let systemRuntimeContainsType s = 
+            printfn "Call systemRuntimeContainsType(%s) returning dummy value 'true'" s
+            true
+
+        let tpConfig = new TypeProviderConfig(systemRuntimeContainsType, ResolutionFolder=__SOURCE_DIRECTORY__, RuntimeAssembly=assemblyFile, ReferencedAssemblies=[| |], TemporaryFolder=Path.GetTempPath(), IsInvalidationSupported=true, IsHostedExecution=true)
+        use typeProvider1 = (new Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders( tpConfig ) :> ITypeProvider)
+
+        let invalidateEventCount = ref 0
+
+        typeProvider1.Invalidate.Add(fun _ -> incr invalidateEventCount)
+
+        // Load a type provider instance for the type and restart
+        let hostedNamespace1 = typeProvider1.GetNamespaces() |> Seq.find (fun t -> t.NamespaceName = "Microsoft.FSharp.Data.TypeProviders")
+
+        check "eenewioinw" (set [ for i in hostedNamespace1.GetTypes() -> i.Name ]) (set ["DbmlFile"; "EdmxFile"; "ODataService"; "SqlDataConnection";"SqlEntityConnection";"WsdlService"])
+
+        let hostedType1 = hostedNamespace1.ResolveTypeName("WsdlService")
+        let hostedType1StaticParameters = typeProvider1.GetStaticParameters(hostedType1)
+        check "eenewioinw2" 
+            (set [ for i in hostedType1StaticParameters -> i.Name ]) 
+            (set ["ServiceUri"; "LocalSchemaFile"; "ResolutionFolder"; "ForceUpdate"; "Serializable"; "MessageContract"; "EnableDataBinding"; "Async"; "CollectionType";])
+
+        let staticParameterValues = 
+            [| for x in hostedType1StaticParameters -> 
+                (match x.Name with 
+                 | "ServiceUri" -> box serviceUri
+                 | "LocalSchemaFile" when useLocalSchemaFile.IsSome -> box useLocalSchemaFile.Value
+                 | "ForceUpdate" when useForceUpdate.IsSome -> box useForceUpdate.Value
+                 | _ -> box x.RawDefaultValue) |]
+        
+        for p in Seq.zip hostedType1StaticParameters staticParameterValues do
+            printfn "%A" p
+        printfn "instantiating service type... may take a while for WSDL service metadata to be downloaded, code generation tool to run and csc.exe to run..."
+        let hostedAppliedType1 = typeProvider1.ApplyStaticArguments(hostedType1, typeFullPath, staticParameterValues)
+        this.CheckHostedType(hostedAppliedType1)
+
+        f()
+
+    member this.InstantiateTypeProviderAndCheckOneHostedType(useLocalSchemaFile: string option, useForceUpdate: bool option, typeFullPath: string[] ) = 
+        this.InstantiateTypeProviderAndPerformCheck(useLocalSchemaFile, useForceUpdate, typeFullPath, ignore)
+
+    member this.Run() = 
+        this.InstantiateTypeProviderAndCheckOneHostedType( None, None, [| "WsdlServiceApplied" |]  )
+
+        let sfile = "sfile.wsdlschema"
+        let fullPath s = Path.Combine(__SOURCE_DIRECTORY__, s)
+        let schemaFile = fullPath sfile
+
+        (try File.Delete schemaFile with _ -> ())
+        this.InstantiateTypeProviderAndCheckOneHostedType(Some sfile, Some true, [| "WsdlServiceApplied" |])
+        // schemaFile should now exist
+        test "eoinew0c9e1" (File.Exists schemaFile)
+
+        let writeTime = File.GetLastWriteTime(schemaFile)
+        // Reuse the WsdlSchema just created
+        this.InstantiateTypeProviderAndCheckOneHostedType(Some sfile, Some false, [| "WsdlServiceApplied" |])
+        // schemaFile should still exist
+        test "eoinew0c9e" (File.Exists schemaFile)
+        check "LastWriteTime_1" (File.GetLastWriteTime(schemaFile)) writeTime
+
+        let sfile2 = "sfile2.wsdlschema"
+        let schemaFile2 = fullPath sfile2
+        (try File.Delete schemaFile2 with _ -> ())
+
+        let check() = 
+            // schemaFile2 should now exist
+            test "eoinew0c9e" (File.Exists schemaFile2)
+
+            // rename schema file
+            let renamedFile = fullPath "renamed"
+            // delete existing file
+            try File.Delete renamedFile with _ -> ()
+            System.Threading.SpinWait.SpinUntil((fun () -> File.Exists(schemaFile2)), 10000)
+            |> ignore
+            test "SchemaFileExists" (File.Exists schemaFile2)
+        this.InstantiateTypeProviderAndPerformCheck(Some sfile2, Some false, [| "WsdlServiceApplied" |], check) 
+
+        // corrupt source file
+        let initial = File.ReadAllText(sfile2)
+        let text = "123" + File.ReadAllText(sfile2)
+        File.WriteAllText(sfile2, text)
+        try
+            this.InstantiateTypeProviderAndPerformCheck(Some sfile2, Some false, [| "WsdlServiceApplied" |], check) 
+            test "Exception_Expected" false
+        with
+            e -> ()
+        // read all text and verify that it was not overwritten
+        let newText = File.ReadAllText(sfile2)
+        test "FileWasNotChanged" (text = newText)
+
+    
+module CheckWsdlServiceTypeProvider = 
+    let private prefix = "ceklc"
+    type SimpleWsdlTest() = 
+        inherit WsdlServiceTest("http://api.microsofttranslator.com/V2/Soap.svc", prefix)
+
+        let check caption a b = Infrastructure.check (prefix + caption) a b
+        let test caption v = Infrastructure.test (prefix + caption) v
+
+        override this.CheckHostedType(hostedType) = 
+            //let hostedType = hostedAppliedType1
+            test "09wlkm1a" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+            test "09wlkm1b" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+            check "09wlkm2" hostedType.DeclaringType null
+            check "09wlkm3" hostedType.DeclaringMethod null
+            check "09wlkm4" hostedType.FullName "WsdlService1.WsdlServiceApplied"
+            check "09wlkm5" (hostedType.GetConstructors()) [| |]
+            check "09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+            check "09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+            check "09wlkm7" (hostedType.GetEvents()) [| |]
+            check "09wlkm8" (hostedType.GetFields()) [| |]
+            check "09wlkm9" (hostedType.GetMethods() |> Array.map (fun m -> m.Name)) [| "GetBasicHttpBinding_LanguageService"; "GetBasicHttpBinding_LanguageService"|]   
+            check "09wlkm10" (hostedType.GetProperties()) [| |]
+            check "09wlkm11" 
+                (set [ for x in hostedType.GetNestedTypes() -> x.Name ]) 
+                (set ["ServiceTypes"]   )
+
+            let serviceTypes = hostedType.GetNestedTypes().[0]
+
+            check "09wlkm11" (serviceTypes.GetNestedTypes().Length) 5
+            check "09wlkm12" 
+                (set [ for x in serviceTypes.GetNestedTypes() -> x.Name ]) 
+                (set ["LanguageService"; "LanguageServiceChannel"; "LanguageServiceClient"; "Microsoft"; "SimpleDataContextTypes" ]   )
+
+            let languageServiceType = (serviceTypes.GetNestedTypes() |> Seq.find (fun t -> t.Name = "LanguageService"))
+            check "09wlkm13"  (languageServiceType.GetProperties().Length) 0
+    
+    (new SimpleWsdlTest()).Run()
+
+module CheckWsdlServiceTypeProviderXIgniteFutures = 
+    let prefix = "qceklc"
+    type XIgniteWsdlTest() = 
+        inherit WsdlServiceTest("http://www.xignite.com/xFutures.asmx?WSDL", prefix)
+        let prefix = "xignite"
+        let check caption a b = Infrastructure.check (prefix + caption) a b
+        let test caption v = Infrastructure.test (prefix + caption) v
+
+        override this.CheckHostedType (hostedType: System.Type) = 
+            test "09wlkm1ad233" (hostedType.Assembly <> typeof<Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders>.Assembly)
+            test "09wlkm1b2ed1" (hostedType.Assembly.FullName.StartsWith "tmp")
+
+            check "09wlkm2" hostedType.DeclaringType null
+            check "09wlkm3" hostedType.DeclaringMethod null
+            check "09wlkm4" hostedType.FullName "WsdlService1.WsdlServiceApplied"
+            check "09wlkm5" (hostedType.GetConstructors()) [| |]
+            check "09wlkm6" (hostedType.GetCustomAttributesData().Count) 1
+            check "09wlkm6" (hostedType.GetCustomAttributesData().[0].Constructor.DeclaringType.FullName) typeof<TypeProviderXmlDocAttribute>.FullName
+            check "09wlkm7" (hostedType.GetEvents()) [| |]
+            check "09wlkm8" (hostedType.GetFields()) [| |]
+            check "09wlkm9" (hostedType.GetMethods() |> Array.map (fun m -> m.Name)) [| "GetXigniteFuturesSoap"; "GetXigniteFuturesSoap"; "GetXigniteFuturesSoap12";"GetXigniteFuturesSoap12"|]   
+            check "09wlkm10" (hostedType.GetProperties()) [| |]
+
+            let serviceTypes = hostedType.GetNestedTypes().[0]
+
+
+            check "09wlkm11a" (serviceTypes.GetNestedTypes().Length >= 1) true
+            check "09wlkm11b" (serviceTypes.GetNestedType("www") <> null) true
+            check "09wlkm11c" (serviceTypes.GetNestedType("www").GetNestedType("xignite") <> null) true
+            check "09wlkm11d" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com") <> null) true
+            check "09wlkm11e" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com").GetNestedType("services") <> null) true
+            check "09wlkm11f" (serviceTypes.GetNestedType("www").GetNestedType("xignite").GetNestedType("com").GetNestedType("services").GetNestedTypes().Length >= 1) true
+            check "09wlkm11g" [ for x in serviceTypes.GetNestedTypes() do if not x.IsNested && x.Namespace = null then yield x.Name ].Length 175
+
+    (new XIgniteWsdlTest()).Run()
+
+
+let _ = 
+    if !Infrastructure.failures then (stdout.WriteLine "Test Failed"; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
diff --git a/tests/fsharp/typeProviders/builtin/copyFSharpDataTypeProviderDLL.cmd b/tests/fsharp/typeProviders/builtin/copyFSharpDataTypeProviderDLL.cmd
new file mode 100644
index 0000000..4273140
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/copyFSharpDataTypeProviderDLL.cmd
@@ -0,0 +1,28 @@
+REM == Find out OS architecture, no matter what cmd prompt
+SET OSARCH=%PROCESSOR_ARCHITECTURE%
+IF NOT "%PROCESSOR_ARCHITEW6432%"=="" SET OSARCH=%PROCESSOR_ARCHITEW6432%
+
+REM == Find out path to native 'Program Files 32bit', no matter what
+REM == architecture we are running on and no matter what command
+REM == prompt we came from.
+IF /I "%OSARCH%"=="x86"   set X86_PROGRAMFILES=%ProgramFiles%
+IF /I "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)%
+
+REM == Set path to FSharp.Data.TypeProviders.dll
+REM == This binary is frozen at 4.3.0.0 version
+set FSDATATYPEPROVIDERSPATH=%X86_PROGRAMFILES%\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\Type Providers\FSharp.Data.TypeProviders.dll
+IF EXIST "%FSCBinPath%\FSharp.Data.TypeProviders.dll" set FSDATATYPEPROVIDERSPATH=%FSCBinPath%\FSharp.Data.TypeProviders.dll
+
+REM == Copy the FSharp.Data.TypeProvider.dll 
+REM == Note: we need this because we are doing white box testing
+IF EXIST "%FSDATATYPEPROVIDERSPATH%" copy /y "%FSDATATYPEPROVIDERSPATH%" .
+
+REM == Copy in config files with needed binding redirects
+xcopy /RY "%~dp0test.exe.config" "%cd%\test.exe.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\testX64.exe.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize.exe.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-lib.dll.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\test--optimize-client-of-lib.exe.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\test--optminus--debug.exe.config*"
+xcopy /RY "%~dp0test.exe.config" "%cd%\test--optplus--debug.exe.config*"
+
diff --git a/tests/fsharp/typeProviders/builtin/tdirs b/tests/fsharp/typeProviders/builtin/tdirs
new file mode 100644
index 0000000..fea6d0f
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/tdirs
@@ -0,0 +1,6 @@
+DbmlFile
+EdmxFile
+ODataService
+SqlDataConnection
+SqlEntityConnection
+WsdlService
diff --git a/tests/fsharp/typeProviders/builtin/test.exe.config b/tests/fsharp/typeProviders/builtin/test.exe.config
new file mode 100644
index 0000000..4c083b6
--- /dev/null
+++ b/tests/fsharp/typeProviders/builtin/test.exe.config
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <legacyUnhandledExceptionPolicy enabled="true" />
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
+        <bindingRedirect oldVersion="4.3.0.0" newVersion="4.3.1.0"/>
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>
diff --git a/tests/fsharp/typeProviders/diamondAssembly/build.bat b/tests/fsharp/typeProviders/diamondAssembly/build.bat
new file mode 100644
index 0000000..1cf0e84
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/build.bat
@@ -0,0 +1,38 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+if EXIST provider.dll del provider.dll
+if errorlevel 1 goto :Error
+
+%FSC% --out:provided.dll -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+%FSC% --out:provider.dll -a ..\helloWorld\provider.fsx
+if errorlevel 1 goto :Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test1.dll -a test1.fsx
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2a.dll -a -r:test1.dll test2a.fsx
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2b.dll -a -r:test1.dll test2b.fsx
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test3.exe -r:test1.dll -r:test2a.dll -r:test2b.dll test3.fsx
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/diamondAssembly/run.bat b/tests/fsharp/typeProviders/diamondAssembly/run.bat
new file mode 100644
index 0000000..4138cb6
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/run.bat
@@ -0,0 +1,41 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+
+"%PEVERIFY%" test1.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test2a.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test2b.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test3.exe
+ at if ERRORLEVEL 1 goto Error
+
+test3.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+if exist test.ok (del /f /q test.ok)
+%CLIX% "%FSI%" %fsi_flags% test1.fsx test2a.fsx test2b.fsx test3.fsx && (
+dir test.ok > NUL 2>&1 ) || (
+ at echo :FSI load failed
+set ERRORMSG=%ERRORMSG% FSI load failed;
+)
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typeProviders/diamondAssembly/test1.fsx b/tests/fsharp/typeProviders/diamondAssembly/test1.fsx
new file mode 100644
index 0000000..56c817a
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/test1.fsx
@@ -0,0 +1,27 @@
+#r "provider.dll"
+
+module ErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+    type TheType = FSharp.HelloWorld.HelloWorldType
+
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType4 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType4">
+
+    let internal f2() : TheGeneratedType4 = Unchecked.defaultof<_>
+    let internal f3() : TheGeneratedType4 = Unchecked.defaultof<_>
+    let internal testTypeEquiv2(a:TheGeneratedType4,b:TheGeneratedType4) = (a = b)
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType5 = FSharp.HelloWorldGenerativeInternalNamespace1.TheContainerType<"unused">
+
+    let f2() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let testTypeEquiv2(a:TheGeneratedType5,b:TheGeneratedType5) = (a = b)
+
+
+
+//#endif
diff --git a/tests/fsharp/typeProviders/diamondAssembly/test2a.fsx b/tests/fsharp/typeProviders/diamondAssembly/test2a.fsx
new file mode 100644
index 0000000..ce7ac90
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/test2a.fsx
@@ -0,0 +1,25 @@
+
+#r "provider.dll"
+#r "test1.dll"
+
+module ErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+    let testTypeEquiv2(a:Test1.ErasedTypes.TheType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+
+module InternalGenerativeTypes = 
+
+    let internal f2() : Test1.PublicGenerativeTypes.TheGeneratedType5 = Unchecked.defaultof<_>
+    let internal f3() : Test1.PublicGenerativeTypes.TheGeneratedType5 = Unchecked.defaultof<_>
+    let internal testTypeEquiv2(a:Test1.PublicGenerativeTypes.TheGeneratedType5,b:Test1.PublicGenerativeTypes.TheGeneratedType5) = (a = b)
+
+module PublicGenerativeTypes = 
+    type TheGeneratedType5 = Test1.PublicGenerativeTypes.TheGeneratedType5
+
+    let f2() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let testTypeEquiv2(a:TheGeneratedType5,b:TheGeneratedType5) = (a = b)
+
+
+
diff --git a/tests/fsharp/typeProviders/diamondAssembly/test2b.fsx b/tests/fsharp/typeProviders/diamondAssembly/test2b.fsx
new file mode 100644
index 0000000..ce7ac90
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/test2b.fsx
@@ -0,0 +1,25 @@
+
+#r "provider.dll"
+#r "test1.dll"
+
+module ErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+    let testTypeEquiv2(a:Test1.ErasedTypes.TheType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+
+module InternalGenerativeTypes = 
+
+    let internal f2() : Test1.PublicGenerativeTypes.TheGeneratedType5 = Unchecked.defaultof<_>
+    let internal f3() : Test1.PublicGenerativeTypes.TheGeneratedType5 = Unchecked.defaultof<_>
+    let internal testTypeEquiv2(a:Test1.PublicGenerativeTypes.TheGeneratedType5,b:Test1.PublicGenerativeTypes.TheGeneratedType5) = (a = b)
+
+module PublicGenerativeTypes = 
+    type TheGeneratedType5 = Test1.PublicGenerativeTypes.TheGeneratedType5
+
+    let f2() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let testTypeEquiv2(a:TheGeneratedType5,b:TheGeneratedType5) = (a = b)
+
+
+
diff --git a/tests/fsharp/typeProviders/diamondAssembly/test3.fsx b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx
new file mode 100644
index 0000000..7ee5769
--- /dev/null
+++ b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx
@@ -0,0 +1,176 @@
+
+#r "provider.dll"
+#r "test1.dll"
+#r "test2a.dll"
+#r "test2b.dll"
+
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s^": YES") 
+  else (stdout.WriteLine ("\n***** "^s^": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+(*========================================================================*)
+
+
+module CheckCrossAssemblyEquivalenceOfErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+    check "jcenewnwe091" (Test1.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test1.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test1.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test1.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test1.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test1.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test1.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test1.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2a.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2a.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv2(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (Test2b.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (Test2b.ErasedTypes.testTypeEquiv2(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (testTypeEquiv(Test2a.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091" (testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe091" (testTypeEquiv(Test2b.ErasedTypes.f(), Test1.ErasedTypes.f())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+module CheckCrossAssemblyEquivalenceOfGeneratedTypes = 
+    type TheGeneratedType5 = Test1.PublicGenerativeTypes.TheGeneratedType5
+
+    let f2() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType5 = Unchecked.defaultof<_>
+    let testTypeEquiv(a:TheGeneratedType5,b:TheGeneratedType5) = (a = b)
+
+    check "jcenewnwe091" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test1.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (Test2b.PublicGenerativeTypes.testTypeEquiv2(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (testTypeEquiv(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (testTypeEquiv(Test2a.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2a.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2a.PublicGenerativeTypes.f2(), f2())) true
+
+    check "jcenewnwe091" (testTypeEquiv(Test2b.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091" (testTypeEquiv(Test2b.PublicGenerativeTypes.f2(), Test1.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe092" (testTypeEquiv(Test2b.PublicGenerativeTypes.f2(), f2())) true
+
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typeProviders/globalNamespace/build.bat b/tests/fsharp/typeProviders/globalNamespace/build.bat
new file mode 100644
index 0000000..ce6d04d
--- /dev/null
+++ b/tests/fsharp/typeProviders/globalNamespace/build.bat
@@ -0,0 +1,23 @@
+rem @if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+%CSC% /out:globalNamespaceTP.dll /debug+ /target:library /r:"%FSCOREDLLPATH%" globalNamespaceTP.cs
+if ERRORLEVEL 1 goto :Error
+
+"%FSC%" %fsc_flags% /debug+ /r:globalNamespaceTP.dll /optimize- test.fsx
+if ERRORLEVEL 1 goto Error
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/globalNamespace/globalNamespaceTP.cs b/tests/fsharp/typeProviders/globalNamespace/globalNamespaceTP.cs
new file mode 100644
index 0000000..dccf87b
--- /dev/null
+++ b/tests/fsharp/typeProviders/globalNamespace/globalNamespaceTP.cs
@@ -0,0 +1,70 @@
+// A dummy type provider that does not do much other that
+// declaring itself as "contributing to types in the global namespace"
+
+using System;
+using Microsoft.FSharp.Core.CompilerServices;
+using System.Reflection;
+
+[assembly: TypeProviderAssembly()]
+
+namespace TypeProviderInCSharp
+{
+    class Namespace1 : IProvidedNamespace
+    {
+        public IProvidedNamespace[] GetNestedNamespaces()
+        {
+            return new IProvidedNamespace[] { };
+        }
+
+        public Type[] GetTypes()
+        {
+            return new Type[] { };
+        }
+
+        public string NamespaceName
+        {
+            // Returning 'null' means that our types live in the global namespace
+            get { System.Console.WriteLine("From TP: returning null to mean global NS..."); return null; }
+        }
+
+        public Type ResolveTypeName(string typeName)
+        {
+            System.Console.WriteLine("From TP: typeName={0}", typeName);
+            return null;  // we don't know any type
+        }
+    }
+
+
+    [TypeProvider()]
+    public class TypeProvider : ITypeProvider {
+    
+        public Type ApplyStaticArguments(Type typeWithoutArguments, string[] typeNameWithArguments, object[] staticArguments)
+        {
+            throw new NotImplementedException();
+        }
+
+        Microsoft.FSharp.Quotations.FSharpExpr ITypeProvider.GetInvokerExpression(MethodBase syntheticMethodBase, Microsoft.FSharp.Quotations.FSharpExpr[] parameterExpressions)
+        {
+            return null;
+        }
+
+        public IProvidedNamespace[] GetNamespaces()
+        {
+            return new IProvidedNamespace[] { new Namespace1() };
+        }
+
+        public System.Reflection.ParameterInfo[] GetStaticParameters(Type typeWithoutArguments)
+        {
+            return new ParameterInfo[] { };
+        }
+
+        public event EventHandler Invalidate;
+
+        void System.IDisposable.Dispose() { }
+
+        public byte[] GetGeneratedAssemblyContents(Assembly assembly) 
+        {
+            throw new Exception("GetGeneratedAssemblyContents - only erased types were provided!!");
+        }
+    }
+}
diff --git a/tests/fsharp/typeProviders/globalNamespace/test.fsx b/tests/fsharp/typeProviders/globalNamespace/test.fsx
new file mode 100644
index 0000000..df239f5
--- /dev/null
+++ b/tests/fsharp/typeProviders/globalNamespace/test.fsx
@@ -0,0 +1,41 @@
+#r "globalNamespaceTP.dll"
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s+": YES") 
+  else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+
+
+printfn "%A" System.DateTime.Now
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs b/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs
new file mode 100644
index 0000000..2177780
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/TypeMagic.fs
@@ -0,0 +1,494 @@
+
+namespace FSharp.TypeMagic 
+open System
+open System.Text
+open System.Reflection
+open System.Linq
+open System.Linq.Expressions
+open System.Collections.Generic
+open Microsoft.FSharp.Core.CompilerServices
+
+module internal Formatting = 
+    let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition()
+    let rec formatObject (o:obj) = 
+        if o = null then "null"
+        else
+            let typ = o.GetType()
+            if typ.IsGenericType then 
+                let gt = typ.GetGenericTypeDefinition()
+                if genericSomeType = gt then 
+                    let getter = typ.GetProperty("Value").GetGetMethod()
+                    let result = getter.Invoke(o,[||])
+                    formatObject result             
+                else
+                    o.ToString()
+            else 
+                o.ToString()
+
+
+type internal ReifiedInstance(obj:obj, hostedType:Type) = 
+    member __.GetReifiedType() = hostedType
+    member __.GetObject() = obj
+    override __.ToString() =
+        if obj = null then
+            "null:" + hostedType.Name
+        else 
+            let sb = StringBuilder()
+            for prop in hostedType.GetProperties() do
+                if prop.CanRead then
+                    let mi = prop.GetGetMethod()
+                    let result = Formatting.formatObject (mi.Invoke(obj,[||]))
+                    if sb.Length = 0 then
+                        sb.Append("{") |> ignore
+                    else
+                        sb.Append(", ") |> ignore
+                    sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore
+            if sb.Length <> 0 then sb.Append("}")|>ignore                  
+            (sb.ToString()) + ":" + hostedType.Name
+
+type internal ITypeStatistics =
+    abstract CallsToGetMembers : int
+
+type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = 
+    inherit ConstructorInfo()
+
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+
+    override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags"
+    override this.GetParameters() = [||]
+    override this.MethodHandle = failwith "not implemented MethodHandle"
+    override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName
+    override this.Name = 
+        if this.IsStatic then ".cctor"
+        else ".ctor"
+    override this.DeclaringType = declaringType
+    override this.ReflectedType = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType, ``inherit``) = true
+
+[<RequireQualifiedAccess>]
+type TypeContainer =
+|   Namespace of System.Reflection.Module * string // namespace
+|   Type of System.Type
+
+type internal TypeImpl(container:TypeContainer, 
+                       className,
+                       baseType,
+                       members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array,
+                       getCustomAttributes,
+                       ?invokeMember,
+                       ?attributes,
+                       ?isErased,
+                       ?extras:obj) as this= 
+    inherit Type()
+    
+
+    // Validate
+    do
+        match container with
+        |   TypeContainer.Namespace (theModule, rootNamespace) ->
+                if theModule = null then failwith "Null modules not allowed"
+                if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace"
+        |   TypeContainer.Type _ -> ()
+    
+    let theModule =
+        match container with
+        |   TypeContainer.Namespace (m, _) -> m
+        |   TypeContainer.Type st -> st.Module
+    
+    // Statistics
+    let mutable callsToGetMembers = 0
+    let rootNamespace =
+        match container with
+        |   TypeContainer.Namespace (_,rootNamespace) -> rootNamespace
+        |   TypeContainer.Type st -> st.Namespace
+
+    let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) =
+        let matches = 
+            this.GetMethods(invokeAttr) 
+            |> Array.filter(fun m->m.Name = name) 
+            |> List.ofArray
+        match matches with 
+        | [oneMatch] -> oneMatch.Invoke(target,args)
+        | [] -> failwith (sprintf "Found no method named '%s'." name)
+        | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name)
+                    
+    let mutable invokeMember = 
+        match invokeMember with 
+        | Some(invokeMember) -> invokeMember
+        | None -> defaultInvokeMembers
+
+    /// Replace the default InvokeMember method.
+    member this.ReplaceInvokeMember(newInvokeMember) =        
+        invokeMember <- newInvokeMember
+       
+    // Members of Type and parents
+    override this.GUID : Guid= failwith "Not implemented GUID"
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj =
+        invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters)
+    override this.Assembly : Assembly = theModule.Assembly
+    override this.FullName : string = 
+        match container with
+        | TypeContainer.Type declaringType -> declaringType.FullName+"+"+className
+        | TypeContainer.Namespace (_,``namespace``) -> 
+            match ``namespace`` with
+            | null -> className
+            | _ -> ``namespace``+"."+className
+    override this.Namespace : string = rootNamespace
+    override this.AssemblyQualifiedName : string = failwith "Not implemented"
+    override this.BaseType : Type = baseType
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = 
+        ConstructorImpl(this) :> ConstructorInfo
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= 
+        [| for m in members this bindingAttr MemberTypes.Constructor None do
+            if m.MemberType = MemberTypes.Constructor then
+                yield downcast m |]
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= 
+        let result = 
+            [ for m in members this bindingAttr MemberTypes.Method (Some name) do
+                if m.MemberType = MemberTypes.Method && m.Name = name then
+                    yield  m ]
+        match result with 
+        | [] -> null
+        | [one] -> downcast one
+        | several -> 
+            System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution")
+            downcast (List.head several)
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m)        
+
+    override this.GetField(name, bindingAttr) : FieldInfo = 
+        let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] 
+        if fields.Length > 0 then downcast fields.[0] else null
+
+    override this.GetFields(bindingAttr) : FieldInfo[] = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] 
+
+    override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase)
+    override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces()
+    override this.GetEvent(name, bindingAttr) = 
+        let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) 
+        if events.Length > 0 then downcast events.[0] else null
+    override this.GetEvents(bindingAttr) = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |]
+    
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = 
+        if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl"
+        if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl"
+        if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl"
+        let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) 
+        if props.Length > 0 then
+            downcast props.[0]
+        else
+            null
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |]
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || 
+                                                            // Allow 'fake' nested types that are actually real .NET types
+                                                            m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m)
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = 
+        let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr)
+        match nt.Length with
+        | 0 -> null
+        | 1 -> downcast nt.[0]
+        | _ -> failwith (sprintf "There is more than one nested type called %s" name)
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = 
+        let thisMembers = members (downcast this) bindingAttr MemberTypes.All None
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )]
+        else thisMembers
+    override this.GetAttributeFlagsImpl() = 
+        let defaultAttributes = 
+            (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| 
+            TypeAttributes.Class ||| 
+            TypeAttributes.Sealed |||
+            (enum (if isErased = Some false then 0 else int32 TypeProviderTypeAttributes.IsErased))
+        defaultArg attributes defaultAttributes
+    override this.IsArrayImpl() : bool = false
+    override this.IsByRefImpl() : bool = false
+    override this.IsPointerImpl() : bool= false
+    override this.IsPrimitiveImpl() : bool= false
+    override this.IsCOMObjectImpl() : bool= false
+    override this.GetElementType() : Type= failwith "Not implemented GetElementType" 
+    override this.HasElementTypeImpl() : bool= false
+    override this.UnderlyingSystemType : Type = typeof<System.Type>
+    override this.Name : string = className
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"        
+    override this.Module : Module = theModule
+    override this.DeclaringType = 
+        match container with
+        | TypeContainer.Type (declaringType)->declaringType
+        | TypeContainer.Namespace _ -> null
+    override this.MemberType : MemberTypes =
+        if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo      
+    override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode()
+    override this.Equals(that:obj) = 
+        match that with
+        | null -> false
+        | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0
+        | _ -> false
+    override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = 
+        let mt = 
+            if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then 
+                mt ||| MemberTypes.TypeInfo
+            else
+                mt
+        let thisMember : MemberInfo array = 
+            members this bindingAttr mt (Some name)
+                |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name)
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMember;this.BaseType.GetMember(name,mt,bindingAttr)]
+        else
+            thisMember
+    override this.GetGenericArguments() = [||]
+    override this.ToString() = 
+        this.FullName
+
+    member this.Extras = extras
+    interface ITypeStatistics with
+        override this.CallsToGetMembers = callsToGetMembers        
+    
+and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = 
+    inherit System.Reflection.PropertyInfo()
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+    override this.PropertyType : Type= propertyType
+    override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue"
+    override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors"
+    override this.GetGetMethod(nonPublic: bool) : MethodInfo = 
+        match propertyGetter with
+        | Some(propertyGetter) -> propertyGetter
+        | None -> null
+    override this.GetSetMethod(nonPublic: bool) : MethodInfo = 
+        match propertySetter with
+        | Some(propertySetter) -> propertySetter
+        | None -> null
+    override this.GetIndexParameters() : ParameterInfo []= [||]
+    override this.Attributes : PropertyAttributes = PropertyAttributes.None
+    override this.CanRead : bool= propertyGetter.IsSome
+    override this.CanWrite : bool = propertySetter.IsSome
+    override this.GetValue(obj: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : obj= failwith "Not implemented GetValue"
+    override this.Name : string= propertyName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"
+    override this.MemberType : MemberTypes = MemberTypes.Property
+    
+and internal MethodInfoImpl(declaringType,
+                             methodName,
+                             returnType,
+                             getCustomAttributes,
+                             attributes,
+                             invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj,
+                             parameters) = 
+    inherit System.Reflection.MethodInfo()
+
+    override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes"
+    override this.GetBaseDefinition() : MethodInfo= failwith "Not implemented GetBaseDefinition"
+    override this.GetParameters() : ParameterInfo []= parameters
+    override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags"
+    override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle"
+    override this.Attributes : MethodAttributes = attributes
+    override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        invoke(obj,invokeAttr,binder,parameters,culture)
+    override this.Name : string = methodName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true
+    override this.MemberType : MemberTypes = MemberTypes.Method
+    override this.CallingConvention = 
+        let mutable cc = CallingConventions.Standard
+        if not(this.IsStatic) then 
+            cc <- cc ||| CallingConventions.HasThis
+        cc
+    override this.ReturnType = returnType
+    override this.ReturnParameter = null 
+    override this.ToString() = 
+        "Method " + this.Name
+
+type internal ParameterInfoImpl(name:string,parameterType:Type,?isOut:bool,?optionalValue:obj,?getCustomAttributes) = 
+    inherit System.Reflection.ParameterInfo()
+    let isOut = defaultArg isOut false
+    let getCustomAttributes = defaultArg getCustomAttributes (fun _ -> [||])
+    override this.GetCustomAttributesData()                 = (getCustomAttributes() :> IList<_>)
+    override this.Name = name
+    override this.ParameterType = parameterType
+    override this.Attributes = (base.Attributes ||| (if isOut then ParameterAttributes.Out else enum 0)
+                                                ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault))
+    override this.RawDefaultValue = defaultArg optionalValue null
+    
+module internal Flags = 
+    let combineWhenOptionTrue optionalFlag append original =
+        match optionalFlag with 
+        | Some(true) -> original ||| append
+        | _ -> original
+        
+[<Sealed>]
+type internal TypeBuilder = 
+        
+   
+    static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras,?isErased) : Type = 
+        let baseType = 
+            match baseType with
+            | Some(baseType) -> baseType
+            | None -> typeof<obj>
+       
+        let members = 
+            match members with 
+            | Some(members) -> members 
+            | _ -> fun _ _ _ _ -> [||]
+                        
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes) -> getCustomAttributes
+            | None -> fun _ -> [||]          
+        
+        let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras,?isErased=isErased)
+                            
+        upcast result                            
+
+    static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes,?isErased) : Type = 
+        let members = defaultArg members (lazy [| |])
+        let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = 
+            match nameOption with
+            | None -> members.Force()
+            | Some name -> members.Force() |> Array.filter(fun m->m.Name=name)
+
+        TypeBuilder.CreateType(container, className, ?baseType=baseType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes, ?isErased=isErased)
+    
+    static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = 
+        let attributes = MethodAttributes.Public
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static 
+        let miGetter = 
+            match getInvoke with
+            | Some(getInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                match getterGetCustomAttributes with
+                | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic))
+                | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic))
+            | None -> None
+        let miSetter = 
+            match setInvoke with
+            | Some(setInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, 
+                                                  typeof<System.Void>, 
+                                                  attributes = attributes, 
+                                                  parameters=[|TypeBuilder.CreateParameter("value",propertyType)|],
+                                                  invoke=setInvoke, 
+                                                  ?isStatic=isStatic))
+            | None -> None
+        match miGetter,miSetter with
+        | Some(miGetter),None-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter,getCustomAttributes=getCustomAttributes)
+        | None,Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | Some(miGetter),Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | None,None -> failwith "Property must have a getter or setter"
+
+    // A synthetic property is one without callable "invoke" methods
+    static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = 
+        let getter = defaultArg getter true
+        let setter = defaultArg setter false
+        if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter"
+        let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+
+        TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) 
+
+    static member CreateStaticParameter(parameterName, parameterType, parameterPosition, ?parameterDefaultValue, ?defaultValue) = 
+        { new ParameterInfo() with 
+              member __.RawDefaultValue = defaultArg defaultValue null
+              member __.Attributes = if defaultValue.IsNone then enum 0 else ParameterAttributes.Optional
+              member __.DefaultValue = defaultArg parameterDefaultValue null
+              member __.Position = parameterPosition
+              member __.ParameterType = parameterType
+              member __.Name = parameterName }
+    
+    static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let attributes = 
+            match attributes with 
+            | Some(attributes) -> attributes 
+            | None -> MethodAttributes.Public 
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static             
+
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes)->getCustomAttributes
+            | None -> fun _ -> [||]    
+
+        let invoke = 
+            match invoke with
+            | Some(invoke)->invoke
+            | None -> fun _ -> failwith "No invoke for this method."             
+            
+        let parameters = 
+            match parameters with 
+            | Some(parameters) -> parameters 
+            | None -> [||]
+            
+        upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters)
+
+
+    // A synthetic method is one without a callable "invoke" method
+    static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+        TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) 
+
+    static member CreateParameter(name:string,parameterType:Type,?isOut:bool,?optionalValue:obj,?getCustomAttributes) = upcast ParameterInfoImpl(name,parameterType,?isOut=isOut,?optionalValue=optionalValue, ?getCustomAttributes=getCustomAttributes)
+    static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes)
+    
+    static member MemberInfosOfProperty(property:PropertyInfo) =
+        [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo
+          if property.CanWrite then yield property.GetSetMethod() :> MemberInfo
+          yield property :> MemberInfo ]
+
+    static member JoinPropertiesIntoMemberInfos(properties:seq<PropertyInfo>) =
+        [| for property in properties do yield! TypeBuilder.MemberInfosOfProperty property |]
+
+    static member CacheMembers f = 
+        let cache = ref None
+        fun this _bindingAttr _kind _nmOpt ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f this in cache := Some res; res
+
+    static member CacheWithArg f = 
+        let cache = ref None
+        fun x ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f x in cache := Some res; res
+
+    static member StandardGenerativeGetInvokerExpression(methodBase: MemberInfo, parameters: Quotations.Expr[]) = 
+        match methodBase with
+        | :?  ConstructorInfo as cinfo ->  
+            Quotations.Expr.NewObject(cinfo, Array.toList parameters) 
+        | :? System.Reflection.MethodInfo as minfo ->  
+            if minfo.IsStatic then 
+                Quotations.Expr.Call(minfo, Array.toList parameters) 
+            else
+                Quotations.Expr.Call(parameters.[0], minfo, Array.toList parameters.[1..])
+        | _ -> failwith ("TypeProviderForNamespaces.GetInvokerExpression: not a ProvidedMethod/ProvidedConstructor/ConstructorInfo/MethodInfo, name=" + methodBase.Name + " class=" + methodBase.GetType().FullName)
diff --git a/tests/fsharp/typeProviders/helloWorld/build.bat b/tests/fsharp/typeProviders/helloWorld/build.bat
new file mode 100644
index 0000000..000924f
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/build.bat
@@ -0,0 +1,97 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+if EXIST provided.dll del provided.dll
+if ERRORLEVEL 1 goto :Error
+
+if EXIST provided1.dll del provided1.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided1.dll -g -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST provided2.dll del provided2.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided2.dll -g -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST provided3.dll del provided3.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided3.dll -g -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST provided4.dll del provided4.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided4.dll -g -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedJ.dll del providedJ.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedJ.dll -g -a ..\helloWorld\providedJ.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedK.dll del providedK.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedK.dll -g -a ..\helloWorld\providedK.fs
+if errorlevel 1 goto :Error
+
+%FSC% --out:providedNullAssemblyName.dll -g -a ..\helloWorld\providedNullAssemblyName.fsx
+if errorlevel 1 goto :Error
+
+call %~d0%~p0\..\build-typeprovider-test.bat
+
+if EXIST provider_with_binary_compat_changes.dll del provider_with_binary_compat_changes.dll
+if ERRORLEVEL 1 goto :Error
+
+mkdir bincompat1
+pushd bincompat1
+
+xcopy /y ..\*.dll .
+if errorlevel 1 goto :Error
+
+
+%FSC% -g -a -o:test_lib.dll -r:provider.dll ..\test.fsx
+if ERRORLEVEL 1 goto :Error
+
+%FSC% -r:test_lib.dll -r:provider.dll ..\testlib_client.fsx
+if ERRORLEVEL 1 goto :Error
+
+popd
+mkdir bincompat2
+pushd bincompat2
+
+xcopy /y ..\bincompat1\*.dll .
+
+
+REM overwrite provider.dll
+%FSC% --define:ADD_AN_OPTIONAL_STATIC_PARAMETER --out:provider.dll -g -a ..\provider.fsx
+if ERRORLEVEL 1 goto :Error
+
+REM This is the important part of the binary compatibility part of the test: the new provider is being used, but 
+REM with a binary that was generated w.r.t. the old provider. The new provider can still resolve the references
+REM generated by the old provider which are stored in the F# metadata for test_lib.dll
+%FSC% --define:ADD_AN_OPTIONAL_STATIC_PARAMETER -r:test_lib.dll -r:provider.dll ..\testlib_client.fsx
+if ERRORLEVEL 1 goto :Error
+
+%PEVERIFY% provider.dll
+if ERRORLEVEL 1 goto :Error
+
+%PEVERIFY% test_lib.dll
+if ERRORLEVEL 1 goto :Error
+
+%PEVERIFY% testlib_client.exe
+if ERRORLEVEL 1 goto :Error
+
+
+
+endlocal
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typeProviders/helloWorld/build.fs b/tests/fsharp/typeProviders/helloWorld/build.fs
new file mode 100644
index 0000000..e69de29
diff --git a/tests/fsharp/typeProviders/helloWorld/provided.fs b/tests/fsharp/typeProviders/helloWorld/provided.fs
new file mode 100644
index 0000000..f3ce98f
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/provided.fs
@@ -0,0 +1,197 @@
+namespace global
+
+type TheGeneratedType1() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType1,x2:TheGeneratedType1) = x1
+    static member (-) (x1:TheGeneratedType1,x2:TheGeneratedType1) = x2
+
+type TheGeneratedType2() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType2,x2:TheGeneratedType2) = x1
+    static member (-) (x1:TheGeneratedType2,x2:TheGeneratedType2) = x2
+
+
+type TheGeneratedType3InContainerType1() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType3InContainerType1,x2:TheGeneratedType3InContainerType1) = x1
+    static member (-) (x1:TheGeneratedType3InContainerType1,x2:TheGeneratedType3InContainerType1) = x2
+
+type TheGeneratedType3InContainerType2() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType3InContainerType2,x2:TheGeneratedType3InContainerType2) = x1
+    static member (-) (x1:TheGeneratedType3InContainerType2,x2:TheGeneratedType3InContainerType2) = x2
+
+type TheGeneratedType4() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType4,x2:TheGeneratedType4) = x1
+    static member (-) (x1:TheGeneratedType4,x2:TheGeneratedType4) = x2
+
+
+type TheGeneratedType1WithIndexer() = 
+    let dict = System.Collections.Generic.Dictionary<int,string>()
+    [<DefaultValue>]
+    val mutable MutableProperty1 : int
+    member x.Prop2 = 1
+    member x.Item 
+        with get (v:int) = if dict.ContainsKey v then dict.[v] else string v 
+        and set (idx:int) (v:string) = dict.[idx] <- v
+
+type TheGeneratedType2WithIndexer() = 
+    let dict = System.Collections.Generic.Dictionary<int,string>()
+    [<DefaultValue>]
+    val mutable MutableProperty1 : int
+    member x.Prop2 = 1
+    member x.Item 
+        with get (v:int) = if dict.ContainsKey v then dict.[v] else string v 
+        and set (idx:int) (v:string) = dict.[idx] <- v
+
+type TheGeneratedType3WithIndexer() = 
+    let dict = System.Collections.Generic.Dictionary<int,string>()
+    [<DefaultValue>]
+    val mutable MutableProperty1 : int
+    member x.Prop2 = 1
+    member x.Item 
+        with get (v:int) = if dict.ContainsKey v then dict.[v] else string v 
+        and set (idx:int) (v:string) = dict.[idx] <- v
+
+
+type TheGeneratedType5() = 
+    member x.Prop1 = 1
+    static member (+) (x1:TheGeneratedType5,x2:TheGeneratedType5) = x1
+    static member (-) (x1:TheGeneratedType5,x2:TheGeneratedType5) = x2
+
+
+type TheGeneratedType5WithIndexer() = 
+    let dict = System.Collections.Generic.Dictionary<int,string>()
+    [<DefaultValue>]
+    val mutable MutableProperty1 : int
+    member x.Prop2 = 1
+    member x.Item 
+        with get (v:int) = if dict.ContainsKey v then dict.[v] else string v 
+        and set (idx:int) (v:string) = dict.[idx] <- v
+
+type TheGeneratedTypeWithEvent() = 
+    let ev = new Event<System.EventHandler<System.EventArgs>, System.EventArgs >()
+    member sender.Trigger () = ev.Trigger(sender,System.EventArgs())
+    [<CLIEvent>]
+    member __.MyEvent = ev.Publish
+
+
+[<Struct>]
+type TheGeneratedStructType(x:int) = 
+    member __.StructProperty1 = x + 1
+    [<DefaultValue>]
+    val mutable StructMutableProperty1 : int
+type TheGeneratedDelegateType = delegate of arg1:int -> int
+
+type TheGeneratedEnumType = 
+    | Item0 = 0
+    | Item1 = 1
+    | Item2 = 2
+
+module GeneratedRelatedTypes = 
+
+    type TheGeneratedInterfaceType = 
+        abstract member InterfaceMethod0 : unit -> int
+        abstract member InterfaceMethod1 : arg1:int -> int
+        abstract member InterfaceMethod2 : arg1:int * arg2:int -> int
+        abstract member InterfaceProperty1 : int
+
+    type TheGeneratedInterfaceSubType = 
+        inherit TheGeneratedInterfaceType
+        abstract member InterfaceMethod3 : arg1:int * arg2:int * arg3:int -> int
+
+    type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceType() = 
+        interface TheGeneratedInterfaceType with
+            member __.InterfaceMethod0() = 3
+            member __.InterfaceMethod1 arg1 = arg1 + 4
+            member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+            member __.InterfaceProperty1 = 4
+
+    type TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceSubType() = 
+        interface TheGeneratedInterfaceSubType with
+            member __.InterfaceMethod0() = 3
+            member __.InterfaceMethod1 arg1 = arg1 + 4
+            member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+            member __.InterfaceMethod3 (arg1, arg2, arg3) = arg1+arg2+arg3
+            member __.InterfaceProperty1 = 4
+
+    type TheGeneratedInterfaceTypeWithEvent = 
+        abstract member InterfaceProperty1 : int
+        [<CLIEvent>]
+        abstract member MyEvent : IEvent<System.EventHandler<System.EventArgs>, System.EventArgs>
+
+    [<AbstractClass>]
+    type TheGeneratedAbstractClass() = 
+        abstract member AbstractMethod0 : unit -> int
+        abstract member AbstractMethod1 : arg1:int -> int
+        abstract member AbstractMethod2 : arg1:int * arg2:int -> int
+        abstract member AbstractProperty1 : int
+
+    [<AbstractClass>]
+    type TheGeneratedAbstractClassWithEvent() = 
+        [<CLIEvent>]
+        abstract member MyEvent : IEvent<System.EventHandler<System.EventArgs>, System.EventArgs>
+
+
+
+module TheOuterType = 
+
+    type TheNestedGeneratedType() = 
+        member x.Prop1 = 1
+        static member (+) (x1:TheNestedGeneratedType,x2:TheNestedGeneratedType) = x1
+        static member (-) (x1:TheNestedGeneratedType,x2:TheNestedGeneratedType) = x2
+
+    type TheNestedGeneratedType1() = 
+        member x.Prop1 = 1
+
+    type TheNestedGeneratedTypeWithIndexer() = 
+        let dict = System.Collections.Generic.Dictionary<int,string>()
+        member x.Prop2 = 1
+        [<DefaultValue>]
+        val mutable MutableProperty1 : int
+        member x.Item 
+            with get (v:int) = if dict.ContainsKey v then dict.[v] else string v 
+            and set (idx:int) (v:string) = dict.[idx] <- v
+
+    [<Struct>]
+    type TheNestedGeneratedStructType(x:int) = 
+        member __.StructProperty1 = x
+        [<DefaultValue>]
+        val mutable StructMutableProperty1 : int
+
+    type TheNestedGeneratedInterfaceType = 
+        abstract member InterfaceMethod0 : unit -> int
+        abstract member InterfaceMethod1 : arg1:int -> int
+        abstract member InterfaceMethod2 : arg1:int * arg2:int -> int
+        abstract member InterfaceProperty1 : int
+
+    type TheNestedGeneratedInterfaceTypeWithEvent = 
+        abstract member InterfaceProperty1 : int
+        [<CLIEvent>]
+        abstract member MyEvent : IEvent<System.EventHandler<System.EventArgs>, System.EventArgs>
+
+    type TheNestedGeneratedDelegateType = delegate of arg1:int -> int
+
+    [<AbstractClass>]
+    type TheNestedGeneratedAbstractClass() = 
+        abstract member AbstractMethod0 : unit -> int
+        abstract member AbstractMethod1 : arg1:int -> int
+        abstract member AbstractMethod2 : arg1:int * arg2:int -> int
+        abstract member AbstractProperty1 : int
+
+    [<AbstractClass>]
+    type TheNestedGeneratedAbstractClassWithEvent() = 
+        abstract member AbstractProperty1 : int
+        [<CLIEvent>]
+        abstract member MyEvent : IEvent<System.EventHandler<System.EventArgs>, System.EventArgs>
+
+    type TheNestedGeneratedEnumType = 
+        | Item0 = 0
+        | Item1 = 1
+        | Item2 = 2
+
+module DllImportSmokeTest = 
+    [<System.Runtime.InteropServices.DllImport("kernel32.dll")>]
+    extern System.UInt32 private GetLastError()
+
diff --git a/tests/fsharp/typeProviders/helloWorld/providedJ.fs b/tests/fsharp/typeProviders/helloWorld/providedJ.fs
new file mode 100644
index 0000000..cf965ce
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/providedJ.fs
@@ -0,0 +1,11 @@
+namespace global
+
+/// The type provided when GenerativeProviderWithStaticParameter is instantiated at "J"
+type TheGeneratedTypeJ() = 
+    member x.Item1 = 1
+
+
+// some code with an intra-assembly reference to a generated type
+module IntraAssemblyCode = 
+   let f (x:TheGeneratedTypeJ) = x
+
diff --git a/tests/fsharp/typeProviders/helloWorld/providedK.fs b/tests/fsharp/typeProviders/helloWorld/providedK.fs
new file mode 100644
index 0000000..78910be
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/providedK.fs
@@ -0,0 +1,7 @@
+namespace global
+
+/// The type provided when GenerativeProviderWithStaticParameter is instantiated at "K"
+type TheGeneratedTypeK() = 
+    member x.Item1 = 1
+
+
diff --git a/tests/fsharp/typeProviders/helloWorld/providedNullAssemblyName.fsx b/tests/fsharp/typeProviders/helloWorld/providedNullAssemblyName.fsx
new file mode 100644
index 0000000..c6f83b0
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/providedNullAssemblyName.fsx
@@ -0,0 +1,3 @@
+
+[<Microsoft.FSharp.Core.CompilerServices.TypeProviderAssembly(null)>]
+do ()
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/helloWorld/provider.fsx b/tests/fsharp/typeProviders/helloWorld/provider.fsx
new file mode 100644
index 0000000..b65e003
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/provider.fsx
@@ -0,0 +1,1062 @@
+namespace Provider
+#load "TypeMagic.fs"
+
+open System
+open System.Linq.Expressions
+open System.Reflection
+open Microsoft.FSharp.Core.CompilerServices
+open Microsoft.FSharp.Linq.NullableOperators
+open System.Collections.Generic
+open System.IO
+open FSharp.TypeMagic
+
+[<assembly: TypeProviderAssembly>]
+do ()
+
+[<AutoOpen>]
+module Utils = 
+    let mkNamespace (name,typ:System.Type) = 
+        { new IProvidedNamespace with
+          member this.NamespaceName = name
+          member this.GetTypes() = [|typ|]
+          member this.GetNestedNamespaces() = [| |]
+          member this.ResolveTypeName typeName = if typ.Name = typeName then typ else null }
+
+    let mkParamArrayAttributeData() = 
+        { new CustomAttributeData() with 
+                member __.Constructor =  typeof<ParamArrayAttribute>.GetConstructors().[0]
+                member __.ConstructorArguments = upcast [| |]
+                member __.NamedArguments = upcast [| |] }
+
+    let mkObsoleteAttributeData(msg:string) = 
+        { new CustomAttributeData() with 
+                member __.Constructor =  typeof<ObsoleteAttribute>.GetConstructors().[0]
+                member __.ConstructorArguments = upcast [| CustomAttributeTypedArgument(typeof<string>, msg)  |]
+                member __.NamedArguments = upcast [| |] }
+
+    let mkConditionalAttributeData(msg:string) = 
+        { new CustomAttributeData() with 
+                member __.Constructor =  typeof<System.Diagnostics.ConditionalAttribute>.GetConstructors().[0]
+                member __.ConstructorArguments = upcast [| CustomAttributeTypedArgument(typeof<string>, msg)  |]
+                member __.NamedArguments = upcast [| |] }
+
+
+type public Runtime() =
+    static member Id x = x
+
+type MemoizationTable<'T,'U when 'T : equality>(createType) =
+    let createdDB = new Dictionary<'T,'U>()
+    member x.Contents = (createdDB :> IDictionary<_,_>)
+    member x.Apply typeName =
+        let found,result = createdDB.TryGetValue typeName
+        if found then
+            result 
+        else
+            let ty = createType typeName
+            createdDB.[typeName] <- ty
+            ty 
+
+[<TypeProvider>]
+type public GlobalNamespaceProvider() =
+    static let thisAssembly = typeof<GlobalNamespaceProvider>.Assembly
+    static let modul = thisAssembly.GetModules().[0]
+    let rootNamespace = null
+    [<Literal>]
+    static let typeName = "ProvidedTypeFromGlobalNamespace"
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let typ =
+        TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,null), typeName)
+    let types = [|typ|]
+
+    interface IProvidedNamespace with
+        member this.GetNestedNamespaces() = [||]
+        member this.ResolveTypeName(name) =
+            match name with
+            |   typeName -> typ
+            |   _ -> null
+        member this.NamespaceName = null
+        member this.GetTypes() = types
+
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.GetStaticParameters _ = [||]
+        member this.ApplyStaticArguments(_,_,_) = raise <| System.InvalidOperationException()
+        member this.GetNamespaces() = [| this |]
+        member this.GetInvokerExpression(_,_) = failwith "GetInvokerExpression"
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents"
+
+
+
+[<TypeProvider>]
+type public Provider() =
+    let thisAssembly = typeof<Provider>.Assembly
+    let modul = thisAssembly.GetModules().[0]
+    let rootNamespace = "FSharp.HelloWorld"
+    let nestedNamespaceName1 = "FSharp.HelloWorld.NestedNamespace1"
+    let nestedNamespaceName2 = "FSharp.HelloWorld.Nested.Nested.Nested.Namespace2"
+    // Test provision of an erased class 
+    let mkHelloWorldType namespaceName className baseType =
+        let rec allMembers = 
+            lazy 
+                [| for (propertyName, propertyType) in  [for i in 1 .. 2 -> ("StaticProperty"+string i, (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                       let prop = TypeBuilder.CreateSyntheticProperty(theType,propertyName,propertyType,isStatic=true) 
+                       yield! TypeBuilder.JoinPropertiesIntoMemberInfos [prop]
+                   yield TypeBuilder.CreateMethod(theType ,"OneOptionalParameter",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",typeof<int>,optionalValue=3375);  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TwoOptionalParameters",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",typeof<int>,optionalValue=3375); TypeBuilder.CreateParameter("arg2",typeof<int>,optionalValue=3390) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"UsesByRef",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",typeof<int>.MakeByRefType())|]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"UsesByRefAsOutParameter",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",typeof<int>); TypeBuilder.CreateParameter("arg2",typeof<int>.MakeByRefType(),isOut=true)|]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"op_Addition",theType, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",theType);TypeBuilder.CreateParameter("arg2",theType) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"op_Subtraction",theType, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",theType);TypeBuilder.CreateParameter("arg2",theType) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsNullSeqString",typeof<seq<string>>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsNullString",typeof<string>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsMondayDayOfWeek",typeof<System.DayOfWeek>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsDefaultDayOfWeek",typeof<System.DayOfWeek>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsDefaultDateTime",typeof<System.DateTime>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsUnit",typeof<unit>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple2OfInt",typeof<int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple3OfInt",typeof<int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple4OfInt",typeof<int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple5OfInt",typeof<int * int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple6OfInt",typeof<int * int * int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple7OfInt",typeof<int * int * int * int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple8OfInt",typeof<int * int * int * int * int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsTuple9OfInt",typeof<int * int * int * int * int * int * int * int * int>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem1OfTuple2OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem2OfTuple2OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int>) |]) :> MemberInfo 
+
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem1OfTuple7OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem7OfTuple7OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int>) |]) :> MemberInfo 
+
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem1OfTuple8OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem7OfTuple8OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem8OfTuple8OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem1OfTuple9OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem7OfTuple9OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem8OfTuple9OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"GetItem9OfTuple9OfInt",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int*int*int*int*int*int*int*int*int>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ArrayGetSmokeTest",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int[]>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ArraySetSmokeTest",typeof<unit>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int[]>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"VarSetSmokeTest",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"Array2DGetSmokeTest",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int[,]>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"Array2DSetSmokeTest",typeof<unit>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<int[,]>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TakesParamArray",typeof<int>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg1",typeof<int>); TypeBuilder.CreateParameter("arg2",typeof<obj[]>,getCustomAttributes=(fun () -> [| mkParamArrayAttributeData() |])); |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"IsMarkedConditional1",typeof<unit>, isStatic=true, parameters=[|  |], getCustomAttributes=(fun () -> [| mkConditionalAttributeData("INTERACTIVE") |])) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"IsMarkedObsolete1",typeof<int>, isStatic=true, parameters=[|  |], getCustomAttributes=(fun () -> [| mkObsoleteAttributeData(null) |])) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"IsMarkedObsolete2",typeof<int>, isStatic=true, parameters=[|  |], getCustomAttributes=(fun () -> [| mkObsoleteAttributeData("this is obsolete, ok? don't use it. we warned you.") |])) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsNewArray",typeof<int[]>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ReturnsEmptyNewArray",typeof<int[]>, isStatic=true, parameters=[| |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"IfThenElseUnitUnit",typeof<System.Void>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<bool>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"IfThenElseVoidUnit",typeof<unit>, isStatic=true, parameters=[| TypeBuilder.CreateParameter("arg",typeof<bool>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"SequentialSmokeTest",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"SequentialSmokeTest2",typeof<unit>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"LambdaSmokeTest",typeof<int -> int >, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"LambdaSmokeTest2",typeof<unit -> unit >, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"LambdaSmokeTest3",typeof<int -> int -> int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"CallInstrinsics",typeof<obj list>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewUnionCaseSmokeTest1",typeof<list<int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewUnionCaseSmokeTest2",typeof<list<int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewUnionCaseSmokeTest3",typeof<option<int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewUnionCaseSmokeTest4",typeof<option<int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewUnionCaseSmokeTest5",typeof<Choice<int,string>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewObjectGeneric1",typeof<System.Collections.Generic.Dictionary<int,int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewObjectGeneric2",typeof<System.Collections.Generic.Dictionary<int,int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewObjectGeneric3",typeof<System.Collections.Generic.Dictionary<int,int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewRecordSmokeTest1",typeof<int ref>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewDelegateSmokeTest1",typeof<System.Func<int,int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"NewDelegateSmokeTest2",typeof<System.Func<int,int,int>>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"WhileLoopSmokeTest1",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"ForIntegerRangeLoopSmokeTest1",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"StructProperty1",typeof<float>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"StructProperty2",typeof<float>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"StructProperty3",typeof<float>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"StructMethod1",typeof<float>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"StructMethod2",typeof<float>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"UnionCaseTest1",typeof<bool>, isStatic=true, parameters=[|   TypeBuilder.CreateParameter("arg",typeof<list<int>>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"UnionCaseTest2",typeof<bool>, isStatic=true, parameters=[|   TypeBuilder.CreateParameter("arg",typeof<option<int>>) |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TryFinallySmokeTest",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TryWithSmokeTest",typeof<int>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TryWithSmokeTest2",typeof<bool>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   yield TypeBuilder.CreateMethod(theType ,"TryWithSmokeTest3",typeof<bool>, isStatic=true, parameters=[|  |]) :> MemberInfo 
+                   
+                   yield (theNestedType :> _)
+                   yield TypeBuilder.CreateConstructor(theType,(fun _ -> [| |])) :> MemberInfo |]  
+
+        and allMembersOfNestedType = 
+            lazy 
+                [| for (propertyName, propertyType) in  [for i in 1 .. 2 -> ("StaticProperty"+string i, (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                       let prop = TypeBuilder.CreateSyntheticProperty(theNestedType,propertyName,propertyType,isStatic=true) 
+                       yield! TypeBuilder.JoinPropertiesIntoMemberInfos [prop]
+                   yield TypeBuilder.CreateConstructor(theNestedType,(fun _ -> [| |])) :> MemberInfo |]  
+
+        and theType = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul, namespaceName),className,members=allMembers,baseType=baseType)
+        and theNestedType = TypeBuilder.CreateSimpleType(TypeContainer.Type(theType),"NestedType",members=allMembersOfNestedType)
+
+        theType
+    let helloWorldType = mkHelloWorldType rootNamespace "HelloWorldType" (typeof<obj>)
+    let helloWorldException = mkHelloWorldType rootNamespace "HelloWorldException" (typeof<Exception>)
+    let helloWorldTypeNested1 = mkHelloWorldType nestedNamespaceName1 "HelloWorldType" (typeof<obj>)
+    let helloWorldTypeNested2 = mkHelloWorldType nestedNamespaceName2 "HelloWorldType" (typeof<obj>)
+
+    // Test provision of an erased class that is a subclass of another erased class
+    let mkHelloWorldSubType className baseType =
+        let rec allMembers = 
+            lazy 
+                [| for (propertyName, propertyType) in  [for i in 1 .. 2 -> ("StaticProperty"+string i+"InSubClass", (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                       let prop = TypeBuilder.CreateSyntheticProperty(theType,propertyName,propertyType,isStatic=true) 
+                       yield! TypeBuilder.JoinPropertiesIntoMemberInfos [prop]
+                   yield TypeBuilder.CreateConstructor(theType,(fun _ -> [| |])) :> MemberInfo |]  
+
+        and theType : Type = 
+            let container = TypeContainer.Namespace(modul, rootNamespace)
+            TypeBuilder.CreateSimpleType(container,className,baseType=baseType,members=allMembers)
+
+        theType
+
+    let helloWorldSubType = mkHelloWorldSubType "HelloWorldSubType" helloWorldType
+    let helloWorldSubException = mkHelloWorldSubType "HelloWorldSubException" helloWorldException
+
+    // Test provision of an erased class with static parameters
+    let helloWorldTypeWithStaticParameters =
+        MemoizationTable(fun (fullName,n) ->
+          let rec allMembers = 
+              lazy 
+                  [| for (propertyName, propertyType) in  [for i in -10 .. n -> ("StaticProperty"+(if i >= 0 then string i else "Minus" + string (-i)), (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                         let prop = TypeBuilder.CreateSyntheticProperty(theType,propertyName,propertyType,isStatic=true) 
+                         yield! TypeBuilder.JoinPropertiesIntoMemberInfos [prop]
+                     yield (theNestedType :> _)
+                     yield TypeBuilder.CreateConstructor(theType,(fun _ -> [| |])) :> MemberInfo  |]
+
+          and allMembersOfNestedType = 
+              lazy 
+                  [| for (propertyName, propertyType) in  [for i in 1 .. 2 -> ("StaticProperty"+string i, (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                         let prop = TypeBuilder.CreateSyntheticProperty(theNestedType,propertyName,propertyType,isStatic=true) 
+                         yield! TypeBuilder.JoinPropertiesIntoMemberInfos [prop]
+                     yield TypeBuilder.CreateConstructor(theNestedType,(fun _ -> [| |])) :> MemberInfo |]  
+
+          and theType = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul, rootNamespace),fullName,members=allMembers)
+          and theNestedType = TypeBuilder.CreateSimpleType(TypeContainer.Type(theType),"NestedType",members=allMembersOfNestedType)
+
+
+          theType)
+
+    let helloWorldTypeWithStaticParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticParameter",1)
+    let helloWorldTypeWithStaticCharParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticCharParameter",1)
+    let helloWorldTypeWithStaticBoolParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticBoolParameter",1)
+    let helloWorldTypeWithStaticSByteParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticSByteParameter",1)
+    let helloWorldTypeWithStaticInt16ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt16Parameter",1)
+    let helloWorldTypeWithStaticInt32ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt32Parameter",1)
+    let helloWorldTypeWithStaticOptionalInt32ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticOptionalInt32Parameter",1)
+    let helloWorldTypeWithStaticInt64ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt64Parameter",1)
+    let helloWorldTypeWithStaticByteParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticByteParameter",1)
+    let helloWorldTypeWithStaticUInt16ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt16Parameter",1)
+    let helloWorldTypeWithStaticUInt32ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt32Parameter",1)
+    let helloWorldTypeWithStaticUInt64ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt64Parameter",1)
+    let helloWorldTypeWithStaticDayOfWeekParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticDayOfWeekParameter",1)
+    let helloWorldTypeWithStaticStringParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticStringParameter",1)
+    let helloWorldTypeWithStaticSingleParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticSingleParameter",1)
+    let helloWorldTypeWithStaticDoubleParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticDoubleParameter",1)
+    let helloWorldTypeWithStaticDecimalParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticDecimalParameter",1)
+
+    let mkNestedNamespace (name,typ) = 
+        { new IProvidedNamespace with
+             member this.NamespaceName = name
+             member this.GetTypes() = [| typ |]
+             member this.GetNestedNamespaces() = [| |]
+             member this.ResolveTypeName typeName = if typeName = typ.Name then typ else null }
+
+    let nestedNamespace1 = mkNestedNamespace (nestedNamespaceName1,helloWorldTypeNested1)
+    let nestedNamespace2 = mkNestedNamespace (nestedNamespaceName2,helloWorldTypeNested2)
+
+    let types = 
+        [| helloWorldType; 
+           helloWorldSubType; helloWorldException; helloWorldSubException;
+           helloWorldTypeWithStaticStringParameterUninstantiated
+           helloWorldTypeWithStaticSByteParameterUninstantiated
+           helloWorldTypeWithStaticInt16ParameterUninstantiated
+           helloWorldTypeWithStaticOptionalInt32ParameterUninstantiated
+           helloWorldTypeWithStaticInt32ParameterUninstantiated
+           helloWorldTypeWithStaticInt64ParameterUninstantiated
+           helloWorldTypeWithStaticByteParameterUninstantiated
+           helloWorldTypeWithStaticUInt16ParameterUninstantiated
+           helloWorldTypeWithStaticUInt32ParameterUninstantiated
+           helloWorldTypeWithStaticUInt64ParameterUninstantiated
+           helloWorldTypeWithStaticDayOfWeekParameterUninstantiated
+           helloWorldTypeWithStaticDecimalParameterUninstantiated
+           helloWorldTypeWithStaticSingleParameterUninstantiated
+           helloWorldTypeWithStaticDoubleParameterUninstantiated
+           helloWorldTypeWithStaticBoolParameterUninstantiated
+           helloWorldTypeWithStaticCharParameterUninstantiated |]
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    // This implements both get_StaticProperty1 and get_StaticProperty2
+    static member GetPropertyByName(propertyName:string) : 'T = 
+        match propertyName with 
+        | nm when nm.StartsWith "StaticProperty1" -> "You got a static property" |> box |> unbox
+        | nm when nm.StartsWith "StaticProperty2" -> 42 |> box |> unbox
+        | nm when nm.StartsWith "StaticPropertyMinus" -> 40 - (int (nm.Replace("StaticPropertyMinus",""))) |> box |> unbox
+        | nm when nm.StartsWith "StaticProperty" -> int (nm.Replace("StaticProperty","")) + 40 |> box |> unbox
+        | _ -> failwith "unexpected property"
+
+    // This implements OneOptionalParameter and TwoOptionalParameters
+    static member OneOptionalParameter(arg1:int) : int = arg1 + 1
+    static member TwoOptionalParameters(arg1:int,arg2:int) : int = arg1 + arg2 + 1
+    
+    // This implements UsesByRef
+    static member UsesByRefImpl(arg1:byref<int>) : int = arg1 + 1
+    static member UsesByRefAsOutParameterImpl(arg1:int, arg2:byref<int>) : int = arg2 <- arg1 + 1; 17
+
+    // This implements op_Addition
+    static member Add(arg1:obj, arg2:obj) : obj = arg1
+    // This implements op_Subtraction
+    static member Sub(arg1:obj, arg2:obj) : obj = arg2
+    static member ReturnsVoid() : unit = ()
+    
+    interface IProvidedNamespace with
+        member this.NamespaceName = rootNamespace
+        member this.GetTypes() = types
+        member __.ResolveTypeName typeName : System.Type = 
+            match typeName with
+            | "HelloWorldType" -> helloWorldType
+            | "HelloWorldException" -> helloWorldException
+            | "HelloWorldSubException" -> helloWorldSubException
+            | "HelloWorldSubType" -> helloWorldSubType
+            | "HelloWorldTypeWithStaticStringParameter" -> helloWorldTypeWithStaticStringParameterUninstantiated
+            | "HelloWorldTypeWithStaticSByteParameter" -> helloWorldTypeWithStaticSByteParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt16Parameter" -> helloWorldTypeWithStaticInt16ParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt32Parameter" -> helloWorldTypeWithStaticInt32ParameterUninstantiated
+            | "HelloWorldTypeWithStaticOptionalInt32Parameter" -> helloWorldTypeWithStaticOptionalInt32ParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt64Parameter" -> helloWorldTypeWithStaticInt64ParameterUninstantiated
+            | "HelloWorldTypeWithStaticByteParameter" -> helloWorldTypeWithStaticByteParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt16Parameter" -> helloWorldTypeWithStaticUInt16ParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt32Parameter" -> helloWorldTypeWithStaticUInt32ParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt64Parameter" -> helloWorldTypeWithStaticUInt64ParameterUninstantiated
+            | "HelloWorldTypeWithStaticDayOfWeekParameter" -> helloWorldTypeWithStaticDayOfWeekParameterUninstantiated
+            | "HelloWorldTypeWithStaticDecimalParameter" -> helloWorldTypeWithStaticDecimalParameterUninstantiated
+            | "HelloWorldTypeWithStaticSingleParameter" -> helloWorldTypeWithStaticSingleParameterUninstantiated
+            | "HelloWorldTypeWithStaticDoubleParameter" -> helloWorldTypeWithStaticDoubleParameterUninstantiated
+            | "HelloWorldTypeWithStaticBoolParameter" -> helloWorldTypeWithStaticBoolParameterUninstantiated
+            | "HelloWorldTypeWithStaticCharParameter" -> helloWorldTypeWithStaticCharParameterUninstantiated
+            | _ -> null
+       
+        member this.GetNestedNamespaces() = [| nestedNamespace1; nestedNamespace2 |]
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.GetNamespaces() = [| this |]
+
+        member this.GetStaticParameters(typeWithoutArguments) = 
+         [| match typeWithoutArguments.Name with
+            |   "HelloWorldTypeWithStaticSByteParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<sbyte>, 0) 
+            |   "HelloWorldTypeWithStaticInt16Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<int16>, 0) 
+            |   "HelloWorldTypeWithStaticInt32Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<int32>, 0) 
+            |   "HelloWorldTypeWithStaticOptionalInt32Parameter" -> 
+                   yield TypeBuilder.CreateStaticParameter("Count",typeof<int32>, 0, defaultValue=42) 
+#if ADD_AN_OPTIONAL_STATIC_PARAMETER
+                   yield TypeBuilder.CreateStaticParameter("ExtraParameter",typeof<int32>, 1, defaultValue=43)             
+#endif
+            |   "HelloWorldTypeWithStaticInt64Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<int64>, 0) 
+            |   "HelloWorldTypeWithStaticByteParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<byte>, 0) 
+            |   "HelloWorldTypeWithStaticUInt16Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<uint16>, 0) 
+            |   "HelloWorldTypeWithStaticUInt32Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<uint32>, 0) 
+            |   "HelloWorldTypeWithStaticUInt64Parameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<uint64>, 0) 
+            |   "HelloWorldTypeWithStaticDayOfWeekParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<System.DayOfWeek>, 0) 
+            |   "HelloWorldTypeWithStaticStringParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<string>, 0) 
+            |   "HelloWorldTypeWithStaticDecimalParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<decimal>, 0) 
+            |   "HelloWorldTypeWithStaticSingleParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<single>, 0) 
+            |   "HelloWorldTypeWithStaticDoubleParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<double>, 0) 
+            |   "HelloWorldTypeWithStaticBoolParameter" -> yield TypeBuilder.CreateStaticParameter("Flag",typeof<bool>, 0) 
+            |   "HelloWorldTypeWithStaticCharParameter" -> yield TypeBuilder.CreateStaticParameter("Count",typeof<char>, 0) 
+            |   _ -> ()
+         |]
+        member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) =
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            match typeWithoutArguments.Name with
+            | "HelloWorldType" -> 
+                if staticArguments.Length <> 0 then failwith "this provided type does not accept static parameters" 
+                helloWorldType
+            | "HelloWorldTypeWithStaticSByteParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> sbyte |> int)
+            | "HelloWorldTypeWithStaticInt16Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int16 |> int)
+            | "HelloWorldTypeWithStaticInt32Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int)
+            | "HelloWorldTypeWithStaticInt64Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int64 |> int)
+            | "HelloWorldTypeWithStaticByteParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> byte |> int)
+            | "HelloWorldTypeWithStaticUInt16Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint16 |> int)
+            | "HelloWorldTypeWithStaticUInt32Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint32 |> int)
+            | "HelloWorldTypeWithStaticUInt64Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint64 |> int)
+            | "HelloWorldTypeWithStaticDayOfWeekParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> System.DayOfWeek |> int)
+            | "HelloWorldTypeWithStaticBoolParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, if (staticArguments.[0] :?> bool) then 1 else 0)
+            | "HelloWorldTypeWithStaticStringParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> string |> String.length)
+            | "HelloWorldTypeWithStaticDecimalParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> decimal |> int)
+            | "HelloWorldTypeWithStaticCharParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> char |> int)
+            | "HelloWorldTypeWithStaticSingleParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> single |> int)
+            | "HelloWorldTypeWithStaticDoubleParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> double |> int)
+
+            | "HelloWorldTypeWithStaticOptionalInt32Parameter" -> 
+#if ADD_AN_OPTIONAL_STATIC_PARAMETER
+                if staticArguments.Length <> 2 then failwith "this provided type accepts two static parameters" 
+#else
+                if staticArguments.Length <> 1 then failwith "this provided type accepts zero, one static parameter" 
+#endif
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int)
+
+            | nm -> failwith (sprintf "ApplyStaticArguments %s" nm)
+
+        member __.GetInvokerExpression(syntheticMethodBase:MethodBase, parameterExpressions:Quotations.Expr[]) = 
+            let expr = 
+                if syntheticMethodBase.IsConstructor then 
+                     Quotations.Expr.NewObject(typeof<obj>.GetConstructor [| |], [])
+                elif syntheticMethodBase.Name = "ReturnsNullSeqString" then 
+                     Quotations.Expr.Value(null,typeof<seq<string>>)
+                elif syntheticMethodBase.Name = "ReturnsNullString" then 
+                     Quotations.Expr.Value(null,typeof<string>)
+                elif syntheticMethodBase.Name = "ReturnsMondayDayOfWeek" then 
+                     Quotations.Expr.Value(System.DayOfWeek.Monday,typeof<System.DayOfWeek>)
+                elif syntheticMethodBase.Name = "ReturnsDefaultDayOfWeek" then 
+                     Quotations.Expr.DefaultValue(typeof<System.DayOfWeek>)
+                elif syntheticMethodBase.Name = "ReturnsDefaultDateTime" then 
+                     Quotations.Expr.DefaultValue(typeof<System.DateTime>)
+                elif syntheticMethodBase.Name = "ReturnsUnit" then 
+                     Quotations.Expr.Value(null, typeof<unit>)
+                elif syntheticMethodBase.Name = "GetItem1OfTuple2OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],0)
+                elif syntheticMethodBase.Name = "GetItem2OfTuple2OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],1)
+                elif syntheticMethodBase.Name = "GetItem1OfTuple7OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],0)
+                elif syntheticMethodBase.Name = "GetItem7OfTuple7OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],6)
+
+                elif syntheticMethodBase.Name = "GetItem1OfTuple8OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],0)
+                elif syntheticMethodBase.Name = "GetItem7OfTuple8OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],6)
+                elif syntheticMethodBase.Name = "GetItem8OfTuple8OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],7)
+
+                elif syntheticMethodBase.Name = "GetItem1OfTuple9OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],0)
+                elif syntheticMethodBase.Name = "GetItem7OfTuple9OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],6)
+                elif syntheticMethodBase.Name = "GetItem8OfTuple9OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],7)
+                elif syntheticMethodBase.Name = "GetItem9OfTuple9OfInt" then 
+                     Quotations.Expr.TupleGet(parameterExpressions.[0],8)
+
+                elif syntheticMethodBase.Name = "ReturnsNewArray" then 
+                     Quotations.Expr.NewArray (typeof<int>, [ Quotations.Expr.Value(3,typeof<int>); Quotations.Expr.Value(6,typeof<int>) ])
+                elif syntheticMethodBase.Name = "ReturnsEmptyNewArray" then 
+                     Quotations.Expr.NewArray (typeof<int>, [  ])
+                elif syntheticMethodBase.Name = "IfThenElseUnitUnit" then 
+                     <@@ if (%%(parameterExpressions.[0]) : bool) then Provider.ReturnsVoid() else failwith "" @@>
+                elif syntheticMethodBase.Name = "IfThenElseVoidUnit" then 
+                     <@@ if (%%(parameterExpressions.[0]) : bool) then System.Console.WriteLine "hello" else failwith "" @@>
+                elif syntheticMethodBase.Name = "SequentialSmokeTest" then 
+                     <@@ System.Console.WriteLine "hello"; 1 @@>
+                elif syntheticMethodBase.Name = "SequentialSmokeTest2" then 
+                     <@@ System.Console.WriteLine "hello"; System.Console.WriteLine "world"; @@>
+                elif syntheticMethodBase.Name = "LambdaSmokeTest" then 
+                     <@@ (fun x -> x + 1) @@>
+                elif syntheticMethodBase.Name = "ArrayGetSmokeTest" then 
+                     <@@ (%%(parameterExpressions.[0]) : int[]).[0] @@>
+                elif syntheticMethodBase.Name = "ArraySetSmokeTest" then 
+                     <@@ (%%(parameterExpressions.[0]) : int[]).[0] <- 3 @@>
+                elif syntheticMethodBase.Name = "VarSetSmokeTest" then 
+                     <@@ let mutable x = 3 in x <- x + 1; x @@>
+                elif syntheticMethodBase.Name = "Array2DGetSmokeTest" then 
+                     <@@ (%%(parameterExpressions.[0]) : int[,]).[0,0] @@>
+                elif syntheticMethodBase.Name = "TakesParamArray" then 
+                     <@@ (%%(parameterExpressions.[1]) : obj[]).Length @@>
+                elif syntheticMethodBase.Name = "IsMarkedConditional1" then 
+                     <@@ () @@>
+                elif syntheticMethodBase.Name = "IsMarkedObsolete1" then 
+                     <@@ 1 @@>
+                elif syntheticMethodBase.Name = "IsMarkedObsolete2" then 
+                     <@@ 2 @@>
+                elif syntheticMethodBase.Name = "Array2DSetSmokeTest" then 
+                     <@@ (%%(parameterExpressions.[0]) : int[,]).[0,0] <- 3 @@>
+                elif syntheticMethodBase.Name = "LambdaSmokeTest2" then 
+                     <@@ (fun () -> System.Console.WriteLine "hello") @@>
+                elif syntheticMethodBase.Name = "LambdaSmokeTest3" then 
+                     <@@ (fun x y -> x + y) @@>
+                elif syntheticMethodBase.Name = "CallInstrinsics" then 
+                     <@@ [ ((true & false) |> box);
+                           ((true && false) |> box);
+                           ((true || false) |> box);
+                           ((true or false) |> box);
+                           ((compare true false) |> box);
+                           ((true = false) |> box);
+                           ((3 +? System.Nullable 4) |> box);  // should be inlined by the compiler
+                           ((System.Nullable 3 ?+ 4) |> box); // should be inlined by the compiler
+                           ((3 *? System.Nullable 4) |> box); // should be inlined by the compiler
+                           ((System.Nullable 3 ?* 4) |> box); // should be inlined by the compiler
+                           ((true =? System.Nullable false) |> box);
+                           ((System.Nullable true ?= false) |> box);
+                           ((System.Nullable true ?=? System.Nullable false) |> box);
+                           ((true <> false) |> box);
+                           ((1 < 2) |> box);
+                           ((1 <= 2) |> box);
+                           (1 > 2) |> box;
+                           (1 >= 2) |> box;
+                           LanguagePrimitives.GenericComparisonWithComparer LanguagePrimitives.GenericComparer 3 4 |> box;
+                           LanguagePrimitives.HashCompare.FastHashTuple2 LanguagePrimitives.GenericEqualityComparer (1,2) |> box;
+                           LanguagePrimitives.HashCompare.FastHashTuple3 LanguagePrimitives.GenericEqualityComparer (1,2,3) |> box;
+                           LanguagePrimitives.HashCompare.FastHashTuple4 LanguagePrimitives.GenericEqualityComparer (1,2,3,4) |> box;
+                           LanguagePrimitives.HashCompare.FastHashTuple5 LanguagePrimitives.GenericEqualityComparer (1,2,3,4,5) |> box;
+
+                           LanguagePrimitives.HashCompare.FastEqualsTuple2 LanguagePrimitives.GenericEqualityComparer (1,2)  (1,2) |> box;
+                           LanguagePrimitives.HashCompare.FastEqualsTuple3 LanguagePrimitives.GenericEqualityComparer (1,2,3)  (1,2,3) |> box;
+                           LanguagePrimitives.HashCompare.FastEqualsTuple4 LanguagePrimitives.GenericEqualityComparer (1,2,3,4)  (1,2,3,4) |> box;
+                           LanguagePrimitives.HashCompare.FastEqualsTuple5 LanguagePrimitives.GenericEqualityComparer (1,2,3,4,5)  (1,2,3,4,5) |> box;
+
+                           LanguagePrimitives.HashCompare.FastCompareTuple2 LanguagePrimitives.GenericComparer (1,2)  (1,2) |> box;
+                           LanguagePrimitives.HashCompare.FastCompareTuple3 LanguagePrimitives.GenericComparer (1,2,3)  (1,2,3) |> box;
+                           LanguagePrimitives.HashCompare.FastCompareTuple4 LanguagePrimitives.GenericComparer (1,2,3,4)  (1,2,3,4) |> box;
+                           LanguagePrimitives.HashCompare.FastCompareTuple5 LanguagePrimitives.GenericComparer (1,2,3,4,5)  (1,2,3,4,5) |> box;
+                           (3 ||| 4 |> box);
+                           (3 &&& 4 |> box);
+                           (3 ^^^ 4 |> box); 
+                           (~~~3 |> box); 
+                           ((3 <<< 1) |> box); 
+                           ((3 >>> 1) |> box); 
+                           ((3 + 1) |> box); 
+                           ((3 - 1) |> box); 
+                           ((3 * 1) |> box); 
+                           ((+(3)) |> box); 
+                           (List.map id [1;2;3] |> box); 
+                           (List.sum [1;2;3] |> box);  // should be inlined by the compiler
+                           (List.sumBy id [1;2;3] |> box);  // should be inlined by the compiler
+                           (List.average [1.0;2.0;3.0] |> box);  // should be inlined by the compiler
+                           (List.averageBy id [1.0;2.0;3.0] |> box);  // should be inlined by the compiler
+                           (Array.map id [|1;2;3|] |> box); 
+                           (Array.sum [|1;2;3|] |> box);      // should be inlined by the compiler
+                           (Array.sumBy id [|1;2;3|] |> box);   // should be inlined by the compiler
+                           (Array.average [|1.0;2.0;3.0|] |> box);  // should be inlined by the compiler
+                           (Array.averageBy id [|1.0;2.0;3.0|] |> box);  // should be inlined by the compiler
+                           (Seq.map id [1;2;3] |> box); 
+                           (Seq.sum [1;2;3] |> box); // should be inlined by the compiler
+                           (Seq.sumBy id [1;2;3] |> box); // should be inlined by the compiler
+                           (Seq.average [1.0;2.0;3.0] |> box); // should be inlined by the compiler
+                           (Seq.averageBy id [1.0;2.0;3.0] |> box); // should be inlined by the compiler
+                           ((-(3)) |> box); 
+                           ((3.0 + 1.0) |> box); 
+                           ((3.0 - 1.0) |> box); 
+                           ((3.0 * 1.0) |> box); 
+                           ((+(3.0)) |> box); 
+                           ((-(3.0)) |> box); 
+                           ((3.0f + 1.0f) |> box); 
+                           ((3.0f - 1.0f) |> box); 
+                           ((3.0f * 1.0f) |> box); 
+                           ((+(3.0f)) |> box); 
+                           ((-(3.0f)) |> box); 
+                           (Operators.Checked.(+) 3 4  |> box); 
+                           Operators.Checked.(-) 3 4  |> box; 
+                           Operators.Checked.(*) 3 4  |> box; 
+                           (Operators.Checked.(~-) 3  |> box); 
+                           (not true  |> box); 
+                           (typeof<int> |> box); 
+                           (sizeof<int> |> box); 
+                           (Unchecked.defaultof<int> |> box); 
+                           (typedefof<int> |> box); 
+                           (enum<System.DayOfWeek>(3)  |> box); 
+                           ((..) 3 4   |> box); 
+                           (OperatorIntrinsics.RangeInt32 3 4   |> box); 
+                           (LanguagePrimitives.IntrinsicFunctions.GetArray [|1;2|] 0   |> box); 
+                           (LanguagePrimitives.IntrinsicFunctions.GetArray2D (array2D [[1;2]]) 0 0   |> box); 
+                           (LanguagePrimitives.IntrinsicFunctions.GetArray3D (Array3D.init 1 1 1 (fun _ _ _ -> 0) ) 0 0 0  |> box); 
+                           (LanguagePrimitives.IntrinsicFunctions.GetArray4D (Array4D.init 1 1 1 1 (fun _ _ _ _ -> 0) )  0 0 0 0 |> box); 
+                           (Seq.collect (fun x -> [x]) [1;2]   |> box); 
+                           (Seq.delay (fun _ -> Seq.empty) |> box); 
+                           (Seq.append [1] [2] |> box); 
+                           (seq { for i in 0 .. 10 -> (i,i*i) } |> box); 
+                           ([| for i in 0 .. 10 -> (i,i*i) |] |> box); 
+                           ([ for i in 0 .. 10 -> (i,i*i) ] |> box); 
+                           (sprintf "%d" 1 |> box); 
+                           ((lazy (3 + 4)) |> box);
+                           (1.0M |> box);
+                           // These are not supported as provided expressions
+                           //(<@ 1+2 @> |> box);
+                           //(<@@ 1+2 @@> |> box);
+                           ]
+                         @@>
+
+                elif syntheticMethodBase.Name = "NewUnionCaseSmokeTest1" then 
+                     <@@ [] : list<int> @@>
+                elif syntheticMethodBase.Name = "NewUnionCaseSmokeTest2" then 
+                     <@@ [1] : list<int> @@>
+                elif syntheticMethodBase.Name = "NewUnionCaseSmokeTest3" then 
+                     <@@ None : option<int> @@>
+                elif syntheticMethodBase.Name = "NewUnionCaseSmokeTest4" then 
+                     <@@ Some 3 : option<int> @@>
+                elif syntheticMethodBase.Name = "NewUnionCaseSmokeTest5" then 
+                     <@@ Choice1Of2 3 : Choice<int,string> @@>
+                elif syntheticMethodBase.Name = "NewRecordSmokeTest1" then 
+                     <@@ { contents = 3 } @@>
+                elif syntheticMethodBase.Name = "WhileLoopSmokeTest1" then 
+                     <@@ let x = ref 0 in while !x < 2 do System.Console.WriteLine "hello"; incr x done; !x @@>
+                elif syntheticMethodBase.Name = "ForIntegerRangeLoopSmokeTest1" then 
+                     <@@ let x = ref 0 in for i = 0 to 10 do incr x done; !x @@>
+                elif syntheticMethodBase.Name = "NewDelegateSmokeTest1" then 
+                     <@@ new System.Func<int,int>(fun x -> x + 1) @@>
+                elif syntheticMethodBase.Name = "NewDelegateSmokeTest2" then 
+                     <@@ new System.Func<int,int,int>(fun x y -> x + y) @@>
+                elif syntheticMethodBase.Name = "StructProperty1" then 
+                     <@@ let s = System.TimeSpan(1,0,0,0) in s.TotalSeconds @@>
+                elif syntheticMethodBase.Name = "StructProperty2" then 
+                     <@@ let mutable s = System.TimeSpan(1,0,0,0) in s.TotalSeconds @@>
+                elif syntheticMethodBase.Name = "StructProperty3" then 
+                     <@@ System.TimeSpan(1,0,0,0).TotalSeconds @@>
+                elif syntheticMethodBase.Name = "StructMethod1" then 
+                     <@@ System.TimeSpan(1,0,0,0).Add(System.TimeSpan(1,0,0,0)).TotalSeconds @@>
+                elif syntheticMethodBase.Name = "StructMethod2" then 
+                     <@@ let s = System.TimeSpan(1,0,0,0) in let s2 = s.Add(System.TimeSpan(1,0,0,0)) in s2.TotalSeconds @@>
+                elif syntheticMethodBase.Name = "NewObjectGeneric1" then 
+                     <@@ new System.Collections.Generic.Dictionary<int,int>() @@>
+                elif syntheticMethodBase.Name = "NewObjectGeneric2" then 
+                     <@@ new System.Collections.Generic.Dictionary<int,int>(null: IEqualityComparer<int>) @@>
+                elif syntheticMethodBase.Name = "NewObjectGeneric3" then 
+                     <@@ new System.Collections.Generic.Dictionary<int,int>(HashIdentity.Structural<int>) @@>
+                elif syntheticMethodBase.Name = "UnionCaseTest1" then 
+                     <@@ match (%%(parameterExpressions.[0]) : list<int>) with _ :: _ -> true | [] -> false @@>
+                elif syntheticMethodBase.Name = "UnionCaseTest2" then 
+                     <@@ match (%%(parameterExpressions.[0]) : option<int>) with Some x -> true | None -> false @@>
+
+                // Note, in F# 3.0 the compiled form of pattern matching over union cases can't be included
+                // in a provided expression. These should go into a runtime library.
+                // 
+                // You get: test.fsx(231,10): error FS1109: A reference to the type 'Microsoft.FSharp.Core.FSharpChoice`2.Choice2Of2' in assembly 'FSharp.Core' was found, but the type could not be found in that assembly
+                //
+                // elif syntheticMethodBase.Name = "UnionCaseTest3" then 
+                //     <@@ match (%%(parameterExpressions.[0]) : Choice<int,string>) with Choice1Of2 x -> true | Choice2Of2 x -> false @@>
+
+                elif syntheticMethodBase.Name = "TryFinallySmokeTest" then 
+                     <@@ try 3 finally System.Console.WriteLine "hello" @@>
+                elif syntheticMethodBase.Name = "TryWithSmokeTest" then 
+                     <@@ try failwith "fail" with _ -> 3 @@>
+                elif syntheticMethodBase.Name = "TryWithSmokeTest2" then 
+                     <@@ try invalidArg "fail" "fail2" with :? System.ArgumentException as e -> e.Message.StartsWith "fail2" @@>
+                elif syntheticMethodBase.Name = "TryWithSmokeTest3" then 
+                     <@@ try invalidArg "fail" "fail2" with :? System.ArithmeticException | :? System.ArgumentException as e   -> e.Message.StartsWith "fail2" @@>
+                elif syntheticMethodBase.Name = "ReturnsTuple2OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>) ]
+                elif syntheticMethodBase.Name = "ReturnsTuple3OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple4OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple5OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); 
+                                                Quotations.Expr.Value(15,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple6OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); 
+                                                Quotations.Expr.Value(15,typeof<int>); 
+                                                Quotations.Expr.Value(18,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple7OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); 
+                                                Quotations.Expr.Value(15,typeof<int>); 
+                                                Quotations.Expr.Value(18,typeof<int>); 
+                                                Quotations.Expr.Value(21,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple8OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); 
+                                                Quotations.Expr.Value(15,typeof<int>); 
+                                                Quotations.Expr.Value(18,typeof<int>); 
+                                                Quotations.Expr.Value(21,typeof<int>); 
+                                                Quotations.Expr.Value(24,typeof<int>); ]
+                elif syntheticMethodBase.Name = "ReturnsTuple9OfInt" then 
+                     Quotations.Expr.NewTuple [ Quotations.Expr.Value(3,typeof<int>); 
+                                                Quotations.Expr.Value(6,typeof<int>); 
+                                                Quotations.Expr.Value(9,typeof<int>); 
+                                                Quotations.Expr.Value(12,typeof<int>); 
+                                                Quotations.Expr.Value(15,typeof<int>); 
+                                                Quotations.Expr.Value(18,typeof<int>); 
+                                                Quotations.Expr.Value(21,typeof<int>); 
+                                                Quotations.Expr.Value(24,typeof<int>); 
+                                                Quotations.Expr.Value(27,typeof<int>); ]
+                elif syntheticMethodBase.Name = "OneOptionalParameter" then 
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("OneOptionalParameter", BindingFlags.Static ||| BindingFlags.Public), [ for p in parameterExpressions -> p ])
+                elif syntheticMethodBase.Name = "TwoOptionalParameters" then 
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("TwoOptionalParameters", BindingFlags.Static ||| BindingFlags.Public), [ for p in parameterExpressions -> p ])
+                elif syntheticMethodBase.Name = "UsesByRef" then 
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("UsesByRefImpl", BindingFlags.Static ||| BindingFlags.Public), [ for p in parameterExpressions -> p ])
+                elif syntheticMethodBase.Name = "UsesByRefAsOutParameter" then 
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("UsesByRefAsOutParameterImpl", BindingFlags.Static ||| BindingFlags.Public), [ for p in parameterExpressions -> p ])
+                elif syntheticMethodBase.Name = "op_Addition" then 
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("Add", BindingFlags.Static ||| BindingFlags.Public), [ for p in parameterExpressions -> p ])
+                elif syntheticMethodBase.Name = "op_Subtraction" then 
+                     // This deliberately swaps argument order so it is not a "simple" expression
+                     Quotations.Expr.Call (typeof<Provider>.GetMethod("Sub", BindingFlags.Static ||| BindingFlags.Public), List.rev [ for p in parameterExpressions -> p ])
+                else
+                    // trim off the "get_"
+                    if not (syntheticMethodBase.Name.StartsWith "get_") then failwith "expected syntheticMethodBase to be a property getter, with name starting with \"get_\""
+                    let propertyName = syntheticMethodBase.Name.Substring(4)
+                    let syntheticMethodBase = syntheticMethodBase :?> MethodInfo
+                    let getClassInstancesByName = 
+                        typeof<Provider>
+                            .GetMethod("GetPropertyByName", BindingFlags.Static ||| BindingFlags.Public)
+                            .MakeGenericMethod([|syntheticMethodBase.ReturnType|])
+                    Quotations.Expr.Call(getClassInstancesByName, [ Quotations.Expr.Value(propertyName) ])
+            
+            let rec trans q = 
+                match q with 
+                // Eliminate F# property gets to method calls
+                | Quotations.Patterns.PropertyGet(obj,propInfo,args) -> 
+                    match obj with 
+                    | None -> trans (Quotations.Expr.Call(propInfo.GetGetMethod(),args))
+                    | Some o -> 
+                       // In F# quotations involving pattern matching over union cases, the 
+                       // static type of 'o' is not the target type when we fetch the items from the union type.
+                       // For example, see the quotation form of this:
+                       //  <@@ match (Choice1Of2 3) with Choice1Of2 x -> true | x -> false @@>
+                       //
+                       // Normally this doesn't matter, e.g. for an evaluatior. However, for provided expressions we can't cope 
+                       // with this case as the F# compiler is not aware of the case-types for the union type.
+                       //
+                       // let o = 
+                       //     if propInfo.DeclaringType.IsAssignableFrom o.Type then 
+                       //         o
+                       //     else 
+                       //         Quotations.Expr.Coerce(o,propInfo.DeclaringType)
+
+                       trans (Quotations.Expr.Call(trans o,propInfo.GetGetMethod(),args))
+                // Eliminate F# property sets to method calls
+                | Quotations.Patterns.PropertySet(obj,propInfo,args,v) -> 
+                     match obj with 
+                     | None -> trans (Quotations.Expr.Call(propInfo.GetSetMethod(),args@[v]))
+                     | Some o -> trans (Quotations.Expr.Call(trans o,propInfo.GetSetMethod(),args@[v]))
+                // Eliminate F# function applications to FSharpFunc<_,_>.Invoke calls
+                | Quotations.Patterns.Application(f,e) -> 
+                    Quotations.Expr.Call(trans f, f.Type.GetMethod "Invoke", [ trans e ]) 
+
+                | Quotations.Patterns.NewUnionCase(ci, es) ->
+                    trans (Quotations.Expr.Call(Reflection.FSharpValue.PreComputeUnionConstructorInfo ci, es) )
+                | Quotations.Patterns.NewRecord(ci, es) ->
+                    trans (Quotations.Expr.NewObject(Reflection.FSharpValue.PreComputeRecordConstructorInfo ci, es) )
+                | Quotations.Patterns.UnionCaseTest(e,uc) ->
+                    let tagInfo = Reflection.FSharpValue.PreComputeUnionTagMemberInfo uc.DeclaringType
+                    let tagExpr = 
+                        match tagInfo with 
+                        | :? PropertyInfo as tagProp ->
+                             Quotations.Expr.PropertyGet(e,tagProp) 
+                        | :? MethodInfo as tagMeth -> 
+                             if tagMeth.IsStatic then Quotations.Expr.Call(tagMeth, [e])
+                             else Quotations.Expr.Call(e,tagMeth,[])
+                        | _ -> failwith "unreachable: unexpected result from PreComputeUnionTagMemberInfo"
+                    let tagNumber = uc.Tag
+                    // Translate to a call the the F# library equality routine
+                    trans <@@ (%%(tagExpr) : int) = tagNumber @@>
+
+                // Handle the generic cases
+                | Quotations.ExprShape.ShapeLambda(v,body) -> 
+                    Quotations.Expr.Lambda(v, trans body)
+                | Quotations.ExprShape.ShapeCombination(comb,args) -> 
+                    Quotations.ExprShape.RebuildShapeCombination(comb,List.map trans args)
+                | Quotations.ExprShape.ShapeVar _ -> q
+            trans expr
+
+        // This event is never triggered in this sample, because the schema never changes
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+       
+
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents"
+
+[<TypeProvider>]
+type public GenerativeProvider(config: TypeProviderConfig) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.HelloWorldGenerative"
+    let theAssembly = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll"))
+
+    let exclude = set [ "TheGeneratedType1"; 
+                        "TheGeneratedType1WithIndexer" 
+                        "TheGeneratedType2"; 
+                        "TheGeneratedType2WithIndexer"; 
+                        "TheGeneratedType3InContainerType1"; 
+                        "TheGeneratedType3InContainerType2"; 
+                        "TheGeneratedType5"; 
+                        "TheGeneratedType5WithIndexer" ]
+
+
+    let typeTable = 
+        MemoizationTable(fun (actualName,typeName) -> 
+             let theType = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType(typeName)
+             theType)
+
+    let theContainerTypeUninstantiated = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), "TheContainerType", members=lazy [| |], isErased=false)
+
+    let theTypes() = [| for x in theAssembly.GetTypes() do if not (exclude.Contains x.Name) && not x.IsNested then yield  x :> MemberInfo |]
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    interface IProvidedNamespace with
+       member this.NamespaceName = rootNamespace
+       member this.GetTypes() = [|theContainerTypeUninstantiated|]
+       member this.GetNestedNamespaces() = [| |]
+       member this.ResolveTypeName typeName =
+         match typeName with
+         |   "TheContainerType" -> theContainerTypeUninstantiated
+         |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| this |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> [| TypeBuilder.CreateStaticParameter("TypeName",typeof<string>, 0) |]
+            | _ -> [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> typeTable.Apply (typeNameWithArguments, (staticArguments.[0] :?> string))
+            | _ -> null
+
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       
+       member this.GetGeneratedAssemblyContents(assembly) = System.IO.File.ReadAllBytes "provided.dll"
+
+
+[<TypeProvider>]
+type public TwoNamespaceGenerativeProvider(config: TypeProviderConfig) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace1 = "FSharp.HelloWorldGenerativeNamespace1"
+    let rootNamespace2 = "FSharp.HelloWorldGenerativeNamespace2"
+
+    let theType1 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType1")
+    let theContainerType1 = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace1), "TheContainerType", members=lazy [| |], isErased=false)
+    let theType2 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType1WithIndexer")
+    let theContainerType2 = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace2), "TheContainerType", members=lazy [| |], isErased=false)
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let n1 = mkNamespace (rootNamespace1, theContainerType1)
+    let n2 = mkNamespace (rootNamespace2, theContainerType2)
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| n1; n2 |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            if typeWithoutArguments.FullName = theContainerType1.FullName then [| TypeBuilder.CreateStaticParameter("Unused",typeof<string>, 0) |]
+            elif typeWithoutArguments.FullName = theContainerType2.FullName then [| TypeBuilder.CreateStaticParameter("Unused",typeof<string>, 0) |]
+            else [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            if typeWithoutArguments.FullName = theContainerType1.FullName then theType1
+            elif typeWithoutArguments.FullName = theContainerType2.FullName then theType2
+            else typeWithoutArguments
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       
+       member this.GetGeneratedAssemblyContents(assembly) = System.IO.File.ReadAllBytes "provided.dll"
+
+
+[<TypeProvider>]
+type public TwoInternalNamespaceGenerativeProvider(config: TypeProviderConfig) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace1 = "FSharp.HelloWorldGenerativeInternalNamespace1"
+    let rootNamespace2 = "FSharp.HelloWorldGenerativeInternalNamespace2"
+    let theType1 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType5")
+    let theContainerType1 = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace1), "TheContainerType", members=lazy [| |], isErased=false)
+    let theType2 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType5WithIndexer")
+    let theContainerType2 = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace2), "TheContainerType", members=lazy [| |], isErased=false)
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let n1 = mkNamespace (rootNamespace1, theContainerType1)
+    let n2 = mkNamespace (rootNamespace2, theContainerType2)
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| n1; n2 |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            if typeWithoutArguments.Equals(theContainerType1) then [| TypeBuilder.CreateStaticParameter("Unused",typeof<string>, 0) |]
+            elif typeWithoutArguments.Equals(theContainerType2) then [| TypeBuilder.CreateStaticParameter("Unused",typeof<string>, 0) |]
+            else [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            if typeWithoutArguments.FullName = theContainerType1.FullName then theType1
+            elif typeWithoutArguments.FullName = theContainerType2.FullName then theType2
+            else typeWithoutArguments
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       member this.GetGeneratedAssemblyContents(assembly) = System.IO.File.ReadAllBytes "provided.dll"
+       
+
+
+[<TypeProvider>]
+// Two namespaces in the same provider contribute to the same namespace
+type public OneProviderContributesTwoFragmentsToSameNamespace(config: TypeProviderConfig) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.OneProviderContributesTwoFragmentsToSameNamespace"
+    let theType1 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType2")
+    let theContainerType1Uninstantiated = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), "TheContainerType1", members=lazy [| |], isErased=false)
+    let theType2 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType2WithIndexer")
+    let theContainerType2Uninstantiated = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), "TheContainerType2", members=lazy [| |], isErased=false)
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let n1 = mkNamespace (rootNamespace, theContainerType1Uninstantiated)
+    let n2 = mkNamespace (rootNamespace, theContainerType2Uninstantiated)
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| n1; n2 |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   n when n = "TheContainerType1" || n = "TheContainerType2" -> [| TypeBuilder.CreateStaticParameter("Unused",typeof<string>, 0) |]
+            | _ -> [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            match typeWithoutArguments.Name with
+            |   n when n = "TheContainerType1" -> theType1
+            |   n when n = "TheContainerType2" -> theType2
+            | _ -> typeWithoutArguments
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       
+       member this.GetGeneratedAssemblyContents(assembly) = System.IO.File.ReadAllBytes "provided.dll"
+
+
+// Two providers contribute to same namespace
+type public TwoProvidersContributeToSameNamespaceBase(config: TypeProviderConfig, typeName) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.TwoProvidersContributeToSameNamespace"
+    let theType1 = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType3In" + typeName)
+
+    let invalidation = new Event<System.EventHandler,_>()
+    let theContainerTypeUninstantiated = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), typeName, members=lazy [| |], isErased=false)
+    let n1 = mkNamespace (rootNamespace, theContainerTypeUninstantiated)
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| n1 |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   n when n = typeName -> [| TypeBuilder.CreateStaticParameter("Tag",typeof<string>, 0) |]
+            | _ -> [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            match typeWithoutArguments.Name with
+            |   n when n = typeName-> theType1
+            | _ -> typeWithoutArguments
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       member this.GetGeneratedAssemblyContents(assembly) = System.IO.File.ReadAllBytes "provided.dll"
+       
+// Two providers contribute to same namespace
+[<TypeProvider>]
+type public TwoProvidersContributeToSameNamespaceA(config: TypeProviderConfig) =
+    inherit TwoProvidersContributeToSameNamespaceBase(config,"ContainerType1")
+
+
+[<TypeProvider>]
+type public TwoProvidersContributeToSameNamespaceB(config: TypeProviderConfig) =
+    inherit TwoProvidersContributeToSameNamespaceBase(config,"ContainerType2")
+
+
+
+[<TypeProvider>]
+type public GenerativeProviderWithStaticParameter(config: TypeProviderConfig) =
+    let modul = typeof<Provider>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.HelloWorldGenerativeWithStaticParameter"
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let typeTable = 
+        MemoizationTable(fun (actualName,c) -> 
+             let theType = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided"+c+".dll")).GetType("TheGeneratedType"+c)
+             theType)
+    let theContainerTypeUninstantiated = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), "TheContainerType", members=lazy [| |], isErased=false)
+    interface IProvidedNamespace with
+       member this.NamespaceName = rootNamespace
+       member this.GetTypes() = [|theContainerTypeUninstantiated|]
+       member this.GetNestedNamespaces() = [| |]
+       member this.ResolveTypeName typeName =
+         match typeName with
+         |   "TheContainerType" -> theContainerTypeUninstantiated
+         |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| this |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> [| TypeBuilder.CreateStaticParameter("Tag",typeof<string>, 0) |]
+            | _ -> [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> 
+                match (staticArguments.[0] :?> string) with 
+                | "J" -> typeTable.Apply (typeNameWithArguments, "J")
+                | "K" -> typeTable.Apply (typeNameWithArguments, "K")
+                | _ -> failwith "invalid static parameter to TheContainerType: expected 'J' or 'K'"
+            | _ -> null
+
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       
+       member this.GetGeneratedAssemblyContents(assembly) = 
+           if assembly.GetName().Name = "providedJ" then 
+                System.IO.File.ReadAllBytes "providedJ.dll"
+           elif assembly.GetName().Name = "providedK" then 
+                System.IO.File.ReadAllBytes "providedK.dll"
+           else failwith "expected providedJ or providedK"
diff --git a/tests/fsharp/typeProviders/helloWorld/run.bat b/tests/fsharp/typeProviders/helloWorld/run.bat
new file mode 100644
index 0000000..8880c1d
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/run.bat
@@ -0,0 +1,10 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typeProviders/helloWorld/test.fsx b/tests/fsharp/typeProviders/helloWorld/test.fsx
new file mode 100644
index 0000000..e7baf01
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/test.fsx
@@ -0,0 +1,1147 @@
+#r "provider.dll"
+#r "providedNullAssemblyName.dll"
+
+[<AutoOpen>]
+module Infrastructure = 
+    let mutable failures = []
+    let reportFailure s = 
+      stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+    let argv = System.Environment.GetCommandLineArgs() 
+    let SetCulture() = 
+      if argv.Length > 2 && argv.[1] = "--culture" then  begin
+        let cultureString = argv.[2] in 
+        let culture = new System.Globalization.CultureInfo(cultureString) in 
+        stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+        System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+      end 
+  
+    do SetCulture()    
+
+    let check s e r = 
+      if r = e then  stdout.WriteLine (s+": YES") 
+      else (eprintfn "\n***** %s: FAIL, expected %A, got %A\n" s r e; reportFailure s)
+
+    let test s b = 
+      if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+      else (stderr.WriteLine ("failure: " + s); 
+            reportFailure s)
+(*========================================================================*)
+
+type TAlias1 = ProvidedTypeFromGlobalNamespace
+type TAlias2 = global.ProvidedTypeFromGlobalNamespace
+
+module BasicErasedProvidedTypeTest = 
+    check "cwpmew90"
+        FSharp.HelloWorld.HelloWorldType.StaticProperty1
+        "You got a static property"
+
+    check "cwkeonwe09"
+        FSharp.HelloWorld.HelloWorldType.StaticProperty2
+        42
+
+    // This is just checking the type checking
+    check "cwkeonwe09a"
+        (FSharp.HelloWorld.HelloWorldType.op_Addition(FSharp.HelloWorld.HelloWorldType(),FSharp.HelloWorld.HelloWorldType()) |> ignore; 1)
+        1
+
+    // This is just checking the type checking
+    let obj1 = FSharp.HelloWorld.HelloWorldType()
+    let obj2 = FSharp.HelloWorld.HelloWorldType()
+    check "cwkeonwe09b"
+        (obj1 + obj2)
+        obj1
+
+    check "cwpmew90"
+        FSharp.HelloWorld.HelloWorldType.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "cwkeonwe09"
+        FSharp.HelloWorld.HelloWorldType.NestedType.StaticProperty2
+        42
+
+    check "cwpmew901x"
+        (obj1.GetType())
+        typeof<obj>
+
+    check "cwkeonwe09a"
+        (let mutable localVar = 10 
+         FSharp.HelloWorld.HelloWorldType.UsesByRef(&localVar))
+        11
+
+    check "cwkeonwe09a221"
+        (FSharp.HelloWorld.HelloWorldType.OneOptionalParameter())
+        3376
+
+    check "cwkeonwe09a222"
+        (FSharp.HelloWorld.HelloWorldType.OneOptionalParameter(42))
+        43
+
+    check "cwkeonwe09a223"
+        (FSharp.HelloWorld.HelloWorldType.TwoOptionalParameters())
+        (3375 + 3390 + 1)
+
+    check "cwkeonwe09a224"
+        (FSharp.HelloWorld.HelloWorldType.TwoOptionalParameters(3))
+        (3 + 3390 + 1)
+
+    check "cwkeonwe09a225"
+        (FSharp.HelloWorld.HelloWorldType.TwoOptionalParameters(arg1=3))
+        (3 + 3390 + 1)
+
+    check "cwkeonwe09a226"
+        (FSharp.HelloWorld.HelloWorldType.TwoOptionalParameters(arg2=4))
+        (3375 + 4 + 1)
+
+    check "cwkeonwe09a227"
+        (FSharp.HelloWorld.HelloWorldType.TwoOptionalParameters(arg1=2,arg2=4))
+        (2 + 4 + 1)
+
+    check "cwkeonwe09a"
+        (let v1,v2 = FSharp.HelloWorld.HelloWorldType.UsesByRefAsOutParameter(3)
+         (v1,v2))
+        (17,4)
+
+    check "cwkeonwe09a1"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsDefaultDateTime())
+        (System.DateTime())
+
+    check "cwkeonwe09a13345"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsNewArray())
+        [| 3;6 |]
+
+
+    check "cwkeonwe09a13355"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsEmptyNewArray())
+        [| |]
+
+    check "cwkeonwe09a133561"
+        (FSharp.HelloWorld.HelloWorldType.IfThenElseUnitUnit true)
+        ()
+
+    check "cwkeonwe09a1335634"
+        (FSharp.HelloWorld.HelloWorldType.SequentialSmokeTest())
+        1
+
+    check "cwkeonwe09a1335634b"
+        (FSharp.HelloWorld.HelloWorldType.SequentialSmokeTest2())
+        ()
+
+    check "cwkeonwe09a1335635"
+        (let f = FSharp.HelloWorld.HelloWorldType.LambdaSmokeTest() in f 5)
+        6
+
+    check "cwkeonwe09a1335635b"
+        (let f = FSharp.HelloWorld.HelloWorldType.LambdaSmokeTest2 () in f ())
+        ()
+
+    check "cwkeonwe09a1335635c"
+        (let f = FSharp.HelloWorld.HelloWorldType.LambdaSmokeTest3 () in f 3 4)
+        7
+
+    check "cwkeonwe09a1335635d"
+        // The test gets arr.[0,0] 
+        (FSharp.HelloWorld.HelloWorldType.ArrayGetSmokeTest [| 11;2;3 |] )
+        11
+
+
+    check "cwkeonwe09a1335635e"
+        // The test sets arr.[0] to 3
+        (let arr = [| 11;2;3 |] in FSharp.HelloWorld.HelloWorldType.ArraySetSmokeTest arr; arr.[0] )
+        3
+
+    check "cwkeonwe09a1335635e2"
+        // The test sets a local mutable value to 4
+        (FSharp.HelloWorld.HelloWorldType.VarSetSmokeTest())
+        4
+
+    check "cwkeonwe09a1335635f"
+        // The test sets arr.[0,0] to 3
+        (let arr = array2D [| [| 11;2;6 |] ; [| 1112;21;31 |] |] in FSharp.HelloWorld.HelloWorldType.Array2DSetSmokeTest arr; arr.[0,0] )
+        3
+
+    check "cwkeonwe09a1335635f"
+        // The test gets arr.[0,0] 
+        (FSharp.HelloWorld.HelloWorldType.Array2DGetSmokeTest (array2D [| [| 12;2;6 |] ; [| 1112;21;31 |] |]) )
+        12
+
+    check "cwkeonwe09a1335635g"
+        (FSharp.HelloWorld.HelloWorldType.IsMarkedObsolete1()) // we expect a warning here
+        1
+
+    check "cwkeonwe09a1335635h"
+        (FSharp.HelloWorld.HelloWorldType.IsMarkedObsolete2()) // we expect a warning here
+        2
+
+    check "cwkeonwe09a1335635i"
+        (FSharp.HelloWorld.HelloWorldType.IsMarkedConditional1(); 3)
+        3
+
+    check "cwkeonwe09a1335635h"
+        (FSharp.HelloWorld.HelloWorldType.TakesParamArray(3,[| |]))
+        0
+
+    check "cwkeonwe09a1335635h1"
+        (FSharp.HelloWorld.HelloWorldType.TakesParamArray(3))
+        0
+
+    check "cwkeonwe09a1335635h2"
+        (FSharp.HelloWorld.HelloWorldType.TakesParamArray(3,4))
+        1
+
+    check "cwkeonwe09a1335635h5"
+        (FSharp.HelloWorld.HelloWorldType.TakesParamArray(3,4,5,6,7,8))
+        5
+
+    check "cwkeonwe09a1335655433"
+        (FSharp.HelloWorld.HelloWorldType.TryWithSmokeTest())
+        3
+
+    // Note, the provided expressions contain a use of "reraise". This is permitted.
+    check "cwkeonwe09a1335655434"
+        (FSharp.HelloWorld.HelloWorldType.TryWithSmokeTest3())
+        true
+
+    check "cwkeonwe09a1335655435"
+        (FSharp.HelloWorld.HelloWorldType.TryWithSmokeTest2())
+        true
+
+    check "cwkeonwe09a13356432437"
+        (FSharp.HelloWorld.HelloWorldType.TryFinallySmokeTest())
+        3
+
+    check "cwkeonwe09a13356b"
+        (FSharp.HelloWorld.HelloWorldType.IfThenElseVoidUnit true)
+        ()
+
+
+    check "cwkeonwe09a13356c"
+        (FSharp.HelloWorld.HelloWorldType.NewUnionCaseSmokeTest1())
+        []
+
+    check "cwkeonwe09a13356d"
+        (FSharp.HelloWorld.HelloWorldType.NewUnionCaseSmokeTest2())
+        [1]
+
+
+    check "cwkeonwe09a13356e"
+        (FSharp.HelloWorld.HelloWorldType.NewUnionCaseSmokeTest3())
+        None
+
+    check "cwkeonwe09a13356f"
+        (FSharp.HelloWorld.HelloWorldType.NewUnionCaseSmokeTest4())
+        (Some 3)
+
+    check "cwkeonwe09a13356g"
+        (FSharp.HelloWorld.HelloWorldType.NewUnionCaseSmokeTest5())
+        (Choice1Of2 3)
+
+
+    check "cwkeonwe09a13356g1"
+        (let del = FSharp.HelloWorld.HelloWorldType.NewDelegateSmokeTest1 () in del.Invoke 3)
+        4
+
+    check "cwkeonwe09a13356g2"
+        (let del = FSharp.HelloWorld.HelloWorldType.NewDelegateSmokeTest2 () in del.Invoke(3,4))
+        7
+
+    check "cwkeonwe09a13356g3"
+        (FSharp.HelloWorld.HelloWorldType.ForIntegerRangeLoopSmokeTest1 ())
+        11
+
+    check "cwkeonwe09a13356hb"
+        (FSharp.HelloWorld.HelloWorldType.NewObjectGeneric1().Count)
+        0
+
+    check "cwkeonwe09a13356hc"
+        (FSharp.HelloWorld.HelloWorldType.NewObjectGeneric2().Count)
+        0
+
+    check "cwkeonwe09a13356h1a"
+        (FSharp.HelloWorld.HelloWorldType.StructProperty1())
+        86400.0
+
+    check "cwkeonwe09a13356h1b"
+        (FSharp.HelloWorld.HelloWorldType.StructProperty2())
+        86400.0
+
+    check "cwkeonwe09a13356h1c"
+        (FSharp.HelloWorld.HelloWorldType.StructProperty3())
+        86400.0
+
+    check "cwkeonwe09a13356h1d"
+        (FSharp.HelloWorld.HelloWorldType.StructMethod1())
+        (86400.0 * 2.0)
+
+    check "cwkeonwe09a13356h13"
+        (FSharp.HelloWorld.HelloWorldType.StructMethod2())
+        (86400.0 * 2.0)
+
+    check "cwkeonwe09a13356h1"
+        (FSharp.HelloWorld.HelloWorldType.NewRecordSmokeTest1().contents)
+        3
+
+    check "cwkeonwe09a13356h2"
+        (FSharp.HelloWorld.HelloWorldType.UnionCaseTest1 [1])
+        true
+
+    check "cwkeonwe09a13356h3"
+        (FSharp.HelloWorld.HelloWorldType.UnionCaseTest1 [])
+        false
+
+    check "cwkeonwe09a13356h4"
+        (FSharp.HelloWorld.HelloWorldType.UnionCaseTest2 (Some 1))
+        true
+
+
+    check "cwkeonwe09a13356h5"
+        (FSharp.HelloWorld.HelloWorldType.UnionCaseTest2 None)
+        false
+
+
+    check "cwkeonwe09a2"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsDefaultDayOfWeek())
+        (System.DayOfWeek())
+
+    check "cwkeonwe09a3"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsMondayDayOfWeek())
+        System.DayOfWeek.Monday
+
+    check "cwkeonwe09a4"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsNullSeqString())
+        null
+
+                   
+
+    let testIntrinsics() = 
+            FSharp.HelloWorld.HelloWorldType.CallInstrinsics()
+
+    testIntrinsics()
+
+
+    check "cwkeonwe09a5"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsNullString())
+        null
+
+
+    let test1() = 
+        check "cwkeonwe09a8731"
+            (FSharp.HelloWorld.HelloWorldType.GetItem1OfTuple2OfInt( (3,6) ))
+            3
+    test1()
+
+    let test2() = 
+        check "cwkeonwe09a8732"
+            (FSharp.HelloWorld.HelloWorldType.GetItem2OfTuple2OfInt( (3,6) ))
+            6
+    test2()
+
+    let test3() = 
+        check "cwkeonwe09a87317"
+            (FSharp.HelloWorld.HelloWorldType.GetItem1OfTuple7OfInt( (3,6,9,12,15,18,21) ))
+            3
+    test3()
+
+    let test4() = 
+        check "cwkeonwe09a87327"
+            (FSharp.HelloWorld.HelloWorldType.GetItem7OfTuple7OfInt( (3,6,9,12,15,18,21) ))
+            21
+    test4()
+
+    let test5() = 
+        check "cwkeonwe09a87318"
+            (FSharp.HelloWorld.HelloWorldType.GetItem1OfTuple8OfInt( (3,6,9,12,15,18,21,24) ))
+            3
+    test5()
+
+    let test6() = 
+        check "cwkeonwe09a87328"
+            (FSharp.HelloWorld.HelloWorldType.GetItem7OfTuple8OfInt( (3,6,9,12,15,18,21,24) ))
+            21
+    test6()
+
+    let test7() = 
+        check "cwkeonwe09a87338"
+            (FSharp.HelloWorld.HelloWorldType.GetItem8OfTuple8OfInt( (3,6,9,12,15,18,21,24) ))
+            24
+    test7()
+
+    let test8() = 
+        check "cwkeonwe09a87319"
+            (FSharp.HelloWorld.HelloWorldType.GetItem1OfTuple9OfInt( (3,6,9,12,15,18,21,24,27) ))
+            3
+    test8()
+
+    let test9() = 
+        check "cwkeonwe09a87329"
+            (FSharp.HelloWorld.HelloWorldType.GetItem7OfTuple9OfInt( (3,6,9,12,15,18,21,24,27) ))
+            21
+    test9()
+
+    let test10() = 
+        check "cwkeonwe09a87339"
+            (FSharp.HelloWorld.HelloWorldType.GetItem8OfTuple9OfInt( (3,6,9,12,15,18,21,24,27) ))
+            24
+    test10()
+
+    let test11() = 
+        check "cwkeonwe09a87349"
+            (FSharp.HelloWorld.HelloWorldType.GetItem9OfTuple9OfInt( (3,6,9,12,15,18,21,24,27) ))
+            27
+    test11()
+
+    let test12() = 
+        check "cwkeonwe09a62"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple2OfInt())
+            (3,6)
+    test12()
+
+    let test13() = 
+        check "cwkeonwe09a63"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple3OfInt())
+            (3,6,9)
+    test13() 
+
+    let test14() = 
+        check "cwkeonwe09a64"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple4OfInt())
+            (3,6,9,12)
+    test14()
+
+    let test15() = 
+        check "cwkeonwe09a65"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple5OfInt())
+            (3,6,9,12,15)
+    test15()
+
+    let test16() = 
+        check "cwkeonwe09a66"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple6OfInt())
+            (3,6,9,12,15,18)
+    test16()
+
+    let test17() = 
+        check "cwkeonwe09a67"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple7OfInt())
+            (3,6,9,12,15,18,21)
+    test17()
+
+    let test18() = 
+        check "cwkeonwe09a68"
+            (FSharp.HelloWorld.HelloWorldType.ReturnsTuple8OfInt())
+            (3,6,9,12,15,18,21,24)
+    test18() 
+
+    check "cwkeonwe09a69"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsTuple9OfInt())
+        (3,6,9,12,15,18,21,24,27)
+
+    check "cwkeonwe09a7"
+        (FSharp.HelloWorld.HelloWorldType.ReturnsUnit())
+        (())
+
+    check "cwpmew901"
+        (FSharp.HelloWorld.HelloWorldType().GetType())
+        typeof<obj>
+
+    check "cwpmew902"
+        (FSharp.HelloWorld.HelloWorldSubType().GetType())
+        typeof<obj>
+
+    check "cwpmew903"
+        (FSharp.HelloWorld.HelloWorldType.NestedType().GetType())
+        typeof<obj>
+
+
+    // Check a simple quotation of an erased type
+    check "cwpmew901"
+        <@ (fun (x : FSharp.HelloWorld.HelloWorldType) -> x) @>.Type
+        typeof<obj -> obj>
+
+    // Check a simple quotation of an erased type that inherits from another erased type
+    check "cwpmew902"
+        <@ (fun (x : FSharp.HelloWorld.HelloWorldSubType) -> x) @>.Type
+        typeof<obj -> obj>
+
+    // Check a simple quotation of an erased type that inherits from another erased type
+    check "cwpmew902"
+        <@ (fun (x : FSharp.HelloWorld.HelloWorldType.NestedType) -> x) @>.Type
+        typeof<obj -> obj>
+
+    check "cewnew0wel" 
+       (obj1 - obj2)
+       obj1
+
+    check "cewnew0wel_equality" 
+       <@ FSharp.HelloWorld.HelloWorldType() - FSharp.HelloWorld.HelloWorldType() @>
+       <@ FSharp.HelloWorld.HelloWorldType() - FSharp.HelloWorld.HelloWorldType() @>
+
+    check "cewnew0wel_equality" 
+       <@ FSharp.HelloWorld.HelloWorldType() + FSharp.HelloWorld.HelloWorldType() @>
+       <@ FSharp.HelloWorld.HelloWorldType() + FSharp.HelloWorld.HelloWorldType() @>
+
+
+module BasicNestedNamespaceErasedProvidedTypeTest = 
+    check "cwpmew902"
+        FSharp.HelloWorld.NestedNamespace1.HelloWorldType.StaticProperty1
+        "You got a static property"
+
+    check "cwpmew903"
+        FSharp.HelloWorld.Nested.Nested.Nested.Namespace2.HelloWorldType.StaticProperty1
+        "You got a static property"
+
+    module Scope1 = 
+        open FSharp.HelloWorld.NestedNamespace1
+
+        check "cwpmew904"
+            HelloWorldType.StaticProperty1
+            "You got a static property"
+
+    module Scope2 = 
+        open FSharp.HelloWorld.Nested.Nested.Nested.Namespace2
+
+        check "cwpmew905"
+            HelloWorldType.StaticProperty1
+            "You got a static property"
+
+module Int32 = 
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<Count=1>.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticOptionalInt32Parameter<1>.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticOptionalInt32Parameter.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticOptionalInt32Parameter<Count=1>.NestedType.StaticProperty1
+        "You got a static property"
+
+    type T = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>
+
+    let testBinaryCompatFunction (x:FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>) = 
+       printfn "do not inline me"
+       printfn "do not inline me"
+       printfn "do not inline me"
+       printfn "do not inline me"
+       printfn "do not inline me"
+       x
+
+
+    check "vlkrrevpojvr0"
+        T.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        T.NestedType.StaticProperty2
+        42
+
+
+    check "vlkrrevpojvr2"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<2>.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr3"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<2>.StaticProperty2
+        42
+
+    check "vlkrrevpojvr4"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<3>.StaticProperty3
+        43
+
+    check "vfhdjkwrywwt1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const 2>.StaticProperty1
+        "You got a static property"
+
+    check "vfhdjkwrywwt2"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const (2 ||| 2)>.StaticProperty1
+        "You got a static property"
+
+    check "vfhdjkwrywwt3"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticDayOfWeekParameter<const System.DayOfWeek.Monday >.StaticProperty1
+        "You got a static property"
+
+    check "vfhdjkwrywwt4"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticDayOfWeekParameter<const (System.DayOfWeek.Monday ||| System.DayOfWeek.Tuesday) >.StaticProperty1
+        "You got a static property"
+
+    [<Literal>]
+    let two = 2
+
+    check "vfhdjkwrywwt"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const two>.StaticProperty1
+        "You got a static property"
+
+    type TConst2 = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const 2>
+    type TConst2b = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const (2)>
+    type TConst2c = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const ((2))>
+    type TConst2d = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const (two)>
+    type TConst2e = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const ((two))>
+    type TConstTwo = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const two>
+
+    check "bdferjhtwer78tr278"
+        TConst2.StaticProperty1
+        "You got a static property"
+    
+    check "bdferjhtwer78tr279"
+        TConstTwo.StaticProperty2
+        42
+
+    type TConstMinus2 = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const -2>
+
+    check "bdferjhtwer78tr278aa"
+        TConstMinus2.StaticPropertyMinus2
+        38
+    
+    module Nested =
+        [<Literal>]
+        let two = 2
+
+    type TConstNestedTwo = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const Nested.two>
+    check "fh873463csdkop9"
+        TConstNestedTwo.StaticProperty1
+        "You got a static property"
+
+    check "fh873463csdkop9kk"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<const Nested.two>.StaticProperty1
+        "You got a static property"
+
+
+
+    type T1 = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>
+    type T2 = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<2>
+    type T3 = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<3>
+
+    check "vlkrrevpojvr51" T1.StaticProperty1 "You got a static property"
+    check "vlkrrevpojvr52" T2.StaticProperty1 "You got a static property"
+    check "vlkrrevpojvr53" T3.StaticProperty1 "You got a static property"
+
+
+    check "vlkrrevpojvr5" T2.StaticProperty2 42
+    check "vlkrrevpojvr5" T3.StaticProperty2 42
+
+    check "vlkrrevpojvr6" T3.StaticProperty3 43
+
+module SByte = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticSByteParameter<1y>.StaticProperty1
+        "You got a static property"
+
+
+module Int16 = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt16Parameter<1s>.StaticProperty1
+        "You got a static property"
+
+module Int64 = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticInt64Parameter<1L>.StaticProperty1
+        "You got a static property"
+
+module Byte = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticByteParameter<1uy>.StaticProperty1
+        "You got a static property"
+
+
+module UInt16 = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticUInt16Parameter<1us>.StaticProperty1
+        "You got a static property"
+
+module UInt32 = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticUInt32Parameter<1u>.StaticProperty1
+        "You got a static property"
+
+module UInt64 = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticUInt64Parameter<1UL>.StaticProperty1
+        "You got a static property"
+
+
+module Single = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticSingleParameter<1.0f>.StaticProperty1
+        "You got a static property"
+
+module Double = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticDoubleParameter<1.0>.StaticProperty1
+        "You got a static property"
+
+module Decimal = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticDecimalParameter<1.0M>.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticDecimalParameter<1.0M>.NestedType.StaticProperty1
+        "You got a static property"
+
+    type T = FSharp.HelloWorld.HelloWorldTypeWithStaticDecimalParameter<1.0M>
+
+    check "vlkrrevpojvr0"
+        T.NestedType.StaticProperty1
+        "You got a static property"
+
+    check "vlkrrevpojvr0"
+        T.NestedType.StaticProperty2
+        42
+
+
+
+module Char = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticCharParameter<'A'>.StaticProperty1
+        "You got a static property"
+
+module String = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"10000">.StaticProperty1
+        "You got a static property"
+
+module Bool = 
+    check "vlkrrevpojvr1"
+        FSharp.HelloWorld.HelloWorldTypeWithStaticBoolParameter<true>.StaticProperty1
+        "You got a static property"
+
+//let a = System.Reflection.Assembly.LoadFile (__SOURCE_DIRECTORY__ + "\\provided.dll")
+
+
+type TheGeneratedType4 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType4">
+
+
+type TheGeneratedType3WithIndexer = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType3WithIndexer">
+
+
+type TheGeneratedTypeWithEvent = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedTypeWithEvent">
+
+
+type TheGeneratedDelegateType = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedDelegateType">
+
+
+type TheGeneratedStructType = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedStructType">
+
+
+
+type GeneratedRelatedTypes = FSharp.HelloWorldGenerative.TheContainerType<"GeneratedRelatedTypes">
+
+
+type TheOuterType = FSharp.HelloWorldGenerative.TheContainerType<"TheOuterType">
+
+
+
+type TheGeneratedEnumType = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedEnumType">
+
+
+module BasicGenerativeTest2Public = 
+
+    // Check creating an instance of a generated type
+    let v0a : TheGeneratedType4 = TheGeneratedType4()
+    let v0b = TheGeneratedType4()
+    let v0c = new TheGeneratedType4()
+
+    // Check creating an instance of a nested generated type
+    let v0na : TheOuterType.TheNestedGeneratedType = TheOuterType.TheNestedGeneratedType()
+    let v0nb = TheOuterType.TheNestedGeneratedType()
+    let v0nc = new TheOuterType.TheNestedGeneratedType()
+
+    // Check use of instance property getter
+    let v1 : TheGeneratedType4 = TheGeneratedType4()
+    check "cwlecew01" v1.Prop1 1
+
+    // Check use of instance property getter on a nested generated type
+    let v1n = TheOuterType.TheNestedGeneratedType()
+    check "cwlecew01" v1.Prop1 1
+
+    // Check use of indexer item property getter
+    let v2  = TheGeneratedType3WithIndexer()
+    check "cwlecew02" v2.[1] "1"
+
+    // Check use of indexer item property getter on a nested generated type
+    let v2n = TheOuterType.TheNestedGeneratedTypeWithIndexer()
+    check "cwlecew02" v2n.[1] "1"
+
+    // Check use of indexer item property setter
+    let v2b  = new TheGeneratedType3WithIndexer()
+    check "cwlecew03" v2b.[2] "2"
+    v2b.[2] <- "two"
+    v2b.set_Item(2,"two")
+
+    check "cwlecew04" v2b.[2] "two"
+
+    // Check use of indexer item property setter on a nested generated type
+    let v2bn  = new TheOuterType.TheNestedGeneratedTypeWithIndexer()
+    check "cwlecew03" v2bn.[2] "2"
+    v2bn.[2] <- "two"
+    check "cwlecew04" v2bn.[2] "two"
+
+    // Check use of provided event 
+    let eventObj  = TheGeneratedTypeWithEvent()
+    let count = ref 0
+    eventObj.MyEvent.Add (fun _ -> incr count)
+    check "cwlecew02" count.Value 0
+    eventObj.Trigger()
+    check "cwlecew02" count.Value 1
+
+    // Check use of overloaded operator
+    let obj1 = TheGeneratedType4()
+    let obj2 : TheGeneratedType4 = TheGeneratedType4()
+    check "cwlecew05" (obj1 + obj2) obj1 // the operator returns the first value
+
+    // Check use of overloaded operator on a nested generated type
+    let obj1n = TheOuterType.TheNestedGeneratedType()
+    let obj2n : TheOuterType.TheNestedGeneratedType = TheOuterType.TheNestedGeneratedType()
+    check "cwlecew05" (obj1n + obj2n) obj1n // the operator returns the first value
+
+    // Check that subtyping amongst provided generated types is detected
+    let testFunctionThatTakesGeneratedInterfaceTypeAsParameter (x: GeneratedRelatedTypes.TheGeneratedInterfaceType) = (x,x)
+    let testFunctionThatTakesGeneratedInterfaceSubTypeAsParameter (x: GeneratedRelatedTypes.TheGeneratedInterfaceSubType) = (x,x)
+
+    let _ = testFunctionThatTakesGeneratedInterfaceTypeAsParameter (GeneratedRelatedTypes.TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceType())
+    let _ = testFunctionThatTakesGeneratedInterfaceSubTypeAsParameter (GeneratedRelatedTypes.TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceSubType())
+    let _ = testFunctionThatTakesGeneratedInterfaceTypeAsParameter (GeneratedRelatedTypes.TheGeneratedClassTypeWhichImplementsTheGeneratedInterfaceSubType())
+
+    // Check creation of provided delegate type
+    let delegateObj1 = new TheGeneratedDelegateType(fun x -> x * x)
+
+    // Check invocation of provided delegate type
+    check "cwlecew02r398y" (delegateObj1.Invoke 3) 9
+
+    // Check creation of provided nested delegate type
+    let delegateObj2 = new TheOuterType.TheNestedGeneratedDelegateType(fun x -> x*x*x)
+
+    // Check invocation of provided nested delegate type
+    check "cwlecew02r3cwe" (delegateObj2.Invoke 3) 27
+
+
+    // Check object expression creating instance of provided generated interface type
+    // Check object expression creating instance of provided nested generated interface type
+    let interfaceObj1  = 
+        { new GeneratedRelatedTypes.TheGeneratedInterfaceType with 
+                    member __.InterfaceMethod0() = 3
+                    member __.InterfaceMethod1 arg1 = arg1 + 4
+                    member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+                    member __.InterfaceProperty1 = 4 }
+                
+    check "cwlecew061" (interfaceObj1.InterfaceMethod0()) 3
+    check "cwlecew062" (interfaceObj1.InterfaceMethod1 6) 10
+    check "cwlecew063" (interfaceObj1.InterfaceMethod2 (3,4)) 7
+    check "cwlecew064" (interfaceObj1.InterfaceProperty1) 4
+
+    let interfaceObj2  = 
+        { new TheOuterType.TheNestedGeneratedInterfaceType with 
+                    member __.InterfaceMethod0() = 3
+                    member __.InterfaceMethod1 arg1 = arg1 + 4
+                    member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+                    member __.InterfaceProperty1 = 4 }
+                
+    check "cwlecew065" (interfaceObj2.InterfaceMethod0()) 3
+    check "cwlecew066" (interfaceObj2.InterfaceMethod1 6) 10
+    check "cwlecew067" (interfaceObj2.InterfaceMethod2 (3,4)) 7
+    check "cwlecew068" (interfaceObj2.InterfaceProperty1) 4
+
+    let interfaceObj1e  = 
+        let ev = new Event<System.EventHandler<System.EventArgs>,System.EventArgs>()
+        { new GeneratedRelatedTypes.TheGeneratedInterfaceTypeWithEvent with 
+                    member __.InterfaceProperty1 = 4
+                    [<CLIEvent>]
+                    member __.MyEvent = ev.Publish }
+
+    let interfaceObj2e  = 
+        let ev = new Event<System.EventHandler<System.EventArgs>,System.EventArgs>()
+        { new TheOuterType.TheNestedGeneratedInterfaceTypeWithEvent with 
+                    member __.InterfaceProperty1 = 4
+                    [<CLIEvent>]
+                    member __.MyEvent = ev.Publish }
+
+    type ImplementationOfInterfaceType1()  = 
+        interface GeneratedRelatedTypes.TheGeneratedInterfaceType with 
+                    member __.InterfaceMethod0() = 3
+                    member __.InterfaceMethod1 arg1 = arg1 + 4
+                    member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+                    member __.InterfaceProperty1 = 4 
+                
+    let interfaceObj3 = (ImplementationOfInterfaceType1()  :> GeneratedRelatedTypes.TheGeneratedInterfaceType)
+    check "cwlecew061" (interfaceObj3.InterfaceMethod0()) 3
+    check "cwlecew062" (interfaceObj3.InterfaceMethod1 6) 10
+    check "cwlecew063" (interfaceObj3.InterfaceMethod2 (3,4)) 7
+    check "cwlecew064" (interfaceObj3.InterfaceProperty1) 4
+
+
+    type ImplementationOfNestedInterfaceType1()  = 
+        interface TheOuterType.TheNestedGeneratedInterfaceType with 
+                    member __.InterfaceMethod0() = 3
+                    member __.InterfaceMethod1 arg1 = arg1 + 4
+                    member __.InterfaceMethod2 (arg1, arg2) = arg1+arg2
+                    member __.InterfaceProperty1 = 4 
+                
+    let interfaceObj4 = (ImplementationOfNestedInterfaceType1()  :> TheOuterType.TheNestedGeneratedInterfaceType)
+    check "cwlecew061" (interfaceObj4.InterfaceMethod0()) 3
+    check "cwlecew062" (interfaceObj4.InterfaceMethod1 6) 10
+    check "cwlecew063" (interfaceObj4.InterfaceMethod2 (3,4)) 7
+    check "cwlecew064" (interfaceObj4.InterfaceProperty1) 4
+
+    type ImplementationOfInterfaceTypeWithEvent1()  = 
+        let ev = new Event<System.EventHandler<System.EventArgs>,System.EventArgs>()
+        interface GeneratedRelatedTypes.TheGeneratedInterfaceTypeWithEvent with 
+            member __.InterfaceProperty1 = 4 
+            [<CLIEvent>]
+            member __.MyEvent = ev.Publish 
+                
+    let ev3 = ImplementationOfInterfaceTypeWithEvent1() 
+    type ImplementationOfNestedInterfaceTypeWithEvent1()  = 
+        let ev = new Event<System.EventHandler<System.EventArgs>,System.EventArgs>()
+        interface TheOuterType.TheNestedGeneratedInterfaceTypeWithEvent with 
+            member __.InterfaceProperty1 = 4 
+            [<CLIEvent>]
+            member __.MyEvent = ev.Publish 
+    let ev4 = ImplementationOfInterfaceTypeWithEvent1() 
+
+#if ABSTRACT_CONSTRUCTORS_ARE_PROTECTED_BUG
+
+    let classObj1e  = 
+        let ev = new Event<System.EventHandler<System.EventArgs>,System.EventArgs>()
+        { new TheContainerType.TheGeneratedAbstractClassWithEvent() with 
+                    member __.InterfaceProperty1 = 4
+                    [<CLIEvent>]
+                    member __.MyEvent = ev.Publish }
+
+
+    // TODO: Check inheritance of provided generated abstract base class type
+    // TODO: Check inheritance of provided nested generated abstract base class type
+
+    // TODO: Check object expression creating instance of provided generated abstract base class type
+    // TODO: Check object expression creating instance of provided nested generated abstract base class type
+
+#endif
+
+    // Check access of immutable struct property
+    let obj3  = new TheGeneratedStructType(3)
+    check "cwlecew06" obj3.StructProperty1 4 // the property adds one to the input
+
+    // Check access of immutable struct property on a nested generated type
+    let obj3n  = new TheOuterType.TheNestedGeneratedStructType(4)
+    check "cwlecew06b" obj3n.StructProperty1 4 // the property returns the input
+
+    // Check mutation of struct property
+    let mutable obj4  = new TheGeneratedStructType(3)
+    obj4.StructMutableProperty1 <- 5
+
+// Disabled because of DevDiv:274092
+// Re-enabled then it is fixed.
+// Note: we call it "mutable property" when it is really a field
+//    check "cwlecew07a" obj4.StructMutableProperty1 5
+
+    // Check mutation of struct property on a nested generated type
+    let mutable obj4n  = new TheOuterType.TheNestedGeneratedStructType(3)
+    obj4n.StructMutableProperty1 <- 5
+// Disabled because of DevDiv:274092
+// Re-enabled then it is fixed.
+// Note: we call it "mutable property" when it is really a field
+//    check "cwlecew07b" obj4n.StructMutableProperty1 5
+
+    // Check getting an enumeration value
+    let enumValue1  = TheGeneratedEnumType.Item0
+    check "cwlecew07c" (int enumValue1) 0
+
+    // Check that you can do bitwise operations on enumeration value
+    let enumValue2  = TheGeneratedEnumType.Item1 ||| TheGeneratedEnumType.Item2
+    check "cwlecew07d" (int enumValue2) (1 ||| 2)
+
+    // Check a simple quotation of a piece of code that manipulates a generated type by taking the quotation and checking the type of the quotation tree
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType4) -> x) @>.Type
+        typeof<TheGeneratedType4 -> TheGeneratedType4>
+
+    // Check a simple quotation of a pirce of code that manipulates a nested generated type by taking the quotation and checking the type of the quotation tree
+    check "cwpmew901"
+        <@ (fun (x : TheOuterType.TheNestedGeneratedType) -> x) @>.Type
+        typeof<TheOuterType.TheNestedGeneratedType -> TheOuterType.TheNestedGeneratedType>
+
+module BasicGenerativeTest2 = 
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+
+    let internal v1 : TheGeneratedTypeJ = TheGeneratedTypeJ()
+
+    let v2 = v1.Item1
+
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+
+    let v3 : TheGeneratedTypeK = TheGeneratedTypeK()
+
+    let v4 = v3.Item1
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedTypeJ) -> x) @>.Type
+        typeof<TheGeneratedTypeJ -> TheGeneratedTypeJ>
+
+    // Check a simple quotation of a generated type
+    check "cwpmew902"
+        <@ (fun (x : TheGeneratedTypeK) -> x) @>.Type
+        typeof<TheGeneratedTypeK -> TheGeneratedTypeK>
+
+module BasicGenerativeTestWithStaticArgPublic = 
+
+    let v1 : TheGeneratedType4 = TheGeneratedType4()
+
+    let v2 = v1.Prop1
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType4) -> x) @>.Type
+        typeof<TheGeneratedType4 -> TheGeneratedType4>
+
+module TwoNamespaceGenerativeTestPublic = 
+    
+    type TheGeneratedType1 = FSharp.HelloWorldGenerativeNamespace1.TheContainerType<"unused">
+
+    
+    type TheGeneratedType1WithIndexer = FSharp.HelloWorldGenerativeNamespace2.TheContainerType<"unused">
+
+    let v1 : TheGeneratedType1 = TheGeneratedType1()
+
+    let v2 = v1.Prop1
+
+    let v3 : TheGeneratedType1WithIndexer = TheGeneratedType1WithIndexer()
+
+    let v4 = v3.Prop2
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType1) -> x) @>.Type
+        typeof<TheGeneratedType1 -> TheGeneratedType1>
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType1WithIndexer) -> x) @>.Type
+        typeof<TheGeneratedType1WithIndexer -> TheGeneratedType1WithIndexer>
+
+
+module TwoNamespaceGenerativeTest = 
+    
+    type internal TheGeneratedType5 = FSharp.HelloWorldGenerativeInternalNamespace1.TheContainerType<"unused">
+
+    
+    type internal TheGeneratedType5WithIndexer = FSharp.HelloWorldGenerativeInternalNamespace2.TheContainerType<"unused">
+
+    let internal v1 : TheGeneratedType5 = TheGeneratedType5()
+
+    let v2 = v1.Prop1
+
+    let internal v3 : TheGeneratedType5WithIndexer = TheGeneratedType5WithIndexer()
+
+    let v4 = v3.Prop2
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType5) -> x) @>.Type
+        typeof<TheGeneratedType5 -> TheGeneratedType5>
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType5WithIndexer) -> x) @>.Type
+        typeof<TheGeneratedType5WithIndexer -> TheGeneratedType5WithIndexer>
+
+
+
+module OneProviderContributesTwoFragmentsToSameNamespace = 
+    
+    type internal TheGeneratedType2 = FSharp.OneProviderContributesTwoFragmentsToSameNamespace.TheContainerType1<"unused">
+
+    
+    type internal TheGeneratedType2WithIndexer = FSharp.OneProviderContributesTwoFragmentsToSameNamespace.TheContainerType2<"unused">
+
+    let internal v1 : TheGeneratedType2 = TheGeneratedType2()
+
+    let v2 = v1.Prop1
+
+    let internal v3 : TheGeneratedType2WithIndexer = TheGeneratedType2WithIndexer()
+
+    let v4 = v3.Prop2
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType2) -> x) @>.Type
+        typeof<TheGeneratedType2 -> TheGeneratedType2>
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType2WithIndexer) -> x) @>.Type
+        typeof<TheGeneratedType2WithIndexer -> TheGeneratedType2WithIndexer>
+
+
+
+module TwoProvidersContributeToSameNamespace = 
+    
+    type internal TheGeneratedType3InContainerType1 = FSharp.TwoProvidersContributeToSameNamespace.ContainerType1<"unused">
+
+    
+    type internal TheGeneratedType3InContainerType2 = FSharp.TwoProvidersContributeToSameNamespace.ContainerType2<"unused">
+
+    let internal v1 : TheGeneratedType3InContainerType1 = TheGeneratedType3InContainerType1()
+
+    let v2 = v1.Prop1
+
+    let internal v3 : TheGeneratedType3InContainerType2 = TheGeneratedType3InContainerType2()
+
+    let v4 = v3.Prop1
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType3InContainerType1) -> x) @>.Type
+        typeof<TheGeneratedType3InContainerType1 -> TheGeneratedType3InContainerType1>
+
+    // Check a simple quotation of a generated type
+    check "cwpmew901"
+        <@ (fun (x : TheGeneratedType3InContainerType2) -> x) @>.Type
+        typeof<TheGeneratedType3InContainerType2 -> TheGeneratedType3InContainerType2>
+
+
+module DllImportSMokeTest = 
+
+   type DllImportSmokeTest = FSharp.HelloWorldGenerative.TheContainerType<"DllImportSmokeTest">
+
+   printfn "Testing DllImport: Win32 GetLastError() = %d" (DllImportSmokeTest.GetLastError())
+   let f() = 
+      printfn "testing...."
+      printfn "testing...."
+      printfn "testing...."
+      printfn "testing...."
+      printfn "testing...."
+      printfn "testing...."
+      printfn "testing...."
+      DllImportSmokeTest.GetLastError() // this tests a call to a pinvoke in tailcall position
+   printfn "Testing DllImport: Win32 GetLastError() = %d" (f())
+
+
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typeProviders/helloWorld/testlib_client.fsx b/tests/fsharp/typeProviders/helloWorld/testlib_client.fsx
new file mode 100644
index 0000000..ea4fb7d
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorld/testlib_client.fsx
@@ -0,0 +1,19 @@
+#r "provider.dll"
+#r "test_lib.dll"
+
+// To compile this function we must reference test_lib.dll. In the test (see build.bat) we reference
+// the _old_ test_lib.dll, which was compiled when referencing a type with one optional static parameter.
+// The provider is then recompiled to change the type to have two optional static parameters
+// (analogous to adding a static paramter to a provider in FSharp.Data.TypeProviders.dll). This
+// provider must function correctly in the sense that it is able to resolve 
+// old metadata references that don't give a value to the new optional static parameter.
+// This is managed by the TP implementation in the F# compiler which fills in the static parameter
+// based on its optional value.
+let functionThatUsesTypeInformationFromTestLibWhichInvolvesTypesWhichUndergoBinaryCompatibleChange () = 
+    Test.Int32.testBinaryCompatFunction 
+
+#if ADD_AN_OPTIONAL_STATIC_PARAMETER
+// after we added an optional static parameter, sanity check we can use it
+let c = FSharp.HelloWorld.HelloWorldTypeWithStaticOptionalInt32Parameter<Count=1,ExtraParameter=2>.NestedType.StaticProperty1
+#endif
+
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/build.bat b/tests/fsharp/typeProviders/helloWorldCSharp/build.bat
new file mode 100644
index 0000000..2010aa0
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorldCSharp/build.bat
@@ -0,0 +1,40 @@
+rem @if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+if EXIST magic.dll del magic.dll
+if errorlevel 1 goto :Error
+
+%FSC% --out:magic.dll -a magic.fs --keyfile:magic.snk
+if errorlevel 1 goto :Error
+
+REM == If we are running this test on a lab machine, we may not be running from an elev cmd prompt
+REM == In that case, ADMIN_PIPE is set to the tool to invoke the command elevated.
+IF DEFINED ADMIN_PIPE %ADMIN_PIPE% %GACUTIL% /if magic.dll
+if errorlevel 1 goto :Error
+
+if EXIST provider.dll del provider.dll
+if ERRORLEVEL 1 goto :Error
+
+%CSC% /out:provider.dll /target:library /r:"%FSCOREDLLPATH%" /r:magic.dll provider.cs
+if ERRORLEVEL 1 goto :Error
+
+%GACUTIL% /if magic.dll
+
+"%FSC%" %fsc_flags% /debug+ /r:provider.dll /optimize- test.fsx
+if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs b/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs
new file mode 100644
index 0000000..16dc55f
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorldCSharp/magic.fs
@@ -0,0 +1,480 @@
+
+namespace FSharp.TypeMagic 
+open System
+open System.Text
+open System.Reflection
+open System.Linq
+open System.Collections.Generic
+open Microsoft.FSharp.Core.CompilerServices
+
+module Formatting = 
+    let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition()
+    let rec formatObject (o:obj) = 
+        if o = null then "null"
+        else
+            let typ = o.GetType()
+            if typ.IsGenericType then 
+                let gt = typ.GetGenericTypeDefinition()
+                if genericSomeType = gt then 
+                    let getter = typ.GetProperty("Value").GetGetMethod()
+                    let result = getter.Invoke(o,[||])
+                    formatObject result             
+                else
+                    o.ToString()
+            else 
+                o.ToString()
+
+
+type ReifiedInstance(obj:obj, hostedType:Type) = 
+    member __.GetReifiedType() = hostedType
+    member __.GetObject() = obj
+    override __.ToString() =
+        if obj = null then
+            "null:" + hostedType.Name
+        else 
+            let sb = StringBuilder()
+            for prop in hostedType.GetProperties() do
+                if prop.CanRead then
+                    let mi = prop.GetGetMethod()
+                    let result = Formatting.formatObject (mi.Invoke(obj,[||]))
+                    if sb.Length = 0 then
+                        sb.Append("{") |> ignore
+                    else
+                        sb.Append(", ") |> ignore
+                    sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore
+            if sb.Length <> 0 then sb.Append("}")|>ignore                  
+            (sb.ToString()) + ":" + hostedType.Name
+
+type ITypeStatistics =
+    abstract CallsToGetMembers : int
+
+type ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = 
+    inherit ConstructorInfo()
+
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+
+    override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags"
+    override this.GetParameters() = [||]
+    override this.MethodHandle = failwith "not implemented MethodHandle"
+    override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName
+    override this.Name = 
+        if this.IsStatic then ".cctor"
+        else ".ctor"
+    override this.DeclaringType = declaringType
+    override this.ReflectedType = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType, ``inherit``) = true
+
+[<RequireQualifiedAccess>]
+type TypeContainer =
+|   Namespace of System.Reflection.Module * string // namespace
+|   Type of System.Type
+
+type TypeImpl(container:TypeContainer, 
+                       className,
+                       baseType,
+                       members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array,
+                       getCustomAttributes,
+                       ?invokeMember,
+                       ?attributes,?extras:obj) as this= 
+    inherit Type()
+    
+
+    // Validate
+    do
+        match container with
+        |   TypeContainer.Namespace (``module``, rootNamespace) ->
+                if ``module`` = null then failwith "Null modules not allowed"
+                if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace"
+        |   TypeContainer.Type _ -> ()
+    
+    let ``module`` =
+        match container with
+        |   TypeContainer.Namespace (m, _) -> m
+        |   TypeContainer.Type st -> st.Module
+    
+    // Statistics
+    let mutable callsToGetMembers = 0
+    let rootNamespace =
+        match container with
+        |   TypeContainer.Namespace (_,rootNamespace) -> rootNamespace
+        |   TypeContainer.Type st -> st.Namespace
+
+    // Other state
+    let RootNamespace = rootNamespace
+    let ClassName = className
+
+    let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) =
+            let matches = 
+                this.GetMethods(invokeAttr) 
+                |> Array.filter(fun m->m.Name = name) 
+                |> List.ofArray
+            match matches with 
+            | [oneMatch] -> oneMatch.Invoke(target,args)
+            | [] -> failwith (sprintf "Found no method named '%s'." name)
+            | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name)
+                    
+    let mutable invokeMember = 
+        match invokeMember with 
+        | Some(invokeMember) -> invokeMember
+        | None -> defaultInvokeMembers
+
+    /// Replace the default InvokeMember method.
+    member this.ReplaceInvokeMember(newInvokeMember) =        
+        invokeMember <- newInvokeMember
+       
+    // Members of Type and parents
+    override this.GUID : Guid= failwith "Not implemented GUID"
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj =
+        invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters)
+    override this.Assembly : Assembly = ``module``.Assembly
+    override this.FullName : string = 
+        match container with
+        | TypeContainer.Type declaringType -> declaringType.FullName+"+"+ClassName
+        | TypeContainer.Namespace (_,``namespace``) -> 
+            match ``namespace`` with
+            | null -> ClassName
+            | _ -> ``namespace``+"."+ClassName
+    override this.Namespace : string = RootNamespace
+    override this.AssemblyQualifiedName : string = failwith "Not implemented"
+    override this.BaseType : Type = baseType
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = 
+        ConstructorImpl(this) :> ConstructorInfo
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= 
+        [| for m in members this bindingAttr MemberTypes.Constructor None do
+            if m.MemberType = MemberTypes.Constructor then
+                yield downcast m |]
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= 
+        let result = 
+            [ for m in members this bindingAttr MemberTypes.Method (Some name) do
+                if m.MemberType = MemberTypes.Method && m.Name = name then
+                    yield  m ]
+        match result with 
+        | [] -> null
+        | [one] -> downcast one
+        | several -> 
+            System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution")
+            downcast (List.head several)
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m)        
+
+    override this.GetField(name, bindingAttr) : FieldInfo = 
+        let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] 
+        if fields.Length > 0 then downcast fields.[0] else null
+
+    override this.GetFields(bindingAttr) : FieldInfo[] = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] 
+
+    override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase)
+    override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces()
+    override this.GetEvent(name, bindingAttr) = 
+        let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) 
+        if events.Length > 0 then downcast events.[0] else null
+    override this.GetEvents(bindingAttr) = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |]
+    
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = 
+        if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl"
+        if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl"
+        if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl"
+        let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) 
+        if props.Length > 0 then
+            downcast props.[0]
+        else
+            null
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |]
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || 
+                                                            // Allow 'fake' nested types that are actually real .NET types
+                                                            m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m)
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = 
+        let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr)
+        match nt.Length with
+        | 0 -> null
+        | 1 -> downcast nt.[0]
+        | _ -> failwith (sprintf "There is more than one nested type called %s" name)
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = 
+        let thisMembers = members (downcast this) bindingAttr MemberTypes.All None
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )]
+        else thisMembers
+    override this.GetAttributeFlagsImpl() : TypeAttributes = 
+        let defaultAttributes = 
+            (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| 
+            TypeAttributes.Class ||| 
+            TypeAttributes.Sealed |||
+            enum (int32 TypeProviderTypeAttributes.IsErased)
+        defaultArg attributes defaultAttributes
+    override this.IsArrayImpl() : bool = false
+    override this.IsByRefImpl() : bool = false
+    override this.IsPointerImpl() : bool= false
+    override this.IsPrimitiveImpl() : bool= false
+    override this.IsCOMObjectImpl() : bool= false
+    override this.GetElementType() : Type= failwith "Not implemented GetElementType" 
+    override this.HasElementTypeImpl() : bool= false
+    override this.UnderlyingSystemType : Type = typeof<System.Type>
+    override this.Name : string = ClassName
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"        
+    override this.Module : Module = ``module``
+    override this.DeclaringType = 
+        match container with
+        | TypeContainer.Type (declaringType)->declaringType
+        | TypeContainer.Namespace _ -> null
+    override this.MemberType : MemberTypes =
+        if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo      
+    override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode()
+    override this.Equals(that:obj) = 
+        match that with
+        | null -> false
+        | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0
+        | _ -> false
+    override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = 
+        let mt = 
+            if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then 
+                mt ||| MemberTypes.TypeInfo
+            else
+                mt
+        let thisMember : MemberInfo array = 
+            members this bindingAttr mt (Some name)
+                |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name)
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMember;this.BaseType.GetMember(name,mt,bindingAttr)]
+        else
+            thisMember
+    override this.GetGenericArguments() = [||]
+    override this.ToString() = 
+        this.FullName
+
+    member this.Extras = extras
+    interface ITypeStatistics with
+        override this.CallsToGetMembers = callsToGetMembers        
+    
+and PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = 
+    inherit System.Reflection.PropertyInfo()
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+    override this.PropertyType : Type= propertyType
+    override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue"
+    override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors"
+    override this.GetGetMethod(nonPublic: bool) : MethodInfo = 
+        match propertyGetter with
+        | Some(propertyGetter) -> propertyGetter
+        | None -> null
+    override this.GetSetMethod(nonPublic: bool) : MethodInfo = 
+        match propertySetter with
+        | Some(propertySetter) -> propertySetter
+        | None -> null
+    override this.GetIndexParameters() : ParameterInfo []= [||]
+    override this.Attributes : PropertyAttributes = PropertyAttributes.None
+    override this.CanRead : bool= propertyGetter.IsSome
+    override this.CanWrite : bool = propertySetter.IsSome
+    override this.GetValue(obj: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : obj= failwith "Not implemented GetValue"
+    override this.Name : string= propertyName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"
+    override this.MemberType : MemberTypes = MemberTypes.Property
+    
+and MethodInfoImpl(declaringType,
+                             methodName,
+                             returnType,
+                             getCustomAttributes,
+                             attributes,
+                             invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj,
+                             parameters) = 
+    inherit System.Reflection.MethodInfo()
+
+    override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes"
+    override this.GetBaseDefinition() : MethodInfo= failwith "Not implemented GetBaseDefinition"
+    override this.GetParameters() : ParameterInfo []= parameters
+    override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags"
+    override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle"
+    override this.Attributes : MethodAttributes = attributes
+    override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        invoke(obj,invokeAttr,binder,parameters,culture)
+    override this.Name : string = methodName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true
+    override this.MemberType : MemberTypes = MemberTypes.Method
+    override this.CallingConvention = 
+        let mutable cc = CallingConventions.Standard
+        if not(this.IsStatic) then 
+            cc <- cc ||| CallingConventions.HasThis
+        cc
+    override this.ReturnType = returnType
+    override this.ReturnParameter = null 
+    override this.ToString() = 
+        "Method " + this.Name
+
+type ParameterInfoImpl(name:string,parameterType:Type) = 
+    inherit System.Reflection.ParameterInfo()
+    override this.Name = name
+    override this.ParameterType = parameterType
+    
+module Flags = 
+    let combineWhenOptionTrue optionalFlag append original =
+        match optionalFlag with 
+        | Some(true) -> original ||| append
+        | _ -> original
+        
+[<Sealed>]
+type TypeBuilder = 
+        
+   
+    static member CreateType(container,className,?baseType,?members,?getProperty,?getCustomAttributes,?extras) : Type = 
+        let baseType = 
+            match baseType with
+            | Some(baseType) -> baseType
+            | None -> typeof<obj>
+       
+        let members = 
+            match members with 
+            | Some(members) -> members 
+            | _ -> fun _ _ _ _ -> [||]
+                        
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes) -> getCustomAttributes
+            | None -> fun _ -> [||]          
+        
+        let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras)
+                            
+        upcast result                            
+
+    static member CreateSimpleType(container,className,?baseType,?members,?getCustomAttributes) : Type = 
+        let members = defaultArg members (lazy [| |])
+        let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = 
+            match nameOption with
+            | None -> members.Force()
+            | Some name -> members.Force() |> Array.filter(fun m->m.Name=name)
+
+        TypeBuilder.CreateType(container, className, ?baseType=baseType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes)
+    
+    static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = 
+        let attributes = MethodAttributes.Public
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static 
+        let miGetter = 
+            match getInvoke with
+            | Some(getInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                match getterGetCustomAttributes with
+                | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic))
+                | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic))
+            | None -> None
+        let miSetter = 
+            match setInvoke with
+            | Some(setInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, 
+                                                  typeof<System.Void>, 
+                                                  attributes = attributes, 
+                                                  parameters=[|TypeBuilder.CreateParameter("value",propertyType)|],
+                                                  invoke=setInvoke, 
+                                                  ?isStatic=isStatic))
+            | None -> None
+        match miGetter,miSetter with
+        | Some(miGetter),None-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter,getCustomAttributes=getCustomAttributes)
+        | None,Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | Some(miGetter),Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | None,None -> failwith "Property must have a getter or setter"
+
+    // A synthetic property is one without callable "invoke" methods
+    static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = 
+        let getter = defaultArg getter true
+        let setter = defaultArg setter false
+        if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter"
+        let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+
+        TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) 
+    
+    static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let attributes = 
+            match attributes with 
+            | Some(attributes) -> attributes 
+            | None -> MethodAttributes.Public 
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static             
+
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes)->getCustomAttributes
+            | None -> fun _ -> [||]    
+
+        let invoke = 
+            match invoke with
+            | Some(invoke)->invoke
+            | None -> fun _ -> failwith "No invoke for this method."             
+            
+        let parameters = 
+            match parameters with 
+            | Some(parameters) -> parameters 
+            | None -> [||]
+            
+        upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters)
+
+
+    // A synthetic method is one without a callable "invoke" method
+    static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+        TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) 
+
+    static member CreateParameter(name:string,parameterType:Type) = upcast ParameterInfoImpl(name,parameterType)
+    static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes)
+    
+    static member MemberInfosOfProperty(property:PropertyInfo) =
+        [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo
+          if property.CanWrite then yield property.GetSetMethod() :> MemberInfo
+          yield property :> MemberInfo ]
+
+
+    static member JoinPropertiesIntoMemberInfos(properties:PropertyInfo seq) =
+        // CHANGE TO THIS (though it reorders - does that matter?)
+        //    [| for property in properties do yield! MemberInfosOfProperty property |]
+        
+        let properties = properties |> List.ofSeq
+        let accessMethods : MemberInfo list = [for property in properties do 
+                                                if property.CanRead then yield property.GetGetMethod() :> MemberInfo
+                                                if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] 
+
+        let properties : MemberInfo list = properties |> List.map(fun f->upcast f)
+        [accessMethods;properties] |> List.concat |> List.toArray
+
+    static member CacheMembers f = 
+        let cache = ref None
+        fun this _bindingAttr _kind _nmOpt ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f this in cache := Some res; res
+
+    static member CacheWithArg f = 
+        let cache = ref None
+        fun x ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f x in cache := Some res; res
+
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/magic.snk b/tests/fsharp/typeProviders/helloWorldCSharp/magic.snk
new file mode 100644
index 0000000..5fbfc98
Binary files /dev/null and b/tests/fsharp/typeProviders/helloWorldCSharp/magic.snk differ
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/provider.cs b/tests/fsharp/typeProviders/helloWorldCSharp/provider.cs
new file mode 100644
index 0000000..4b4a230
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorldCSharp/provider.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Linq.Expressions;
+using System.Reflection;
+using Microsoft.FSharp.Core.CompilerServices;
+using System.Collections.Generic;
+using FSharp.TypeMagic;
+
+[assembly: TypeProviderAssembly]
+namespace Provider
+{
+
+    [TypeProvider]
+    public class Provider : ITypeProvider, IProvidedNamespace
+    {
+        void IDisposable.Dispose()
+        {
+        }
+        Type helloWorldType;
+        public Provider()
+        {
+            System.Console.WriteLine("Creating provider...");
+            var thisAssembly = typeof(Provider).Assembly;
+            var modul = thisAssembly.GetModules()[0];
+            var rootNamespace = "FSharp.HelloWorld";
+            var container = TypeContainer.NewNamespace(modul, rootNamespace);
+            helloWorldType = TypeBuilder.CreateSimpleType(container, "HelloWorldType", null, null, null);
+
+        }
+
+
+        string IProvidedNamespace.NamespaceName { get { return "FSharp.HelloWorld"; } }
+
+        Type[] IProvidedNamespace.GetTypes() { return new Type[] { helloWorldType }; }
+
+        Type IProvidedNamespace.ResolveTypeName(string typeBaseName) { if (typeBaseName == "HelloWorldType") return helloWorldType; else return null; }
+
+        IProvidedNamespace[] ITypeProvider.GetNamespaces() { return new IProvidedNamespace[] { this }; }
+
+        IProvidedNamespace[] IProvidedNamespace.GetNestedNamespaces() { return new IProvidedNamespace[] { }; }
+
+        ParameterInfo[] ITypeProvider.GetStaticParameters(Type typeWithoutArguments) { return new ParameterInfo[] { }; }
+
+        Type ITypeProvider.ApplyStaticArguments(Type typeWithoutArguments, string[] typeNameWithArguments, object[] staticArguments) { return typeWithoutArguments; }
+
+        Microsoft.FSharp.Quotations.FSharpExpr ITypeProvider.GetInvokerExpression(MethodBase syntheticMethodBase, Microsoft.FSharp.Quotations.FSharpExpr[] parameterExpressions)
+        {
+            if (!syntheticMethodBase.Name.StartsWith("get_"))
+            {
+                throw (new Exception("expected syntheticMethodBase to be a property getter, with name starting with \"get_\""));
+            }
+            // trim off the "get_"
+            var propertyName = syntheticMethodBase.Name.Substring(4);
+            var syntheticMethodBase2 = syntheticMethodBase as MethodInfo;
+            var getClassInstancesByName = (typeof(Provider)).GetMethod("GetPropertyByName", BindingFlags.Static | BindingFlags.Public).MakeGenericMethod(new Type[] { syntheticMethodBase2.ReturnType });
+            return Microsoft.FSharp.Quotations.FSharpExpr.Call(getClassInstancesByName, Microsoft.FSharp.Collections.ListModule.OfArray (new Microsoft.FSharp.Quotations.FSharpExpr[] { Microsoft.FSharp.Quotations.FSharpExpr.Value(propertyName) }));
+        }
+
+        public event System.EventHandler Invalidate;
+        public byte[] GetGeneratedAssemblyContents(Assembly assembly) { throw (new Exception("GetGeneratedAssemblyContents - only erased types were provided!!")); }
+
+    }
+}
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/run.bat b/tests/fsharp/typeProviders/helloWorldCSharp/run.bat
new file mode 100644
index 0000000..cac4440
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorldCSharp/run.bat
@@ -0,0 +1,21 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+"%PEVERIFY%" magic.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" provider.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%PEVERIFY%" test.exe
+ at if ERRORLEVEL 1 goto Error
+
+test.exe
+ at if ERRORLEVEL 1 goto Error
+
+endlocal
+exit /b 0
diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx
new file mode 100644
index 0000000..0e71778
--- /dev/null
+++ b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx
@@ -0,0 +1,43 @@
+#r "provider.dll"
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s+": YES") 
+  else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+
+
+type T1 = FSharp.HelloWorld.HelloWorldType
+
+let f (x: FSharp.HelloWorld.HelloWorldType) =  x
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.bslpp b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.bslpp
new file mode 100644
index 0000000..14bf3ba
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.bslpp
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_ConstructorThrows.fsx(2,1,2,50): parse error FS3053: The type provider 'Provider.EvilProviderConstructorThrows' reported an error: The type provider constructor has thrown an exception: Kaboom
+
+EVIL_PROVIDER_ConstructorThrows.fsx(2,1,2,50): parse error FS3005: Referenced assembly '<ASSEMBLY>' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.fsx
new file mode 100644
index 0000000..2e0e25a
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ConstructorThrows.fsx
@@ -0,0 +1,4 @@
+
+#r "provider_EVIL_PROVIDER_ConstructorThrows.dll"
+
+let x = 1
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.bslpp b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.bslpp
new file mode 100644
index 0000000..94de885
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.bslpp
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_DoesNotHaveConstructor.fsx(2,1,2,55): parse error FS3032: The type provider 'Provider.EvilProviderDoesNotHaveConstructor' reported an error: The type provider does not have a valid constructor. A constructor taking either no arguments or one argument of type 'TypeProviderConfig' was expected.
+
+EVIL_PROVIDER_DoesNotHaveConstructor.fsx(2,1,2,55): parse error FS3005: Referenced assembly '<ASSEMBLY>' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.fsx
new file mode 100644
index 0000000..b2a6ad5
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.fsx
@@ -0,0 +1,5 @@
+
+#r "provider_EVIL_PROVIDER_DoesNotHaveConstructor.dll"
+
+open FSharp.EvilProviderDoesNotHaveConstructor
+let x = 1
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.vsbslpp b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.vsbslpp
new file mode 100644
index 0000000..7870289
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_DoesNotHaveConstructor.vsbslpp
@@ -0,0 +1,6 @@
+
+EVIL_PROVIDER_DoesNotHaveConstructor.fsx(2,1,2,55): parse error FS3032: The type provider 'Provider.EvilProviderDoesNotHaveConstructor' reported an error: The type provider does not have a valid constructor. A constructor taking either no arguments or one argument of type 'TypeProviderConfig' was expected.
+
+EVIL_PROVIDER_DoesNotHaveConstructor.fsx(2,1,2,55): parse error FS3005: Referenced assembly '<ASSEMBLY>' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
+
+EVIL_PROVIDER_DoesNotHaveConstructor.fsx(4,13,4,47): typecheck error FS0039: The namespace 'EvilProviderDoesNotHaveConstructor' is not defined
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl
new file mode 100644
index 0000000..711a55c
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.bsl
@@ -0,0 +1,2 @@
+
+EVIL_PROVIDER_GetInvokerExpression_Exception.fsx(7,9,7,80): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionRaisesException' reported an error in the context of provided type 'FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType', member 'get_Foo'. The error: deliberate error for testing purposes
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.fsx
new file mode 100644
index 0000000..aa31fbc
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Exception.fsx
@@ -0,0 +1,7 @@
+
+#r "provider_EVIL_PROVIDER_GetInvokerExpression_Exception.dll"
+
+open FSharp.EvilProviderWhereGetInvokerExpressionRaisesException
+
+// It is enough to name the type to expose the validation check
+let x = FSharp.EvilProviderWhereGetInvokerExpressionRaisesException.TheType.Foo
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl
new file mode 100644
index 0000000..b2fc037
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.bsl
@@ -0,0 +1,2 @@
+
+EVIL_PROVIDER_GetInvokerExpression_Null.fsx(7,9,7,76): typecheck error FS3056: Type provider 'Provider.EvilProviderWhereApplyGetInvokerExpressionReturnsNull' returned null from GetInvokerExpression.
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.fsx
new file mode 100644
index 0000000..6aac115
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetInvokerExpression_Null.fsx
@@ -0,0 +1,7 @@
+
+#r "provider_EVIL_PROVIDER_GetInvokerExpression_Null.dll"
+
+open FSharp.EvilProviderWhereGetInvokerExpressionReturnsNull
+
+// It is enough to name the type to expose the validation check
+let x = FSharp.EvilProviderWhereGetInvokerExpressionReturnsNull.TheType.Foo
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.bsl
new file mode 100644
index 0000000..e69faf0
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetNamespaces_Exception.fsx(2,1,2,56): parse error FS3033: The type provider 'Provider.EvilProviderWhereGetNamespacesRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_GetNamespaces_Exception.fsx(2,1,2,56): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.fsx
new file mode 100644
index 0000000..3da8aad
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Exception.fsx
@@ -0,0 +1,4 @@
+
+#r "provider_EVIL_PROVIDER_GetNamespaces_Exception.dll"
+
+let x = 1
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.bsl
new file mode 100644
index 0000000..22bf31c
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetNamespaces_Null.fsx(2,1,2,51): parse error FS3051: The type provider 'Provider.EvilProviderWhereGetNamespacesReturnsNull' reported an error: The type provider returned 'null', which is not a valid return value from 'GetNamespaces'
+
+EVIL_PROVIDER_GetNamespaces_Null.fsx(2,1,2,51): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.fsx
new file mode 100644
index 0000000..0bbc494
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNamespaces_Null.fsx
@@ -0,0 +1,4 @@
+
+#r "provider_EVIL_PROVIDER_GetNamespaces_Null.dll"
+
+let x = 1
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.bsl
new file mode 100644
index 0000000..2cbc65c
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx(2,1,2,62): parse error FS3033: The type provider 'Provider.EvilProviderWhereGetNestedNamespacesRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx(2,1,2,62): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx
new file mode 100644
index 0000000..a708686
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Exception.fsx
@@ -0,0 +1,5 @@
+
+#r "provider_EVIL_PROVIDER_GetNestedNamespaces_Exception.dll"
+
+open FSharp.EvilProviderWhereGetNestedNamespacesRaisesException
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Null.fsx
new file mode 100644
index 0000000..53e143d
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetNestedNamespaces_Null.fsx
@@ -0,0 +1,5 @@
+
+#r "provider_EVIL_PROVIDER_GetNestedNamespaces_Null.dll"
+
+open FSharp.EvilProviderWhereGetNestedNamespacesReturnsNull
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.bsl
new file mode 100644
index 0000000..2d6ed1a
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetStaticParameters_Exception.fsx(7,18,7,84): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereGetStaticParametersRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_GetStaticParameters_Exception.fsx(7,18,7,84): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereGetStaticParametersRaisesException' reported an error: deliberate error for testing purposes
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.fsx
new file mode 100644
index 0000000..5319d0d
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Exception.fsx
@@ -0,0 +1,7 @@
+#r "provider_EVIL_PROVIDER_GetStaticParameters_Exception.dll"
+
+
+open FSharp.EvilProviderWhereGetStaticParametersRaisesException
+
+// It is enough to name the type to expose the validation check
+type Negative1 = FSharp.EvilProviderWhereGetStaticParametersRaisesException.TheType
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.bsl
new file mode 100644
index 0000000..6251ecb
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetStaticParameters_Null.fsx(7,18,7,80): typecheck error FS3051: The type provider 'Provider.EvilProviderWhereGetStaticParametersReturnsNull' reported an error: The type provider returned 'null', which is not a valid return value from 'GetStaticParameters'
+
+EVIL_PROVIDER_GetStaticParameters_Null.fsx(7,18,7,80): typecheck error FS3051: The type provider 'Provider.EvilProviderWhereGetStaticParametersReturnsNull' reported an error: The type provider returned 'null', which is not a valid return value from 'GetStaticParameters'
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.fsx
new file mode 100644
index 0000000..7cedb31
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetStaticParameters_Null.fsx
@@ -0,0 +1,7 @@
+#r "provider_EVIL_PROVIDER_GetStaticParameters_Null.dll"
+
+
+open FSharp.EvilProviderWhereGetStaticParametersReturnsNull
+
+// It is enough to name the type to expose the validation check
+type Negative1 = FSharp.EvilProviderWhereGetStaticParametersReturnsNull.TheType
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.bsl
new file mode 100644
index 0000000..8f728f1
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetTypes_Exception.fsx(2,1,2,51): parse error FS3033: The type provider 'Provider.EvilProviderWhereGetTypesRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_GetTypes_Exception.fsx(2,1,2,51): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.fsx
new file mode 100644
index 0000000..cecaec3
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Exception.fsx
@@ -0,0 +1,4 @@
+
+#r "provider_EVIL_PROVIDER_GetTypes_Exception.dll"
+
+open FSharp.EvilProviderWhereGetTypesRaisesException
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.bsl
new file mode 100644
index 0000000..d87da23
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_GetTypes_Null.fsx(2,1,2,46): parse error FS3051: The type provider 'Provider.EvilProviderWhereGetTypesReturnsNull' reported an error: The type provider returned 'null', which is not a valid return value from 'GetTypes'
+
+EVIL_PROVIDER_GetTypes_Null.fsx(2,1,2,46): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.fsx
new file mode 100644
index 0000000..8ea60ea
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_GetTypes_Null.fsx
@@ -0,0 +1,4 @@
+
+#r "provider_EVIL_PROVIDER_GetTypes_Null.dll"
+
+open FSharp.EvilProviderWhereGetTypesReturnsNull
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.bsl
new file mode 100644
index 0000000..ee96b12
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_NamespaceName_Empty.fsx(1,1,1,52): parse error FS3007: Empty namespace found from the type provider 'EvilProviderWhereNamespaceNameReturnsEmpty'. Use 'null' for the global namespace.
+
+EVIL_PROVIDER_NamespaceName_Empty.fsx(1,1,1,52): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.fsx
new file mode 100644
index 0000000..24bd031
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Empty.fsx
@@ -0,0 +1,4 @@
+#r "provider_EVIL_PROVIDER_NamespaceName_Empty.dll"
+
+open FSharp.EvilProviderWhereNamespaceNameReturnsEmpty
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.bsl
new file mode 100644
index 0000000..afb4e69
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_NamespaceName_Exception.fsx(1,1,1,56): parse error FS3033: The type provider 'Provider.EvilProviderWhereNamespaceNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_NamespaceName_Exception.fsx(1,1,1,56): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.fsx
new file mode 100644
index 0000000..3c6562d
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Exception.fsx
@@ -0,0 +1,4 @@
+#r "provider_EVIL_PROVIDER_NamespaceName_Exception.dll"
+
+open FSharp.EvilProviderWhereNamespaceNameRaisesException
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Null.fsx
new file mode 100644
index 0000000..e074e19
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_NamespaceName_Null.fsx
@@ -0,0 +1,4 @@
+#r "provider_EVIL_PROVIDER_NamespaceName_Null.dll"
+
+open FSharp.EvilProviderWhereNamespaceNameReturnsNull
+
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.bsl
new file mode 100644
index 0000000..d5c920e
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.bsl
@@ -0,0 +1,20 @@
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS0039: The type 'SomeNameThatDoesntExist' is not defined
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS3033: The type provider 'Provider.EvilProviderWhereResolveTypeNameRaisesException' reported an error: deliberate error for testing purposes
+
+EVIL_PROVIDER_ResolveTypeName_Exception.fsx(7,73,7,96): typecheck error FS0039: The type 'SomeNameThatDoesntExist' is not defined
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.fsx
new file mode 100644
index 0000000..288ffd9
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Exception.fsx
@@ -0,0 +1,7 @@
+
+#r "provider_EVIL_PROVIDER_ResolveTypeName_Exception.dll"
+
+open FSharp.EvilProviderWhereResolveTypeNameRaisesException
+
+// It is enough to try to resolve a type to expose the validation check
+type Negative1 = FSharp.EvilProviderWhereResolveTypeNameRaisesException.SomeNameThatDoesntExist
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.bsl
new file mode 100644
index 0000000..03beeb1
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.bsl
@@ -0,0 +1,4 @@
+
+EVIL_PROVIDER_ResolveTypeName_Null.fsx(7,69,7,92): typecheck error FS0039: The type 'SomeNameThatDoesntExist' is not defined
+
+EVIL_PROVIDER_ResolveTypeName_Null.fsx(7,69,7,92): typecheck error FS0039: The type 'SomeNameThatDoesntExist' is not defined
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.fsx
new file mode 100644
index 0000000..9349344
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ResolveTypeName_Null.fsx
@@ -0,0 +1,7 @@
+
+#r "provider_EVIL_PROVIDER_ResolveTypeName_Null.dll"
+
+open FSharp.EvilProviderWhereResolveTypeNameReturnsNull
+
+// It is enough to try to resolve a type to expose the validation check
+type Negative1 = FSharp.EvilProviderWhereResolveTypeNameReturnsNull.SomeNameThatDoesntExist
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.bsl b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.bsl
new file mode 100644
index 0000000..df5cd1d
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.bsl
@@ -0,0 +1,8 @@
+
+EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(6,39,6,145): typecheck error FS3057: The type provider 'Provider.EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments' returned an invalid type from 'ApplyStaticArguments'. A type with name 'TheContainerType,Tag="J"' was expected, but a type with name 'TheContainerType' was returned.
+
+EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(6,39,6,145): typecheck error FS3057: The type provider 'Provider.EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments' returned an invalid type from 'ApplyStaticArguments'. A type with name 'TheContainerType,Tag="J"' was expected, but a type with name 'TheContainerType' was returned.
+
+EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(8,41,8,58): typecheck error FS0039: The type 'TheGeneratedTypeJ' is not defined
+
+EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx(8,79,8,96): typecheck error FS0039: The field, constructor or member 'TheGeneratedTypeJ' is not defined
diff --git a/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx
new file mode 100644
index 0000000..f71ba80
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.fsx
@@ -0,0 +1,9 @@
+#r "provider_EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments.dll"
+
+
+module GenerativeTypesWithStaticParameters = 
+    
+    type internal TheContainerTypeJ = FSharp.EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments.TheContainerType<"J">
+
+    let internal v1 : TheContainerTypeJ.TheGeneratedTypeJ = TheContainerTypeJ.TheGeneratedTypeJ()
+
diff --git a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl
new file mode 100644
index 0000000..1806dc3
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.bsl
@@ -0,0 +1,2 @@
+
+InvalidInvokerExpression.fsx(4,9,4,79): typecheck error FS3056: Type provider 'Provider.GoodProviderForNegativeTypeTests1' returned null from GetInvokerExpression.
diff --git a/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.fsx b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.fsx
new file mode 100644
index 0000000..055a8d3
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/InvalidInvokerExpression.fsx
@@ -0,0 +1,4 @@
+#r "provider.dll"
+
+let i = FSharp.GoodProviderForNegativeTypeTests1.TheType.InvalidInvokerExpression
+let j = FSharp.GoodProviderForNegativeTypeTests1.TheType.NullInvokerExpression
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/negTests/MostBasicProvider.fsx b/tests/fsharp/typeProviders/negTests/MostBasicProvider.fsx
new file mode 100644
index 0000000..6684d0f
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/MostBasicProvider.fsx
@@ -0,0 +1,138 @@
+open System
+open System.Reflection
+
+//////////////////////////////////////////////////////
+
+type MostBasicTypeImpl(theModule : Module, rootNamespace, className, baseType) = 
+    inherit Type()
+
+    let NYI() = raise <| new NotImplementedException()
+    do
+        assert(theModule <> null)
+        assert(rootNamespace <> null)
+        assert(className <> null)
+        // baseType might be null
+
+    // Members of Type and parents
+    override this.GUID : Guid = 
+        NYI()
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], 
+                               culture: System.Globalization.CultureInfo, namedParameters: string []) : obj =
+        NYI()
+    override this.Assembly : Assembly = 
+        theModule.Assembly
+    override this.FullName : string = 
+        match rootNamespace with
+        | null -> className
+        | n -> n + "." + className
+    override this.Namespace : string = 
+        rootNamespace
+    override this.AssemblyQualifiedName : string = 
+        NYI()
+    override this.BaseType : Type = 
+        baseType
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = 
+        NYI()
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= 
+        [| |]
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= 
+        null
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = 
+        [| |]
+    override this.GetField(name, bindingAttr) : FieldInfo = 
+        null
+    override this.GetFields(bindingAttr) : FieldInfo[] = 
+        [| |] 
+    override this.GetInterface(name, ignoreCase) : Type = 
+        this.BaseType.GetInterface(name, ignoreCase)
+    override this.GetInterfaces() : Type[] = 
+        match this.BaseType with null -> [| |] | _ -> this.BaseType.GetInterfaces()
+    override this.GetEvent(name, bindingAttr) = 
+        null
+    override this.GetEvents(bindingAttr) = 
+        [| |]
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = 
+        null
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= 
+        [| |]
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = 
+        [| |]
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = 
+        null
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = 
+        [| |]
+    override this.GetAttributeFlagsImpl() : TypeAttributes =
+        TypeAttributes.Public ||| TypeAttributes.Class ||| TypeAttributes.Sealed
+    override this.IsArrayImpl() : bool = 
+        false
+    override this.IsByRefImpl() : bool = 
+        false
+    override this.IsPointerImpl() : bool = 
+        false
+    override this.IsPrimitiveImpl() : bool = 
+        false
+    override this.IsCOMObjectImpl() : bool = 
+        false
+    override this.GetElementType() : Type =
+        NYI()
+    override this.HasElementTypeImpl() : bool = 
+        false
+    override this.UnderlyingSystemType : Type = 
+        typeof<System.Type>
+    override this.Name : string = 
+        className
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = [| |] :> System.Collections.Generic.IList<_>
+
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool = 
+        NYI()
+    override this.Module : Module = 
+        theModule
+    override this.DeclaringType : Type = 
+        null
+    override this.MemberType : MemberTypes =
+        if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo      
+    override this.GetHashCode() : int = 
+        rootNamespace.GetHashCode() ^^^ className.GetHashCode()
+    override this.Equals(that:obj) : bool = 
+        match that with
+        | null -> false
+        | :? MostBasicTypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0
+        | _ -> false
+    override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) : MemberInfo[] = 
+        [| |]
+    override this.GetGenericArguments() : Type[] =
+        [| |]
+    override this.ToString() : string = 
+        this.FullName
+
+//////////////////////////////////////////////////////
+
+open Microsoft.FSharp.Core.CompilerServices
+
+[<assembly: TypeProviderAssembly>]
+do ()
+
+[<TypeProvider>]
+type MostBasicProvider() =
+    let modul = typeof<MostBasicProvider>.Assembly.GetModules().[0]
+    let namespaceName = "MyProvider"
+    let theType : Type = upcast new MostBasicTypeImpl(modul, namespaceName, "TheType", null)
+    let types = [|theType|]
+    let invalidation = new Event<System.EventHandler,_>()
+    interface IProvidedNamespace with
+        member this.GetNestedNamespaces() : IProvidedNamespace[] = [| |]
+        member this.NamespaceName : string = namespaceName
+        member this.GetTypes() : Type[] = types
+        member this.ResolveTypeName(s:string) : Type = match s with | "TheType" -> theType | _ -> null
+    interface ITypeProvider with
+        member this.GetNamespaces() : IProvidedNamespace[] = [| this |]
+        member this.GetStaticParameters(typeWithoutArguments:Type) : ParameterInfo[] = [| |]
+        member this.ApplyStaticArguments(typeWithoutArguments:Type, typeNameWithArguments:string[], staticArguments:obj[]) : Type = typeWithoutArguments
+        member this.GetInvokerExpression(mb,parameters) = failwith "GetInvokerExpression not implemented"
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+    interface IDisposable with
+        member __.Dispose() = ()
diff --git a/tests/fsharp/typeProviders/negTests/ProviderAttributeErrorConsume.bslpp b/tests/fsharp/typeProviders/negTests/ProviderAttributeErrorConsume.bslpp
new file mode 100644
index 0000000..59ee16d
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/ProviderAttributeErrorConsume.bslpp
@@ -0,0 +1,4 @@
+
+providerAttributeErrorConsume.fsx(1,1,1,48): parse error FS3031: The type provider '<ASSEMBLY>' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'Invalid.Assembly.Name' which cannot be loaded or doesn't exist. Could not load file or assembly '<URIPATH>Invalid.Assembly.Name.dll' or one of its dependencies. The system cannot find the file specified.
+
+providerAttributeErrorConsume.fsx(1,1,1,48): parse error FS3005: Referenced assembly '<ASSEMBLY>' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
diff --git a/tests/fsharp/typeProviders/negTests/ProviderAttribute_EmptyConsume.bslpp b/tests/fsharp/typeProviders/negTests/ProviderAttribute_EmptyConsume.bslpp
new file mode 100644
index 0000000..4906b66
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/ProviderAttribute_EmptyConsume.bslpp
@@ -0,0 +1,4 @@
+
+ProviderAttribute_EmptyConsume.fsx(1,1,1,49): parse error FS3065: Assembly '<ASSEMBLY>' hase TypeProviderAssembly attribute with invalid value ''. The value should be a valid assembly name
+
+ProviderAttribute_EmptyConsume.fsx(1,1,1,49): parse error FS3005: Referenced assembly '<ASSEMBLY>' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
diff --git a/tests/fsharp/typeProviders/negTests/TypeEvil.fs b/tests/fsharp/typeProviders/negTests/TypeEvil.fs
new file mode 100644
index 0000000..33a8b46
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/TypeEvil.fs
@@ -0,0 +1,538 @@
+
+namespace FSharp.TypeEvil
+open System
+open System.Text
+open System.Reflection
+open System.Linq
+open System.Collections.Generic
+open Microsoft.FSharp.Core.CompilerServices
+
+module internal Formatting = 
+    let genericSomeType = (Some 1).GetType().GetGenericTypeDefinition()
+    let rec formatObject (o:obj) = 
+        if o = null then "null"
+        else
+            let typ = o.GetType()
+            if typ.IsGenericType then 
+                let gt = typ.GetGenericTypeDefinition()
+                if genericSomeType = gt then 
+                    let getter = typ.GetProperty("Value").GetGetMethod()
+                    let result = getter.Invoke(o,[||])
+                    formatObject result             
+                else
+                    o.ToString()
+            else 
+                o.ToString()
+
+
+type internal ReifiedInstance(obj:obj, hostedType:Type) = 
+    member __.GetReifiedType() = hostedType
+    member __.GetObject() = obj
+    override __.ToString() =
+        if obj = null then
+            "null:" + hostedType.Name
+        else 
+            let sb = StringBuilder()
+            for prop in hostedType.GetProperties() do
+                if prop.CanRead then
+                    let mi = prop.GetGetMethod()
+                    let result = Formatting.formatObject (mi.Invoke(obj,[||]))
+                    if sb.Length = 0 then
+                        sb.Append("{") |> ignore
+                    else
+                        sb.Append(", ") |> ignore
+                    sb.AppendFormat("{0}={1}", prop.Name, result) |> ignore
+            if sb.Length <> 0 then sb.Append("}")|>ignore                  
+            (sb.ToString()) + ":" + hostedType.Name
+
+type internal ITypeStatistics =
+    abstract CallsToGetMembers : int
+
+type internal ConstructorImpl(declaringType, ?getCustomAttributes, ?invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj) = 
+    inherit ConstructorInfo()
+
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+
+    override this.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(null,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.Invoke(obj:obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        match invoke with 
+        | Some(invoke) -> invoke(obj,invokeAttr,binder,parameters,culture)
+        | None -> failwith "Invoke is not supported here."
+    override this.GetMethodImplementationFlags() = failwith "not implemented GetMethodImplementationFlags"
+    override this.GetParameters() = [||]
+    override this.MethodHandle = failwith "not implemented MethodHandle"
+    override this.Attributes = MethodAttributes.Public ||| MethodAttributes.RTSpecialName
+    override this.Name = 
+        if this.IsStatic then ".cctor"
+        else ".ctor"
+    override this.DeclaringType = declaringType
+    override this.ReflectedType = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType, ``inherit``) = true
+
+[<RequireQualifiedAccess>]
+type TypeContainer =
+|   Namespace of System.Reflection.Module * string // namespace
+|   Type of System.Type
+
+type internal TypeImpl(container:TypeContainer, 
+                       className,
+                       baseType,
+                       members : Type -> BindingFlags -> MemberTypes -> string option -> MemberInfo array,
+                       getCustomAttributes,
+                       ?invokeMember,
+                       ?attributes,?extras:obj) as this= 
+    inherit Type()
+    
+
+    // Validate
+    do
+        match container with
+        |   TypeContainer.Namespace (theModule, rootNamespace) ->
+                if theModule = null then failwith "Null modules not allowed"
+                if rootNamespace<>null && rootNamespace.Length=0 then failwith "Use 'null' for global namespace"
+        |   TypeContainer.Type _ -> ()
+    
+    let theModule =
+        match container with
+        |   TypeContainer.Namespace (m, _) -> m
+        |   TypeContainer.Type st -> st.Module
+    
+    // Statistics
+    let mutable callsToGetMembers = 0
+    let rootNamespace =
+        match container with
+        |   TypeContainer.Namespace (_,rootNamespace) -> rootNamespace
+        |   TypeContainer.Type st -> st.Namespace
+
+    // Other state
+    let attributes = 
+        let defaultAttributes = 
+            (if this.IsNested then TypeAttributes.NestedPublic else TypeAttributes.Public) ||| 
+            TypeAttributes.Class ||| 
+            TypeAttributes.Sealed |||
+            enum (int32 TypeProviderTypeAttributes.IsErased)
+        defaultArg attributes defaultAttributes
+
+    let defaultInvokeMembers(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) =
+        let matches = 
+            this.GetMethods(invokeAttr) 
+            |> Array.filter(fun m->m.Name = name) 
+            |> List.ofArray
+        match matches with 
+        | [oneMatch] -> oneMatch.Invoke(target,args)
+        | [] -> failwith (sprintf "Found no method named '%s'." name)
+        | _ -> failwith (sprintf "Found multiple overloads of method named '%s'." name)
+                    
+    let mutable invokeMember = 
+        match invokeMember with 
+        | Some(invokeMember) -> invokeMember
+        | None -> defaultInvokeMembers
+
+    /// Replace the default InvokeMember method.
+    member this.ReplaceInvokeMember(newInvokeMember) =        
+        invokeMember <- newInvokeMember
+       
+    // Members of Type and parents
+    override this.GUID : Guid= failwith "Not implemented GUID"
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj =
+        invokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters)
+    override this.Assembly : Assembly = theModule.Assembly
+    override this.FullName : string = 
+        match container with
+        | TypeContainer.Type declaringType -> declaringType.FullName+"+"+className
+        | TypeContainer.Namespace (_,``namespace``) -> 
+            match ``namespace`` with
+            | null -> className
+            | _ -> ``namespace``+"."+className
+    override this.Namespace : string = rootNamespace
+    override this.AssemblyQualifiedName : string = failwith "Not implemented"
+    override this.BaseType : Type = baseType
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo = 
+        ConstructorImpl(this) :> ConstructorInfo
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= 
+        [| for m in members this bindingAttr MemberTypes.Constructor None do
+            if m.MemberType = MemberTypes.Constructor then
+                yield downcast m |]
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= 
+        let result = 
+            [ for m in members this bindingAttr MemberTypes.Method (Some name) do
+                if m.MemberType = MemberTypes.Method && m.Name = name then
+                    yield  m ]
+        match result with 
+        | [] -> null
+        | [one] -> downcast one
+        | several -> 
+            System.Diagnostics.Debug.Assert(false, "TypeBuilder does not yet support overload resolution")
+            downcast (List.head several)
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Method) |> Array.map(fun m->downcast m)        
+
+    override this.GetField(name, bindingAttr) : FieldInfo = 
+        let fields = [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field && (name = null || m.Name = name) then yield m |] 
+        if fields.Length > 0 then downcast fields.[0] else null
+
+    override this.GetFields(bindingAttr) : FieldInfo[] = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Field then yield downcast m |] 
+
+    override this.GetInterface(name, ignoreCase) : Type = this.BaseType.GetInterface(name, ignoreCase)
+    override this.GetInterfaces() : Type[] = this.BaseType.GetInterfaces()
+    override this.GetEvent(name, bindingAttr) = 
+        let events = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Event && (name = null || m.Name = name)) 
+        if events.Length > 0 then downcast events.[0] else null
+    override this.GetEvents(bindingAttr) = 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Event then yield downcast m |]
+    
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo = 
+        if returnType <> null then failwith "Need to handle specified return type in GetPropertyImpl"
+        if types <> null then failwith "Need to handle specified parameter types in GetPropertyImpl"
+        if modifiers <> null then failwith "Need to handle specified modifiers in GetPropertyImpl"
+        let props = this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.Property && (name = null || m.Name = name)) 
+        if props.Length > 0 then
+            downcast props.[0]
+        else
+            null
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= 
+        [| for m in this.GetMembers(bindingAttr) do if m.MemberType = MemberTypes.Property then yield downcast m |]
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = 
+        this.GetMembers(bindingAttr) |> Array.filter(fun m->m.MemberType = MemberTypes.NestedType || 
+                                                            // Allow 'fake' nested types that are actually real .NET types
+                                                            m.MemberType = MemberTypes.TypeInfo) |> Array.map(fun m->downcast m)
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = 
+        let nt = this.GetMember(name, MemberTypes.NestedType ||| MemberTypes.TypeInfo, bindingAttr)
+        match nt.Length with
+        | 0 -> null
+        | 1 -> downcast nt.[0]
+        | _ -> failwith (sprintf "There is more than one nested type called %s" name)
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo [] = 
+        let thisMembers = members (downcast this) bindingAttr MemberTypes.All None
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMembers;this.BaseType.GetMembers(bindingAttr) |> Array.filter(fun m -> int (m.MemberType &&& MemberTypes.Constructor) = 0 )]
+        else thisMembers
+    override this.GetAttributeFlagsImpl() : TypeAttributes = attributes
+    override this.IsArrayImpl() : bool = false
+    override this.IsByRefImpl() : bool = false
+    override this.IsPointerImpl() : bool= false
+    override this.IsPrimitiveImpl() : bool= false
+    override this.IsCOMObjectImpl() : bool= false
+    override this.GetElementType() : Type= failwith "Not implemented GetElementType" 
+    override this.HasElementTypeImpl() : bool= false
+    override this.UnderlyingSystemType : Type = typeof<System.Type>
+    override this.Name : string = className
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"        
+    override this.Module : Module = theModule
+    override this.DeclaringType = 
+        match container with
+        | TypeContainer.Type (declaringType)->declaringType
+        | TypeContainer.Namespace _ -> null
+    override this.MemberType : MemberTypes =
+        if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo      
+    override this.GetHashCode() = rootNamespace.GetHashCode() ^^^ className.GetHashCode()
+    override this.Equals(that:obj) = 
+        match that with
+        | null -> false
+        | :? TypeImpl as ti -> String.CompareOrdinal(this.FullName, ti.FullName) = 0
+        | _ -> false
+    override this.GetMember(name:string,mt:MemberTypes,bindingAttr:BindingFlags) = 
+        let mt = 
+            if mt &&& MemberTypes.NestedType = MemberTypes.NestedType then 
+                mt ||| MemberTypes.TypeInfo
+            else
+                mt
+        let thisMember : MemberInfo array = 
+            members this bindingAttr mt (Some name)
+                |> Array.filter(fun m->0<>(int(m.MemberType &&& mt)) && m.Name = name)
+        if (bindingAttr &&& BindingFlags.FlattenHierarchy) = BindingFlags.FlattenHierarchy then
+            Array.concat [thisMember;this.BaseType.GetMember(name,mt,bindingAttr)]
+        else
+            thisMember
+    override this.GetGenericArguments() = [||]
+    override this.ToString() = 
+        this.FullName
+
+    member this.Extras = extras
+    interface ITypeStatistics with
+        override this.CallsToGetMembers = callsToGetMembers        
+    
+and internal PropertyInfoImpl(declaringType,propertyName,propertyType,getCustomAttributes,?propertyGetter,?propertySetter) = 
+    inherit System.Reflection.PropertyInfo()
+    let getCustomAttributes = 
+        match getCustomAttributes with
+        | Some(getCustomAttributes)->getCustomAttributes
+        | None -> fun _ -> [||]
+    override this.PropertyType : Type= propertyType
+    override this.SetValue(obj: obj, value: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : unit= failwith "Not implemented SetValue"
+    override this.GetAccessors(nonPublic: bool) : MethodInfo []= failwith "Not implemented GetAccessors"
+    override this.GetGetMethod(nonPublic: bool) : MethodInfo = 
+        match propertyGetter with
+        | Some(propertyGetter) -> propertyGetter
+        | None -> null
+    override this.GetSetMethod(nonPublic: bool) : MethodInfo = 
+        match propertySetter with
+        | Some(propertySetter) -> propertySetter
+        | None -> null
+    override this.GetIndexParameters() : ParameterInfo []= [||]
+    override this.Attributes : PropertyAttributes = PropertyAttributes.None
+    override this.CanRead : bool= propertyGetter.IsSome
+    override this.CanWrite : bool = propertySetter.IsSome
+    override this.GetValue(obj: obj, invokeAttr: BindingFlags, binder: Binder, index: obj [], culture: Globalization.CultureInfo) : obj= failwith "Not implemented GetValue"
+    override this.Name : string= propertyName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented IsDefined"
+    override this.MemberType : MemberTypes = MemberTypes.Property
+    
+and internal MethodInfoImpl(declaringType,
+                             methodName,
+                             returnType,
+                             getCustomAttributes,
+                             attributes,
+                             invoke : obj*BindingFlags*Binder*obj [] *Globalization.CultureInfo -> obj,
+                             parameters) = 
+    inherit System.Reflection.MethodInfo()
+
+    override this.ReturnTypeCustomAttributes= failwith "Not implemented ReturnTypeCustomAttributes"
+    override this.GetBaseDefinition() : MethodInfo= failwith "Not implemented GetBaseDefinition"
+    override this.GetParameters() : ParameterInfo []= parameters
+    override this.GetMethodImplementationFlags() : MethodImplAttributes= failwith "Not implemented GetMethodImplementationFlags"
+    override this.MethodHandle : RuntimeMethodHandle= failwith "Not implemented RuntimeMethodHandle"
+    override this.Attributes : MethodAttributes = attributes
+    override this.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj = 
+        invoke(obj,invokeAttr,binder,parameters,culture)
+    override this.Name : string = methodName
+    override this.DeclaringType : Type= declaringType
+    override this.ReflectedType : Type= failwith "Not implemented ReflectedType"
+    override this.GetCustomAttributes(``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributes(attributeType, ``inherit``) = failwith "not implemented ReflectedType"
+    override this.GetCustomAttributesData() = getCustomAttributes() :> IList<_>
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool=true
+    override this.MemberType : MemberTypes = MemberTypes.Method
+    override this.CallingConvention = 
+        let mutable cc = CallingConventions.Standard
+        if not(this.IsStatic) then 
+            cc <- cc ||| CallingConventions.HasThis
+        cc
+    override this.ReturnType = returnType
+    override this.ReturnParameter = null 
+    override this.ToString() = 
+        "Method " + this.Name
+
+type internal ParameterInfoImpl(name:string,parameterType:Type) = 
+    inherit System.Reflection.ParameterInfo()
+    override this.Name = name
+    override this.ParameterType = parameterType
+    
+module internal Flags = 
+    let combineWhenOptionTrue optionalFlag append original =
+        match optionalFlag with 
+        | Some(true) -> original ||| append
+        | _ -> original
+        
+[<Sealed>]
+type internal TypeBuilder = 
+        
+   
+    static member CreateType(container,className,?baseType,?declaringType,?members,?getProperty,?getCustomAttributes,?extras) : Type = 
+        let baseType = 
+            match baseType with
+            | Some(baseType) -> baseType
+            | None -> typeof<obj>
+       
+        let members = 
+            match members with 
+            | Some(members) -> members 
+            | _ -> fun _ _ _ _ -> [||]
+                        
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes) -> getCustomAttributes
+            | None -> fun _ -> [||]          
+        
+        let result = TypeImpl(container,className,baseType,members,getCustomAttributes,?extras=extras)
+                            
+        upcast result                            
+
+    static member CreateSimpleType(container,className,?baseType,?declaringType,?members,?getCustomAttributes) : Type = 
+        let members = defaultArg members (lazy [| |])
+        let getTypeMembers _declaringType _bindingFlags _memberTypes nameOption : MemberInfo[] = 
+            match nameOption with
+            | None -> members.Force()
+            | Some name -> members.Force() |> Array.filter(fun m->m.Name=name)
+
+        TypeBuilder.CreateType(container, className, ?baseType=baseType, ?declaringType=declaringType, members=getTypeMembers, ?getCustomAttributes=getCustomAttributes)
+    
+    static member CreateProperty(declaringType,propertyName,propertyType, ?isStatic, ?getInvoke, ?setInvoke, ?getCustomAttributes, ?getterGetCustomAttributes) : PropertyInfo = 
+        let attributes = MethodAttributes.Public
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static 
+        let miGetter = 
+            match getInvoke with
+            | Some(getInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                match getterGetCustomAttributes with
+                | Some(getCustomAttributes) -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, getCustomAttributes=getCustomAttributes, ?isStatic=isStatic))
+                | None -> Some(TypeBuilder.CreateMethod(declaringType, "get_"+propertyName, propertyType, attributes = attributes, invoke=getInvoke, ?isStatic=isStatic))
+            | None -> None
+        let miSetter = 
+            match setInvoke with
+            | Some(setInvoke) -> 
+                let attributes = attributes ||| MethodAttributes.SpecialName
+                Some(TypeBuilder.CreateMethod(declaringType, "set_"+propertyName, 
+                                                  typeof<System.Void>, 
+                                                  attributes = attributes, 
+                                                  parameters=[|TypeBuilder.CreateParameter("value",propertyType)|],
+                                                  invoke=setInvoke, 
+                                                  ?isStatic=isStatic))
+            | None -> None
+        match miGetter,miSetter with
+        | Some(miGetter),None-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter,getCustomAttributes=getCustomAttributes)
+        | None,Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | Some(miGetter),Some(miSetter)-> upcast PropertyInfoImpl(declaringType,propertyName, propertyType, propertyGetter=miGetter, propertySetter=miSetter,getCustomAttributes=getCustomAttributes)
+        | None,None -> failwith "Property must have a getter or setter"
+
+    // A synthetic property is one without callable "invoke" methods
+    static member CreateSyntheticProperty(declaringType, propertyName, propertyType, ?isStatic,?getter,?setter, ?getCustomAttributes, ?getterGetCustomAttributes) = 
+        let getter = defaultArg getter true
+        let setter = defaultArg setter false
+        if not getter && not setter then invalidArg "getter" "property must have either a getter or a setter"
+        let dummyGetInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+
+        TypeBuilder.CreateProperty(declaringType,propertyName,propertyType,?isStatic=isStatic,?getInvoke=(if getter then Some dummyGetInvoke else None), ?setInvoke=(if setter then Some dummyGetInvoke else None), ?getCustomAttributes=getCustomAttributes, ?getterGetCustomAttributes=getterGetCustomAttributes) 
+    
+    static member CreateMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let attributes = 
+            match attributes with 
+            | Some(attributes) -> attributes 
+            | None -> MethodAttributes.Public 
+        let attributes = attributes |> Flags.combineWhenOptionTrue isStatic MethodAttributes.Static             
+
+        let getCustomAttributes = 
+            match getCustomAttributes with
+            | Some(getCustomAttributes)->getCustomAttributes
+            | None -> fun _ -> [||]    
+
+        let invoke = 
+            match invoke with
+            | Some(invoke)->invoke
+            | None -> fun _ -> failwith "No invoke for this method."             
+            
+        let parameters = 
+            match parameters with 
+            | Some(parameters) -> parameters 
+            | None -> [||]
+            
+        upcast MethodInfoImpl(declaringType,methodName,returnType,getCustomAttributes,attributes,invoke,parameters)
+
+
+    // A synthetic method is one without a callable "invoke" method
+    static member CreateSyntheticMethod(declaringType,methodName,returnType,?getCustomAttributes,?attributes,?invoke,?parameters,?isStatic) : MethodInfo = 
+        let dummyInvoke(_this,_bindingFlags,_binder,_,_cultureInfo) : obj = failwith "never called 2"
+        TypeBuilder.CreateMethod(declaringType,methodName,returnType,?isStatic=isStatic,invoke=dummyInvoke, ?attributes=attributes, ?parameters=parameters, ?getCustomAttributes=getCustomAttributes) 
+
+    static member CreateParameter(name:string,parameterType:Type) = upcast ParameterInfoImpl(name,parameterType)
+    static member CreateConstructor(declaringType, getCustomAttributes) : ConstructorInfo = upcast ConstructorImpl(declaringType,getCustomAttributes=getCustomAttributes)
+    
+    static member MemberInfosOfProperty(property:PropertyInfo) =
+        [ if property.CanRead then yield property.GetGetMethod() :> MemberInfo
+          if property.CanWrite then yield property.GetSetMethod() :> MemberInfo
+          yield property :> MemberInfo ]
+
+
+    static member JoinPropertiesIntoMemberInfos(properties:PropertyInfo seq) =
+        // CHANGE TO THIS (though it reorders - does that matter?)
+        //    [| for property in properties do yield! MemberInfosOfProperty property |]
+        
+        let properties = properties |> List.ofSeq
+        let accessMethods : MemberInfo list = [for property in properties do 
+                                                if property.CanRead then yield property.GetGetMethod() :> MemberInfo
+                                                if property.CanWrite then yield property.GetSetMethod() :> MemberInfo] 
+
+        let properties : MemberInfo list = properties |> List.map(fun f->upcast f)
+        [accessMethods;properties] |> List.concat |> List.toArray
+
+    static member CacheMembers f = 
+        let cache = ref None
+        fun this _bindingAttr _kind _nmOpt ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f this in cache := Some res; res
+
+    static member CacheWithArg f = 
+        let cache = ref None
+        fun x ->
+            match !cache with 
+            | Some res -> res
+            | None -> let res = f x in cache := Some res; res
+
+
+// A delegating System.Type that lets you intercept anything
+type TypeEvil() = 
+
+    static member Intercept(st: System.Type, nm, ?get_Name, ?get_IsArrayImpl, ?get_IsGenericType, ?get_Assembly, ?get_FullName, ?get_Namespace, 
+                            ?get_GUID, ?get_AssemblyQualifiedName, ?get_BaseType, ?get_IsByRefImpl, ?get_IsPointerImpl, 
+                            ?get_IsPrimitiveImpl, ?get_IsCOMObjectImpl, ?get_GetElementType, ?get_HasElementTypeImpl, 
+                            ?get_UnderlyingSystemType, ?get_Module, ?get_DeclaringType, ?get_MemberType,
+                            ?GetMethods,?GetEvents,?GetProperties,?GetFields,?GetNestedTypes,?GetInterfaces,?GetMembers,?GetGenericArguments,
+                            ?GetConstructors) = 
+        { new System.Type() with 
+
+            // Members of Type and parents
+            override this.GUID = match get_GUID with Some f -> f() | None -> st.GUID
+            override this.Assembly = match get_Assembly with Some f -> f() | None -> st.Assembly
+            override this.FullName = match get_FullName with Some f -> f() | None -> match st.Namespace with null -> nm | x -> x + "." + nm
+            override this.Namespace = match get_Namespace with Some f -> f() | None -> st.Namespace
+            override this.AssemblyQualifiedName = match get_AssemblyQualifiedName with Some f -> f() | None -> st.AssemblyQualifiedName
+            override this.BaseType = match get_BaseType with Some f -> f() | None -> st.BaseType
+            override this.IsGenericType = match get_IsGenericType with Some f -> f() | None -> st.IsGenericType 
+            override this.IsArrayImpl() = match get_IsArrayImpl with Some f -> f() | None -> st.IsArrayImpl() 
+            override this.IsByRefImpl() = match get_IsByRefImpl with Some f -> f() | None -> st.IsByRefImpl() 
+            override this.IsPointerImpl() = match get_IsPointerImpl with Some f -> f() | None -> st.IsPointerImpl() 
+            override this.IsPrimitiveImpl() = match get_IsPrimitiveImpl with Some f -> f() | None -> st.IsPrimitiveImpl() 
+            override this.IsCOMObjectImpl() = match get_IsCOMObjectImpl with Some f -> f() | None -> st.IsCOMObjectImpl() 
+            override this.GetElementType() = match get_GetElementType with Some f -> f() | None -> st.GetElementType() 
+            override this.HasElementTypeImpl() = match get_HasElementTypeImpl with Some f -> f() | None -> st.HasElementTypeImpl() 
+            override this.UnderlyingSystemType = match get_UnderlyingSystemType with Some f -> f() | None -> st.UnderlyingSystemType 
+            override this.Name = match get_Name with Some f -> f() | None -> nm
+            override this.Module = match get_Module with Some f -> f() | None -> st.Module 
+            override this.DeclaringType = match get_DeclaringType with Some f -> f() | None -> st.DeclaringType 
+            override this.MemberType = match get_MemberType with Some f -> f() | None -> this.MemberType 
+
+            override this.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters) = st.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters)
+            override this.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers) = st.GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers)
+            override this.GetConstructors(bindingAttr) = match GetConstructors with Some f -> f() | None -> st.GetConstructors(bindingAttr)
+            override this.GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers) = st.GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers)
+            override this.GetMethods(bindingAttr) =  match GetMethods with Some f -> f() | None -> st.GetMethods(bindingAttr)
+            override this.GetField(name, bindingAttr) = st.GetField(name, bindingAttr)
+            override this.GetFields(bindingAttr) =  match GetFields with Some f -> f() | None -> st.GetFields(bindingAttr)
+            override this.GetInterface(name, ignoreCase) = st.GetInterface(name, ignoreCase)
+            override this.GetInterfaces() =  match GetInterfaces with Some f -> f() | None -> st.GetInterfaces() 
+            override this.GetEvent(name, bindingAttr) = st.GetEvent(name, bindingAttr) 
+            override this.GetEvents(bindingAttr) =  match GetEvents with Some f -> f() | None -> st.GetEvents(bindingAttr) 
+            override this.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) = st.GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers) 
+            override this.GetProperties(bindingAttr) =  match GetProperties with Some f -> f() | None -> st.GetProperties(bindingAttr) 
+            override this.GetNestedTypes(bindingAttr) =  match GetNestedTypes with Some f -> f() | None -> st.GetNestedTypes(bindingAttr)
+            override this.GetNestedType(name, bindingAttr) = st.GetNestedType(name, bindingAttr) 
+            override this.GetMembers(bindingAttr) =  match GetMembers with Some f -> f() | None -> st.GetMembers(bindingAttr) 
+            override this.GetAttributeFlagsImpl() = st.GetAttributeFlagsImpl() 
+            override this.GetCustomAttributes(``inherit``) = st.GetCustomAttributes(``inherit``) 
+            override this.GetCustomAttributes(attributeType, ``inherit``) = st.GetCustomAttributes(attributeType, ``inherit``) 
+            override this.GetCustomAttributesData() = st.GetCustomAttributesData() 
+            override this.IsDefined(attributeType, ``inherit``) = st.IsDefined(attributeType, ``inherit``) 
+            override this.GetHashCode() = st.GetHashCode() 
+            override this.Equals(that:obj) = st.Equals(that:obj)
+            override this.GetMember(name,mt,bindingAttr) = st.GetMember(name,mt,bindingAttr) 
+            override this.GetGenericArguments() =  match GetGenericArguments with Some f -> f() | None -> st.GetGenericArguments() 
+            override this.ToString() = st.ToString() }
diff --git a/tests/fsharp/typeProviders/negTests/build.bat b/tests/fsharp/typeProviders/negTests/build.bat
new file mode 100644
index 0000000..72b674a
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/build.bat
@@ -0,0 +1,126 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+
+if EXIST provided.dll del provided.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provided.dll -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedJ.dll del providedJ.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedJ.dll -a ..\helloWorld\providedJ.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedK.dll del providedK.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:providedK.dll -a ..\helloWorld\providedK.fs
+if errorlevel 1 goto :Error
+
+if EXIST provider.dll del provider.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provider.dll -a  provider.fsx
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provider_providerAttributeErrorConsume.dll -a  providerAttributeError.fsx
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:provider_ProviderAttribute_EmptyConsume.dll -a  providerAttribute_Empty.fsx
+if ERRORLEVEL 1 goto :Error
+
+if EXIST helloWorldProvider.dll del helloWorldProvider.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:helloWorldProvider.dll -a  ..\helloWorld\provider.fsx
+if ERRORLEVEL 1 goto :Error
+
+if EXIST MostBasicProvider.dll del MostBasicProvider.dll
+if ERRORLEVEL 1 goto :Error
+
+%FSC% --out:MostBasicProvider.dll -a  MostBasicProvider.fsx
+if ERRORLEVEL 1 goto :Error
+
+set FAILURES=
+
+set TESTS_SIMPLE=neg2h neg4 neg1 neg1_a neg2 neg2c neg2e neg2g neg6
+REM neg7 - excluded 
+set TESTS_SIMPLE=%TESTS_SIMPLE% InvalidInvokerExpression providerAttributeErrorConsume ProviderAttribute_EmptyConsume
+
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetNestedNamespaces_Exception
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_NamespaceName_Exception
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_NamespaceName_Empty
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetTypes_Exception
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_ResolveTypeName_Exception
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetNamespaces_Exception
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetStaticParameters_Exception 
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetInvokerExpression_Exception 
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetTypes_Null
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_ResolveTypeName_Null
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetNamespaces_Null
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetStaticParameters_Null
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_GetInvokerExpression_Null
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_DoesNotHaveConstructor
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_ConstructorThrows
+set TESTS_WITH_DEFINE=%TESTS_WITH_DEFINE% EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments
+
+REM for running one at a time easily:
+REM set TESTS_SIMPLE=neg7
+REM set TESTS_WITH_DEFINE=
+
+if "%1"=="" goto :RunAllTests
+
+if "%1"=="--withDefine" goto :RunSpecificWithDefine
+
+call :RunTest %1
+goto :ReportResults
+
+:RunSpecificWithDefine
+call :RunTestWithDefine %2
+goto :ReportResults
+
+:RunAllTests
+
+for %%T in (%TESTS_SIMPLE%) do call :RunTest %%T
+for %%T in (%TESTS_WITH_DEFINE%) do call :RunTestWithDefine %%T
+
+:ReportResults
+if "%FAILURES%"=="" goto :Ok
+
+echo fsharp %~f0 - Build failed
+echo Failures: %FAILURES%
+exit /b 1
+
+:Ok
+echo Built fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+
+:RunTestWithDefine
+%FSC% --define:%1 --out:provider_%1.dll -a  provider.fsx
+if ERRORLEVEL 1 goto :Error
+
+:RunTest
+if EXIST %1.bslpp   call :Preprocess "%1" ""
+if EXIST %1.vsbslpp call :Preprocess "%1" "vs"
+
+:DoRunTest
+call ..\..\single-neg-test.bat %1
+if ERRORLEVEL 1 goto Error
+GOTO :EOF
+
+:Error
+set FAILURES=%FAILURES% %1
+GOTO :EOF
+
+:Preprocess
+fsi --exec sed.fsx "<ASSEMBLY>" "%~d0%~p0provider_%1.dll" < %~1.%~2bslpp | fsi --exec sed.fsx "<URIPATH>" "file:///%CD%\\" > %~1.%~2bsl
+
+goto :EOF
diff --git a/tests/fsharp/typeProviders/negTests/neg1.bsl b/tests/fsharp/typeProviders/negTests/neg1.bsl
new file mode 100644
index 0000000..97c9d24
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg1.bsl
@@ -0,0 +1,1449 @@
+
+neg1.fsx(3,18,3,70): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    int    
+
+neg1.fsx(9,38,9,64): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.IsArrayTypeRaisesException' member 'IsArray': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(9,38,9,64): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.IsArrayTypeRaisesException' member 'IsArray': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(9,38,9,64): typecheck error FS3004: The provided type 'FSharp.EvilProvider.IsArrayTypeRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(10,38,10,60): typecheck error FS3013: Provided type 'FSharp.EvilProvider.IsArrayTypeReturnsTrue' has 'IsArray' as true, but array types are not supported.
+
+neg1.fsx(10,38,10,60): typecheck error FS3013: Provided type 'FSharp.EvilProvider.IsArrayTypeReturnsTrue' has 'IsArray' as true, but array types are not supported.
+
+neg1.fsx(10,38,10,60): typecheck error FS3004: The provided type 'FSharp.EvilProvider.IsArrayTypeReturnsTrue' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS0039: The type 'TypeWhereNameRaisesException' is not defined
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'Name' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(11,38,11,66): typecheck error FS0039: The type 'TypeWhereNameRaisesException' is not defined
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS0039: The type 'TypeWhereNameReturnsNull' is not defined
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'Name' of a provided type was null or empty.
+
+neg1.fsx(12,38,12,62): typecheck error FS0039: The type 'TypeWhereNameReturnsNull' is not defined
+
+neg1.fsx(13,38,13,66): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.IsGenericTypeRaisesException' member 'IsGenericType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(13,38,13,66): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.IsGenericTypeRaisesException' member 'IsGenericType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(13,38,13,66): typecheck error FS3004: The provided type 'FSharp.EvilProvider.IsGenericTypeRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(14,38,14,62): typecheck error FS3011: Provided type 'FSharp.EvilProvider.IsGenericTypeReturnsTrue' has 'IsGenericType' as true, but generic types are not supported.
+
+neg1.fsx(14,38,14,62): typecheck error FS3011: Provided type 'FSharp.EvilProvider.IsGenericTypeReturnsTrue' has 'IsGenericType' as true, but generic types are not supported.
+
+neg1.fsx(14,38,14,62): typecheck error FS3004: The provided type 'FSharp.EvilProvider.IsGenericTypeReturnsTrue' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS0039: The type 'TypeWhereFullNameRaisesException' is not defined
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereFullNameRaisesException' member 'FullName': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS3072: The type provider 'Provider.EvilProvider' reported an error: An exception occurred when accessing the 'FullName' of a provided type: deliberate error for testing purposes
+
+neg1.fsx(15,38,15,70): typecheck error FS0039: The type 'TypeWhereFullNameRaisesException' is not defined
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS0039: The type 'TypeWhereFullNameReturnsNull' is not defined
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS3042: Unexpected 'null' return value from provided type 'TypeWhereFullNameReturnsNull' member 'FullName'
+
+neg1.fsx(16,38,16,66): typecheck error FS3073: The type provider 'Provider.EvilProvider' reported an error: The 'FullName' of a provided type was null or empty.
+
+neg1.fsx(16,38,16,66): typecheck error FS0039: The type 'TypeWhereFullNameReturnsNull' is not defined
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3041: Expected provided type with path 'FSharp.EvilProvider' but provided type has path ''
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3041: Expected provided type with path 'FSharp.EvilProvider' but provided type has path ''
+
+neg1.fsx(17,38,17,71): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereNamespaceRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(17,38,17,71): typecheck error FS3033: The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3041: Expected provided type with path 'FSharp.EvilProvider' but provided type has path ''
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3021: Unexpected exception from provided type 'TypeWhereNamespaceRaisesException' member 'Namespace': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(17,38,17,71): typecheck error FS3041: Expected provided type with path 'FSharp.EvilProvider' but provided type has path ''
+
+neg1.fsx(17,38,17,71): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereNamespaceRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(17,38,17,71): typecheck error FS3033: The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(18,39,18,68): typecheck error FS0039: The type 'TypeWhereNamespaceReturnsNull' is not defined
+
+neg1.fsx(18,39,18,68): typecheck error FS0039: The type 'TypeWhereNamespaceReturnsNull' is not defined
+
+neg1.fsx(19,39,19,67): typecheck error FS3021: Unexpected exception from provided type 'DeclaringTypeRaisesException' member 'DeclaringType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(19,39,19,67): typecheck error FS3021: Unexpected exception from provided type 'DeclaringTypeRaisesException' member 'DeclaringType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(19,39,19,67): typecheck error FS3004: The provided type 'FSharp.EvilProvider.DeclaringTypeRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(19,39,19,67): typecheck error FS3033: The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(19,39,19,67): typecheck error FS3021: Unexpected exception from provided type 'DeclaringTypeRaisesException' member 'DeclaringType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(19,39,19,67): typecheck error FS3021: Unexpected exception from provided type 'DeclaringTypeRaisesException' member 'DeclaringType': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(19,39,19,67): typecheck error FS3004: The provided type 'FSharp.EvilProvider.DeclaringTypeRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(19,39,19,67): typecheck error FS3033: The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(20,39,20,73): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetMethodsRaisesException' member 'GetMethods': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(20,39,20,73): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetMethodsRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(21,39,21,72): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetEventsRaisesException' member 'GetEvents': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(21,39,21,72): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetEventsRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(22,39,22,72): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetFieldsRaisesException' member 'GetFields': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(22,39,22,72): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetFieldsRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(23,39,23,76): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetPropertiesRaisesException' member 'GetProperties': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(24,39,24,77): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetNestedTypesRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(25,39,25,78): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetConstructorsRaisesException' member 'GetConstructors': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1.fsx(25,39,25,78): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetConstructorsRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(27,39,27,69): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetMethodsReturnsNull' member 'GetMethods': The type provider 'Provider.EvilProvider' reported an error: The type provider returned 'null', which is not a valid return value from 'GetMethods'
+
+neg1.fsx(27,39,27,69): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetMethodsReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(28,39,28,68): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetEventsReturnsNull' member 'GetEvents': The type provider 'Provider.EvilProvider' reported an error: The type provider returned 'null', which is not a valid return value from 'GetEvents'
+
+neg1.fsx(28,39,28,68): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetEventsReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(29,39,29,68): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetFieldsReturnsNull' member 'GetFields': The type provider 'Provider.EvilProvider' reported an error: The type provider returned 'null', which is not a valid return value from 'GetFields'
+
+neg1.fsx(29,39,29,68): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetFieldsReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(30,39,30,72): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetPropertiesReturnsNull' member 'GetProperties': The type provider 'Provider.EvilProvider' reported an error: The type provider returned 'null', which is not a valid return value from 'GetProperties'
+
+neg1.fsx(31,39,31,73): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetNestedTypesReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(32,39,32,74): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetConstructorsReturnsNull' member 'GetConstructors': The type provider 'Provider.EvilProvider' reported an error: The type provider returned 'null', which is not a valid return value from 'GetConstructors'
+
+neg1.fsx(32,39,32,74): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetConstructorsReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(33,39,33,72): typecheck error FS3042: Unexpected 'null' return value from provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesReturnsNull' member 'GetInterfaces'
+
+neg1.fsx(33,39,33,72): typecheck error FS3042: Unexpected 'null' return value from provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesReturnsNull' member 'GetInterfaces'
+
+neg1.fsx(33,39,33,72): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesReturnsNull' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(36,38,36,81): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetGenericArgumentsRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(37,38,37,72): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetMembersRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
+
+neg1.fsx(42,103,42,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(43,103,43,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(44,103,44,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(45,103,45,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(46,103,46,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(47,103,47,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(48,103,48,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(49,103,49,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(50,103,50,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(51,103,51,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(52,103,52,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(53,103,53,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(54,103,54,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int'.
+
+neg1.fsx(56,109,56,111): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    int64    
+
+neg1.fsx(57,109,57,111): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    int16    
+
+neg1.fsx(58,109,58,111): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    sbyte    
+
+neg1.fsx(59,109,59,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    uint64    
+
+neg1.fsx(60,109,60,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    byte    
+
+neg1.fsx(61,109,61,111): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    uint32    
+
+neg1.fsx(62,109,62,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    uint16    
+
+neg1.fsx(63,109,63,113): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    decimal    
+
+neg1.fsx(64,109,64,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    float    
+
+neg1.fsx(65,109,65,113): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    float32    
+
+neg1.fsx(66,109,66,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    string    
+
+neg1.fsx(67,109,67,112): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    char    
+
+neg1.fsx(68,109,68,113): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    bool    
+
+neg1.fsx(72,103,72,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(73,103,73,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(74,103,74,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(75,103,75,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(76,103,76,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(77,103,77,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(78,103,78,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(79,103,79,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(80,103,80,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(81,103,81,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(82,103,82,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(83,103,83,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'sbyte'.
+
+neg1.fsx(86,109,86,111): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    int64    
+
+neg1.fsx(87,109,87,111): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    int16    
+
+neg1.fsx(88,109,88,110): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    int    
+
+neg1.fsx(89,109,89,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    uint64    
+
+neg1.fsx(90,109,90,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    byte    
+
+neg1.fsx(91,109,91,111): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    uint32    
+
+neg1.fsx(92,109,92,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    uint16    
+
+neg1.fsx(93,109,93,113): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    decimal    
+
+neg1.fsx(94,109,94,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    float    
+
+neg1.fsx(95,109,95,113): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    float32    
+
+neg1.fsx(96,109,96,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    string    
+
+neg1.fsx(97,109,97,112): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    char    
+
+neg1.fsx(98,109,98,113): typecheck error FS0001: This expression was expected to have type
+    sbyte    
+but here has type
+    bool    
+
+neg1.fsx(101,103,101,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(102,103,102,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(103,103,103,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(104,103,104,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(105,103,105,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(106,103,106,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(107,103,107,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(108,103,108,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(109,103,109,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(110,103,110,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(111,103,111,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(112,103,112,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(113,103,113,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int16'.
+
+neg1.fsx(116,109,116,111): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    int64    
+
+neg1.fsx(117,109,117,110): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    int    
+
+neg1.fsx(118,109,118,111): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    sbyte    
+
+neg1.fsx(119,109,119,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    uint64    
+
+neg1.fsx(120,109,120,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    byte    
+
+neg1.fsx(121,109,121,111): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    uint32    
+
+neg1.fsx(122,109,122,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    uint16    
+
+neg1.fsx(123,109,123,113): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    decimal    
+
+neg1.fsx(124,109,124,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    float    
+
+neg1.fsx(125,109,125,113): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    float32    
+
+neg1.fsx(126,109,126,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    string    
+
+neg1.fsx(127,109,127,112): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    char    
+
+neg1.fsx(128,109,128,113): typecheck error FS0001: This expression was expected to have type
+    int16    
+but here has type
+    bool    
+
+neg1.fsx(132,103,132,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(133,103,133,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(134,103,134,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(135,103,135,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(136,103,136,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(137,103,137,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(138,103,138,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(139,103,139,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(140,103,140,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(141,103,141,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(142,103,142,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(143,103,143,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(144,103,144,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'int64'.
+
+neg1.fsx(147,109,147,110): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    int    
+
+neg1.fsx(148,109,148,111): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    int16    
+
+neg1.fsx(149,109,149,111): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    sbyte    
+
+neg1.fsx(150,109,150,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    uint64    
+
+neg1.fsx(151,109,151,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    byte    
+
+neg1.fsx(152,109,152,111): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    uint32    
+
+neg1.fsx(153,109,153,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    uint16    
+
+neg1.fsx(154,109,154,113): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    decimal    
+
+neg1.fsx(155,109,155,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    float    
+
+neg1.fsx(156,109,156,113): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    float32    
+
+neg1.fsx(157,109,157,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    string    
+
+neg1.fsx(158,109,158,112): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    char    
+
+neg1.fsx(159,109,159,113): typecheck error FS0001: This expression was expected to have type
+    int64    
+but here has type
+    bool    
+
+neg1.fsx(163,104,163,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(164,104,164,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(165,104,165,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(166,104,166,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(167,104,167,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(168,104,168,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(169,104,169,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(170,104,170,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(171,104,171,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(172,104,172,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(173,104,173,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(174,104,174,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(175,104,175,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint64'.
+
+neg1.fsx(177,110,177,112): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    int64    
+
+neg1.fsx(178,110,178,112): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    int16    
+
+neg1.fsx(179,110,179,112): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    sbyte    
+
+neg1.fsx(180,110,180,111): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    int    
+
+neg1.fsx(181,110,181,113): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    byte    
+
+neg1.fsx(182,110,182,112): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    uint32    
+
+neg1.fsx(183,110,183,113): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    uint16    
+
+neg1.fsx(184,110,184,114): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    decimal    
+
+neg1.fsx(185,110,185,113): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    float    
+
+neg1.fsx(186,110,186,114): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    float32    
+
+neg1.fsx(187,110,187,113): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    string    
+
+neg1.fsx(188,110,188,113): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    char    
+
+neg1.fsx(189,110,189,114): typecheck error FS0001: This expression was expected to have type
+    uint64    
+but here has type
+    bool    
+
+neg1.fsx(193,104,193,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(194,104,194,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(195,104,195,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(196,104,196,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(197,104,197,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(198,104,198,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(199,104,199,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(200,104,200,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(201,104,201,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(202,104,202,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(203,104,203,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(204,104,204,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(205,104,205,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint32'.
+
+neg1.fsx(208,110,208,112): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    int64    
+
+neg1.fsx(209,110,209,112): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    int16    
+
+neg1.fsx(210,110,210,112): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    sbyte    
+
+neg1.fsx(211,110,211,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    uint64    
+
+neg1.fsx(212,110,212,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    byte    
+
+neg1.fsx(213,110,213,111): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    int    
+
+neg1.fsx(214,110,214,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    uint16    
+
+neg1.fsx(215,110,215,114): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    decimal    
+
+neg1.fsx(216,110,216,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    float    
+
+neg1.fsx(217,110,217,114): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    float32    
+
+neg1.fsx(218,110,218,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    string    
+
+neg1.fsx(219,110,219,113): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    char    
+
+neg1.fsx(220,110,220,114): typecheck error FS0001: This expression was expected to have type
+    uint32    
+but here has type
+    bool    
+
+neg1.fsx(224,104,224,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(225,104,225,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(226,104,226,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(227,104,227,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(228,104,228,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(229,104,229,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(230,104,230,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(231,104,231,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(232,104,232,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(233,104,233,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(234,104,234,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(235,104,235,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(236,104,236,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'uint16'.
+
+neg1.fsx(239,110,239,112): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    int64    
+
+neg1.fsx(240,110,240,112): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    int16    
+
+neg1.fsx(241,110,241,112): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    sbyte    
+
+neg1.fsx(242,110,242,113): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    uint64    
+
+neg1.fsx(243,110,243,113): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    byte    
+
+neg1.fsx(244,110,244,112): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    uint32    
+
+neg1.fsx(245,110,245,111): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    int    
+
+neg1.fsx(246,110,246,114): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    decimal    
+
+neg1.fsx(247,110,247,113): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    float    
+
+neg1.fsx(248,110,248,114): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    float32    
+
+neg1.fsx(249,110,249,113): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    string    
+
+neg1.fsx(250,110,250,113): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    char    
+
+neg1.fsx(251,110,251,114): typecheck error FS0001: This expression was expected to have type
+    uint16    
+but here has type
+    bool    
+
+neg1.fsx(255,102,255,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(256,102,256,103): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(257,102,257,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(258,102,258,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(259,102,259,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(260,102,260,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(261,102,261,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(262,102,262,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(263,102,263,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(264,102,264,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(265,102,265,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(266,102,266,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(267,102,267,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'byte'.
+
+neg1.fsx(269,108,269,110): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    int64    
+
+neg1.fsx(270,108,270,110): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    int16    
+
+neg1.fsx(271,108,271,110): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    sbyte    
+
+neg1.fsx(272,108,272,111): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    uint64    
+
+neg1.fsx(273,108,273,109): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    int    
+
+neg1.fsx(274,108,274,110): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    uint32    
+
+neg1.fsx(275,108,275,111): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    uint16    
+
+neg1.fsx(276,108,276,112): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    decimal    
+
+neg1.fsx(277,108,277,111): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    float    
+
+neg1.fsx(278,108,278,112): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    float32    
+
+neg1.fsx(279,108,279,111): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    string    
+
+neg1.fsx(280,108,280,111): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    char    
+
+neg1.fsx(281,108,281,112): typecheck error FS0001: This expression was expected to have type
+    byte    
+but here has type
+    bool    
+
+neg1.fsx(285,102,285,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(286,102,286,103): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(287,102,287,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(288,102,288,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(289,102,289,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(290,102,290,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(291,102,291,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(292,102,292,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(293,102,293,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(294,102,294,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(295,102,295,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(296,102,296,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(297,102,297,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'bool'.
+
+neg1.fsx(299,108,299,110): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    int64    
+
+neg1.fsx(300,108,300,110): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    int16    
+
+neg1.fsx(301,108,301,110): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    sbyte    
+
+neg1.fsx(302,108,302,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    uint64    
+
+neg1.fsx(303,108,303,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    byte    
+
+neg1.fsx(304,108,304,110): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    uint32    
+
+neg1.fsx(305,108,305,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    uint16    
+
+neg1.fsx(306,108,306,112): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    decimal    
+
+neg1.fsx(307,108,307,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    float    
+
+neg1.fsx(308,108,308,112): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    float32    
+
+neg1.fsx(309,108,309,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    string    
+
+neg1.fsx(310,108,310,111): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    char    
+
+neg1.fsx(311,108,311,109): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    int    
+
+neg1.fsx(315,104,315,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(316,104,316,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(317,104,317,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(318,104,318,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(319,104,319,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(320,104,320,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(321,104,321,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(322,104,322,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(323,104,323,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(324,104,324,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(325,104,325,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(326,104,326,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(327,104,327,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(328,104,328,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(329,110,329,112): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    int64    
+
+neg1.fsx(330,110,330,112): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    int16    
+
+neg1.fsx(331,110,331,112): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    sbyte    
+
+neg1.fsx(332,110,332,113): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    uint64    
+
+neg1.fsx(333,110,333,113): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    byte    
+
+neg1.fsx(334,110,334,112): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    uint32    
+
+neg1.fsx(335,110,335,113): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    uint16    
+
+neg1.fsx(336,110,336,114): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    decimal    
+
+neg1.fsx(337,110,337,113): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    float    
+
+neg1.fsx(338,110,338,114): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    float32    
+
+neg1.fsx(339,110,339,111): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    int    
+
+neg1.fsx(340,110,340,113): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    char    
+
+neg1.fsx(341,110,341,114): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    bool    
+
+neg1.fsx(342,110,342,114): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'string'.
+
+neg1.fsx(345,104,345,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(346,104,346,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(347,104,347,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(348,104,348,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(349,104,349,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(350,104,350,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(351,104,351,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(352,104,352,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(353,104,353,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(354,104,354,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(355,104,355,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(356,104,356,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(357,104,357,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float'.
+
+neg1.fsx(359,110,359,112): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    int64    
+
+neg1.fsx(360,110,360,112): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    int16    
+
+neg1.fsx(361,110,361,112): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    sbyte    
+
+neg1.fsx(362,110,362,113): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    uint64    
+
+neg1.fsx(363,110,363,113): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    byte    
+
+neg1.fsx(364,110,364,112): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    uint32    
+
+neg1.fsx(365,110,365,113): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    uint16    
+
+neg1.fsx(366,110,366,114): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    decimal    
+
+neg1.fsx(367,110,367,111): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    int    
+
+neg1.fsx(368,110,368,114): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    float32    
+
+neg1.fsx(369,110,369,113): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    string    
+
+neg1.fsx(370,110,370,113): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    char    
+
+neg1.fsx(371,110,371,114): typecheck error FS0001: This expression was expected to have type
+    float    
+but here has type
+    bool    
+
+neg1.fsx(376,104,376,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(377,104,377,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(378,104,378,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(379,104,379,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(380,104,380,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(381,104,381,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(382,104,382,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(383,104,383,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(384,104,384,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(385,104,385,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(386,104,386,108): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(387,104,387,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(388,104,388,107): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'float32'.
+
+neg1.fsx(390,110,390,112): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    int64    
+
+neg1.fsx(391,110,391,112): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    int16    
+
+neg1.fsx(392,110,392,112): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    sbyte    
+
+neg1.fsx(393,110,393,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    uint64    
+
+neg1.fsx(394,110,394,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    byte    
+
+neg1.fsx(395,110,395,112): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    uint32    
+
+neg1.fsx(396,110,396,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    uint16    
+
+neg1.fsx(397,110,397,114): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    decimal    
+
+neg1.fsx(398,110,398,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    float    
+
+neg1.fsx(399,110,399,111): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    int    
+
+neg1.fsx(400,110,400,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    string    
+
+neg1.fsx(401,110,401,113): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    char    
+
+neg1.fsx(402,110,402,114): typecheck error FS0001: This expression was expected to have type
+    float32    
+but here has type
+    bool    
+
+neg1.fsx(406,102,406,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(407,102,407,103): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(408,102,408,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(409,102,409,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(410,102,410,104): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(411,102,411,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(412,102,412,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(413,102,413,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(414,102,414,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(415,102,415,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(416,102,416,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(417,102,417,106): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(418,102,418,105): typecheck error FS3045: Invalid static argument to provided type. Expected an argument of kind 'char'.
+
+neg1.fsx(420,108,420,110): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    int64    
+
+neg1.fsx(421,108,421,110): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    int16    
+
+neg1.fsx(422,108,422,110): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    sbyte    
+
+neg1.fsx(423,108,423,111): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    uint64    
+
+neg1.fsx(424,108,424,111): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    byte    
+
+neg1.fsx(425,108,425,110): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    uint32    
+
+neg1.fsx(426,108,426,111): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    uint16    
+
+neg1.fsx(427,108,427,112): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    decimal    
+
+neg1.fsx(428,108,428,111): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    float    
+
+neg1.fsx(429,108,429,112): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    float32    
+
+neg1.fsx(430,108,430,111): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    string    
+
+neg1.fsx(431,108,431,109): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    int    
+
+neg1.fsx(432,108,432,112): typecheck error FS0001: This expression was expected to have type
+    char    
+but here has type
+    bool    
+
+neg1.fsx(438,109,438,110): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    string    
+
+neg1.fsx(440,119,440,120): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    string    
+
+neg1.fsx(440,119,440,120): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    string    
+
+neg1.fsx(448,9,448,107): typecheck error FS3148: Too many static parameters. Expected at most 1 parameters, but got 2 unnamed and 0 named parameters.
+
+neg1.fsx(449,105,449,110): typecheck error FS3083: The static parameter 'Count' has already been given a value
+
+neg1.fsx(450,9,450,119): typecheck error FS3148: Too many static parameters. Expected at most 1 parameters, but got 0 unnamed and 2 named parameters.
diff --git a/tests/fsharp/typeProviders/negTests/neg1.fsx b/tests/fsharp/typeProviders/negTests/neg1.fsx
new file mode 100644
index 0000000..e216d87
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg1.fsx
@@ -0,0 +1,451 @@
+#r "provider.dll"
+
+let s : string = FSharp.GoodProviderForNegativeTypeTests1.TheType.Foo
+
+// This one exposes the types of a provider, one of which is an array
+open FSharp.EvilProvider
+
+// It is enough to name the type to expose the validation check
+type Negative1 = FSharp.EvilProvider.IsArrayTypeRaisesException
+type Negative2 = FSharp.EvilProvider.IsArrayTypeReturnsTrue
+type Negative3 = FSharp.EvilProvider.TypeWhereNameRaisesException
+type Negative4 = FSharp.EvilProvider.TypeWhereNameReturnsNull
+type Negative5 = FSharp.EvilProvider.IsGenericTypeRaisesException
+type Negative6 = FSharp.EvilProvider.IsGenericTypeReturnsTrue
+type Negative7 = FSharp.EvilProvider.TypeWhereFullNameRaisesException
+type Negative8 = FSharp.EvilProvider.TypeWhereFullNameReturnsNull
+type Negative9 = FSharp.EvilProvider.TypeWhereNamespaceRaisesException
+type Negative10 = FSharp.EvilProvider.TypeWhereNamespaceReturnsNull
+type Negative11 = FSharp.EvilProvider.DeclaringTypeRaisesException
+type Negative12 = FSharp.EvilProvider.TypeWhereGetMethodsRaisesException
+type Negative13 = FSharp.EvilProvider.TypeWhereGetEventsRaisesException
+type Negative14 = FSharp.EvilProvider.TypeWhereGetFieldsRaisesException
+type Negative15 = FSharp.EvilProvider.TypeWhereGetPropertiesRaisesException
+type Negative16 = FSharp.EvilProvider.TypeWhereGetNestedTypesRaisesException
+type Negative17 = FSharp.EvilProvider.TypeWhereGetConstructorsRaisesException
+//type Negative18 = FSharp.EvilProvider.TypeWhereGetInterfacesRaisesException
+type Negative19 = FSharp.EvilProvider.TypeWhereGetMethodsReturnsNull
+type Negative20 = FSharp.EvilProvider.TypeWhereGetEventsReturnsNull
+type Negative21 = FSharp.EvilProvider.TypeWhereGetFieldsReturnsNull
+type Negative22 = FSharp.EvilProvider.TypeWhereGetPropertiesReturnsNull
+type Negative23 = FSharp.EvilProvider.TypeWhereGetNestedTypesReturnsNull
+type Negative24 = FSharp.EvilProvider.TypeWhereGetConstructorsReturnsNull
+type Negative25 = FSharp.EvilProvider.TypeWhereGetInterfacesReturnsNull
+
+
+type Positive1 = FSharp.EvilProvider.TypeWhereGetGenericArgumentsRaisesException
+type Positive2 = FSharp.EvilProvider.TypeWhereGetMembersRaisesException
+
+
+
+module Int32 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<true>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const true>.StaticProperty1 |> ignore
+
+
+module SByte = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<'1'>.StaticProperty1 |> ignore
+
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSByteParameter<const true>.StaticProperty1 |> ignore
+
+module Int16 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<true>.StaticProperty1 |> ignore
+
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt16Parameter<const true>.StaticProperty1 |> ignore
+
+
+module Int64 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<true>.StaticProperty1 |> ignore
+
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt64Parameter<const true>.StaticProperty1 |> ignore
+
+
+module UInt64 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<true>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt64Parameter<const true>.StaticProperty1 |> ignore
+
+
+module UInt32 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<true>.StaticProperty1 |> ignore
+
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt32Parameter<const true>.StaticProperty1 |> ignore
+
+
+module UInt16 = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<true>.StaticProperty1 |> ignore
+
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticUInt16Parameter<const true>.StaticProperty1 |> ignore
+
+
+module Byte = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<true>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticByteParameter<const true>.StaticProperty1 |> ignore
+
+
+module Bool = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<1uy>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticBoolParameter<const 1>.StaticProperty1 |> ignore
+
+
+module String = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<true>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<null>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const true>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<const null>.StaticProperty1 |> ignore
+
+module Double = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<true>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<1uy>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticDoubleParameter<const true>.StaticProperty1 |> ignore
+
+
+
+module Single = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<true>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<'1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<1uy>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const '1'>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticSingleParameter<const true>.StaticProperty1 |> ignore
+
+
+module Char = 
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<"1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<true>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<1uy>.StaticProperty1 |> ignore
+        
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1L>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1y>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1UL>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1uy>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1u>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1us>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1.0M>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1.0>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1.0f>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const "1">.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const 1>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticCharParameter<const true>.StaticProperty1 |> ignore
+
+module ConstExpr =
+
+        [<Literal>]
+        let s = "abc"
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const s>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<s>.StaticProperty1 |> ignore
+        type T1 = FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<const s>
+        type T2 = FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<s>
+
+
+
+
+module TooManyArgs =
+
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<3,2>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<3,Count=2>.StaticProperty1 |> ignore
+        FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticInt32Parameter<Count=3,Count=2>.StaticProperty1 |> ignore
+        //FSharp.GoodProviderForNegativeStaticParameterTypeTests.HelloWorldTypeWithStaticStringParameter<s>.StaticProperty1 |> ignore
diff --git a/tests/fsharp/typeProviders/negTests/neg1_a.bsl b/tests/fsharp/typeProviders/negTests/neg1_a.bsl
new file mode 100644
index 0000000..a522638
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg1_a.bsl
@@ -0,0 +1,6 @@
+
+neg1_a.fsx(7,39,7,76): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesRaisesException' member 'GetInterfaces': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1_a.fsx(7,39,7,76): typecheck error FS3021: Unexpected exception from provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesRaisesException' member 'GetInterfaces': The type provider 'Provider.EvilProvider' reported an error: deliberate error for testing purposes
+
+neg1_a.fsx(7,39,7,76): typecheck error FS3004: The provided type 'FSharp.EvilProvider.TypeWhereGetInterfacesRaisesException' has member 'Foo' which has declaring type 'FSharp.EvilProvider.TheType'. Expected declaring type to be the same as provided type.
diff --git a/tests/fsharp/typeProviders/negTests/neg1_a.fsx b/tests/fsharp/typeProviders/negTests/neg1_a.fsx
new file mode 100644
index 0000000..ed2a37e
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg1_a.fsx
@@ -0,0 +1,7 @@
+#r "provider.dll"
+
+// This one exposes the types of a provider, one of which is an array
+open FSharp.EvilProvider
+
+// It is enough to name the type to expose the validation check
+type Negative18 = FSharp.EvilProvider.TypeWhereGetInterfacesRaisesException
diff --git a/tests/fsharp/typeProviders/negTests/neg2.bsl b/tests/fsharp/typeProviders/negTests/neg2.bsl
new file mode 100644
index 0000000..b1bd82c
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2.bsl
@@ -0,0 +1,6 @@
+
+neg2.fsx(3,59,3,66): typecheck error FS3033: The type provider 'Provider.GoodProviderForNegativeTypeTests1' reported an error: Kaboom
+
+neg2.fsx(3,59,3,66): typecheck error FS3033: The type provider 'Provider.GoodProviderForNegativeTypeTests1' reported an error: Kaboom
+
+neg2.fsx(3,59,3,66): typecheck error FS0039: The value, constructor, namespace or type 'TheHype' is not defined
diff --git a/tests/fsharp/typeProviders/negTests/neg2.fsx b/tests/fsharp/typeProviders/negTests/neg2.fsx
new file mode 100644
index 0000000..9fcba56
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2.fsx
@@ -0,0 +1,3 @@
+#r "provider.dll"
+
+let s : string = FSharp.GoodProviderForNegativeTypeTests1.TheHype.Foo
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/negTests/neg2c.bsl b/tests/fsharp/typeProviders/negTests/neg2c.bsl
new file mode 100644
index 0000000..b671f71
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2c.bsl
@@ -0,0 +1,2 @@
+
+neg2c.fsx(6,5,6,7): typecheck error FS0410: The type 'TheGeneratedType1' is less accessible than the value, member or type 'val f2 : unit -> TheGeneratedType1' it is used in
diff --git a/tests/fsharp/typeProviders/negTests/neg2c.fsx b/tests/fsharp/typeProviders/negTests/neg2c.fsx
new file mode 100644
index 0000000..1a4c7c1
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2c.fsx
@@ -0,0 +1,6 @@
+#r "helloWorldProvider.dll"
+
+
+type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<TypeName="TheGeneratedType1">
+
+let f2() = Unchecked.defaultof<TheGeneratedType1> // should give an error because TheGeneratedType1 is not accessible enough to be part of public API
diff --git a/tests/fsharp/typeProviders/negTests/neg2e.bsl b/tests/fsharp/typeProviders/negTests/neg2e.bsl
new file mode 100644
index 0000000..71d58bb
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2e.bsl
@@ -0,0 +1,6 @@
+
+neg2e.fsx(7,41,7,85): typecheck error FS3039: A direct reference to the generated type 'TheContainerType' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly.
+
+neg2e.fsx(10,19,10,63): typecheck error FS3039: A direct reference to the generated type 'TheContainerType' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly.
+
+neg2e.fsx(10,96,10,140): typecheck error FS3039: A direct reference to the generated type 'TheContainerType' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly.
diff --git a/tests/fsharp/typeProviders/negTests/neg2e.fsx b/tests/fsharp/typeProviders/negTests/neg2e.fsx
new file mode 100644
index 0000000..c12a4ec
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2e.fsx
@@ -0,0 +1,12 @@
+#r "helloWorldProvider.dll"
+
+
+type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<TypeName="TheGeneratedType1">
+
+// references must go through the alias GeneratedType, not FSharp.HelloWorldGenerative.TheGeneratedType
+let internal f2() = Unchecked.defaultof<FSharp.HelloWorldGenerative.TheContainerType<TypeName="TheGeneratedType1">>
+
+// references must go through the alias GeneratedType, not FSharp.HelloWorldGenerative.TheGeneratedType
+let internal v1 : FSharp.HelloWorldGenerative.TheContainerType<TypeName="TheGeneratedType1"> = FSharp.HelloWorldGenerative.TheContainerType<TypeName="TheGeneratedType1">()
+
+
diff --git a/tests/fsharp/typeProviders/negTests/neg2g.bsl b/tests/fsharp/typeProviders/negTests/neg2g.bsl
new file mode 100644
index 0000000..76abcbb
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2g.bsl
@@ -0,0 +1,4 @@
+
+neg2g.fsx(7,31,7,47): typecheck error FS3039: A direct reference to the generated type 'TheContainerType' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly.
+
+neg2g.fsx(7,31,7,47): typecheck error FS3039: A direct reference to the generated type 'TheContainerType' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = <path>'. This indicates that a type provider adds generated types to your assembly.
diff --git a/tests/fsharp/typeProviders/negTests/neg2g.fsx b/tests/fsharp/typeProviders/negTests/neg2g.fsx
new file mode 100644
index 0000000..0757de1
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2g.fsx
@@ -0,0 +1,8 @@
+#r "helloWorldProvider.dll"
+
+open FSharp.HelloWorldGenerative
+
+
+// A 'Generate' reference should be to the container, not to the nested types
+type internal GeneratedType = TheContainerType<TypeName="TheOuterType">.TheNestedGeneratedType
+
diff --git a/tests/fsharp/typeProviders/negTests/neg2h.bsl b/tests/fsharp/typeProviders/negTests/neg2h.bsl
new file mode 100644
index 0000000..afd5527
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2h.bsl
@@ -0,0 +1,2 @@
+
+neg2h.fs(4,6,4,7): typecheck error FS0318: The type definitions in the signature and implementation are not compatible because the abbreviations differ: FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<2> versus FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>
diff --git a/tests/fsharp/typeProviders/negTests/neg2h.fs b/tests/fsharp/typeProviders/negTests/neg2h.fs
new file mode 100644
index 0000000..f5e9e22
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2h.fs
@@ -0,0 +1,5 @@
+namespace global
+
+// the signature and implementation have different static parameters
+type A = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<2>
+
diff --git a/tests/fsharp/typeProviders/negTests/neg2h.fsi b/tests/fsharp/typeProviders/negTests/neg2h.fsi
new file mode 100644
index 0000000..5d32c09
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg2h.fsi
@@ -0,0 +1,6 @@
+
+namespace global
+
+// the signature and implementation have different static parameters
+type A = FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1>
+
diff --git a/tests/fsharp/typeProviders/negTests/neg3.bsl b/tests/fsharp/typeProviders/negTests/neg3.bsl
new file mode 100644
index 0000000..e421575
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg3.bsl
@@ -0,0 +1,4 @@
+
+neg3.fsx(1,1,1,77): parse error FS3052: The type provider 'Provider.EvilGeneratedProviderThatReturnsAGeneratedTypeNotNestedInAnErasedType' returned a non-nested generated type. Generated types must be nested types of an enclosing erased type.
+
+neg3.fsx(1,1,1,77): parse error FS3020: One or more errors seen during provided type setup
diff --git a/tests/fsharp/typeProviders/negTests/neg3.fsx b/tests/fsharp/typeProviders/negTests/neg3.fsx
new file mode 100644
index 0000000..ff94a32
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg3.fsx
@@ -0,0 +1,6 @@
+#r "provider_EVIL_PROVIDER_ReturnsAGeneratedTypeNotNestedInAnErasedType.dll"
+
+
+type GeneratedType = FSharp.EvilGeneratedProviderThatReturnsAGeneratedTypeNotNestedInAnErasedType.TheGeneratedType
+
+
diff --git a/tests/fsharp/typeProviders/negTests/neg4.bsl b/tests/fsharp/typeProviders/negTests/neg4.bsl
new file mode 100644
index 0000000..7f22593
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg4.bsl
@@ -0,0 +1,28 @@
+
+neg4.fsx(7,25,7,44): typecheck error FS3062: This type test with a provided type 'HelloWorldType' is not allowed because this provided type will be erased to 'System.Object' at runtime.
+
+neg4.fsx(10,25,10,68): typecheck error FS3060: This type test or downcast will erase the provided type 'HelloWorldType' to the type 'System.Object'
+
+neg4.fsx(13,25,13,45): typecheck error FS3061: This downcast will erase the provided type 'HelloWorldType' to the type 'System.Object'.
+
+neg4.fsx(16,25,16,69): typecheck error FS3060: This type test or downcast will erase the provided type 'HelloWorldType' to the type 'System.Object'
+
+neg4.fsx(19,25,19,48): typecheck error FS3061: This downcast will erase the provided type 'HelloWorldSubType' to the type 'System.Object'.
+
+neg4.fsx(22,25,22,50): typecheck error FS3061: This downcast will erase the provided type 'HelloWorldException' to the type 'System.Exception'.
+
+neg4.fsx(25,25,25,53): typecheck error FS3061: This downcast will erase the provided type 'HelloWorldSubException' to the type 'System.Exception'.
+
+neg4.fsx(30,5,30,22): typecheck error FS3062: This type test with a provided type 'HelloWorldType' is not allowed because this provided type will be erased to 'System.Object' at runtime.
+
+neg4.fsx(36,5,36,28): typecheck error FS3060: This type test or downcast will erase the provided type 'HelloWorldType' to the type 'System.Object'
+
+neg4.fsx(42,8,42,33): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg4.fsx(42,8,42,33): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg4.fsx(47,8,47,35): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg4.fsx(47,8,47,35): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg4.fsx(52,25,52,42): typecheck error FS3063: Cannot inherit from erased provided type
diff --git a/tests/fsharp/typeProviders/negTests/neg4.fsx b/tests/fsharp/typeProviders/negTests/neg4.fsx
new file mode 100644
index 0000000..fc18884
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg4.fsx
@@ -0,0 +1,53 @@
+#r "helloWorldProvider.dll"
+
+open FSharp.HelloWorld
+open System.Collections.Generic
+
+// Emit error if we try to test against an erased type
+let testtype1 (x:obj) = x :? HelloWorldType
+
+// Emit warning if we try to test against a type that contains an erased type
+let testtype2 (x:obj) = x :? List<FSharp.HelloWorld.HelloWorldType>
+
+// Emit error if we try to cast to an erased type
+let casttype1 (x:obj) = x :?> HelloWorldType
+
+// Emit warning if we try to cast to a type that contains an erased type
+let casttype2 (x:obj) = x :?> List<FSharp.HelloWorld.HelloWorldType>
+
+// Emit error if we try to cast to an erased type
+let casttype3 (x:obj) = x :?> HelloWorldSubType
+
+// Emit error if we try to cast to an erased type
+let casttype4 (x:obj) = x :?> HelloWorldException
+
+// Emit error if we try to cast to an erased type
+let casttype5 (x:obj) = x :?> HelloWorldSubException
+
+// Emit error if we try to match against an erased type
+let matchtype1 (x:obj) =
+  match x with
+    :? HelloWorldType -> "yes"
+  | _ -> "no"
+
+// Emit warning if we try to match against a type that contains an erased type
+let matchtype2 (x:obj) =
+  match x with
+    :? List<HelloWorldType> -> "yes"
+  | _ -> "no"
+
+
+type C = 
+    class
+       inherit HelloWorldSubType
+    end
+
+type C2() = 
+    class
+       inherit HelloWorldSubType()
+    end
+
+let okObjExpr1 = new HelloWorldSubType() // this is allowed
+
+let badObjExpr2 = { new HelloWorldSubType() with override x.ToString() = "" }
+
diff --git a/tests/fsharp/typeProviders/negTests/neg5.bsl b/tests/fsharp/typeProviders/negTests/neg5.bsl
new file mode 100644
index 0000000..0beeb34
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg5.bsl
@@ -0,0 +1,6 @@
+
+neg5.fsx(11,15,11,18): typecheck error FS0438: Duplicate method. The method 'Bar' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg5.fsx(19,15,19,19): typecheck error FS0438: Duplicate method. The method 'Bar3' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg5.fsx(8,15,8,18): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
diff --git a/tests/fsharp/typeProviders/negTests/neg6.bsl b/tests/fsharp/typeProviders/negTests/neg6.bsl
new file mode 100644
index 0000000..985dd48
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg6.bsl
@@ -0,0 +1,12 @@
+
+neg6.fsx(8,3,8,27): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg6.fsx(8,3,8,27): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg6.fsx(11,3,11,30): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg6.fsx(11,3,11,30): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg6.fsx(14,3,14,35): typecheck error FS3063: Cannot inherit from erased provided type
+
+neg6.fsx(14,3,14,35): typecheck error FS3063: Cannot inherit from erased provided type
diff --git a/tests/fsharp/typeProviders/negTests/neg6.fsx b/tests/fsharp/typeProviders/negTests/neg6.fsx
new file mode 100644
index 0000000..7b7a0bd
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg6.fsx
@@ -0,0 +1,16 @@
+#r "helloWorldProvider.dll"
+
+open FSharp.HelloWorld
+open System.Collections.Generic
+
+// Should not be able to inherit from an erased provided type
+type T() =
+  inherit HelloWorldType()
+
+type T2() =
+  inherit HelloWorldSubType()
+
+type T3() =
+  inherit HelloWorldSubException()
+
+
diff --git a/tests/fsharp/typeProviders/negTests/neg7.bsl b/tests/fsharp/typeProviders/negTests/neg7.bsl
new file mode 100644
index 0000000..e69de29
diff --git a/tests/fsharp/typeProviders/negTests/neg7.fsx b/tests/fsharp/typeProviders/negTests/neg7.fsx
new file mode 100644
index 0000000..0ac464a
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/neg7.fsx
@@ -0,0 +1,6 @@
+#r "MostBasicProvider.dll"
+
+type T = MyProvider.TheType
+
+
+
diff --git a/tests/fsharp/typeProviders/negTests/provider.fsx b/tests/fsharp/typeProviders/negTests/provider.fsx
new file mode 100644
index 0000000..f64589b
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/provider.fsx
@@ -0,0 +1,594 @@
+namespace Provider
+open System
+open System.Linq.Expressions
+open System.Reflection
+open Microsoft.FSharp.Core.CompilerServices
+open System.Collections.Generic
+open System.IO
+
+#load "TypeEvil.fs"
+#load "..\helloWorld\TypeMagic.fs"
+
+open FSharp.TypeEvil
+open FSharp.TypeMagic
+
+[<assembly: TypeProviderAssembly>]
+do ()
+
+type public Runtime() =
+    static member Id x = x
+
+[<AutoOpen>]
+module Utils = 
+    let doEvil() = failwith "deliberate error for testing purposes"
+
+[<TypeProvider>]
+type public GoodProviderForNegativeTypeTests1() =
+    let modul = typeof<GoodProviderForNegativeTypeTests1>.Assembly.GetModules().[0]
+    let namespaceName = "FSharp.GoodProviderForNegativeTypeTests1"
+    let theType =
+        let members (typ:Type) =
+            let invoke _ = failwith "Kaboom"
+            let fooP = TypeBuilder.CreateProperty(typ, "Foo", typeof<int>, getInvoke = invoke,isStatic = true)
+            let invalidInvokerExpressionP = TypeBuilder.CreateProperty(typ, "InvalidInvokerExpression", typeof<int>, getInvoke = invoke,isStatic = true)
+            let nullInvokerExpressionP = TypeBuilder.CreateProperty(typ, "NullInvokerExpression", typeof<int>, getInvoke = invoke,isStatic = true)
+            fun (_bf:BindingFlags) (mt:MemberTypes) (s:string option) ->
+            [|
+                if mt &&& MemberTypes.Property = MemberTypes.Property then
+                    match s with
+                    |   Some "Foo" -> yield fooP :> MemberInfo
+                    |   Some "InvalidInvokerExpression" -> yield invalidInvokerExpressionP :> MemberInfo
+                    |   Some "NullInvokerExpression" -> yield nullInvokerExpressionP :> MemberInfo
+                    |   None -> 
+                          yield fooP :> MemberInfo 
+                          yield invalidInvokerExpressionP :> MemberInfo
+                          yield nullInvokerExpressionP :> MemberInfo
+                    |   _ -> ()
+            |]
+        TypeBuilder.CreateType(TypeContainer.Namespace(modul, namespaceName), "TheType", members = members)       
+
+    let types = [|theType|]
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    interface IProvidedNamespace with
+        member this.GetNestedNamespaces() = [| |]
+        member this.NamespaceName = namespaceName
+        member this.GetTypes() = types
+        member this.ResolveTypeName(s) =
+            match s with
+            |   "TheType" -> theType
+            |   "TheHype" -> failwith "Kaboom"
+            |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.GetNamespaces() = [| this |]
+        member this.GetStaticParameters(typeWithoutArguments) = [| |]
+        member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = typeWithoutArguments
+
+        member this.GetInvokerExpression(mb:MethodBase,parameters) = 
+            match mb,parameters with
+            |   _, [||] when mb.Name = "get_Foo" ->
+                    let mi = typeof<Runtime>.GetMethod("Id").MakeGenericMethod([|typeof<int>|])
+                    Quotations.Expr.Call(mi, [ Quotations.Expr.Value(42) ])
+            |   _, [||] when mb.Name = "get_InvalidInvokerExpression" ->
+                    Quotations.Expr.WhileLoop(Quotations.Expr.Value(true), Quotations.Expr.Value((), typeof<unit>))
+            |   _, [||] when mb.Name = "get_NullInvokerExpression" ->
+                    Unchecked.defaultof<_>
+            |   _ -> failwith "Unexpected method erasure"
+
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+       
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+
+
+type public EvilProviderBase(namespaceName,?GetNestedNamespaces,?get_NamespaceName,?GetTypes,?ResolveTypeName,?GetNamespaces,?GetStaticParameters,?ApplyStaticArguments,?GetInvokerExpression) =
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let modul = typeof<EvilProviderBase>.Assembly.GetModules().[0]
+    let okType =
+        let members (typ:Type) =
+            let invoke _ = failwith "Kaboom"
+            let fooP = TypeBuilder.CreateProperty(typ, "Foo", typeof<int>, getInvoke = invoke,isStatic = true)
+            fun (_bf:BindingFlags) (mt:MemberTypes) (s:string option) ->
+            [|
+                if mt &&& MemberTypes.Property = MemberTypes.Property then
+                    match s with
+                    |   Some "Foo" -> yield fooP :> MemberInfo
+                    |   None -> yield fooP :> MemberInfo
+                    |   _ -> ()
+            |]
+        TypeBuilder.CreateType(TypeContainer.Namespace(modul, namespaceName), "TheType", members = members)       
+
+    interface IProvidedNamespace with
+        member this.GetNestedNamespaces() = match GetNestedNamespaces with Some f -> f() | None -> [| |]
+        member this.NamespaceName = match get_NamespaceName with Some f -> f() | None -> namespaceName
+        // Return an array
+        member this.GetTypes() = match GetTypes with Some f -> f() | None -> [| okType |]
+        member this.ResolveTypeName(s) = 
+           match ResolveTypeName with 
+           | Some f -> f(s) 
+           | None -> 
+           match s with 
+           | "TheType" -> okType
+           | "IsArrayTypeRaisesException" -> TypeEvil.Intercept(okType, s, get_IsArrayImpl=(fun _ -> doEvil()))
+           | "IsArrayTypeReturnsTrue" -> TypeEvil.Intercept(okType,  s, get_IsArrayImpl=(fun _ -> true))
+           | "IsGenericTypeRaisesException" -> TypeEvil.Intercept(okType,  s, get_IsGenericType=(fun _ -> doEvil()))
+           | "IsGenericTypeReturnsTrue" -> TypeEvil.Intercept(okType,  s, get_IsGenericType=(fun _ -> true))
+           | "TypeWhereNameRaisesException" -> TypeEvil.Intercept(okType, s, get_Name=(fun _ -> doEvil()))
+           | "TypeWhereNameReturnsNull" -> TypeEvil.Intercept(okType, s, get_Name=(fun _ -> null))
+           | "TypeWhereFullNameRaisesException" -> TypeEvil.Intercept(okType, s, get_FullName=(fun _ -> doEvil()))
+           | "TypeWhereFullNameReturnsNull" -> TypeEvil.Intercept(okType,s, get_FullName=(fun _ -> null))
+           | "TypeWhereNamespaceRaisesException" -> TypeEvil.Intercept(okType, s, get_Namespace=(fun _ -> doEvil()))
+           | "TypeWhereNamepsaceReturnsNull" -> TypeEvil.Intercept(okType, s, get_Namespace=(fun _ -> null))
+           | "DeclaringTypeRaisesException" -> TypeEvil.Intercept(okType, s, get_DeclaringType=(fun _ -> doEvil()))
+
+           | "TypeWhereGetMethodsRaisesException" -> TypeEvil.Intercept(okType, s, GetMethods=(fun _ -> doEvil()))
+           | "TypeWhereGetEventsRaisesException" -> TypeEvil.Intercept(okType, s, GetEvents=(fun _ -> doEvil()))
+           | "TypeWhereGetFieldsRaisesException" -> TypeEvil.Intercept(okType, s, GetFields=(fun _ -> doEvil()))
+           | "TypeWhereGetPropertiesRaisesException" -> TypeEvil.Intercept(okType, s, GetProperties=(fun _ -> doEvil()))
+           | "TypeWhereGetNestedTypesRaisesException" -> TypeEvil.Intercept(okType, s, GetNestedTypes=(fun _ -> doEvil()))
+           | "TypeWhereGetConstructorsRaisesException" -> TypeEvil.Intercept(okType, s, GetConstructors=(fun _ -> doEvil()))
+           | "TypeWhereGetInterfacesRaisesException" -> TypeEvil.Intercept(okType, s, GetInterfaces=(fun _ -> doEvil()))
+
+           | "TypeWhereGetMethodsReturnsNull" -> TypeEvil.Intercept(okType, s, GetMethods=(fun _ -> null))
+           | "TypeWhereGetEventsReturnsNull" -> TypeEvil.Intercept(okType, s, GetEvents=(fun _ -> null))
+           | "TypeWhereGetFieldsReturnsNull" -> TypeEvil.Intercept(okType, s, GetFields=(fun _ -> null))
+           | "TypeWhereGetPropertiesReturnsNull" -> TypeEvil.Intercept(okType, s, GetProperties=(fun _ -> null))
+           | "TypeWhereGetNestedTypesReturnsNull" -> TypeEvil.Intercept(okType, s, GetNestedTypes=(fun _ -> null))
+           | "TypeWhereGetConstructorsReturnsNull" -> TypeEvil.Intercept(okType, s, GetConstructors=(fun _ -> null))
+           | "TypeWhereGetInterfacesReturnsNull" -> TypeEvil.Intercept(okType, s, GetInterfaces=(fun _ -> null))
+
+           // positive tests - it should not matter that these raise exceptions
+           | "TypeWhereGetGenericArgumentsRaisesException" -> TypeEvil.Intercept(okType, s, GetGenericArguments=(fun _ -> doEvil()))
+           | "TypeWhereGetMembersRaisesException" -> TypeEvil.Intercept(okType, s, GetMembers=(fun _ -> doEvil()))
+
+           | _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.GetNamespaces() = match GetNamespaces with Some f -> f() | None -> [| this |]
+      
+        member this.GetStaticParameters(typeWithoutArguments) = match GetStaticParameters with Some f -> f() | None -> [| |]
+        member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = match ApplyStaticArguments with Some f -> f() | None -> typeWithoutArguments
+
+        member this.GetInvokerExpression(mb:MethodBase,parameters) = 
+            match GetInvokerExpression with 
+            | Some f -> f() 
+            | None -> 
+            match mb,parameters with
+            |   _, [||] when mb.Name = "get_Foo" ->
+                    let mi = typeof<Runtime>.GetMethod("Id").MakeGenericMethod([|typeof<int>|])
+                    Quotations.Expr.Call(mi, [Quotations.Expr.Value(42) ])
+            |   _ -> failwith "Unexpected method erasure"
+
+
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+       
+[<TypeProvider>]
+type public EvilProvider() = 
+    inherit EvilProviderBase("FSharp.EvilProvider")
+
+
+#if EVIL_PROVIDER_GetNestedNamespaces_Exception
+[<TypeProvider>]
+type public EvilProviderWhereGetNestedNamespacesRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetNestedNamespacesRaisesException",GetNestedNamespaces=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_NamespaceName_Exception
+[<TypeProvider>]
+type public EvilProviderWhereNamespaceNameRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereNamespaceNameRaisesException",get_NamespaceName=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_GetTypes_Exception
+[<TypeProvider>]
+type public EvilProviderWhereGetTypesRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetTypesRaisesException",GetTypes=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_ResolveTypeName_Exception
+[<TypeProvider>]
+type public EvilProviderWhereResolveTypeNameRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereResolveTypeNameRaisesException",ResolveTypeName=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_GetNamespaces_Exception
+[<TypeProvider>]
+type public EvilProviderWhereGetNamespacesRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetNamespacesRaisesException",GetNamespaces=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_GetStaticParameters_Exception
+[<TypeProvider>]
+type public EvilProviderWhereGetStaticParametersRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetStaticParametersRaisesException",GetStaticParameters=(fun _ -> doEvil()))
+#endif
+
+#if EVIL_PROVIDER_GetInvokerExpression_Exception
+[<TypeProvider>]
+type public EvilProviderWhereApplyGetInvokerExpressionRaisesException() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetInvokerExpressionRaisesException",GetInvokerExpression=(fun _ -> doEvil()))
+#endif
+
+
+
+#if EVIL_PROVIDER_GetNestedNamespaces_Null
+[<TypeProvider>]
+type public EvilProviderWhereGetNestedNamespacesReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetNestedNamespacesReturnsNull",GetNestedNamespaces=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_NamespaceName_Null
+[<TypeProvider>]
+type public EvilProviderWhereNamespaceNameReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereNamespaceNameReturnsNull",get_NamespaceName=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_NamespaceName_Empty
+[<TypeProvider>]
+type public EvilProviderWhereNamespaceNameReturnsEmpty() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereNamespaceNameReturnsEmpty",get_NamespaceName=(fun _ -> ""))
+#endif
+
+#if EVIL_PROVIDER_GetTypes_Null
+[<TypeProvider>]
+type public EvilProviderWhereGetTypesReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetTypesReturnsNull",GetTypes=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_ResolveTypeName_Null
+[<TypeProvider>]
+type public EvilProviderWhereResolveTypeNameReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereResolveTypeNameReturnsNull",ResolveTypeName=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_GetNamespaces_Null
+[<TypeProvider>]
+type public EvilProviderWhereGetNamespacesReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetNamespacesReturnsNull",GetNamespaces=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_GetStaticParameters_Null
+[<TypeProvider>]
+type public EvilProviderWhereGetStaticParametersReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetStaticParametersReturnsNull",GetStaticParameters=(fun _ -> null))
+#endif
+
+#if EVIL_PROVIDER_GetInvokerExpression_Null
+[<TypeProvider>]
+type public EvilProviderWhereApplyGetInvokerExpressionReturnsNull() = 
+    inherit EvilProviderBase("FSharp.EvilProviderWhereGetInvokerExpressionReturnsNull",GetInvokerExpression=(fun _ -> Unchecked.defaultof<_>))
+#endif
+
+#if EVIL_PROVIDER_DoesNotHaveConstructor
+[<TypeProvider>]
+type public EvilProviderDoesNotHaveConstructor(_o : obj, s : string) = 
+    inherit EvilProviderBase("FSharp.EvilProviderDoesNotHaveConstructor")
+#endif
+
+#if EVIL_PROVIDER_ConstructorThrows
+[<TypeProvider>]
+type public EvilProviderConstructorThrows() = 
+    inherit EvilProviderBase("FSharp.ConstructorThrows")
+    do failwith "Kaboom"
+#endif
+
+
+type MemoizationTable<'T,'U when 'T : equality>(createType) =
+    let createdDB = new Dictionary<'T,'U>()
+    member x.Contents = (createdDB :> IDictionary<_,_>)
+    member x.Apply typeName =
+        let found,result = createdDB.TryGetValue typeName
+        if found then
+            result 
+        else
+            let ty = createType typeName
+            createdDB.[typeName] <- ty
+            ty 
+
+[<TypeProvider>]
+type public GoodProviderForNegativeStaticParameterTypeTests() =
+    let thisAssembly = typeof<GoodProviderForNegativeStaticParameterTypeTests>.Assembly
+    let modul = thisAssembly.GetModules().[0]
+    let rootNamespace = "FSharp.GoodProviderForNegativeStaticParameterTypeTests"
+    let helloWorldType =
+        let rec allMembers = 
+            lazy 
+                [| for (propertyName, propertyType) in  [for i in 1 .. 2 -> ("StaticProperty"+string i, (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                       yield TypeBuilder.CreateSyntheticProperty(theType,propertyName,propertyType,isStatic=true) :> MemberInfo |]  
+
+        and theType = 
+            let container = TypeContainer.Namespace(modul, rootNamespace)
+            TypeBuilder.CreateSimpleType(container,"HelloWorldType",members=allMembers)
+
+        theType
+
+    // This defines all the members in the one synthetic type. A lazy computation is used to ensure the
+    // members are only created once.
+    let helloWorldTypeWithStaticParameters =
+      MemoizationTable(fun (fullName,n) ->
+        let rec allMembers = 
+            lazy 
+                [| for (propertyName, propertyType) in  [for i in 1 .. n -> ("StaticProperty"+string i, (if i = 1 then typeof<string> else typeof<int>)) ] do 
+                       yield TypeBuilder.CreateSyntheticProperty(theType,propertyName,propertyType,isStatic=true) :> MemberInfo |]  
+
+        and theType = 
+            let container = TypeContainer.Namespace(modul, rootNamespace)
+            TypeBuilder.CreateSimpleType(container,fullName,members=allMembers)
+
+        theType)
+
+    let helloWorldTypeWithStaticParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticParameter",1)
+    let helloWorldTypeWithStaticCharParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticCharParameter",1)
+    let helloWorldTypeWithStaticBoolParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticBoolParameter",1)
+    let helloWorldTypeWithStaticSByteParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticSByteParameter",1)
+    let helloWorldTypeWithStaticInt16ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt16Parameter",1)
+    let helloWorldTypeWithStaticInt32ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt32Parameter",1)
+    let helloWorldTypeWithStaticInt64ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticInt64Parameter",1)
+    let helloWorldTypeWithStaticByteParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticByteParameter",1)
+    let helloWorldTypeWithStaticUInt16ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt16Parameter",1)
+    let helloWorldTypeWithStaticUInt32ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt32Parameter",1)
+    let helloWorldTypeWithStaticUInt64ParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticUInt64Parameter",1)
+    let helloWorldTypeWithStaticStringParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticStringParameter",1)
+    let helloWorldTypeWithStaticSingleParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticSingleParameter",1)
+    let helloWorldTypeWithStaticDoubleParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticDoubleParameter",1)
+    let helloWorldTypeWithStaticDecimalParameterUninstantiated = helloWorldTypeWithStaticParameters.Apply("HelloWorldTypeWithStaticDecimalParameter",1)
+
+    let types = [|helloWorldTypeWithStaticStringParameterUninstantiated; 
+                  helloWorldType;
+                  helloWorldTypeWithStaticCharParameterUninstantiated
+                  helloWorldTypeWithStaticBoolParameterUninstantiated
+                  helloWorldTypeWithStaticSByteParameterUninstantiated
+                  helloWorldTypeWithStaticInt16ParameterUninstantiated
+                  helloWorldTypeWithStaticInt32ParameterUninstantiated
+                  helloWorldTypeWithStaticInt64ParameterUninstantiated
+                  helloWorldTypeWithStaticByteParameterUninstantiated
+                  helloWorldTypeWithStaticUInt16ParameterUninstantiated
+                  helloWorldTypeWithStaticUInt32ParameterUninstantiated
+                  helloWorldTypeWithStaticUInt64ParameterUninstantiated
+                  helloWorldTypeWithStaticStringParameterUninstantiated
+                  helloWorldTypeWithStaticSingleParameterUninstantiated
+                  helloWorldTypeWithStaticDoubleParameterUninstantiated
+                  helloWorldTypeWithStaticDecimalParameterUninstantiated|]
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    // This implements both get_StaticProperty1 and get_StaticProperty2
+    static member GetPropertyByName(propertyName:string) : 'T = 
+        match propertyName with 
+        | "StaticProperty1" -> "You got a static property" |> box |> unbox
+        | "StaticProperty2" -> 42 |> box |> unbox
+        | nm when nm.StartsWith "StaticProperty" -> int (nm.Replace("StaticProperty","")) + 40 |> box |> unbox
+        | _ -> failwith "unexpected property"
+
+    interface IProvidedNamespace with
+        member this.GetNestedNamespaces() = [| |]
+        member this.NamespaceName = rootNamespace
+        member this.GetTypes() = types
+        member __.ResolveTypeName typeName : System.Type = 
+            match typeName with
+            | "HelloWorldType" -> helloWorldType
+            | "HelloWorldTypeWithStaticStringParameter" -> helloWorldTypeWithStaticStringParameterUninstantiated
+            | "HelloWorldTypeWithStaticSByteParameter" -> helloWorldTypeWithStaticSByteParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt16Parameter" -> helloWorldTypeWithStaticInt16ParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt32Parameter" -> helloWorldTypeWithStaticInt32ParameterUninstantiated
+            | "HelloWorldTypeWithStaticInt64Parameter" -> helloWorldTypeWithStaticInt64ParameterUninstantiated
+            | "HelloWorldTypeWithStaticByteParameter" -> helloWorldTypeWithStaticByteParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt16Parameter" -> helloWorldTypeWithStaticUInt16ParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt32Parameter" -> helloWorldTypeWithStaticUInt32ParameterUninstantiated
+            | "HelloWorldTypeWithStaticUInt64Parameter" -> helloWorldTypeWithStaticUInt64ParameterUninstantiated
+            | "HelloWorldTypeWithStaticDecimalParameter" -> helloWorldTypeWithStaticDecimalParameterUninstantiated
+            | "HelloWorldTypeWithStaticSingleParameter" -> helloWorldTypeWithStaticSingleParameterUninstantiated
+            | "HelloWorldTypeWithStaticDoubleParameter" -> helloWorldTypeWithStaticDoubleParameterUninstantiated
+            | "HelloWorldTypeWithStaticBoolParameter" -> helloWorldTypeWithStaticBoolParameterUninstantiated
+            | "HelloWorldTypeWithStaticCharParameter" -> helloWorldTypeWithStaticCharParameterUninstantiated
+            | _ -> null
+       
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.GetNamespaces() = [| this |]
+        member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   "HelloWorldTypeWithStaticSByteParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<sbyte>, 0) |]
+            |   "HelloWorldTypeWithStaticInt16Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<int16>, 0) |]
+            |   "HelloWorldTypeWithStaticInt32Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<int32>, 0) |]
+            |   "HelloWorldTypeWithStaticInt64Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<int64>, 0) |]
+            |   "HelloWorldTypeWithStaticByteParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<byte>, 0) |]
+            |   "HelloWorldTypeWithStaticUInt16Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<uint16>, 0) |]
+            |   "HelloWorldTypeWithStaticUInt32Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<uint32>, 0) |]
+            |   "HelloWorldTypeWithStaticUInt64Parameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<uint64>, 0) |]
+            |   "HelloWorldTypeWithStaticStringParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<string>, 0) |]
+            |   "HelloWorldTypeWithStaticDecimalParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<decimal>, 0) |]
+            |   "HelloWorldTypeWithStaticSingleParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<single>, 0) |]
+            |   "HelloWorldTypeWithStaticDoubleParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<double>, 0) |]
+            |   "HelloWorldTypeWithStaticBoolParameter" -> [| TypeBuilder.CreateStaticParameter("Flag",typeof<bool>, 0) |]
+            |   "HelloWorldTypeWithStaticCharParameter" -> [| TypeBuilder.CreateStaticParameter("Count",typeof<char>, 0) |]
+            |   _ -> [| |]
+
+        member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) =
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            match typeWithoutArguments.Name with
+            | "HelloWorldType" -> 
+                if staticArguments.Length <> 0 then failwith "this provided type does not accept static parameters" 
+                helloWorldType
+            | "HelloWorldTypeWithStaticSByteParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> sbyte |> int)
+            | "HelloWorldTypeWithStaticInt16Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int16 |> int)
+            | "HelloWorldTypeWithStaticInt32Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int)
+            | "HelloWorldTypeWithStaticInt64Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> int64 |> int)
+            | "HelloWorldTypeWithStaticByteParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> byte |> int)
+            | "HelloWorldTypeWithStaticUInt16Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint16 |> int)
+            | "HelloWorldTypeWithStaticUInt32Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint32 |> int)
+            | "HelloWorldTypeWithStaticUInt64Parameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> uint64 |> int)
+            | "HelloWorldTypeWithStaticBoolParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, if (staticArguments.[0] :?> bool) then 1 else 0)
+            | "HelloWorldTypeWithStaticStringParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> string |> String.length)
+            | "HelloWorldTypeWithStaticDecimalParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> decimal |> int)
+            | "HelloWorldTypeWithStaticCharParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> char |> int)
+            | "HelloWorldTypeWithStaticSingleParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> single |> int)
+            | "HelloWorldTypeWithStaticDoubleParameter" -> 
+                if staticArguments.Length <> 1 then failwith "this provided type accepts one static parameter" 
+                helloWorldTypeWithStaticParameters.Apply (typeNameWithArguments, staticArguments.[0] :?> double |> int)
+            | nm -> failwith (sprintf "ApplyStaticArguments %s" nm)
+
+        member __.GetInvokerExpression(syntheticMethodBase:MethodBase, parameterExpressions:Quotations.Expr []) = 
+            // trim off the "get_"
+            if not (syntheticMethodBase.Name.StartsWith "get_") then failwith "expected syntheticMethodBase to be a property getter, with name starting with \"get_\""
+            let propertyName = syntheticMethodBase.Name.Substring(4)
+            let syntheticMethodBase = syntheticMethodBase :?> MethodInfo
+            let getClassInstancesByName = 
+                typeof<GoodProviderForNegativeStaticParameterTypeTests>
+                    .GetMethod("GetPropertyByName", BindingFlags.Static ||| BindingFlags.Public)
+                    .MakeGenericMethod([|syntheticMethodBase.ReturnType|])
+            Quotations.Expr.Call(getClassInstancesByName, [ Quotations.Expr.Value(propertyName) ])
+
+        // This event is never triggered in this sample, because the schema never changes
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+       
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+
+#if EVIL_PROVIDER_ReturnsAGeneratedTypeNotNestedInAnErasedType
+[<TypeProvider>]
+// Evil in the sense that it returns a generated type that is not nested in a container type
+type public EvilGeneratedProviderThatReturnsAGeneratedTypeNotNestedInAnErasedType(config: TypeProviderConfig) =
+    let modul = typeof<EvilGeneratedProviderThatReturnsAGeneratedTypeNotNestedInAnErasedType>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.EvilGeneratedProviderThatReturnsAGeneratedTypeNotNestedInAnErasedType"
+    let theType = Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided.dll")).GetType("TheGeneratedType")
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    interface IProvidedNamespace with
+       member this.NamespaceName = rootNamespace
+       member this.GetTypes() = [|theType|]
+       member this.GetNestedNamespaces() = [| |]
+       member this.ResolveTypeName typeName =
+         match typeName with
+         |   "TheType" -> theType
+         |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| this |]
+       member this.GetStaticParameters(typeWithoutArguments) =  [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = typeWithoutArguments
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+       
+#endif
+
+#if EVIL_PROVIDER_GeneratesMscorlibTypes
+[<TypeProvider>]
+type public EvilProviderGeneratesMscorlibTypes() =
+    let invalidation = new Event<System.EventHandler,_>()
+
+    interface IProvidedNamespace with
+       member this.NamespaceName = "FSharp.EvilProviderGeneratesMscorlibTypes"
+       member this.GetTypes() = [|typeof<int>|]
+       member this.GetNestedNamespaces() = [| |]
+       member this.ResolveTypeName typeName =
+         match typeName with
+         |   "M" -> typeof<int>
+         |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| this |]
+       member this.GetStaticParameters(typeWithoutArguments) =  [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = typeWithoutArguments
+       member this.ResolveExtensionReference(name) = null
+
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+#endif
+
+#if EVIL_PROVIDER_ReturnsTypeWithIncorrectNameFromApplyStaticArguments
+[<TypeProvider>]
+// Evil in the sense that it returns a generated type that is not nested in a container type
+type public EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments(config: TypeProviderConfig) =
+    let modul = typeof<EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments>.Assembly.GetModules().[0]
+    let rootNamespace = "FSharp.EvilGeneratedProviderThatReturnsTypeWithIncorrectNameFromApplyStaticArguments"
+
+    let typeTable = 
+        MemoizationTable(fun (_actualName,c) -> 
+             let theType = System.Reflection.Assembly.LoadFrom(Path.Combine(Path.GetDirectoryName config.RuntimeAssembly,"provided"+c+".dll")).GetType("TheGeneratedType"+c)
+             
+             // The error here is that a type with name "TheContainerType" is returned instead of a type with name "actualName"
+             let theContainerType = TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace), "TheContainerType", members=lazy [| theType |])
+             theContainerType)
+
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let theContainerTypeUninstantiated = typeTable.Apply("TheContainerType","")
+    interface IProvidedNamespace with
+       member this.NamespaceName = rootNamespace
+       member this.GetTypes() = [|theContainerTypeUninstantiated|]
+       member this.GetNestedNamespaces() = [| |]
+       member this.ResolveTypeName typeName =
+         match typeName with
+         |   "TheContainerType" -> theContainerTypeUninstantiated
+         |   _ -> null
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+       member this.GetNamespaces() = [| this |]
+       member this.GetStaticParameters(typeWithoutArguments) = 
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> [| TypeBuilder.CreateStaticParameter("Tag",typeof<string>, 0) |]
+            | _ -> [| |]
+       member this.ApplyStaticArguments(typeWithoutArguments, typeNameWithArguments, staticArguments) = 
+            let typeNameWithArguments = typeNameWithArguments.[typeNameWithArguments.Length-1]
+            match typeWithoutArguments.Name with
+            |   "TheContainerType" -> 
+                match (staticArguments.[0] :?> string) with 
+                | "J" -> typeTable.Apply (typeNameWithArguments, "J")
+                | "K" -> typeTable.Apply (typeNameWithArguments, "K")
+                | _ -> failwith "invalid static parameter to TheContainerType: expected 'J' or 'K'"
+            | _ -> null
+
+       member __.GetInvokerExpression(mbase, parameters) = TypeBuilder.StandardGenerativeGetInvokerExpression(mbase, parameters)
+       [<CLIEvent>]
+       member this.Invalidate = invalidation.Publish
+       member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+       
+#endif
diff --git a/tests/fsharp/typeProviders/negTests/providerAttributeError.fsx b/tests/fsharp/typeProviders/negTests/providerAttributeError.fsx
new file mode 100644
index 0000000..c26a891
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/providerAttributeError.fsx
@@ -0,0 +1,3 @@
+
+[<Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute("Invalid.Assembly.Name")>]
+do()
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/negTests/providerAttributeErrorConsume.fsx b/tests/fsharp/typeProviders/negTests/providerAttributeErrorConsume.fsx
new file mode 100644
index 0000000..8af091f
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/providerAttributeErrorConsume.fsx
@@ -0,0 +1 @@
+#r "provider_providerAttributeErrorConsume.dll"
diff --git a/tests/fsharp/typeProviders/negTests/providerAttribute_Empty.fsx b/tests/fsharp/typeProviders/negTests/providerAttribute_Empty.fsx
new file mode 100644
index 0000000..d61fd98
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/providerAttribute_Empty.fsx
@@ -0,0 +1,3 @@
+
+[<Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute("")>]
+do()
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/negTests/providerAttribute_EmptyConsume.fsx b/tests/fsharp/typeProviders/negTests/providerAttribute_EmptyConsume.fsx
new file mode 100644
index 0000000..669525e
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/providerAttribute_EmptyConsume.fsx
@@ -0,0 +1 @@
+#r "provider_ProviderAttribute_EmptyConsume.dll"
diff --git a/tests/fsharp/typeProviders/negTests/sed.fsx b/tests/fsharp/typeProviders/negTests/sed.fsx
new file mode 100644
index 0000000..1bee371
--- /dev/null
+++ b/tests/fsharp/typeProviders/negTests/sed.fsx
@@ -0,0 +1,8 @@
+open System
+
+let fromPatt = fsi.CommandLineArgs.[1]
+let toPatt = fsi.CommandLineArgs.[2]
+
+let s = Console.In.ReadToEnd()
+let s' = s.Replace(fromPatt, toPatt)
+Console.Out.Write(s')
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/splitAssembly/build.bat b/tests/fsharp/typeProviders/splitAssembly/build.bat
new file mode 100644
index 0000000..6765e65
--- /dev/null
+++ b/tests/fsharp/typeProviders/splitAssembly/build.bat
@@ -0,0 +1,27 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+
+%FSC% --out:provider.dll -a provider.fs
+if errorlevel 1 goto :Error
+
+%FSC% --out:providerDesigner.dll -a providerDesigner.fsx
+
+
+call %~d0%~p0..\..\single-test-build.bat
+goto :Ok
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typeProviders/splitAssembly/provider.fs b/tests/fsharp/typeProviders/splitAssembly/provider.fs
new file mode 100644
index 0000000..7324864
--- /dev/null
+++ b/tests/fsharp/typeProviders/splitAssembly/provider.fs
@@ -0,0 +1,17 @@
+namespace Microsoft.FSharp.Core.CompilerServices
+
+type TypeProviderAssemblyAttribute(assemblyName) =
+    inherit System.Attribute()
+
+    new() = TypeProviderAssemblyAttribute(null)
+    member this.AssemblyName 
+        with get () = assemblyName 
+
+[<assembly:TypeProviderAssembly("providerDesigner")>]
+do()
+
+
+namespace My
+    type Runtime =
+        static member Id x = x
+
diff --git a/tests/fsharp/typeProviders/splitAssembly/providerDesigner.fsx b/tests/fsharp/typeProviders/splitAssembly/providerDesigner.fsx
new file mode 100644
index 0000000..3f2183f
--- /dev/null
+++ b/tests/fsharp/typeProviders/splitAssembly/providerDesigner.fsx
@@ -0,0 +1,51 @@
+namespace Provider
+#load @"..\helloWorld\TypeMagic.fs"
+open Microsoft.FSharp.Core.CompilerServices
+open System.Collections.Generic
+open System.IO
+open System
+open System.Reflection
+open System.Linq.Expressions
+open FSharp.TypeMagic
+
+[<TypeProvider>]
+type public Provider(config : TypeProviderConfig) =
+    let runtimeAssembly = Assembly.ReflectionOnlyLoadFrom(config.RuntimeAssembly)
+    let modul = runtimeAssembly.GetModules().[0]
+
+    let ``My.Runtime`` = runtimeAssembly.GetType("My.Runtime")
+    let rootNamespace = "FSharp.SplitAssembly"
+    let invalidation = new Event<System.EventHandler,_>()
+
+    let theType = 
+        let rec members =
+            lazy
+                [|  let p = TypeBuilder.CreateSyntheticProperty(theType,"Foo",typeof<int>,isStatic=true) 
+                    yield! TypeBuilder.JoinPropertiesIntoMemberInfos [p]
+                |]
+        and theType =                
+            TypeBuilder.CreateSimpleType(TypeContainer.Namespace(modul,rootNamespace),"TheType", members = members)
+        theType
+
+    interface IProvidedNamespace with
+        member this.NamespaceName = rootNamespace
+        member this.GetNestedNamespaces() = [||]
+        member this.ResolveTypeName typeName =
+            match typeName with
+            |   "TheType" -> theType
+            |   _ -> null
+        member this.GetTypes() = [| theType |] 
+
+    interface IDisposable with
+        member __.Dispose() = ()
+    interface ITypeProvider with
+        member this.ApplyStaticArguments (st,_,_) = st
+        member this.GetInvokerExpression(mb,p) = 
+            let mi = ``My.Runtime``.GetMethod("Id").MakeGenericMethod([|typeof<int>|])
+            Quotations.Expr.Call(mi, [ Quotations.Expr.Value(42) ])
+        member this.GetNamespaces() = [| this |]
+        member this.GetStaticParameters st = [||]
+        [<CLIEvent>]
+        member this.Invalidate = invalidation.Publish
+        member this.GetGeneratedAssemblyContents(assembly) = failwith "GetGeneratedAssemblyContents - only erased types were provided!!"
+
diff --git a/tests/fsharp/typeProviders/splitAssembly/run.bat b/tests/fsharp/typeProviders/splitAssembly/run.bat
new file mode 100644
index 0000000..47024ee
--- /dev/null
+++ b/tests/fsharp/typeProviders/splitAssembly/run.bat
@@ -0,0 +1,10 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0..\..\..\config.bat
+
+call %~d0%~p0..\..\single-test-run.bat
+
+endlocal
+exit /b %ERRORLEVEL%
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/splitAssembly/test.fsx b/tests/fsharp/typeProviders/splitAssembly/test.fsx
new file mode 100644
index 0000000..be74124
--- /dev/null
+++ b/tests/fsharp/typeProviders/splitAssembly/test.fsx
@@ -0,0 +1,43 @@
+#r "provider.dll"
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s+": YES") 
+  else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+(*========================================================================*)
+
+check "fgdjkwefg"
+    FSharp.SplitAssembly.TheType.Foo
+    42
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typeProviders/tdirs b/tests/fsharp/typeProviders/tdirs
new file mode 100644
index 0000000..b14664e
--- /dev/null
+++ b/tests/fsharp/typeProviders/tdirs
@@ -0,0 +1,8 @@
+builtin
+diamondAssembly
+globalNamespace
+helloWorld
+helloWorldCSharp
+negTests
+splitAssembly
+wedgeAssembly
\ No newline at end of file
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/build.bat b/tests/fsharp/typeProviders/wedgeAssembly/build.bat
new file mode 100644
index 0000000..99e6b3f
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/build.bat
@@ -0,0 +1,71 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+if EXIST provider.dll del provider.dll
+if errorlevel 1 goto :Error
+
+if EXIST provided.dll del provided.dll
+if errorlevel 1 goto :Error
+
+%FSC% --out:provided.dll -a ..\helloWorld\provided.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedJ.dll del providedJ.dll
+if errorlevel 1 goto :Error
+
+%FSC% --out:providedJ.dll -a ..\helloWorld\providedJ.fs
+if errorlevel 1 goto :Error
+
+if EXIST providedK.dll del providedK.dll
+if errorlevel 1 goto :Error
+
+%FSC% --out:providedK.dll -a ..\helloWorld\providedK.fs
+if errorlevel 1 goto :Error
+
+
+
+%FSC% --out:provider.dll -a ..\helloWorld\provider.fsx
+if errorlevel 1 goto :Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2a.dll -a test2a.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2b.dll -a test2b.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test3.exe test3.fsx
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2a-with-sig.dll -a test2a.fsi test2a.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2b-with-sig.dll -a test2b.fsi test2b.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test3-with-sig.exe --define:SIGS test3.fsx
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2a-with-sig-restricted.dll -a test2a-restricted.fsi test2a.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test2b-with-sig-restricted.dll -a test2b-restricted.fsi test2b.fs
+if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --debug+ -r:provider.dll --optimize- -o:test3-with-sig-restricted.exe --define:SIGS_RESTRICTED test3.fsx
+if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo. > build.ok
+endlocal
+exit /b 0
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat  %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
+
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/run.bat b/tests/fsharp/typeProviders/wedgeAssembly/run.bat
new file mode 100644
index 0000000..b16278d
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/run.bat
@@ -0,0 +1,29 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+
+call %~d0%~p0\..\..\..\config.bat
+
+"%PEVERIFY%" test2a.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test2b.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" test3.exe
+ at if ERRORLEVEL 1 goto Error
+
+test3.exe
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Ran fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Error
+echo Test Script Failed (perhaps test did not emit test.ok signal file?)
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi
new file mode 100644
index 0000000..84397d0
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a-restricted.fsi
@@ -0,0 +1,48 @@
+module Test2a
+
+module ErasedTypes = 
+    val f : unit -> FSharp.HelloWorld.HelloWorldType
+    val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool
+
+(*
+// this test hides this internal part of the signature:
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+    val internal f2 : unit -> TheGeneratedType1
+    val internal f3 : unit -> TheGeneratedType1
+    val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool
+*)
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+    val f2 : unit -> TheGeneratedType2
+    val f3 : unit -> TheGeneratedType2
+    val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool
+
+module PublicErasedQuotations = 
+    val q1 : Quotations.Expr<FSharp.HelloWorld.HelloWorldSubType -> FSharp.HelloWorld.HelloWorldSubType>
+    val q2 : Quotations.Expr<FSharp.HelloWorld.HelloWorldType.NestedType -> FSharp.HelloWorld.HelloWorldType.NestedType>
+
+module PublicErasedTypesWithStaticParameters = 
+    val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> 
+    val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> 
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool
+    val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool
+
+module GenerativeTypesWithStaticParameters = 
+(*
+// this test hides this internal part of the signature:
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+    val internal v1 : TheGeneratedTypeJ 
+    val v2 : int
+*)
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+    val v3 : TheGeneratedTypeK 
+    val v4 : int
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs
new file mode 100644
index 0000000..ecc46c6
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fs
@@ -0,0 +1,54 @@
+module Test2a
+
+module ErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+module PublicErasedQuotations = 
+    let q1 = <@ (fun (x : FSharp.HelloWorld.HelloWorldSubType) -> x) @>
+    let q2 = <@ (fun (x : FSharp.HelloWorld.HelloWorldType.NestedType) -> x) @>
+
+module PublicErasedTypesWithStaticParameters = 
+    let f1() : FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> = Unchecked.defaultof<_>
+    let f2() : FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> = Unchecked.defaultof<_>
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    let testTypeEquivString1(a:AbbrevString1,b:AbbrevString1) = (a = b)
+    let testTypeEquivString2(a:AbbrevString2,b:AbbrevString2) = (a = b)
+
+
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+
+    let internal f2() : TheGeneratedType1 = Unchecked.defaultof<_>
+    let internal f3() : TheGeneratedType1 = Unchecked.defaultof<_>
+    let internal testTypeEquiv2(a:TheGeneratedType1,b:TheGeneratedType1) = (a = b)
+
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+
+    let f2() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b)
+
+
+module GenerativeTypesWithStaticParameters = 
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+
+    let internal v1 : TheGeneratedTypeJ = TheGeneratedTypeJ()
+
+    let v2 = v1.Item1
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+
+    let v3 : TheGeneratedTypeK = TheGeneratedTypeK()
+
+    let v4 = v3.Item1
+
+
+//#endif
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi
new file mode 100644
index 0000000..1565ca6
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2a.fsi
@@ -0,0 +1,44 @@
+module Test2a
+
+module ErasedTypes = 
+    val f : unit -> FSharp.HelloWorld.HelloWorldType
+    val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool
+
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+    val internal f2 : unit -> TheGeneratedType1
+    val internal f3 : unit -> TheGeneratedType1
+    val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+    val f2 : unit -> TheGeneratedType2
+    val f3 : unit -> TheGeneratedType2
+    val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool
+
+module PublicErasedQuotations = 
+    val q1 : Quotations.Expr<FSharp.HelloWorld.HelloWorldSubType -> FSharp.HelloWorld.HelloWorldSubType>
+    val q2 : Quotations.Expr<FSharp.HelloWorld.HelloWorldType.NestedType -> FSharp.HelloWorld.HelloWorldType.NestedType>
+
+module PublicErasedTypesWithStaticParameters = 
+    val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> 
+    val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> 
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool
+    val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool
+
+module GenerativeTypesWithStaticParameters = 
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+    val internal v1 : TheGeneratedTypeJ 
+    val v2 : int
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+    val v3 : TheGeneratedTypeK 
+    val v4 : int
+
+
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi
new file mode 100644
index 0000000..c3316ea
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b-restricted.fsi
@@ -0,0 +1,50 @@
+module Test2b
+
+module ErasedTypes = 
+    val f : unit -> FSharp.HelloWorld.HelloWorldType
+    val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool
+
+(*
+// this test hides this internal part of the signature:
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+    val internal f2 : unit -> TheGeneratedType1
+    val internal f3 : unit -> TheGeneratedType1
+    val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool
+*)
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+    val f2 : unit -> TheGeneratedType2
+    val f3 : unit -> TheGeneratedType2
+    val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool
+
+module PublicErasedQuotations = 
+    val q1 : Quotations.Expr<FSharp.HelloWorld.HelloWorldSubType -> FSharp.HelloWorld.HelloWorldSubType>
+    val q2 : Quotations.Expr<FSharp.HelloWorld.HelloWorldType.NestedType -> FSharp.HelloWorld.HelloWorldType.NestedType>
+
+module PublicErasedTypesWithStaticParameters = 
+    val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> 
+    val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> 
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool
+    val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool
+
+module GenerativeTypesWithStaticParameters = 
+(*
+// this test hides this internal part of the signature:
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+    val internal v1 : TheGeneratedTypeJ 
+    val v2 : int
+*)
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+    val v3 : TheGeneratedTypeK 
+    val v4 : int
+
+
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs
new file mode 100644
index 0000000..bc7bb2c
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fs
@@ -0,0 +1,54 @@
+module Test2b
+
+module ErasedTypes = 
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+module PublicErasedQuotations = 
+    let q1 = <@ (fun (x : FSharp.HelloWorld.HelloWorldSubType) -> x) @>
+    let q2 = <@ (fun (x : FSharp.HelloWorld.HelloWorldType.NestedType) -> x) @>
+
+module PublicErasedTypesWithStaticParameters = 
+    let f1() : FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> = Unchecked.defaultof<_>
+    let f2() : FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> = Unchecked.defaultof<_>
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    let testTypeEquivString1(a:AbbrevString1,b:AbbrevString1) = (a = b)
+    let testTypeEquivString2(a:AbbrevString2,b:AbbrevString2) = (a = b)
+
+
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+
+    let internal f2() : TheGeneratedType1 = Unchecked.defaultof<_>
+    let internal f3() : TheGeneratedType1 = Unchecked.defaultof<_>
+    let internal testTypeEquiv2(a:TheGeneratedType1,b:TheGeneratedType1) = (a = b)
+
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+
+    let f2() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let f3() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b)
+
+
+module GenerativeTypesWithStaticParameters = 
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+
+    let internal v1 : TheGeneratedTypeJ = TheGeneratedTypeJ()
+
+    let v2 = v1.Item1
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+
+    let v3 : TheGeneratedTypeK = TheGeneratedTypeK()
+
+    let v4 = v3.Item1
+
+
+//#endif
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi
new file mode 100644
index 0000000..0592180
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test2b.fsi
@@ -0,0 +1,44 @@
+module Test2b
+
+module ErasedTypes = 
+    val f : unit -> FSharp.HelloWorld.HelloWorldType
+    val testTypeEquiv : FSharp.HelloWorld.HelloWorldType * FSharp.HelloWorld.HelloWorldType -> bool
+
+module InternalGenerativeTypes = 
+    
+    type internal TheGeneratedType1 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType1">
+    val internal f2 : unit -> TheGeneratedType1
+    val internal f3 : unit -> TheGeneratedType1
+    val internal testTypeEquiv2 : TheGeneratedType1 * TheGeneratedType1 -> bool
+
+module PublicGenerativeTypes = 
+    
+    type TheGeneratedType2 = FSharp.HelloWorldGenerative.TheContainerType<"TheGeneratedType2">
+    val f2 : unit -> TheGeneratedType2
+    val f3 : unit -> TheGeneratedType2
+    val testTypeEquiv2 : TheGeneratedType2 * TheGeneratedType2 -> bool
+
+module PublicErasedQuotations = 
+    val q1 : Quotations.Expr<FSharp.HelloWorld.HelloWorldSubType -> FSharp.HelloWorld.HelloWorldSubType>
+    val q2 : Quotations.Expr<FSharp.HelloWorld.HelloWorldType.NestedType -> FSharp.HelloWorld.HelloWorldType.NestedType>
+
+module PublicErasedTypesWithStaticParameters = 
+    val f1 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticInt32Parameter<1> 
+    val f2 : unit -> FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1"> 
+    type AbbrevString1 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"1">
+    type AbbrevString2 = FSharp.HelloWorld.HelloWorldTypeWithStaticStringParameter<"2">
+    val testTypeEquivString1 : AbbrevString1 * AbbrevString1 -> bool
+    val testTypeEquivString2 : AbbrevString2 * AbbrevString2 -> bool
+
+module GenerativeTypesWithStaticParameters = 
+    
+    type internal TheGeneratedTypeJ = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"J">
+    val internal v1 : TheGeneratedTypeJ 
+    val v2 : int
+
+    
+    type TheGeneratedTypeK = FSharp.HelloWorldGenerativeWithStaticParameter.TheContainerType<"K">
+    val v3 : TheGeneratedTypeK 
+    val v4 : int
+
+
diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx
new file mode 100644
index 0000000..707609b
--- /dev/null
+++ b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx
@@ -0,0 +1,125 @@
+
+#r "provider.dll"
+#if SIGS
+#r "test2a-with-sig.dll"
+#r "test2b-with-sig.dll"
+#else
+#if SIGS_RESTRICTED
+#r "test2a-with-sig-restricted.dll"
+#r "test2b-with-sig-restricted.dll"
+#else
+#r "test2a.dll"
+#r "test2b.dll"
+#endif
+#endif
+
+
+let mutable failures = []
+let reportFailure s = 
+  stdout.WriteLine "\n................TEST FAILED...............\n"; failures <- failures @ [s]
+
+let argv = System.Environment.GetCommandLineArgs() 
+let SetCulture() = 
+  if argv.Length > 2 && argv.[1] = "--culture" then  begin
+    let cultureString = argv.[2] in 
+    let culture = new System.Globalization.CultureInfo(cultureString) in 
+    stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
+    System.Threading.Thread.CurrentThread.CurrentCulture <-  culture
+  end 
+  
+do SetCulture()    
+
+let check s e r = 
+  if r = e then  stdout.WriteLine (s+": YES") 
+  else (stdout.WriteLine ("\n***** "+s+": FAIL\n"); reportFailure s)
+
+let test s b = 
+  if b then ( (* stdout.WriteLine ("passed: " + s) *) ) 
+  else (stderr.WriteLine ("failure: " + s); 
+        reportFailure s)
+
+(*========================================================================*)
+
+module ReferenceNonGenerativeTypesAcrossAssemblies = 
+
+    let f() : FSharp.HelloWorld.HelloWorldType = Unchecked.defaultof<_>
+    let testTypeEquiv(a:FSharp.HelloWorld.HelloWorldType,b:FSharp.HelloWorld.HelloWorldType) = (a = b)
+
+
+    check "jcenewnwe091q" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092w" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092e" (Test2a.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091r" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092t" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092y" (Test2a.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091u" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092i" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092o" (Test2b.ErasedTypes.testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091p" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092a" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092s" (Test2b.ErasedTypes.testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+
+    check "jcenewnwe091d" (testTypeEquiv(Test2a.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092f" (testTypeEquiv(Test2a.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092g" (testTypeEquiv(Test2a.ErasedTypes.f(), f())) true
+
+    check "jcenewnwe091h" (testTypeEquiv(Test2b.ErasedTypes.f(), Test2a.ErasedTypes.f())) true
+    check "jcenewnwe092j" (testTypeEquiv(Test2b.ErasedTypes.f(), Test2b.ErasedTypes.f())) true
+    check "jcenewnwe092k" (testTypeEquiv(Test2b.ErasedTypes.f(), f())) true
+
+(*========================================================================*)
+
+module ReferenceGenerativeTypeAcrossAssemblies = 
+    let f2() : Test2a.PublicGenerativeTypes.TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2a(a:Test2a.PublicGenerativeTypes.TheGeneratedType2,b:Test2a.PublicGenerativeTypes.TheGeneratedType2) = (a = b)
+
+    check "jcenewnwe091z" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091x" (Test2a.PublicGenerativeTypes.testTypeEquiv2(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f3())) true
+
+    check "jcenewnwe091c" (testTypeEquiv2a(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091v" (testTypeEquiv2a(Test2a.PublicGenerativeTypes.f2(), Test2a.PublicGenerativeTypes.f3())) true
+
+    let f3() : Test2b.PublicGenerativeTypes.TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2b(a:Test2b.PublicGenerativeTypes.TheGeneratedType2,b:Test2b.PublicGenerativeTypes.TheGeneratedType2) = (a = b)
+
+    check "jcenewnwe091b" (testTypeEquiv2b(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091n" (testTypeEquiv2b(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f3())) true
+    check "jcenewnwe091m" (testTypeEquiv2b(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f2())) true
+    check "jcenewnwe091Q" (testTypeEquiv2b(Test2b.PublicGenerativeTypes.f2(), Test2b.PublicGenerativeTypes.f3())) true
+
+module ReferenceGenerativeTypeAcrossAssembliesViaOpen = 
+    open Test2a.PublicGenerativeTypes
+    let f2() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2a(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b)
+
+    check "jcenewnwe091W" (testTypeEquiv2(f2(), f2())) true
+    check "jcenewnwe091E" (testTypeEquiv2(f2(), f3())) true
+
+    check "jcenewnwe091R" (testTypeEquiv2a(f2(), f2())) true
+    check "jcenewnwe091T" (testTypeEquiv2a(f2(), f3())) true
+
+    open Test2b.PublicGenerativeTypes
+    let f3() : TheGeneratedType2 = Unchecked.defaultof<_>
+    let testTypeEquiv2b(a:TheGeneratedType2,b:TheGeneratedType2) = (a = b)
+
+    check "jcenewnwe091Y" (testTypeEquiv2b(f2(), f2())) true
+    check "jcenewnwe091U" (testTypeEquiv2b(f2(), f3())) true
+    check "jcenewnwe091I" (testTypeEquiv2b(f2(), f2())) true
+    check "jcenewnwe091O" (testTypeEquiv2b(f2(), f3())) true
+
+(*---------------------------------------------------------------------------
+!* wrap up
+ *--------------------------------------------------------------------------- *)
+
+let _ = 
+  if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) 
+
+do (stdout.WriteLine "Test Passed"; 
+    System.IO.File.WriteAllText("test.ok","ok"); 
+    exit 0)
+
+
diff --git a/tests/fsharp/typecheck/misc/build.bat b/tests/fsharp/typecheck/misc/build.bat
new file mode 100644
index 0000000..6df2653
--- /dev/null
+++ b/tests/fsharp/typecheck/misc/build.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-build.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typecheck/misc/run.bat b/tests/fsharp/typecheck/misc/run.bat
new file mode 100644
index 0000000..06ffddc
--- /dev/null
+++ b/tests/fsharp/typecheck/misc/run.bat
@@ -0,0 +1,5 @@
+ at if "%_echo%"=="" echo off
+
+call %~d0%~p0..\..\single-test-run.bat
+
+exit /b %ERRORLEVEL%
diff --git a/tests/fsharp/typecheck/misc/test.ml b/tests/fsharp/typecheck/misc/test.ml
new file mode 100644
index 0000000..4a2e5c8
--- /dev/null
+++ b/tests/fsharp/typecheck/misc/test.ml
@@ -0,0 +1,37 @@
+// #TypeInference #Regression 
+(* Avoid ;; since it allows fsi to recover from type errors *)
+
+open System.Collections.Generic
+let repro (ie : IEnumerable<'a>) = None
+(* avoid ;; -- to avoid fsi error recovery *)    
+
+(* Bug693: user annotated 'a generalised, and then picked up (out of scope) from tpenv *)
+let create() = new Event<_>()
+let f () = 
+    // let sendM,_ = Event.create() in // : ('a -> unit) * 'a IEvent in
+    let sendM = create().Trigger in // : ('a -> unit) in
+ // let sendM = create()       : ('a -> unit) in
+    let delegateSendM msg = new System.Converter<'a,unit>(fun _ -> sendM msg) in
+    let send (msg:'a) = delegateSendM msg in
+    send
+(* avoid ;; -- to avoid fsi error recovery *)    
+      
+let Memoize f = 
+    let t = new Dictionary<_,_>(1000) in
+    fun x -> 
+        let ok,v = t.TryGetValue(x) in
+        if ok then Some v else None
+(* avoid ;; -- to avoid fsi error recovery *)    
+
+(* Bug 1143: are generated signatures correct for these? *)
+let fA<'a> = printf "\nRUN at %s\n" (typeof<'a>).FullName;12;;
+let fB<'a> (x:int) = printf "\nRUN at %s\n" (typeof<'a>).FullName;12;;
+let fC<'a,'b> (x:'a) = printf "\nRUN at %s\n" (typeof<'a>).FullName;12;;
+          
+let _ =
+  (* May not be enough if fsi does error recovery...
+   * So avoid using ;;
+   *)
+  System.Console.WriteLine "Test Passed"; 
+  System.IO.File.WriteAllText ("test.ok", "ok"); 
+  exit 0
diff --git a/tests/fsharp/typecheck/sigs/build.bat b/tests/fsharp/typecheck/sigs/build.bat
new file mode 100644
index 0000000..6fcc289
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/build.bat
@@ -0,0 +1,471 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+REM Configure the sample, i.e. where to find the F# compiler and C# compiler.
+
+call %~d0%~p0..\..\..\config.bat
+
+call ..\..\single-neg-test.bat neg91
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% --target:exe -o:pos13.exe  pos13.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos13.exe
+ at if ERRORLEVEL 1 goto Error
+
+pos13.exe
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos12.dll  pos12.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos11.dll  pos11.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos10.dll  pos10.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos10.dll
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg90
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg89
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg88
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos09.dll  pos09.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos09.dll
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg87
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg86
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg85
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg84
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg83
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg82
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg81
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg80
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg79
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg78
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg77
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg76
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg75
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg74
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg73
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg72
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg71
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg70
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg69
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg68
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg67
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg66
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg65
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg64
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg61
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg63
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg62
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg20
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg24
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg32
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg37
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg37_a
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg60
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg59
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg58
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg57
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg56
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg56_a
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg56_b
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg55
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg54
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg53
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg52
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg51
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg50
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg49
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg48
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg47
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg46
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg10
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg10_a
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg45
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg44
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg43
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg38
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg39
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg40
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg41
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg42
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos07.dll  pos07.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos07.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -a -o:pos08.dll  pos08.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos08.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -a -o:pos06.dll  pos06.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos06.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+"%FSC%" %fsc_flags% -a -o:pos03.dll  pos03.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos03.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos03a.dll  pos03a.fsi pos03a.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos03a.dll
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg34
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg33
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg30
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg31
+ at if ERRORLEVEL 1 goto Error
+
+
+
+call ..\..\single-neg-test.bat neg29
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg28
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg07
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_20
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_1
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_2
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_3
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_4
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_5
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_6
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_7
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_8
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_10
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_11
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_12
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_13
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_14
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_15
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_16
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_17
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_18
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_19
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_21
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_22
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg_byref_23
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg36
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg17
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg26
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg27
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg25
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg03
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg23
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg22
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg21
+ at if ERRORLEVEL 1 goto Error
+
+
+
+
+call ..\..\single-neg-test.bat neg04
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg05
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg06
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg06_a
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg06_b
+ at if ERRORLEVEL 1 goto Error
+
+
+  call ..\..\single-neg-test.bat neg08
+  @if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg09
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg11
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg12
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg13
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg14
+ at if ERRORLEVEL 1 goto Error
+
+
+call ..\..\single-neg-test.bat neg16
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg18
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg19
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg01
+ at if ERRORLEVEL 1 goto Error
+
+call ..\..\single-neg-test.bat neg02
+ at if ERRORLEVEL 1 goto Error
+
+
+
+call ..\..\single-neg-test.bat neg15
+ at if ERRORLEVEL 1 goto Error
+
+echo Some random positive cases found while developing the negative tests
+"%FSC%" %fsc_flags% -a -o:pos01a.dll  pos01a.fsi pos01a.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos01a.dll
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos02.dll  pos02.fs 
+ at if ERRORLEVEL 1 goto Error
+
+"%PEVERIFY%" pos02.dll
+ at if ERRORLEVEL 1 goto Error
+call ..\..\single-neg-test.bat neg35
+ at if ERRORLEVEL 1 goto Error
+
+"%FSC%" %fsc_flags% -a -o:pos05.dll  pos05.fs
+ at if ERRORLEVEL 1 goto Error
+
+
+:Ok
+echo Built fsharp %~f0 ok.
+endlocal
+exit /b 0
+
+:Skip
+echo Skipped %~f0
+endlocal
+exit /b 0
+
+
+:Error
+call %SCRIPT_ROOT%\ChompErr.bat %ERRORLEVEL% %~f0
+endlocal
+exit /b %ERRORLEVEL%
+
diff --git a/tests/fsharp/typecheck/sigs/neg01.bsl b/tests/fsharp/typecheck/sigs/neg01.bsl
new file mode 100644
index 0000000..9f25b3a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg01.bsl
@@ -0,0 +1,6 @@
+
+neg01a.fsi(24,8,25,7): typecheck error FS0913: Types cannot contain nested type definitions
+
+neg01a.fs(22,8,23,7): typecheck error FS0913: Types cannot contain nested type definitions
+
+neg01b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg01a.fs b/tests/fsharp/typecheck/sigs/neg01a.fs
new file mode 100644
index 0000000..7bc1a37
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg01a.fs
@@ -0,0 +1,23 @@
+
+module Lib
+
+type okType = X | Y 
+type missingConstructorInSignature = A | B  | C
+type missingFieldInSignature = { a: int; b: int }
+type 'a missingTypeVariableInSignature = { f1: int }
+
+type missingInterfaceInSignature<'t> =
+   class
+    interface System.IComparable with 
+      member x.CompareTo(y) = 0
+    end
+   end
+
+type missingInterfaceInImplementation<'t> = A | B
+
+
+
+type NestedTypes = 
+   class
+       static type NestedTypesNotYetSupported = T of int
+   end
diff --git a/tests/fsharp/typecheck/sigs/neg01a.fsi b/tests/fsharp/typecheck/sigs/neg01a.fsi
new file mode 100644
index 0000000..9108135
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg01a.fsi
@@ -0,0 +1,26 @@
+
+module Lib
+
+type okType
+type missingTypeInImplementation
+type missingConstructorInSignature = A | B
+type missingFieldInSignature = { a: int }
+type fieldsInWrongOrder = { a: int; b:int }
+type missingTypeVariableInSignature = { f1: int }
+type missingInterfaceInSignature<'t> =
+   class
+   end
+type missingInterfaceInImplementation<'t> =
+   class
+     interface System.IComparable
+   end
+
+
+type z = A | B
+
+
+type NestedTypes = 
+   class
+       static type NestedTypesNotYetSupported = T of int
+   end
+
diff --git a/tests/fsharp/typecheck/sigs/neg01b.fs b/tests/fsharp/typecheck/sigs/neg01b.fs
new file mode 100644
index 0000000..7798b3f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg01b.fs
@@ -0,0 +1,2 @@
+module Neg01b
+let x = Lib.X
diff --git a/tests/fsharp/typecheck/sigs/neg02.bsl b/tests/fsharp/typecheck/sigs/neg02.bsl
new file mode 100644
index 0000000..77a47cc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg02.bsl
@@ -0,0 +1,8 @@
+
+neg02.fs(6,8,6,15): parse error FS0046: The identifier 'virtual' is reserved for future use by F#
+
+neg02.fs(6,8,6,15): parse error FS0010: Unexpected identifier in member definition
+
+neg02.fs(11,8,11,14): parse error FS0046: The identifier 'method' is reserved for future use by F#
+
+neg02.fs(17,7,17,13): parse error FS0010: Unexpected keyword 'static' in member definition. Expected 'member', 'override' or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg02.fs b/tests/fsharp/typecheck/sigs/neg02.fs
new file mode 100644
index 0000000..3df2a19
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg02.fs
@@ -0,0 +1,22 @@
+
+module Lib
+
+type TestBadKeywords = 
+   class
+       virtual x.M() = 3
+   end
+
+type TestBadKeywords2 = 
+   class
+       method x.M() = 3
+   end
+
+type staticInInterface =
+   class
+    interface System.ComponentModel.INotifyPropertyChanged with 
+      static member Foo() = ()
+      member x.add_PropertyChanged(_) = ()
+      member x.remove_PropertyChanged(_) = ()
+    end
+   end
+
diff --git a/tests/fsharp/typecheck/sigs/neg03.bsl b/tests/fsharp/typecheck/sigs/neg03.bsl
new file mode 100644
index 0000000..c7bdf5b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg03.bsl
@@ -0,0 +1,116 @@
+
+neg03.fs(7,20,7,70): typecheck error FS0763: The field 'field3' has been given a value, but is not present in the type 'myRecord1'
+
+neg03.fs(8,20,8,70): typecheck error FS0763: The field 'field1' has been given a value, but is not present in the type 'myRecord2'
+
+neg03.fs(9,20,9,54): typecheck error FS0764: No assignment given for field 'field2' of type 'Neg03.myRecord1'
+
+neg03.fs(10,20,10,56): typecheck error FS0764: No assignment given for field 'field1' of type 'Neg03.myRecord1'
+
+neg03.fs(11,20,11,54): typecheck error FS0764: No assignment given for field 'field2' of type 'Neg03.myRecord2'
+
+neg03.fs(14,5,14,8): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(16,8,16,11): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(22,39,22,42): typecheck error FS0026: This rule will never be matched
+
+neg03.fs(25,9,25,13): typecheck error FS0001: The type 'bool' does not support the operator '<<<'
+
+neg03.fs(26,9,26,13): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    bool    
+
+neg03.fs(27,15,27,19): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    bool    
+
+neg03.fs(28,15,28,19): typecheck error FS0001: This expression was expected to have type
+    int32    
+but here has type
+    bool    
+
+neg03.fs(40,31,40,36): typecheck error FS0001: Type mismatch. Expecting a
+    Map<string,string>    
+but given a
+    Map<string,int>    
+The type 'string' does not match the type 'int'
+
+neg03.fs(45,20,45,26): typecheck error FS0685: The generic function 'typeof' must be given explicit type argument(s)
+
+neg03.fs(46,20,46,26): typecheck error FS0685: The generic function 'sizeof' must be given explicit type argument(s)
+
+neg03.fs(52,15,52,17): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'int'.
+
+neg03.fs(53,15,53,17): typecheck error FS0001: Type mismatch. Expecting a
+    string list ref    
+but given a
+    int list ref    
+The type 'string' does not match the type 'int'
+
+neg03.fs(59,9,59,10): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).
+
+neg03.fs(61,9,61,16): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).
+
+neg03.fs(62,9,62,16): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).
+
+neg03.fs(64,9,64,14): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '(_,0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(66,9,66,18): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Some (0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(68,9,68,17): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'None' may indicate a case not covered by the pattern(s).
+
+neg03.fs(70,9,70,22): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Some (_)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(71,9,71,32): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Some (0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(72,9,72,28): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Some (0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(73,9,73,28): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Some (0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(74,9,74,24): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '(_,0)' may indicate a case not covered by the pattern(s).
+
+neg03.fs(76,9,76,14): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[|_|]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(77,9,77,18): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(78,9,78,18): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; 0|]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(79,9,79,16): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[|0|]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(81,9,81,12): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '"a"' may indicate a case not covered by the pattern(s).
+
+neg03.fs(83,9,83,21): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '"a"' may indicate a case not covered by the pattern(s).
+
+neg03.fs(84,9,84,23): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '"a"' may indicate a case not covered by the pattern(s).
+
+neg03.fs(85,9,85,27): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '"a"' may indicate a case not covered by the pattern(s).
+
+neg03.fs(86,9,86,13): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '( some-non-null-value )' may indicate a case not covered by the pattern(s).
+
+neg03.fs(87,19,87,26): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '( some-other-subtype )' may indicate a case not covered by the pattern(s).
+
+neg03.fs(91,11,91,20): typecheck error FS0026: This rule will never be matched
+
+neg03.fs(97,11,97,20): typecheck error FS0026: This rule will never be matched
+
+neg03.fs(100,9,100,12): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(101,9,101,16): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_;_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(102,9,102,16): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_;_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(103,9,103,14): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[_;_]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(106,15,106,17): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '[0]' may indicate a case not covered by the pattern(s).
+
+neg03.fs(148,23,148,26): typecheck error FS0003: This value is not a function and cannot be applied
+
+neg03.fs(151,9,151,23): typecheck error FS0002: This function takes too many arguments, or is used in a context where a function is not expected
+
+neg03.fs(154,9,154,10): typecheck error FS0001: This expression was expected to have type
+    int -> int    
+but here has type
+    int    
diff --git a/tests/fsharp/typecheck/sigs/neg03.fs b/tests/fsharp/typecheck/sigs/neg03.fs
new file mode 100644
index 0000000..2e930c9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg03.fs
@@ -0,0 +1,154 @@
+module Neg03
+type myRecord1 = { field1: int; field2: string }
+type myRecord2 = { field2: string; field3: int }
+let myGoodRecord1 = { new myRecord1 with field1 = 3 and field2 = "3" }  
+let myGoodRecord2 = { new myRecord2 with field3 = 3 and field2 = "3" }  
+let myGoodRecord3 = { new myRecord2 with field2 = "3" and field3 = 3;  }  
+let myBadRecord1 = { new myRecord1 with field1 = 3 and field3 = "3" }  
+let myBadRecord2 = { new myRecord2 with field3 = 3 and field1 = "3" }  
+let myBadRecord3 = { new myRecord1 with field1 = 1  }  
+let myBadRecord4 = { new myRecord1 with field2 = "a"  }  
+let myBadRecord5 = { new myRecord2 with field3 = 1  }  
+
+// check location of incomplete and redundant match warnings
+let [1] = [2]
+  
+let f1 [1] = 1
+
+let f2 () = match [2] with [3] -> 4 | _ -> 5
+
+let f3 () = match [2] with | [3] -> 4 | _ -> 5
+
+let f4 () = match [2] with | x -> 4 | [3] -> 5
+
+let (lsl) (a:int) (b:int) =  a <<< b  
+let _ = true <<< 4
+let _ = true lsl 4
+let _ = 4 lsl true
+let _ = 4 <<< true
+
+
+type C() = class
+   let t = ref (Map.empty<string,_>)
+   let f x = (!t).Add("3",x)
+   member x.M() = !t
+      
+end
+
+let x = C()
+let v1 : Map<string,int> = x.M()
+let v2 : Map<string,string> = x.M()
+
+
+// check we're taking notice of RequiresExplicitTypeArgumentsAttribute
+module GeneralizationOfTypeFunctionChecks = begin
+    let test3257 = typeof
+    let test3254 = sizeof
+
+    // check type functions are not generalizeable by default
+    let r<'a> = printfn "abc"; ref ([] : 'a list)
+    let x1 = r<'a>
+
+    let x2 = (x1 : int list ref)
+    let x3 = (x1 : string  list ref)
+end
+
+
+
+module IncompletePatternWarningTests = begin
+    let 1 = 3
+
+    let (1 | 2) = 3
+    let (2 | 1) = 3
+
+    let (1,2) = 4,5
+
+    let (Some(1)) = Some(1)
+
+    let (Some _) = Some(1)
+    let None = Some(1)
+    let (None | None) = Some(1)
+    let (None | None | Some(1)) = Some(1)
+    let (Some(2) | Some(1)) = Some(1)
+    let (Some(2) & Some(1)) = Some(1)
+    let ((1,2) | (2,1)) = 2,3
+
+    let [| |] = [| 2 |]
+    let [| _;_ |] = [| 2 |]
+    let [| 1;2 |] = [| 2 |]
+    let [| 1 |] = [| 2 |]
+
+    let "1" = "3"
+
+    let ("1" | "1a") = "3"
+    let ("1aa" | "1a") = "3"
+    let ("1aa" | "ssssss") = "3"
+    let null = "3"
+    let _ = match box "3" with :? string  -> 1
+    let _ = 
+        match box "3" with 
+        | :? string  -> 1 
+        | :? string  -> 1  // check this rule is marked as 'never be matched'
+        | _ -> 2
+
+    let _ = 
+        match box "3" with 
+        | :? System.IComparable -> 1 
+        | :? string  -> 1  // check this rule is marked as 'never be matched'
+        | _ -> 2
+
+    let [ ] = [ 2 ]
+    let [ _;_ ] = [ 2 ]
+    let [ 1;2 ] = [ 2 ]
+    let [ 1 ] = [ 2 ]
+
+    let _ =    
+        match [] with 
+        | [] -> () 
+        | [1] -> () 
+        | h1::h2::t -> ()
+(*
+    let _ =    
+        match 1N with 
+        | 2N -> () 
+        | 3N -> ()  // suggests "13N"
+
+    let _ =    
+        match 1N with 
+        | 2N -> () 
+        | 3N -> () 
+        | 13N -> () // suggests "113N"
+
+    let _ =    
+        match 1N with 
+        | 2N -> () 
+        | 2N -> ()  // check this rule is marked as 'never be matched'
+        | _  -> ()
+
+    let _ =    
+        match 1I with 
+        | 2I -> () 
+        | 3I -> ()  // suggests "13I"
+
+
+    let _ =    
+        match 1I with 
+        | 2I -> () 
+        | 3I -> () 
+        | 13I -> () // suggests "113I"
+
+    let _ =    
+        match 1I with 
+        | 2I -> () 
+        | 2I -> ()  // check this rule is marked as 'never be matched'
+        | _  -> ()
+  *)      
+end
+
+let foo (arr : int) = arr 1
+
+let goo (f : int ) = ()
+do goo (fun x -> x + 1)
+
+let goo2 (f : int -> int) = ()
+do goo2 1
diff --git a/tests/fsharp/typecheck/sigs/neg04.bsl b/tests/fsharp/typecheck/sigs/neg04.bsl
new file mode 100644
index 0000000..c380982
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg04.bsl
@@ -0,0 +1,126 @@
+
+neg04.fs(5,21,5,94): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(7,21,7,35): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(11,8,11,81): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(14,8,14,22): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(22,8,22,17): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(26,8,26,17): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg04.fs(32,8,32,11): typecheck error FS0039: The field, constructor or member 'Nan' is not defined
+
+neg04.fs(46,69,46,94): typecheck error FS0001: Type mismatch. Expecting a
+    'a * 'b * 'c * 'e    
+but given a
+    'a * 'b * 'c    
+The tuples have differing lengths of 4 and 3
+
+neg04.fs(46,99,46,107): typecheck error FS0001: Type mismatch. Expecting a
+    'a * 'b * 'c * 'e    
+but given a
+    'a * 'b * 'c    
+The tuples have differing lengths of 4 and 3
+
+neg04.fs(47,30,47,51): typecheck error FS0001: Type mismatch. Expecting a
+    seq<'a> -> 'f    
+but given a
+    'g list -> 'h    
+The type 'seq<'a>' does not match the type ''f list'
+
+neg04.fs(61,25,61,40): typecheck error FS0001: This expression was expected to have type
+    ClassType1    
+but here has type
+    Object    
+
+neg04.fs(70,21,70,36): typecheck error FS0698: Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution
+
+neg04.fs(70,21,70,36): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'c<string>'.
+
+neg04.fs(70,12,70,14): typecheck error FS0663: This type parameter has been used in a way that constrains it to always be 'c<string>'
+
+neg04.fs(70,21,70,36): typecheck error FS0698: Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution
+
+neg04.fs(76,19,76,26): typecheck error FS0698: Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution
+
+neg04.fs(76,19,76,26): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'd'.
+
+neg04.fs(76,10,76,12): typecheck error FS0663: This type parameter has been used in a way that constrains it to always be 'd'
+
+neg04.fs(76,19,76,26): typecheck error FS0698: Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution
+
+neg04.fs(81,58,81,61): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    'a * 'b    
+
+neg04.fs(83,39,83,46): typecheck error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints
+
+neg04.fs(85,47,85,52): typecheck error FS0039: The field, constructor or member 'Item' is not defined
+
+neg04.fs(87,73,87,78): typecheck error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints
+
+neg04.fs(91,72,91,77): typecheck error FS0752: The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints
+
+neg04.fs(121,12,121,16): typecheck error FS0193: Type constraint mismatch. The type 
+    R    
+is not compatible with type
+    IBar    
+The type 'R' is not compatible with the type 'IBar'
+
+neg04.fs(126,12,126,16): typecheck error FS0193: Type constraint mismatch. The type 
+    U    
+is not compatible with type
+    IBar    
+The type 'U' is not compatible with the type 'IBar'
+
+neg04.fs(131,12,131,21): typecheck error FS0193: Type constraint mismatch. The type 
+    Struct    
+is not compatible with type
+    IBar    
+The type 'Struct' is not compatible with the type 'IBar'
+
+neg04.fs(135,10,135,16): typecheck error FS0193: Type constraint mismatch. The type 
+    R    
+is not compatible with type
+    IBar    
+The type 'R' is not compatible with the type 'IBar'
+
+neg04.fs(138,10,138,16): typecheck error FS0193: Type constraint mismatch. The type 
+    U    
+is not compatible with type
+    IBar    
+The type 'U' is not compatible with the type 'IBar'
+
+neg04.fs(141,10,141,21): typecheck error FS0193: Type constraint mismatch. The type 
+    Struct    
+is not compatible with type
+    IBar    
+The type 'Struct' is not compatible with the type 'IBar'
+
+neg04.fs(144,10,144,25): typecheck error FS0193: Type constraint mismatch. The type 
+    int * int    
+is not compatible with type
+    IBar    
+The type 'int * int' is not compatible with the type 'IBar'
+
+neg04.fs(147,10,147,20): typecheck error FS0193: Type constraint mismatch. The type 
+    int []    
+is not compatible with type
+    IBar    
+The type 'int []' is not compatible with the type 'IBar'
+
+neg04.fs(150,10,150,26): typecheck error FS0193: Type constraint mismatch. The type 
+    int -> int    
+is not compatible with type
+    IBar    
+The type 'int -> int' is not compatible with the type 'IBar'
+
+neg04.fs(159,47,159,57): typecheck error FS0692: This function value is being used to construct a delegate type whose signature includes a byref argument. You must use an explicit lambda expression taking 1 arguments.
+
+neg04.fs(163,54,163,67): typecheck error FS0692: This function value is being used to construct a delegate type whose signature includes a byref argument. You must use an explicit lambda expression taking 1 arguments.
+
+neg04.fs(178,13,178,18): typecheck error FS0001: The type '('a -> unit)' does not support the 'equality' constraint because it is a function type
diff --git a/tests/fsharp/typecheck/sigs/neg04.fs b/tests/fsharp/typecheck/sigs/neg04.fs
new file mode 100644
index 0000000..d484b25
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg04.fs
@@ -0,0 +1,179 @@
+module Neg04
+
+type myRecord1 = { field1: int; field2: string }
+
+type myRecord1 with abstract member AbstractMemberNotAllowedInAugmentation : string -> string end
+
+type myRecord1 with val x : string end
+
+
+type myRecord2 = { field1: int; field2: string }
+  with abstract member AbstractMemberNotAllowedInAugmentation : string -> string end
+
+type myRecord3 = { field1: int; field2: string }
+  with val x : string end
+
+type myRecord4 = { field1: int; field2: string }
+  with override x.ToString() = x.field2 end
+
+type myRecord5 = 
+    { field1: int; field2: string }
+    with 
+       let x = 1
+    end
+
+type System.Int32 with 
+       let x = 1
+    end
+
+
+// random test of what was once a poor error message
+open System;;
+Double.Nan;;
+
+//// random test of what was once a poor error message
+// This test is now under the FSHARPQA suite.
+//type GrowingArray<'a> = System.Collections.Generic.List<'a>
+//let nextPrime (sofar : GrowingArray<int>) n = failwith "nyi"
+//let primes = Seq.unfold
+//                 (fun (soFar,n) -> 
+//                    let next = nextPrime soFar n in 
+//                    Some(next, (soFar.Add(n), next+1)))
+ 
+ 
+
+let f2 x = 
+  let approxs = Seq.unfold (fun (i,y,z,sum) -> Some (sum + (y / z),(i + 1N,x * y,(i + 1N) * z))) (0N,1N,1N) in  
+  approxs |> Seq.take 100 |> List.fold      (+) 0N;;
+
+
+type ClassType1 =
+  class
+     inherit System.Object 
+     new(s: string) = { inherit System.Object() }
+  end
+
+type ClassType2 =
+  class
+     inherit ClassType1 
+     val rf : int
+     // Check that a wrong type for 'inherits' gets reported in a decent location
+     new(s) = { inherit System.Object(); rf = 1 }
+  end
+
+let Walk (x: obj) = ()
+
+
+do Walk ["a";"b";"b"]
+
+module ConstraintExample1 = begin
+    type c<'a> when 'a :> c<string> = A | B
+end
+
+module ConstraintExample2 = begin
+
+  type d = A | B
+  type c<'a> when 'a :> d = A | B
+end
+
+module BracketNotation1 = begin
+
+  let stringArrayDoesntSupport2DLookup (x : string) = x.[0,0]
+
+  let unconstrainedTypeGivesError x = x.[0,0]
+
+  let intArrayDoesntSupportLookup (x : int) = x.[0]
+
+  let resolutionOfStringOperatorAfterTheFactGivesOcamlCompatWarning x = x.[0]
+  let c : char =  resolutionOfStringOperatorAfterTheFactGivesOcamlCompatWarning "1"
+  let _ =  resolutionOfStringOperatorAfterTheFactGivesOcamlCompatWarning "1"
+
+  let resolutionOfArrayOperatorAfterTheFactGivesOcamlCompatWarning x = x.[0]
+  let _ : int = resolutionOfArrayOperatorAfterTheFactGivesOcamlCompatWarning [| 0 |]
+
+
+end
+
+
+module InterfaceCastTests = begin
+    type IBar = 
+        interface
+        end
+
+    type IFoo = 
+        interface
+        end
+
+    type Struct = 
+        struct
+           val x : int
+        end
+        
+    type R = 
+        { c : int }
+        
+    type U = 
+        A | B
+        
+        
+    let staticallyIllegalPatternTestInterfaceToSealedRecord(l:IBar list) =
+        match l with
+        | [:? R] -> None
+        | _ -> None
+        
+    let staticallyIllegalPatternTestInterfaceToSealedUnion(l:IBar  list) =
+        match l with
+        | [:? U] -> None
+        | _ -> None
+        
+    let staticallyIllegalPatternTestInterfaceToStruct(l:IBar list) =
+        match l with
+        | [:? Struct] -> None
+        | _ -> None
+
+    let staticallyIllegalCoercionInterfaceToSealedRecord(l:IBar ) =
+        (l :? R)
+        
+    let staticallyIllegalCoercionInterfaceToSealedUnion(l:IBar) =
+        (l :? U)
+        
+    let staticallyIllegalCoercionInterfaceToStruct(l:IBar) =
+        (l :? Struct)
+        
+    let staticallyIllegalCoercionInterfaceToTuple(l:IBar) =
+        (l :? (int * int))
+        
+    let staticallyIllegalCoercionInterfaceToArray(l:IBar) =
+        (l :? int[])
+        
+    let staticallyIllegalCoercionInterfaceToFunction(l:IBar) =
+        (l :? (int -> int))
+        
+end
+
+
+module NegativeDelegateByrefCreationTests = begin
+    type D = delegate of int byref -> int
+
+    let byrefFun (b : int byref) = b
+    let negateTest_createDelegateToFun = new D(byrefFun)
+
+
+    let byrefFun2 (b1 : int) (b2 : int byref)  = b1 + b2
+    let negateTest_createDelegateToFunPartial = new D(byrefFun2 3)
+end
+
+module AmbiguousImplicitInstantiationWarning = begin
+
+    type IDuplex<'a> = 
+      interface 
+      end
+
+    type IServer<'a> = 
+      interface 
+      end
+
+    let Delay(v: 'a when 'a :> IDuplex<'a> and 'a :> IServer<'a>)  = ()
+
+    do hash Delay   // An instantiation must be implicitly determined for Delay. But there is no single valid choice. Hence an error should be raised here.
+end
diff --git a/tests/fsharp/typecheck/sigs/neg05.bsl b/tests/fsharp/typecheck/sigs/neg05.bsl
new file mode 100644
index 0000000..209dc0d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg05.bsl
@@ -0,0 +1,26 @@
+
+neg05.fs(5,9,5,12): typecheck error FS0866: Interfaces cannot contain definitions of object constructors
+
+neg05.fs(9,6,9,8): typecheck error FS0947: Struct types cannot contain abstract members
+
+neg05.fs(13,6,13,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(18,6,18,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(23,6,23,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(28,6,28,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(33,6,33,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(38,6,38,8): typecheck error FS0927: The kind of the type specified by its attributes does not match the kind implied by its definition
+
+neg05.fs(46,46,46,60): typecheck error FS0754: Calls to object constructors on type parameters cannot be given arguments
+
+neg05.fs(59,10,59,26): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'unit'.
+
+neg05.fs(57,15,57,18): typecheck error FS1198: The generic member 'Pop' has been used at a non-uniform instantiation prior to this program point. Consider reordering the members so this member occurs first. Alternatively, specify the full type of the member explicitly, including argument types, return type and any additional generic parameters and constraints.
+
+neg05.fs(51,11,51,13): typecheck error FS0663: This type parameter has been used in a way that constrains it to always be 'unit'
+
+neg05.fs(51,11,51,13): typecheck error FS0660: This code is less generic than required by its annotations because the explicit type variable 'a' could not be generalized. It was constrained to be 'unit'.
diff --git a/tests/fsharp/typecheck/sigs/neg05.fs b/tests/fsharp/typecheck/sigs/neg05.fs
new file mode 100644
index 0000000..2787a46
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg05.fs
@@ -0,0 +1,64 @@
+module Test
+
+type Foo = 
+    interface 
+        new() = 1 
+    end
+
+[<Struct>]
+type N3 = 
+    abstract M : int
+
+[<Struct>]
+type N4 = 
+    interface
+    end
+
+[<Class>]
+type N5 = 
+    interface
+    end
+
+[<Struct>]
+type N6 = 
+    class
+    end
+
+[<Interface>]
+type N7 = 
+    class
+    end
+
+[<Class>]
+type N8 = 
+    struct
+    end
+
+[<Interface>]
+type N9 = 
+    struct
+    end
+
+type N15 =
+    abstract M : int
+    member x.P = x.M
+
+let f (c: 'a when 'a : (new : unit -> 'a)) = new 'a("AAAA")
+
+
+
+// NOTE: error message should appear on type variable declaration
+type Test<'a> = class
+     val mutable buffer: 'a[]
+     val mutable idx: int
+
+     member t.Dec() = t.idx <- t.idx - 1
+
+     member t.Pop() =
+         t.Dec()
+         t.buffer.[t.idx]  // NOTE: <-- it would actually be better for it to appear here
+         1
+end
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg06.bsl b/tests/fsharp/typecheck/sigs/neg06.bsl
new file mode 100644
index 0000000..c2b940a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06.bsl
@@ -0,0 +1,144 @@
+
+neg06.fs(3,40,3,45): typecheck error FS0039: The field, constructor or member 'Ascii' is not defined
+
+neg06.fs(12,6,12,31): typecheck error FS0942: Struct types are always sealed
+
+neg06.fs(18,6,18,24): typecheck error FS0948: Interface types cannot be sealed
+
+neg06.fs(24,6,24,30): typecheck error FS0944: Abbreviated types cannot be given the 'Sealed' attribute
+
+neg06.fs(27,6,27,33): typecheck error FS0942: Delegate types are always sealed
+
+neg06.fs(31,9,31,29): typecheck error FS0945: Cannot inherit a sealed type
+
+neg06.fs(37,6,37,29): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(37,6,37,29): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg06.fs(37,6,37,29): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(42,6,42,30): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(46,5,46,29): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(42,6,42,30): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg06.fs(42,6,42,30): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(46,5,46,29): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(53,10,53,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(60,10,60,20): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(60,10,60,20): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(60,10,60,20): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(64,9,64,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(64,9,64,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(64,9,64,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(75,10,75,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(80,10,80,25): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(90,10,90,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(90,10,90,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(94,10,94,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(99,10,99,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(100,9,100,10): typecheck error FS0035: This construct is deprecated: This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'.
+
+neg06.fs(104,10,104,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(104,10,104,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(108,10,108,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(108,10,108,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(112,10,112,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(117,10,117,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(117,10,117,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(117,10,117,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(118,9,118,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(118,9,118,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(118,9,118,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(118,9,118,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(118,9,118,10): typecheck error FS0035: This construct is deprecated: This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'.
+
+neg06.fs(122,10,122,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(123,9,123,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(124,9,124,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg06.fs(128,19,128,46): typecheck error FS0700: 'new' constraints must take one argument of type 'unit' and return the constructed type
+
+neg06.fs(128,53,128,61): typecheck error FS0043: A type parameter is missing a constraint 'when 'a : (new : unit ->  'a)'
+
+neg06.fs(141,10,141,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(148,13,148,21): typecheck error FS0039: The value or constructor 'BadType1' is not defined
+
+neg06.fs(150,10,150,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(157,13,157,21): typecheck error FS0039: The value or constructor 'BadType2' is not defined
+
+neg06.fs(159,10,159,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(166,13,166,21): typecheck error FS0039: The value or constructor 'BadType3' is not defined
+
+neg06.fs(195,10,195,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(203,13,203,21): typecheck error FS0039: The value or constructor 'BadType1' is not defined
+
+neg06.fs(205,10,205,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(213,13,213,21): typecheck error FS0039: The value or constructor 'BadType2' is not defined
+
+neg06.fs(215,10,215,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(223,13,223,21): typecheck error FS0039: The value or constructor 'BadType3' is not defined
+
+neg06.fs(294,10,294,12): typecheck error FS0009: Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.
+
+neg06.fs(298,10,298,12): typecheck error FS0009: Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'.
+
+neg06.fs(304,10,304,12): typecheck error FS0937: Only structs and classes without primary constructors may be given the 'StructLayout' attribute
+
+neg06.fs(310,10,310,12): typecheck error FS0937: Only structs and classes without primary constructors may be given the 'StructLayout' attribute
+
+neg06.fs(314,10,314,12): typecheck error FS0937: Only structs and classes without primary constructors may be given the 'StructLayout' attribute
+
+neg06.fs(317,10,317,12): typecheck error FS0937: Only structs and classes without primary constructors may be given the 'StructLayout' attribute
+
+neg06.fs(320,10,320,12): typecheck error FS0937: Only structs and classes without primary constructors may be given the 'StructLayout' attribute
+
+neg06.fs(326,10,326,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(335,13,335,21): typecheck error FS0039: The value or constructor 'BadType4' is not defined
+
+neg06.fs(340,10,340,18): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg06.fs(350,13,350,21): typecheck error FS0039: The value or constructor 'BadType4' is not defined
+
+neg06.fs(375,9,375,10): typecheck error FS1197: The parameter 'x' was inferred to have byref type. Parameters of byref type must be given an explicit type annotation, e.g. 'x1: byref<int>'. When used, a byref parameter is implicitly dereferenced.
+
+neg06.fs(382,13,382,19): typecheck error FS0041: A unique overload for method 'M1' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: static member C.M1 : x:int -> int, static member C.M1 : x:string -> int
+
+neg06.fs(398,13,398,14): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s). Unmatched elements will be ignored.
diff --git a/tests/fsharp/typecheck/sigs/neg06.fs b/tests/fsharp/typecheck/sigs/neg06.fs
new file mode 100644
index 0000000..77bd862
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06.fs
@@ -0,0 +1,408 @@
+(* SHOULD GIVE A NICE ERROR INCLUDING THE NAME "Ascii": *)
+module Test
+let testError b = System.Text.Encoding.Ascii.GetString b 
+
+[<Sealed>]
+type SealedType() = 
+    class
+        member x.P = 1
+    end
+    
+[<Sealed>]
+type UnnecessarilySealedStruct = 
+    struct
+        member x.P = 1
+    end
+    
+[<Sealed>]
+type BadSealedInterface = 
+    interface
+        abstract P : int
+    end
+    
+[<Sealed>]
+type BadSealedAbbreviatedType = System.Object 
+
+[<Sealed>]
+type UnnecessarilySealedDelegate() = delegate of int -> int
+        
+type BadExtensionOfSealedType() = 
+    class
+        inherit SealedType()
+        member x.P = 1
+    end
+//Moved to FSHARPQA suite     
+//let WarningOnHashOfSealedType (x: #SealedType) = x
+
+type BadImmediateInheritance() = 
+    class
+        inherit BadImmediateInheritance()
+    end
+
+type BadImmediateInheritance1() = 
+    class
+        inherit BadImmediateInheritance2()
+    end
+and BadImmediateInheritance2() = 
+    class 
+        inherit BadImmediateInheritance1()
+    end
+    
+ 
+module BadStructTest1 = begin
+    type BadStruct = 
+        struct
+            val x : BadStruct
+        end    
+end
+
+module BadStructTest2 =  begin
+    type BadStruct1 = 
+        struct
+            val x : BadStruct2
+        end    
+    and BadStruct2 =
+        struct
+            val x : BadStruct1
+        end    
+end
+
+module BadStructTest3 =  begin
+    type One<'a> = 
+        struct
+            val x : 'a
+        end    
+    type BadStruct =
+        struct
+            val x : One<BadStruct>
+        end    
+
+    type BadAbbreviation = One<BadAbbreviation>
+
+    type GoodStruct =
+        struct
+            val x : One<int>
+        end    
+end
+
+
+module NegativeTest1 = begin
+    type X = option<X>
+end
+
+module NegativeTest2 = begin
+    type X = A<X> 
+    and A<'a> = A of int
+end
+
+module NegativeTest3 = begin
+    type X = A<X> 
+    and A<'a> = int
+end
+
+module Neg4 = begin
+    type Y = Y * Y    
+end
+
+module Neg5 = begin
+    type Y = Y -> Y    
+end
+
+module Neg6 = begin
+    type Y = F<Y>
+    and F<'a> = 'a -> 'a
+end
+
+module Neg7 = begin
+    type Y = F<Y>
+    and F<'a> = Y -> Y
+end
+
+module Neg8 = begin
+    type A = F<int>
+    and F<'a> = G<'a>
+    and G<'a> = F<'a>
+end
+
+module BadConstraint = begin
+    let f<'a when 'a : (new : string -> unit)> () = new 'a()
+end
+
+module BadRecursiveTypeDefinitionSingleRecursion = begin
+
+    type BadType0 =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private x : int  // structs require at least one field
+      end
+
+    let _ = BadType0()
+
+    type BadType1<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private x : BadType1<'a[]>
+        val Y : int
+      end
+
+    let _ = BadType1<int32>()
+     
+    type BadType2<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private X : BadType2<int>
+        val Y : int
+      end
+     
+    let _ = BadType2<int32>()
+
+    type BadType3<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        val mutable X : BadType3<int>
+        val Y : int
+      end
+     
+    let _ = BadType3<int32>()
+
+    
+
+    type GoodType1<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private X : GoodType1<'a>
+        val Y : int
+      end
+     
+    let _ = GoodType1<int32>()
+ 
+    type GoodType2 =
+      struct
+        [<DefaultValue(false)>]
+        val mutable X : GoodBox2<GoodType2>
+      end
+    and GoodBox2<'T> = 
+      class
+        val v : 'T
+      end
+     
+    let _ = GoodType2()
+end
+
+module BadRecursiveTypeDefinitionsWithAbbrev = begin
+
+
+    type BadType1<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private x : Naught1<BadType1<'a[]>>
+        val Y : int
+      end
+    and Naught1<'a> = 'a
+
+    let _ = BadType1<int32>()
+     
+    type BadType2<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private X : Naught2<BadType2<int>>
+        val Y : int
+      end
+    and Naught2<'a> = 'a
+     
+    let _ = BadType2<int32>()
+
+    type BadType3<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        val mutable X : Naught3<BadType3<int>>
+        val Y : int
+      end
+    and Naught3<'a> = 'a
+     
+    let _ = BadType3<int32>()
+
+    
+    type GoodType1<'a> =
+      struct
+        [<DefaultValueAttribute>]
+        static val mutable private X : Naught5<int>
+        val Y : int
+      end
+    and Naught5<'a> = 'a
+      
+    let _ = GoodType1<int32>()
+ 
+    type GoodType2 =
+      struct
+        [<DefaultValue(false)>]
+        val mutable X : GoodBox2<GoodType2>
+      end
+    and GoodBox2<'T> = 
+      class
+        val v : 'T
+      end
+     
+    let _ = GoodType2()
+
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+module PositiveTests = 
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    type X3 =  { r : int }
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    [<AbstractClass>]
+    type X2 = 
+        abstract M : unit -> 'a
+
+
+module NegativeTests = 
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    type X1 = 
+        abstract M : unit -> 'a
+
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    [<AbstractClass>]
+    type X2() = 
+        abstract M : unit -> 'a
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    type X4 =  R1 | R2
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    type X5 =  R1 = 1 | R2 = 2
+
+    [<System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)>]
+    type X6 =  delegate of int -> int 
+
+
+module Regression_3417a =
+    // This type should be rejected due to a struct cycle (pre-fix, observed loop in fsi)
+    // Prefix: it looped
+    type BadType4 =
+      struct
+        [<DefaultValueAttribute>]
+        val mutable X : BadBox4<BadType4>
+      end
+    and BadBox4<'T> = 
+      struct
+        val v : 'T
+      end
+    let _ = BadType4()
+
+module Regression_3417b =
+    // This type should be rejected due to a struct cycle (pre-fix, observed loop in fsi)     
+    // Prefix: it looped
+    type BadType4 =
+      struct
+        [<DefaultValueAttribute>]
+        val mutable X : Naught4<BadBox4<BadType4>>
+      end
+    and BadBox4<'T> = 
+      struct
+        val v : 'T
+      end
+    and Naught4<'a> = 'a
+    let _ = BadType4()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+module NonMonotonicByrefParameter =
+  let f (x:byref<int>) = ()
+
+  let g x = f x
+  
+module AmbiguousOverload = 
+  type C = 
+      static member M1 (x: int) = 1
+      static member M1 (x: string) = 2
+
+  let f x = C.M1 x  
+  
+module CheckErrorForNonUniformGeneric =
+    type Foo<'a>(bar : Bar<'a>) =
+        member this.Blah() = bar.Foo() 
+    and Bar<'a>() =
+        member this.Foo() = ()    // expect NO error here
+
+module CheckNoErrorForNonUniformGenericWithExplicitSignature =
+    type Foo<'a>(bar : Bar<'a>) =
+        member this.Blah() = bar.Foo() 
+    and Bar<'a>() =
+        member this.Foo() : unit = ()    // expect NO error here 
+
+module CHeckWarningForIncompletePatternMatchInForLoop = 
+    let f () = 
+        for 1 in [1;2;3] do ()
+
+module CHeckErrorForNamedArgumentToDatatype = 
+    type C = 
+        | C1 of bool * bool
+        | C2 of bool
+    
+    let x = 1
+    let c1 = C1 (x=1, x = 1) // error no longer expected here
+    let c2 = C2 (x=1) // no error expected
+
diff --git a/tests/fsharp/typecheck/sigs/neg06_a.bsl b/tests/fsharp/typecheck/sigs/neg06_a.bsl
new file mode 100644
index 0000000..389cbbd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06_a.bsl
@@ -0,0 +1,4 @@
+
+neg06_a.fs(8,23,8,26): typecheck error FS0023: The member 'IsC' can not be defined because the name 'IsC' clashes with the default augmentation of the union case 'C' in this type or module
+
+neg06_a.fs(13,28,13,31): typecheck error FS0023: The member 'IsD' can not be defined because the name 'IsD' clashes with the default augmentation of the union case 'D' in this type or module
diff --git a/tests/fsharp/typecheck/sigs/neg06_a.fs b/tests/fsharp/typecheck/sigs/neg06_a.fs
new file mode 100644
index 0000000..6de61b7
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06_a.fs
@@ -0,0 +1,41 @@
+module Test
+
+module NameClashesWithDefaultAugmentation =
+    type T = | C of int * int
+             | D of (int * int)
+
+             // Expect error here:
+             member x.IsC(a) = match a with
+                               | C(_,_) -> true
+                               | D(_) -> false
+                               
+             // Expect error here:
+             static member IsD(b) = match b with
+                                    | C(_,_) -> true
+                                    | D(_) -> false
+
+             // Expect no error here:
+             member x.GetC1(a) = match a with
+                                 | C(_,_) -> true
+                                 | D(_) -> false
+                               
+             // Expect no error here:
+             static member GetC2(b) = match b with
+                                      | C(_,_) -> true
+                                      | D(_) -> false
+
+             // Expect no error here:
+             static member GetC3(b) = match b with
+                                      | C(_,_) -> true
+                                      | D(_) -> false
+
+             // Expect NO NO NO error here:
+             member x.GetC(a) = match a with
+                                 | C(_,_) -> true
+                                 | D(_) -> false
+                               
+             // Expect NO NO NO error here:
+             static member getD(b) = match b with
+                                      | C(_,_) -> true
+                                      | D(_) -> false
+
diff --git a/tests/fsharp/typecheck/sigs/neg06_b.bsl b/tests/fsharp/typecheck/sigs/neg06_b.bsl
new file mode 100644
index 0000000..55453e9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06_b.bsl
@@ -0,0 +1,4 @@
+
+neg06_b.fs(13,18,13,22): typecheck error FS0023: The member 'bmap' can not be defined because the name 'bmap' clashes with the field 'bmap' in this type or module
+
+neg06_b.fs(20,18,20,22): typecheck error FS0023: The member 'bmap' can not be defined because the name 'bmap' clashes with the field 'bmap' in this type or module
diff --git a/tests/fsharp/typecheck/sigs/neg06_b.fs b/tests/fsharp/typecheck/sigs/neg06_b.fs
new file mode 100644
index 0000000..9a312ff
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg06_b.fs
@@ -0,0 +1,21 @@
+module Test
+
+module Regression_4688 =
+    type BMap<'v>(anyX : int) =
+      struct
+        static let    empty: BMap<'v> = failwith""
+        static member Empty: BMap<'v> = empty
+      end
+
+    // This type is OK, note 'v instance of BMap        
+    type CMap<'v> (bmap: BMap<'v>) =
+      struct
+        member x.bmap = bmap
+      end
+
+    // This type is OK, note 'v option instance of BMap
+    // Prefix: it looped (non-termination, but no stack overflow)
+    type DMap<'v> (bmap: BMap<'v option>) =
+      struct
+        member x.bmap = bmap
+      end 
diff --git a/tests/fsharp/typecheck/sigs/neg07.bsl b/tests/fsharp/typecheck/sigs/neg07.bsl
new file mode 100644
index 0000000..4551e7a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg07.bsl
@@ -0,0 +1,38 @@
+
+neg07.fs(7,10,7,29): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(7,10,7,29): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(24,13,24,23): typecheck error FS0039: The value or constructor 'UnionCase1' is not defined
+
+neg07.fs(27,11,27,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(28,11,28,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(28,11,28,21): typecheck error FS0026: This rule will never be matched
+
+neg07.fs(31,18,31,28): typecheck error FS0039: The value or constructor 'UnionCase1' is not defined
+
+neg07.fs(35,11,35,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(36,11,36,21): typecheck error FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.
+
+neg07.fs(36,11,36,21): typecheck error FS0026: This rule will never be matched
+
+neg07.fs(46,15,46,27): typecheck error FS0039: The record label 'RecordLabel1' is not defined
+
+neg07.fs(47,19,47,31): typecheck error FS0039: The record label 'RecordLabel1' is not defined
+
+neg07.fs(57,10,57,17): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(64,10,64,18): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(70,10,70,18): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(75,10,75,19): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(79,10,79,18): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(86,10,86,22): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
+
+neg07.fs(93,10,93,19): typecheck error FS1196: The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case
diff --git a/tests/fsharp/typecheck/sigs/neg07.fs b/tests/fsharp/typecheck/sigs/neg07.fs
new file mode 100644
index 0000000..44d11a6
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg07.fs
@@ -0,0 +1,98 @@
+(* SHOULD GIVE UnionCase1 NICE ERROR INCLUDING THE NAME "Ascii": *)
+module Test
+
+let test() =
+    try
+        failwith "message"
+    with UndeclaredException ->
+        System.Console.WriteLine "UndeclaredException"
+        
+do test()
+
+
+
+module TestRequiredQualifiedAccess = begin
+    [<RequireQualifiedAccess>]
+    type X = 
+       | UnionCase1 
+       | UnionCase2
+       with 
+          member x.M() = match x with UnionCase1 -> 1 | UnionCase2 -> 2 // expect ok, since inside the member of the type
+          member x.N() = (UnionCase1, UnionCase2)                       // expect ok, since inside the member of the type
+       end
+
+    let _ = UnionCase1 // expect not ok
+    let f x = 
+        match x with 
+        | UnionCase1 -> 1 // expect not ok with warnings about uppercase variable names
+        | UnionCase2 -> 2 // expect not ok with warnings about uppercase variable names
+
+    let x = X.UnionCase1 // expect ok
+    let x2 : X = UnionCase1 // expect not ok
+
+    let g (x:X) = 
+        match x with
+        | UnionCase1 -> ()  // expect not ok with warnings about uppercase variable names
+        | UnionCase2 -> ()  // expect not ok with warnings about uppercase variable names
+
+    [<RequireQualifiedAccess>]
+    type R = 
+        { RecordLabel1 : int; RecordLabel2 : int }
+        with 
+           member x.M() = { RecordLabel1 = 1; RecordLabel2 = 2 } // expect ok, since inside the member of the type
+           member x.N() = (fun y -> y.RecordLabel1)              // expect ok, since inside the member of the type
+        end
+
+    let _ = { RecordLabel1 = 1; RecordLabel2 = 2 }  // expect not ok
+    let _ = fun { RecordLabel1 = a; RecordLabel2 = b } -> a + b // expect not ok
+
+    let _ = { R.RecordLabel1 = 1; R.RecordLabel2 = 2 } // expect ok
+    let xR: R = { RecordLabel1 = 1; RecordLabel2 = 2 } // expect ok since resolution is inferred by type
+end
+
+
+module TestUsNullAttribute = begin
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyUnion = 
+        | A1
+        | A
+        | B of string
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyUnion2 =
+        | A1
+        | A 
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyUnion3 = 
+        | A1
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyRecord3 = { x : int }
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyClass4() = 
+       class
+          member x.P = 1
+       end
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyInterface5 = 
+       interface 
+           abstract P : int
+       end
+
+    // expect error
+    [<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+    type MyStruct6(x : int) = 
+       struct
+           member __.X = x
+       end
+
+end
diff --git a/tests/fsharp/typecheck/sigs/neg08.bsl b/tests/fsharp/typecheck/sigs/neg08.bsl
new file mode 100644
index 0000000..838d6a0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg08.bsl
@@ -0,0 +1,24 @@
+
+neg08.fs(7,24,7,55): typecheck error FS0033: The type 'System.Collections.Generic.List<_>' expects 1 type argument(s) but is given 0
+
+neg08.fs(9,24,9,67): typecheck error FS0033: The type 'System.Collections.Generic.List<_>' expects 1 type argument(s) but is given 2
+
+neg08.fs(16,8,16,10): typecheck error FS0670: This code is not sufficiently generic. The type variable 'b could not be generalized because it would escape its scope.
+
+neg08.fs(21,1,21,28): typecheck error FS0919: Exception abbreviations must refer to existing exceptions or F# types deriving from System.Exception
+
+neg08.fs(28,16,28,26): typecheck error FS0790: This type is not a record type. Values of class and struct types must be created using calls to object constructors.
+
+neg08.fs(30,9,30,12): typecheck error FS0789: '{ }' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'.
+
+neg08.fs(43,18,43,19): typecheck error FS0859: No abstract property was found that corresponds to this override
+
+neg08.fs(48,18,48,19): typecheck error FS0855: No abstract or interface member was found that corresponds to this override
+
+neg08.fs(55,7,55,14): typecheck error FS0773: Cannot create an extension of a sealed type
+
+neg08.fs(55,7,55,14): typecheck error FS0776: Object construction expressions may only be used to implement constructors in class types
+
+neg08.fs(61,19,61,26): typecheck error FS0039: The field, constructor or member 'value__' is not defined
+
+neg08.fs(79,5,79,44): typecheck error FS0502: The member or object constructor 'Random' takes 0 type argument(s) but is here given 1. The required signature is 'static member Variable.Random : y:Variable<'a> -> Variable<'a>'.
diff --git a/tests/fsharp/typecheck/sigs/neg08.fs b/tests/fsharp/typecheck/sigs/neg08.fs
new file mode 100644
index 0000000..3ff686a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg08.fs
@@ -0,0 +1,80 @@
+module Neg08
+let l = ref []
+exception StackEmpty
+
+let push a x = l:=x:: !l
+
+let topEnvTable1 = new System.Collections.Generic.List()
+  
+let topEnvTable2 = new System.Collections.Generic.List<int,string>()
+
+#light 
+
+// Check non-generalization of escaping implicit ctor tyvars
+let x2 = ref []
+
+type C<'b>() = 
+    member a.Z() : 'b list = !x2
+    
+    member a.Z2() = a.Z()
+
+exception A = System.Object
+
+type Test = class
+     val test: int
+     new(test) = {test = test}
+end
+
+let t : Test = {test = 0}
+
+let q = { } 
+
+module TestMissingAndExtraOverrides = begin
+    type B = class
+      new () = { }
+      
+      abstract A : int
+      abstract M : unit -> int
+    end
+
+    type C = class
+      inherit B
+
+      override x.A
+        with get() = 3
+        // Check we can't also provide a setter when the abstract only has a getter
+        and set(v : int) = (invalidArg "v" "C.A.set" : unit) 
+
+      override x.N() = 2
+      override x.M() = 3
+    end
+end
+
+module FSharp1_0_Bug1221 = begin
+    type Foo = delegate of int * int -> int
+    { new Foo with
+      member x.Invoke (x,y) = x + y }
+end
+    
+module FSharp1_0_Bug992= begin
+   type Type = | P = 1
+   let _ = Type.P.value__
+end
+
+
+module FSharp1_0_Bug1423 = begin
+
+    type Variable() =
+        class
+           member x.Name with set(v:string) = ()
+        end
+
+    type Variable<'a>() =
+        class
+            inherit Variable()
+            static member Random(y:Variable<'a>) = new Variable<'a>()
+        end
+        
+    let x : Variable<int> = failwith ""
+    Variable.Random<float> (x, Name = "m_")
+end
diff --git a/tests/fsharp/typecheck/sigs/neg08.fsi b/tests/fsharp/typecheck/sigs/neg08.fsi
new file mode 100644
index 0000000..de290b5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg08.fsi
@@ -0,0 +1,3 @@
+module Neg08
+val push: 'a -> 'a -> unit
+
diff --git a/tests/fsharp/typecheck/sigs/neg09.bsl b/tests/fsharp/typecheck/sigs/neg09.bsl
new file mode 100644
index 0000000..4db6dab
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg09.bsl
@@ -0,0 +1,16 @@
+
+neg09.fsi(4,5,4,6): typecheck error FS0201: Namespaces cannot contain values. Consider using a module to hold your value declarations.
+
+neg09.fsi(5,5,5,6): typecheck error FS0201: Namespaces cannot contain values. Consider using a module to hold your value declarations.
+
+neg09.fs(4,5,4,6): typecheck error FS0201: Namespaces cannot contain values. Consider using a module to hold your value declarations.
+
+neg09.fs(6,5,6,8): typecheck error FS0201: Namespaces cannot contain values. Consider using a module to hold your value declarations.
+
+neg09.fs(20,32,20,42): typecheck error FS0941: Accessibility modifiers are not permitted on overrides or interface implementations
+
+neg09.fs(26,8,26,39): typecheck error FS0497: The member or object constructor 'NamedMeth1' requires 1 additional argument(s). The required signature is 'abstract member IFoo.NamedMeth1 : arg1:int * arg2:int * arg3:int * arg4:int -> float'.
+
+neg09.fs(49,19,49,20): typecheck error FS1173: Infix operator member '+' has 1 initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
+
+neg09.fs(49,19,49,20): typecheck error FS1174: Infix operator member '+' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ...
diff --git a/tests/fsharp/typecheck/sigs/neg09.fs b/tests/fsharp/typecheck/sigs/neg09.fs
new file mode 100644
index 0000000..d8c76c3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg09.fs
@@ -0,0 +1,50 @@
+
+namespace N
+
+let x = 1
+
+let f x = x + x
+
+  
+type C = class end
+
+
+module Bug1433 = begin
+    type IFoo = 
+        interface
+            abstract NamedMeth1 : arg1:int * arg2:int * arg3:int * arg4:int-> float
+        end
+
+    type Foo() = class
+        interface IFoo with
+            member public this.NamedMeth1 (arg1, arg2, arg3, arg4) = 2.718
+        end
+        member x.Stuff() = printfn "Foo"
+    end
+
+    let y = new Foo() :> IFoo
+    do y.NamedMeth1(1, arg4=1, arg2=2) 
+end
+
+module Bug1462 = begin
+
+  open System
+  open Microsoft.FSharp.Quotations
+
+
+  let rec expand_power (n,x) =
+      if n = 0
+      then 1 
+      else (x) * (failwith "" : Expr<int>)
+end
+
+module Bug5534 = begin
+   let (?) x y = () // expect NO warning here
+   let (?<-) x y = () // expect NO warning here
+end
+
+type Translator() = class
+   let (===) x y = true  // expect NO warning here
+   member x.M(a,b) = (a === b)
+   static member (+) x y = 1
+end
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg09.fsi b/tests/fsharp/typecheck/sigs/neg09.fsi
new file mode 100644
index 0000000..71f06c2
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg09.fsi
@@ -0,0 +1,7 @@
+
+namespace N
+
+val x : int
+val f : int -> int
+
+type C = class member M : int end
diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl
new file mode 100644
index 0000000..5737608
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg10.bsl
@@ -0,0 +1,250 @@
+
+neg10.fsi(9,6,9,7): typecheck error FS0249: Two type definitions named 'x' occur in namespace 'N' in two parts of this assembly
+
+neg10.fs(11,17,11,27): typecheck error FS0946: Cannot inherit from interface type. Use interface ... with instead.
+
+neg10.fs(13,17,13,26): typecheck error FS0945: Cannot inherit a sealed type
+
+neg10.fs(15,22,15,32): typecheck error FS0887: The type 'C1' is not an interface type
+
+neg10.fs(16,32,16,34): typecheck error FS1207: Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'
+
+neg10.fs(16,32,16,34): typecheck error FS0887: The type 'C1' is not an interface type
+
+neg10.fs(16,32,16,34): typecheck error FS1207: Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...'
+
+neg10.fs(16,32,16,34): typecheck error FS0908: This type is not an interface type
+
+neg10.fs(17,28,17,30): typecheck error FS0887: The type 'C1' is not an interface type
+
+neg10.fs(17,28,17,30): typecheck error FS0908: This type is not an interface type
+
+neg10.fs(19,17,19,28): typecheck error FS0870: Structs cannot have an object constructor with no arguments. This is a restriction imposed on all CLI languages as structs automatically support a default constructor.
+
+neg10.fs(21,16,21,46): typecheck error FS0001: A generic construct requires that the type 'System.Enum' have a public default constructor
+
+neg10.fs(22,16,22,51): typecheck error FS0001: A generic construct requires that the type 'System.ValueType' have a public default constructor
+
+neg10.fs(23,16,23,38): typecheck error FS0001: A generic construct requires that the type 'obj' is a CLI or F# struct type
+
+neg10.fs(24,16,24,41): typecheck error FS0001: A generic construct requires that the type 'string' have a public default constructor
+
+neg10.fs(25,16,25,53): typecheck error FS0001: This type parameter cannot be instantiated to 'Nullable'. This is a restriction imposed in order to ensure the meaning of 'null' in some CLI languages is not confusing when used in conjunction with 'Nullable' values.
+
+neg10.fs(54,17,54,20): typecheck error FS0060: Override implementations in augmentations are now deprecated. Override implementations should be given as part of the initial declaration of a type.
+
+neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.
+
+neg10.fs(77,27,77,34): typecheck error FS0896: Enumerations cannot have members
+
+neg10.fs(84,20,84,29): typecheck error FS0896: Enumerations cannot have members
+
+neg10.fs(90,23,90,41): typecheck error FS0907: Enumerations cannot have interface declarations
+
+neg10.fs(99,23,99,29): typecheck error FS0907: Enumerations cannot have interface declarations
+
+neg10.fs(107,10,107,17): typecheck error FS0964: Type abbreviations cannot have augmentations
+
+neg10.fs(109,27,109,34): typecheck error FS0895: Type abbreviations cannot have members
+
+neg10.fs(114,10,114,17): typecheck error FS0964: Type abbreviations cannot have augmentations
+
+neg10.fs(116,20,116,29): typecheck error FS0895: Type abbreviations cannot have members
+
+neg10.fs(120,10,120,17): typecheck error FS0964: Type abbreviations cannot have augmentations
+
+neg10.fs(122,23,122,41): typecheck error FS0906: Type abbreviations cannot have interface declarations
+
+neg10.fs(129,10,129,17): typecheck error FS0964: Type abbreviations cannot have augmentations
+
+neg10.fs(131,23,131,29): typecheck error FS0906: Type abbreviations cannot have interface declarations
+
+neg10.fs(169,32,169,35): typecheck error FS0035: This construct is deprecated: This form of object expression is not used in F#. Use 'member this.MemberName ... = ...' to define member implementations in object expressions.
+
+neg10.fs(169,32,169,33): typecheck error FS0017: The member 'X : unit -> 'a' does not have the correct type to override any given virtual method
+
+neg10.fs(169,19,169,26): typecheck error FS0783: At least one override did not correctly implement its corresponding abstract member
+
+neg10.fs(174,9,175,20): typecheck error FS0951: Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char
+
+neg10.fs(180,10,180,11): typecheck error FS0866: Interfaces cannot contain definitions of object constructors
+
+neg10.fs(193,39,193,46): typecheck error FS0767: The member 'MyX' does not correspond to any abstract or virtual method available to override or implement
+
+neg10.fs(193,41,193,44): typecheck error FS0017: The member 'MyX : unit -> int' does not have the correct type to override any given virtual method
+
+neg10.fs(193,20,193,23): typecheck error FS0783: At least one override did not correctly implement its corresponding abstract member
+
+neg10.fs(200,11,200,18): typecheck error FS0745: This is not a valid name for an enumeration case
+
+neg10.fs(209,13,209,14): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(210,13,210,14): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(211,13,211,14): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(212,13,212,14): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(213,22,213,23): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(213,33,213,34): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(214,10,214,11): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(216,5,216,18): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(217,13,217,15): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(218,13,218,15): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(219,13,219,15): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(220,13,220,15): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(221,23,221,25): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(221,35,221,37): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(222,10,222,12): typecheck error FS0044: This construct is deprecated. Obsolete
+
+neg10.fs(239,47,239,48): typecheck error FS0001: A type parameter is missing a constraint 'when 'b :> C'
+
+neg10.fs(239,47,239,48): typecheck error FS0193: Type constraint mismatch. The type 
+    'b    
+is not compatible with type
+    C    
+A type parameter is missing a constraint 'when 'b :> C'
+
+neg10.fs(245,50,245,51): typecheck error FS0193: A type parameter is missing a constraint 'when 'b :> C'
+
+neg10.fs(245,17,245,40): typecheck error FS0043: A type parameter is missing a constraint 'when 'b :> C'
+
+neg10.fs(251,49,251,61): typecheck error FS0001: The type '('a -> 'a)' does not support the 'equality' constraint because it is a function type
+
+neg10.fs(252,45,252,57): typecheck error FS0001: The type '('a -> 'a)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg10.fs(253,36,253,48): typecheck error FS0001: The type '('a -> 'a)' does not support the 'equality' constraint because it is a function type
+
+neg10.fs(297,17,297,24): typecheck error FS1187: An indexer property must be given at least one argument
+
+neg10.fs(298,17,298,24): typecheck error FS1187: An indexer property must be given at least one argument
+
+neg10.fs(299,17,299,24): typecheck error FS0807: Property 'S2' is not readable
+
+neg10.fs(300,17,300,24): typecheck error FS0807: Property 'S3' is not readable
+
+neg10.fs(301,17,301,24): typecheck error FS0807: Property 'S4' is not readable
+
+neg10.fs(303,17,303,22): typecheck error FS0807: Property 'SS2' is not readable
+
+neg10.fs(304,17,304,22): typecheck error FS0807: Property 'SS3' is not readable
+
+neg10.fs(305,17,305,22): typecheck error FS0807: Property 'SS4' is not readable
+
+neg10.fs(316,17,316,28): typecheck error FS0807: Property 'X' is not readable
+
+neg10.fs(324,17,324,29): typecheck error FS1187: An indexer property must be given at least one argument
+
+neg10.fs(333,17,333,29): typecheck error FS1187: An indexer property must be given at least one argument
+
+neg10.fs(335,17,335,39): typecheck error FS0501: The member or object constructor 'X' takes 2 argument(s) but is here given 3. The required signature is 'member T3.X : a:int -> int * int with set'.
+
+neg10.fs(345,23,345,24): typecheck error FS0001: The type 'SqlDecimal' does not support a conversion to the type 'float'
+
+neg10.fs(362,25,362,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'single'
+
+neg10.fs(363,24,363,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'sbyte'
+
+neg10.fs(364,24,364,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int16'
+
+neg10.fs(365,25,365,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint16'
+
+neg10.fs(366,25,366,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint32'
+
+neg10.fs(367,25,367,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint64'
+
+neg10.fs(368,24,368,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int64'
+
+neg10.fs(369,26,369,27): typecheck error FS0001: The type 'C' does not support a conversion to the type 'decimal'
+
+neg10.fs(388,25,388,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'single'
+
+neg10.fs(389,24,389,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'sbyte'
+
+neg10.fs(390,24,390,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int16'
+
+neg10.fs(391,25,391,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint16'
+
+neg10.fs(392,25,392,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint32'
+
+neg10.fs(393,25,393,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint64'
+
+neg10.fs(394,24,394,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int64'
+
+neg10.fs(395,26,395,27): typecheck error FS0001: The type 'C' does not support a conversion to the type 'decimal'
+
+neg10.fs(399,25,399,40): typecheck error FS0093: The type 'C' does not support a conversion to the type 'char'
+
+neg10.fs(401,25,401,40): typecheck error FS0093: The type 'C' does not support a conversion to the type 'byte'
+
+neg10.fs(403,27,403,42): typecheck error FS0093: The type 'C' does not support a conversion to the type 'single'
+
+neg10.fs(404,26,404,41): typecheck error FS0093: The type 'C' does not support a conversion to the type 'sbyte'
+
+neg10.fs(405,26,405,41): typecheck error FS0093: The type 'C' does not support a conversion to the type 'int16'
+
+neg10.fs(406,27,406,42): typecheck error FS0093: The type 'C' does not support a conversion to the type 'uint16'
+
+neg10.fs(407,27,407,42): typecheck error FS0093: The type 'C' does not support a conversion to the type 'uint32'
+
+neg10.fs(408,27,408,42): typecheck error FS0093: The type 'C' does not support a conversion to the type 'uint64'
+
+neg10.fs(409,26,409,41): typecheck error FS0093: The type 'C' does not support a conversion to the type 'int64'
+
+neg10.fs(410,28,410,43): typecheck error FS0093: The type 'C' does not support a conversion to the type 'decimal'
+
+neg10.fs(422,24,422,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'float'
+
+neg10.fs(423,23,423,24): typecheck error FS0001: The type 'C' does not support a conversion to the type 'char'
+
+neg10.fs(424,23,424,24): typecheck error FS0001: The type 'C' does not support a conversion to the type 'byte'
+
+neg10.fs(426,25,426,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'single'
+
+neg10.fs(427,24,427,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'sbyte'
+
+neg10.fs(428,24,428,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int16'
+
+neg10.fs(429,25,429,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint16'
+
+neg10.fs(430,25,430,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint32'
+
+neg10.fs(431,25,431,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint64'
+
+neg10.fs(432,24,432,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int64'
+
+neg10.fs(433,26,433,27): typecheck error FS0001: The type 'C' does not support a conversion to the type 'decimal'
+
+neg10.fs(446,24,446,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'float'
+
+neg10.fs(447,23,447,24): typecheck error FS0001: The type 'C' does not support a conversion to the type 'char'
+
+neg10.fs(448,23,448,24): typecheck error FS0001: The type 'C' does not support a conversion to the type 'byte'
+
+neg10.fs(450,25,450,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'single'
+
+neg10.fs(451,24,451,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'sbyte'
+
+neg10.fs(452,24,452,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int16'
+
+neg10.fs(453,25,453,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint16'
+
+neg10.fs(454,25,454,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint32'
+
+neg10.fs(455,25,455,26): typecheck error FS0001: The type 'C' does not support a conversion to the type 'uint64'
+
+neg10.fs(456,24,456,25): typecheck error FS0001: The type 'C' does not support a conversion to the type 'int64'
+
+neg10.fs(457,26,457,27): typecheck error FS0001: The type 'C' does not support a conversion to the type 'decimal'
+
+neg10.fsi(1,1,1,81): typecheck error FS0240: The signature file 'Neg10' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match.
diff --git a/tests/fsharp/typecheck/sigs/neg10.fs b/tests/fsharp/typecheck/sigs/neg10.fs
new file mode 100644
index 0000000..20d1206
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg10.fs
@@ -0,0 +1,462 @@
+namespace N
+
+type x = int
+
+
+namespace N
+
+//type x = A | B
+
+type IM = interface end
+type C1 = class inherit IM end
+type D = delegate of int -> int
+type M2 = class inherit D end
+type IM2 = interface inherit IM end
+type IM3 = interface inherit C1 end
+type IM4 = interface interface C1 end
+type IM5 = class interface C1 end
+
+type S = struct new() = { }  end
+module M = begin
+  let i1 = new System.Nullable< System.Enum >()
+  let i2 = new System.Nullable< System.ValueType >()
+  let i3 = new System.Nullable< obj >()
+  let i4 = new System.Nullable< string >()
+  let i5 = new System.Nullable< System.Nullable<S> >()
+end
+
+type I = 
+   interface
+      abstract X : int 
+      abstract Y : x:int -> int 
+   end
+
+module KeikoNakataBug = begin
+  type c = class
+   new () = {}
+   abstract f : int -> int
+  end
+
+  type d = class
+   inherit c
+   new () = {}
+  end
+
+  let x = new d ()
+  let y = x.f 1
+end
+
+module CheckNoImplementationsInAugmentations = begin
+    type X = class
+        abstract M : int
+    end
+    type X with 
+        default a.M = 3
+    end    
+end
+    
+module CheckNoIntrfacesInAugmentations = begin
+    type IX = interface
+        abstract M : int
+    end
+    type X = class
+        interface IX 
+    end
+    type X with 
+        interface IX with 
+            member a.M = 3
+        end
+    end    
+end
+
+module CheckNoMembersOnEnumerations = begin
+
+    // Check you can't have members in enumerations (see bug 1418, FSharp 1.0 database) *)
+    type Season1 = Spring=0 | Summer=1 | Autumn=2 | Winter=3
+        with
+            static member M() = 1
+        end
+
+
+    // Check you can't have instance members in enumerations (see bug 1418, FSharp 1.0 database) *)
+    type Season2 = Spring=0 | Summer=1 | Autumn=2 | Winter=3
+        with
+            member x.M() = 1
+        end
+
+    // Check you can't have instance members in enumerations (see bug 1418, FSharp 1.0 database) *)
+    type Season3 = Spring=0 | Summer=1 | Autumn=2 | Winter=3
+        with
+            interface System.IComparable with 
+                member x.CompareTo(yobj) = 0 
+            end
+        end
+
+    type IEmpty = interface end
+    // Check you can't have an implementation of an empty interface
+    type Season4 = Spring=0 | Summer=1 | Autumn=2 | Winter=3
+        with
+            interface IEmpty
+        end
+end
+
+
+module CheckNoMembersOnAbbreviations = begin
+
+    // Check you can't have members in type abbreviation
+    type Season1 = int
+        with
+            static member M() = 1
+        end
+
+
+    // Check you can't have members in type abbreviation
+    type Season2 = int
+        with
+            member x.M() = 1
+        end
+
+    // Check you can't have members in type abbreviation
+    type Season3 = int
+        with
+            interface System.IComparable with 
+                member x.CompareTo(yobj) = 0 
+            end
+        end
+
+    type IEmpty = interface end
+    // Check you can't have an implementation of an empty interface
+    type Season4 = int
+        with
+            interface IEmpty
+        end
+end
+
+module CheckMissingMethod_FSharp_1_0_bug_1625 = begin
+    type IA = 
+        interface
+            abstract M : int -> int 
+        end
+
+    type IB = 
+        interface
+            inherit IA
+            abstract M : int -> int 
+        end
+
+    type C() = 
+        //interface IA with 
+         //   member x.M(y) = y+3
+        class
+            interface IB with 
+                member x.M(y) = y+3
+            end
+        end
+end
+
+module EnumOfString_FSharp_1_0_bug_1743 = begin
+    type IA<'a> =
+        interface 
+            abstract X : unit -> 'a
+        end
+
+    type IB<'a,'b> =
+        interface 
+            inherit IA<'a>
+            inherit IA<'b>
+        end
+
+    let x = { new IB<_,_> with X() = failwith "" }
+end
+
+module EnumOfString_FSharp_1_0_bug_1730 = begin
+    type EnumOfString =
+        | A = "foo"
+        | B = "bar"
+end
+
+
+module EnumOfString_FSharp_1_0_bug_1749 = begin
+    type X() =
+        interface
+        end
+end
+
+
+module MiscBug_FSharp_1_0_bug_1683 = begin
+
+    type Foo(x : int) =
+       class
+           member v.MyX() = x
+       end
+
+    let foo = {new Foo(3) with member v.MyX() = 4 end }
+
+    do printf "%d" (foo.MyX())
+
+end
+module NoEnumValueWithSpecialName = begin
+    type X =
+        | value__ = 1
+end
+
+module CheckHonourObsoleteOnModules = begin
+    [<System.Obsolete("Obsolete")>]
+    module M = begin
+       let x = 1
+       type C = A | B
+    end
+    let _ = M.x
+    let _ = M.A
+    let _ = M.B
+    let _ : M.C list = []
+    let f = function M.A -> 1 | M.B -> 2
+    open M
+
+    module M2 = M
+    let _ = M2.x
+    let _ = M2.A
+    let _ = M2.B
+    let _ : M2.C list = []
+    let f2 = function M2.A -> 1 | M2.B -> 2
+    open M2
+
+end
+
+module CheckUnderConstrainedExplicitTyparDeclarationsGiveErrors = begin
+    type Four = | Four
+
+    // An unsealed type
+    type C() = class
+        member x.P = 1
+    end
+    
+    type C4 =    class
+        static member M<'a>(x:'a,y:C) = Four
+       end
+
+    module M0 = begin
+        let gB4<'a,'b> (x:'a) (y:'b) = C4.M(x,y)  = Four    // expect: error, missing constraint
+     end
+
+    module M0Rec = begin
+
+        // Expected: error
+        let rec gB4<'a,'b>(x:'a) (y:'b) = C4.M(x,y)  = Four    // expect: error, missing constraint
+      end
+
+end
+
+module CheckMisusedConstraints = begin
+    let cantHashAFunctionValue = Operators.hash Operators.id
+    let cantCompareFunctionValues = compare Operators.id Operators.id
+    let cantEquateFunctionValues = Operators.id = Operators.id
+
+
+    let uncheckHashAFunctionValue = Unchecked.hash Operators.id // no error expected
+    let uncheckCompareFunctionValues = Unchecked.compare Operators.id Operators.id // no error expected
+    let uncheckEquateFunctionValues = Unchecked.equals Operators.id Operators.id // no error expected
+
+end
+
+
+module CheckMisusedProperties = begin 
+    module Test1 = begin
+
+        type T() = 
+          class
+
+            member this.X1 = 1
+
+            member this.X2 with get () = 2
+
+            member this.X3 with get (idx1 : int) = 3
+            member this.X4 with get (idx1 : int, idx2 : int) = 3
+
+            //member this.X5 with get (idx1 : int) (idx2 : int) = 4 // should be rejected by parsing
+            //member this.X6 with get (idx1 : int) (idx2 : int) (idx3 : int) = 4 // should be rejected by parsing
+
+
+            member this.S2 with set () v = ()
+            member this.S3 with set (idx1 : int) v = ()
+            member this.S4 with set (idx1 : int, idx2 : int) v = ()
+
+            static member SS2 with set () v = ()
+            static member SS3 with set (idx1 : int) v = ()
+            static member SS4 with set (idx1 : int, idx2 : int) v = ()
+
+            //member this.S5 with set (idx1 : int) (idx2 : int) v = 4 // should be rejected by parsing
+
+            
+          end
+
+        let tobj = T()
+        
+        let _ = tobj.X1
+        let _ = tobj.X2
+        let _ = tobj.X3 // should be rejected
+        let _ = tobj.X4 // should be rejected
+        let _ = tobj.S2 // should be rejected
+        let _ = tobj.S3 // should be rejected
+        let _ = tobj.S4 // should be rejected
+
+        let _ = T.SS2 // should be rejected
+        let _ = T.SS3 // should be rejected
+        let _ = T.SS4 // should be rejected
+    end
+    
+    module Test2 =  begin
+        type T() =
+          class
+             member this.X
+               with set (a:int, b:int) = ()
+          end
+
+        let _ = (new T()).X <- (1,2) // should be ok 
+        let _ = (new T()).X(1) <- 2 // should be rejected
+
+        type T2() =
+           class
+             member this.X
+               with set (a:int) (b:int) = ()
+           end
+
+        let _ = (new T2()).X <- (1,2) // should be rejected, currently not rejected
+        let _ = (new T2()).X(1) <- 2 // should be ok
+
+        type T3() =
+          class
+             member this.X
+               with set (a:int) (b:int, c:int) = ()
+          end
+
+        let _ = (new T3()).X <- (1,2,3) // should be rejected
+        let _ = (new T3()).X(1) <- (2,3) // should be ok
+        let _ = (new T3()).X(1,2) <- 2 // should be rejected
+    end
+end
+
+module MissingStaticOperatorsTests = begin
+
+    module ActualRepro = begin
+        open System.Data.SqlTypes
+
+        let d = SqlDecimal(12)
+        let x = float d
+    end
+
+    module SystematicTests1 = begin
+
+        type C() = class
+            static member op_Explicit(c: C) : int = 1
+            static member op_Explicit(c: C) : double = 2.0
+            static member op_Explicit(c: C) : char = 'a'
+            static member op_Explicit(c: C) : byte = byte 1 
+        end
+
+        let c = C()
+        let x1 = float c // expect ok
+        let x2 = char c // expect ok
+        let x3 = byte c // expect ok
+        let x4 = int c  // expect ok
+        let x5 = single c // expect fail with decent error message
+        let x6 = sbyte c // expect fail with decent error message
+        let x7 = int16 c // expect fail with decent error message
+        let x8 = uint16 c // expect fail with decent error message
+        let x9 = uint32 c // expect fail with decent error message
+        let xQ = uint64 c // expect fail with decent error message
+        let xW = int64 c // expect fail with decent error message
+        let xE = decimal c // expect fail with decent error message
+
+    end
+
+    module SystematicTests2 = begin
+
+        // From the F# perspective it doesn't matter if overloads are op_Explicit or op_Implicit
+        type C() = class
+            static member op_Explicit(c: C) : int = 1
+            static member op_Explicit(c: C) : double = 2.0
+            static member op_Implicit(c: C) : char = 'a'
+            static member op_Implicit(c: C) : byte = byte 1 
+        end
+
+        let c = C()
+        let x1 = float c // expect ok
+        let x2 = char c // expect ok
+        let x3 = byte c // expect ok
+        let x4 = int c  // expect ok
+        let x5 = single c // expect fail with decent error message
+        let x6 = sbyte c // expect fail with decent error message
+        let x7 = int16 c // expect fail with decent error message
+        let x8 = uint16 c // expect fail with decent error message
+        let x9 = uint32 c // expect fail with decent error message
+        let xQ = uint64 c // expect fail with decent error message
+        let xW = int64 c // expect fail with decent error message
+        let xE = decimal c // expect fail with decent error message
+        
+        let y1 : float = C.op_Explicit c // expect ok
+        let y2 : char = C.op_Implicit c // expect ok
+        let yA : char = C.op_Explicit c // expect error - no special treatment for direct calls
+        let y3 : byte = C.op_Implicit c // expect ok
+        let yS : byte = C.op_Explicit c // expect ok
+        let y4 : int = C.op_Explicit c  // expect ok
+        let y5 : single = C.op_Explicit c // expect fail with decent error message
+        let y6 : sbyte = C.op_Explicit c // expect fail with decent error message
+        let y7 : int16 = C.op_Explicit c // expect fail with decent error message
+        let y8 : uint16 = C.op_Explicit c // expect fail with decent error message
+        let y9 : uint32 = C.op_Explicit c // expect fail with decent error message
+        let yQ : uint64 = C.op_Explicit c // expect fail with decent error message
+        let yW : int64 = C.op_Explicit c // expect fail with decent error message
+        let yE : decimal = C.op_Explicit c // expect fail with decent error message
+
+    end
+
+    // Also check the case where there is only one overload!
+    module SystematicTests3 = begin
+
+        type C() = class
+            static member op_Explicit(c: C) : int = 1
+        end
+
+        let c = C()
+        let x1 = float c // expect fail with decent error message
+        let x2 = char c // expect fail with decent error message
+        let x3 = byte c // expect fail with decent error message
+        let x4 = int c  // expect ok
+        let x5 = single c // expect fail with decent error message
+        let x6 = sbyte c // expect fail with decent error message
+        let x7 = int16 c // expect fail with decent error message
+        let x8 = uint16 c // expect fail with decent error message
+        let x9 = uint32 c // expect fail with decent error message
+        let xQ = uint64 c // expect fail with decent error message
+        let xW = int64 c // expect fail with decent error message
+        let xE = decimal c // expect fail with decent error message
+
+    end
+
+    // Also check the case where there is only one overload!
+    module SystematicTests4 = begin
+
+        type C() = class
+           // From the F# perspective it doesn't matter if overloads are op_Explicit or op_Implicit
+            static member op_Implicit(c: C) : int = 1
+        end
+
+        let c = C()
+        let x1 = float c // expect fail with decent error message
+        let x2 = char c // expect fail with decent error message
+        let x3 = byte c // expect fail with decent error message
+        let x4 = int c  // expect ok
+        let x5 = single c // expect fail with decent error message
+        let x6 = sbyte c // expect fail with decent error message
+        let x7 = int16 c // expect fail with decent error message
+        let x8 = uint16 c // expect fail with decent error message
+        let x9 = uint32 c // expect fail with decent error message
+        let xQ = uint64 c // expect fail with decent error message
+        let xW = int64 c // expect fail with decent error message
+        let xE = decimal c // expect fail with decent error message
+
+    end
+    
+end
+
diff --git a/tests/fsharp/typecheck/sigs/neg10.fsi b/tests/fsharp/typecheck/sigs/neg10.fsi
new file mode 100644
index 0000000..04c9865
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg10.fsi
@@ -0,0 +1,14 @@
+
+namespace N
+
+type x = int
+
+
+namespace N
+
+type x = A | B
+
+
+type I = 
+   interface
+   end
diff --git a/tests/fsharp/typecheck/sigs/neg10_a.bsl b/tests/fsharp/typecheck/sigs/neg10_a.bsl
new file mode 100644
index 0000000..3df9d58
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg10_a.bsl
@@ -0,0 +1,2 @@
+
+neg10_a.fs(8,6,8,7): typecheck error FS0249: Two type definitions named 'x' occur in namespace 'N' in two parts of this assembly
diff --git a/tests/fsharp/typecheck/sigs/neg10_a.fs b/tests/fsharp/typecheck/sigs/neg10_a.fs
new file mode 100644
index 0000000..aacdd33
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg10_a.fs
@@ -0,0 +1,9 @@
+namespace N
+
+type x = int
+
+
+namespace N
+
+type x = A | B
+
diff --git a/tests/fsharp/typecheck/sigs/neg11.bsl b/tests/fsharp/typecheck/sigs/neg11.bsl
new file mode 100644
index 0000000..6e2f9ed
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg11.bsl
@@ -0,0 +1,2 @@
+
+neg11.fs(6,26,6,28): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type 'obj'.
diff --git a/tests/fsharp/typecheck/sigs/neg11.fs b/tests/fsharp/typecheck/sigs/neg11.fs
new file mode 100644
index 0000000..72d32a1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg11.fs
@@ -0,0 +1,9 @@
+module Neg11
+// check that a decent error is given when a constructor is too polymorphic
+type Gaussian1D =
+   class 
+      val p : float;
+      new (precisionMean:'a) = { p = 0.0 }
+  end
+
+// note this test shouldn't contain any other code
diff --git a/tests/fsharp/typecheck/sigs/neg12.bsl b/tests/fsharp/typecheck/sigs/neg12.bsl
new file mode 100644
index 0000000..8fc2630
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg12.bsl
@@ -0,0 +1,20 @@
+
+neg12.fs(15,20,15,45): typecheck error FS0491: The member or object constructor 'GetSchemaSerializable' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg12.fs(16,20,16,45): typecheck error FS0491: The member or object constructor 'GetSchemaSerializable' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg12.fs(17,44,17,57): typecheck error FS0035: This construct is deprecated: This form of object expression is not used in F#. Use 'member this.MemberName ... = ...' to define member implementations in object expressions.
+
+neg12.fs(17,61,17,86): typecheck error FS0491: The member or object constructor 'GetSchemaSerializable' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg12.fs(18,53,18,78): typecheck error FS0491: The member or object constructor 'GetSchemaSerializable' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg12.fs(21,56,21,81): typecheck error FS0491: The member or object constructor 'GetSchemaSerializable' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg12.fs(30,8,30,9): typecheck error FS1181: Each argument of the primary constructor for a struct must be given a type, for example 'type S(x1:int, x2: int) = ...'. These arguments determine the fields of the struct.
+
+neg12.fs(39,15,39,18): typecheck error FS0762: Constructors for the type 't' must directly or indirectly call its implicit object constructor. Use a call to the implicit object constructor instead of a record expression.
+
+neg12.fs(44,15,44,18): typecheck error FS0762: Constructors for the type 't2' must directly or indirectly call its implicit object constructor. Use a call to the implicit object constructor instead of a record expression.
+
+neg12.fs(48,20,48,23): typecheck error FS0762: Constructors for the type 't3' must directly or indirectly call its implicit object constructor. Use a call to the implicit object constructor instead of a record expression.
diff --git a/tests/fsharp/typecheck/sigs/neg12.fs b/tests/fsharp/typecheck/sigs/neg12.fs
new file mode 100644
index 0000000..261fdd1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg12.fs
@@ -0,0 +1,51 @@
+// check that a decent error is given when a constructor is too polymorphic
+module Test
+
+type Gaussian1D =
+   class 
+      member x.Foot with get() = failwith ""
+   end
+
+
+module AccessingProtectedMembersFromUnderLambdas = begin
+    type DS() = class
+      inherit System.Data.DataSet()
+      member t.Foo () =
+        let a = new DS() in
+        (fun () -> a.GetSchemaSerializable()) |> ignore;   //should give error
+        let f () = a.GetSchemaSerializable() in           //should give error
+        let x = { new System.Object() with GetHashCode() = (a.GetSchemaSerializable() |> ignore); 3 } in // should give error
+        let h = new System.EventHandler(fun _ _ -> (a.GetSchemaSerializable() |> ignore)) in // should give error
+        // check that protected members from the surrounding context can be used
+        // in the arguments to an object constructor.
+        let obj = { new System.Collections.ArrayList( (a.GetSchemaSerializable() |> ignore; 3)) with 
+                       member x.ToString() = "" 
+                    end } in
+        ()
+    end
+end
+
+
+[<Struct>]
+type C(x) =
+   member y.Z = x
+
+module ImplicitClassCOnstructionMayNotUseExplicitCOnstruction_Bug_1341_FSharp_1_0 = begin
+    type s = class 
+     new () = {}
+    end
+
+    type t (x:s) = class
+     new () = { }
+    end
+
+    type t2 (x:s) = class
+     let x = 1
+     new () = { }
+    end
+
+    type t3 () = class
+     new (x:int) = { }
+    end
+
+end
diff --git a/tests/fsharp/typecheck/sigs/neg13.bsl b/tests/fsharp/typecheck/sigs/neg13.bsl
new file mode 100644
index 0000000..a0557e1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg13.bsl
@@ -0,0 +1,32 @@
+
+neg13.fs(10,6,10,8): typecheck error FS0381: A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes
+
+neg13.fs(13,6,13,8): typecheck error FS0379: The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute
+
+neg13.fs(16,6,16,8): typecheck error FS0380: The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes
+
+neg13.fs(19,6,19,8): typecheck error FS0379: The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute
+
+neg13.fs(22,6,22,8): typecheck error FS0380: The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes
+
+neg13.fs(25,6,25,8): typecheck error FS0381: A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes
+
+neg13.fs(28,6,28,8): typecheck error FS0379: The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute
+
+neg13.fs(31,6,31,8): typecheck error FS0380: The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes
+
+neg13.fs(34,6,34,8): typecheck error FS0379: The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute
+
+neg13.fs(37,6,37,8): typecheck error FS0380: The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes
+
+neg13.fs(43,6,43,8): typecheck error FS0378: The 'NoEquality' attribute must be used in conjunction with the 'NoComparison' attribute
+
+neg13.fs(47,6,47,8): typecheck error FS0344: The struct, record or union type 'Ru' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type
+
+neg13.fs(47,6,47,8): typecheck error FS0346: The struct, record or union type 'Ru' has an explicit implementation of 'Object.Equals'. Consider implementing a matching override for 'Object.GetHashCode()'
+
+neg13.fs(56,6,56,8): typecheck error FS0386: A type with attribute 'NoComparison' should not usually have an explicit implementation of 'System.IComparable', 'System.IComparable<_>' or 'System.Collections.IStructuralComparable'. Disable this warning if this is intentional for interoperability purposes
+
+neg13.fs(56,6,56,8): typecheck error FS0344: The struct, record or union type 'Rv' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type
+
+neg13.fs(56,6,56,8): typecheck error FS0346: The struct, record or union type 'Rv' has an explicit implementation of 'Object.Equals'. Consider implementing a matching override for 'Object.GetHashCode()'
diff --git a/tests/fsharp/typecheck/sigs/neg13.fs b/tests/fsharp/typecheck/sigs/neg13.fs
new file mode 100644
index 0000000..3393f5e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg13.fs
@@ -0,0 +1,65 @@
+module Neg13
+// check that a decent error is given when a setter is too polymorphic
+type Gaussian1D =
+   class 
+      member x.Feet with set(v) = failwith ""
+   end
+
+
+[<ReferenceEquality; StructuralEquality; StructuralComparison>]
+type R1 = A | B
+
+[<ReferenceEquality; StructuralComparison>]
+type R2 = A | B
+
+[<ReferenceEquality; StructuralEquality>]
+type R3 = A | B
+
+[<StructuralComparison>]
+type R4 = A | B
+
+[<StructuralEquality>]
+type R5 = A | B
+
+[<ReferenceEquality; StructuralEquality; StructuralComparison>]
+type R6 = A | B
+
+[<ReferenceEquality; StructuralComparison>]
+type R7 = A | B
+
+[<ReferenceEquality; StructuralEquality>]
+type R8 = A | B
+
+[<StructuralComparison>]
+type R9 = A | B
+
+[<StructuralEquality>]
+type Rq = A | B
+
+[<NoComparison>]
+type Rt = A | B
+
+[<NoEquality>]
+type Ry = A | B
+
+
+[<StructuralEquality; NoComparison>]
+type Ru = 
+    | A 
+    | B
+    with 
+        override x.Equals(y) = false
+    end
+
+
+[<StructuralEquality; NoComparison>]
+type Rv = 
+    | A 
+    | B
+    with 
+        override x.Equals(y) = false
+        interface System.IComparable with 
+            member x.CompareTo(y) = 0
+        end
+    end
+
diff --git a/tests/fsharp/typecheck/sigs/neg14.bsl b/tests/fsharp/typecheck/sigs/neg14.bsl
new file mode 100644
index 0000000..bc17ed5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg14.bsl
@@ -0,0 +1,4 @@
+
+neg14a.fs(9,6,9,33): typecheck error FS0343: The type 'missingInterfaceInSignature' implements 'System.IComparable' explicitly but provides no corresponding override for 'Object.Equals'. An implementation of 'Object.Equals' has been automatically provided, implemented via 'System.IComparable'. Consider implementing the override 'Object.Equals' explicitly
+
+neg14b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg14a.fs b/tests/fsharp/typecheck/sigs/neg14a.fs
new file mode 100644
index 0000000..1ac70e0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg14a.fs
@@ -0,0 +1,18 @@
+
+module Lib
+
+type okType = X | Y 
+type missingConstructorInSignature = A | B  | C
+type missingFieldInSignature = { a: int; b: int }
+type 'a missingTypeVariableInSignature = { f1: int }
+
+type missingInterfaceInSignature<'t> =
+   class
+    interface System.IComparable with 
+      member x.CompareTo(y) = 0
+    end
+   end
+
+type missingInterfaceInImplementation<'t> = A | B
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg14a.fsi b/tests/fsharp/typecheck/sigs/neg14a.fsi
new file mode 100644
index 0000000..4b80477
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg14a.fsi
@@ -0,0 +1,19 @@
+
+module Lib
+
+type okType
+type missingTypeInImplementation
+type missingConstructorInSignature = A | B
+type missingFieldInSignature = { a: int }
+type fieldsInWrongOrder = { a: int; b:int }
+type missingTypeVariableInSignature = { f1: int }
+type missingInterfaceInSignature<'t> =
+   class
+   end
+type missingInterfaceInImplementation<'t> =
+   class
+     interface System.IComparable
+   end
+
+
+type z = A | B
diff --git a/tests/fsharp/typecheck/sigs/neg14b.fs b/tests/fsharp/typecheck/sigs/neg14b.fs
new file mode 100644
index 0000000..4bd9d18
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg14b.fs
@@ -0,0 +1,2 @@
+module Neg14b
+let x = Lib.X
diff --git a/tests/fsharp/typecheck/sigs/neg15.bsl b/tests/fsharp/typecheck/sigs/neg15.bsl
new file mode 100644
index 0000000..5e57728
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg15.bsl
@@ -0,0 +1,60 @@
+
+neg15.fs(102,17,102,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location
+
+neg15.fs(103,18,103,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location
+
+neg15.fs(106,18,106,66): typecheck error FS1093: The union cases or fields of the type 'UnionTypeWithPrivateRepresentation' are not accessible from this code location
+
+neg15.fs(107,17,107,41): typecheck error FS0491: The member or object constructor 'PrivateProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(108,17,108,45): typecheck error FS0491: The member or object constructor 'PrivateStaticProperty' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(109,17,109,41): typecheck error FS0491: The member or object constructor 'PrivateMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(110,17,110,45): typecheck error FS0491: The member or object constructor 'PrivateStaticMethod' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(111,17,111,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location
+
+neg15.fs(111,17,111,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location
+
+neg15.fs(112,18,112,78): typecheck error FS1093: The union cases or fields of the type 'RecordTypeWithPrivateRepresentation' are not accessible from this code location
+
+neg15.fs(112,18,112,78): typecheck error FS1093: The union cases or fields of the type 'RecordTypeWithPrivateRepresentation' are not accessible from this code location
+
+neg15.fs(113,19,113,76): typecheck error FS1093: The union cases or fields of the type 'RecordTypeWithPrivateRepresentation' are not accessible from this code location
+
+neg15.fs(114,19,114,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location
+
+neg15.fs(115,19,115,48): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg15.fs(116,20,116,73): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg15.fs(122,32,122,57): typecheck error FS0039: The value, constructor, namespace or type 'InternalTagOfInternalType' is not defined
+
+neg15.fs(128,31,128,61): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg15.fs(135,31,135,56): typecheck error FS0039: The value, constructor, namespace or type 'InternalTagOfInternalType' is not defined
+
+neg15.fs(141,30,141,60): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg15.fs(152,20,152,50): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg15.fs(183,1,183,5): typecheck error FS0491: The member or object constructor 'P' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(184,1,184,7): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(185,1,185,5): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(186,1,186,7): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(187,1,187,6): typecheck error FS1096: The record, struct or class field 'f' is not accessible from this code location
+
+neg15.fs(188,1,188,6): typecheck error FS0491: The member or object constructor 'P' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(189,1,189,8): typecheck error FS0491: The member or object constructor 'M' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(190,1,190,6): typecheck error FS0491: The member or object constructor 'SP' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(191,1,191,8): typecheck error FS0491: The member or object constructor 'SM' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg15.fs(204,11,204,16): typecheck error FS0501: The member or object constructor 'X2' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> X2'.
diff --git a/tests/fsharp/typecheck/sigs/neg15.fs b/tests/fsharp/typecheck/sigs/neg15.fs
new file mode 100644
index 0000000..a9dbda7
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg15.fs
@@ -0,0 +1,204 @@
+module Test
+
+
+// TODO: private and internal module checking
+// TODO: implement escape checks
+
+
+module M =
+   let private privateValue = 1
+   let internal internalValue = 1
+   
+   type private PrivateUnionType = 
+       |          DefaultTagOfPrivateType of int
+       //| private  PrivateTagOfPrivateType of int
+       //| internal InternalTagOfPrivateType of int
+
+   type UnionTypeWithPrivateRepresentation = 
+       private | DefaultTagOfUnionTypeWithPrivateRepresentation of int
+
+   type private PrivateRecordType = 
+       { DefaultFieldOfPrivateType : int }
+
+   type RecordTypeWithPrivateRepresentation = 
+       private { DefaultFieldOfRecordTypeWithPrivateRepresentation : int }
+
+   type internal InternalUnionType = 
+       |          DefaultTagOfInternalType of int
+       //| private  PrivateTagOfInternalType of int
+       //| internal InternalTagOfInternalType of int
+
+   type internal InternalRecordType = 
+       { DefaultFieldOfInternalType : int }
+
+   type PublicRecordType = 
+       {          DefaultFieldOfPublicType : int; 
+         //private  PrivateFieldOfPublicType : int; 
+         //internal InternalFieldOfPublicType : int; 
+                  PublicFieldOfPublicType: int }
+
+   let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref []  // escape via type inference
+   let errorPublicValueLaterInferredToInvolveInternalUnionType = ref [] // escape via type inference
+
+   let internal errorInternalValueLaterInferredToInvolvePrivateUnionType = ref []  // escape via type inference
+   let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // escape via type inference
+   
+   let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref []  // escape via type inference
+   let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // escape via type inference
+   
+   type Type() = 
+       member        private x.PrivateProperty = 3
+       static member private PrivateStaticProperty = 3
+       member        private x.PrivateMethod() = 3
+       static member private PrivateStaticMethod() = 3
+
+       member        internal x.InternalProperty = 3
+       static member internal   InternalStaticProperty = 3
+       member        internal x.InternalMethod() = 3
+       static member internal   InternalStaticMethod() = 3
+
+       // Check we can access private things from this type
+       member        x.NoError1 = x.PrivateProperty
+       member        x.NoError2 = Type.PrivateStaticProperty
+       static member NoError3 = Type.PrivateStaticProperty 
+       static member NoError4 = Type.PrivateStaticMethod() 
+
+       member        x.NoError1a = x.InternalProperty
+       member        x.NoError2a = Type.InternalStaticProperty
+       static member   NoError3a = Type.InternalStaticProperty 
+       static member   NoError4a = Type.InternalStaticMethod() 
+
+       member          x.Error1 = { DefaultFieldOfPrivateType=3 } // returning a private type from a public method
+       member          x.Error2 = DefaultTagOfPrivateType(3) // returning a private type from a public method
+       member          x.Error3 = { DefaultFieldOfInternalType=3 } // returning a internal type from a public method
+       member          x.Error4 = DefaultTagOfPrivateType(3) // returning a internal type from a public method
+       member internal x.Error5 = { DefaultFieldOfPrivateType=3 } // returning a private type from a internal method
+       member internal x.Error6 = DefaultTagOfPrivateType(3) // returning a private type from a internal method
+       member          x.Error7(y:PrivateUnionType) = () // accepting private type as argument to an public method
+       member          x.Error8(y:PrivateRecordType) = () // accepting private type as argument to an public method
+       member          x.Error9(y:InternalUnionType) = () // accepting internal type as argument to an public method
+       member          x.Error10(y:InternalRecordType) = () // accepting internal type as argument to an public method
+       member internal x.Error11(y:PrivateUnionType) = () // accepting private type as argument to an internal method
+       member internal x.Error12(y:PrivateRecordType) = () // accepting private type as argument to an internal method
+
+
+       static member Method30() = errorPublicValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method31() = errorPublicValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method32() = errorInternalValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method33() = noErrorInternalValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method34() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method35() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+
+    type Type with 
+
+         // Check we can access private things from an in-file augmentation
+         member        x.NoError51 = x.PrivateProperty
+         member        x.NoError52 = Type.PrivateStaticProperty
+         static member NoError53 = Type.PrivateStaticProperty 
+         static member NoError54 = Type.PrivateStaticMethod() 
+
+           
+module N =
+   let error1 = M.privateValue
+   let error2a = M.DefaultTagOfPrivateType(3)
+   //let error2b = M.PrivateTagOfPrivateType(3)
+   //let noError2c = M.InternalTagOfPrivateType(3)
+   let error2d = M.DefaultTagOfUnionTypeWithPrivateRepresentation(3)
+   let error3 = M.Type().PrivateProperty
+   let error4 = M.Type.PrivateStaticProperty
+   let error5 = M.Type().PrivateMethod()
+   let error6 = M.Type.PrivateStaticMethod()
+   let error7 = { M.DefaultFieldOfPrivateType = 3 }
+   let error7a = { M.DefaultFieldOfRecordTypeWithPrivateRepresentation = 3  }
+   let error7a1 { M.DefaultFieldOfRecordTypeWithPrivateRepresentation = x } = x
+   let error7a2 { M.DefaultFieldOfPrivateType = x } = x
+   let error8 x = x.M.DefaultFieldOfPrivateType
+   let error8a x = x.M.DefaultFieldOfRecordTypeWithPrivateRepresentation 
+   //let error9 x = x.M.PrivateFieldOfPublicType
+
+   let internal noError41 = M.internalValue
+   let internal noError42a = M.DefaultTagOfInternalType(3)
+   //let internal error42b = M.PrivateTagOfInternalType(3)
+   let internal noError42c = M.InternalTagOfInternalType(3)
+   let internal noError43 = M.Type().InternalProperty
+   let internal noError44 = M.Type.InternalStaticProperty
+   let internal noError45 = M.Type().InternalMethod()
+   let internal noError46 = M.Type.InternalStaticMethod()
+   let internal noError47 = { M.DefaultFieldOfInternalType = 3 }
+   let internal noError48 x = x.M.DefaultFieldOfInternalType
+   //let internal noError49 x = x.M.InternalFieldOfPublicType
+   let noError410 (x:M.PublicRecordType) = ()
+
+   let private noError71 = M.internalValue
+   let private noError72a = M.DefaultTagOfInternalType(3)
+   //let private error72b = M.PrivateTagOfInternalType(3)
+   let private noError72c = M.InternalTagOfInternalType(3)
+   let private noError73 = M.Type().InternalProperty
+   let private noError74 = M.Type.InternalStaticProperty
+   let private noError75 = M.Type().InternalMethod()
+   let private noError76 = M.Type.InternalStaticMethod()
+   let private noError77 = { M.DefaultFieldOfInternalType = 3 }
+   let private noError78 x = x.M.DefaultFieldOfInternalType
+   //let private noError79 x = x.M.InternalFieldOfPublicType
+   let noError10 (x:M.PublicRecordType) = ()
+
+   let noError21 = M.internalValue  
+   let error22   = M.DefaultTagOfInternalType(3) // returning internal type as public value
+   let noError23 = M.Type().InternalProperty
+   let noError24 = M.Type.InternalStaticProperty
+   let noError25 = M.Type().InternalMethod()
+   let noError26 = M.Type.InternalStaticMethod()
+   let error27 = { M.DefaultFieldOfInternalType = 3 } // returning internal type as public value
+   let error28 x = x.M.DefaultFieldOfInternalType      // accepting internal type as argument to public function
+   //let error29 x = x.M.InternalFieldOfPublicType // returning internal type as argument to public function
+
+type X() = 
+    member private x.P = 1
+    member private x.M() = 1
+    static member private SP = 1
+    static member private SM() = 1
+    member internal x.IP = 1
+    member internal x.IM() = 1
+    static member internal SIP = 1
+    static member internal SIM() = 1
+
+type X2 = 
+    new() = { f = 1; f2 = 1 }
+    private new (dummy:int) = { f = 1; f2 = 1 }
+    val private f : int
+    member private x.P = 1
+    member private x.M() = 1
+    static member private SP = 1
+    static member private SM() = 1
+
+    val internal f2 : int
+    member internal x.IP = 1
+    member internal x.IM() = 1
+    static member internal SIP = 1
+    static member internal SIM() = 1
+
+
+let xx = X() 
+let xx2 = X2()
+xx.P   // This now gives access error
+xx.M()   // This now gives access error
+X.SP   // This now gives access error
+X.SM()   // This now gives access error
+xx2.f   // This now gives access error
+xx2.P   // This now gives access error
+xx2.M()   // This now gives access error
+X2.SP   // This now gives access error
+X2.SM()   // This now gives access error
+
+xx.IP   // no access error
+xx.IM()   // no access error
+X.SIP   // no access error
+X.SIM()   // no access error
+xx2.f2   // no access error
+xx2.IP   // no access error
+xx2.IM()   // no access error
+X2.SIP   // no access error
+X2.SIM()   // no access error
+
+
+let xx3 = X2(2) // should give an access error 
diff --git a/tests/fsharp/typecheck/sigs/neg16.bsl b/tests/fsharp/typecheck/sigs/neg16.bsl
new file mode 100644
index 0000000..0477126
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg16.bsl
@@ -0,0 +1,82 @@
+
+neg16.fs(7,13,7,16): typecheck error FS0644: Namespaces cannot contain extension members except in the same file and namespace where the type is defined. Consider using a module to hold declarations of extension members.
+
+neg16.fs(23,10,23,11): typecheck error FS0935: Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal
+
+neg16.fs(23,10,23,11): typecheck error FS0935: Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal
+
+neg16.fs(35,10,35,11): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute
+
+neg16.fs(38,10,38,11): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute
+
+neg16.fs(41,10,41,11): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute
+
+neg16.fs(44,10,44,11): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute
+
+neg16.fs(47,10,47,13): typecheck error FS0934: Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute
+
+neg16.fs(49,7,49,23): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg16.fs(52,7,52,23): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg16.fs(59,7,59,20): typecheck error FS0001: This expression was expected to have type
+    Choice<'a,'b>    
+but here has type
+    string    
+
+neg16.fs(60,7,60,24): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(61,7,61,32): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(62,7,62,19): typecheck error FS0001: This expression was expected to have type
+    'a option    
+but here has type
+    string    
+
+neg16.fs(67,7,67,28): typecheck error FS0001: This expression was expected to have type
+    Choice<'a,'b>    
+but here has type
+    string    
+
+neg16.fs(68,7,68,33): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(69,7,69,40): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(70,7,70,27): typecheck error FS0001: This expression was expected to have type
+    'a option    
+but here has type
+    string    
+
+neg16.fs(75,11,75,32): typecheck error FS0001: This expression was expected to have type
+    Choice<'a,'b>    
+but here has type
+    string    
+
+neg16.fs(76,11,76,36): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(77,12,77,45): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg16.fs(78,11,78,31): typecheck error FS0001: This expression was expected to have type
+    'a option    
+but here has type
+    string    
+
+neg16.fs(86,15,86,16): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes
+
+neg16.fs(89,11,89,14): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes
+
+neg16.fs(89,11,89,14): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
+
+neg16.fs(92,7,92,9): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes
+
+neg16.fs(92,7,92,9): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
+
+neg16.fs(108,17,108,24): typecheck error FS0823: The 'VolatileField' attribute may only be used on 'let' bindings in classes
+
+neg16.fs(96,16,96,19): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
+
+neg16.fs(99,16,99,20): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
+
+neg16.fs(102,9,102,11): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
+
+neg16.fs(105,9,105,13): typecheck error FS0879: Volatile fields must be marked 'mutable' and cannot be thread-static
diff --git a/tests/fsharp/typecheck/sigs/neg16.fs b/tests/fsharp/typecheck/sigs/neg16.fs
new file mode 100644
index 0000000..c31edcb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg16.fs
@@ -0,0 +1,113 @@
+
+
+namespace Test
+open System.Reflection
+
+type System.Reflection.MethodInfo with
+  member mi.Bug() = printf "%A" mi.IsGenericMethod 
+  
+module AllowNullLiteralTest = begin
+
+    //[<AllowNullLiteral>]
+    type I = 
+        interface
+          abstract P : int
+        end
+
+    //[<AllowNullLiteral>]
+    type C() = 
+        member x.P = 1
+
+
+    [<AllowNullLiteral>]
+    type D() = 
+        inherit C()
+        interface I with 
+            member x.P = 2
+        member x.P = 1
+
+    let d = (null : D)
+
+    let d2 = ((box null) :?>  D)
+
+
+    [<AllowNullLiteral>] // expect an error here
+    type S(c:int) = struct end
+    
+    [<AllowNullLiteral>] // expect an error here
+    type R = { r : int } 
+    
+    [<AllowNullLiteral>] // expect an error here
+    type U = A | B of int
+    
+    [<AllowNullLiteral>] // expect an error here
+    type E = A = 1 | B = 2
+    
+    [<AllowNullLiteral>] // expect an error here
+    type Del = delegate of int -> int
+    
+    [<AllowNullLiteral>] // expect an error here
+    let x = 1
+    
+    [<AllowNullLiteral>] // expect an error here
+    let f x = 1
+    
+   
+end
+module ActivePatternSanityCHeckTests1 = begin
+
+  let (|Foo|Bar|) x = "BAD DOG!"  //  expect: type string doesn't match type 'choice'
+  let (|Foo2|Bar2|_|) x = "BAD DOG!"   // expect: invalid name for an active pattern
+  let (|Foo2b|Bar2b|Baz2b|_|) x = "BAD DOG!"   //  expect: type string doesn't match type 'choice'
+  let (|Foo3|_|) x = "BAD DOG!"   //  expect: type string doesn't match type 'option'
+
+end
+module ActivePatternSanityCHeckTests2 = begin
+
+  let (|Foo|Bar|) (a:int) x = "BAD DOG!"  //  expect: type string doesn't match type 'choice'
+  let (|Foo2|Bar2|_|) (a:int)  x = "BAD DOG!"   // expect: invalid name for an active pattern
+  let (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!"   //  expect: type string doesn't match type 'choice'
+  let (|Foo3|_|) (a:int) x = "BAD DOG!"   //  expect: type string doesn't match type 'option'
+end
+
+module ActivePatternSanityCHeckTests3 = begin
+
+  let rec (|Foo|Bar|) (a:int) x = "BAD DOG!"  //  expect: type string doesn't match type 'choice'
+  let rec (|Foo2|Bar2|_|) (a:int) x = "BAD DOG!"   // expect: invalid name for an active pattern
+  let rec  (|Foo2b|Bar2b|Baz2b|_|) (a:int) x = "BAD DOG!"   //  expect: type string doesn't match type 'choice'
+  let rec (|Foo3|_|) (a:int) x = "BAD DOG!"   //  expect: type string doesn't match type 'option'
+
+end
+
+
+module VolatileFieldSanityChecks = begin
+
+  [<VolatileField>]
+  let mutable x = 1
+
+  [<VolatileField>]
+  let rec f x = 1
+
+  [<VolatileField>]
+  let x2 = 1
+
+  type C() = 
+    [<VolatileField>]
+    static let sx2 = 1   // expect an error - not mutable
+
+    [<VolatileField>]
+    static let f x2 = 1   // expect an error - not mutable
+
+    [<VolatileField>]
+    let x2 = 1   // expect an error - not mutable
+
+    [<VolatileField>]
+    let f x2 = 1   // expect an error - not mutable
+
+    [<VolatileField>]
+    val mutable x : int // expect an error - not supported
+
+    member x.P = 1
+
+end
+
diff --git a/tests/fsharp/typecheck/sigs/neg17.bsl b/tests/fsharp/typecheck/sigs/neg17.bsl
new file mode 100644
index 0000000..6659012
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg17.bsl
@@ -0,0 +1,36 @@
+
+neg17.fs(84,17,84,33): typecheck error FS0292: The type definitions in the signature and implementation are not compatible because the accessibility specified in the signature is more than that specified in the implementation
+
+neg17b.fs(7,17,7,31): typecheck error FS1094: The value 'privateValue' is not accessible from this code location
+
+neg17b.fs(8,18,8,43): typecheck error FS1092: The type 'PrivateUnionType' is not accessible from this code location
+
+neg17b.fs(11,26,11,41): typecheck error FS0039: The field, constructor or member 'PrivateProperty' is not defined
+
+neg17b.fs(12,24,12,45): typecheck error FS0039: The field, constructor or member 'PrivateStaticProperty' is not defined
+
+neg17b.fs(13,26,13,39): typecheck error FS0039: The field, constructor or member 'PrivateMethod' is not defined
+
+neg17b.fs(14,24,14,43): typecheck error FS0039: The field, constructor or member 'PrivateStaticMethod' is not defined
+
+neg17b.fs(15,17,15,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location
+
+neg17b.fs(15,17,15,52): typecheck error FS1092: The type 'PrivateRecordType' is not accessible from this code location
+
+neg17b.fs(16,19,16,48): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg17b.fs(17,19,17,47): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg17b.fs(21,31,21,77): typecheck error FS0039: The value, constructor, namespace or type 'DefaultTagOfUnionTypeWithPrivateRepresentation' is not defined
+
+neg17b.fs(29,31,29,61): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg17b.fs(30,31,30,84): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg17b.fs(32,24,32,50): typecheck error FS0039: The type 'RecordTypeWithPrivateField' is not defined
+
+neg17b.fs(43,30,43,60): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
+
+neg17b.fs(45,23,45,49): typecheck error FS0039: The type 'RecordTypeWithPrivateField' is not defined
+
+neg17b.fs(54,20,54,50): typecheck error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
diff --git a/tests/fsharp/typecheck/sigs/neg17.fs b/tests/fsharp/typecheck/sigs/neg17.fs
new file mode 100644
index 0000000..df77551
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg17.fs
@@ -0,0 +1,143 @@
+module Neg17
+
+
+
+
+
+
+module M =
+   let private privateValue = 1
+   let internal internalValue = 1
+   
+   type private PrivateUnionType = 
+       |          DefaultTagOfPrivateType of int
+       //| private  PrivateTagOfPrivateType of int
+       //| internal InternalTagOfPrivateType of int
+
+   type UnionTypeWithPrivateRepresentation = 
+       private | DefaultTagOfUnionTypeWithPrivateRepresentation of int
+
+   type private PrivateRecordType = 
+       { DefaultFieldOfPrivateType : int }
+
+   type RecordTypeWithPrivateRepresentation = 
+       private { DefaultFieldOfRecordTypeWithPrivateRepresentation : int }
+
+   type internal InternalUnionType = 
+       |          DefaultTagOfInternalType of int
+       //| private  PrivateTagOfInternalType of int
+       //| internal InternalTagOfInternalType of int
+
+   type internal InternalRecordType = 
+       { DefaultFieldOfInternalType : int }
+
+   let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref []  // escape check: escape via type inference
+   let errorPublicValueLaterInferredToInvolveInternalUnionType = ref [] // escape check: escape via type inference
+
+   let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference
+   
+   let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref []  // escape check: escape via type inference
+   let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference
+   
+   type Type() = 
+       member        private x.PrivateProperty = 3
+       static member private PrivateStaticProperty = 3
+       member        private x.PrivateMethod() = 3
+       static member private PrivateStaticMethod() = 3
+
+       member        internal x.InternalProperty = 3
+       static member internal   InternalStaticProperty = 3
+       member        internal x.InternalMethod() = 3
+       static member internal   InternalStaticMethod() = 3
+
+       // Check we can access private things from this type
+       member        x.NoError1 = x.PrivateProperty
+       member        x.NoError2 = Type.PrivateStaticProperty
+       static member NoError3 = Type.PrivateStaticProperty 
+       static member NoError4 = Type.PrivateStaticMethod() 
+
+       member        x.NoError1a = x.InternalProperty
+       member        x.NoError2a = Type.InternalStaticProperty
+       static member   NoError3a = Type.InternalStaticProperty 
+       static member   NoError4a = Type.InternalStaticMethod() 
+
+       static member Method30() = errorPublicValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method31() = errorPublicValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method33() = noErrorInternalValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method34() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method35() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+
+    type Type with 
+
+         // Check we can access private things from an in-file augmentation
+         member        x.NoError51 = x.PrivateProperty
+         member        x.NoError52 = Type.PrivateStaticProperty
+         static member NoError53 = Type.PrivateStaticProperty 
+         static member NoError54 = Type.PrivateStaticMethod() 
+
+    
+
+module M2 =
+   let private privateValue = 1
+   let internal internalValue = 1
+   
+   type private PrivateUnionType = 
+       |          DefaultTagOfPrivateType of int
+       //| private  PrivateTagOfPrivateType of int
+       //| internal InternalTagOfPrivateType of int
+(*
+   type private PrivateRecordType = 
+       { DefaultFieldOfPrivateType : int }
+
+   type internal InternalUnionType = 
+       |          DefaultTagOfInternalType of int
+       | private  PrivateTagOfInternalType of int
+       | internal InternalTagOfInternalType of int
+
+   type internal InternalRecordType = 
+       { DefaultFieldOfInternalType : int }
+
+   type RecordTypeWithPrivateField = 
+       {          DefaultFieldOfPublicType : int; 
+         private  PrivateFieldOfPublicType : int; 
+         internal InternalFieldOfPublicType : int; 
+         public   PublicFieldOfPublicType: int }
+
+   let errorPublicValueLaterInferredToInvolvePrivateUnionType = ref []  // escape check: escape via type inference
+   let errorPublicValueLaterInferredToInvolveInternalUnionType = ref [] // escape check: escape via type inference
+
+   let internal noErrorInternalValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference
+   
+   let private noErrorPrivateValueLaterInferredToInvolvePrivateUnionType = ref []  // escape check: escape via type inference
+   let private noErrorPrivateValueLaterInferredToInvolveInternalUnionType = ref [] // no escape check: escape via type inference
+   
+   type Type() = 
+       member        private x.PrivateProperty = 3
+       static member private PrivateStaticProperty = 3
+       member        private x.PrivateMethod() = 3
+       static member private PrivateStaticMethod() = 3
+
+       member        internal x.InternalProperty = 3
+       static member internal   InternalStaticProperty = 3
+       member        internal x.InternalMethod() = 3
+       static member internal   InternalStaticMethod() = 3
+
+       // Check we can access private things from this type
+       member        x.NoError1 = x.PrivateProperty
+       member        x.NoError2 = Type.PrivateStaticProperty
+       static member NoError3 = Type.PrivateStaticProperty 
+       static member NoError4 = Type.PrivateStaticMethod() 
+
+       member        x.NoError1a = x.InternalProperty
+       member        x.NoError2a = Type.InternalStaticProperty
+       static member   NoError3a = Type.InternalStaticProperty 
+       static member   NoError4a = Type.InternalStaticMethod() 
+
+       static member Method30() = errorPublicValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method31() = errorPublicValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method33() = noErrorInternalValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfInternalType(3)]
+       static member Method34() = noErrorPrivateValueLaterInferredToInvolveInternalUnionType := [DefaultTagOfPrivateType(3)]
+       static member Method35() = noErrorPrivateValueLaterInferredToInvolvePrivateUnionType := [DefaultTagOfPrivateType(3)]
+       
+       *)
+       
diff --git a/tests/fsharp/typecheck/sigs/neg17.fsi b/tests/fsharp/typecheck/sigs/neg17.fsi
new file mode 100644
index 0000000..2359078
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg17.fsi
@@ -0,0 +1,47 @@
+module Neg17
+
+
+
+
+
+
+module M =
+   val private privateValue : int
+   val internal internalValue : int
+   
+   type private PrivateUnionType = 
+       |          DefaultTagOfPrivateType of int
+       //| private  PrivateTagOfPrivateType of int
+       //| internal InternalTagOfPrivateType of int
+
+   type UnionTypeWithPrivateRepresentation 
+
+   type private PrivateRecordType = 
+       { DefaultFieldOfPrivateType : int }
+
+   type RecordTypeWithPrivateRepresentation 
+
+   type internal InternalUnionType = 
+       |          DefaultTagOfInternalType of int
+       //| private  PrivateTagOfInternalType of int
+       //| internal InternalTagOfInternalType of int
+
+   type internal InternalRecordType = 
+       { DefaultFieldOfInternalType : int }
+
+   val internal noErrorInternalValueLaterInferredToInvolveInternalUnionType : InternalUnionType list ref
+   
+ 
+   type Type = 
+       new : unit -> Type
+       member        internal InternalProperty : int
+       static member internal InternalStaticProperty : int
+       member        internal InternalMethod: unit -> int
+       static member internal InternalStaticMethod: unit -> int
+
+module M2 =
+   val internal privateValue : int // error 
+   val private  internalValue : int // error
+   
+   type internal PrivateUnionType = // error
+       |          DefaultTagOfPrivateType of int
diff --git a/tests/fsharp/typecheck/sigs/neg17b.fs b/tests/fsharp/typecheck/sigs/neg17b.fs
new file mode 100644
index 0000000..066f38c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg17b.fs
@@ -0,0 +1,58 @@
+
+module Test
+
+open Neg17
+           
+module N =
+   let error1 = M.privateValue
+   let error2a = M.DefaultTagOfPrivateType(3)
+   //let error2b = M.PrivateTagOfPrivateType(3)
+   //let noError2c = M.InternalTagOfPrivateType(3)
+   let error3 = M.Type().PrivateProperty
+   let error4 = M.Type.PrivateStaticProperty
+   let error5 = M.Type().PrivateMethod()
+   let error6 = M.Type.PrivateStaticMethod()
+   let error7 = { M.DefaultFieldOfPrivateType = 3 }
+   let error8 x = x.M.DefaultFieldOfPrivateType
+   let error9 x = x.M.PrivateFieldOfPublicType
+
+   let internal noError41 = M.internalValue
+   let internal noError42a = M.DefaultTagOfInternalType(3)
+   let internal error42a1 = M.DefaultTagOfUnionTypeWithPrivateRepresentation(3)
+   //let internal error42b = M.PrivateTagOfInternalType(3)
+   //let internal noError42c = M.InternalTagOfInternalType(3)
+   let internal noError43 = M.Type().InternalProperty
+   let internal noError44 = M.Type.InternalStaticProperty
+   let internal noError45 = M.Type().InternalMethod()
+   let internal noError46 = M.Type.InternalStaticMethod()
+   let internal noError47 = { M.DefaultFieldOfInternalType = 3 }
+   let internal noError48 x = x.M.DefaultFieldOfInternalType
+   let internal error48a1 x = x.M.DefaultFieldOfRecordTypeWithPrivateRepresentation
+   //let internal noError49 x = x.M.InternalFieldOfPublicType
+   let noError410 (x:M.RecordTypeWithPrivateField) = ()
+
+   let private noError71 = M.internalValue
+   let private noError72a = M.DefaultTagOfInternalType(3)
+   //let private error72b = M.PrivateTagOfInternalType(3)
+   //let private noError72c = M.InternalTagOfInternalType(3)
+   let private noError73 = M.Type().InternalProperty
+   let private noError74 = M.Type.InternalStaticProperty
+   let private noError75 = M.Type().InternalMethod()
+   let private noError76 = M.Type.InternalStaticMethod()
+   let private noError77 = { M.DefaultFieldOfInternalType = 3 }
+   let private noError78 x = x.M.DefaultFieldOfInternalType
+   //let private noError79 x = x.M.InternalFieldOfPublicType
+   let noError10 (x:M.RecordTypeWithPrivateField) = ()
+
+   let noError21 = M.internalValue  
+   let error22   = M.DefaultTagOfInternalType(3) // returning internal type as public value
+   let noError23 = M.Type().InternalProperty
+   let noError24 = M.Type.InternalStaticProperty
+   let noError25 = M.Type().InternalMethod()
+   let noError26 = M.Type.InternalStaticMethod()
+   let error27 = { M.DefaultFieldOfInternalType = 3 } // returning internal type as public value
+   let error28 x = x.M.DefaultFieldOfInternalType      // accepting internal type as argument to public function
+   //let error29 x = x.M.InternalFieldOfPublicType // returning internal type as argument to public function
+
+
+       
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg18.bsl b/tests/fsharp/typecheck/sigs/neg18.bsl
new file mode 100644
index 0000000..4d98d93
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg18.bsl
@@ -0,0 +1,44 @@
+
+neg18.fs(7,13,7,20): typecheck error FS0001: The type 'int' is not compatible with the type 'seq<'a>'
+
+neg18.fs(25,21,25,24): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.TwoAmbiguousGenericTypes.M.C<_>' expects 1 type argument(s) but is given 0
+
+neg18.fs(27,17,27,20): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(33,17,33,20): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(39,21,39,22): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.TwoAmbiguousGenericTypes.M.C<_,_>' expects 2 type argument(s) but is given 0
+
+neg18.fs(41,17,41,18): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(47,17,47,20): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(54,21,54,22): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.TwoAmbiguousGenericTypes.M.C<_,_>' expects 2 type argument(s) but is given 0
+
+neg18.fs(56,17,56,18): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(62,17,62,20): typecheck error FS1124: Multiple types exist called 'C', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'C<_>'.
+
+neg18.fs(121,21,121,25): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.OneNonAmbiguousGenericType.M3.C<_>' expects 1 type argument(s) but is given 0
+
+neg18.fs(125,17,125,21): typecheck error FS1125: The instantiation of the generic type 'C' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'C<_>'.
+
+neg18.fs(130,21,130,22): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.OneNonAmbiguousGenericType.M3.C<_>' expects 1 type argument(s) but is given 0
+
+neg18.fs(134,17,134,20): typecheck error FS1125: The instantiation of the generic type 'C' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'C<_>'.
+
+neg18.fs(140,13,140,14): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.OneNonAmbiguousGenericType.M3.C<_>' expects 1 type argument(s) but is given 0
+
+neg18.fs(144,17,144,20): typecheck error FS1125: The instantiation of the generic type 'C' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'C<_>'.
+
+neg18.fs(154,19,154,22): typecheck error FS1124: Multiple types exist called 'Foo', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'Foo<_>'.
+
+neg18.fs(160,26,160,29): typecheck error FS1125: The instantiation of the generic type 'T' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'T<_>'.
+
+neg18.fs(170,10,170,13): typecheck error FS0086: The '.[]' operator cannot be redefined. Consider using a different operator name
+
+neg18.fs(182,28,182,29): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'.
+
+neg18.fs(185,26,185,27): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'b has been constrained to be type ''a'.
+
+neg18.fs(186,12,186,16): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The type variable 'a has been constrained to be type ''b'.
diff --git a/tests/fsharp/typecheck/sigs/neg18.fs b/tests/fsharp/typecheck/sigs/neg18.fs
new file mode 100644
index 0000000..ff39354
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg18.fs
@@ -0,0 +1,192 @@
+module Test
+
+module TestSquigglyLocation = 
+
+    type R = { Sizes : int }
+    let r = { Sizes = 1 }
+    Seq.max r.Sizes
+
+module TestSquigglyExists =
+    let f () = 
+       match box 1 with 
+       | :? list<_> -> 3  // this line should give a warning
+       | _ -> 4
+
+
+module AmbiguousTypeNameTests = 
+    module TwoAmbiguousGenericTypes = 
+        module M = 
+            type C<'a>() = 
+               static member P = 1
+
+            type C<'a,'b>() = 
+               static member P = 1
+
+        let _ = new M.C() //  give errpr
+        let _ = new M.C<int>() 
+        let _ = M.C()     //  give warning
+        let _ = M.C<int>()  
+        let _ = M.C<int,int>() 
+        let _ = M.C<_>()  
+        let _ = M.C<_,_>() 
+
+        let _ = M.C.P     //  give warning
+        let _ = M.C<_>.P
+        let _ = M.C<_,_>.P
+
+        open M
+
+        let _ = new C() //  give errpr
+        let _ = new C<int>() 
+        let _ = C()     //  give warning
+        let _ = C<int>()  
+        let _ = C<int,int>() 
+        let _ = C<_>()  
+        let _ = C<_,_>() 
+
+        let _ = C.P     //  give warning
+        let _ = C<_>.P
+        let _ = C<_,_>.P
+        
+        // open again for good luck
+        open M
+
+        let _ = new C() //  give errpr
+        let _ = new C<int>() 
+        let _ = C()     //  give warning
+        let _ = C<int>()  
+        let _ = C<int,int>() 
+        let _ = C<_>()  
+        let _ = C<_,_>() 
+
+        let _ = C.P     //  give warning
+        let _ = C<_>.P
+        let _ = C<_,_>.P
+        
+    module OneGenericTypeAndOneNonGenericType = 
+        module M = 
+            type C() = 
+               static member P = 1
+
+            type C<'a>() = 
+               static member P = 1
+
+        let _ = new M.C() 
+        let _ = new M.C< >() 
+        let _ = new M.C<int>() 
+        let _ = M.C()     
+        let _ = M.C< >()     
+        let _ = M.C<int>()  
+        let _ = M.C<_>()  
+
+        let _ = M.C.P     
+        let _ = M.C< >.P     
+        let _ = M.C<_>.P
+
+        open M
+
+        let _ = new C() 
+        let _ = new C< >() 
+        let _ = new C<int>() 
+        let _ = C()     
+        let _ = C< >()     
+        let _ = C<int>()  
+        let _ = C<_>()  
+
+        let _ = C.P     
+        let _ = C< >.P     
+        let _ = C<_>.P
+        
+        // open again for good luck
+        open M
+
+        let _ = new C() 
+        let _ = new C< >() 
+        let _ = new C<int>() 
+        let _ = C()     
+        let _ = C< >()     
+        let _ = C<int>()  
+        let _ = C<_>()  
+
+        let _ = C.P     
+        let _ = C< >.P     
+        let _ = C<_>.P
+        
+    module OneNonAmbiguousGenericType = 
+        module M3 = 
+            type C<'a>() = 
+               static member P = 1
+
+
+        let _ = new M3.C()  //  give error
+        let _ = M3.C()     
+        let _ = M3.C<int>()   
+
+        let _ = M3.C.P      //  give warning
+        let _ = M3.C<_>.P
+
+        open M3
+
+        let _ = new C()  //  give error
+        let _ = C()     
+        let _ = C<int>()   
+
+        let _ = C.P      //  give warning
+        let _ = C<_>.P
+        
+        // open again for good luck
+        open M3
+
+        new C()  //  give error
+        let _ = C()     
+        let _ = C<int>()   
+
+        let _ = C.P      //  give warning
+        let _ = C<_>.P
+
+    module ActualRepro1 = 
+        type Foo<'a>() =
+            member x.f() = ()
+
+        type Foo<'a,'b>() =
+            member x.f() = ()
+
+        let foo = Foo()  // Foo<'a,b> !!!
+
+    module ActualRepro2 =     
+
+        type T<'a>() = 
+            static member P = sizeof<'a>
+            member x.M = T.P  // expect deprecation warning
+
+        let v = (new T<int64>()).M
+
+        printfn "Expected: 8"
+        printfn "Actual:   %d" v
+
+module FSharp_1_0_Bug_3183 = 
+    type IIndexable<'T> = 
+         abstract (.[]) : 'T with get, set       // expect no warning here
+    let (.[]) x = x // expect warning here
+
+module FSharp_1_0_Bug_2949 = 
+    [<AbstractClass>]
+    type T() = 
+        abstract X : unit -> int       
+        abstract X : unit -> decimal     // expect duplicate member error here
+        abstract X : unit -> byte        // expect duplicate member error here
+        abstract X : unit -> char        // expect duplicate member error here
+        abstract X : unit -> float<_>    // expect duplicate member error here
+
+module TestWarningGivenOnLessGenericCode = 
+    let f (x:'a,y:'b) = [x;y]
+    
+module TestWarningGivenOnRecursiveCodeWithDifferentTypeVariableNames = 
+    let rec f (x:'a) = g x
+    and g (x:'b) = f x
+
+module TestNoWarningGivenOnRecursiveCodeWithSameTypeVariableNames = 
+    let rec f (x:'a) = g x
+    and g (x:'a) = f x
+    
+    
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg19.bsl b/tests/fsharp/typecheck/sigs/neg19.bsl
new file mode 100644
index 0000000..dc279d1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg19.bsl
@@ -0,0 +1,20 @@
+
+neg19.fs(5,25,5,41): parse error FS1154: This number is outside the allowable range for decimal literals
+
+neg19.fs(6,28,6,44): parse error FS1154: This number is outside the allowable range for decimal literals
+
+neg19.fs(13,33,13,62): parse error FS1184: A getter property may have at most one argument group
+
+neg19.fs(14,33,14,75): parse error FS1184: A getter property may have at most one argument group
+
+neg19.fs(15,33,15,64): parse error FS1185: A setter property may have at most two argument groups
+
+neg19.fs(15,33,15,64): parse error FS0559: Property setters must be defined using 'set value = ', 'set idx value = ' or 'set (idx1,...,idxN) value = ... '
+
+neg19.fs(16,36,16,65): parse error FS1184: A getter property may have at most one argument group
+
+neg19.fs(17,36,17,78): parse error FS1184: A getter property may have at most one argument group
+
+neg19.fs(18,36,18,67): parse error FS1185: A setter property may have at most two argument groups
+
+neg19.fs(18,36,18,67): parse error FS0559: Property setters must be defined using 'set value = ', 'set idx value = ' or 'set (idx1,...,idxN) value = ... '
diff --git a/tests/fsharp/typecheck/sigs/neg19.fs b/tests/fsharp/typecheck/sigs/neg19.fs
new file mode 100644
index 0000000..ef52895
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg19.fs
@@ -0,0 +1,23 @@
+module Test
+
+// Literal tests
+module DecimalLiteralTests = 
+    let literalTooBig = 7.922816252e+28M
+    let literalTooSmall = -7.922816252e+28M
+
+module CheckMisDefinedProperties = begin 
+    module Test1 = begin
+
+        type T() = 
+          class
+            member this.X5 with get (idx1 : int) (idx2 : int) = 4 // should be rejected by parsing
+            member this.X6 with get (idx1 : int) (idx2 : int) (idx3 : int) = 4 // should be rejected by parsing
+            member this.S5 with set (idx1 : int) (idx2 : int) v = 4 // should be rejected by parsing
+            static member SX5 with get (idx1 : int) (idx2 : int) = 4 // should be rejected by parsing
+            static member SX6 with get (idx1 : int) (idx2 : int) (idx3 : int) = 4 // should be rejected by parsing
+            static member SS5 with set (idx1 : int) (idx2 : int) v = 4 // should be rejected by parsing
+            
+          end
+
+    end
+end
diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl
new file mode 100644
index 0000000..a2b8918
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg20.bsl
@@ -0,0 +1,364 @@
+
+neg20.fs(30,28,30,31): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(31,32,31,35): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(32,28,32,31): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(32,32,32,35): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(34,24,34,27): typecheck error FS0001: This expression was expected to have type
+    obj    
+but here has type
+    string    
+
+neg20.fs(35,24,35,27): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(43,15,43,18): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(44,19,44,22): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(45,15,45,18): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(45,19,45,22): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(47,11,47,14): typecheck error FS0001: This expression was expected to have type
+    obj    
+but here has type
+    string    
+
+neg20.fs(48,11,48,14): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(52,24,52,31): typecheck error FS0001: This expression was expected to have type
+    A    
+but here has type
+    B    
+
+neg20.fs(53,38,53,39): typecheck error FS0001: This expression was expected to have type
+    System.ValueType    
+but here has type
+    int    
+
+neg20.fs(60,26,60,33): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    A    
+
+neg20.fs(61,27,61,35): typecheck error FS0001: This expression was expected to have type
+    B1    
+but here has type
+    B2    
+
+neg20.fs(62,26,62,33): typecheck error FS0001: This expression was expected to have type
+    C    
+but here has type
+    B    
+
+neg20.fs(66,25,66,32): typecheck error FS0001: This expression was expected to have type
+    A    
+but here has type
+    B    
+
+neg20.fs(67,27,67,34): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    C    
+
+neg20.fs(70,31,70,38): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    C    
+
+neg20.fs(71,34,71,42): typecheck error FS0001: Type mismatch. Expecting a
+    A list    
+but given a
+    B list    
+The type 'A' does not match the type 'B'
+
+neg20.fs(75,30,75,37): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    C    
+
+neg20.fs(76,34,76,43): typecheck error FS0001: Type mismatch. Expecting a
+    A list    
+but given a
+    B list    
+The type 'A' does not match the type 'B'
+
+neg20.fs(80,23,80,39): typecheck error FS0193: Type constraint mismatch. The type 
+    C list    
+is not compatible with type
+    seq<B>    
+The type 'C list' is not compatible with the type 'seq<B>'
+
+neg20.fs(81,34,81,43): typecheck error FS0001: Type mismatch. Expecting a
+    A list    
+but given a
+    B list    
+The type 'A' does not match the type 'B'
+
+neg20.fs(83,47,83,54): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    C    
+
+neg20.fs(87,54,87,61): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    C    
+
+neg20.fs(92,19,92,26): typecheck error FS0001: This expression was expected to have type
+    A    
+but here has type
+    B    
+
+neg20.fs(96,26,96,33): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    A    
+
+neg20.fs(97,26,97,33): typecheck error FS0001: This expression was expected to have type
+    A    
+but here has type
+    B    
+
+neg20.fs(99,26,99,33): typecheck error FS0001: This expression was expected to have type
+    B    
+but here has type
+    A    
+
+neg20.fs(108,12,108,16): typecheck error FS0001: Type mismatch. Expecting a
+    B * B -> 'a    
+but given a
+    A * A -> Data    
+The type 'B' does not match the type 'A'
+
+neg20.fs(109,12,109,16): typecheck error FS0001: Type mismatch. Expecting a
+    A * B -> 'a    
+but given a
+    A * A -> Data    
+The type 'B' does not match the type 'A'
+
+neg20.fs(110,12,110,16): typecheck error FS0001: Type mismatch. Expecting a
+    B * A -> 'a    
+but given a
+    A * A -> Data    
+The type 'B' does not match the type 'A'
+
+neg20.fs(128,19,128,22): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(129,19,129,22): typecheck error FS0001: This expression was expected to have type
+    obj    
+but here has type
+    string    
+
+neg20.fs(131,5,131,24): typecheck error FS0041: No overloads match for method 'OM3'. The available overloads are shown below (or in the Error List window).
+neg20.fs(131,5,131,24): typecheck error FS0041: Possible overload: 'static member C.OM3 : x:'b * y:int -> int'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    int    
+The type 'obj' is not compatible with the type 'int'.
+neg20.fs(131,5,131,24): typecheck error FS0041: Possible overload: 'static member C.OM3 : x:'b * y:'b -> int'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    'a    
+The type 'obj' is not compatible with the type ''a'.
+
+neg20.fs(152,13,152,23): typecheck error FS0033: The type 'Test.BadNumberOfGenericParameters.C<_>' expects 1 type argument(s) but is given 2
+
+neg20.fs(153,13,153,23): typecheck error FS0033: The type 'Test.BadNumberOfGenericParameters.C<_>' expects 1 type argument(s) but is given 2
+
+neg20.fs(154,13,154,25): typecheck error FS0502: The member or object constructor 'SM1' takes 0 type argument(s) but is here given 1. The required signature is 'static member C.SM1 : unit -> int'.
+
+neg20.fs(155,13,155,26): typecheck error FS0502: The member or object constructor 'SM2' takes 0 type argument(s) but is here given 1. The required signature is 'static member C.SM2 : y:int -> int'.
+
+neg20.fs(156,13,156,28): typecheck error FS0502: The member or object constructor 'SM3' takes 0 type argument(s) but is here given 1. The required signature is 'static member C.SM3 : y:int * z:int -> int'.
+
+neg20.fs(157,28,157,29): typecheck error FS0495: The member or object constructor 'SM3' has no argument or settable return property 'x'. The required signature is static member C.SM3 : y:int * z:int -> int.
+
+neg20.fs(158,13,158,36): typecheck error FS0502: The member or object constructor 'SM4' takes 1 type argument(s) but is here given 2. The required signature is 'static member C.SM4 : y:'a * z:'b -> int'.
+
+neg20.fs(159,13,159,32): typecheck error FS0502: The member or object constructor 'SM5' takes 2 type argument(s) but is here given 1. The required signature is 'static member C.SM5 : y:'a * z:'b -> int'.
+
+neg20.fs(162,13,162,24): typecheck error FS0502: The member or object constructor 'M1' takes 0 type argument(s) but is here given 1. The required signature is 'member C.M1 : unit -> int'.
+
+neg20.fs(163,13,163,25): typecheck error FS0502: The member or object constructor 'M2' takes 0 type argument(s) but is here given 1. The required signature is 'member C.M2 : y:int -> int'.
+
+neg20.fs(164,13,164,27): typecheck error FS0502: The member or object constructor 'M3' takes 0 type argument(s) but is here given 1. The required signature is 'member C.M3 : y:int * z:int -> int'.
+
+neg20.fs(165,27,165,28): typecheck error FS0495: The member or object constructor 'M3' has no argument or settable return property 'x'. The required signature is member C.M3 : y:int * z:int -> int.
+
+neg20.fs(166,13,166,35): typecheck error FS0502: The member or object constructor 'M4' takes 1 type argument(s) but is here given 2. The required signature is 'member C.M4 : y:'a * z:'b -> int'.
+
+neg20.fs(167,13,167,31): typecheck error FS0502: The member or object constructor 'M5' takes 2 type argument(s) but is here given 1. The required signature is 'member C.M5 : y:'a * z:'b -> int'.
+
+neg20.fs(182,14,182,31): typecheck error FS0041: No overloads match for method 'M'. The available overloads are shown below (or in the Error List window).
+neg20.fs(182,14,182,31): typecheck error FS0041: Possible overload: 'static member C2.M : fmt:string * params args:int [] -> string'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    int    
+The type 'obj' is not compatible with the type 'int'.
+neg20.fs(182,14,182,31): typecheck error FS0041: Possible overload: 'static member C2.M : fmt:string * params args:int [] -> string'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    int []    
+The type 'obj' is not compatible with the type 'int []'.
+
+neg20.fs(183,14,183,41): typecheck error FS0001: This expression was expected to have type
+    unit    
+but here has type
+    string    
+
+neg20.fs(184,28,184,33): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    obj    
+
+neg20.fs(184,34,184,39): typecheck error FS0001: This expression was expected to have type
+    int    
+but here has type
+    obj    
+
+neg20.fs(188,14,188,31): typecheck error FS0041: No overloads match for method 'M'. The available overloads are shown below (or in the Error List window).
+neg20.fs(188,14,188,31): typecheck error FS0041: Possible overload: 'static member C3.M : fmt:string * params args:string [] -> string'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    string    
+The type 'obj' is not compatible with the type 'string'.
+neg20.fs(188,14,188,31): typecheck error FS0041: Possible overload: 'static member C3.M : fmt:string * params args:string [] -> string'. Type constraint mismatch. The type 
+    obj    
+is not compatible with type
+    string []    
+The type 'obj' is not compatible with the type 'string []'.
+
+neg20.fs(189,14,189,41): typecheck error FS0001: This expression was expected to have type
+    unit    
+but here has type
+    string    
+
+neg20.fs(190,28,190,33): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(190,34,190,39): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    obj    
+
+neg20.fs(195,5,195,10): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(198,5,198,11): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(202,7,202,9): typecheck error FS0825: The 'DefaultValue' attribute may only be used on 'val' declarations
+
+neg20.fs(204,5,204,14): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(207,5,207,11): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(210,5,210,12): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(213,5,213,33): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(216,5,216,12): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(219,5,219,15): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(222,5,222,24): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(225,5,225,22): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(228,5,228,23): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(231,5,231,21): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(234,5,234,34): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(237,5,237,34): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(240,5,240,23): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(243,5,243,23): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(249,9,249,27): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(255,5,255,21): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(258,5,258,31): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(261,5,261,17): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(265,5,265,24): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(268,5,268,27): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(271,5,271,13): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg20.fs(278,14,278,95): typecheck error FS0507: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. Note the call to this member also provides 2 named arguments.
+
+neg20.fs(280,14,280,94): typecheck error FS0508: No accessible member or object constructor named 'ProcessStartInfo' takes 0 arguments. The named argument 'Argument' doesn't correspond to any argument or settable return property for any overload.
+
+neg20.fs(285,12,285,13): typecheck error FS0038: 'x' is bound twice in this pattern
+
+neg20.fs(286,14,286,15): typecheck error FS0038: 'x' is bound twice in this pattern
+
+neg20.fs(288,17,288,18): typecheck error FS0038: 'x' is bound twice in this pattern
+
+neg20.fs(294,5,294,36): typecheck error FS0840: Unrecognized attribute target. Valid attribute targets are 'assembly', 'module', 'type', 'method', 'property', 'return', 'param', 'field', 'event', 'constructor'.
+
+neg20.fs(301,8,301,16): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(304,8,304,16): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(307,8,307,20): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(310,8,310,17): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(313,8,313,15): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(316,8,316,19): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(319,8,319,17): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(322,8,322,18): typecheck error FS3132: This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute.
+
+neg20.fs(335,11,335,24): typecheck error FS0802: Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. 'new Type(args)'.
+
+neg20.fs(336,11,336,22): typecheck error FS0802: Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. 'new Type(args)'.
+
+neg20.fs(340,11,340,34): typecheck error FS0803: Invalid use of a type name and/or object constructor. If necessary use 'new' and apply the constructor to its arguments, e.g. 'new Type(args)'. The required signature is:
+	new : x:int -> ClassWithOneConstructor.
diff --git a/tests/fsharp/typecheck/sigs/neg20.fs b/tests/fsharp/typecheck/sigs/neg20.fs
new file mode 100644
index 0000000..750905c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg20.fs
@@ -0,0 +1,342 @@
+module Test
+
+type A() = 
+    member x.P = 1
+
+type B() = 
+    inherit A()
+    member x.P = 1
+
+type B1() = 
+    inherit A()
+    member x.P = 1
+
+type B2() = 
+    inherit A()
+    member x.P = 1
+    
+    
+type C() = 
+    inherit B()
+    member x.P = 1
+
+module BiGenericStaticMemberTests =
+    type StaticClass1() = 
+        static member M<'b>(c:'b, d:'b) = 1
+
+    let obj = new obj()
+    let str = ""
+
+    StaticClass1.M<string>(obj,str)
+    StaticClass1.M<string>(str,obj)
+    StaticClass1.M<string>(obj,obj)
+
+    StaticClass1.M(obj,str)   // obj :> 'b  --> obj = 'b 
+    StaticClass1.M(str,obj)   // string :> 'b  --> string = 'b 
+
+module BiGenericFunctionTests =
+    let M<'b>(c:'b, d:'b) = 1
+
+    let obj = new obj()
+    let str = ""
+
+    M<string>(obj,str)
+    M<string>(str,obj)
+    M<string>(obj,obj)
+
+    M(obj,str)   // obj :> 'b  --> obj = 'b 
+    M(str,obj)   // string :> 'b  --> string = 'b 
+
+
+module NoSubsumptionOnApplication = 
+    (fun (x:A) -> 1)  (new B())  // no: subsumption comes from de-condensation, not application!
+    (fun (x:System.ValueType) -> 1)  1  // coercion on application!
+
+
+module NoSubsumptionForLists = 
+    type StaticClass2() = 
+        static member DisplayControls(controls: A list) = ()
+        
+    let v21 = [ new B(); new A() ]
+    let v22 = [ new B1(); new B2() ]
+    let v2b = [ new C(); new B() ]
+    let v2c : A list = [ new B(); new C() ]
+    StaticClass2.DisplayControls [ new B1(); new B2() ]
+
+    let v2 = [ new A(); new B() ]
+    let v2b' = [ new B(); new C() ]
+    let v2c' : A list = [ (new B() :> A); new C() ]
+
+    let controls = [ new B(); new C() ]
+    StaticClass2.DisplayControls controls // bang
+
+    // Q: how about on sequence expressions?
+    let controls2 = [ yield (new B())
+                      yield (new C()) ]
+    StaticClass2.DisplayControls controls2 // bang
+
+    // Q: how about on sequence expressions?
+    let controls3 = [ yield! [new B()]
+                      yield! [new C()] ]
+    StaticClass2.DisplayControls controls3 // bang
+
+    let controls4 = if true then new B() else new C()
+    StaticClass2.DisplayControls [controls4] // bang
+
+    // Q: how about on matches? Not covered. Decision: disallow
+    let controls5 = match 1 with 1 -> new B() | _ -> new C()
+    StaticClass2.DisplayControls [controls5] // bang
+
+
+    // Q. subsumption on 'let v = expr'? Not covered. Disallow
+    let x76 : A = new B()
+
+module NoSubsumptionForLists2 = 
+
+    let d1 = new B() ::  new A() :: [] 
+    let d2 = new A() ::  new B() :: [] 
+
+    let v2a = [ new B(); new A() ] // would not work! 
+        // cf. let v2b = [ (new B() :> A); new A() ] 
+
+    type Data = Data of A * A
+    let data (x,y) = Data (x,y)
+    let pAA = (new A(),new A()) 
+    let pBB = (new B(),new B())
+    let pAB = (new A(),new B())
+    let pBA = (new B(),new A())
+    pBB |> Data   // not permitted (questionable)
+    pAB |> Data   // not permitted (questionable)
+    pBA |> Data   // not permitted (questionable)
+    pBB |> data   // permitted
+    pAB |> data   // permitted
+    pBA |> data   // permitted
+
+module BiGenericMethodsInGenericClassTests = 
+    type C<'a>() =
+        static member M(x:'a) = 1
+        static member M2<'b>(x:'b) = 1
+        static member M3<'b>(x:'b,y:'b) = 1
+        
+        static member OM3<'b>(x:'b,y:'b) = 1
+        
+        static member OM3<'b>(x:'b,y:int) = 1
+
+    let obj = new obj()
+    let str = ""
+
+    C<obj>.M3("a",obj)  // this is not permitted since 'b is inferred to be "string". Fair enough
+    C<obj>.M3(obj,"a") 
+
+    C<obj>.OM3("a",obj)  // this is not permitted since 'b is inferred to be "string". Fair enough
+
+
+
+
+module BadNumberOfGenericParameters = 
+
+    type C<'a>() = 
+        member x.P = 1
+        member x.M1() = 2
+        member x.M2(y:int) = 2
+        member x.M3(y:int,z:int) = 2
+        member x.M4<'b>(y:'a,z:'b) = 2
+        member x.M5<'b,'c>(y:'a,z:'b) = 2
+        
+        static member SP = 1
+        static member SM1() = 2
+        static member SM2(y:int) = 2
+        static member SM3(y:int,z:int) = 2
+        static member SM4<'b>(y:'a,z:'b) = 2
+        static member SM5<'b,'c>(y:'a,z:'b) = 2
+    let _ = C<int,int>.SP
+    let _ = C<int,int>.M1
+    let _ = C.SM1<int>() // expect error here
+    let _ = C.SM2<int>(3) // expect error here
+    let _ = C.SM3<int>(3,4) // expect error here
+    let _ = C.SM3<int>(y=3,x=4) // expect error here
+    let _ = C.SM4<int,int>(y=3,z=4) // expect error here
+    let _ = C.SM5<int>(y=3,z=4) // expect error here
+
+    let c = C<int>()
+    let _ = c.M1<int>() // expect error here
+    let _ = c.M2<int>(3) // expect error here
+    let _ = c.M3<int>(3,4) // expect error here
+    let _ = c.M3<int>(y=3,x=4) // expect error here
+    let _ = c.M4<int,int>(y=3,z=4) // expect error here
+    let _ = c.M5<int>(y=3,z=4) // expect error here
+
+    module PositiveTests = 
+        let _ = C.SM4<int>(y=3,z=4) // expect NO NO NO NO NO error here
+        let _ = C.SM4(y=3,z=4) // expect NO NO NO NO NO error here
+        let _ = C.SM5<int,int>(y=3,z=4) // expect NO NO NO NO NO error here
+        let _ = c.M4<int>(y=3,z=4) // expect NO NO NO NO NO error here
+        let _ = c.M4(y=3,z=4) // expect NO NO NO NO NO error here
+        let _ = c.M5<int,int>(y=3,z=4) // expect NO NO NO NO NO error here
+        
+    
+module ParamArgs =  begin
+    type C2() = class
+        static member M( fmt:string, [<System.ParamArray>] args : int[]) = System.String.Format(fmt,args)
+    end
+    let () = C2.M("{0}",box 1)            // expect error
+    let () = C2.M("{0},{1}",box 1,box 2)  // expect error
+    let _ = C2.M("{0},{1}",box 1,box 2)  // expect error
+    type C3() = class
+        static member M( fmt:string, [<System.ParamArray>] args : string[]) = System.String.Format(fmt,args)
+    end
+    let () = C3.M("{0}",box 1)            // expect error
+    let () = C3.M("{0},{1}",box 1,box 2)  // expect error
+    let _ = C3.M("{0},{1}",box 1,box 2)  // expect error
+end
+
+module BadAttribute =  begin
+
+  [<Class>]
+  let T1 = 1
+
+  [<Struct>]
+  let T2 = 1
+
+  [<DefaultValue>]
+  let T3 = 1
+
+  [<Interface>]
+  let T4 = 1
+
+  [<Sealed>]
+  let T5 = 1
+
+  [<Measure>]
+  let T6 = 1
+
+  [<MeasureAnnotatedAbbreviation>]
+  let T7 = 1
+
+  [<Literal>]
+  type C1() = class end
+
+  [<EntryPoint>]
+  type C2() = class end
+
+  [<DefaultAugmentation(false)>]
+  let T8 = 1
+
+  [<ReferenceEquality>]
+  let T9 = 1
+
+  [<StructuralEquality>]
+  let T10 = 1
+
+  [<OptionalArgument>]
+  let T11 = 1
+
+  [<RequiresExplicitTypeArguments>]
+  type C3() = class end
+
+  [<RequiresExplicitTypeArguments>]
+  module M = begin end
+
+  [<GeneralizableValue>]
+  module M2 = begin end
+
+  [<GeneralizableValue>]
+  type C4() = class end
+
+  
+  type C5 = 
+    class 
+      [<GeneralizableValue>] val x : int 
+    end
+
+  
+  type C6() = class end
+
+  [<AutoSerializable(false)>]
+  let T12 = 1
+
+  [<FSharpInterfaceDataVersion(3,4,5)>]
+  let T13 = 1
+
+  [<Unverifiable>]
+  type C7() = class end
+
+
+  [<NoDynamicInvocation>]
+  type C8() = class end
+
+  [<RequireQualifiedAccess>]
+  let T14 = 1
+
+  [<AutoOpen()>]  
+  let T15 = 1
+
+end
+
+module BadArgName =  begin
+
+  let psi1 = new System.Diagnostics.ProcessStartInfo(FileName = "test", arguments = "testarg")
+
+  let psi2 = new System.Diagnostics.ProcessStartInfo(FileName = "test", Argument = "testarg")
+end
+
+module DuplicateArgNames =  begin
+
+  let f1 x x = ()
+  let f2 x _ x = ()
+  type C() = 
+     member x.M(x:int)  = x + x
+end
+
+
+module BogusAttributeTarget =  begin
+
+  [<someTotallyBogusAttributeTarget : System.ObsoleteAttribute("asdf")>]
+  let x = 5
+end
+
+module BogusUseOfCLIMutable =  begin
+
+  [<CLIMutable>]
+  type BadClass() = member x.P = 1
+
+  [<CLIMutable>]
+  type BadUnion = A | B
+
+  [<CLIMutable>]
+  type BadInterface = interface end
+
+  [<CLIMutable>]
+  type BadClass2 = class end
+
+  [<CLIMutable>]
+  type BadEnum = | A = 1 | B = 2
+
+  [<CLIMutable>]
+  type BadDelegate = delegate of int * int -> int
+
+  [<CLIMutable>]
+  type BadStruct = struct val x : int end
+
+  [<CLIMutable>]
+  type BadStruct2(x:int)  = struct member v.X = x end
+
+  [<CLIMutable>]
+  type Good1 = { x : int; y : int }
+  let good1 = { x = 1; y = 2 }
+
+  [<CLIMutable>]
+  type Good2 = { x : int }
+  let good2 = { x = 1 }
+
+end
+
+
+let ss1 = System.String
+let ss2 = System.Guid
+
+type ClassWithOneConstructor(x:int) = member x.P = 1
+
+let ss3 = ClassWithOneConstructor
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg21.bsl b/tests/fsharp/typecheck/sigs/neg21.bsl
new file mode 100644
index 0000000..d30e35f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg21.bsl
@@ -0,0 +1,44 @@
+
+neg21.fs(12,20,12,23): typecheck error FS0001: The type 'float' does not match the type 'float<kg>'
+
+neg21.fs(12,18,12,19): typecheck error FS0043: The type 'float' does not match the type 'float<kg>'
+
+neg21.fs(13,19,13,28): typecheck error FS0001: The unit of measure 'sqrm' does not match the unit of measure 's'
+
+neg21.fs(13,17,13,18): typecheck error FS0043: The unit of measure 'sqrm' does not match the unit of measure 's'
+
+neg21.fs(14,19,14,23): typecheck error FS0001: The type 'float32' does not match the type 'float<'u>'
+
+neg21.fs(14,17,14,18): typecheck error FS0043: The type 'float32' does not match the type 'float<'u>'
+
+neg21.fs(15,16,15,22): typecheck error FS0001: The unit of measure 'm' does not match the unit of measure ''u ^ 2'
+
+neg21.fs(17,26,17,34): typecheck error FS0001: Type mismatch. Expecting a
+    float<s ^ 3>    
+but given a
+    float<s ^ 4>    
+The unit of measure 's ^ 3' does not match the unit of measure 's ^ 4'
+
+neg21.fs(19,59,19,67): typecheck error FS0001: Type mismatch. Expecting a
+    area    
+but given a
+    float<m ^ 3>    
+The unit of measure 'sqrm' does not match the unit of measure 'm ^ 3'
+
+neg21.fs(20,36,20,44): typecheck error FS0001: Type mismatch. Expecting a
+    area    
+but given a
+    float<m ^ 3>    
+The unit of measure 'sqrm' does not match the unit of measure 'm ^ 3'
+
+neg21.fs(21,53,21,59): typecheck error FS0001: Type mismatch. Expecting a
+    float<s ^ 2>    
+but given a
+    float<m>    
+The unit of measure 's ^ 2' does not match the unit of measure 'm'
+
+neg21.fs(22,17,22,21): typecheck error FS0001: The unit of measure 's ^ 4' does not match the unit of measure 'sqrm'
+
+neg21.fs(22,15,22,16): typecheck error FS0043: The unit of measure 's ^ 4' does not match the unit of measure 'sqrm'
+
+neg21.fs(23,11,23,18): typecheck error FS0001: The type 'float<kg>' does not match the type 'float'
diff --git a/tests/fsharp/typecheck/sigs/neg21.fs b/tests/fsharp/typecheck/sigs/neg21.fs
new file mode 100644
index 0000000..2399aad
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg21.fs
@@ -0,0 +1,27 @@
+module Test
+#nowarn "57"
+
+[<Measure>] type kg
+[<Measure>] type s
+[<Measure>] type m
+
+[<Measure>] type sqrm = m^2
+
+type area = float<sqrm>
+
+let x1 = 2.0<kg> + 4.0
+let x2 = 2.0<s> - 4.0<sqrm>
+let x3 = 2.0<m> / 4.0f
+let x8 = sqrt (4.0<m>)
+let x10 = sign (3.0<m/s>)
+let x11 = atan2 4.4<s^3> 5.4<s^4>
+let x12 = Seq.sum [2.0<sqrm>; 3.0<m^2>]
+let x12a = Seq.sumBy  (fun x -> x*x) [(2.0<sqrm> : area); 3.0<m^3>]
+let x13 = (Seq.average [2.0<sqrm>; 3.0<m^3>]) : area
+let x13a = Seq.averageBy  (fun x -> x*x) [2.0<s^2>; 3.0<m>]
+let x14 = x13 + x13a
+let x15 = 3.0<kg> ** 2.5
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg22.bsl b/tests/fsharp/typecheck/sigs/neg22.bsl
new file mode 100644
index 0000000..f6270f3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg22.bsl
@@ -0,0 +1,28 @@
+
+neg22.fs(13,17,13,23): typecheck error FS0001: Type mismatch. Expecting a
+    float<kg>    
+but given a
+    float<m>    
+The unit of measure 'kg' does not match the unit of measure 'm'
+
+neg22.fs(15,17,15,24): typecheck error FS0001: Type mismatch. Expecting a
+    float<m>    
+but given a
+    float<kg>    
+The unit of measure 'm' does not match the unit of measure 'kg'
+
+neg22.fs(16,20,16,28): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'v has been constrained to be measure 'kg'.
+
+neg22.fs(16,22,16,28): typecheck error FS0064: This construct causes code to be less generic than indicated by the type annotations. The unit-of-measure variable 'u has been constrained to be measure 'm'.
+
+neg22.fs(17,20,17,29): typecheck error FS0001: Type mismatch. Expecting a
+    float<m>    
+but given a
+    float<kg>    
+The unit of measure 'm' does not match the unit of measure 'kg'
+
+neg22.fs(28,12,28,18): typecheck error FS0957: The declared type parameters for this type extension do not match the declared type parameters on the original type 'LibGen<_>'
+
+neg22.fs(40,12,40,18): typecheck error FS0957: The declared type parameters for this type extension do not match the declared type parameters on the original type 'LibGen<_>'
+
+neg22.fs(33,17,33,19): typecheck error FS0341: The signature and implementation are not compatible because the type parameter 'T' has a constraint of the form 'T :> System.ValueType but the implementation does not. Either remove this constraint from the signature or add it to the implementation.
diff --git a/tests/fsharp/typecheck/sigs/neg22.fs b/tests/fsharp/typecheck/sigs/neg22.fs
new file mode 100644
index 0000000..f42124e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg22.fs
@@ -0,0 +1,41 @@
+module Test
+#nowarn "57"
+
+[<Measure>] type kg
+[<Measure>] type s
+[<Measure>] type m
+
+let f (x:float<'u>) : float<'v> = 1.0<_> * x
+let incr1 x = 1.0<_> + (x:float<_>)
+let incr2 x = (x:float<_>) + 1.0<_>
+
+let x1 = incr1 2.0<kg>
+let x1a = incr1 2.0<m>
+let x2 = incr2 3.0<m>
+let x2a = incr2 3.0<kg>
+let x3:float<kg> = f 2.0<m>
+let x3a:float<m> = f 3.0<kg>
+
+module ExtensionMemberOfGenericTypeWrongNumberOfTypeArgsTest = 
+
+    type LibGen<'T when 'T :> System.ValueType>() =
+        class
+          [<DefaultValue(false)>]
+          val mutable instanceField : 'T 
+       end
+
+    module N =
+      type LibGen with
+            member x.P  = 1
+
+module ExtensionMemberOfGenericTypeWrongConstraintsTest = 
+
+    type LibGen<'T when 'T :> System.ValueType>() =
+        class
+          [<DefaultValue(false)>]
+          val mutable instanceField : 'T 
+       end
+
+    module N =
+      type LibGen<'T> with
+            member x.P  = 1
diff --git a/tests/fsharp/typecheck/sigs/neg23.bsl b/tests/fsharp/typecheck/sigs/neg23.bsl
new file mode 100644
index 0000000..5e75b46
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg23.bsl
@@ -0,0 +1,40 @@
+
+neg23.fs(9,21,9,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(7,21,7,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(19,21,19,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(17,21,17,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(28,21,28,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(26,21,26,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(55,21,55,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(53,21,53,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(64,21,64,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(62,21,62,24): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg23.fs(76,9,76,11): typecheck error FS0410: The type 'IA' is less accessible than the value, member or type 'IB' it is used in
+
+neg23.fs(83,18,83,20): typecheck error FS0439: The method 'X0' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(82,18,82,20): typecheck error FS0439: The method 'X0' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(85,18,85,21): typecheck error FS0439: The method 'X01' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(88,18,88,21): typecheck error FS0440: Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional' or 'byref' arguments
+
+neg23.fs(90,18,90,21): typecheck error FS0440: Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional' or 'byref' arguments
+
+neg23.fs(93,18,93,21): typecheck error FS0439: The method 'X04' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(92,18,92,21): typecheck error FS0439: The method 'X04' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(110,21,110,22): typecheck error FS0439: The method 'F' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
+
+neg23.fs(113,21,113,22): typecheck error FS0439: The method 'F' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments.
diff --git a/tests/fsharp/typecheck/sigs/neg23.fs b/tests/fsharp/typecheck/sigs/neg23.fs
new file mode 100644
index 0000000..24cf167
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg23.fs
@@ -0,0 +1,157 @@
+module Test
+
+module DuplicateOverloadUpToErasure1 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:int->int) = printfn "method 1"
+        
+        member this.Foo (x:FSharpFunc<int,int>) = printfn "method 2"
+end
+
+// This one also checks that duplicate generic methods are detected
+module DuplicateOverloadUpToErasure2 =  begin
+
+    type SomeClass() =
+       
+        member this.Foo (x:'a->int) = printfn "method 1"
+        
+        member this.Foo (x:FSharpFunc<'b,int>) = printfn "method 2"
+end
+
+module DuplicateOverloadUpToErasure3 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:int*int) = printfn "method 1"
+        
+        member this.Foo (x:System.Tuple<int,int>) = printfn "method 2"
+end
+
+module DuplicateOverloadUpToErasure4 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:int*int*int*int*int*int*int*int*int) = printfn "method 1"
+        
+        member this.Foo (x:System.Tuple<int,int,int,int,int,int,System.Tuple<System.Tuple<int,int,int>>>) = printfn "method 2"
+end
+                                
+module DuplicateOverloadUpToErasure5 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:int*int*int*int*int*int*int) = printfn "method 1"
+        
+        member this.Foo (x:System.Tuple<int,int,int,int,int,int,System.Tuple<int>>) = printfn "method 2"
+end
+                                
+module DuplicateOverloadUpToErasure6 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:nativeptr<int>) = printfn "method 1"
+        
+        member this.Foo (x:nativeint) =  printfn "method 2"
+end
+
+module DuplicateOverloadUpToErasure7 =  begin
+
+    type SomeClass() =
+        
+        member this.Foo (x:(int*int)*int*(int*nativeptr<int>)*int*int) = printfn "method 1"
+        
+        member this.Foo (x:System.Tuple<System.Tuple<int,int>,int,System.Tuple<int,nativeint>,int,int>) =  printfn "method 2"
+end
+
+module TestPrivateInheritance1 = 
+    type private IA = interface abstract M : int -> int end
+    type C() = 
+        interface IA with 
+           member obj.M(x) = x + 1
+
+
+module TestPrivateInheritance2 = 
+   type private IA = interface abstract M : int -> int end
+   type IB = 
+      inherit IA 
+
+module TestCurriedMemberRestricitons = 
+    [<AbstractClass>]
+    type C() = 
+        member x.X0 () () = 1
+        member x.X0 (a1,a2) (a3:int)  = 1
+
+        member x.X01 a b = 1
+        member x.X01 (a1,a2,a3)  = 1
+        
+        member x.X02 a ([<System.ParamArrayAttribute>] b) = 1
+
+        member x.X03 a ([<OptionalArgumentAttribute>] b) = 1
+
+        abstract X04 : int -> int -> int
+        abstract X04 : int * int -> int -> int
+
+        
+        // positive test - no error expected here
+        abstract X1 : int -> int -> int
+        default x.X1 a b = a + b
+
+        // positive test - no error expected here
+        abstract X2 : int * int -> int
+        default x.X2 (a1,a3) = 1//(fun b -> 1)
+        
+        // positive test - no error expected here
+        abstract X4 : int -> int * int * int -> int
+        default x.X4 a (b1,b2,b3) = 1
+
+    type T1() = 
+        member this.F(a, b) = ()
+        member this.F a b = ()
+
+    type T2() = 
+        member this.F a b = ()
+        member this.F(a, b) = ()
+
+module PositiveTests = 
+    module CurriedMember = 
+        type C() =
+            member x.P = 1
+            member x.M1 a b = a + b    
+            member x.M2 (a,b) c = a + b + c
+            
+        let c = C()
+
+        // positive test - no error expected here
+        let x1 : int = c.M1 3 4
+        let x2 : int -> int = c.M1 3
+        let x3 : int -> int -> int = c.M1
+
+        // positive test - no error expected here
+        let y1 : int = c.M2 (3,4) 4
+        let y2 : int -> int = c.M2 (3,4)
+        let y3 : int * int -> int -> int = c.M2
+
+    module CurriedExtensionMember = 
+        type C() =
+            member x.P = 1
+            
+        module M = 
+            type C with 
+                member x.M1 a b = a + b    
+                member x.M2 (a,b) c = a + b + c
+
+        open M
+
+        let c = C()
+
+        // positive test - no error expected here
+        let x1 : int = c.M1 3 4
+        let x2 : int -> int = c.M1 3
+        let x3 : int -> int -> int = c.M1 
+        
+        // positive test - no error expected here
+        let y1 : int = c.M2 (3,4) 4
+        let y2 : int -> int = c.M2 (3,4)
+        let y3 : int * int -> int -> int = c.M2
+
diff --git a/tests/fsharp/typecheck/sigs/neg24.bsl b/tests/fsharp/typecheck/sigs/neg24.bsl
new file mode 100644
index 0000000..b782269
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg24.bsl
@@ -0,0 +1,30 @@
+
+neg24.fs(11,14,11,39): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(12,14,12,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(13,14,13,33): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(14,14,14,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(15,14,15,43): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(16,14,16,35): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression
+
+neg24.fs(17,18,17,45): typecheck error FS0739: Invalid object, sequence or record expression
+
+neg24.fs(17,20,17,43): typecheck error FS0793: This construct is ambiguous as part of a sequence expression. Nested expressions may be written using 'let _ = (...)' and nested sequences using 'yield! seq {... }'.
+
+neg24.fs(53,24,53,30): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(55,31,55,37): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(57,38,57,42): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(60,24,60,34): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(62,31,62,41): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(64,44,64,48): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form.
+
+neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int.
diff --git a/tests/fsharp/typecheck/sigs/neg24.fs b/tests/fsharp/typecheck/sigs/neg24.fs
new file mode 100644
index 0000000..22a8f4d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg24.fs
@@ -0,0 +1,71 @@
+module Test
+open Microsoft.FSharp.Quotations
+
+
+let test2 (v : Expr<'a> -> Expr<'b>) = <@ fun (i: 'a) -> %v <@i@> @>
+
+let test (v : 'a -> Expr<'b>) = <@ fun (i: 'a) -> %(v i) @>
+
+// expect warning
+module Negative = 
+    let v1 = [ if true then 1 else 2 ]  
+    let v2 = [ if true then () else () ] 
+    let v6 = [ if true then () ] 
+    let a1 = [| if true then 1 else 2 |]  
+    let a2 = [| if true then () else () |] 
+    let a6 = [| if true then () |] 
+    let s3 = seq { (if true then 1 else 2) }
+
+// expect no warning
+module Positive = 
+    let v3 = [ (if true then 1 else 2) ] 
+    let v4 = [ if true then yield 1 else yield 2 ] 
+    let v5 = [ if true then yield 1 ] 
+    let a3 = [| (if true then 1 else 2) |] 
+    let a4 = [| if true then yield 1 else yield 2 |] 
+    let a5 = [| if true then yield 1 |] 
+    let s2 = seq { if true then () else () } 
+    let s6 = seq { if true then () } 
+    let s4 = seq { if true then yield 1 else yield 2 }
+    let s5 = seq { if true then yield 1  }
+
+
+module BadCurriedExtensionMember = 
+        type C() =
+            member x.P = 1
+            
+        module M1 = 
+            type C with 
+                member x.M1 a b = a + b    
+                member x.M2 (a,b) c = a + b + c
+
+        module M2 = 
+            type C with 
+                member x.M1 a b = a + b    
+                member x.M2 (a,b) c = a + b + c
+
+        open M1
+        open M2
+
+        let c = C()
+
+        // negative test - error expected here
+        let x1 : int = c.M1 3 4
+        // negative test - error expected here
+        let x2 : int -> int = c.M1 3
+        // negative test - error expected here
+        let x3 : int -> int -> int = c.M1 
+        
+        // negative test - error expected here
+        let y1 : int = c.M2 (3,4) 4
+        // negative test - error expected here
+        let y2 : int -> int = c.M2 (3,4)
+        // negative test - error expected here
+        let y3 : int * int -> int -> int = c.M2
+
+type C() = 
+    member x.M(abc:int,def:string) = abc + def.Length
+
+// Check that the error for a named argument/setter that does not exist is located in a good place
+let _ = C().M(qez=3)
+
diff --git a/tests/fsharp/typecheck/sigs/neg25.bsl b/tests/fsharp/typecheck/sigs/neg25.bsl
new file mode 100644
index 0000000..40494a3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg25.bsl
@@ -0,0 +1,22 @@
+
+neg25.fs(15,23,15,31): typecheck error FS0366: No implementation was given for 'abstract member NegativeTests.Test1.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(32,23,32,31): typecheck error FS0366: No implementation was given for 'abstract member NegativeTests.Test2.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(64,19,64,45): typecheck error FS0366: No implementation was given for 'abstract member NegativeTestsActualRepro1.INodeWrapper.Node : NegativeTestsActualRepro1.Node'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(87,19,87,25): typecheck error FS0366: No implementation was given for 'abstract member NegativeTestsActualRepro3.IThing.Name : string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(104,19,104,27): typecheck error FS0366: No implementation was given for 'abstract member AnotherNegativeTest.ITestSub.Meth1 : int -> int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(126,27,126,35): typecheck error FS0366: No implementation was given for 'abstract member MissingInterfaceMemberTests.Test0.ITestSub.Meth2 : int -> int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(126,27,126,35): typecheck error FS0366: No implementation was given for 'abstract member MissingInterfaceMemberTests.Test0.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(147,27,147,35): typecheck error FS0366: No implementation was given for 'abstract member MissingInterfaceMemberTests.Test1.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(171,27,171,35): typecheck error FS0366: No implementation was given for 'abstract member MissingInterfaceMemberTests.Test3.ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(192,23,192,45): typecheck error FS0366: No implementation was given for 'abstract member NegativeTestsActualRepro2.IEvent.Add2 : ('a -> unit) -> unit'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg25.fs(211,23,211,29): typecheck error FS0366: No implementation was given for 'abstract member NegativeTestsActualRepro4.IThing.Name : string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
diff --git a/tests/fsharp/typecheck/sigs/neg25.fs b/tests/fsharp/typecheck/sigs/neg25.fs
new file mode 100644
index 0000000..87b1d5c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg25.fs
@@ -0,0 +1,215 @@
+module Test
+
+module NegativeTests = 
+
+    module Test1 = 
+        type ITest =
+            abstract member Meth1: string -> string
+
+        type ITestSub =
+            inherit ITest
+            abstract member Meth2: int -> int
+
+        [<AbstractClass>]
+        type Partial() =  // THis should give an error  - Meth1 is not implemented
+            interface ITestSub with 
+                override this.Meth2 x = x + 1
+
+        type ErroneousComplete () =   
+            inherit Partial()
+
+
+    module Test2 = 
+        type ITest =
+            abstract member Meth1: string -> string
+
+        type ITestSub =
+            inherit ITest
+            abstract member Meth2: int -> int
+
+        [<AbstractClass>]
+        type Partial() =  // this should give an error - we can't complete the partial implementation implicitly
+            interface ITestSub with
+                override this.Meth2 x = x + 1
+
+        type ErroneousComplete () =
+            inherit Partial()
+            abstract Meth1 : string -> string
+            override x.Meth1(s) = s                   
+
+
+module NegativeTestsActualRepro1 = 
+
+    open System
+    [<NoEquality;NoComparison>]
+    type Node =
+        TestVariableNode of seq<Object>
+      | InterleavingNode of seq<Node>
+      | SynthesizingNode of seq<Node> * Delegate
+
+    type INodeWrapper =
+        abstract member Node: Node
+
+
+    open System.Collections
+
+
+    type ITestCaseEnumeratorFactory =
+        inherit INodeWrapper
+        abstract member CreateEnumerator: uint32 -> IEnumerator;
+        abstract member MaximumStrength: System.UInt32;
+
+    [<AbstractClass>]
+    type TestCaseEnumeratorFactoryCommonImplementation () as this = // Expect an error here - incomplete interface implementation
+        interface ITestCaseEnumeratorFactory with
+            override this.CreateEnumerator desiredStrength =
+                (Seq.empty :> IEnumerable).GetEnumerator ()    // Stub
+            override this.MaximumStrength =
+                9u    // Stub
+
+    type TestVariableLevelEnumeratorFactory (levels: seq<Object>) =    /// THis should give an error
+            inherit TestCaseEnumeratorFactoryCommonImplementation ()
+            let node =
+               TestVariableNode levels
+
+    module Throwaway =
+        let foo =
+            TestVariableLevelEnumeratorFactory Seq.empty // Surely I can't do this at compile time?
+
+module NegativeTestsActualRepro3 = 
+
+    open System
+    type IThing =
+        abstract Name: string
+        abstract Action: List< string * (unit -> unit) >
+    [<AbstractClass>]
+    type Dog() =                     // Expect an error here - incomplete interface implementation
+        interface IThing with
+            member x.Action = [("bites", fun () -> printfn "ouch")]
+
+    type MyDog() =   // expect an error here - Name not implemented
+        inherit Dog() 
+
+module AnotherNegativeTest = 
+    type ITest =
+        abstract member Meth1: int -> int
+
+    type ITestSub =
+        inherit ITest
+        abstract member Meth1: int -> int
+
+    [<AbstractClass>]
+    type Partial() =
+        abstract Meth1 : int -> int
+        interface ITestSub
+        interface ITest with
+            override this.Meth1 x = this.Meth1 x
+
+    type OkComplete () =
+        inherit Partial()
+        override this.Meth1 x = x
+
+    module Throwaway =
+        let foo = OkComplete()
+
+module MissingInterfaceMemberTests = 
+        module Test0 = 
+            type ITest =
+                abstract member Meth1: string -> string
+
+            type ITestSub =
+                inherit ITest
+                abstract member Meth2: int -> int
+
+            [<AbstractClass>]
+            type Partial() =
+                interface ITestSub 
+
+            type OkComplete () =
+                inherit Partial()
+                interface ITest with
+                    override this.Meth1 x = x + "1"
+                interface ITestSub with
+                    override this.Meth2 x = x + 1
+
+            module Throwaway =
+                let foo = OkComplete()
+        module Test1 = 
+            type ITest =
+                abstract member Meth1: string -> string
+
+            type ITestSub =
+                inherit ITest
+                abstract member Meth2: int -> int
+
+            [<AbstractClass>]
+            type Partial() =
+                interface ITestSub with
+                    override this.Meth2 x = x + 1
+
+            type OkComplete () =
+                inherit Partial()
+                interface ITest with
+                    override this.Meth1 x = x + "1"
+                interface ITestSub with
+                    override this.Meth2 x = x + 1
+
+            module Throwaway =
+                let foo = OkComplete()
+
+
+        module Test3 = 
+            type ITest =
+                abstract member Meth1: string -> string
+
+            type ITestSub =
+                inherit ITest
+                abstract member Meth2: int -> int
+
+            [<AbstractClass>]
+            type Partial() =
+                interface ITestSub with
+                    override this.Meth2 x = x + 1
+            type OkComplete () =
+                inherit Partial()
+                interface ITest with
+                    override this.Meth1 x = x + "1"
+
+            module Throwaway =
+                let foo = OkComplete()
+
+
+
+    module NegativeTestsActualRepro2 = 
+        type IEvent<'del,'a> = 
+            abstract Add : ('a -> unit) -> unit
+            abstract Add2 : ('a -> unit) -> unit
+            
+        [<AbstractClass>]
+        type wire<'a>() =
+            abstract Send   : 'a -> unit
+            abstract Listen : ('a -> unit) -> unit
+            interface IEvent<Handler<'a>,'a> with   // Expect an error here - Add2 no implemented
+                member x.Add(handler) = x.Listen(handler)
+
+        let createWire() =
+            let listeners = ref [] in
+            {new wire<'a>() with   
+              member obj.Send(x)   = List.iter (fun f -> f x) !listeners   
+              member obj.Listen(f) = listeners := f :: !listeners
+            }
+
+
+    module NegativeTestsActualRepro4 = 
+
+        open System
+        type IThing =
+            abstract Name: string
+            abstract Action: List< string * (unit -> unit) >
+        [<AbstractClass>]
+        type Dog() =                      // Expect an error here - Name not implemented
+            interface IThing with 
+                member x.Action = [("bites", fun () -> printfn "ouch")]
+
+        let MyDog() =    { new Dog() with member x.ToString() = "2" }   
+
diff --git a/tests/fsharp/typecheck/sigs/neg26.bsl b/tests/fsharp/typecheck/sigs/neg26.bsl
new file mode 100644
index 0000000..8244d0e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg26.bsl
@@ -0,0 +1,10 @@
+
+neg26.fs(15,13,15,56): typecheck error FS0366: No implementation was given for 'abstract member ITest.Meth1 : string -> string'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg26.fs(27,13,27,66): typecheck error FS0366: No implementation was given for 'abstract member ITestSub.Meth2 : int -> int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.
+
+neg26.fs(40,27,40,32): typecheck error FS0361: The override 'Meth1 : int -> int' implements more than one abstract slot, e.g. 'abstract member ITestSub.Meth1 : int -> int' and 'abstract member ITest.Meth1 : int -> int'
+
+neg26.fs(53,27,53,32): typecheck error FS0017: The member 'Meth1 : 'a -> 'a' does not have the correct type to override any given virtual method
+
+neg26.fs(52,15,52,23): typecheck error FS0783: At least one override did not correctly implement its corresponding abstract member
diff --git a/tests/fsharp/typecheck/sigs/neg26.fs b/tests/fsharp/typecheck/sigs/neg26.fs
new file mode 100644
index 0000000..fb6e1a1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg26.fs
@@ -0,0 +1,53 @@
+module Test
+
+module ObjectExpressionNegativeTests = 
+
+    module Test1 = 
+        type ITest =
+            abstract member Meth1: string -> string
+
+        type ITestSub =
+            inherit ITest  
+            abstract member Meth2: int -> int
+
+
+        let ErroneousComplete () =    
+            { new ITestSub with member x.Meth2(y) = 2 } // THis should give an error  - Meth1 is not implemented
+
+
+    module Test2 = 
+        type ITest =
+            abstract member Meth1: string -> string
+
+        type ITestSub =
+            inherit ITest
+            abstract member Meth2: int -> int
+
+        let ErroneousComplete () =
+            { new ITestSub with override x.Meth1(s:string) = s  }  // Expect an error here 
+            
+            
+module AnotherObjectExpressionTest = 
+    type ITest =
+        abstract member Meth1: int -> int
+
+    type ITestSub =
+        inherit ITest
+        abstract member Meth1: int -> int
+
+    let Partial() =
+        { new ITestSub with                   // Expect an error here 
+            override this.Meth1 (x:int) = x }
+
+            
+module YetAnotherObjectExpressionTest = 
+    type ITest =
+        abstract member Meth1: int -> int
+
+    type ITestSub =
+        inherit ITest
+        abstract member Meth1: int -> int
+
+    let Partial() =
+        { new ITestSub with                   // Expect an error here - ambiguous slot, so no slot inference, incorrect type
+            override this.Meth1 (x:'a) = x }
diff --git a/tests/fsharp/typecheck/sigs/neg27.bsl b/tests/fsharp/typecheck/sigs/neg27.bsl
new file mode 100644
index 0000000..320eb46
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg27.bsl
@@ -0,0 +1,4 @@
+
+neg27.fsi(3,6,3,15): parse error FS0547: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
+
+neg27.fs(3,6,3,14): parse error FS0547: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
diff --git a/tests/fsharp/typecheck/sigs/neg27.fs b/tests/fsharp/typecheck/sigs/neg27.fs
new file mode 100644
index 0000000..843ae1c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg27.fs
@@ -0,0 +1,10 @@
+module Test
+
+type NonComp() = //class end
+
+//[<StructuralEquality(true)>]
+//[<StructuralComparison(true)>]
+type MyAlg =
+
+
+    | Foo of NonComp
diff --git a/tests/fsharp/typecheck/sigs/neg27.fsi b/tests/fsharp/typecheck/sigs/neg27.fsi
new file mode 100644
index 0000000..548964e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg27.fsi
@@ -0,0 +1,10 @@
+
+module Test
+type NonComp = //class end
+
+//[<StructuralEquality(true)>]
+//[<StructuralComparison(true)>]
+type MyAlg =
+
+
+    | Foo of NonComp
diff --git a/tests/fsharp/typecheck/sigs/neg27.vsbsl b/tests/fsharp/typecheck/sigs/neg27.vsbsl
new file mode 100644
index 0000000..b884808
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg27.vsbsl
@@ -0,0 +1,6 @@
+
+neg27.fsi(3,6,3,15): parse error FS0547: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
+
+neg27.fs(3,6,3,14): parse error FS0547: A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'.
+
+neg27.fsi(3,6,3,13): typecheck error FS0938: The representation of this type is hidden by the signature. It must be given an attribute such as [<Sealed>], [<Class>] or [<Interface>] to indicate the characteristics of the type.
diff --git a/tests/fsharp/typecheck/sigs/neg28.bsl b/tests/fsharp/typecheck/sigs/neg28.bsl
new file mode 100644
index 0000000..1b428ae
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg28.bsl
@@ -0,0 +1,130 @@
+
+neg28.fsx(5,10,5,11): typecheck error FS1180: The struct, record or union type 'X' has the 'StructuralEquality' attribute but the component type '(int -> int)' does not satisfy the 'equality' constraint
+
+neg28.fsx(12,13,12,20): typecheck error FS0880: Uninitialized 'val' fields must be mutable and marked with the '[<DefaultValue>]' attribute. Consider using a 'let' binding instead of a 'val' field.
+
+neg28.fsx(19,13,19,14): typecheck error FS1181: Each argument of the primary constructor for a struct must be given a type, for example 'type S(x1:int, x2: int) = ...'. These arguments determine the fields of the struct.
+
+neg28.fsx(33,14,33,18): typecheck error FS0688: The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization
+
+neg28.fsx(58,17,58,33): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(59,17,59,37): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(61,40,61,41): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(62,42,62,43): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(63,46,63,47): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(64,50,64,51): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(65,54,65,55): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(66,58,66,59): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(67,62,67,63): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(68,66,68,67): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(69,39,69,40): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(70,17,70,34): typecheck error FS0001: The type '(int -> int)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(71,17,71,38): typecheck error FS0001: The type '(int -> int)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(79,17,79,39): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(80,17,80,41): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(81,17,81,38): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(82,21,82,37): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(83,21,83,41): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(97,17,97,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(100,35,100,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(108,17,108,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(110,35,110,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(112,41,112,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(119,17,119,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(121,35,121,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(123,41,123,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(130,17,130,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(132,35,132,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(134,41,134,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(142,17,142,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(144,35,144,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(146,41,146,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(154,17,154,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(156,35,156,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(158,41,158,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(165,17,165,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(166,17,166,42): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(169,35,169,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(171,41,171,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(180,17,180,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(181,17,181,42): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(184,35,184,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(186,41,186,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(194,17,194,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(195,17,195,42): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(198,35,198,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(200,41,200,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(204,17,204,36): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(205,17,205,42): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(208,35,208,36): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(210,41,210,42): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(252,17,252,40): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(253,17,253,46): typecheck error FS0001: The type 'System.Type' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
+
+neg28.fsx(256,42,256,43): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(258,48,258,49): typecheck error FS0001: The type '(int -> int)' does not support the 'equality' constraint because it is a function type
+
+neg28.fsx(272,17,272,23): typecheck error FS0001: The type 'X' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison
+
+neg28.fsx(273,17,273,23): typecheck error FS0001: The type 'Y' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison
+
+neg28.fsx(275,23,275,24): typecheck error FS0001: The type 'X' does not support the 'equality' constraint because it is a record, union or struct with one or more structural element types which do not support the 'equality' constraint. Either avoid the use of equality with this type, or add the 'StructuralEquality' attribute to the type to determine which field type does not support equality
+
+neg28.fsx(276,23,276,24): typecheck error FS0001: The type 'Y' does not support the 'equality' constraint because it is a record, union or struct with one or more structural element types which do not support the 'equality' constraint. Either avoid the use of equality with this type, or add the 'StructuralEquality' attribute to the type to determine which field type does not support equality
+
+neg28.fsx(284,17,284,23): typecheck error FS0001: The type 'X' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison
+
+neg28.fsx(285,17,285,23): typecheck error FS0001: The type 'Y' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison
diff --git a/tests/fsharp/typecheck/sigs/neg28.fsx b/tests/fsharp/typecheck/sigs/neg28.fsx
new file mode 100644
index 0000000..4f27392
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg28.fsx
@@ -0,0 +1,289 @@
+
+module AdhocStructuralEqualityAndCOmparisonTests =
+
+    [<StructuralEquality>]
+    type X = X of (int -> int)
+
+
+module PairWithPrimaryConstructorCantContainVal =
+
+    [<Struct>]
+    type Pair(x:int, y:int) =
+        val z : int
+        member p.X = x
+        member p.Y = y
+
+module StructPrimaryConstructorARgsMustByTypeAnnotated =
+
+    [<Struct>]
+    type U3(v) = 
+        member x.P = v
+
+module StructDefaultConstructorCantBeUsed =
+
+    [<Struct>]
+    type U1(v:int) = 
+        member x.P = v
+
+    [<Struct>]
+    type U2(v:list<int>) = 
+        member x.P = 1
+
+    let v1 = U1()  // can be used - expect ok
+    let v2 = U2() // can't be used - expect an error
+
+
+module BasicExample1 =
+    let f1 (x : list<int>) = (x = x) // expect ok
+    let f2 (x : option<int>) = (x = x) // expect ok
+    let f3 (x : Choice<int,int>) = (x = x) // expect ok
+    let f4 (x : Choice<int,int,int>) = (x = x) // expect ok
+    let f5 (x : Choice<int,int,int,int>) = (x = x) // expect ok
+    let f6 (x : Choice<int,int,int,int,int>) = (x = x) // expect ok
+    let f7 (x : Choice<int,int,int,int,int,int>) = (x = x) // expect ok
+    let f8 (x : Choice<int,int,int,int,int,int,int>) = (x = x) // expect ok
+    let f9 (x : ref<int>) = (x = x) // expect ok
+    let fq (x : Set<int>) = (x = x) // expect ok
+    let fw (x : Map<int,int>) = (x = x) // expect ok
+    
+    let fe (x : list<System.Type>) = (x = x) // expect ok
+    let fr (x : option<System.Type>) = (x = x) // expect ok
+    let ft (x : Choice<System.Type,int>) = (x = x) // expect ok
+    let fy (x : Choice<System.Type,int,int>) = (x = x) // expect ok
+    let fu (x : Choice<System.Type,int,int,int>) = (x = x) // expect ok
+    let fi (x : Choice<System.Type,int,int,int,int>) = (x = x) // expect ok
+    let fo (x : Choice<System.Type,int,int,int,int,int>) = (x = x) // expect ok
+    let fp (x : Choice<System.Type,int,int,int,int,int,int>) = (x = x) // expect ok
+    let fa (x : ref<System.Type>) = (x = x) // expect ok
+    let fs (x : Set<System.Type>) = (x = x) // expect error
+    let fd (x : Map<System.Type,int>) = (x = x) // expect error
+
+    let ff (x : list<(int -> int)>) = (x = x) // expect error
+    let fg (x : option<(int -> int)>) = (x = x) // expect error
+    let fh (x : Choice<(int -> int),int>) = (x = x) // expect error
+    let fj (x : Choice<(int -> int),int,int>) = (x = x) // expect error
+    let fk (x : Choice<(int -> int),int,int,int>) = (x = x) // expect error
+    let fl (x : Choice<(int -> int),int,int,int,int>) = (x = x) // expect error
+    let fz (x : Choice<(int -> int),int,int,int,int,int>) = (x = x) // expect error
+    let fx (x : Choice<(int -> int),int,int,int,int,int,int>) = (x = x) // expect error
+    let fc (x : ref<(int -> int)>) = (x = x) // expect error
+    let fv (x : Set<(int -> int)>) = (x = x) // expect error
+    let fb (x : Map<(int -> int),int>) = (x = x) // expect error
+
+
+    let fn (x : Set<list<int>>) = () // expect ok
+    let fm (x : Set<option<int>>) = () // expect ok
+    let fQ (x : Set<ref<int>>) = () // expect ok
+    let fW (x : Set<Set<int>>) = () // expect ok
+    let fE (x : Set<Map<int,int>>) = () // expect ok
+    let fR (x : Set<list<System.Type>>) = () // expect error
+    let fT (x : Set<option<System.Type>>) = () // expect error
+    let fY (x : Set<ref<System.Type>>) = () // expect error
+    let fU (x : Set<Set<System.Type>>) = () // expect error
+    let fI (x : Set<Map<System.Type,int>>) = () // expect error
+    let fO (x : Set<int * int>) = () // expect ok
+    let fP (x : Set<int * int * int>) = () // expect ok
+    let fA (x : Set<int * int * int * int>) = () // expect ok
+    let fS (x : Set<int * int * int * int * int>) = () // expect ok
+    let fD (x : Set<int * int * int * int * int * int>) = () // expect ok
+    let fF (x : Set<int * int * int * int * int * int * int>) = () // expect ok
+    let fG (x : Set<int * int * int * int * int * int * int * int>) = () // expect ok
+    let fH (x : Set<int * int * int * int * int * int * int * int * int >) = () // expect ok
+    let fJ (x : Set<int * int * int * int * int * int * int * int * int * int>) = () // expect ok
+    let fK (x : Set<int * int * int * int * int * int * int * int * int * int * int>) = () // expect ok
+
+    type R<'T> = R of 'T * R<'T>
+    let r1 (x : Set<R<int>>) = () // expect ok
+    let r2 (x : Set<R<System.Type>>) = () // expect error
+    let r3 (x : R<int>) = (x = x) // expect ok
+    let r4 (x : R<System.Type>) = (x = x) // expect ok
+    let r5 (x : R<int -> int>) = (x = x) // expect error
+
+    
+module Example1 =
+    type X<'T> = X of 'T
+
+    let f0 (x : Set<X<int>>) = ()  // expect ok
+    let f1 (x : Set<X<'T>>) = ()  // expect ok
+    let f2 (x : Set<X<System.Type>>) = ()  // expect error
+    let f3 (x : X<list<int>>) = (x = x) // expect ok
+    let f4 (x : X<int -> int>) = (x = x) // expect error   
+    let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f6 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example1_Record =
+    type X<'T> = { r : 'T }
+
+    let f0 (x : Set<X<int>>) = ()  // expect ok
+    let f1 (x : Set<X<'T>>) = ()  // expect ok
+    let f2 (x : Set<X<System.Type>>) = ()  // expect error
+    let f3 (x : X<list<int>>) = (x = x) // expect ok
+    let f4 (x : X<int -> int>) = (x = x) // expect error   
+    let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f6 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example1_Struct =
+    type X<'T> = struct val r : 'T  end
+
+    let f0 (x : Set<X<int>>) = ()  // expect ok
+    let f1 (x : Set<X<'T>>) = ()  // expect ok
+    let f2 (x : Set<X<System.Type>>) = ()  // expect error
+    let f3 (x : X<list<int>>) = (x = x) // expect ok
+    let f4 (x : X<int -> int>) = (x = x) // expect error   
+    let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f6 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example1_StructImplicit =
+    [<Struct; StructuralComparison; StructuralEquality>]
+    type X<[<EqualityConditionalOn;ComparisonConditionalOn>] 'T>(r:'T) = struct member x.R = r  end
+
+    let f0 (x : Set<X<int>>) = ()  // expect ok
+    let f1 (x : Set<X<'T>>) = ()  // expect ok
+    let f2 (x : Set<X<System.Type>>) = ()  // expect error 
+    let f3 (x : X<list<int>>) = (x = x) // expect ok
+    let f4 (x : X<int -> int>) = (x = x) // expect error   
+    let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f6 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example1_StructImplicit2 =
+    [<Struct>]
+    type X<[<EqualityConditionalOn;ComparisonConditionalOn>] 'T>(r:'T) = struct member x.R = r  end
+
+    let f0 (x : Set<X<int>>) = ()  // expect ok
+    let f1 (x : Set<X<'T>>) = ()  // expect ok
+    let f2 (x : Set<X<System.Type>>) = ()  // expect error 
+    let f3 (x : X<list<int>>) = (x = x) // expect ok
+    let f4 (x : X<int -> int>) = (x = x) // expect error   
+    let f5 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f6 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example2 = 
+    type X<'T> = X of list<'T>
+
+    let f0 (x : Set<X<int>>) = ()   // expect ok
+    let f1 (x : Set<X<'T>>) = ()   // expect ok
+    let f2 (x : Set<X<System.Type>>) = () // expect error
+    let f3 (x : Set<X<list<System.Type>>>) = () // expect error
+
+    let f4 (x : X<list<int>>) = (x = x) // expect ok
+    let f5 (x : X<int -> int>) = (x = x) // expect error   
+    let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f7 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+
+module Example3 = 
+    type X<'T> = X of Y<'T>
+    and Y<'T> = Y of 'T
+
+    let f0 (x : Set<X<int>>) = ()   // expect ok
+    let f1 (x : Set<X<'T>>) = ()   // expect ok
+    let f2 (x : Set<X<System.Type>>) = () // expect error
+    let f3 (x : Set<X<list<System.Type>>>) = () // expect error
+
+    let f4 (x : X<list<int>>) = (x = x) // expect ok
+    let f5 (x : X<int -> int>) = (x = x) // expect error   
+    let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f7 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+module Example4 = 
+    type X<'T> = X of Y<'T>
+    and Y<'T> = Y of 'T * X<'T>
+
+    let f0 (x : Set<X<int>>) = ()   // expect ok
+    let f1 (x : Set<X<'T>>) = ()   // expect ok
+    let f2 (x : Set<X<System.Type>>) = () // expect error
+    let f3 (x : Set<X<list<System.Type>>>) = () // expect error
+
+    let f4 (x : X<list<int>>) = (x = x) // expect ok
+    let f5 (x : X<int -> int>) = (x = x) // expect error   
+    let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f7 (x : X<list<int -> int>>) = (x = x) // expect error    
+
+    let g0 (x : Set<Y<int>>) = ()   // expect ok
+    let g1 (x : Set<Y<'T>>) = ()   // expect ok
+    let g2 (x : Set<Y<System.Type>>) = () // expect error
+    let g3 (x : Set<Y<list<System.Type>>>) = () // expect error
+
+    let g4 (x : Y<list<int>>) = (x = x) // expect ok
+    let g5 (x : Y<int -> int>) = (x = x) // expect error   
+    let g6 (x : Y<list<System.Type>>) = (x = x) // expect ok
+    let g7 (x : Y<list<int -> int>>) = (x = x) // expect error    
+
+module Example5 = 
+    type X<'T> = X of Y<'T>
+    and Y<'T> = Y of int
+
+    let f0 (x : Set<X<int>>) = ()   // expect ok
+    let f1 (x : Set<X<'T>>) = ()   // expect ok
+    let f2 (x : Set<X<System.Type>>) = () // expect ok
+    let f3 (x : Set<X<list<System.Type>>>) = () // expect ok
+
+    let f4 (x : X<list<int>>) = (x = x) // expect ok
+    let f5 (x : X<int -> int>) = (x = x) // expect ok
+    let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f7 (x : X<list<int -> int>>) = (x = x) // expect ok
+
+    let g0 (x : Set<Y<int>>) = ()   // expect ok
+    let g1 (x : Set<Y<'T>>) = ()   // expect ok
+    let g2 (x : Set<Y<System.Type>>) = () // expect ok
+    let g3 (x : Set<Y<list<System.Type>>>) = () // expect ok
+
+    let g4 (x : Y<list<int>>) = (x = x) // expect ok
+    let g5 (x : Y<int -> int>) = (x = x) // expect ok
+    let g6 (x : Y<list<System.Type>>) = (x = x) // expect ok
+    let g7 (x : Y<list<int -> int>>) = (x = x) // expect ok
+
+module Example6 = 
+    type X<'T> = X of Y<int,'T>
+    and Y<'T,'U> = Y of 'T * X<'T>
+
+    let f0 (x : Set<X<int>>) = ()   // expect ok
+    let f1 (x : Set<X<'T>>) = ()   // expect ok
+    let f2 (x : Set<X<System.Type>>) = () // expect ok
+    let f3 (x : Set<X<list<System.Type>>>) = () // expect ok
+
+    let f4 (x : X<list<int>>) = (x = x) // expect ok
+    let f5 (x : X<int -> int>) = (x = x) // expect ok
+    let f6 (x : X<list<System.Type>>) = (x = x) // expect ok
+    let f7 (x : X<list<int -> int>>) = (x = x) // expect ok
+
+    let g0 (x : Set<Y<int,int>>) = ()   // expect ok
+    let g1 (x : Set<Y<'T,'T>>) = ()   // expect ok
+    let g2 (x : Set<Y<System.Type,int>>) = () // expect error
+    let g3 (x : Set<Y<list<System.Type>,int>>) = () // expect error
+
+    let g4 (x : Y<list<int>,int>) = (x = x) // expect ok
+    let g5 (x : Y<(int -> int), int>) = (x = x) // expect error   
+    let g6 (x : Y<list<System.Type>, int>) = (x = x) // expect ok
+    let g7 (x : Y<list<(int -> int)>, int>) = (x = x) // expect error    
+
+
+    let g8 (x : Y<int,list<int>>) = (x = x) // expect ok
+    let g9 (x : Y<int,(int -> int)>) = (x = x) // expect ok
+    let g10 (x : Y<int,list<System.Type>>) = (x = x) // expect ok
+    let g11 (x : Y<int,list<(int -> int)>>) = (x = x) // expect ok
+
+module Example7 = 
+    // a type inferred to be without equality or comparison
+    type X = X of (int -> int)
+    // a type transitively inferred to be without equality or comparison
+    type  Y = Y of X
+
+    let f0 (x : Set<X>) = ()   // expect error
+    let f1 (x : Set<Y>) = ()   // expect error
+
+    let f2 (x : X) = (x = x) // expect error
+    let f3 (x : Y) = (x = x) // expect error
+
+module Example8 = 
+    // a type inferred to be without comparison
+    type X = X of System.Type
+    // a type transitively inferred to be without comparison
+    type  Y = Y of X
+
+    let f0 (x : Set<X>) = ()   // expect error
+    let f1 (x : Set<Y>) = ()   // expect error
+
+    let f2 (x : X) = (x = x) // expect ok
+    let f3 (x : Y) = (x = x) // expect ok
+
diff --git a/tests/fsharp/typecheck/sigs/neg29.bsl b/tests/fsharp/typecheck/sigs/neg29.bsl
new file mode 100644
index 0000000..287a889
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg29.bsl
@@ -0,0 +1,20 @@
+
+neg29.fs(6,9,6,10): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:12). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(6,9,6,10): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:12). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(10,7,10,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (9:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(10,7,10,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (9:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(14,6,14,7): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (13:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(14,6,14,7): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (13:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(18,5,18,6): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (17:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(18,5,18,6): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (17:16). Try indenting this token further or using standard formatting conventions.
+
+neg29.fs(21,19,22,16): parse error FS0010: Incomplete structured construct at or before this point in type name. Expected '>' or other token.
+
+neg29.fs(25,1,25,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
diff --git a/tests/fsharp/typecheck/sigs/neg29.fs b/tests/fsharp/typecheck/sigs/neg29.fs
new file mode 100644
index 0000000..df251c0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg29.fs
@@ -0,0 +1,24 @@
+module Test
+// Some syntax tests
+module MultiLineTypeParameterNegativeTests = 
+
+    type C<'T,
+        'U>() =  // Expect "possible incorrect indentation"
+         static let x =  1
+
+    type C1err<'T,
+      'U>() =  // Expect "possible incorrect indentation"
+         static let x =  1
+
+    type C2err<'T,
+     'U>() =  // Expect "possible incorrect indentation"
+         static let x =  1
+
+    type C3err<'T,
+    'U>() =  // Expect "possible incorrect indentation"
+         static let x =  1
+
+    type C4err<'T
+               'U>() =  // Expect syntax error if comma omitted
+ 
+         ()
diff --git a/tests/fsharp/typecheck/sigs/neg30.bsl b/tests/fsharp/typecheck/sigs/neg30.bsl
new file mode 100644
index 0000000..b958db2
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg30.bsl
@@ -0,0 +1,34 @@
+
+neg30.fs(28,6,28,19): typecheck error FS0954: This type definition involves an immediate cyclic reference through a struct field or inheritance relation
+
+neg30.fs(43,7,43,21): typecheck error FS0001: A generic construct requires that the type 'SManaged' is an unmanaged type
+
+neg30.fs(44,7,44,30): typecheck error FS0001: A generic construct requires that the type 'SManagedRecursive' is an unmanaged type
+
+neg30.fs(45,7,45,16): typecheck error FS0001: A generic construct requires that the type 'obj' is an unmanaged type
+
+neg30.fs(46,7,46,26): typecheck error FS0001: A generic construct requires that the type 'SBadRecursion' is an unmanaged type
+
+neg30.fs(47,6,47,8): typecheck error FS0001: A generic construct requires that the type 'FSharpUnion' is an unmanaged type
+
+neg30.fs(48,7,48,26): typecheck error FS0001: A generic construct requires that the type 'SGeneric<int>' is an unmanaged type
+
+neg30.fs(59,13,59,24): typecheck error FS0001: A generic construct requires that the type 'SManaged' is an unmanaged type
+
+neg30.fs(60,13,60,33): typecheck error FS0001: A generic construct requires that the type 'SManagedRecursive' is an unmanaged type
+
+neg30.fs(61,13,61,19): typecheck error FS0001: A generic construct requires that the type 'obj' is an unmanaged type
+
+neg30.fs(62,13,62,29): typecheck error FS0001: A generic construct requires that the type 'SBadRecursion' is an unmanaged type
+
+neg30.fs(63,13,63,27): typecheck error FS0001: A generic construct requires that the type 'FSharpUnion' is an unmanaged type
+
+neg30.fs(64,13,64,29): typecheck error FS0001: A generic construct requires that the type 'SGeneric<int>' is an unmanaged type
+
+neg30.fs(71,12,71,35): typecheck error FS0120: hello!
+
+neg30.fs(71,12,71,35): typecheck error FS0120: hello!
+
+neg30.fs(71,12,71,35): typecheck error FS0120: hello!
+
+neg30.fs(78,13,78,37): typecheck error FS10021: hello!
diff --git a/tests/fsharp/typecheck/sigs/neg30.fs b/tests/fsharp/typecheck/sigs/neg30.fs
new file mode 100644
index 0000000..a427d47
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg30.fs
@@ -0,0 +1,79 @@
+module Neg30
+let f<'a when 'a : unmanaged> (x : 'a) = ()
+;;
+do f 10
+do f 10u
+;;
+[<Struct>]
+type SUnmanaged =
+   val i : int
+   val j : uint32
+   member this.X = this.i, this.j
+;;
+[<Struct>]
+type SUnmanagedRecursive =
+   val s1 : SUnmanaged
+   val i : int
+
+[<Struct>]
+type SManaged =
+   val v : obj
+
+[<Struct>]
+type SManagedRecursive =
+   val s1 : SUnmanaged
+   val s2 : SManaged
+
+[<Struct>]
+type SBadRecursion =
+   val s : SBadRecursion
+
+[<Struct>]
+type SGeneric<'T> =
+   val s : int
+
+type FSharpUnion =
+| XA 
+| XB
+| XC
+
+
+do f (new SUnmanaged())               // Ok
+do f (new SUnmanagedRecursive())      // Ok
+do f (new SManaged())                 // Error
+do f (new SManagedRecursive())        // Error
+do f (new obj())                      // Error
+do f (new SBadRecursion())            // Should not crash
+do f XA                               // Error
+do f (new SGeneric<int>())            // Error
+
+[<Measure>]
+type kg
+
+do f (1.5<kg>)                        // Ok
+
+type C<'a when 'a : unmanaged>() = class end
+
+let _ = new C<SUnmanaged>()               // Ok
+let _ = new C<SUnmanagedRecursive>()      // Ok
+let _ = new C<SManaged>()                 // Error
+let _ = new C<SManagedRecursive>()        // Error
+let _ = new C<obj>()                      // Error
+let _ = new C<SBadRecursion>()            // Should not crash
+let _ = new C<FSharpUnion>()               // Error
+let _ = new C<SGeneric<int>>()               // Error
+
+
+type CompilerMessageTest() = 
+    [<CompilerMessage("hello!", 120)>] 
+    member x.P = 1
+
+let test = CompilerMessageTest().P
+
+
+type CompilerMessageTest2() = 
+    [<CompilerMessage("hello!", 10021, IsError=true)>]
+    member x.P = 1
+
+let test2 = CompilerMessageTest2().P
+
diff --git a/tests/fsharp/typecheck/sigs/neg31.bsl b/tests/fsharp/typecheck/sigs/neg31.bsl
new file mode 100644
index 0000000..86bb626
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg31.bsl
@@ -0,0 +1,12 @@
+
+neg31.fs(9,6,9,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
+
+neg31.fs(71,12,71,36): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
+
+neg31.fs(107,13,107,41): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
+
+neg31.fs(28,6,28,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
+
+neg31.fs(93,14,93,42): typecheck error FS1200: The attribute 'CLSCompliantAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
+
+neg31.fs(47,6,47,30): typecheck error FS1200: The attribute 'ObsoleteAttribute' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code.
diff --git a/tests/fsharp/typecheck/sigs/neg31.fs b/tests/fsharp/typecheck/sigs/neg31.fs
new file mode 100644
index 0000000..42d7de0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg31.fs
@@ -0,0 +1,116 @@
+module Neg31
+
+module ValAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   let x1 = 1
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   let x2 = 1
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   let x3 = 1
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   let x4 = 1
+
+
+
+module TyconAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   type C1 = A | B
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   type C2 = A | B
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   type C3 = A | B
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   type C4 = A | B
+
+
+module ModuleAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   module M1 = 
+       let x = 1
+
+   // expect warning, and attribute from signature to be included
+   [<System.ObsoleteAttribute("Text differs in implementation")>]
+   module M2 = 
+       let x = 1
+
+   // expect no warning, and attribute to be in compiled code
+   [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   module M3 = 
+       let x = 1
+
+   // expect no warning, and attribute to be in compiled code
+   //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   module M4 = 
+       let x = 1
+
+
+module UnionCaseAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   type U1 =    
+       | [<System.ObsoleteAttribute("Text identical in both")>]
+         A of int
+       | B of string
+
+   // expect warning, and attribute from signature to be included
+   type U2 =    
+       | [<System.ObsoleteAttribute("Text differs in implementation")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U3 =    
+       | [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U4 =    
+       | //[<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+         A of int
+       | B of string
+
+module ParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   let x1 ([<System.CLSCompliantAttribute(true)>] p : int) = p
+
+   // differs in signature
+   let x2 ([<System.CLSCompliantAttribute(false)>] p : int) = p
+
+   // missing in signature
+   let x3 ([<System.CLSCompliantAttribute(true)>] p : int) = p
+
+   // in signature but not implementation
+   let x4 ((* [<System.CLSCompliantAttribute(true)>] *) p : int) = p
+
+module TypeParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   let x1<[<System.CLSCompliantAttribute(true)>] 'T>(x:'T) = x
+
+   // differs in signature
+   let x2<[<System.CLSCompliantAttribute(false)>] 'T>(x:'T) = x
+
+   // missing in signature
+   let x3<[<System.CLSCompliantAttribute(true)>] 'T>(x:'T) = x
+
+   // in signature but not implementation
+   let x4<(* [<System.CLSCompliantAttribute(true)>] *) 'T>(x:'T) = x
+
+
+          
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg31.fsi b/tests/fsharp/typecheck/sigs/neg31.fsi
new file mode 100644
index 0000000..8ed343b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg31.fsi
@@ -0,0 +1,97 @@
+module Neg31
+
+module ValAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   val x1 : int
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   val x2 : int
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   val x3 : int
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   val x4 : int
+
+module TyconAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   type C1 = A | B
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   type C2 = A | B
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   type C3 = A | B
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   type C4 = A | B
+
+module ModuleAttributesDifferent = 
+   [<System.ObsoleteAttribute("Text identical in both")>]
+   module M1 = 
+       val x : int
+
+   [<System.ObsoleteAttribute("Text differs in signature")>]
+   module M2 = 
+       val x : int
+
+   //[<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+   module M3 = 
+       val x : int
+
+   [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+   module M4 = 
+       val x : int
+
+module UnionCaseAttributesDifferent = 
+   // expect no warning, and attribute to be in compiled code
+   type U1 =    
+       | [<System.ObsoleteAttribute("Text identical in both")>]
+         A of int
+       | B of string
+
+   // expect warning, and attribute from signature to be included
+   type U2 =    
+       | [<System.ObsoleteAttribute("Text differs in signature")>]
+         A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U3 =    
+       // [<System.ObsoleteAttribute("Attribute is in implementation but not signature")>]
+       | A of int
+       | B of string
+
+   // expect no warning, and attribute to be in compiled code
+   type U4 =    
+       | [<System.ObsoleteAttribute("Attribute is in signature but not implementation")>]
+         A of int
+       | B of string
+
+module ParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   val x1 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+   // differs in signature
+   val x2 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+   // missing in signature
+   val x3 : (* [<System.CLSCompliantAttribute(true)>] *) p : int -> int
+
+   // in signature but not implementation
+   val x4 : [<System.CLSCompliantAttribute(true)>] p : int -> int
+
+module TypeParamAttributesDifferent = 
+   
+   // identical in signature and implementation
+   val x1< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
+
+   // differs in signature
+   val x2< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
+
+   // missing in signature
+   val x3< (* [<System.CLSCompliantAttribute(true)>] *) 'T> : 'T -> 'T
+
+   // in signature but not implementation
+   val x4< [<System.CLSCompliantAttribute(true)>] 'T> : 'T -> 'T
diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl
new file mode 100644
index 0000000..1b0de0b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg32.bsl
@@ -0,0 +1,44 @@
+
+neg32.fs(17,21,17,49): typecheck error FS0842: This attribute is not valid for use on this language element
+
+neg32.fs(24,15,24,16): typecheck error FS0043: The member or object constructor 'TryParse' does not take 1 argument(s). An overload was found taking 2 arguments.
+
+neg32.fs(39,17,39,19): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(40,4,40,23): typecheck error FS0671: A property cannot have explicit type parameters. Consider using a method instead.
+
+neg32.fs(40,21,40,23): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(41,21,41,23): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(41,27,41,29): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(42,18,42,20): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(42,24,42,26): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(46,17,46,19): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(47,4,47,23): typecheck error FS0671: A property cannot have explicit type parameters. Consider using a method instead.
+
+neg32.fs(47,21,47,23): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(48,21,48,23): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(48,27,48,29): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(49,18,49,20): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(49,24,49,26): typecheck error FS0039: The type parameter 'U' is not defined
+
+neg32.fs(52,10,52,12): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(52,10,52,12): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(55,11,55,13): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(55,11,55,13): typecheck error FS0039: The type parameter 'T' is not defined
+
+neg32.fs(59,65,59,86): typecheck error FS0033: The non-generic type 'System.EventArgs' does not expect any type arguments, but here is given 1 type argument(s)
+
+neg32.fs(59,21,59,27): typecheck error FS1091: The event 'Event1' has a non-standard type. If this event is declared in another CLI language, you may need to access this event using the explicit add_Event1 and remove_Event1 methods for the event. If this event is declared in F#, make the type of the event an instantiation of either 'IDelegateEvent<_>' or 'IEvent<_,_>'.
diff --git a/tests/fsharp/typecheck/sigs/neg32.fs b/tests/fsharp/typecheck/sigs/neg32.fs
new file mode 100644
index 0000000..4ff91d1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg32.fs
@@ -0,0 +1,60 @@
+module Neg32
+module IncorrectAttributeUsage =
+    type DontPressThisButtonAttribute = 
+      class 
+        inherit System.Attribute
+        val v: string 
+        val mutable someOtherField: string 
+        member x.SomeOtherField 
+           with get() = x.someOtherField 
+           and  set(v:string) = x.someOtherField <- v
+        member x.Message = x.v
+        new(s:string) = { inherit System.Attribute(); v=s; someOtherField="" }
+      end
+
+    type C = 
+      class 
+        [<property: DontPressThisButtonAttribute("no!")>]
+        val mutable mf3 : int
+      end
+
+module Bug5680 = 
+    let inline try_parse x = (^a: (static member TryParse: string -> bool * ^a) x)
+    let _, x = try_parse "4" 
+    let z = x + 1      
+
+
+
+type PositiveInterface =
+   abstract M<'T> : 'T -> 'T
+   abstract M : 'U -> 'U
+
+[<AbstractClass>]
+type PositiveClass<'A>() =
+   abstract M<'T> : 'T -> 'T
+   abstract M2<'T> : 'T -> 'A
+   abstract M : 'U -> 'U
+
+type NegativeInterface =
+   abstract v : 'T
+   abstract M<'T> : 'U 
+   abstract M<'T> : 'U -> 'U
+   abstract M : ('U -> 'U)
+
+[<AbstractClass>]
+type NegativeClass() =
+   abstract v : 'T
+   abstract M<'T> : 'U 
+   abstract M<'T> : 'U -> 'U
+   abstract M : ('U -> 'U)
+
+type NegativeRecord =
+   { v : 'T }
+
+type NegativeUnion =
+   Foo of 'T
+
+type EventDeclarationWithSquiggleThatWasTooLong = 
+    [<CLIEvent>]
+    abstract member Event1 : IDelegateEvent<System.EventHandler<System.EventArgs<int>>>
+
diff --git a/tests/fsharp/typecheck/sigs/neg33.bsl b/tests/fsharp/typecheck/sigs/neg33.bsl
new file mode 100644
index 0000000..5a68e0f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg33.bsl
@@ -0,0 +1,2 @@
+
+neg33.fs(4,8,4,13): typecheck error FS0193: Module 'MyNS.File2' requires a value 'member File2.LSS.Bar : string -> int'
diff --git a/tests/fsharp/typecheck/sigs/neg33.fs b/tests/fsharp/typecheck/sigs/neg33.fs
new file mode 100644
index 0000000..2c9536a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg33.fs
@@ -0,0 +1,14 @@
+
+namespace MyNS
+
+module File2 =
+    type IFoo =
+        abstract member Bar : int -> int
+
+    type LSS() =
+        member this.Irrelevant() = ()
+    and LS() =
+        member this.Irrelevant() = ()
+        interface IFoo with
+            member this.Bar x = x
+
diff --git a/tests/fsharp/typecheck/sigs/neg33.fsi b/tests/fsharp/typecheck/sigs/neg33.fsi
new file mode 100644
index 0000000..77b90cc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg33.fsi
@@ -0,0 +1,16 @@
+namespace MyNS
+
+module File2 =
+    type IFoo =
+        abstract member Bar : int -> int
+
+    type LSS =
+      class
+        member Irrelevant : unit -> unit
+        member Bar : string -> int
+      end
+    type LS =
+      class
+        interface IFoo
+        member Irrelevant : unit -> unit
+      end
diff --git a/tests/fsharp/typecheck/sigs/neg34.bsl b/tests/fsharp/typecheck/sigs/neg34.bsl
new file mode 100644
index 0000000..4cfced4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg34.bsl
@@ -0,0 +1,2 @@
+
+neg34.fsi(3,19,3,24): typecheck error FS0001: A type parameter is missing a constraint 'when 'a : struct'
diff --git a/tests/fsharp/typecheck/sigs/neg34.fs b/tests/fsharp/typecheck/sigs/neg34.fs
new file mode 100644
index 0000000..5f7d69b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg34.fs
@@ -0,0 +1,3 @@
+module Bbb
+type G<'a when 'a : comparison> = X
+let h (x : 'a) : G<'a> = X
diff --git a/tests/fsharp/typecheck/sigs/neg34.fsi b/tests/fsharp/typecheck/sigs/neg34.fsi
new file mode 100644
index 0000000..1cc02a1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg34.fsi
@@ -0,0 +1,3 @@
+module Bbb
+type G<'a when 'a : struct>
+val h<'a> : 'a -> G<'a>
diff --git a/tests/fsharp/typecheck/sigs/neg35.bsl b/tests/fsharp/typecheck/sigs/neg35.bsl
new file mode 100644
index 0000000..91885a8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg35.bsl
@@ -0,0 +1,16 @@
+
+neg35.fs(4,10,4,13): parse error FS1208: Invalid operator definition. Prefix operator definitions must use a valid prefix operator name.
+
+neg35.fs(5,10,5,13): parse error FS1208: Invalid operator definition. Prefix operator definitions must use a valid prefix operator name.
+
+neg35.fs(6,10,6,12): parse error FS1208: Invalid operator definition. Prefix operator definitions must use a valid prefix operator name.
+
+neg35.fs(7,10,7,17): parse error FS1208: Invalid operator definition. Prefix operator definitions must use a valid prefix operator name.
+
+neg35.fs(9,27,9,28): parse error FS1208: Invalid prefix operator
+
+neg35.fs(10,27,10,28): parse error FS1208: Invalid prefix operator
+
+neg35.fs(11,25,11,26): parse error FS1208: Invalid prefix operator
+
+neg35.fs(12,25,12,26): parse error FS1208: Invalid prefix operator
diff --git a/tests/fsharp/typecheck/sigs/neg35.fs b/tests/fsharp/typecheck/sigs/neg35.fs
new file mode 100644
index 0000000..7a73583
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg35.fs
@@ -0,0 +1,12 @@
+namespace global
+
+module PrefixOperatorsNegative = 
+    let (~<<) x = x // now rejected
+    let (~++) x = x // now rejected
+    let (~!) x = x // now rejected
+    let (~%%%%%%) x = x // now rejected
+
+    let x1 : int = id ~<< 2 // now rejected
+    let x2 : int = id ~++ 2 // now rejected
+    let x3 : int = id ~+2 // now rejected
+    let x4 : int = id ~!2 // now rejected
diff --git a/tests/fsharp/typecheck/sigs/neg36.bsl b/tests/fsharp/typecheck/sigs/neg36.bsl
new file mode 100644
index 0000000..bbee183
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg36.bsl
@@ -0,0 +1,4 @@
+
+neg36.fs(11,20,11,21): typecheck error FS0361: The override 'M : string -> int' implements more than one abstract slot, e.g. 'abstract member TestAbstractOverrides_Bug4232_Case1.D.M : 'U -> int' and 'abstract member TestAbstractOverrides_Bug4232_Case1.D.M : 'T -> int'
+
+neg36.fs(32,23,32,24): typecheck error FS0361: The override 'M : int -> unit' implements more than one abstract slot, e.g. 'abstract member TestAbstractOverrides_Bug4232_Case2.PB.M : 'a -> unit' and 'abstract member TestAbstractOverrides_Bug4232_Case2.PA.M : int -> unit'
diff --git a/tests/fsharp/typecheck/sigs/neg36.fs b/tests/fsharp/typecheck/sigs/neg36.fs
new file mode 100644
index 0000000..9ffd667
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg36.fs
@@ -0,0 +1,33 @@
+module Neg36
+
+module TestAbstractOverrides_Bug4232_Case1 = 
+    [<AbstractClass>]
+    type D<'T,'U>() = 
+        abstract M : 'T  -> int
+        abstract M : 'U -> int
+        
+    type E() = 
+        inherit D<string,string>()
+        override x.M(a:string) = 1
+
+module TestAbstractOverrides_Bug4232_Case2 = 
+        
+    [<AbstractClass>]
+    type PA() =
+        abstract M : int -> unit
+
+    [<AbstractClass>]
+    type PB<'a>() =
+        inherit PA()
+        abstract M : 'a -> unit
+
+    [<AbstractClass>]
+    type PC() =
+        inherit PB<int>()
+        // Here, PA.M amd PB<int>.M have the same signature, so PA.M is unimplementable.
+        // EXPECT: friendly error at this point?
+
+    type PD() = 
+        inherit PC()
+        override this.M(x:int) = ()
+
diff --git a/tests/fsharp/typecheck/sigs/neg37.bsl b/tests/fsharp/typecheck/sigs/neg37.bsl
new file mode 100644
index 0000000..3e87428
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg37.bsl
@@ -0,0 +1,22 @@
+
+neg37.fs(7,19,7,29): typecheck error FS0670: This code is not sufficiently generic. The type variable 'T could not be generalized because it would escape its scope.
+
+neg37.fs(19,33,19,40): typecheck error FS1125: The instantiation of the generic type 'CCC' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'CCC<_>'.
+
+neg37.fs(19,19,19,29): typecheck error FS0670: This code is not sufficiently generic. The type variable 'T could not be generalized because it would escape its scope.
+
+neg37.fs(24,10,24,37): typecheck error FS0331: The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. 'IComparable <'T>' and 'IEvent <'T>'. Consider using type annotations to resolve the ambiguity
+
+neg37.fs(24,10,24,37): typecheck error FS0071: Type constraint mismatch when applying the default type 'IEvent<'T>' for a type inference variable. The type 'IEvent<'T>' is not compatible with the type 'System.IComparable<'T>' Consider adding further type constraints
+
+neg37.fs(30,10,30,37): typecheck error FS0331: The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. 'IComparable <'T>' and 'IEvent <'T>'. Consider using type annotations to resolve the ambiguity
+
+neg37.fs(30,10,30,37): typecheck error FS0071: Type constraint mismatch when applying the default type 'IEvent<'T>' for a type inference variable. The type 'IEvent<'T>' is not compatible with the type 'System.IComparable<'T>' Consider adding further type constraints
+
+neg37.fs(36,10,36,37): typecheck error FS0331: The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. 'IComparable <'T>' and 'IEvent <'T>'. Consider using type annotations to resolve the ambiguity
+
+neg37.fs(36,10,36,37): typecheck error FS0071: Type constraint mismatch when applying the default type 'IEvent<'T>' for a type inference variable. The type 'IEvent<'T>' is not compatible with the type 'System.IComparable<'T>' Consider adding further type constraints
+
+neg37.fs(42,9,42,36): typecheck error FS0331: The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. 'IComparable <'T>' and 'IEvent <'T>'. Consider using type annotations to resolve the ambiguity
+
+neg37.fs(42,9,42,36): typecheck error FS0071: Type constraint mismatch when applying the default type 'IEvent<'T>' for a type inference variable. The type 'IEvent<'T>' is not compatible with the type 'System.IComparable<'T>' Consider adding further type constraints
diff --git a/tests/fsharp/typecheck/sigs/neg37.fs b/tests/fsharp/typecheck/sigs/neg37.fs
new file mode 100644
index 0000000..7795fd7
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg37.fs
@@ -0,0 +1,43 @@
+module Neg37
+
+
+// This test should indeed give an error: the type variable 'T escapes its scope into the type of Bar
+type AAA() = 
+    static member Bar = (fun x -> ())
+    static member Baz<'T> () =  AAA.Bar (failwith "" : list<'T>)
+
+// This test should indeed give an error: the use of 'Bar' at a non-uniform instantiation before we know its
+// complete type w.r.t. 'T is not permitted
+// Moved to neg37a - since the error was masked by other errors
+//type BBB<'T>() = 
+//    static member Bar = (fun x -> ())
+//    static member Baz =  BBB<string>.Bar (failwith "" : 'T)
+
+// This test should indeed give an error: the type variable 'T escapes its scope into the type of Bar
+type CCC<'U>() = 
+    static member Bar = (fun x -> ())
+    static member Baz<'T> () =  CCC.Bar (failwith "" : list<'T>)
+
+type Bad1<'T>(v) = 
+    member x.M() = 
+        (v :> IEvent<'T> |> ignore)
+        (v :> System.IComparable<'T> |> ignore); 
+
+type Bad2<'T> = 
+    member x.P 
+      with get v = 
+        (v :> IEvent<'T> |> ignore)
+        (v :> System.IComparable<'T> |> ignore); 
+
+type Bad3<'T>() = 
+    member x.P 
+      with get v = 
+        (v :> IEvent<'T> |> ignore)
+        (v :> System.IComparable<'T> |> ignore); 
+
+type Bad4<'T> = 
+    new () = { } 
+    new v = 
+       (v :> IEvent<'T> |> ignore); 
+       (v :> System.IComparable<'T> |> ignore);  // this should give an ambiguity error
+       Bad4<'T>()
diff --git a/tests/fsharp/typecheck/sigs/neg37_a.bsl b/tests/fsharp/typecheck/sigs/neg37_a.bsl
new file mode 100644
index 0000000..8a7ff77
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg37_a.bsl
@@ -0,0 +1,2 @@
+
+neg37_a.fs(7,26,7,41): typecheck error FS3068: The function or member 'Bar' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member BBB.Bar : ('T -> unit)'.
diff --git a/tests/fsharp/typecheck/sigs/neg37_a.fs b/tests/fsharp/typecheck/sigs/neg37_a.fs
new file mode 100644
index 0000000..0f4e2fc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg37_a.fs
@@ -0,0 +1,8 @@
+module Neg37a
+
+// This test should indeed give an error: the use of 'Bar' at a non-uniform instantiation before we know its
+// complete type w.r.t. 'T is not permitted
+type BBB<'T>() = 
+    static member Bar = (fun x -> ())
+    static member Baz =  BBB<string>.Bar (failwith "" : 'T)
+
diff --git a/tests/fsharp/typecheck/sigs/neg38.bsl b/tests/fsharp/typecheck/sigs/neg38.bsl
new file mode 100644
index 0000000..beb1d3c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg38.bsl
@@ -0,0 +1,2 @@
+
+neg38.fs(6,1,6,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected '=' or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg38.fs b/tests/fsharp/typecheck/sigs/neg38.fs
new file mode 100644
index 0000000..6cebde8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg38.fs
@@ -0,0 +1,5 @@
+module Neg38a
+
+module Neg38b
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg39.bsl b/tests/fsharp/typecheck/sigs/neg39.bsl
new file mode 100644
index 0000000..b9885e0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg39.bsl
@@ -0,0 +1,2 @@
+
+neg39.fs(3,3,3,12): parse error FS0010: Unexpected keyword 'namespace' in implementation file. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg39.fs b/tests/fsharp/typecheck/sigs/neg39.fs
new file mode 100644
index 0000000..664b00e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg39.fs
@@ -0,0 +1,5 @@
+namespace Neg39a 
+
+  namespace Neg39b
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg40.bsl b/tests/fsharp/typecheck/sigs/neg40.bsl
new file mode 100644
index 0000000..3047ab4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg40.bsl
@@ -0,0 +1,4 @@
+
+neg40.fs(3,3,3,12): parse error FS0010: Unexpected keyword 'namespace' in implementation file. Expected incomplete structured construct at or before this point or other token.
+
+neg40.fs(7,1,7,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
diff --git a/tests/fsharp/typecheck/sigs/neg40.fs b/tests/fsharp/typecheck/sigs/neg40.fs
new file mode 100644
index 0000000..11cdba5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg40.fs
@@ -0,0 +1,6 @@
+namespace Neg40a 
+  type X = A | B
+  namespace Neg40b
+
+  type X = A | B
+
diff --git a/tests/fsharp/typecheck/sigs/neg41.bsl b/tests/fsharp/typecheck/sigs/neg41.bsl
new file mode 100644
index 0000000..0ebbdcd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg41.bsl
@@ -0,0 +1,4 @@
+
+neg41.fs(3,1,3,5): parse error FS0010: Unexpected start of structured construct in definition. Expected '=' or other token.
+
+neg41.fs(4,1,4,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
diff --git a/tests/fsharp/typecheck/sigs/neg41.fs b/tests/fsharp/typecheck/sigs/neg41.fs
new file mode 100644
index 0000000..b3e95b3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg41.fs
@@ -0,0 +1,3 @@
+namespace Neg41 
+module Neg41Module
+type X = A | B
diff --git a/tests/fsharp/typecheck/sigs/neg42.bsl b/tests/fsharp/typecheck/sigs/neg42.bsl
new file mode 100644
index 0000000..4ae7c49
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg42.bsl
@@ -0,0 +1,4 @@
+
+neg42.fsi(3,1,3,5): parse error FS0010: Unexpected start of structured construct in signature file. Expected ':', '=' or other token.
+
+neg42.fsi(4,1,4,1): parse error FS0010: Incomplete structured construct at or before this point in signature file
diff --git a/tests/fsharp/typecheck/sigs/neg42.fs b/tests/fsharp/typecheck/sigs/neg42.fs
new file mode 100644
index 0000000..070cedd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg42.fs
@@ -0,0 +1,3 @@
+namespace Neg42 
+module Neg42Module =
+  type X = A | B 
diff --git a/tests/fsharp/typecheck/sigs/neg42.fsi b/tests/fsharp/typecheck/sigs/neg42.fsi
new file mode 100644
index 0000000..cdb6581
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg42.fsi
@@ -0,0 +1,3 @@
+namespace Neg42 
+module Neg42Module
+type X = A | B
diff --git a/tests/fsharp/typecheck/sigs/neg43.bsl b/tests/fsharp/typecheck/sigs/neg43.bsl
new file mode 100644
index 0000000..e6e2e81
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg43.bsl
@@ -0,0 +1,2 @@
+
+neg43.fs(11,6,11,8): typecheck error FS0294: The type definitions in the signature and implementation are not compatible because the implementation says this type may use nulls as a representation but the signature does not
diff --git a/tests/fsharp/typecheck/sigs/neg43.fs b/tests/fsharp/typecheck/sigs/neg43.fs
new file mode 100644
index 0000000..81a64cd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg43.fs
@@ -0,0 +1,15 @@
+namespace Foo
+[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+type DU = 
+ | A
+ | B of string
+ with
+   override x.ToString() = "x"
+
+namespace Foo2
+[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
+type DU = 
+ | A
+ | B of string
+ with
+   override x.ToString() = "x"
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg43.fsi b/tests/fsharp/typecheck/sigs/neg43.fsi
new file mode 100644
index 0000000..faf0740
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg43.fsi
@@ -0,0 +1,18 @@
+
+namespace Foo
+  [<CompilationRepresentationAttribute
+    (enum<CompilationRepresentationFlags> (8))>]
+  type DU =
+    | A
+    | B of string
+    with
+      override ToString : unit -> string
+    end
+
+namespace Foo2
+  type DU =
+    | A
+    | B of string
+    with
+      override ToString : unit -> string
+    end
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg44.bsl b/tests/fsharp/typecheck/sigs/neg44.bsl
new file mode 100644
index 0000000..a8aa1d6
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg44.bsl
@@ -0,0 +1,4 @@
+
+neg44.fs(6,6,6,12): typecheck error FS0365: No implementation was given for 'Type.get_Module() : Module'
+
+neg44.fs(6,6,6,12): typecheck error FS0054: This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type.
diff --git a/tests/fsharp/typecheck/sigs/neg44.fs b/tests/fsharp/typecheck/sigs/neg44.fs
new file mode 100644
index 0000000..8a17812
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg44.fs
@@ -0,0 +1,43 @@
+module Neg44
+
+open System
+open System.Reflection
+
+type MyType() = 
+    inherit Type()
+    override this.GUID : Guid= failwith "Not implemented"
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = failwith "Not implemented"
+    override this.Assembly : Assembly = failwith "Not implemented"
+    override this.FullName : string = failwith "Not implemented"
+    override this.Namespace : string = failwith "Not implemented"
+    override this.AssemblyQualifiedName : string = failwith "Not implemented"
+    override this.BaseType : Type = typeof<obj>
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo= failwith "Not implemented"
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= failwith "Not implemented"
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= failwith "Not implemented"
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo []= failwith "Not implemented"
+    override this.GetField(name: string, bindingAttr: BindingFlags) : FieldInfo= failwith "Not implemented"
+    override this.GetFields(bindingAttr: BindingFlags) : FieldInfo []= failwith "Not implemented"
+    override this.GetInterface(name: string, ignoreCase: bool) : Type = failwith "Not implemented"
+    override this.GetInterfaces() : Type[] = failwith "Not implemented"
+    override this.GetEvent(name: string, bindingAttr: BindingFlags) : EventInfo= failwith "Not implemented"
+    override this.GetEvents(bindingAttr: BindingFlags) : EventInfo []= failwith "Not implemented"
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: System.Type, types: System.Type [], modifiers: ParameterModifier []) : PropertyInfo = failwith "Not implemented"
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= failwith "Not implemented"
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = failwith "Not implemented"
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = failwith "Not implemented"
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo []= failwith "Not implemented"
+    override this.GetAttributeFlagsImpl() : TypeAttributes= failwith "Not implemented"
+    override this.IsArrayImpl() : bool= failwith "Not implemented"
+    override this.IsByRefImpl() : bool= failwith "Not implemented"
+    override this.IsPointerImpl() : bool= failwith "Not implemented"
+    override this.IsPrimitiveImpl() : bool= failwith "Not implemented"
+    override this.IsCOMObjectImpl() : bool= failwith "Not implemented"
+    override this.GetElementType() : Type= failwith "Not implemented" 
+    override this.HasElementTypeImpl() : bool= failwith "Not implemented"
+    override this.UnderlyingSystemType : Type = failwith "Not implemented"
+    override this.Name : string = failwith "Not implemented"
+    //override this.Module : Module = failwith "Not implemented"
+    override this.GetCustomAttributes(``inherit``: bool) : obj []= failwith "Not implemented"
+    override this.GetCustomAttributes(attributeType: Type, ``inherit``: bool) : obj []= failwith "Not implemented"
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented"
diff --git a/tests/fsharp/typecheck/sigs/neg45.bsl b/tests/fsharp/typecheck/sigs/neg45.bsl
new file mode 100644
index 0000000..872e098
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg45.bsl
@@ -0,0 +1,84 @@
+
+neg45.fs(12,5,12,11): typecheck error FS0685: The generic function 'Foo' must be given explicit type argument(s)
+
+neg45.fs(14,5,14,11): typecheck error FS0685: The generic function 'Foo' must be given explicit type argument(s)
+
+neg45.fs(23,5,23,11): typecheck error FS0685: The generic function 'Foo' must be given explicit type argument(s)
+
+neg45.fs(25,5,25,11): typecheck error FS0685: The generic function 'Foo' must be given explicit type argument(s)
+
+neg45.fs(34,25,34,26): typecheck error FS0465: Type inference problem too complicated (maximum iteration depth reached). Consider adding further type annotations.
+
+neg45.fs(34,25,34,26): typecheck error FS0465: Type inference problem too complicated (maximum iteration depth reached). Consider adding further type annotations.
+
+neg45.fs(41,23,41,41): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg45.fs(52,14,52,17): typecheck error FS0039: The field, constructor or member 'Foo' is not defined
+
+neg45.fs(56,16,56,31): typecheck error FS0827: This is not a valid name for an active pattern
+
+neg45.fs(72,26,72,31): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(72,10,72,19): typecheck error FS0035: This construct is deprecated: This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'.
+
+neg45.fs(73,36,73,41): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(73,36,73,41): typecheck error FS0193: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(73,20,73,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(74,42,74,47): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(75,41,75,46): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(76,35,76,40): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(77,30,77,35): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(77,30,77,35): typecheck error FS0193: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(77,20,77,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(78,38,78,43): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(79,28,79,33): typecheck error FS0193: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(79,20,79,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(79,20,79,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(80,28,80,33): typecheck error FS0193: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(80,20,80,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(80,20,80,22): typecheck error FS0340: The signature and implementation are not compatible because the declaration of the type parameter 'T' requires a constraint of the form 'T :> System.IComparable
+
+neg45.fs(81,35,81,40): typecheck error FS0001: A type parameter is missing a constraint 'when 'T :> System.IComparable'
+
+neg45.fs(89,26,89,40): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member D.M : 'a -> 'b, member D.M : 'a -> 'b
+
+neg45.fs(97,26,97,55): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member D.M : 'a -> 'b, member D.M : 'a -> 'b
+
+neg45.fs(104,26,104,31): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member D.M : 'a -> 'b, member D.M : 'a -> 'b
+
+neg45.fs(105,24,105,25): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value '0' may indicate a case not covered by the pattern(s).
+
+neg45.fs(113,53,113,54): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg45.fs(139,21,139,23): typecheck error FS0001: The type 'A1' does not support the operator 'set_Name'
+
+neg45.fs(140,17,140,19): typecheck error FS0001: The type 'A1' does not support the operator 'get_Age'
+
+neg45.fs(141,17,141,19): typecheck error FS0001: The type 'A2' does not support the operator 'get_Age'
+
+neg45.fs(142,13,142,18): typecheck error FS0001: The type 'A1' does not support the operator 'Name'
+
+neg45.fs(143,13,143,18): typecheck error FS0001: The type 'A1' does not support the operator 'Name'
+
+neg45.fs(144,13,144,23): typecheck error FS0001: The type 'A1' does not support the operator 'get_Name'
+
+neg45.fs(145,13,145,23): typecheck error FS0001: The type 'A2' does not support the operator 'get_Name'
+
+neg45.fs(146,13,146,23): typecheck error FS0001: The type 'B' has a method 'get_Name' (full name 'get_Name'), but the method is not static
+
+neg45.fs(147,15,147,25): typecheck error FS0001: The type 'StaticMutableClassExplicit' does not support the operator 'get_Name'
diff --git a/tests/fsharp/typecheck/sigs/neg45.fs b/tests/fsharp/typecheck/sigs/neg45.fs
new file mode 100644
index 0000000..372a9d8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg45.fs
@@ -0,0 +1,148 @@
+namespace global
+
+module RequiresExplicitTypeArgumentsAttributeNotRespectedForMembers_FSharp_1_0_6163 = 
+
+    type G1() =
+        [<RequiresExplicitTypeArgumentsAttribute>]
+        member x.Foo<'a>(y:'a) = printfn "first"
+        [<RequiresExplicitTypeArgumentsAttribute>]
+        member x.Foo<'a>(y:'a, ?z:int) = printfn "second"
+
+    let g1 = new G1()    
+    g1.Foo(42)         // first
+    g1.Foo<int>(42)    // first
+    g1.Foo(42, 0)      // second
+    g1.Foo<int>(42, 0) // second
+
+
+    type G2() =
+        [<RequiresExplicitTypeArgumentsAttribute>]
+        member x.Foo<'a>(y:'a, ?z:int) = printfn "second"
+
+    let g2 = new G2()    
+    g2.Foo(42)         // second
+    g2.Foo<int>(42)    // second
+    g2.Foo(42, 0)      // second
+    g2.Foo<int>(42, 0) // second
+
+
+module CompilerStackOverflowOnOperatorOverloading_FSharp_1_0_6164 = 
+    type 'a D =
+      static member inline (+)(_:^b D, _:^b) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented"
+      static member inline (+)(_:^b, _:^b D) : ^b when ^b : (static member (+) : ^b * ^b -> ^b) = failwith "Not implemented"
+ 
+    let f (x:int D) = x + 1
+
+
+module ActivePatternsShouldNotBeAllowedOnMembers = 
+
+    // No error in this class, static works great
+    type FooBar() = 
+        static member (|Foo|Bar|) (x, y) =
+            match x = y with
+            | true -> Foo
+            | false -> Bar
+    
+        member x.doSomething y =
+            match x, y with
+            | Foo -> ()  // compiles!  How is 'Foo' in scope?
+            | Bar -> ()
+    
+    match 1,2 with
+    | FooBar.Foo -> printfn "hi"  // The field, constructor or member 'Foo' is not defined
+    | _ -> ()
+    
+    type FooBar2() = 
+        member x.(|Foo|Bar|) y =
+            match x = y with
+            | true -> Foo
+            | false -> Bar
+
+        // compiler error on "Foo"    
+        member x.doSomething y =
+            let r = x.``|Foo|Bar|``  y   // compiles!
+            match r with
+            | Foo -> () // The type 'Choice<unit,unit>' is not compatible with the type 'FooBar2'
+            | Bar -> ()
+
+module CheckThatNoConstraintPropagationHappensForTypeParameters = 
+    type C<'T when 'T :> System.IComparable>() =
+        member x.P = 1
+
+    type Negative1<'T> = C<'T>
+    type Negative2<'T>() = inherit C<'T>()        /// EXPECT ERROR
+    type Negative3<'T >() = abstract X : C<'T>    /// EXPECT ERROR
+    type Negative4<'T > = UnionCase1 of C<'T>     /// EXPECT ERROR
+    type Negative5<'T > = { rf1 : C<'T> }         /// EXPECT ERROR
+    type Negative6<'T >(rf1: C<'T>) = struct end  /// EXPECT ERROR
+    type Negative7<'T > =  val rf1 : C<'T>          /// EXPECT ERROR
+    type Negative8<'T >(c: C<'T>) = member x.P = 1  /// EXPECT ERROR
+    type Negative9<'T>(x : C<'T> when 'T :> System.IComparable) = member x.P = 1  /// EXPECT ERROR
+    type Negative10<'T when 'T :> C<'T> > = member x.P = 1  /// EXPECT ERROR
+
+
+module CheckNoOverloadResolutionAgainstSignatureInformationGivenByTUpledAndRecordPatterns = 
+    module Negative1 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M { f1 = 3 }  /// EXPECT ERROR
+            member x.M({ f1 = y }) = ()
+            member x.M({ f2 = y }) = ()
+
+    module Negative2 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M (({ f1 = 3 },{ f1 = 3 }))  /// EXPECT ERROR
+            member x.M((y1: R1,y2: R1)) = ()
+            member x.M((y1: R2,y2: R1)) = ()
+        
+    module Negative3 = 
+        type R1 = { f1 : int }  /// EXPECT ERROR
+        type D() = 
+            member x.N = x.M 3
+            member x.M(1) = ()
+            member x.M(()) = ()
+
+
+module CheckInitializationGraphInStaticMembers = 
+
+    module Positive6 = 
+        type C() = 
+           static let rec x = (); (fun () -> ignore x; ())        // expect warning
+           static member A = x
+           
+    
+
+module CheckMemberConstraintNegativeCases = 
+
+    let inline staticName< ^T when ^T : (static member Name : string) > () = (^T : (static member Name : string) ())
+    let inline staticAge< ^T when ^T : (static member Age : int)> () = (^T : (static member Age : int) ())
+    let inline staticLifetime< ^T when  ^T : (static member LifeTime : System.TimeSpan) > () = (^T : (static member LifeTime : System.TimeSpan) ())
+
+    let inline name1< ^T when ^T : (member Name : int -> string) > (x:^T) = (^T : (member Name : int -> string) (x,3))
+    let inline age (x:^T) = (^T : (member Age : int) x)
+    let inline setName (x:^T) (y:string) = (^T : (member set_Name : string -> unit) (x,y))
+
+    type A1 = { Name: string }
+    type A2 = { mutable Name: string }
+    type B = { name: string } with member this.Name = this.name
+    let a1 : A1 = { Name = "a" }
+    let a2 : A2 = { Name = "a" }
+
+    type StaticMutableClassExplicit =
+        [<DefaultValue>]
+        static val mutable private Name: string
+
+    // check that static member constraints aren't satisfied by record properties
+    let _ = setName a1
+    let _ = age a1
+    let _ = age a2
+    let _ = name1<A1> { Name = "1" }
+    let _ = name1<A1>
+    let _ = staticName<A1>
+    let _ = staticName<A2>
+    let _ = staticName<B>
+    let f() = staticName<StaticMutableClassExplicit>
+    
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
new file mode 100644
index 0000000..4350b9a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -0,0 +1,38 @@
+
+neg46.fs(6,8,6,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(10,8,10,33): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(14,8,14,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(18,8,19,21): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(23,8,23,32): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(27,8,27,25): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(31,8,32,21): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(36,8,36,25): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(40,8,40,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(44,8,44,31): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(48,8,48,34): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(52,8,52,39): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(56,8,56,11): typecheck error FS0871: Constructors cannot be defined for this type
+
+neg46.fs(56,17,56,20): typecheck error FS0787: The inherited type is not an object model type
+
+neg46.fs(56,17,56,20): typecheck error FS0696: This is not a valid object construction expression. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor.
+
+neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
+
+neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
diff --git a/tests/fsharp/typecheck/sigs/neg46.fs b/tests/fsharp/typecheck/sigs/neg46.fs
new file mode 100644
index 0000000..ec75b83
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg46.fs
@@ -0,0 +1,75 @@
+// This test checks error ranges for a number of members not allowed in augmentations. It
+// also checks we actually get errors for all of these.
+module Neg46
+
+type System.Random with
+       do printfn "hello"
+       static member Factory() = 1
+
+type System.Random with
+       static let gen = Random()
+       static member Factory() = 1
+
+type System.Random with
+       static let f x = x
+       static member Factory() = 1
+
+type System.Random with
+       static let rec f x = g x 
+       and g x = f x
+       static member Factory() = 1
+
+type System.Random with
+       static let rec f x = f x 
+       static member Factory() = 1
+
+type System.Random with
+       let rec f x = f x 
+       static member Factory() = 1
+
+type System.Random with
+       let rec f x = g x 
+       and g x = f x
+       static member Factory() = 1
+
+type System.Random with
+       let rec f x = g x 
+       static member Factory() = 1
+
+type System.Random with
+       let gen = Random()
+       static member Factory() = 1
+
+type System.Random with
+       abstract M : int -> int
+       static member Factory() = 1
+
+type System.Random with
+       abstract P : int  with get
+       static member Factory() = 1
+
+type System.Random with
+       abstract P : int  with get, set
+       static member Factory() = 1
+
+type System.Random with
+       new () = { }
+       static member Factory() = 1
+
+type System.Random with
+       val x : int
+       static member Factory() = 1
+
+type System.Random with
+       static val x : int
+       static member Factory() = 1
+
+type System.Random with
+       interface System.IComparable with 
+          member x.A = 1
+       static member Factory() = 1
+
+type System.Random with
+       interface System.IComparable 
+       static member Factory() = 1
+
diff --git a/tests/fsharp/typecheck/sigs/neg47.bsl b/tests/fsharp/typecheck/sigs/neg47.bsl
new file mode 100644
index 0000000..5296465
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg47.bsl
@@ -0,0 +1,8 @@
+
+neg47.fs(18,9,18,26): typecheck error FS1221: DLLImport bindings must be static members in a class or function definitions in a module
+
+neg47.fs(24,12,24,33): typecheck error FS1221: DLLImport bindings must be static members in a class or function definitions in a module
+
+neg47.fs(29,16,29,27): typecheck error FS1221: DLLImport bindings must be static members in a class or function definitions in a module
+
+neg47.fs(33,12,33,27): typecheck error FS1221: DLLImport bindings must be static members in a class or function definitions in a module
diff --git a/tests/fsharp/typecheck/sigs/neg47.fs b/tests/fsharp/typecheck/sigs/neg47.fs
new file mode 100644
index 0000000..8d938b4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg47.fs
@@ -0,0 +1,33 @@
+module Neg47
+open System.Runtime.InteropServices
+
+type Allowed1() =
+    [<DllImport("user32.dll")>]
+    static let GetCaretBlinkTime() : int = failwith ""
+type Allowed2() = member x.P = 1
+type Allowed2 with
+    [<DllImport("user32.dll")>]
+    static member GetCaretBlinkTime() : int = failwith ""
+
+type System.Object with 
+    [<DllImport("user32.dll")>]
+    static member Allowed3() = true 
+
+type NotAllowed() =
+    [<DllImport("user32.dll")>]
+    let GetCaretBlinkTime() : int = failwith ""
+    do  
+        printf "%d" (GetCaretBlinkTime())   
+
+type NotAllowed2() =
+    [<DllImport("user32.dll")>]
+    member x.GetCaretBlinkTime() : int = failwith ""
+
+let NotAllowed3() =
+    { new obj() with 
+        [<DllImport("user32.dll")>]
+        member x.Equals(y) = true }
+
+type System.Object with 
+    [<DllImport("user32.dll")>]
+    member x.NotAllowed4() = true 
diff --git a/tests/fsharp/typecheck/sigs/neg48.bsl b/tests/fsharp/typecheck/sigs/neg48.bsl
new file mode 100644
index 0000000..4d9e739
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg48.bsl
@@ -0,0 +1,58 @@
+
+neg48.fs(40,16,40,21): typecheck error FS0023: The member 'Item1' can not be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module
+
+neg48.fs(44,21,44,26): typecheck error FS0023: The member 'Item1' can not be defined because the name 'Item1' clashes with the generated property 'Item1' in this type or module
+
+neg48.fs(48,16,48,21): typecheck error FS0023: The member 'Item2' can not be defined because the name 'Item2' clashes with the generated property 'Item2' in this type or module
+
+neg48.fs(52,21,52,26): typecheck error FS0023: The member 'Item2' can not be defined because the name 'Item2' clashes with the generated property 'Item2' in this type or module
+
+neg48.fs(56,16,56,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(56,16,56,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(60,21,60,25): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(60,21,60,25): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(64,16,64,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(64,16,64,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(68,16,68,20): typecheck error FS0023: The member 'Item' can not be defined because the name 'Item' clashes with the generated property 'Item' in this type or module
+
+neg48.fs(72,21,72,25): typecheck error FS0023: The member 'Item' can not be defined because the name 'Item' clashes with the generated property 'Item' in this type or module
+
+neg48.fs(76,16,76,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(76,16,76,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(80,21,80,25): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(80,21,80,25): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(84,16,84,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(84,16,84,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(88,21,88,24): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(88,21,88,24): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(92,16,92,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(92,16,92,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(96,16,96,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(96,16,96,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(102,16,102,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(102,16,102,19): typecheck error FS0023: The member 'Tag' can not be defined because the name 'Tag' clashes with the generated property 'Tag' in this type or module
+
+neg48.fs(105,16,105,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(105,16,105,20): typecheck error FS0023: The member 'Tags' can not be defined because the name 'Tags' clashes with the generated type 'Tags' in this type or module
+
+neg48.fs(108,16,108,20): typecheck error FS0023: The member 'Item' can not be defined because the name 'Item' clashes with the generated property 'Item' in this type or module
diff --git a/tests/fsharp/typecheck/sigs/neg48.fs b/tests/fsharp/typecheck/sigs/neg48.fs
new file mode 100644
index 0000000..bf87f38
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg48.fs
@@ -0,0 +1,108 @@
+
+module Neg48 
+
+// No errors expected in here
+module PositiveTests = 
+    type tree3 = 
+      | NodeA of int * int
+      member x.Item0 = 1 // ok
+
+    type tree3static = 
+      | NodeA of int * int
+      static member Item0 = 1 // ok
+
+    type tree3B =
+      | NodeA of int * int
+      member x.Item3 = 1 // ok
+
+    type tree4A = 
+      | NodeA 
+      member x.Item = 1 // ok
+
+    type tree5 = 
+      | NodeA of int
+
+    module M = 
+        type tree5 with 
+          member x.Tag = 1 // ok - extrinsic extension
+
+        type tree5 with 
+          member x.Tags = 1 // ok - extrinsic extension
+
+        type tree5 with 
+          member x.Item = 1 // ok - extrinsic extension
+
+
+module NegativeTEsts =
+    // more union type checks
+    type tree1A = 
+      | NodeA of int * int
+      member x.Item1 = 1 // not ok
+
+    type tree1Astatic = 
+      | NodeA of int * int
+      static member Item1 = 1 // not ok
+
+    type tree1B = 
+      | NodeA of int  * int
+      member x.Item2 = 1 // not ok
+
+    type tree1Bstatic = 
+      | NodeA of int  * int
+      static member Item2 = 1 // not ok
+
+    type tree1C = 
+      | NodeA of int * int
+      member x.Tags = 1 // not ok
+
+    type tree1Cstatic = 
+      | NodeA of int * int
+      static member Tags = 1 // not ok
+
+    type tree1D = 
+      | NodeA of int * int
+      member x.Tag = 1 // not ok
+
+    type tree2A = 
+      | NodeA of int 
+      member x.Item = 1 // not ok
+
+    type tree2Astatic = 
+      | NodeA of int 
+      static member Item = 1 // not ok
+
+    type tree2B = 
+      | NodeA of int
+      member x.Tags = 1 // not ok
+
+    type tree2Bstatic  = 
+      | NodeA of int
+      static member Tags = 1 // not ok
+
+    type tree2C = 
+      | NodeA of int 
+      member x.Tag = 1 // not ok
+
+    type tree2Cstatic = 
+      | NodeA of int 
+      static member Tag = 1 // not ok
+
+    type tree4B = 
+      | NodeA 
+      member x.Tags = 1 // not ok
+
+    type tree4C = 
+      | NodeA 
+      member x.Tag = 1 // not ok
+
+    type tree5 = 
+      | NodeA of int
+
+    type tree5 with 
+      member x.Tag = 1 // not ok - intrinsic extension
+
+    type tree5 with 
+      member x.Tags = 1 // not ok - intrinsic extension
+
+    type tree5 with 
+      member x.Item = 1 // not ok - intrinsic extension
diff --git a/tests/fsharp/typecheck/sigs/neg49.bsl b/tests/fsharp/typecheck/sigs/neg49.bsl
new file mode 100644
index 0000000..e0b7e3e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg49.bsl
@@ -0,0 +1,24 @@
+
+neg49.fs(5,17,5,18): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(5,13,5,14): typecheck error FS0031: The value 'X' will be evaluated as part of its own definition
+
+neg49.fs(8,18,8,20): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(8,13,8,15): typecheck error FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'X1' will evaluate 'X2' will evaluate 'X1'.
+
+neg49.fs(12,18,12,20): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(12,13,12,15): typecheck error FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'X1' will evaluate 'X3' will evaluate 'X1'.
+
+neg49.fs(17,18,17,20): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(17,13,17,15): typecheck error FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'X1' will evaluate 'X3' will evaluate 'X2' will evaluate 'X1'.
+
+neg49.fs(22,18,22,20): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(22,13,22,15): typecheck error FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'X1' will evaluate 'X3' will evaluate 'X1'.
+
+neg49.fs(27,18,27,20): typecheck error FS0040: This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference. This is because you are defining one or more recursive objects, rather than recursive functions. This warning may be suppressed by using '#nowarn "40"' or '--nowarn:40'.
+
+neg49.fs(27,13,27,15): typecheck error FS0031: This value will be eventually evaluated as part of its own definition. You may need to make the value lazy or a function. Value 'X1' will evaluate 'X3' will evaluate 'X1'.
diff --git a/tests/fsharp/typecheck/sigs/neg49.fs b/tests/fsharp/typecheck/sigs/neg49.fs
new file mode 100644
index 0000000..50fd3ff
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg49.fs
@@ -0,0 +1,29 @@
+
+module Neg49
+
+module Example1 = 
+    let rec X = X // expect an error
+
+module Example2 =
+    let rec X1 = X2 // expect an error
+    and X2 = X1
+
+module Example3 =
+    let rec X1 = X3 // expect an error
+    and X2 = 1
+    and X3 = X1
+
+module Example4 =
+    let rec X1 = X3 // expect an error
+    and X2 = X1
+    and X3 = X2
+
+module Example5 =
+    let rec X1 = X3 // expect an error
+    and X2() = 1
+    and X3 = X1
+
+module Example6 =
+    let rec X1 = X3 // expect an error
+    and X2() = X2()
+    and X3 = X1
diff --git a/tests/fsharp/typecheck/sigs/neg50.bsl b/tests/fsharp/typecheck/sigs/neg50.bsl
new file mode 100644
index 0000000..015dbca
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg50.bsl
@@ -0,0 +1,12 @@
+
+neg50.fs(19,28,19,36): typecheck error FS1231: The type 'En<string>' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property
+
+neg50.fs(22,28,22,40): typecheck error FS1231: The type 'En<Struct>' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property
+
+neg50.fs(25,30,25,33): typecheck error FS1231: The type 'En<'a>' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property
+
+neg50.fs(42,28,42,31): typecheck error FS1231: The type 'En' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property
+
+neg50.fs(60,28,60,31): typecheck error FS1231: The type 'En' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property
+
+neg50.fs(77,28,77,31): typecheck error FS0693: The type 'T' is not a type whose values can be enumerated with this syntax, i.e. is not compatible with either seq<_>, IEnumerable<_> or IEnumerable and does not have a GetEnumerator method
diff --git a/tests/fsharp/typecheck/sigs/neg50.fs b/tests/fsharp/typecheck/sigs/neg50.fs
new file mode 100644
index 0000000..2616cb9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg50.fs
@@ -0,0 +1,78 @@
+
+module Neg50
+
+module EnumPatternWithFunkyTypes_Dev11_13904 = 
+    [<Struct>]
+
+    type Struct =
+        val x:int
+        val y:int
+
+    type En<'a>(mvNext:'a) =
+        member x.Current = 1
+        member x.MoveNext() = mvNext
+
+    type T<'a>(mvNext:'a) =
+        member x.GetEnumerator() = En mvNext
+
+    // This is not allowed:
+    let t = seq { for i in T "test" -> i }
+
+    // This is not allowed:
+    let u = seq { for i in T (Struct()) -> i }
+
+    // This is not allowed - 'a (and the type of "a") are not known to be "bool"
+    let v a = seq { for i in T a -> i }
+
+module EnumPatternWithFunkyTypes2_Dev11_13904 = 
+    [<Struct>]
+
+    type Struct =
+        val x:int
+        val y:int
+
+    type En() =
+        member x.Current with get () = 1
+        member x.MoveNext(v:int) = true
+
+    type T() =
+        member x.GetEnumerator() = En()
+
+    // This is not allowed - MoveNext has an arg
+    let t = seq { for i in T() -> i }
+
+
+module EnumPatternWithFunkyTypes3_Dev11_13904 = 
+    [<Struct>]
+
+    type Struct =
+        val x:int
+        val y:int
+
+    type En() =
+        member x.Current with get (v:int) = 1
+        member x.MoveNext() = true
+
+    type T() =
+        member x.GetEnumerator() = En()
+
+    // This is not allowed - Current has an arg
+    let t = seq { for i in T() -> i }
+
+module EnumPatternWithFunkyTypes4_Dev11_13904 = 
+    [<Struct>]
+
+    type Struct =
+        val x:int
+        val y:int
+
+    type En() =
+        member x.Current with get () = 1
+        member x.MoveNext() = true
+
+    type T() =
+        member x.GetEnumerator(c:int) = En()
+
+    // This is not allowed - GetEnumerator has an arg
+    let t = seq { for i in T() -> i }
+
diff --git a/tests/fsharp/typecheck/sigs/neg51.bsl b/tests/fsharp/typecheck/sigs/neg51.bsl
new file mode 100644
index 0000000..d8c42f5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg51.bsl
@@ -0,0 +1,24 @@
+
+neg51.fs(10,25,10,39): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(11,25,11,45): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(12,37,12,51): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure ''u'
+
+neg51.fs(15,25,15,40): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(16,25,16,46): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(17,37,17,52): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure ''u'
+
+neg51.fs(22,5,22,17): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(27,5,27,23): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(32,5,32,17): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure ''u'
+
+neg51.fs(43,5,43,17): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(48,5,48,23): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure 'kg'
+
+neg51.fs(53,5,53,17): typecheck error FS1240: This type test or downcast will ignore the unit-of-measure ''u'
diff --git a/tests/fsharp/typecheck/sigs/neg51.fs b/tests/fsharp/typecheck/sigs/neg51.fs
new file mode 100644
index 0000000..aff4bab
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg51.fs
@@ -0,0 +1,55 @@
+// Erasure tests for units-of-measure
+module Neg51
+
+[<Measure>] type kg
+[<Measure>] type s
+
+open System.Collections.Generic
+
+// Emit warning if we try to test against a type that contains a unit-of-measure
+let testtype1 (x:obj) = x :? float<kg>
+let testtype2 (x:obj) = x :? List<float<kg>>
+let testtype3 (x:obj,y:float<'u>) = x :? float<'u>
+
+// Emit warning if we try to cast to type that contains a unit-of-measure
+let casttype1 (x:obj) = x :?> float<kg>
+let casttype2 (x:obj) = x :?> List<float<kg>>
+let casttype3 (x:obj,y:float<'u>) = x :?> float<'u>
+
+// Likewise for matching
+let matchtesttype1 (x:obj) =
+  match x with
+    :? float<kg> -> "yes"
+  | _ -> "no"
+
+let matchtesttype2 (x:obj) =
+  match x with
+    :? List<float<kg>> -> "yes"
+  | _ -> "no"
+
+let matchtesttype3 (x:obj,y:float<'u>) =
+  match x with
+    :? float<'u> -> "yes"
+  | _ -> "no"
+
+// But we should not get a warning for dimensionless types
+let matchtesttype4 (x:obj) =
+  match x with
+    :? float<1> -> "yes"
+  | _ -> "no"
+
+let matchcasttype1 (x:obj) =
+  match x with
+    :? float<kg> as x -> Some x
+  | _ -> None
+
+let matchcasttype2 (x:obj) =
+  match x with
+    :? List<float<kg>> as x -> Some x
+  | _ -> None
+
+let matchcasttype3 (x:obj,y:float<'u>) =
+  match x with
+    :? float<'u> as x -> Some x
+  | _ -> None
+
diff --git a/tests/fsharp/typecheck/sigs/neg52.bsl b/tests/fsharp/typecheck/sigs/neg52.bsl
new file mode 100644
index 0000000..2003f12
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg52.bsl
@@ -0,0 +1,12 @@
+
+neg52.fs(21,15,21,18): typecheck error FS0438: Duplicate method. The method 'Bar' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg52.fs(20,15,20,18): typecheck error FS0438: Duplicate method. The method 'Bar' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg52.fs(18,15,18,19): typecheck error FS0438: Duplicate method. The method 'Bong' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg52.fs(17,15,17,19): typecheck error FS0438: Duplicate method. The method 'Bong' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg52.fs(15,15,15,18): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
+
+neg52.fs(14,15,14,18): typecheck error FS0438: Duplicate method. The method 'Foo' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased.
diff --git a/tests/fsharp/typecheck/sigs/neg52.fs b/tests/fsharp/typecheck/sigs/neg52.fs
new file mode 100644
index 0000000..4c78711
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg52.fs
@@ -0,0 +1,24 @@
+// Erasure tests for units-of-measure: overloading
+module Neg52
+
+[<Measure>] type kg
+[<Measure>] type s
+
+open System.Collections.Generic
+
+type C<[<Measure>] 'u>() = 
+  member this.Meth() = ()
+
+// Emit error if overloaded method signatures are not distinct wrt erasure
+type T() =
+  member this.Foo(x:float<kg>) = ()
+  member this.Foo(x:float) = ()
+
+  member this.Bong(x:float32<kg>) = ()
+  member this.Bong(x:float32<s>) = ()
+
+  member this.Bar(x:C<kg>) = ()
+  member this.Bar(x:C<s>) = ()
+
+  member this.Bing(x:C<'u>) = ()
+  member this.Bing(x:C<1>) = ()
diff --git a/tests/fsharp/typecheck/sigs/neg53.bsl b/tests/fsharp/typecheck/sigs/neg53.bsl
new file mode 100644
index 0000000..3811a45
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg53.bsl
@@ -0,0 +1,2 @@
+
+neg53.fs(8,25,8,30): typecheck error FS0039: The value or constructor '_arg1' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg53.fs b/tests/fsharp/typecheck/sigs/neg53.fs
new file mode 100644
index 0000000..bfaac61
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg53.fs
@@ -0,0 +1,13 @@
+module Neg53
+
+let r = 
+    async {
+        use z = null
+        let rec loop() =
+            async {
+                let x = _arg1 // this should give an error
+                return ()
+            }
+        return! loop()
+    }
+ 
diff --git a/tests/fsharp/typecheck/sigs/neg54.bsl b/tests/fsharp/typecheck/sigs/neg54.bsl
new file mode 100644
index 0000000..5557980
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg54.bsl
@@ -0,0 +1,2 @@
+
+neg54.fs(8,25,8,30): typecheck error FS0039: The value or constructor '_arg1' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg54.fs b/tests/fsharp/typecheck/sigs/neg54.fs
new file mode 100644
index 0000000..0214e40
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg54.fs
@@ -0,0 +1,13 @@
+module Neg53
+
+let r = 
+    async {
+        let! z = failwith ""
+        let rec loop() =
+            async {
+                let x = _arg1 // this should give an error
+                return ()
+            }
+        return! loop()
+    }
+ 
diff --git a/tests/fsharp/typecheck/sigs/neg55.bsl b/tests/fsharp/typecheck/sigs/neg55.bsl
new file mode 100644
index 0000000..3c89e4d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg55.bsl
@@ -0,0 +1,6 @@
+
+neg55.fs(10,5,10,19): typecheck error FS0491: The member or object constructor '.cctor' is not accessible. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+
+neg55.fs(19,7,19,16): typecheck error FS0039: The field, constructor or member '.ctor' is not defined
+
+neg55.fs(24,22,24,31): typecheck error FS3066: Invalid member name. Members may not have name '.ctor' or '.cctor'
diff --git a/tests/fsharp/typecheck/sigs/neg55.fs b/tests/fsharp/typecheck/sigs/neg55.fs
new file mode 100644
index 0000000..3fe7811
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg55.fs
@@ -0,0 +1,25 @@
+module Neg53
+
+module Test1 = 
+    type D() = 
+
+       static let x = 1
+
+ 
+
+    D.``.cctor``()
+
+
+module Test2 = 
+    type D() = 
+
+       static let x = 1
+
+
+    D.``.ctor``()
+
+module Test3 = 
+    type D() = 
+
+       static member ``.ctor``() = 1
+
diff --git a/tests/fsharp/typecheck/sigs/neg56.bsl b/tests/fsharp/typecheck/sigs/neg56.bsl
new file mode 100644
index 0000000..3dbb248
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56.bsl
@@ -0,0 +1,10 @@
+
+neg56.fs(9,39,9,44): typecheck error FS3068: The function or member 'A' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'member C.A : unit -> 'T'.
+
+neg56.fs(12,36,12,41): typecheck error FS3068: The function or member 'A' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'member C.A : unit -> 'T'.
+
+neg56.fs(15,39,15,44): typecheck error FS3068: The function or member 'A' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'member C.A : unit -> 'T'.
+
+neg56.fs(26,30,26,43): typecheck error FS3068: The function or member 'A' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member C.A : unit -> 'T'.
+
+neg56.fs(27,30,27,40): typecheck error FS3068: The function or member 'A' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member C.A : unit -> 'T'.
diff --git a/tests/fsharp/typecheck/sigs/neg56.fs b/tests/fsharp/typecheck/sigs/neg56.fs
new file mode 100644
index 0000000..8245eb0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56.fs
@@ -0,0 +1,28 @@
+module Neg56
+
+// This should not compile. A has been generalized too early.
+// In this example, envNonRec contains "?X", later instantiated to T
+module InstanceMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = 
+    type C<'T>() = 
+        let mutable x = Unchecked.defaultof<_> // this inference variable ?X ultimately becomes T
+        member this.A() = x // We incorrectly generalize "A" here, to have type Forall T. C<T> -> unit -> ?X
+        member this.B1(c:C<string>) = c.A() 
+           // At this point during type inference, the return type of c.A() is ?X
+           // After type inference,  the return type of c.A() is 'string' by one measure and T be another - this is the inconsistency
+        member this.B2(c:C<int>) = c.A() 
+           // At this point during type inference, the return type of c.A() is ?X
+           // After type inference,  the return type of c.A() is 'int' by one measure and T be another - this is the inconsistency
+        member this.B3<'U>(c:C<'U>) = c.A() // the return type of c.A() is 'U', the return type of B1 is T
+           // At this point during type inference, the return type of c.A() is ?X
+           // After type inference,  the return type of c.A() is 'U' by one measure and T be another - this is the inconsistency
+        member this.C() = (x : 'T)
+           // At this point during type inference the inference variable ?X is inferred to be T
+
+// This should not compile. A has been generalized too early.
+module StaticMembersEarlyGeneralizationPotentiallyInvalidAndUltimatelyInconsistent = 
+    type C<'T>() = 
+        static let mutable x = Unchecked.defaultof<_> // this inference variable ultimately becomes T
+        static member A() = x // We incorrectly generalize "A" here, to 'Forall T. unit -> ?X
+        static member B1() = C<string>.A()
+        static member B2() = C<int>.A()
+        static member C() = (x : 'T)
diff --git a/tests/fsharp/typecheck/sigs/neg56_a.bsl b/tests/fsharp/typecheck/sigs/neg56_a.bsl
new file mode 100644
index 0000000..ca83218
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56_a.bsl
@@ -0,0 +1,2 @@
+
+neg56_a.fs(11,35,11,47): typecheck error FS1125: The instantiation of the generic type 'list1' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. 'list1<_>'.
diff --git a/tests/fsharp/typecheck/sigs/neg56_a.fs b/tests/fsharp/typecheck/sigs/neg56_a.fs
new file mode 100644
index 0000000..f311fdf
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56_a.fs
@@ -0,0 +1,20 @@
+module Neg56
+
+module Devdiv2_Bug_10649_repro3 = 
+    open System.Collections
+    
+    type 'a list1 = 
+        | One of 'a 
+        | Many of 'a * 'a list1
+        static member private toList = function
+            | One x -> [x]
+            | Many(x, xs) -> x :: list1.toList xs
+        
+        interface IEnumerable with
+            member this.GetEnumerator() =
+                (list1<_>.toList this :> IEnumerable).GetEnumerator()
+        
+        interface Generic.IEnumerable<'a> with
+            member this.GetEnumerator() =
+                (list1<_>.toList this :> Generic.IEnumerable<_>).GetEnumerator()
+ 
diff --git a/tests/fsharp/typecheck/sigs/neg56_b.bsl b/tests/fsharp/typecheck/sigs/neg56_b.bsl
new file mode 100644
index 0000000..c3bc36c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56_b.bsl
@@ -0,0 +1,8 @@
+
+neg56_b.fs(8,36,8,39): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member Foo.Inf : 'T ref'.
+
+neg56_b.fs(15,37,15,40): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member Foo2.Inf : 'T ref'.
+
+neg56_b.fs(26,13,26,23): typecheck error FS3068: The function or member 'Inf' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Foo.Inf : ('T list -> 'T list)'.
+
+neg56_b.fs(36,13,36,23): typecheck error FS3068: The function or member 'Foo' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is 'static member private Qux.Foo : ('T list -> 'T list)'.
diff --git a/tests/fsharp/typecheck/sigs/neg56_b.fs b/tests/fsharp/typecheck/sigs/neg56_b.fs
new file mode 100644
index 0000000..559d42b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg56_b.fs
@@ -0,0 +1,37 @@
+module Neg56
+
+// Similar repro to above, but involving a property
+
+module Devdiv2_Bug_10649_case0 = 
+    type Foo<'T>() = 
+        static member Inf = ref Unchecked.defaultof<_>
+        member this.Bar() = Foo<_>.Inf.Value : 'T 
+
+
+    // Similar repro to above, but involving a static property
+    type Foo2<'T>() = 
+        static let x = (); Unchecked.defaultof<_>
+        static member Inf = ref x
+        member this.Bar() = Foo2<_>.Inf.Value : 'T 
+
+module Devdiv2_Bug_10649 = 
+    type Foo<'T> = FooCase of 'T
+        with
+        //static member private Inf l = ignore l  // ok
+        static member private Inf = function
+            | h::t -> h :: Foo<_>.Inf t
+            | [] -> []
+        member this.Bar() =
+            let (FooCase(x)) = this
+            Foo<_>.Inf [x; x]
+ 
+
+module Devdiv2_Bug_10649_repro2 = 
+    // compiles ok
+    type Qux<'T>(x:'T) =
+        static member private Foo = function
+            | h::t -> h :: Qux<_>.Foo t
+            | [] -> []
+        member this.Bar() =
+            Qux<_>.Foo [x; x]
+ 
diff --git a/tests/fsharp/typecheck/sigs/neg57.bsl b/tests/fsharp/typecheck/sigs/neg57.bsl
new file mode 100644
index 0000000..44e6446
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg57.bsl
@@ -0,0 +1,4 @@
+
+neg57.fs(4,6,4,9): typecheck error FS0314: The type definitions in the signature and implementation are not compatible because the field 'offset' was present in the implementation but not in the signature. Struct types must now reveal their fields in the signature for the type, though the fields may still be labelled 'private' or 'internal'.
+
+neg57.fs(1,8,1,9): typecheck error FS0193: Module 'M' requires a value 'new : unit -> Foo<'T>'
diff --git a/tests/fsharp/typecheck/sigs/neg57.fs b/tests/fsharp/typecheck/sigs/neg57.fs
new file mode 100644
index 0000000..67465f1
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg57.fs
@@ -0,0 +1,6 @@
+module M
+
+[<Struct>]
+type Foo<'T> =
+   val offset : int
+   new (x:'T) = { offset = 1 } 
diff --git a/tests/fsharp/typecheck/sigs/neg57.fsi b/tests/fsharp/typecheck/sigs/neg57.fsi
new file mode 100644
index 0000000..3bea4cc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg57.fsi
@@ -0,0 +1,7 @@
+module M
+
+[<Struct>]
+type Foo<'T> =
+  // val offset : int
+   new: unit -> 'T Foo
+
diff --git a/tests/fsharp/typecheck/sigs/neg58.bsl b/tests/fsharp/typecheck/sigs/neg58.bsl
new file mode 100644
index 0000000..dfb2125
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg58.bsl
@@ -0,0 +1,8 @@
+
+neg58.fs(5,6,5,9): typecheck error FS0314: The type definitions in the signature and implementation are not compatible because the field 'offset' was present in the implementation but not in the signature. Struct types must now reveal their fields in the signature for the type, though the fields may still be labelled 'private' or 'internal'.
+
+neg58.fs(9,17,9,30): typecheck error FS0034: Module 'FooBarSoftware' contains
+    override Foo.GetEnumerator : unit -> IEnumerator<'T>    
+but its signature specifies
+    member Foo.GetEnumerator : unit -> IEnumerator<'T>    
+The compiled names differ
diff --git a/tests/fsharp/typecheck/sigs/neg58.fs b/tests/fsharp/typecheck/sigs/neg58.fs
new file mode 100644
index 0000000..91ef355
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg58.fs
@@ -0,0 +1,11 @@
+namespace FooBarSoftware
+open System.Collections
+open System.Collections.Generic
+[<Struct>]
+type Foo<'T> =
+  val offset : int
+  new (x:'T) = { offset = 1 }
+  interface IEnumerable<'T> with 
+    member this.GetEnumerator() = null :> IEnumerator<'T> 
+    member this.GetEnumerator() = null :> IEnumerator
+
diff --git a/tests/fsharp/typecheck/sigs/neg58.fsi b/tests/fsharp/typecheck/sigs/neg58.fsi
new file mode 100644
index 0000000..415aa01
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg58.fsi
@@ -0,0 +1,11 @@
+
+namespace FooBarSoftware
+open System.Collections.Generic
+[<Struct>]
+//[<Class>]
+type Foo<'T> = 
+  new : 'T -> 'T Foo
+  member public GetEnumerator: unit -> IEnumerator<'T> 
+  interface IEnumerable<'T>
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg59.bsl b/tests/fsharp/typecheck/sigs/neg59.bsl
new file mode 100644
index 0000000..5ca04e0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg59.bsl
@@ -0,0 +1,46 @@
+
+neg59.fs(9,13,9,17): typecheck error FS3096: 'join' must be followed by a variable name. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg59.fs(9,39,9,40): typecheck error FS0039: The value or constructor 'j' is not defined
+
+neg59.fs(10,24,10,25): typecheck error FS0039: The value or constructor 'j' is not defined
+
+neg59.fs(15,13,15,22): typecheck error FS3096: 'groupJoin' must be followed by a variable name. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'.
+
+neg59.fs(15,44,15,45): typecheck error FS0039: The value or constructor 'j' is not defined
+
+neg59.fs(25,23,25,40): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg59.fs(31,23,31,24): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg59.fs(36,23,36,40): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg59.fs(42,23,42,24): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg59.fs(49,15,49,27): typecheck error FS3090: An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead.
+
+neg59.fs(56,15,56,27): typecheck error FS3090: An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead.
+
+neg59.fs(63,15,63,27): typecheck error FS3163: 'match' expressions may not be used in queries
+
+neg59.fs(69,15,69,27): typecheck error FS3163: 'match' expressions may not be used in queries
+
+neg59.fs(76,15,76,18): typecheck error FS3146: 'try/with' expressions may not be used in queries
+
+neg59.fs(82,15,82,18): typecheck error FS3146: 'try/with' expressions may not be used in queries
+
+neg59.fs(89,15,89,18): typecheck error FS3141: 'try/finally' expressions may not be used in queries
+
+neg59.fs(95,15,95,18): typecheck error FS3141: 'try/finally' expressions may not be used in queries
+
+neg59.fs(102,23,102,64): typecheck error FS3142: 'use' expressions may not be used in queries
+
+neg59.fs(108,23,108,64): typecheck error FS3142: 'use' expressions may not be used in queries
+
+neg59.fs(113,15,113,25): typecheck error FS3140: 'while' expressions may not be used in queries
+
+neg59.fs(118,15,118,25): typecheck error FS3140: 'while' expressions may not be used in queries
+
+neg59.fs(124,17,124,25): typecheck error FS3144: 'return' and 'return!' may not be used in queries
+
+neg59.fs(128,17,128,26): typecheck error FS3144: 'return' and 'return!' may not be used in queries
diff --git a/tests/fsharp/typecheck/sigs/neg59.fs b/tests/fsharp/typecheck/sigs/neg59.fs
new file mode 100644
index 0000000..4fc08ce
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg59.fs
@@ -0,0 +1,132 @@
+module Neg59
+
+
+let dbOne = [[1]]
+
+let joinMustUseASimplePattern = 
+    query { for i in dbOne do 
+            // Join must use a simple pattern
+            join [i] in dbOne on (i = j)
+            select (i, j) } |> Seq.toList
+
+let groupJoinMustUseASimplePattern = 
+    query { for i in dbOne do 
+            // Join must use a simple pattern
+            groupJoin [i] in dbOne on (i = j) into group
+            select (i, group) } |> Seq.toList
+
+let functionDefinitionInQuery = 
+    query { for i in dbOne do 
+              let f (x:int) (y:int) = x 
+              select i }
+
+let recFunctionDefinitionInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              let rec f (x:int) (y:int) = f y x
+              select i }
+
+
+let recValueInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              let rec x = ((); (fun () -> x() + 1))
+              select i }
+
+let recFunctionDefinitionInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              let rec f (x:int) (y:int) = f y x
+              yield i }
+
+
+let recValueInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              let rec x = ((); (fun () -> x() + 1))
+              yield i }
+
+
+
+let ifThenElseInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              if true then
+                select i 
+              else 
+                select (i+1) }
+
+let ifThenElseInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              if true then
+                yield i 
+              else 
+                yield (i+1) }
+
+let matchInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              match 1 with 
+              | 1 -> select i 
+              | _ -> select (i+1) }
+
+let matchInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              match 1 with 
+              | 1 -> yield i 
+              | _ -> yield (i+1) }
+
+
+let tryWithInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              try 
+                select i 
+              with _ -> () }
+
+let tryWithInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              try 
+                yield i 
+              with _ -> () }
+
+
+let tryFinallyInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              try 
+                select i 
+              finally () }
+
+let tryFinallyInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              try 
+                yield i 
+              finally () }
+
+
+let useInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              use x = { new IDisposable with x.Dispose() = () }
+              select i  }
+
+
+let useInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              use x = { new IDisposable with x.Dispose() = () }
+              yield i }
+
+let whileInQueryWithCustomOperator = 
+    query { for i in dbOne do 
+              while true do 
+                select i }
+
+let whileInQueryNoCustomOperator = 
+    query { for i in dbOne do 
+              while true do 
+                yield i }
+
+
+let returnInQuery1 = 
+    query { for i in dbOne do 
+                return i }
+
+let returnFromInQuery1 = 
+    query { for i in dbOne do 
+                return! i }
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg60.bsl b/tests/fsharp/typecheck/sigs/neg60.bsl
new file mode 100644
index 0000000..b7d7181
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg60.bsl
@@ -0,0 +1,85 @@
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,24): typecheck error FS3087: The custom operation 'where' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg60.fs(65,19,65,38): typecheck error FS0001: This expression was expected to have type
+    bool    
+but here has type
+    unit    
+
+neg60.fs(71,36,71,40): typecheck error FS0043: The type 'System.Nullable<int>' does not have 'null' as a proper value. To create a null value for a Nullable type use 'System.Nullable()'.
+
+neg60.fs(77,20,77,22): typecheck error FS0001: The type 'System.Nullable<int>' does not support the operator '?>='. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.
+
+neg60.fs(77,16,77,19): typecheck error FS0043: The type 'System.Nullable<int>' does not support the operator '?>='. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.
+
+neg60.fs(78,20,78,22): typecheck error FS0001: None of the types 'System.Nullable<int>, int' support the operator '?>='. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.
+
+neg60.fs(78,16,78,19): typecheck error FS0043: None of the types 'System.Nullable<int>, int' support the operator '?>='. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.
+
+neg60.fs(79,18,79,21): typecheck error FS0001: The type ''a * 'b' does not match the type 'int'
+
+neg60.fs(79,15,79,16): typecheck error FS0043: The type ''a * 'b' does not match the type 'int'
+
+neg60.fs(80,22,80,25): typecheck error FS0001: Expecting a type supporting the operator '+' but given a tuple type
+
+neg60.fs(80,19,80,20): typecheck error FS0043: Expecting a type supporting the operator '+' but given a tuple type
+
+neg60.fs(81,22,81,34): typecheck error FS0002: This function takes too many arguments, or is used in a context where a function is not expected
+
+neg60.fs(87,14,87,15): typecheck error FS0001: The type 'System.Nullable<int>' does not support the operator '?=?'. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.
diff --git a/tests/fsharp/typecheck/sigs/neg60.fs b/tests/fsharp/typecheck/sigs/neg60.fs
new file mode 100644
index 0000000..15475f5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg60.fs
@@ -0,0 +1,87 @@
+module Neg60
+// Tests that we get an error when custom operations are overloaded
+module QuerySyntaxForAnFSharpType = 
+
+    open System
+    open Microsoft.FSharp.Quotations
+
+    type EventBuilder() = 
+        member __.For(ev:IObservable<'T>, loop:('T -> #IObservable<'U>)) : IObservable<'U> = failwith ""
+        member __.Yield(v:'T) : IObservable<'T> = failwith ""
+        member __.Quote(v:Quotations.Expr<'T>) : Expr<'T> = v
+        member __.Run(x:Expr<'T>) = Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation x :?> 'T
+         
+        [<CustomOperation("where",MaintainsVariableSpace=true)>]
+        member __.Where (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        [<CustomOperation("notValid1",MaintainsVariableSpace=true,MaintainsVariableSpaceUsingBind=true)>]
+        member __.NotValid1 (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        [<CustomOperation("notValid2",IsLikeZip=true,IsLikeJoin=true)>]
+        member __.NotValid2 (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        [<CustomOperation("notValid3",IsLikeZip=true,IsLikeGroupJoin=true)>]
+        member __.NotValid3 (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        [<CustomOperation("notValid4",IsLikeJoin=true,IsLikeGroupJoin=true)>]
+        member __.NotValid4 (x, [<ProjectionParameter>] f) = Observable.filter f x
+         
+        // Note: overloaded, this gives the error further below
+        [<CustomOperation("where")>]
+        member __.Select (x, [<ProjectionParameter>] f) = Observable.map f x
+
+        [<CustomOperation("choose")>]
+        member __.Choose (x, [<ProjectionParameter>] f) = Observable.choose f x
+
+    // intrinsic extension member
+    type EventBuilder with 
+        [<CustomOperation("action",MaintainsVariableSpace=true)>]
+        member __.Action (source:IObservable<_>, [<ProjectionParameter>] f)  = Observable.add f source; source
+
+    // extrinsic extension member
+    /// Check that a custom operator defined by an extension member works
+    [<AutoOpen>]
+    module ExtensionMembers = 
+        type EventBuilder with 
+            [<CustomOperation("scanSumBy")>]
+            member inline __.ScanSumBy (source, [<ProjectionParameter>] f : 'T -> 'U) : IObservable<'U> = Observable.scan (fun a b -> a + f b) LanguagePrimitives.GenericZero<'U> source
+
+
+    let myquery = EventBuilder()
+    let mybuilder = EventBuilder()
+
+    //---------------------------------------------------------------
+
+    type PretendForm() = 
+    
+       let event = new Event<int * int >()
+       member x.Tick = event.Trigger(10,10)
+       member x.MouseClick = event.Publish
+    //let f = new System.Windows.Forms.Form()
+    let f = new PretendForm()
+
+    let e1 =     
+      myquery { for x in f.MouseClick do 
+                  where (fst x < 100)
+                  scanSumBy (snd x) }
+
+module NullableOperators1 = 
+
+
+    let x : System.Nullable<int> = null
+
+
+module NullableOperators2 = 
+ 
+    let iq = System.Nullable<int>(10)
+    let _ = iq ?>= iq 
+    let _ = iq ?>= 10 
+    let _ = 1 + (1,2) 
+    let _ = (2,3) + (1,2) 
+    let _ = (2,3) + (fun () -> ())
+
+module NullableOperators3 = 
+ 
+    let a = new System.Nullable<int>(0)
+    let b = new System.Nullable<int>(1)
+    if a ?=? b then printfn "Same" else printfn "Differerent"
diff --git a/tests/fsharp/typecheck/sigs/neg61.bsl b/tests/fsharp/typecheck/sigs/neg61.bsl
new file mode 100644
index 0000000..d0d0ed8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg61.bsl
@@ -0,0 +1,106 @@
+
+neg61.fs(10,37,10,42): typecheck error FS3125: Invalid join relation in 'groupJoin'. Expected 'expr <op> expr', where <op> is =, =?, ?= or ?=?.
+
+neg61.fs(14,13,14,22): typecheck error FS3097: Incorrect syntax for 'groupJoin'. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'.
+
+neg61.fs(18,13,18,22): typecheck error FS3097: Incorrect syntax for 'groupJoin'. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'.
+
+neg61.fs(22,13,22,16): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(22,13,22,16): typecheck error FS0039: The value or constructor 'zip' is not defined
+
+neg61.fs(26,13,26,19): typecheck error FS3099: 'select' is used with an incorrect number of arguments. This is a custom operation in this query or computation expression. Expected 1 argument(s), but given 0.
+
+neg61.fs(30,13,30,16): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(30,13,30,16): typecheck error FS0039: The value or constructor 'zip' is not defined
+
+neg61.fs(34,13,34,22): typecheck error FS3096: 'groupJoin' must be followed by a variable name. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'.
+
+neg61.fs(34,13,34,22): typecheck error FS3167: 'groupJoin' must be followed by 'in'. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'.
+
+neg61.fs(34,13,34,22): typecheck error FS3098: 'groupJoin' must come after a 'for' selection clause and be followed by the rest of the query. Syntax: ... groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on' ...
+
+neg61.fs(38,13,38,17): typecheck error FS3096: 'join' must be followed by a variable name. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg61.fs(38,13,38,17): typecheck error FS3167: 'join' must be followed by 'in'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg61.fs(38,13,38,17): typecheck error FS3098: 'join' must come after a 'for' selection clause and be followed by the rest of the query. Syntax: ... join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on' ...
+
+neg61.fs(42,13,42,15): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(42,16,42,22): typecheck error FS3095: 'select' is not used correctly. This is a custom operation in this query or computation expression.
+
+neg61.fs(47,13,47,15): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(47,16,47,20): typecheck error FS3095: 'join' is not used correctly. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'. This is a custom operation in this query or computation expression.
+
+neg61.fs(52,13,52,15): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(52,16,52,25): typecheck error FS3095: 'groupJoin' is not used correctly. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'. This is a custom operation in this query or computation expression.
+
+neg61.fs(56,13,56,15): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(56,16,56,19): typecheck error FS0039: The value or constructor 'zip' is not defined
+
+neg61.fs(60,13,60,21): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(60,13,60,21): typecheck error FS0193: This expression is a function value, i.e. is missing arguments. Its type is  ^a ->  ^a.
+
+neg61.fs(64,13,64,20): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(69,13,69,23): typecheck error FS3140: 'while' expressions may not be used in queries
+
+neg61.fs(74,13,74,32): typecheck error FS3139: In queries, use the form 'for x in n .. m do ...' for ranging over integers
+
+neg61.fs(79,13,79,16): typecheck error FS3146: 'try/with' expressions may not be used in queries
+
+neg61.fs(86,13,86,16): typecheck error FS3141: 'try/finally' expressions may not be used in queries
+
+neg61.fs(92,21,92,70): typecheck error FS3142: 'use' expressions may not be used in queries
+
+neg61.fs(97,13,97,33): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries
+
+neg61.fs(102,13,102,28): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(102,13,102,28): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries
+
+neg61.fs(107,13,107,21): typecheck error FS3144: 'return' and 'return!' may not be used in queries
+
+neg61.fs(111,13,111,24): typecheck error FS3144: 'return' and 'return!' may not be used in queries
+
+neg61.fs(114,13,114,21): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type.
+
+neg61.fs(114,22,114,23): typecheck error FS0001: The type 'int' does not support the operator 'Truncate'
+
+neg61.fs(133,17,133,20): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg61.fs(140,17,140,20): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg61.fs(148,20,148,23): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg61.fs(156,21,156,22): typecheck error FS3147: This 'let' definition may not be used in a query. Only simple value definitions may be used in queries.
+
+neg61.fs(171,13,171,18): typecheck error FS3099: 'sumBy' is used with an incorrect number of arguments. This is a custom operation in this query or computation expression. Expected 1 argument(s), but given 0.
+
+neg61.fs(174,22,174,23): typecheck error FS0041: No overloads match for method 'Source'. The available overloads are shown below (or in the Error List window).
+neg61.fs(174,22,174,23): typecheck error FS0041: Possible overload: 'member Linq.QueryBuilder.Source : source:System.Linq.IQueryable<'T> -> Linq.QuerySource<'T,'Q>'. Type constraint mismatch. The type 
+    int    
+is not compatible with type
+    System.Linq.IQueryable<'a>    
+The type 'int' is not compatible with the type 'System.Linq.IQueryable<'a>'.
+neg61.fs(174,22,174,23): typecheck error FS0041: Possible overload: 'member Linq.QueryBuilder.Source : source:System.Collections.Generic.IEnumerable<'T> -> Linq.QuerySource<'T,System.Collections.IEnumerable>'. Type constraint mismatch. The type 
+    int    
+is not compatible with type
+    System.Collections.Generic.IEnumerable<'a>    
+The type 'int' is not compatible with the type 'System.Collections.Generic.IEnumerable<'a>'.
+
+neg61.fs(180,19,180,31): typecheck error FS3153: Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)'
+
+neg61.fs(186,19,186,31): typecheck error FS3153: Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)'
+
+neg61.fs(191,21,191,33): typecheck error FS3153: Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)'
+
+neg61.fs(197,21,197,33): typecheck error FS3153: Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)'
+
+neg61.fs(202,20,202,31): typecheck error FS3153: Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)'
diff --git a/tests/fsharp/typecheck/sigs/neg61.fs b/tests/fsharp/typecheck/sigs/neg61.fs
new file mode 100644
index 0000000..d32af70
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg61.fs
@@ -0,0 +1,203 @@
+
+module Neg61
+
+let b2 = 
+    query { for x in [1] do
+            join y in [2] on (x = y) 
+            select x }
+let b3 = 
+    query { for x in [1] do
+            groupJoin y in [2] on ( x < y) into g
+            select x }
+let b4 = 
+    query { for x in [1] do
+            groupJoin y in [2] on ( x = y)
+            select x }
+let a0 = 
+    query { for x in [1] do
+            groupJoin y in [2] on ( x = y)
+            select x }
+let a1 = 
+    query { for x in [1] do
+            zip [2] 
+            select x }
+let a2 = 
+    query { for x in [1] do
+            select }
+
+let a3 = 
+    query { for x in [1] do
+            zip }
+
+let a4 = 
+    query { for x in [1] do
+            groupJoin }
+
+let x0 = 
+    query { for x in [1] do
+            join }
+
+let x1 = 
+    query { for x in [1] do
+            id select }
+
+
+let x2 = 
+    query { for x in [1] do
+            id join }
+
+
+let x3 = 
+    query { for x in [1] do
+            id groupJoin }
+
+let x4 = 
+    query { for x in [1] do
+            id zip }
+
+let x5 = 
+    query { for c in [1..10] do
+            truncate }   
+
+let x6 = 
+    query { for c in [1..10] do
+            printfn "hello"
+            yield 1 }   
+
+let x7 = 
+    query { for c in [1..10] do
+            while true do 
+              yield 1 }   
+
+let x8 = 
+    query { for c in [1..10] do
+            for i = 1 to 100 do 
+              yield 1 }   
+
+let x9 = 
+    query { for c in [1..10] do
+            try 
+               yield 1
+            with _ -> 
+               yield 2  }   
+
+let x10 = 
+    query { for c in [1..10] do
+            try 
+               yield 1
+            finally ()  }   
+
+let x11 = 
+    query { for c in [1..10] do
+            use x = { new System.IDisposable with __.Dispose() = () }
+            yield 1  }   
+
+let x12 = 
+    query { for c in [1..10] do
+            let! x = failwith ""
+            yield 1  }   
+
+let x13 = 
+    query { for c in [1..10] do
+            do! failwith ""
+            yield 1  }   
+
+let x14 = 
+    query { for c in [1..10] do
+            return 1 }   
+
+let x15 = 
+    query { for c in [1..10] do
+            return! [1] }   
+let x16 = 
+    query { for c in [1..10] do
+            truncate 3 }   
+
+let x17ok = 
+    query {
+        for d in [1..10] do
+        let f x = x + 1 // no error expected here
+        select (f d)
+    }
+
+let x18ok = 
+    query {
+        for d in [1..10] do
+        let f x = x + 1 // no error expected here
+        select (f d)
+    }
+
+let x18rec = 
+    query {
+        for d in [1..10] do
+        let rec f x = x + 1 // error expected here - no recursive functions
+        select (f d)
+    }
+
+let x18rec2 = 
+    query {
+        for d in [1..10] do
+        let rec f x = x + 1 // error expected here - no recursive functions
+        and g x = f x + 2
+        select (f d)
+    }
+
+let x18inline = 
+    query {
+        for d in [1..10] do
+        let inline f x = x + 1 // error expected here - no inline functions
+        select (f d)
+    }
+
+
+let x18mutable = 
+    query {
+        for d in [1..10] do
+        let mutable v = 1 // error expected here - no mutable values
+        select (f d)
+    }
+
+let x19 = 
+    query {
+        for d in [1..10] do
+        let r =   // error expected here - no generic functions in quotations
+            let add (x : 'a list) y = y :: x
+            add
+        select (r [] d)
+    }
+
+let x20 = 
+    query { for c in [1..10] do
+            sumBy }   
+
+let x21 = 
+    query { for c in 1 do 
+            sumBy c }
+
+// check misuse of binary operator in sequence position
+let x23a = 
+    query { for x in ["1"] do
+            where x.Length > x
+            select x }
+
+// check misuse of binary operator in last position
+let x23b = 
+    query { for x in ["1"] do
+            where x.Length > x }
+
+// check misuse of binary operator in sequence position
+let x24a = 
+    query { for x in ["1"] do
+            groupBy x.Length + 1
+            select x }
+
+// check misuse of binary operator in last position
+let x24b = 
+    query { for x in ["1"] do
+            groupBy x.Length + 1 }
+
+// check misuse of tuple in select position
+let x24c = 
+    query { for x in ["1"] do
+            select x.Length, x }
+
diff --git a/tests/fsharp/typecheck/sigs/neg62.bsl b/tests/fsharp/typecheck/sigs/neg62.bsl
new file mode 100644
index 0000000..d2bbd52
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg62.bsl
@@ -0,0 +1,34 @@
+
+neg62.fs(5,3,5,28): typecheck error FS0902: Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(8,3,8,19): typecheck error FS0902: Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(11,3,11,12): typecheck error FS0963: This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(14,3,14,21): typecheck error FS0963: This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(13,6,13,41): typecheck error FS0037: Duplicate definition of type, exception or module 'DoBindingInClassWithoutImplicitCtor'
+
+neg62.fs(18,3,18,12): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions
+
+neg62.fs(22,5,22,14): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions
+
+neg62.fs(28,5,28,18): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions
+
+neg62.fs(31,19,31,32): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(31,19,31,32): typecheck error FS0902: Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(34,12,34,25): typecheck error FS3133: 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.
+
+neg62.fs(49,6,49,26): typecheck error FS0081: Implicit object constructors for structs must take at least one argument
+
+neg62.fs(50,12,50,21): typecheck error FS0901: Structs cannot contain value definitions because the default constructor for structs will not execute these bindings. Consider adding additional arguments to the primary constructor for the type.
+
+neg62.fs(54,26,54,34): typecheck error FS3135: To indicate that this property can be set, use 'member val PropertyName = expr with get,set'.
+
+neg62.fs(69,22,69,40): typecheck error FS0670: This code is not sufficiently generic. The type variable 'S could not be generalized because it would escape its scope.
+
+neg62.fs(75,5,75,28): typecheck error FS3151: This member, function or value declaration may not be declared 'inline'
+
+neg62.fs(80,5,80,35): typecheck error FS3151: This member, function or value declaration may not be declared 'inline'
diff --git a/tests/fsharp/typecheck/sigs/neg62.fs b/tests/fsharp/typecheck/sigs/neg62.fs
new file mode 100644
index 0000000..aaffce6
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg62.fs
@@ -0,0 +1,88 @@
+
+module Test
+
+type DoBindingInClassWithoutImplicitCtor =
+  static do printfn "hello"
+
+type StaticLetBindingInClassWithoutImplicitCtor =
+  static let x = 1
+
+type LetBindingInClassWithoutImplicitCtor =
+  let x = 1
+
+type DoBindingInClassWithoutImplicitCtor =
+  do printfn "hello"
+
+type LetAfterMember() =
+  member x.P  = 1
+  let x = 1
+
+type Bad1() = 
+    member val X = 1 + 1
+    let x = 1
+    member x.P = 1
+
+type Bad2() = 
+    interface System.ICloneable with 
+        member x.Clone() = obj()
+    let X = 1 + 1
+
+type Bad4 = 
+    static member val X = 1 + 1
+
+type Bad3 = 
+    member val X = 1 + 1
+
+type Ok1() = 
+    let p = 1
+    member val X = 1 + 1
+
+type Ok2() = 
+    let p = 1
+    member val X = 1 + 1
+
+[<Struct>]
+type S = 
+    val mutable X : int 
+
+[<Struct>]
+type StructWithValBinding() = 
+    member val S = 1 with get,set
+
+type Bad5() = 
+    let p = 1
+    member val X = 1 + 1 with set // 'set' alone not allowed
+
+type Ok3() = 
+    let p = 1
+    member val X = 1 + 1 with get,set // 'set' alone not allowed
+
+module GeneralizationBug_220377 = 
+    type F<'T> = 
+      abstract Invoke<'S> : 'S -> 'T
+
+    let foo (f:F<'T>) =
+      f.Invoke(42), f.Invoke("hi")
+
+    let res() = 
+      foo { new F<_> with
+              member x.Invoke<'S>(s:'S) = s } // 'S should not generalize, error should be reported here
+
+    let n : int * int = res()
+
+[<AbstractClass>]
+type Bad10 = 
+    abstract inline X : int
+
+
+[<AbstractClass>]
+type Bad11 = 
+    abstract inline X : int -> int
+
+
+module LeafExpressionsInQueries  = 
+
+   let f1 (xs:seq<int>) = query { for x in xs do select (fun x -> x + 1) }
+   let f2 (xs:seq<int>) = query { for x in xs do select ((); x) }
+   let f3 (xs:seq<int>) = query { for x in xs do select ((); x) }
+
diff --git a/tests/fsharp/typecheck/sigs/neg63.bsl b/tests/fsharp/typecheck/sigs/neg63.bsl
new file mode 100644
index 0000000..278d150
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg63.bsl
@@ -0,0 +1,12 @@
+
+neg63.fs(6,8,6,14): typecheck error FS3155: A quotation may not involve an assignment to or taking the address of a captured local variable
+
+neg63.fs(11,9,11,10): typecheck error FS0421: The address of the variable 'x' cannot be used at this point
+
+neg63.fs(11,9,11,10): typecheck error FS3155: A quotation may not involve an assignment to or taking the address of a captured local variable
+
+neg63.fs(11,5,11,13): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg63.fs(10,5,11,13): typecheck error FS0426: A method return type would contain byrefs which is not permitted
+
+neg63.fs(14,8,14,9): typecheck error FS3155: A quotation may not involve an assignment to or taking the address of a captured local variable
diff --git a/tests/fsharp/typecheck/sigs/neg63.fs b/tests/fsharp/typecheck/sigs/neg63.fs
new file mode 100644
index 0000000..4486ab4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg63.fs
@@ -0,0 +1,15 @@
+
+module Test
+
+let negTest1() = 
+    let mutable x = 0
+    <@ x <- 1 @>
+
+
+let negTest2() = 
+    let mutable x = 0
+    <@ &x @>
+
+let posTest1(x:byref<int>) = 
+    <@ x @>
+
diff --git a/tests/fsharp/typecheck/sigs/neg64.bsl b/tests/fsharp/typecheck/sigs/neg64.bsl
new file mode 100644
index 0000000..e9578dc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg64.bsl
@@ -0,0 +1,2 @@
+
+neg64.fsx(32,32,32,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
diff --git a/tests/fsharp/typecheck/sigs/neg64.fsx b/tests/fsharp/typecheck/sigs/neg64.fsx
new file mode 100644
index 0000000..9d0eddb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg64.fsx
@@ -0,0 +1,94 @@
+
+module M
+        
+open System  
+open System.Text  
+open Microsoft.FSharp.Collections  
+
+
+type PrettyString = 
+    | StringLiteral of String 
+    | Vertical of PrettyString * PrettyString 
+    | Horizontal of PrettyString * PrettyString 
+
+let rec Height ps = 
+    match ps with 
+    | StringLiteral(_) -> 1 
+    | Vertical(top, bottom) -> (Height top) + (Height bottom) 
+    | Horizontal(left, right) -> max (Height left) (Height right) 
+
+let rec Width ps = 
+    match ps with 
+    | StringLiteral(s) -> s.Length 
+    | Vertical(top, bottom) -> max (Width top) (Width bottom) 
+    | Horizontal(left, right) -> (Width left) + (Width right) 
+
+let rec Line ps n = 
+    match ps with 
+    | StringLiteral(s) -> if n <> 0 then "" else s 
+    | Vertical(top, bottom) ->  
+        if n < 0 || n >= Height ps 
+        then ""  
+        else if n < Height top )
+             then Line top n  
+             else Line bottom (n - Height top)  
+    | Horizontal(left, right) ->  
+        String.Concat((Line left n).PadRight(Width left),  
+                      Line right n)  
+
+let ToString ps = 
+    let sb = new StringBuilder() 
+    for i in 0 .. Height ps do  
+        sb.Append(Line ps i) |> ignore 
+        sb.Append("\n") |> ignore 
+    sb.ToString()  
+     
+let pretty s = StringLiteral(s) 
+let (%%) x y = Vertical(x,y) 
+let (++) x y = Horizontal(x,y) 
+
+let blank = pretty " " 
+
+let calendar year month =  
+    let maxDays = DateTime.DaysInMonth(year, month)  
+    // make the column that starts with day i (e.g. 1, 8, 15, 22, 29) 
+    let makeColumn i =  
+        let prettyNum (i:int) = pretty(i.ToString().PadLeft(2))  
+        let mutable r = prettyNum i  
+        let mutable j = i + 7  
+        while j <= maxDays do  
+            r <- r %% prettyNum j  
+            j <- j + 7  
+        r  
+          
+    let firstOfMonth = new DateTime(year, month, 1)  
+    let firstDayOfWeek = int firstOfMonth.DayOfWeek 
+    // create all the columns for this month's calendar, with Sundays in columns[0] 
+    let columns = Array.create 7 blank  
+    for i in 0 .. 6 do  
+        columns.[(i + firstDayOfWeek) % 7] <- makeColumn (i+1)  
+    // if, for example, the first of the month is a Tuesday, then we need Sunday and Monday 
+    // to have a blank in the first row of the calendar    
+    if firstDayOfWeek <> 0 then  
+        for i in 0 .. firstDayOfWeek-1 do  
+            columns.[i] <- blank %% columns.[i]  
+    // put the weekday headers at the top of each column 
+    let dayAbbrs = [| "Su"; "Mo"; "Tu"; "We"; "Th"; "Fr"; "Sa" |]  
+    for i in 0 .. 6 do  
+        columns.[i] <- pretty(dayAbbrs.[i]) %% columns.[i]  
+    // Horizontally concatenate all of the columns together, with blank space between columns 
+    let calendarBody = Array.reduceBack (fun x y -> x ++ blank ++ y) columns  
+    // Surely there must be a .NET call that turns a month number into its name, 
+    // but I couldn't find it when I was typing this up.  
+    let monthNames = [| "January" ; "February"; "March"; "April"; "May"; "June";   
+        "July"; "August"; "September"; "October"; "November"; "December" |]  
+    let titleBar = pretty(sprintf "%s %d" monthNames.[month-1] year)   
+    titleBar %% calendarBody 
+
+let c = calendar 2008 4 
+#if CLASSES 
+printfn "%s" (c.ToString()) 
+#else 
+printfn "%s" (ToString c) 
+#endif 
+
diff --git a/tests/fsharp/typecheck/sigs/neg64.vsbsl b/tests/fsharp/typecheck/sigs/neg64.vsbsl
new file mode 100644
index 0000000..0b2bac3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg64.vsbsl
@@ -0,0 +1,4 @@
+
+neg64.fsx(32,32,32,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
+
+neg64.fsx(32,32,32,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
diff --git a/tests/fsharp/typecheck/sigs/neg65.bsl b/tests/fsharp/typecheck/sigs/neg65.bsl
new file mode 100644
index 0000000..0637289
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg65.bsl
@@ -0,0 +1,2 @@
+
+neg65.fs(6,23,6,24): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg65.fs b/tests/fsharp/typecheck/sigs/neg65.fs
new file mode 100644
index 0000000..8894e17
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg65.fs
@@ -0,0 +1,25 @@
+module A
+
+let X1 (x:int) = x + 1
+let X2 (x:int) = x + 1
+let X3 (x:int) = x + 1
+let X4 (x:int) = x + 1)
+let X5 (x:int) = x + 1
+let X6 (x:int) = x + 1
+let X7 (x:int) = x + 1
+let X8 (x:int) = x + 1
+let X9 (x:int) = x + 1
+let X10 (x:int) = x + 1
+
+let Y1 (x:int) = x + 1
+let Y2 (x:int) = x + 1
+let Y3 (x:int) = x + 1
+let Y4 (x:int) = x + 1
+let Y5 (x:int) = x + 1
+let Y6 (x:int) = x + 1
+let Y7 (x:int) = x + 1
+let Y8 (x:int) = x + 1
+let Y9 (x:int) = x + 1
+let Y10 (x:int) = x + 1
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg66.bsl b/tests/fsharp/typecheck/sigs/neg66.bsl
new file mode 100644
index 0000000..958a768
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg66.bsl
@@ -0,0 +1,2 @@
+
+neg66.fsx(43,4,43,5): parse error FS0010: Unexpected symbol ')' in definition. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg66.fsx b/tests/fsharp/typecheck/sigs/neg66.fsx
new file mode 100644
index 0000000..5d4dc72
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg66.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g))
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg66.vsbsl b/tests/fsharp/typecheck/sigs/neg66.vsbsl
new file mode 100644
index 0000000..2a69694
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg66.vsbsl
@@ -0,0 +1,6 @@
+
+neg66.fsx(43,4,43,5): parse error FS0010: Unexpected symbol ')' in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg66.fsx(43,4,43,5): parse error FS0010: Unexpected symbol ')' in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg66.fsx(30,1,38,33): typecheck error FS0003: This value is not a function and cannot be applied
diff --git a/tests/fsharp/typecheck/sigs/neg67.bsl b/tests/fsharp/typecheck/sigs/neg67.bsl
new file mode 100644
index 0000000..dcbee8e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg67.bsl
@@ -0,0 +1,8 @@
+
+neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized
+
+neg67.fsx(41,15,41,16): parse error FS0604: Unmatched '{'
+
+neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg67.fsx b/tests/fsharp/typecheck/sigs/neg67.fsx
new file mode 100644
index 0000000..caab46a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg67.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10))
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg67.vsbsl b/tests/fsharp/typecheck/sigs/neg67.vsbsl
new file mode 100644
index 0000000..baf62da
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg67.vsbsl
@@ -0,0 +1,23 @@
+
+neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized
+
+neg67.fsx(41,15,41,16): parse error FS0604: Unmatched '{'
+
+neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token.
+
+neg67.fsx(41,36,41,37): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected '}' or other token.
+
+neg67.fsx(41,15,41,16): parse error FS0604: Unmatched '{'
+
+neg67.fsx(42,17,42,34): parse error FS0597: Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized
+
+neg67.fsx(42,35,42,36): parse error FS0010: Unexpected symbol '}' in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg67.fsx(41,9,41,14): typecheck error FS0001: This expression was expected to have type
+    unit    
+but here has type
+    Async<'a>    
+
+neg67.fsx(30,1,41,37): typecheck error FS0003: This value is not a function and cannot be applied
diff --git a/tests/fsharp/typecheck/sigs/neg68.bsl b/tests/fsharp/typecheck/sigs/neg68.bsl
new file mode 100644
index 0000000..6bc722f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg68.bsl
@@ -0,0 +1,2 @@
+
+neg68.fsx(71,46,71,47): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg68.fsx b/tests/fsharp/typecheck/sigs/neg68.fsx
new file mode 100644
index 0000000..207349a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg68.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2))>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G / d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg68.vsbsl b/tests/fsharp/typecheck/sigs/neg68.vsbsl
new file mode 100644
index 0000000..1596621
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg68.vsbsl
@@ -0,0 +1,8 @@
+
+neg68.fsx(71,46,71,47): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg68.fsx(71,46,71,47): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg68.fsx(123,40,123,41): typecheck error FS0001: The type 'bool' does not match the type 'float<'u>'
+
+neg68.fsx(123,38,123,39): typecheck error FS0043: The type 'bool' does not match the type 'float<'u>'
diff --git a/tests/fsharp/typecheck/sigs/neg69.bsl b/tests/fsharp/typecheck/sigs/neg69.bsl
new file mode 100644
index 0000000..72e8704
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg69.bsl
@@ -0,0 +1,68 @@
+
+neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(171,1,171,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token.
+
+neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument
+
+neg69.fsx(88,43,88,44): parse error FS0010: Unexpected symbol ')' in type arguments. Expected ',' or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg69.fsx b/tests/fsharp/typecheck/sigs/neg69.fsx
new file mode 100644
index 0000000..9e0c517
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg69.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s)>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg69.vsbsl b/tests/fsharp/typecheck/sigs/neg69.vsbsl
new file mode 100644
index 0000000..eac2355
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg69.vsbsl
@@ -0,0 +1,136 @@
+
+neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(171,1,171,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token.
+
+neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument
+
+neg69.fsx(88,43,88,44): parse error FS0010: Unexpected symbol ')' in type arguments. Expected ',' or other token.
+
+neg69.fsx(88,43,88,44): parse error FS0010: Unexpected symbol ')' in type arguments. Expected ',' or other token.
+
+neg69.fsx(88,43,88,44): parse error FS1241: Expected type argument or static argument
+
+neg69.fsx(88,44,88,45): parse error FS0010: Unexpected symbol '>' in type definition. Expected '=' or other token.
+
+neg69.fsx(94,5,94,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (93:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(94,5,94,8): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg69.fsx(95,5,95,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (94:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(96,5,96,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,5,98,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(98,19,98,20): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(99,5,99,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(100,5,100,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(101,5,101,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(102,5,102,11): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(104,5,104,14): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(113,1,113,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(168,1,168,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:5). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(170,1,170,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (168:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(171,1,171,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (170:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(172,1,172,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (171:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(173,1,173,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (172:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(174,1,174,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (173:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(176,1,176,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (174:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(177,1,177,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (176:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(178,1,178,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (177:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(180,1,180,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (178:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(181,1,181,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (180:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(182,1,182,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (181:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(183,1,183,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (182:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (185:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (194:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (203:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (212:1). Try indenting this token further or using standard formatting conventions.
+
+neg69.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (221:1). Try indenting this token further or using standard formatting conventions.
diff --git a/tests/fsharp/typecheck/sigs/neg70.bsl b/tests/fsharp/typecheck/sigs/neg70.bsl
new file mode 100644
index 0000000..16c15ba
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg70.bsl
@@ -0,0 +1,2 @@
+
+neg70.fsx(109,64,109,65): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg70.fsx b/tests/fsharp/typecheck/sigs/neg70.fsx
new file mode 100644
index 0000000..e5ed474
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg70.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU))-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg70.vsbsl b/tests/fsharp/typecheck/sigs/neg70.vsbsl
new file mode 100644
index 0000000..5103887
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg70.vsbsl
@@ -0,0 +1,4 @@
+
+neg70.fsx(109,64,109,65): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg70.fsx(109,64,109,65): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg71.bsl b/tests/fsharp/typecheck/sigs/neg71.bsl
new file mode 100644
index 0000000..5eb45a8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg71.bsl
@@ -0,0 +1,6 @@
+
+neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition
+
+neg71.fsx(166,24,168,1): parse error FS0010: Incomplete structured construct at or before this point in member definition. Expected incomplete structured construct at or before this point, 'end' or other token.
+
+neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg71.fsx b/tests/fsharp/typecheck/sigs/neg71.fsx
new file mode 100644
index 0000000..5fc2390
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg71.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush),rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg71.vsbsl b/tests/fsharp/typecheck/sigs/neg71.vsbsl
new file mode 100644
index 0000000..7a9e0ab
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg71.vsbsl
@@ -0,0 +1,16 @@
+
+neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition
+
+neg71.fsx(166,24,168,1): parse error FS0010: Incomplete structured construct at or before this point in member definition. Expected incomplete structured construct at or before this point, 'end' or other token.
+
+neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token.
+
+neg71.fsx(110,43,110,44): parse error FS0010: Unexpected symbol ')' in expression. Expected incomplete structured construct at or before this point or other token.
+
+neg71.fsx(166,24,168,1): parse error FS0010: Incomplete structured construct at or before this point in member definition. Expected incomplete structured construct at or before this point, 'end' or other token.
+
+neg71.fsx(230,1,230,13): parse error FS0010: Unexpected identifier in member definition
+
+neg71.fsx(168,1,168,28): typecheck error FS0960: 'let' and 'do' bindings must come before member and interface definitions in type definitions
+
+neg71.fsx(168,9,168,18): typecheck error FS0039: The value or constructor 'Simulator' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg72.bsl b/tests/fsharp/typecheck/sigs/neg72.bsl
new file mode 100644
index 0000000..e7c11aa
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg72.bsl
@@ -0,0 +1,2 @@
+
+neg72.fsx(144,106,144,107): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg72.fsx b/tests/fsharp/typecheck/sigs/neg72.fsx
new file mode 100644
index 0000000..e468111
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg72.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime)
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg72.vsbsl b/tests/fsharp/typecheck/sigs/neg72.vsbsl
new file mode 100644
index 0000000..29fc279
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg72.vsbsl
@@ -0,0 +1,4 @@
+
+neg72.fsx(144,106,144,107): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg72.fsx(144,106,144,107): parse error FS0010: Unexpected symbol ')' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg73.bsl b/tests/fsharp/typecheck/sigs/neg73.bsl
new file mode 100644
index 0000000..8ea9d75
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg73.bsl
@@ -0,0 +1,2 @@
+
+neg73.fsx(153,79,153,80): parse error FS0010: Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg73.fsx b/tests/fsharp/typecheck/sigs/neg73.fsx
new file mode 100644
index 0000000..608efd9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg73.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2]
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg73.vsbsl b/tests/fsharp/typecheck/sigs/neg73.vsbsl
new file mode 100644
index 0000000..b11767d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg73.vsbsl
@@ -0,0 +1,4 @@
+
+neg73.fsx(153,79,153,80): parse error FS0010: Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg73.fsx(153,79,153,80): parse error FS0010: Unexpected symbol ']' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg74.bsl b/tests/fsharp/typecheck/sigs/neg74.bsl
new file mode 100644
index 0000000..4f4e40c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg74.bsl
@@ -0,0 +1,56 @@
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
+
+neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg74.fsx b/tests/fsharp/typecheck/sigs/neg74.fsx
new file mode 100644
index 0000000..6721721
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg74.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km +
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg74.vsbsl b/tests/fsharp/typecheck/sigs/neg74.vsbsl
new file mode 100644
index 0000000..9696443
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg74.vsbsl
@@ -0,0 +1,114 @@
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
+
+neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(185,1,185,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(194,1,194,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(203,1,203,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(212,1,212,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(221,1,221,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(230,1,230,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(231,1,231,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(232,1,232,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(233,1,233,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(234,1,234,13): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(236,1,236,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(241,1,241,3): parse error FS0010: Unexpected symbol '[<' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(242,1,242,3): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (183:28). Try indenting this token further or using standard formatting conventions.
+
+neg74.fsx(254,1,254,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file
+
+neg74.fsx(183,52,183,53): typecheck error FS0043: The type 'unit' does not match the type 'float<AU/s>'
diff --git a/tests/fsharp/typecheck/sigs/neg75.bsl b/tests/fsharp/typecheck/sigs/neg75.bsl
new file mode 100644
index 0000000..bbd0a76
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg75.bsl
@@ -0,0 +1,10 @@
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
diff --git a/tests/fsharp/typecheck/sigs/neg75.fsx b/tests/fsharp/typecheck/sigs/neg75.fsx
new file mode 100644
index 0000000..1c3eb84
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg75.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2+
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg75.vsbsl b/tests/fsharp/typecheck/sigs/neg75.vsbsl
new file mode 100644
index 0000000..535db18
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg75.vsbsl
@@ -0,0 +1,20 @@
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg75.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
diff --git a/tests/fsharp/typecheck/sigs/neg76.bsl b/tests/fsharp/typecheck/sigs/neg76.bsl
new file mode 100644
index 0000000..2abbf43
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg76.bsl
@@ -0,0 +1,10 @@
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
diff --git a/tests/fsharp/typecheck/sigs/neg76.fsx b/tests/fsharp/typecheck/sigs/neg76.fsx
new file mode 100644
index 0000000..da7d64f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg76.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2*
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg76.vsbsl b/tests/fsharp/typecheck/sigs/neg76.vsbsl
new file mode 100644
index 0000000..c390d24
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg76.vsbsl
@@ -0,0 +1,20 @@
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(154,24,154,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(155,24,155,27): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (153:38). Try indenting this token further or using standard formatting conventions.
+
+neg76.fsx(153,24,153,27): parse error FS0588: Block following this 'let' is unfinished. Expect an expression.
diff --git a/tests/fsharp/typecheck/sigs/neg77.bsl b/tests/fsharp/typecheck/sigs/neg77.bsl
new file mode 100644
index 0000000..922e6b6
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg77.bsl
@@ -0,0 +1,6 @@
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression
diff --git a/tests/fsharp/typecheck/sigs/neg77.fsx b/tests/fsharp/typecheck/sigs/neg77.fsx
new file mode 100644
index 0000000..c354321
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg77.fsx
@@ -0,0 +1,253 @@
+module M
+//----------------------------------------------------------------------------
+// A Simple Solar System Simulator, using Units of Measure
+//
+// This sample code is provided "as is" without warranty of any kind. 
+// We disclaim all warranties, either express or implied, including the 
+// warranties of merchantability and fitness for a particular purpose. 
+
+open System
+open System.Windows.Forms
+open System.Drawing
+
+
+//-----------------------------------------------
+// Graphics System
+
+// Define a special type of form that doesn't flicker
+type SmoothForm() as x = 
+    inherit Form()
+    do x.DoubleBuffered <- true
+        
+let form = new SmoothForm(Text="F# Solar System Simulator",  Visible=true, TopMost=true, Width=500, Height=500)
+
+type IPaintObject = 
+    abstract Paint : Graphics -> unit
+    
+// Keep a list of objects to draw
+let paintObjects = new ResizeArray<IPaintObject>()
+
+form.Paint.Add (fun args -> 
+
+        let g = args.Graphics
+        // Clear the form
+        g.Clear(color=Color.Blue)
+
+        // Draw the paint objects
+        for paintObject in paintObjects do
+           paintObject.Paint(g)
+
+        // Invalidate the form again in 10 milliseconds to get continuous update
+        async { do! Async.Sleep(10)
+                form.Invalidate() } |> Async.Start
+   )
+
+// Set things going with an initial Invaldiate
+form.Invalidate()
+
+//-----------------------------------------------
+
+[<Measure>]
+type m
+
+[<Measure>]
+type s
+
+[<Measure>]
+type kg
+
+[<Measure>]
+type km
+
+[<Measure>]
+type AU
+
+[<Measure>]
+type sRealTime
+
+[<Measure>]
+type pixels
+
+let G             = 6.67e-11<m ^ 3 / (kg s^2)>
+let m_per_AU      = 149597870691.0<m/AU>
+let AU_per_m      = 1.0/m_per_AU
+let Pixels_per_AU = 200.0<pixels/AU>
+let m_per_km      = 1000.0<m/km>
+let AU_per_km     = m_per_km * AU_per_m 
+
+// Make 5 seconds into one year
+let sec_per_year = 60.0<s> * 60.0 * 24.0 * 365.0
+
+// One second of real time is 1/40th of a year of model time
+let realTimeToModelTime (x:float<sRealTime>) = float x * sec_per_year / 80.0
+
+let pixels (x:float<pixels>) = int32 x
+
+
+type Planet(ipx:float<AU>,ipy:float<AU>,
+            ivx:float<AU/s>,ivy:float<AU/s>,
+            brush:Brush,mass:float<kg>,
+            width,height) =
+
+    // For this sample e store the simulation state directly in the object
+    let mutable px = ipx
+    let mutable py = ipy
+    let mutable vx = ivx
+    let mutable vy = ivy
+    
+    member p.Mass = mass
+    member p.X with get() = px and set(v) = (px <- v)
+    member p.Y with get() = py and set(v) = (py <- v)
+    member p.VX with get() = vx and set(v) = (vx <- v)
+    member p.VY with get() = vy and set(v) = (vy <- v)
+    
+    interface IPaintObject with
+              member obj.Paint(g) =
+             
+                 let rect = Rectangle(x=pixels (px * Pixels_per_AU)-width/2,
+                                      y=pixels (py * Pixels_per_AU)-height/2,
+                                      width=width,height=height)               
+                 g.FillEllipse(brush,rect)
+                                                   
+
+type Simulator() = 
+    // Get the start time for the animation
+    let startTime = System.DateTime.Now
+    let lastTimeOption = ref None
+
+    let ComputeGravitationalAcceleration (obj:Planet) (obj2:Planet) = 
+        let dx = (obj2.X-obj.X)*m_per_AU
+        let dy = (obj2.Y-obj.Y)*m_per_AU
+        let d2 = (dx*dx) + (dy*dy)
+        let d = sqrt d2
+        let g = obj.Mass * obj2.Mass * G /d2
+        let ax = (dx / d) * g / obj.Mass
+        let ay = (dy / d) * g / obj.Mass
+        ax,ay
+
+    /// Find all the gravitational objects in the system except the given object
+    let FindObjects(obj) = 
+        [ for paintObject in paintObjects do 
+              match paintObject with
+              | :? Planet as p2 when p2 <> obj -> 
+                  yield p2,
+              | _ -> 
+                  yield! [] ]
+
+    member sim.Step(time:TimeSpan) = 
+        match !lastTimeOption with
+        | None -> ()
+        | Some(lastTime) -> 
+           for paintObject in paintObjects do
+               match paintObject with
+               | :? Planet as obj -> 
+                   let timeStep = (time - lastTime).TotalSeconds * 1.0<sRealTime> |>  realTimeToModelTime
+                   obj.X <- obj.X + timeStep * obj.VX
+                   obj.Y <- obj.Y + timeStep * obj.VY
+
+                   // Find all the gravitational objects in the system
+                   let objects = FindObjects(obj)
+
+                   // For each object, apply its gravitational field to this object
+                   for obj2 in objects do 
+                       let (ax,ay) = ComputeGravitationalAcceleration obj obj2
+                       obj.VX <- obj.VX + timeStep * ax * AU_per_m 
+                       obj.VY <- obj.VY + timeStep * ay * AU_per_m 
+               | _ ->  ()
+
+        lastTimeOption := Some time 
+
+    member sim.Start() = 
+        async { while true do 
+                   let time = System.DateTime.Now - startTime
+                   // Sleep a little to give better GUI updates
+                   do! Async.Sleep(1) 
+                   sim.Step(time) } 
+        |> Async.Start
+
+let s = Simulator().Start() 
+
+let massOfEarth   = 5.9742e24<kg>
+let massOfMoon    = 7.3477e22<kg>
+let massOfMercury = 3.3022e23<kg>
+let massOfVenus   = 4.8685e24<kg>
+let massOfSun     = 1.98892e30<kg>
+
+let mercuryDistanceFromSun  = 57910000.0<km> * AU_per_km
+let venusDistanceFromSun    = 0.723332<AU>
+let distanceFromMoonToEarth =384403.0<km> * AU_per_km
+
+let orbitalSpeedOfMoon   = 1.023<km/s> * AU_per_km
+let orbitalSpeedOfMecury = 47.87<km/s> * AU_per_km
+let orbitalSpeedOfVenus  = 35.02<km/s> * AU_per_km
+let orbitalSpeedOfEarth  = 29.8<km/s>  * AU_per_km 
+
+let sun   = new Planet(ipx=1.1<AU>,                        
+                       ipy=1.1<AU>,
+                       ivx=0.0<AU/s>,
+                       ivy=0.0<AU/s>,
+                       brush=Brushes.Yellow,
+                       mass=massOfSun,
+                       width=20,
+                       height=20)
+
+let mercury = new Planet(ipx=sun.X+mercuryDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfMecury,
+                       brush=Brushes.Goldenrod,
+                       mass=massOfMercury,
+                       width=10,
+                       height=10)
+
+let venus = new Planet(ipx=sun.X+venusDistanceFromSun,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfVenus,
+                       brush=Brushes.BlanchedAlmond,
+                       mass=massOfVenus,
+                       width=10,
+                       height=10)
+
+let earth = new Planet(ipx=sun.X+1.0<AU>,
+                       ipy=sun.Y,
+                       ivx=0.0<AU/s>,
+                       ivy=orbitalSpeedOfEarth,
+                       brush=Brushes.Green,
+                       mass=massOfEarth,
+                       width=10,
+                       height=10)
+
+let moon  = new Planet(ipx=earth.X+distanceFromMoonToEarth,
+                       ipy=earth.Y,
+                       ivx=earth.VX,
+                       ivy=earth.VY+orbitalSpeedOfMoon,
+                       brush=Brushes.White,
+                       mass=massOfMoon,
+                       width=2,
+                       height=2)
+
+paintObjects.Add(sun)
+paintObjects.Add(mercury)
+paintObjects.Add(venus)
+paintObjects.Add(earth)
+paintObjects.Add(moon)
+
+form.Show()
+
+
+
+#if COMPILED
+[<STAThread>]
+do Application.Run(form)
+#endif
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg77.vsbsl b/tests/fsharp/typecheck/sigs/neg77.vsbsl
new file mode 100644
index 0000000..4483229
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg77.vsbsl
@@ -0,0 +1,14 @@
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions.
+
+neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression
+
+neg77.fsx(153,75,153,79): typecheck error FS0001: The type 'Planet * 'a' is not compatible with the type 'Planet'
diff --git a/tests/fsharp/typecheck/sigs/neg78.bsl b/tests/fsharp/typecheck/sigs/neg78.bsl
new file mode 100644
index 0000000..38d7bec
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg78.bsl
@@ -0,0 +1,2 @@
+
+neg78.fsx(3,15,3,17): parse error FS0010: Unexpected symbol '..' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg78.fsx b/tests/fsharp/typecheck/sigs/neg78.fsx
new file mode 100644
index 0000000..cd97e13
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg78.fsx
@@ -0,0 +1,4 @@
+module M
+
+let x = System..
+
diff --git a/tests/fsharp/typecheck/sigs/neg78.vsbsl b/tests/fsharp/typecheck/sigs/neg78.vsbsl
new file mode 100644
index 0000000..5857bfb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg78.vsbsl
@@ -0,0 +1,4 @@
+
+neg78.fsx(3,15,3,17): parse error FS0010: Unexpected symbol '..' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg78.fsx(3,15,3,17): parse error FS0010: Unexpected symbol '..' in binding. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg79.bsl b/tests/fsharp/typecheck/sigs/neg79.bsl
new file mode 100644
index 0000000..b5599e2
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg79.bsl
@@ -0,0 +1,2 @@
+
+neg79.fsx(31,32,31,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
diff --git a/tests/fsharp/typecheck/sigs/neg79.fsx b/tests/fsharp/typecheck/sigs/neg79.fsx
new file mode 100644
index 0000000..3ca8ec5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg79.fsx
@@ -0,0 +1,93 @@
+module M
+        
+open System  
+open System.Text  
+open Microsoft.FSharp.Collections  
+
+
+type PrettyString = 
+    | StringLiteral of String 
+    | Vertical of PrettyString * PrettyString 
+    | Horizontal of PrettyString * PrettyString 
+
+let rec Height ps = 
+    match ps with 
+    | StringLiteral(_) -> 1 
+    | Vertical(top, bottom) -> (Height top) + (Height bottom) 
+    | Horizontal(left, right) -> max (Height left) (Height right) 
+
+let rec Width ps = 
+    match ps with 
+    | StringLiteral(s) -> s.Length 
+    | Vertical(top, bottom) -> max (Width top) (Width bottom) 
+    | Horizontal(left, right) -> (Width left) + (Width right) 
+
+let rec Line ps n = 
+    match ps with 
+    | StringLiteral(s) -> if n <> 0 then "" else s 
+    | Vertical(top, bottom) ->  
+        if n < 0 || n >= Height ps 
+        then ""  
+        else if n < Height top )
+             then Line top n  
+             else Line bottom (n - Height top)  
+    | Horizontal(left, right) ->  
+        String.Concat((Line left n).PadRight(Width left),  
+                      Line right n)  
+
+let ToString ps = 
+    let sb = new StringBuilder() 
+    for i in 0 .. Height ps do  
+        sb.Append(Line ps i) |> ignore 
+        sb.Append("\n") |> ignore 
+    sb.ToString()  
+     
+let pretty s = StringLiteral(s) 
+let (%%) x y = Vertical(x,y) 
+let (++) x y = Horizontal(x,y) 
+
+let blank = pretty " " 
+
+let calendar year month =  
+    let maxDays = DateTime.DaysInMonth(year, month)  
+    // make the column that starts with day i (e.g. 1, 8, 15, 22, 29) 
+    let makeColumn i =  
+        let prettyNum (i:int) = pretty(i.ToString().PadLeft(2))  
+        let mutable r = prettyNum i  
+        let mutable j = i + 7  
+        while j <= maxDays do  
+            r <- r %% prettyNum j  
+            j <- j + 7  
+        r  
+          
+    let firstOfMonth = new DateTime(year, month, 1)  
+    let firstDayOfWeek = int firstOfMonth.DayOfWeek 
+    // create all the columns for this month's calendar, with Sundays in columns[0] 
+    let columns = Array.create 7 blank  
+    for i in 0 .. 6 do  
+        columns.[(i + firstDayOfWeek) % 7] <- makeColumn (i+1)  
+    // if, for example, the first of the month is a Tuesday, then we need Sunday and Monday 
+    // to have a blank in the first row of the calendar    
+    if firstDayOfWeek <> 0 then  
+        for i in 0 .. firstDayOfWeek-1 do  
+            columns.[i] <- blank %% columns.[i]  
+    // put the weekday headers at the top of each column 
+    let dayAbbrs = [| "Su"; "Mo"; "Tu"; "We"; "Th"; "Fr"; "Sa" |]  
+    for i in 0 .. 6 do  
+        columns.[i] <- pretty(dayAbbrs.[i]) %% columns.[i]  
+    // Horizontally concatenate all of the columns together, with blank space between columns 
+    let calendarBody = Array.reduceBack (fun x y -> x ++ blank ++ y) columns  
+    // Surely there must be a .NET call that turns a month number into its name, 
+    // but I couldn't find it when I was typing this up.  
+    let monthNames = [| "January" ; "February"; "March"; "April"; "May"; "June";   
+        "July"; "August"; "September"; "October"; "November"; "December" |]  
+    let titleBar = pretty(sprintf "%s %d" monthNames.[month-1] year)   
+    titleBar %% calendarBody 
+
+let c = calendar 2008 4 
+#if CLASSES 
+printfn "%s" (c.ToString()) 
+#else 
+printfn "%s" (ToString c) 
+#endif 
+
diff --git a/tests/fsharp/typecheck/sigs/neg79.vsbsl b/tests/fsharp/typecheck/sigs/neg79.vsbsl
new file mode 100644
index 0000000..5527cab
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg79.vsbsl
@@ -0,0 +1,4 @@
+
+neg79.fsx(31,32,31,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
+
+neg79.fsx(31,32,31,33): parse error FS0010: Unexpected symbol ')' in if/then/else expression
diff --git a/tests/fsharp/typecheck/sigs/neg80.bsl b/tests/fsharp/typecheck/sigs/neg80.bsl
new file mode 100644
index 0000000..86e8d40
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg80.bsl
@@ -0,0 +1,2 @@
+
+neg80.fsx(79,5,79,6): parse error FS0010: Unexpected symbol '|' in pattern matching
diff --git a/tests/fsharp/typecheck/sigs/neg80.fsx b/tests/fsharp/typecheck/sigs/neg80.fsx
new file mode 100644
index 0000000..27514d4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg80.fsx
@@ -0,0 +1,145 @@
+module M
+        
+open System  
+open System.Text  
+open Microsoft.FSharp.Collections  
+
+#if CLASSES 
+/// PrettyStrings are strings that support vertical and horizontal concatenation 
+/// for creating grids of text. 
+[<AbstractClass>] 
+type PrettyString() =  
+    /// The number of lines in this PrettyString 
+    abstract Height : int  
+    /// The width of this PrettyString (width of the longest line) 
+    abstract Width : int  
+    /// Get the nth line.  If n is not in the range [0..Height), then return the empty string. 
+    abstract Line : int -> string  
+    override this.ToString() =   
+        let sb = new StringBuilder()  
+        for i in 0 .. this.Height do  
+            sb.Append(this.Line i) |> ignore 
+            sb.Append("\n") |> ignore 
+        sb.ToString()  
+
+type StringLiteral(s : String) =  
+    inherit PrettyString() 
+    // TODO: if the input string contains newline characters, 
+    // things will be ugly.  Ignoring that issue for now. 
+    override this.Height = 1  
+    override this.Width = s.Length  
+    override this.Line n = if n <> 0 then "" else s  
+      
+type Vertical(top : PrettyString, bottom : PrettyString) =  
+    inherit PrettyString () 
+    override this.Height = top.Height + bottom.Height  
+    override this.Width = Math.Max(top.Width, bottom.Width)  
+    override this.Line n =  
+        if n < 0 || n >= this.Height   
+        then ""  
+        else if n < top.Height  
+             then top.Line n  
+             else bottom.Line (n - top.Height)  
+
+type Horizontal(left : PrettyString, right : PrettyString) =  
+    inherit PrettyString() 
+    override this.Height = Math.Max(left.Height, right.Height)  
+    override this.Width = left.Width + right.Width  
+    override this.Line n =  
+        String.Concat(left.Line(n).PadRight(left.Width),  
+                      right.Line(n))  
+
+let pretty s = new StringLiteral(s) :> PrettyString   
+let (%%) x y = new Vertical(x,y) :> PrettyString  
+let (++) x y = new Horizontal(x,y) :> PrettyString 
+
+#else 
+
+type PrettyString = 
+    | StringLiteral of String 
+    | Vertical of PrettyString * PrettyString
+    | Horizontal of PrettyString * PrettyString 
+
+let rec Height ps = 
+    match ps with 
+    | StringLiteral(_) -> 1 
+    | Vertical(top, bottom) -> (Height top) + (Height bottom) 
+    | Horizontal(left, right) -> max (Height left) (Height right) 
+
+let rec Width ps = 
+    match ps with 
+    | StringLiteral(s) -> s.Length 
+    | Vertical(top, bottom) -> max (Width top) (Width bottom) 
+    | Horizontal(left, right) -> (Width left) + (Width right) 
+
+let rec Line ps n =
+    match ps with 
+    | StringLiteral(s) -> if n <> 0 then "" else s 
+    | Vertical(top, bottom) ->  
+    | Vertical(top, bottom) ->  
+        if n < 0 || n >= Height ps 
+        then ""  
+        else if n < Height top 
+             then Line top n  
+             else Line bottom (n - Height top)  
+    | Horizontal(left, right) ->  
+        String.Concat((Line left n).PadRight(Width left),  
+                      Line right n)  
+
+let ToString ps = 
+    let sb = new StringBuilder() 
+    for i in 0 .. Height ps do  
+        sb.Append(Line ps i) |> ignore 
+        sb.Append("\n") |> ignore 
+    sb.ToString()  
+     
+let pretty s = StringLiteral(s) 
+let (%%) x y = Vertical(x,y) 
+let (++) x y = Horizontal(x,y) 
+#endif 
+
+let blank = pretty " " 
+
+let calendar year month =  
+    let maxDays = DateTime.DaysInMonth(year, month)  
+    // make the column that starts with day i (e.g. 1, 8, 15, 22, 29) 
+    let makeColumn i =  
+        let prettyNum (i:int) = pretty(i.ToString().PadLeft(2))  
+        let mutable r = prettyNum i  
+        let mutable j = i + 7  
+        while j <= maxDays do  
+            r <- r %% prettyNum j  
+            j <- j + 7  
+        r  
+          
+    let firstOfMonth = new DateTime(year, month, 1)  
+    let firstDayOfWeek = int firstOfMonth.DayOfWeek 
+    // create all the columns for this month's calendar, with Sundays in columns[0] 
+    let columns = Array.create 7 blank  
+    for i in 0 .. 6 do  
+        columns.[(i + firstDayOfWeek) % 7] <- makeColumn (i+1)  
+    // if, for example, the first of the month is a Tuesday, then we need Sunday and Monday 
+    // to have a blank in the first row of the calendar    
+    if firstDayOfWeek <> 0 then  
+        for i in 0 .. firstDayOfWeek-1 do  
+            columns.[i] <- blank %% columns.[i]  
+    // put the weekday headers at the top of each column 
+    let dayAbbrs = [| "Su"; "Mo"; "Tu"; "We"; "Th"; "Fr"; "Sa" |]  
+    for i in 0 .. 6 do  
+        columns.[i] <- pretty(dayAbbrs.[i]) %% columns.[i]  
+    // Horizontally concatenate all of the columns together, with blank space between columns 
+    let calendarBody = Array.reduceBack (fun x y -> x ++ blank ++ y) columns  
+    // Surely there must be a .NET call that turns a month number into its name, 
+    // but I couldn't find it when I was typing this up.  
+    let monthNames = [| "January" ; "February"; "March"; "April"; "May"; "June";   
+        "July"; "August"; "September"; "October"; "November"; "December" |]  
+    let titleBar = pretty(sprintf "%s %d" monthNames.[month-1] year)   
+    titleBar %% calendarBody 
+
+let c = calendar 2008 4 
+#if CLASSES 
+printfn "%s" (c.ToString()) 
+#else 
+printfn "%s" (ToString c) 
+#endif 
+
diff --git a/tests/fsharp/typecheck/sigs/neg80.vsbsl b/tests/fsharp/typecheck/sigs/neg80.vsbsl
new file mode 100644
index 0000000..750b8fd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg80.vsbsl
@@ -0,0 +1,11 @@
+
+neg80.fsx(79,5,79,6): parse error FS0010: Unexpected symbol '|' in pattern matching
+
+neg80.fsx(79,5,79,6): parse error FS0010: Unexpected symbol '|' in pattern matching
+
+neg80.fsx(79,6,79,6): typecheck error FS0001: This expression was expected to have type
+    string    
+but here has type
+    unit    
+
+neg80.fsx(76,11,76,13): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Horizontal (_, _)' may indicate a case not covered by the pattern(s).
diff --git a/tests/fsharp/typecheck/sigs/neg81.bsl b/tests/fsharp/typecheck/sigs/neg81.bsl
new file mode 100644
index 0000000..7deb26c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg81.bsl
@@ -0,0 +1,14 @@
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword.
+
+neg81.fsx(8,1,8,5): parse error FS0010: Unexpected keyword 'type' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression
diff --git a/tests/fsharp/typecheck/sigs/neg81.fsx b/tests/fsharp/typecheck/sigs/neg81.fsx
new file mode 100644
index 0000000..b25e7f8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg81.fsx
@@ -0,0 +1,9 @@
+module M
+
+let y = 1
+
+let f() = 
+    y+
+
+type C() = 
+   member x.P = 1
diff --git a/tests/fsharp/typecheck/sigs/neg81.vsbsl b/tests/fsharp/typecheck/sigs/neg81.vsbsl
new file mode 100644
index 0000000..dc19e54
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg81.vsbsl
@@ -0,0 +1,28 @@
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.
+
+neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword.
+
+neg81.fsx(8,1,8,5): parse error FS0010: Unexpected keyword 'type' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:5). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(8,1,8,5): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (5:1). Try indenting this token further or using standard formatting conventions.
+
+neg81.fsx(6,6,6,7): parse error FS3156: Unexpected token '+' or incomplete expression
+
+neg81.fsx(8,1,8,5): parse error FS0010: Unexpected keyword 'type' in binding. Expected incomplete structured construct at or before this point or other token.
+
+neg81.fsx(5,1,5,4): parse error FS3118: Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword.
+
+neg81.fsx(10,1,10,1): parse error FS0010: Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.
diff --git a/tests/fsharp/typecheck/sigs/neg82.bsl b/tests/fsharp/typecheck/sigs/neg82.bsl
new file mode 100644
index 0000000..5e12949
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg82.bsl
@@ -0,0 +1,22 @@
+
+neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(95,1,95,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (88:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token.
+
+neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression
diff --git a/tests/fsharp/typecheck/sigs/neg82.fsx b/tests/fsharp/typecheck/sigs/neg82.fsx
new file mode 100644
index 0000000..0a6899d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg82.fsx
@@ -0,0 +1,144 @@
+module M
+        
+open System  
+open System.Text  
+open Microsoft.FSharp.Collections  
+
+#if CLASSES 
+/// PrettyStrings are strings that support vertical and horizontal concatenation 
+/// for creating grids of text. 
+[<AbstractClass>] 
+type PrettyString() =  
+    /// The number of lines in this PrettyString 
+    abstract Height : int  
+    /// The width of this PrettyString (width of the longest line) 
+    abstract Width : int  
+    /// Get the nth line.  If n is not in the range [0..Height), then return the empty string. 
+    abstract Line : int -> string  
+    override this.ToString() =   
+        let sb = new StringBuilder()  
+        for i in 0 .. this.Height do  
+            sb.Append(this.Line i) |> ignore 
+            sb.Append("\n") |> ignore 
+        sb.ToString()  
+
+type StringLiteral(s : String) =  
+    inherit PrettyString() 
+    // TODO: if the input string contains newline characters, 
+    // things will be ugly.  Ignoring that issue for now. 
+    override this.Height = 1  
+    override this.Width = s.Length  
+    override this.Line n = if n <> 0 then "" else s  
+      
+type Vertical(top : PrettyString, bottom : PrettyString) =  
+    inherit PrettyString () 
+    override this.Height = top.Height + bottom.Height  
+    override this.Width = Math.Max(top.Width, bottom.Width)  
+    override this.Line n =  
+        if n < 0 || n >= this.Height   
+        then ""  
+        else if n < top.Height  
+             then top.Line n  
+             else bottom.Line (n - top.Height)  
+
+type Horizontal(left : PrettyString, right : PrettyString) =  
+    inherit PrettyString() 
+    override this.Height = Math.Max(left.Height, right.Height)  
+    override this.Width = left.Width + right.Width  
+    override this.Line n =  
+        String.Concat(left.Line(n).PadRight(left.Width),  
+                      right.Line(n))  
+
+let pretty s = new StringLiteral(s) :> PrettyString   
+let (%%) x y = new Vertical(x,y) :> PrettyString  
+let (++) x y = new Horizontal(x,y) :> PrettyString 
+
+#else 
+
+type PrettyString = 
+    | StringLiteral of String 
+    | Vertical of PrettyString * PrettyString
+    | Horizontal of PrettyString * PrettyString 
+
+let rec Height ps = 
+    match ps with 
+    | StringLiteral(_) -> 1 
+    | Vertical(top, bottom) -> (Height top) + (Height bottom) 
+    | Horizontal(left, right) -> max (Height left) (Height right) 
+
+let rec Width ps = 
+    match ps with 
+    | StringLiteral(s) -> s.Length 
+    | Vertical(top, bottom) -> max (Width top) (Width bottom) 
+    | Horizontal(left, right) -> (Width left) + (Width right) 
+
+let rec Line ps n = 
+    match ps with 
+    | StringLiteral(s) -> if n <> 0 then "" else s 
+    | Vertical(top, bottom) ->  
+        if n < 0 || n >= Height ps 
+        then ""  
+        else if n < Height top 
+             then Line top n  
+             else Line bottom (n - Height top
+    | Horizontal(left, right) ->  
+        String.Concat((Line left n).PadRight(Width left),  
+                      Line right n)  
+
+let ToString ps = 
+    let sb = new StringBuilder() 
+    for i in 0 .. Height ps do  
+        sb.Append(Line ps i) |> ignore 
+        sb.Append("\n") |> ignore 
+    sb.ToString()  
+     
+let pretty s = StringLiteral(s) 
+let (%%) x y = Vertical(x,y) 
+let (++) x y = Horizontal(x,y) 
+#endif 
+
+let blank = pretty " " 
+
+let calendar year month =  
+    let maxDays = DateTime.DaysInMonth(year, month)  
+    // make the column that starts with day i (e.g. 1, 8, 15, 22, 29) 
+    let makeColumn i =  
+        let prettyNum (i:int) = pretty(i.ToString().PadLeft(2))  
+        let mutable r = prettyNum i  
+        let mutable j = i + 7  
+        while j <= maxDays do  
+            r <- r %% prettyNum j  
+            j <- j + 7  
+        r  
+          
+    let firstOfMonth = new DateTime(year, month, 1)  
+    let firstDayOfWeek = int firstOfMonth.DayOfWeek 
+    // create all the columns for this month's calendar, with Sundays in columns[0] 
+    let columns = Array.create 7 blank  
+    for i in 0 .. 6 do  
+        columns.[(i + firstDayOfWeek) % 7] <- makeColumn (i+1)  
+    // if, for example, the first of the month is a Tuesday, then we need Sunday and Monday 
+    // to have a blank in the first row of the calendar    
+    if firstDayOfWeek <> 0 then  
+        for i in 0 .. firstDayOfWeek-1 do  
+            columns.[i] <- blank %% columns.[i]  
+    // put the weekday headers at the top of each column 
+    let dayAbbrs = [| "Su"; "Mo"; "Tu"; "We"; "Th"; "Fr"; "Sa" |]  
+    for i in 0 .. 6 do  
+        columns.[i] <- pretty(dayAbbrs.[i]) %% columns.[i]  
+    // Horizontally concatenate all of the columns together, with blank space between columns 
+    let calendarBody = Array.reduceBack (fun x y -> x ++ blank ++ y) columns  
+    // Surely there must be a .NET call that turns a month number into its name, 
+    // but I couldn't find it when I was typing this up.  
+    let monthNames = [| "January" ; "February"; "March"; "April"; "May"; "June";   
+        "July"; "August"; "September"; "October"; "November"; "December" |]  
+    let titleBar = pretty(sprintf "%s %d" monthNames.[month-1] year)   
+    titleBar %% calendarBody 
+
+let c = calendar 2008 4 
+#if CLASSES 
+printfn "%s" (c.ToString()) 
+#else 
+printfn "%s" (ToString c) 
+#endif 
+
diff --git a/tests/fsharp/typecheck/sigs/neg82.vsbsl b/tests/fsharp/typecheck/sigs/neg82.vsbsl
new file mode 100644
index 0000000..2b274cd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg82.vsbsl
@@ -0,0 +1,46 @@
+
+neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(95,1,95,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (88:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token.
+
+neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression
+
+neg82.fsx(84,5,84,6): parse error FS0010: Unexpected symbol '|' in expression
+
+neg82.fsx(84,17,84,18): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(88,1,88,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (83:19). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(90,5,90,8): parse error FS0010: Incomplete structured construct at or before this point in expression. Expected incomplete structured construct at or before this point or other token.
+
+neg82.fsx(95,1,95,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (88:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(95,1,95,4): parse error FS0010: Unexpected keyword 'let' or 'use' in implementation file
+
+neg82.fsx(96,1,96,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (95:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(97,1,97,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (96:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(100,1,100,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (97:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(102,1,102,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (100:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(138,1,138,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (102:1). Try indenting this token further or using standard formatting conventions.
+
+neg82.fsx(93,5,93,7): typecheck error FS0039: The namespace or module 'sb' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg83.bsl b/tests/fsharp/typecheck/sigs/neg83.bsl
new file mode 100644
index 0000000..641ecf8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg83.bsl
@@ -0,0 +1,6 @@
+
+neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions.
+
+neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression
+
+neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression
diff --git a/tests/fsharp/typecheck/sigs/neg83.fsx b/tests/fsharp/typecheck/sigs/neg83.fsx
new file mode 100644
index 0000000..2a08f47
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg83.fsx
@@ -0,0 +1,15 @@
+module M
+
+let f (xs:string list) = 
+   match xs  with 
+   | [] -> 
+        xs 
+        |> List.map (fun x -> x 
+        |> List.map (fun x -> x + "a") 
+
+    | h::t -> []
+
+
+["1"] 
+|> List.map (fun x -> x 
+|> List.map (fun x -> x + "a") 
diff --git a/tests/fsharp/typecheck/sigs/neg83.vsbsl b/tests/fsharp/typecheck/sigs/neg83.vsbsl
new file mode 100644
index 0000000..69d51b3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg83.vsbsl
@@ -0,0 +1,12 @@
+
+neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions.
+
+neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression
+
+neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression
+
+neg83.fsx(10,5,10,6): parse error FS0010: Unexpected symbol '|' in expression
+
+neg83.fsx(13,1,13,2): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (6:9). Try indenting this token further or using standard formatting conventions.
+
+neg83.fsx(16,1,16,1): parse error FS0010: Incomplete structured construct at or before this point in expression
diff --git a/tests/fsharp/typecheck/sigs/neg84.bsl b/tests/fsharp/typecheck/sigs/neg84.bsl
new file mode 100644
index 0000000..6d4db3a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg84.bsl
@@ -0,0 +1,2 @@
+
+neg84.fsx(11,1,11,1): parse error FS0010: Incomplete structured construct at or before this point in expression
diff --git a/tests/fsharp/typecheck/sigs/neg84.fsx b/tests/fsharp/typecheck/sigs/neg84.fsx
new file mode 100644
index 0000000..5471e98
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg84.fsx
@@ -0,0 +1,10 @@
+module M
+
+let f (xs:string list) = 
+   match xs  with 
+   | [] -> 
+        xs 
+        |> List.map (fun x -> x 
+        //|> List.map (fun x -> x + "a") 
+        //|> List.map (fun x -> x + "b")
+
diff --git a/tests/fsharp/typecheck/sigs/neg84.vsbsl b/tests/fsharp/typecheck/sigs/neg84.vsbsl
new file mode 100644
index 0000000..2b7a0c0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg84.vsbsl
@@ -0,0 +1,4 @@
+
+neg84.fsx(11,1,11,1): parse error FS0010: Incomplete structured construct at or before this point in expression
+
+neg84.fsx(11,1,11,1): parse error FS0010: Incomplete structured construct at or before this point in expression
diff --git a/tests/fsharp/typecheck/sigs/neg85.bsl b/tests/fsharp/typecheck/sigs/neg85.bsl
new file mode 100644
index 0000000..f1f4f66
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg85.bsl
@@ -0,0 +1,2 @@
+
+neg85.fsx(7,9,7,56): typecheck error FS3162: A type variable has been constrained by multiple different class types. A type variable may only have one class constraint.
diff --git a/tests/fsharp/typecheck/sigs/neg85.fsx b/tests/fsharp/typecheck/sigs/neg85.fsx
new file mode 100644
index 0000000..c89cfaa
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg85.fsx
@@ -0,0 +1,35 @@
+module M
+
+module MultipleClassConstraints = 
+    open System
+    open System.Linq.Expressions
+ 
+    let convertExpressionTreeToFSharp (e : #Expression) =
+        match e.NodeType with
+        | ExpressionType.Constant -> 
+            let c = e :> ConstantExpression
+            ()
+        | ExpressionType.Assign ->
+            let a = e :> BinaryExpression
+            ()
+        | _ -> 
+            ()
+
+
+module OneClassConstraint = 
+    open System
+    open System.Linq.Expressions
+
+    let convertExpressionTreeToFSharp (e : #Expression) =
+        match e.NodeType with
+        | ExpressionType.Constant -> 
+            let c = e :> ConstantExpression
+            ()
+        | ExpressionType.Assign ->
+            let a = e :> IDisposable
+            ()
+        | _ -> 
+            ()
+
+        //convertExpressionTreeToFSharp (Expression.Constant(1)) // error
+ 
diff --git a/tests/fsharp/typecheck/sigs/neg86.bsl b/tests/fsharp/typecheck/sigs/neg86.bsl
new file mode 100644
index 0000000..9f10ac4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg86.bsl
@@ -0,0 +1,2 @@
+
+neg86.fsx(18,20,18,22): parse error FS3156: Unexpected token 'in' or incomplete expression
diff --git a/tests/fsharp/typecheck/sigs/neg86.fsx b/tests/fsharp/typecheck/sigs/neg86.fsx
new file mode 100644
index 0000000..a48cf18
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg86.fsx
@@ -0,0 +1,36 @@
+
+let f1() =
+    query { for x in [1] do
+            where 1 in 2 }
+
+let f2() =
+    query { for c in [1] do
+            join 
+            select (e,c) }
+
+let f3() =
+    query { for c in [1] do
+            join e 
+            select (e,c) }
+
+let f4() =
+    query { for c in [1] do
+            join e in   }
+    printfn "recover"
+
+let f5() =
+    query { for c in [1] do
+            join e in  [1;2;3] //on (c = e); 
+            select (e,c) }
+
+let f6() =
+    query { for c in [1] do
+            join e in  [1;2;3] on // (c = e); 
+            select (e,c) }
+
+let f7() =
+    query { for c in [1] do
+            join e in  [1;2;3] on (c); 
+            select (e,c) }
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg86.vsbsl b/tests/fsharp/typecheck/sigs/neg86.vsbsl
new file mode 100644
index 0000000..877aaf5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg86.vsbsl
@@ -0,0 +1,22 @@
+
+neg86.fsx(18,20,18,22): parse error FS3156: Unexpected token 'in' or incomplete expression
+
+neg86.fsx(18,20,18,22): parse error FS3156: Unexpected token 'in' or incomplete expression
+
+neg86.fsx(4,21,4,23): typecheck error FS3156: Unexpected token 'in' or incomplete expression
+
+neg86.fsx(8,13,8,17): typecheck error FS3096: 'join' must be followed by a variable name. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg86.fsx(8,13,8,17): typecheck error FS3167: 'join' must be followed by 'in'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg86.fsx(9,21,9,22): typecheck error FS0039: The value or constructor 'e' is not defined
+
+neg86.fsx(23,13,23,17): typecheck error FS3097: Incorrect syntax for 'join'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg86.fsx(28,13,28,17): typecheck error FS3097: Incorrect syntax for 'join'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'.
+
+neg86.fsx(33,36,33,37): typecheck error FS3125: Invalid join relation in 'join'. Expected 'expr <op> expr', where <op> is =, =?, ?= or ?=?.
+
+neg86.fsx(34,21,34,22): typecheck error FS0039: The value or constructor 'e' is not defined
+
+neg86.fsx(34,23,34,24): typecheck error FS0039: The value or constructor 'c' is not defined
diff --git a/tests/fsharp/typecheck/sigs/neg87.bsl b/tests/fsharp/typecheck/sigs/neg87.bsl
new file mode 100644
index 0000000..5359647
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg87.bsl
@@ -0,0 +1,40 @@
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
+
+neg87.fsx(14,5,14,10): typecheck error FS3087: The custom operation 'test2' refers to a method which is overloaded. The implementations of custom operations may not be overloaded.
diff --git a/tests/fsharp/typecheck/sigs/neg87.fsx b/tests/fsharp/typecheck/sigs/neg87.fsx
new file mode 100644
index 0000000..72748b4
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg87.fsx
@@ -0,0 +1,15 @@
+
+type QB() =
+    [<CustomOperation("test1")>]
+    member x.Op(i:int) = 
+        printfn "test1: %i" i
+        true
+    [<CustomOperation("test2")>]
+    member x.Op(s:string) = 
+        printfn "test2 %s" s
+        'c'
+    member x.Yield(()) = 2
+
+let q : bool = QB() {
+    test2
+}
diff --git a/tests/fsharp/typecheck/sigs/neg88.bsl b/tests/fsharp/typecheck/sigs/neg88.bsl
new file mode 100644
index 0000000..7d423cd
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg88.bsl
@@ -0,0 +1,18 @@
+
+neg88.fs(18,18,18,20): typecheck error FS0001: Type constraint mismatch. The type 
+    'c -> 'd    
+is not compatible with type
+    Func<'a,'b>    
+The type ''c -> 'd' is not compatible with the type 'Func<'a,'b>'
+
+neg88.fs(19,18,19,20): typecheck error FS0001: Type constraint mismatch. The type 
+    'c -> 'd    
+is not compatible with type
+    Expressions.Expression<Func<'a,'b>>    
+The type ''c -> 'd' is not compatible with the type 'Expressions.Expression<Func<'a,'b>>'
+
+neg88.fs(21,10,21,12): typecheck error FS0001: Type constraint mismatch. The type 
+    'b ref    
+is not compatible with type
+    byref<'a>    
+The type ''b ref' is not compatible with the type 'byref<'a>'
diff --git a/tests/fsharp/typecheck/sigs/neg88.fs b/tests/fsharp/typecheck/sigs/neg88.fs
new file mode 100644
index 0000000..0cbf2fe
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg88.fs
@@ -0,0 +1,21 @@
+namespace neg88
+
+open System
+open System.Linq
+
+type Cls<'t>() = 
+    member this.M1<'a, 'b>(f : Func<'a, 'b>) : Cls<'b> = new Cls<'b>()
+    member this.M2<'a, 'b>(f : System.Linq.Expressions.Expression<Func<'a, 'b>>) : Cls<'b> = new Cls<'b>()
+    member this.M3<'a>(a : byref<'a>) = ()
+
+
+module Test = 
+    let inline map1  (data : ^a) (f: ^b -> ^c) : ^d = (^a : (member M1 : (^b -> ^c) -> ^d) (data,f))
+    let inline map2  (data : ^a) (f: ^b -> ^c) : ^d = (^a : (member M2 : (^b -> ^c) -> ^d) (data,f))
+    let inline map3 (data : ^a)(f: ^b ref)  : ^d = (^a : (member M3 : ^b ref -> ^d) (data,f))
+
+    let c1 = Cls<int>()
+    let _ = map1 c1 (fun x -> Math.Log(x))  // 1
+    let _ = map2 c1 (fun x -> Math.Log(x))  // 2
+    let r1 = ref 0
+    map3 c1 r1  // 3
diff --git a/tests/fsharp/typecheck/sigs/neg89.bsl b/tests/fsharp/typecheck/sigs/neg89.bsl
new file mode 100644
index 0000000..0f81ef3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg89.bsl
@@ -0,0 +1,44 @@
+
+neg89.fsx(2,10,2,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(2,10,2,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(3,9,3,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(3,9,3,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(3,9,3,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(3,9,3,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(6,10,6,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(6,10,6,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(6,10,6,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(6,10,6,11): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(7,9,7,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(7,9,7,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(7,9,7,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(7,9,7,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
+
+neg89.fsx(8,9,8,10): typecheck error FS0953: This type definition involves an immediate cyclic reference through an abbreviation
diff --git a/tests/fsharp/typecheck/sigs/neg89.fsx b/tests/fsharp/typecheck/sigs/neg89.fsx
new file mode 100644
index 0000000..282dbda
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg89.fsx
@@ -0,0 +1,8 @@
+module M1 =
+    type A = A list
+    and B = A list
+   
+module M2 = 
+    type A = B -> B
+    and B = A * A
+    and C = A list   
diff --git a/tests/fsharp/typecheck/sigs/neg90.bsl b/tests/fsharp/typecheck/sigs/neg90.bsl
new file mode 100644
index 0000000..9fa4482
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg90.bsl
@@ -0,0 +1,2 @@
+
+neg90.fs(4,9,4,12): typecheck error FS0001: A generic construct requires that the type 'Recd' have a public default constructor
diff --git a/tests/fsharp/typecheck/sigs/neg90.fs b/tests/fsharp/typecheck/sigs/neg90.fs
new file mode 100644
index 0000000..83b29cc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg90.fs
@@ -0,0 +1,4 @@
+module Test
+let foo<'a when 'a : (new : unit -> 'a)>() = new 'a()
+type Recd = {f : int}
+let _ = foo<Recd>()
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/neg91.bsl b/tests/fsharp/typecheck/sigs/neg91.bsl
new file mode 100644
index 0000000..6fb74c5
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg91.bsl
@@ -0,0 +1,4 @@
+
+neg91.fs(7,16,7,30): typecheck error FS0896: Enumerations cannot have members
+
+neg91.fs(10,10,10,15): typecheck error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope.
diff --git a/tests/fsharp/typecheck/sigs/neg91.fs b/tests/fsharp/typecheck/sigs/neg91.fs
new file mode 100644
index 0000000..0c19061
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg91.fs
@@ -0,0 +1,14 @@
+module Test
+
+module T1 = 
+    type Enum1 = 
+        | E = 1
+        with
+        member this.Foo() = 1 // not ok
+
+module T2 =    
+    type Enum2 = 
+        | E2 = 1
+    type Enum2
+        with
+        member this.Foo() = 1 // not ok
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_0.fs b/tests/fsharp/typecheck/sigs/neg_byref_0.fs
new file mode 100644
index 0000000..5eacbb8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_0.fs
@@ -0,0 +1,7 @@
+
+module Test
+(* original error *)  
+open Microsoft.FSharp.Quotations.Typed
+let test a = ()
+let mutable i = 5 in
+test <@ &i @>
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_1.bsl b/tests/fsharp/typecheck/sigs/neg_byref_1.bsl
new file mode 100644
index 0000000..3428aa8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_1.bsl
@@ -0,0 +1,4 @@
+
+neg_byref_1.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_1.fs(2,11,2,13): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_1.fs b/tests/fsharp/typecheck/sigs/neg_byref_1.fs
new file mode 100644
index 0000000..9446846
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_1.fs
@@ -0,0 +1,2 @@
+module Test
+let x01 = []   : (int byref) list  (* trap: tinst *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_10.bsl b/tests/fsharp/typecheck/sigs/neg_byref_10.bsl
new file mode 100644
index 0000000..8caa4ac
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_10.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_10.fs(2,6,2,8): typecheck error FS0437: A type would store a byref typed value. This is not permitted by Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_10.fs b/tests/fsharp/typecheck/sigs/neg_byref_10.fs
new file mode 100644
index 0000000..eaaf775
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_10.fs
@@ -0,0 +1,4 @@
+module Test
+type M2 = class
+    val x : byref<int>                 (* trap: byref fields *)
+end
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_11.bsl b/tests/fsharp/typecheck/sigs/neg_byref_11.bsl
new file mode 100644
index 0000000..3e3bda7
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_11.bsl
@@ -0,0 +1,8 @@
+
+neg_byref_11.fs(3,6,3,8): typecheck error FS0437: A type would store a byref typed value. This is not permitted by Common IL.
+
+neg_byref_11.fs(3,13,3,14): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_11.fs(3,13,3,14): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_11.fs(3,13,3,14): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_11.fs b/tests/fsharp/typecheck/sigs/neg_byref_11.fs
new file mode 100644
index 0000000..8842ab2
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_11.fs
@@ -0,0 +1,3 @@
+module Test
+#nowarn "1175"
+type M3 = { x:byref<int> }             (* trap: byref record fields *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_12.bsl b/tests/fsharp/typecheck/sigs/neg_byref_12.bsl
new file mode 100644
index 0000000..4bfeb87
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_12.bsl
@@ -0,0 +1,8 @@
+
+neg_byref_12.fs(3,6,3,8): typecheck error FS0437: A type would store a byref typed value. This is not permitted by Common IL.
+
+neg_byref_12.fs(3,11,3,17): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_12.fs(3,11,3,17): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_12.fs(3,11,3,17): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_12.fs b/tests/fsharp/typecheck/sigs/neg_byref_12.fs
new file mode 100644
index 0000000..25e7fce
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_12.fs
@@ -0,0 +1,3 @@
+module Test
+#nowarn "1175"
+type M4 = Nested of byref<int>         (* trap: byref union constr fields *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_13.bsl b/tests/fsharp/typecheck/sigs/neg_byref_13.bsl
new file mode 100644
index 0000000..92efcae
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_13.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_13.fs(2,6,2,8): typecheck error FS0445: The type abbreviation contains byrefs. This is not permitted by F#.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_13.fs b/tests/fsharp/typecheck/sigs/neg_byref_13.fs
new file mode 100644
index 0000000..ffff58a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_13.fs
@@ -0,0 +1,3 @@
+module Test
+type M5 = byref<int> * int             (* type alias for tuple with byref fields, trapped as tuple instance *)
+let useM5 (x:M5) = x                   (* trap: tuple with byref type component *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_14.bsl b/tests/fsharp/typecheck/sigs/neg_byref_14.bsl
new file mode 100644
index 0000000..7e867cb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_14.bsl
@@ -0,0 +1,8 @@
+
+neg_byref_14.fs(3,11,3,25): typecheck error FS0437: A type would store a byref typed value. This is not permitted by Common IL.
+
+neg_byref_14.fs(3,11,3,25): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_14.fs(3,11,3,25): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_14.fs(3,11,3,25): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_14.fs b/tests/fsharp/typecheck/sigs/neg_byref_14.fs
new file mode 100644
index 0000000..e7e6414
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_14.fs
@@ -0,0 +1,3 @@
+module Test
+#nowarn "1175"
+exception ByrefException of byref<int> (* trap: exception with byref type *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_15.bsl b/tests/fsharp/typecheck/sigs/neg_byref_15.bsl
new file mode 100644
index 0000000..0b3c290
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_15.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_15.fs(2,50,2,71): typecheck error FS0406: The byref-typed variable 'ab' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_15.fs b/tests/fsharp/typecheck/sigs/neg_byref_15.fs
new file mode 100644
index 0000000..06cd4d3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_15.fs
@@ -0,0 +1,2 @@
+module Test
+let f () = let mutable a = 1 in  let ab = &a in (fun () -> [ab].Length) (* trap: byref captured by function closure (explicit lambda) *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_16.bsl b/tests/fsharp/typecheck/sigs/neg_byref_16.bsl
new file mode 100644
index 0000000..aa7e581
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_16.bsl
@@ -0,0 +1,4 @@
+
+neg_byref_16.fs(3,33,3,42): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_16.fs(3,5,3,9): typecheck error FS0426: A method return type would contain byrefs which is not permitted
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_16.fs b/tests/fsharp/typecheck/sigs/neg_byref_16.fs
new file mode 100644
index 0000000..f953985
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_16.fs
@@ -0,0 +1,3 @@
+module Test
+let rec pair x y loop = if loop then pair x y loop else (x,y)
+let f () = let mutable a = 1 in pair (&a)                  (* trap: byref captured by function closure (partial application) *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_17.bsl b/tests/fsharp/typecheck/sigs/neg_byref_17.bsl
new file mode 100644
index 0000000..570d6bc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_17.bsl
@@ -0,0 +1,18 @@
+
+neg_byref_17.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_17.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_17.fs(2,17,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(2,17,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(2,17,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(3,17,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(3,17,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(3,17,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_17.fs(3,17,3,39): typecheck error FS0426: A method return type would contain byrefs which is not permitted
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_17.fs b/tests/fsharp/typecheck/sigs/neg_byref_17.fs
new file mode 100644
index 0000000..a9e63d9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_17.fs
@@ -0,0 +1,3 @@
+module Test
+let vvv       = unbox null : int byref;;
+let f (x:obj) = unbox x    : int byref;;
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_18.bsl b/tests/fsharp/typecheck/sigs/neg_byref_18.bsl
new file mode 100644
index 0000000..f408ecb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_18.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_18.fs(2,38,2,47): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_18.fs b/tests/fsharp/typecheck/sigs/neg_byref_18.fs
new file mode 100644
index 0000000..1629615
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_18.fs
@@ -0,0 +1,2 @@
+module Test
+let f x = let mutable y = "hello" in hash (&y);;
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_19.bsl b/tests/fsharp/typecheck/sigs/neg_byref_19.bsl
new file mode 100644
index 0000000..5a3ea12
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_19.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_19.fs(2,38,2,46): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_19.fs b/tests/fsharp/typecheck/sigs/neg_byref_19.fs
new file mode 100644
index 0000000..e7967b9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_19.fs
@@ -0,0 +1,3 @@
+module Test
+let f x = let mutable y = "hello" in box (&y);;
+
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_2.bsl b/tests/fsharp/typecheck/sigs/neg_byref_2.bsl
new file mode 100644
index 0000000..ce1fb78
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_2.bsl
@@ -0,0 +1,4 @@
+
+neg_byref_2.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_2.fs(2,11,2,15): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_2.fs b/tests/fsharp/typecheck/sigs/neg_byref_2.fs
new file mode 100644
index 0000000..027421e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_2.fs
@@ -0,0 +1,2 @@
+module Test
+let x02 = [||] : byref<int>[]      (* trap: tinst *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_20.bsl b/tests/fsharp/typecheck/sigs/neg_byref_20.bsl
new file mode 100644
index 0000000..eecb7fc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_20.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_20.fs(2,2,2,21): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_20.fs b/tests/fsharp/typecheck/sigs/neg_byref_20.fs
new file mode 100644
index 0000000..0e23d62
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_20.fs
@@ -0,0 +1,4 @@
+module Test
+(Array.zeroCreate 10 : int byref [] );;
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_21.bsl b/tests/fsharp/typecheck/sigs/neg_byref_21.bsl
new file mode 100644
index 0000000..11ff3de
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_21.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_21.fs(4,5,4,7): typecheck error FS0425: The type of a first-class function cannot contain byrefs
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_21.fs b/tests/fsharp/typecheck/sigs/neg_byref_21.fs
new file mode 100644
index 0000000..e510b4f
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_21.fs
@@ -0,0 +1,4 @@
+(* Regression for Bug 1358 *)
+module Test
+let f (x : byref<'a>) = x = x;;
+let zz = f;;
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_22.bsl b/tests/fsharp/typecheck/sigs/neg_byref_22.bsl
new file mode 100644
index 0000000..21e4ac3
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_22.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_22.fs(3,16,3,32): typecheck error FS0426: A method return type would contain byrefs which is not permitted
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_22.fs b/tests/fsharp/typecheck/sigs/neg_byref_22.fs
new file mode 100644
index 0000000..a09a333
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_22.fs
@@ -0,0 +1,4 @@
+(* Regression for Bug 1358 *)
+module Test
+let rec f () = f () : int byref;;
+
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_23.bsl b/tests/fsharp/typecheck/sigs/neg_byref_23.bsl
new file mode 100644
index 0000000..ca76f5b
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_23.bsl
@@ -0,0 +1,2 @@
+
+neg_byref_23.fs(4,5,4,6): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_23.fs b/tests/fsharp/typecheck/sigs/neg_byref_23.fs
new file mode 100644
index 0000000..c7e462a
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_23.fs
@@ -0,0 +1,6 @@
+(* Regression for Bug 3807 *)
+module Test
+let f (x:byref<int>) = "123"
+let g = f (* <-- expect error here, but not ICE *)
+
+
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_3.bsl b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl
new file mode 100644
index 0000000..62fbe08
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_3.bsl
@@ -0,0 +1,8 @@
+
+neg_byref_3.fs(2,5,2,8): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_3.fs(2,11,2,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_3.fs(3,11,3,22): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_3.fs(3,11,3,34): typecheck error FS0426: A method return type would contain byrefs which is not permitted
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_3.fs b/tests/fsharp/typecheck/sigs/neg_byref_3.fs
new file mode 100644
index 0000000..972f3b0
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_3.fs
@@ -0,0 +1,3 @@
+module Test
+let vvv = List.length<byref<int>>  (* trap: tinst of a generic app (TExpr_app) *)
+let f() = List.length<byref<int>>  (* trap: tinst of a generic app (TExpr_app) *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_4.bsl b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl
new file mode 100644
index 0000000..0e6d485
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_4.bsl
@@ -0,0 +1,8 @@
+
+neg_byref_4.fs(4,11,4,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_4.fs(4,11,4,29): typecheck error FS0426: A method return type would contain byrefs which is not permitted
+
+neg_byref_4.fs(5,11,5,29): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_4.fs(5,11,5,29): typecheck error FS0426: A method return type would contain byrefs which is not permitted
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_4.fs b/tests/fsharp/typecheck/sigs/neg_byref_4.fs
new file mode 100644
index 0000000..f33a71c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_4.fs
@@ -0,0 +1,5 @@
+module Test
+type ID<'T> =
+    static member id (x:'T) = x  
+let vv  = ID<byref<int>> .id       (* trap: tinst of a generic type, then static method (TExpr_ilcall) *)
+let f() = ID<byref<int>> .id       (* trap: tinst of a generic type, then static method (TExpr_ilcall) *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_5.bsl b/tests/fsharp/typecheck/sigs/neg_byref_5.bsl
new file mode 100644
index 0000000..d60bde9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_5.bsl
@@ -0,0 +1,4 @@
+
+neg_byref_5.fs(2,5,2,9): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_5.fs(2,12,2,16): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_5.fs b/tests/fsharp/typecheck/sigs/neg_byref_5.fs
new file mode 100644
index 0000000..dfd843e
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_5.fs
@@ -0,0 +1,2 @@
+module Test
+let xop1 = None : byref<int> option                          (* trap: tinst of TExpr_op, union constructor *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_6.bsl b/tests/fsharp/typecheck/sigs/neg_byref_6.bsl
new file mode 100644
index 0000000..18c5efe
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_6.bsl
@@ -0,0 +1,4 @@
+
+neg_byref_6.fs(2,5,2,9): typecheck error FS0431: A byref typed value would be stored here. Top-level let-bound byref values are not permitted.
+
+neg_byref_6.fs(2,12,2,17): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_6.fs b/tests/fsharp/typecheck/sigs/neg_byref_6.fs
new file mode 100644
index 0000000..e9c6882
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_6.fs
@@ -0,0 +1,2 @@
+module Test
+let xop2 = [| |] : byref<int>[]                              (* trap: tinst of TExpr_op, array *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_7.bsl b/tests/fsharp/typecheck/sigs/neg_byref_7.bsl
new file mode 100644
index 0000000..11f25ec
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_7.bsl
@@ -0,0 +1,20 @@
+
+neg_byref_7.fs(2,38,2,43): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,38,2,43): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,39,2,40): typecheck error FS0418: The byref typed value 'v' cannot be used at this point
+
+neg_byref_7.fs(2,42,2,43): typecheck error FS0418: The byref typed value 'v' cannot be used at this point
+
+neg_byref_7.fs(2,47,2,60): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,47,2,60): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_7.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_7.fs b/tests/fsharp/typecheck/sigs/neg_byref_7.fs
new file mode 100644
index 0000000..870455d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_7.fs
@@ -0,0 +1,2 @@
+module Test
+let xop3 (v:byref<int>) = let pair = &v,&v in [pair].Length  (* trap: tinst of TExpr_op, tuple - no opt away *)
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_8.bsl b/tests/fsharp/typecheck/sigs/neg_byref_8.bsl
new file mode 100644
index 0000000..d0665ef
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_8.bsl
@@ -0,0 +1,20 @@
+
+neg_byref_8.fs(2,38,2,43): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,38,2,43): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,39,2,40): typecheck error FS0418: The byref typed value 'v' cannot be used at this point
+
+neg_byref_8.fs(2,42,2,43): typecheck error FS0418: The byref typed value 'v' cannot be used at this point
+
+neg_byref_8.fs(2,47,2,60): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,47,2,60): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
+
+neg_byref_8.fs(2,47,2,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL.
diff --git a/tests/fsharp/typecheck/sigs/neg_byref_8.fs b/tests/fsharp/typecheck/sigs/neg_byref_8.fs
new file mode 100644
index 0000000..e519162
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/neg_byref_8.fs
@@ -0,0 +1,2 @@
+module Test
+let xop4 (v:byref<int>) = let pair = &v,&v in [pair].Length  (* trap: tinst of TExpr_op, tuple - no opt away *)
diff --git a/tests/fsharp/typecheck/sigs/pos01a.fs b/tests/fsharp/typecheck/sigs/pos01a.fs
new file mode 100644
index 0000000..a64f989
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos01a.fs
@@ -0,0 +1,46 @@
+module Pos01a
+let x : int list ref = ref []
+let y : string list ref = ref []
+
+let f () = 3
+
+module X1 = begin 
+  type x = X | Y
+  let y = 3
+end
+
+
+module X2 = begin 
+  type x = X | Y
+  let x = 3
+end
+
+
+module X3 = begin 
+  let y = X2.X
+end
+
+
+
+type fieldsInDifferentOrder = { b:int; a: int }
+
+(*
+module TestModuleAbbreviatingNamespace = begin
+    module M = System
+
+    let v = 3
+end
+
+module TestModuleAbbreviatingNamespaceOCamlSig = begin
+    module M = System
+
+    let v = 3
+end
+*)
+
+type C() = 
+    class
+        [<DefaultValue>]
+        val mutable x : int
+    end
+    
diff --git a/tests/fsharp/typecheck/sigs/pos01a.fsi b/tests/fsharp/typecheck/sigs/pos01a.fsi
new file mode 100644
index 0000000..b419224
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos01a.fsi
@@ -0,0 +1,29 @@
+module Pos01a
+val x : int list ref
+val f : unit -> int
+
+module X1 : sig val y : int  end 
+module X2 : sig type x = X | Y  end 
+
+module X3 : sig val y : X2.x  end 
+
+type fieldsInDifferentOrder = { b:int; a: int }
+
+//module TestModuleAbbreviatingNamespace : begin
+//    module M = System
+//
+//    val v : M.Int32
+//end
+//
+//module TestModuleAbbreviatingNamespaceOCamlSig : sig
+//    module M = System
+//
+//    val v : M.Int32
+//end
+
+type C = 
+    class
+        [<DefaultValue>]
+        val mutable x : int
+        new : unit -> C
+    end
diff --git a/tests/fsharp/typecheck/sigs/pos02.fs b/tests/fsharp/typecheck/sigs/pos02.fs
new file mode 100644
index 0000000..b8cc909
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos02.fs
@@ -0,0 +1,55 @@
+module Test
+let f<'a when 'a : unmanaged> (x : 'a) = ()
+;;
+do f 10
+do f 10u
+;;
+[<Struct>]
+type SUnmanaged =
+   val i : int
+   val j : uint32
+   member this.X = this.i, this.j
+
+type FSharpEnum =
+| A = 1
+| B = 2
+| C = 3
+
+
+[<Struct>]
+type SUnmanagedRecursive =
+   val s1 : SUnmanaged
+   val i : int
+
+[<Struct>]
+type SManaged =
+   val v : obj
+
+[<Struct>]
+type SManagedRecursive =
+   val s1 : SUnmanaged
+   val s2 : SManaged
+
+
+
+do f (new SUnmanaged())               // Ok
+do f (new SUnmanagedRecursive())      // Ok
+do f FSharpEnum.A                     // Ok
+do f (System.DayOfWeek.Monday)        // Ok
+
+type SAbbrev = SUnmanaged
+
+do f (new SAbbrev())
+
+[<Measure>]
+type kg
+
+do f (1.5<kg>)                        // Ok
+
+type C<'a when 'a : unmanaged>() = class end
+
+let _ = new C<SUnmanaged>()               // Ok
+let _ = new C<SUnmanagedRecursive>()      // Ok
+let _ = new C<FSharpEnum>()               // Ok
+let _ = new C<System.DayOfWeek>()         // Ok
+let _ = new C<SAbbrev>()                  // Ok
diff --git a/tests/fsharp/typecheck/sigs/pos03.fs b/tests/fsharp/typecheck/sigs/pos03.fs
new file mode 100644
index 0000000..f1c91f8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos03.fs
@@ -0,0 +1,24 @@
+// Bug 5554: constraints containing units-of-measure variables
+
+module MeasureConstr
+
+type MU<[<Measure>] 'ua> = class end
+type MU2<[<Measure>] 'ua, [<Measure>] 'ub> = class end
+type MT<'a> = class end
+type MT2<'a,'b> = class end
+
+type T =  
+    static member foo (l: #MT<'c>) = ()
+
+    static member star (l:'a when 'a :> MT<'b>) = ()
+
+    static member bar (a : 'd, l:'a when 'a :> MT2<'b,'c>) = ()
+
+type U =
+  static member foo (l: #MU<'uc>) = ()
+
+  static member star (l:'ua when 'ua :> MU<'ub>) = ()
+
+  static member bar (l:'ua when 'ua :> MU2<'ub,'uc>) = ()
+  static member bar2 (l:'ua when 'ua :> MU2<'uc*'ub,'ud>) = ()
+  static member bar3 (l:'ua when 'ua :> MU2<'ub*'uc,'ub*'uc>, r:'ud when 'ud :> MU2<'uc,'uc>) = ()
diff --git a/tests/fsharp/typecheck/sigs/pos03a.fs b/tests/fsharp/typecheck/sigs/pos03a.fs
new file mode 100644
index 0000000..f1c91f8
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos03a.fs
@@ -0,0 +1,24 @@
+// Bug 5554: constraints containing units-of-measure variables
+
+module MeasureConstr
+
+type MU<[<Measure>] 'ua> = class end
+type MU2<[<Measure>] 'ua, [<Measure>] 'ub> = class end
+type MT<'a> = class end
+type MT2<'a,'b> = class end
+
+type T =  
+    static member foo (l: #MT<'c>) = ()
+
+    static member star (l:'a when 'a :> MT<'b>) = ()
+
+    static member bar (a : 'd, l:'a when 'a :> MT2<'b,'c>) = ()
+
+type U =
+  static member foo (l: #MU<'uc>) = ()
+
+  static member star (l:'ua when 'ua :> MU<'ub>) = ()
+
+  static member bar (l:'ua when 'ua :> MU2<'ub,'uc>) = ()
+  static member bar2 (l:'ua when 'ua :> MU2<'uc*'ub,'ud>) = ()
+  static member bar3 (l:'ua when 'ua :> MU2<'ub*'uc,'ub*'uc>, r:'ud when 'ud :> MU2<'uc,'uc>) = ()
diff --git a/tests/fsharp/typecheck/sigs/pos03a.fsi b/tests/fsharp/typecheck/sigs/pos03a.fsi
new file mode 100644
index 0000000..bd79883
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos03a.fsi
@@ -0,0 +1,27 @@
+module MeasureConstr
+type MU<[<Measure>] 'ua> =
+  class
+  end
+type MU2<[<Measure>] 'ua,[<Measure>] 'ub> =
+  class
+  end
+type MT<'a> =
+  class
+  end
+type MT2<'a,'b> =
+  class
+  end
+type T =
+  class
+    static member bar : a:'d * l:#MT2<'b,'c> -> unit
+    static member foo : l:#MT<'c> -> unit
+    static member star : l:#MT<'b> -> unit
+  end
+type U =
+  class
+    static member bar : l:#MU2<'ub,'uc> -> unit
+    static member bar2 : l:#MU2<'ub,'ud> -> unit
+    static member bar3 : l:#MU2<'ub,'ub> * r:#MU2<'uc,'uc> -> unit
+    static member foo : l:#MU<'uc> -> unit
+    static member star : l:#MU<'ub> -> unit
+  end
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos05.fs b/tests/fsharp/typecheck/sigs/pos05.fs
new file mode 100644
index 0000000..7bd99db
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos05.fs
@@ -0,0 +1,64 @@
+namespace global
+
+module PrefixOperatorsDefaultPositive = 
+    let f1 (x:Quotations.Expr<'T>) = <@ id %x @>  // now allowed
+    let f2 (x:Quotations.Expr) = <@@ id %%x @@>   // now allowed
+    let g (x:byref<int>) = x
+    let g2 (x:byref<int>) (x2:byref<int>) = x
+    let g3 (x:nativeptr<int>) (x2:nativeptr<int>) = x
+    let f3 x = let mutable v = 1 in g &v       // now allowed
+    let f4 x = let mutable v = 1 in g2 &v &v   // now allowed
+    let f5 x = let mutable v = 1 in g3 &&v &&v // now allowed
+
+module PrefixOperatorsPositive = 
+    // special cases:
+    let (~+) x = x // keep
+    let (~-) x = x // keep
+    let (~-.)  (x:float)           =  -x // keep
+    let (~+.)  (x:float)           =  -x // keep
+    let (~%) x = x // keep
+    let (~%%) x = x // keep
+
+    // user-defined prefix operators:
+    let (~~) x = x // keep
+    let (~~~) x = x // keep
+    let (~~~~~~) x = x // keep
+    let (!) x = x  // keep
+    let (!!) x = x  // keep
+    let (!!!) x = x  // keep
+    let (!!!!) x = x  // keep
+    let (!!!!!) x = x  // keep
+    let (!~) x = x // keep
+    let (!?) x = x // keep
+
+    let (?) x y = x // keep
+    let (?<-) x y z = x // keep
+
+    let (++) x y  = x + y // keep
+
+    let x11 : int = id +2 // keep
+    let x12 : int = id -2 // keep
+    let x13 : int = id ~~2 // keep
+    let x14 : int = id !2 // keep
+    let x15 : int = id %2 // keep
+    let x16 : int = id %%2 // keep
+    let x17 : int = id ~~~2 // keep
+    let x18 : float = id -.2.0 // keep
+    let x19 : float = id +.2.0 // keep
+    let x5 : int = id !~2 // keep
+    let x6 : int = id !?2 // keep
+
+    let x7 : int = 1 ++2 // ideally reject, keep as infix, assuming (++) is defined
+    let x8 : int = id ~~   2 // keep as prefix
+    let x9 : int = id !    2 // keep as prefix
+    let x10 : int = id ~~~  2 // keep as prefix
+
+// Check the '**' operator can be overloaded
+
+type Gaussian(x:float,y:float) =
+  static member ( ** ) (g: Gaussian, e: float) = g
+  static member Pow (g: Gaussian, e: float) = g
+
+module M = 
+    let c1 : Gaussian = Gaussian(0.,1.) ** 3.
+    let c2 = Gaussian(0.,1.) ** 3.
diff --git a/tests/fsharp/typecheck/sigs/pos06.fs b/tests/fsharp/typecheck/sigs/pos06.fs
new file mode 100644
index 0000000..d209d98
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos06.fs
@@ -0,0 +1,8 @@
+  namespace Neg41a 
+  type X = A | B
+    
+  namespace Neg40b
+  type X = A | B
+
+namespace Neg41c
+  type X = A | B
diff --git a/tests/fsharp/typecheck/sigs/pos07.fs b/tests/fsharp/typecheck/sigs/pos07.fs
new file mode 100644
index 0000000..6067373
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos07.fs
@@ -0,0 +1,47 @@
+module Neg41Module
+
+id (fun x -> x) id 
+ ()
+let x = 1
+
+open System
+open System.Reflection
+
+type MyType() = 
+    inherit Type()
+    override this.GUID : Guid= failwith "Not implemented"
+    override this.InvokeMember(name: string, invokeAttr: BindingFlags, binder: Binder, target: obj, args: obj [], modifiers: ParameterModifier [], culture: System.Globalization.CultureInfo, namedParameters: string []) : obj = failwith "Not implemented"
+    override this.Assembly : Assembly = failwith "Not implemented"
+    override this.FullName : string = failwith "Not implemented"
+    override this.Namespace : string = failwith "Not implemented"
+    override this.AssemblyQualifiedName : string = failwith "Not implemented"
+    override this.BaseType : Type = typeof<obj>
+    override this.GetConstructorImpl(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : ConstructorInfo= failwith "Not implemented"
+    override this.GetConstructors(bindingAttr: BindingFlags) : ConstructorInfo []= failwith "Not implemented"
+    override this.GetMethodImpl(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type[], modifiers: ParameterModifier []) : MethodInfo= failwith "Not implemented"
+    override this.GetMethods(bindingAttr: BindingFlags) : MethodInfo []= failwith "Not implemented"
+    override this.GetField(name: string, bindingAttr: BindingFlags) : FieldInfo= failwith "Not implemented"
+    override this.GetFields(bindingAttr: BindingFlags) : FieldInfo []= failwith "Not implemented"
+    override this.GetInterface(name: string, ignoreCase: bool) : Type = failwith "Not implemented"
+    override this.GetInterfaces() : Type[] = failwith "Not implemented"
+    override this.GetEvent(name: string, bindingAttr: BindingFlags) : EventInfo= failwith "Not implemented"
+    override this.GetEvents(bindingAttr: BindingFlags) : EventInfo []= failwith "Not implemented"
+    override this.GetPropertyImpl(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: System.Type, types: System.Type [], modifiers: ParameterModifier []) : PropertyInfo = failwith "Not implemented"
+    override this.GetProperties(bindingAttr: BindingFlags) : PropertyInfo []= failwith "Not implemented"
+    override this.GetNestedTypes(bindingAttr: BindingFlags) : Type [] = failwith "Not implemented"
+    override this.GetNestedType(name: string, bindingAttr: BindingFlags) : Type = failwith "Not implemented"
+    override this.GetMembers(bindingAttr: BindingFlags) : MemberInfo []= failwith "Not implemented"
+    override this.GetAttributeFlagsImpl() : TypeAttributes= failwith "Not implemented"
+    override this.IsArrayImpl() : bool= failwith "Not implemented"
+    override this.IsByRefImpl() : bool= failwith "Not implemented"
+    override this.IsPointerImpl() : bool= failwith "Not implemented"
+    override this.IsPrimitiveImpl() : bool= failwith "Not implemented"
+    override this.IsCOMObjectImpl() : bool= failwith "Not implemented"
+    override this.GetElementType() : Type= failwith "Not implemented" 
+    override this.HasElementTypeImpl() : bool= failwith "Not implemented"
+    override this.UnderlyingSystemType : Type = failwith "Not implemented"
+    override this.Name : string = failwith "Not implemented"
+    override this.Module : Module = failwith "Not implemented"
+    override this.GetCustomAttributes(``inherit``: bool) : obj []= failwith "Not implemented"
+    override this.GetCustomAttributes(attributeType: Type, ``inherit``: bool) : obj []= failwith "Not implemented"
+    override this.IsDefined(attributeType: Type, ``inherit``: bool) : bool= failwith "Not implemented"
diff --git a/tests/fsharp/typecheck/sigs/pos08.fs b/tests/fsharp/typecheck/sigs/pos08.fs
new file mode 100644
index 0000000..eefa2eb
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos08.fs
@@ -0,0 +1,248 @@
+module Pos08
+
+module Tests2 = 
+    let f2 () = 
+       lazy 
+         (let x = 1    // expect no error
+          x + x)
+
+    let f3 () = 
+       assert 
+         (let x = 1    // expect no error
+          (x + x = x + x))
+       1+2
+
+    let f21 () = 
+       lazy 
+          (match () with () -> 1) // expect no error
+
+    let f31 () = 
+       assert 
+          (match () with () -> true) // expect no error
+       1+2
+
+    let f22 () = 
+       lazy 
+          (while false do ())  // expect no error
+
+    let f32 () = 
+       assert 
+          (while false do ()  // expect no error
+           true)
+       1+2
+
+    let f23 () = 
+       lazy 
+         (try 1 with _ -> 2)  // expect no error
+
+    let f33 () = 
+       assert 
+         (try true with _ -> false)  // expect no error
+       1+2
+
+
+    let f24 () = 
+       lazy 
+          (if true then 1 else 2)  // expect no error
+
+    let f34 () = 
+       assert 
+          (if true then true else false)  // expect no error
+       1+2
+
+
+    let f25 () = 
+       lazy 
+          (for i in 0 .. 0 do ())  // expect no error
+
+    let f35 () = 
+       assert 
+          (for i in 0 .. 0 do ()// expect no error
+           true)
+       1+2
+
+    let f26 () = 
+       lazy 1 // expect no error
+
+    let f36 () = 
+       assert true // expect no error
+       1+2
+
+
+    let f27 () = 
+       lazy id 1 // expect no error
+
+    let f37 () = 
+       assert id true // expect no error
+       1+2
+
+module Tests3 = 
+    let f2 () = 
+       lazy 
+          let x = 1    // expect no error
+          x + x
+
+    let f3 () = 
+       assert 
+          let x = 1    // expect no error
+          (x + x = x + x)
+       1+2
+
+    let f21 () = 
+       lazy 
+          match () with () -> 1 // expect no error
+
+    let f31 () = 
+       assert 
+          match () with () -> true // expect no error
+       1+2
+
+    let f22 () = 
+       lazy 
+          while false do ()  // expect no error
+
+    let f32 () = 
+       assert 
+          while false do ()  // expect no error
+          true 
+       1+2
+
+    let f23 () = 
+       lazy 
+          try 1 with _ -> 2  // expect no error
+
+    let f33 () = 
+       assert 
+          try true with _ -> false  // expect no error
+       1+2
+
+
+    let f24 () = 
+       lazy 
+          if true then 1 else 2  // expect no error
+
+    let f34 () = 
+       assert 
+          if true then true else false  // expect no error
+       1+2
+
+
+    let f25 () = 
+       lazy 
+          for i in 0 .. 0 do ()  // expect no error
+
+    let f35 () = 
+       assert 
+          for i in 0 .. 0 do ()// expect no error
+          true 
+       1+2
+
+    let gf21 () = 
+       lazy match () with () -> 1 // expect no error
+
+    let gf31 () = 
+       assert match () with () -> true // expect no error
+       1+2
+
+    let gf22 () = 
+       lazy while false do ()  // expect no error
+
+    let gf32 () = 
+       assert while false do ()  // expect no error
+              true 
+       1+2
+
+    let gf23 () = 
+       lazy try 1 with _ -> 2  // expect no error
+
+    let gf33 () = 
+       assert try true with _ -> false  // expect no error
+       1+2
+
+
+    let gf24 () = 
+       lazy if true then 1 else 2  // expect no error
+
+    let gf34 () = 
+       assert if true then true else false  // expect no error
+       1+2
+
+
+    let gf25 () = 
+       lazy for i in 0 .. 0 do ()  // expect no error
+
+    let gf35 () = 
+       assert for i in 0 .. 0 do ()// expect no error
+              true 
+       1+2
+
+    let gf26 () = 
+       lazy let x = 1    // expect no error
+            x + x
+
+    let gf36 () = 
+       assert let x = 1  // expect no error
+              x = x 
+       1+2
+
+module NonControlFlowTests = 
+    let (a: Lazy<int>), (b: int) = lazy 1, 2
+    
+    let (++) (a:Lazy<int>) (b:Lazy<int>) = a.Force() + b.Force()
+    let (b2: int) = lazy 1 ++ lazy 2
+    
+    let (a3: Lazy<int>), (b3: int) = 
+        lazy 1, 
+        2
+    
+module CheckOverloadResolutionAgainstSignatureInformationGivenByPatterns = 
+
+    module Positive1 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M { f1 = 3 } // Expect no error
+            member x.M(y: R1) = ()
+            member x.M(y: R2) = ()
+
+    module Positive2 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M { f1 = 3 } // Expect no error
+            member x.M((y: R1)) = ()
+            member x.M((y: R2)) = ()
+        
+    module Positive3 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M { f1 = 3 } // Expect no error
+            member x.M(_ as p : R2) = ()
+            member x.M(_ as p : R1) = ()
+
+    module Positive4 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        let (|Fail|_|) (x : 'a) : 'a option= None
+        type D() = 
+            member x.N = x.M { f1 = 3 } // Expect no error
+            member x.M(Fail(_) as p : R2) = ()
+            member x.M(Fail(_) as p : R1) = ()
+
+    module Positive5 = 
+        type R1 = { f1 : int }
+        type R2 = { f2 : int }
+        type D() = 
+            member x.N = x.M { f1 = 3 } // Expect no error
+            member x.M((y: R1)) = ()
+            member x.M(()) = ()
+        
+module CheckInitializationGraphInStaticMembers = 
+
+    module Positive6 = 
+        type C() = 
+           static let rec x = (); (fun () -> ignore x; ())        // expect warning, no runtime error
+           static member A = x
+           
+        C.A () // expect no runtime error
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos09.fs b/tests/fsharp/typecheck/sigs/pos09.fs
new file mode 100644
index 0000000..b0cbe1c
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos09.fs
@@ -0,0 +1,21 @@
+namespace pos09
+
+type A() = 
+    member this.Set(v : obj) = ()
+    member this.Set_1(name : string, v : obj) = ()
+    static member Set2(v : obj) = ()
+    static member Set2_1(name : string, v : obj) = ()
+
+module Test =
+
+    let inline set (df:^a) (value:^b)=(^a : (member Set : ^b -> unit) (df, value))
+    let inline set_1 (df:^a) (name : string) (value:^b)=(^a : (member Set_1 : string -> ^b -> unit) (df, name, value))
+    let inline set2< ^t, ^b when ^t : (static member Set2 : ^b -> unit)> (value:^b)=(^t : (static member Set2 : ^b -> unit) (value))
+    let inline set2_1< ^t, ^b when ^t : (static member Set2_1 : string -> ^b -> unit)> (name : string) (value:^b)=(^t : (static member Set2_1 : string -> ^b -> unit) (name, value))
+
+    let a = A()
+    set a 1.0
+    set2<A, _> 2.0
+
+    set_1 a "name" 3.0
+    set2_1<A, _> "name" 5.0
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos10.fs b/tests/fsharp/typecheck/sigs/pos10.fs
new file mode 100644
index 0000000..954b3f9
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos10.fs
@@ -0,0 +1,6 @@
+module Test
+let foo<'a when 'a : (new : unit -> 'a)>() = new 'a()
+[<CLIMutable>]
+type Recd = {f : int}
+// records with CLIMutable should satisfy 'default ctor' constraint
+foo<Recd>().f = 0
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos11.fs b/tests/fsharp/typecheck/sigs/pos11.fs
new file mode 100644
index 0000000..8ccc03d
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos11.fs
@@ -0,0 +1,130 @@
+// verify type inference can determine proper type for lambda args when there are multiple overloads containing lambdas
+module LambdaOverloadTypeInference
+
+open System.Linq
+
+let xs = ["1"]
+let qs = ["1"].AsQueryable()
+
+let inline f1 (x : ^a) =
+    ( ^a : (member Length : int) (x))
+
+let f2 (x : 'a) =
+    (2, x)
+
+let f3 x i =
+    i
+
+let _ = xs.Sum(fun x -> x.Length)
+let _ = xs.Select(fun x -> x.Length)
+let _ = xs.Where(fun x -> x.Length % 3 = 0).Select(fun x -> x.Length)
+let _ = xs.Select(fun x i -> (x.Length, i))
+let _ = xs.Sum(fun x -> 64L)
+let _ = xs.Sum(fun x -> 1.)
+let _ = xs.Sum(fun x -> decimal 1.0)
+let _ = xs.Select(fun x _ -> x.Length)
+let _ = xs.Select(fun _ i -> i)
+let _ = xs.Where(fun x i -> x.Length % 3 = 0)
+let _ = xs.Where(fun x _ -> x.Length % 3 = 0)
+let _ = xs.Select(f1)
+let _ = xs.Sum(f1)
+let _ = xs.Select(f2)
+let _ = xs.Select(f3)
+let _ = xs.SelectMany(fun x -> seq { yield x.Length })
+// let _ = xs.SelectMany(fun x -> [ x.Length ])
+let _ = xs.SelectMany(fun x i -> seq { yield (float i, x.Length) })
+// let _ = xs.SelectMany((fun x -> seq { yield x.Length }), (fun x i -> (i, x.Length)))
+// let _ = xs.SelectMany((fun x i -> seq { yield (i, x.Length) }), (fun x tup -> (tup, x.Length)))
+let _ = xs.GroupBy(fun src -> src.Length)
+//let _ = xs.GroupBy((fun src -> src.Length), (fun key grp -> grp.Count()) )
+let _ = xs.Join([2], (fun x -> x.Length), (fun i -> i), (fun x i -> x.Length = i))
+
+let _ = qs.Sum(fun x -> x.Length)
+let _ = qs.Select(fun x -> x.Length)
+let _ = qs.Where(fun x -> x.Length % 3 = 0).Select(fun x -> x.Length)
+let _ = qs.Select(fun x i -> (x.Length, i))
+let _ = qs.Sum(fun x -> 64L)
+let _ = qs.Sum(fun x -> 1.)
+let _ = qs.Sum(fun x -> decimal 1.0)
+let _ = qs.Select(fun x _ -> x.Length)
+let _ = qs.Select(fun _ i -> i)
+let _ = qs.Where(fun x i -> x.Length % 3 = 0)
+let _ = qs.Where(fun x _ -> x.Length % 3 = 0)
+let _ = qs.Select(f1)
+let _ = qs.Sum(f1)
+let _ = qs.Select(f2)
+let _ = qs.Select(f3)
+let _ = qs.SelectMany(fun x -> seq { yield x.Length })
+// let _ = qs.SelectMany(fun x -> [ x.Length ])
+let _ = qs.SelectMany(fun x i -> seq { yield (float i, x.Length) })
+// let _ = qs.SelectMany((fun x -> seq { yield x.Length }), (fun x i -> (i, x.Length)))
+// let _ = qs.SelectMany((fun x i -> seq { yield (i, x.Length) }), (fun x tup -> (tup, x.Length)))
+let _ = qs.GroupBy(fun src -> src.Length)
+//let _ = qs.GroupBy((fun src -> src.Length), (fun key grp -> grp.Count()) )
+let _ = qs.Join([2], (fun x -> x.Length), (fun i -> i), (fun x i -> x.Length = i))
+
+
+type Repro<'a>(x : 'a) =
+    member this.Meth( f1 : 'a -> 'b ) = ()
+    member this.Meth( f1 : int) = ()
+    member this.Meth( f1 : 'a) = ()
+    member this.Meth( f1 : 'a, f2 : 'a) = ()
+    member this.Meth( f1 : 'a -> 'b, f2 : 'a -> 'b) = ()
+    member this.Meth( f1x : 'a -> 'b -> 'c) = ()
+    member this.Meth( f1 : int, f2 : int) = ()
+
+let z = Repro("foo")
+
+z.Meth(fun a -> a.Length)
+z.Meth(f1 = (fun a -> a.Length))
+
+z.Meth(1)
+z.Meth(f1 = 1)
+
+z.Meth("str")
+z.Meth(f1 = "str")
+
+z.Meth("str", "str")
+z.Meth(f1 = "str", f2 = "str")
+
+z.Meth(1, 2)
+z.Meth(f1 = 1, f2 = 2)
+
+//z.Meth(fun a b -> a.Length)
+z.Meth(f1x = (fun a b -> a.Length))
+
+//z.Meth(fun a -> fun b -> a.Length)
+z.Meth(f1x = (fun a -> fun b -> a.Length))
+
+//z.Meth((fun a -> a.Length), (fun a2 -> a2.Length))
+//z.Meth(f1 = (fun a -> a.Length), f2 = (fun a2 -> a2.Length))
+
+let z2 = Repro(id)
+
+z2.Meth(fun a -> ())
+z2.Meth(f1 = (fun a -> ()))
+
+z2.Meth(1)
+z2.Meth(f1 = 1)
+
+z2.Meth(fun () -> ())
+z2.Meth(f1 = (fun () -> ()))
+
+z2.Meth((fun () -> ()), (fun () -> ()))
+
+z2.Meth(1, 2)
+z2.Meth(f1 = 1, f2 = 2)
+
+type TestTy() = class end
+
+type Repro2<'a, 'b, 'c>(x : 'a, y : 'b, z : 'c) =
+    member this.Meth( f1 : 'b -> 'c ) = ()
+    member this.Meth( f1 : 'a) = ()
+
+let z3 = Repro2((fun (s : string) -> s), "", 10)
+z3.Meth(fun s  -> s.Length)
+z3.Meth(fun s  -> s)
+
+let z4 = Repro2((fun (s : float) -> s), "", 10)
+//z4.Meth(fun s  -> s.Length)
+z4.Meth(fun s  -> s)
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos12.fs b/tests/fsharp/typecheck/sigs/pos12.fs
new file mode 100644
index 0000000..d23fc96
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos12.fs
@@ -0,0 +1,30 @@
+// verify type inference works properly when extending asyncbuilder with Task bind and return methods
+module AsyncTaskBind
+
+open System.Threading.Tasks
+
+type Microsoft.FSharp.Control.AsyncBuilder with
+    member x.Bind(computation:Task<'T>, binder:'T -> Async<'R>) =  x.Bind(Async.AwaitTask computation, binder)
+    member x.ReturnFrom(computation:Task<'T>) = x.ReturnFrom(Async.AwaitTask computation)
+
+let f1a p            = async { let! a = p in return a }
+let f1b (p:Task<'T>) = async { let! a = p in return a }
+
+let f2a (p:Async<string>) = async.Delay (fun () -> async.Bind(p, (fun a -> async.Return a)))
+let f2b (p:Task<string>) = async.Delay (fun () -> async.Bind(p, (fun a -> async.Return a)))
+
+let f3a (p:Async<string>) = async { let! a = p in return (a.EndsWith("3")) }
+let f3b (p:Task<string>) = async { let! a = p in return (a.EndsWith("3")) }
+
+let f5a (p:Async<string>) = async.Bind(p, (fun a -> if a.EndsWith("3") then async.Return 1 else async.Return 2))
+let f5b (p:Task<string>) = async.Bind(p, (fun a -> if a.EndsWith("3") then async.Return 1 else async.Return 2))
+
+let f7a (p:Async<string>) = async.Bind(p, (fun a -> async.Return (a.EndsWith("3"))))
+let f7b (p:Task<string>) = async.Bind(p, (fun a -> async.Return (a.EndsWith("3"))))
+
+let f7an1 (p:Async<string>) = async.Bind(p, binder=(fun a -> async.Return (a.EndsWith("3"))))
+let f7bn2 (p:Task<string>) = async.Bind(computation=p, binder=(fun a -> async.Return (a.EndsWith("3"))))
+
+let f8a (p:Async<string>) = async.Delay (fun () -> async.Bind(p, (fun a -> async.Return (a.EndsWith("3")))))
+let f8b (p:Task<string>) = async.Delay (fun () -> async.Bind(p, (fun a -> async.Return (a.EndsWith("3")))))
+let f8c (p:Task<string>) = (fun (a:AsyncBuilder) -> a.Delay (fun () -> a.Bind(p, (fun _arg1 -> let v = _arg1 in a.Return (v.EndsWith("3")))))) async
\ No newline at end of file
diff --git a/tests/fsharp/typecheck/sigs/pos13.fs b/tests/fsharp/typecheck/sigs/pos13.fs
new file mode 100644
index 0000000..c7421dc
--- /dev/null
+++ b/tests/fsharp/typecheck/sigs/pos13.fs
@@ -0,0 +1,10 @@
+type Enum1 = | E = 1
+    
+module Ext = 
+    type Enum1
+    with
+    member this.Foo() = 42 // ok - extrinsic extension
+
+open Ext
+let r = Enum1.E.Foo()
+exit(if r = 42 then 0 else 1)
diff --git a/tests/fsharp/typecheck/tdirs b/tests/fsharp/typecheck/tdirs
new file mode 100644
index 0000000..5b5af8b
--- /dev/null
+++ b/tests/fsharp/typecheck/tdirs
@@ -0,0 +1,2 @@
+misc
+sigs
diff --git a/tests/run.bat b/tests/run.bat
new file mode 100644
index 0000000..acfa1ba
--- /dev/null
+++ b/tests/run.bat
@@ -0,0 +1,32 @@
+ at if "%_echo%"=="" echo off
+
+setlocal
+set _ScriptHome=%~dp0%
+
+if exist tdirs (
+ for /f %%i in (tdirs) do ( 
+  if exist "%%i" (
+	pushd %%i
+        echo **************************************************
+        cd
+        echo **************************************************
+        call %_ScriptHome%\run.bat
+	if ERRORLEVEL 1 goto Exit
+	popd
+  )
+ )
+)
+
+if NOT exist tdirs (
+   if exist run.bat (
+        call .\run.bat
+	if ERRORLEVEL 1 goto Exit
+   ) 
+)
+
+echo Ran ok.
+:Exit
+endlocal
+
+exit /b %ERRORLEVEL%
+
diff --git a/tests/run40.bat b/tests/run40.bat
new file mode 100644
index 0000000..5b167ae
--- /dev/null
+++ b/tests/run40.bat
@@ -0,0 +1,14 @@
+ at if "%_echo%"=="" echo off
+
+set _SCRIPT_DRIVE=%~d0
+set _SCRIPT_PATH=%~p0
+set _SCRIPT_ROOT=%_SCRIPT_DRIVE%%_SCRIPT_PATH%
+
+set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools;%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE;%_SCRIPT_ROOT%\..\Release\net40\bin;%_SCRIPT_ROOT%\..\Proto\built\net40\bin;%SystemRoot%\Microsoft.NET\Framework\v4.0.30319;%PATH%
+
+set FSHARP_HOME=%_SCRIPT_ROOT%
+
+set TARGETFSHARP=VS2010
+
+color 6
+title "%_SCRIPT_ROOT% Test Environment"
diff --git a/tests/run40d.bat b/tests/run40d.bat
new file mode 100644
index 0000000..6d1c684
--- /dev/null
+++ b/tests/run40d.bat
@@ -0,0 +1,14 @@
+ at if "%_echo%"=="" echo off
+
+set _SCRIPT_DRIVE=%~d0
+set _SCRIPT_PATH=%~p0
+set _SCRIPT_ROOT=%_SCRIPT_DRIVE%%_SCRIPT_PATH%
+
+set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools;%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE;%_SCRIPT_ROOT%\..\Debug\net40\bin;%_SCRIPT_ROOT%\..\Proto\built\net40\bin;%SystemRoot%\Microsoft.NET\Framework\v4.0.30319;%PATH%
+
+set FSHARP_HOME=%_SCRIPT_ROOT%
+
+set TARGETFSHARP=VS2010
+
+color 6
+title "%_SCRIPT_ROOT% Test Environment"
diff --git a/tests/tdirs b/tests/tdirs
new file mode 100644
index 0000000..cdd2a5e
--- /dev/null
+++ b/tests/tdirs
@@ -0,0 +1 @@
+fsharp
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-cli-apps/packages/fsharp.git



More information about the Pkg-cli-apps-commits mailing list