Skip to content

Commit

Permalink
integrate & merge with latest HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme committed Jul 9, 2015
2 parents 4767d5b + dd8252e commit 248a14c
Show file tree
Hide file tree
Showing 194 changed files with 2,953 additions and 1,157 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ F# is a mature, open source, cross-platform, functional-first programming langua

Changes contributed here are packaged into the Visual F# Tools, the F# Open Edition, and other open source F# editing tools. Microsoft coordinates packaging this repository as part of the Visual F# Tools, while the F# community coordinates packaging it as the Open Edition of F# for use on Linux, OSX, Android, iOS, and other platforms, via the [fsharp/fsharp GitHub repo](https://github.com/fsharp/fsharp/).

## We're having a Bugbash!!!! find bugs and win a __Cup<`t>__

[Bug bash page](https://github.com/Microsoft/visualfsharp/wiki/Have-a-Cup-'t--Visual-F%23-Tools-March-Bugbash)


###Engineering status

[F# 4.0 status](https://github.com/Microsoft/visualfsharp/wiki/F%23-4.0-Status)
Expand Down
3 changes: 3 additions & 0 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4383,6 +4383,8 @@ and encodeCustomAttrValue ilg ty c =
match ty, c with
| ILType.Boxed tspec, _ when tspec.Name = tname_Object ->
[| yield! encodeCustomAttrElemTypeForObject c; yield! encodeCustomAttrPrimValue ilg c |]
| ILType.Array (shape, _), ILAttribElem.Null when shape = ILArrayShape.SingleDimensional ->
[| yield! i32AsBytes 0xFFFFFFFF |]
| ILType.Array (shape, elemType), ILAttribElem.Array (_,elems) when shape = ILArrayShape.SingleDimensional ->
[| yield! i32AsBytes elems.Length; for elem in elems do yield! encodeCustomAttrValue ilg elemType elem |]
| _ ->
Expand Down Expand Up @@ -4750,6 +4752,7 @@ let decodeILAttribData ilg (ca: ILAttribute) scope =
parseVal ty sigptr
| ILType.Array(shape,elemTy) when shape = ILArrayShape.SingleDimensional ->
let n,sigptr = sigptr_get_i32 bytes sigptr
if n = 0xFFFFFFFF then ILAttribElem.Null,sigptr else
let rec parseElems acc n sigptr =
if n = 0 then List.rev acc else
let v,sigptr = parseVal elemTy sigptr
Expand Down
8 changes: 4 additions & 4 deletions src/absil/ilreflect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,20 +1659,20 @@ let typeAttributesOfTypeEncoding x =


let typeAttributesOfTypeLayout cenv emEnv x =
let attr p =
let attr x p =
if p.Size =None && p.Pack = None then None
else
Some(convCustomAttr cenv emEnv
(IL.mkILCustomAttribute cenv.ilg
(mkILTyRef (cenv.ilg.traits.ScopeRef,"System.Runtime.InteropServices.StructLayoutAttribute"),
[mkILNonGenericValueTy (mkILTyRef (cenv.ilg.traits.ScopeRef,"System.Runtime.InteropServices.LayoutKind")) ],
[ ILAttribElem.Int32 0x02 ],
[ ILAttribElem.Int32 x ],
(p.Pack |> Option.toList |> List.map (fun x -> ("Pack", cenv.ilg.typ_int32, false, ILAttribElem.Int32 (int32 x)))) @
(p.Size |> Option.toList |> List.map (fun x -> ("Size", cenv.ilg.typ_int32, false, ILAttribElem.Int32 x)))))) in
match x with
| ILTypeDefLayout.Auto -> TypeAttributes.AutoLayout,None
| ILTypeDefLayout.Explicit p -> TypeAttributes.ExplicitLayout,(attr p)
| ILTypeDefLayout.Sequential p -> TypeAttributes.SequentialLayout, (attr p)
| ILTypeDefLayout.Explicit p -> TypeAttributes.ExplicitLayout,(attr 0x02 p)
| ILTypeDefLayout.Sequential p -> TypeAttributes.SequentialLayout, (attr 0x00 p)


//----------------------------------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,9 +1566,12 @@ let DefaultBasicReferencesForOutOfProjectSources =
// Note: this is not a partiuclarly good technique as it relying on the environment the compiler is executing in
// to determine the default references. However, System.Core will only fail to load on machines with only .NET 2.0,
// in which case the compiler will also be running as a .NET 2.0 process.
//
// NOTE: it seems this can now be removed now that .NET 4.x is minimally assumed when using this toolchain
if (try System.Reflection.Assembly.Load "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" |> ignore; true with _ -> false) then
yield "System.Core"

yield "System.Runtime"
yield "System.Web"
yield "System.Web.Services"
yield "System.Windows.Forms" ]
Expand All @@ -1595,6 +1598,7 @@ let SystemAssemblies primaryAssemblyName =
yield "System.Web.Services"
yield "System.Windows.Forms"
yield "System.Core"
yield "System.Runtime"
yield "System.Observable"
yield "System.Numerics"]

Expand Down Expand Up @@ -3859,7 +3863,9 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti

// Add the invalidation signal handlers to each provider
for provider in providers do
provider.PUntaint((fun tp -> tp.Invalidate.Add(fun _ -> invalidateCcu.Trigger ("The provider '" + fileNameOfRuntimeAssembly + "' reported a change"))), m)
provider.PUntaint((fun tp ->
let handler = tp.Invalidate.Subscribe(fun _ -> invalidateCcu.Trigger ("The provider '" + fileNameOfRuntimeAssembly + "' reported a change"))
tcImports.AttachDisposeAction(fun () -> try handler.Dispose() with _ -> ())), m)

match providers with
| [] ->
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/CompileOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ let ReportTime (tcConfig:TcConfig) descr =
| None -> ()
| Some prevDescr ->
if tcConfig.pause then
dprintf "[done '%s', entering '%s'] press any key... " prevDescr descr;
dprintf "[done '%s', entering '%s'] press <enter> to continue... " prevDescr descr;
System.Console.ReadLine() |> ignore;
// Intentionally putting this right after the pause so a debugger can be attached.
match tcConfig.simulateException with
Expand Down
10 changes: 6 additions & 4 deletions src/fsharp/ConstraintSolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef &&
not rfinfo.LiteralValue.IsSome &&
not rfinfo.RecdField.IsCompilerGenerated ->
Some (TTraitSolvedRecdProp (rfinfo, isSetProp))
Some (rfinfo, isSetProp)
| _ -> None)
match props with
| [ prop ] -> Some prop
Expand Down Expand Up @@ -1210,9 +1210,11 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
CollectThenUndo (fun trace -> ResolveOverloading csenv (WithTrace(trace)) nm ndeep true (0,0) AccessibleFromEverywhere calledMethGroup false (Some rty))

match recdPropSearch, methOverloadResult with
| Some a, None ->
// OK, the constraint is solved by a record property
ResultD a
| Some (rfinfo, isSetProp), None ->
// OK, the constraint is solved by a record property. Assert that the return types match.
let rty2 = if isSetProp then g.unit_ty else rfinfo.FieldType
SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace rty rty2 ++ (fun () ->
ResultD (TTraitSolvedRecdProp(rfinfo, isSetProp)))
| None, Some (calledMeth:CalledMeth<_>) ->
// OK, the constraint is solved.
// Re-run without undo to commit the inference equations. Throw errors away
Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead"
1242,parsMissingGreaterThan,"Unmatched '<'. Expected closing '>'"
1243,parsUnexpectedQuotationOperatorInTypeAliasDidYouMeanVerbatimString,"Unexpected quotation operator '<@' in type definition. If you intend to pass a verbatim string as a static argument to a type provider, put a space between the '<' and '@' characters."
1244,parsErrorParsingAsOperatorName,"Attempted to parse this as an operator name, but failed"
1245,lexInvalidUnicodeLiteral,"\U%s is not a valid Unicode character escape sequence"
# Fsc.exe resource strings
fscTooManyErrors,"Exiting - too many errors"
2001,docfileNoXmlSuffix,"The documentation file has no .xml suffix"
Expand Down Expand Up @@ -1340,3 +1341,4 @@ estApplyStaticArgumentsForMethodNotImplemented,"A type provider implemented GetS
3183,ppparsUnexpectedToken,"Unexpected token '%s' in preprocessor expression"
3184,ppparsIncompleteExpression,"Incomplete preprocessor expression"
3185,ppparsMissingToken,"Missing token '%s' in preprocessor expression"
3186,pickleMissingDefinition,"An error occurred while reading the F# metadata node at position %d in table '%s' of assembly '%s'. The node had no matching declaration. Please report this warning. You may need to recompile the F# assembly you are using."
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,17 @@ type ArrayModule() =
member this.ChunkBySize() =

// int Seq
Assert.AreEqual([| [|1..4|]; [|5..8|] |], Array.chunkBySize 4 [|1..8|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..10|] |], Array.chunkBySize 4 [|1..10|])
Assert.AreEqual([| [|1|]; [|2|]; [|3|]; [|4|] |], Array.chunkBySize 1 [|1..4|])
Assert.IsTrue([| [|1..4|]; [|5..8|] |] = Array.chunkBySize 4 [|1..8|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..10|] |] = Array.chunkBySize 4 [|1..10|])
Assert.IsTrue([| [|1|]; [|2|]; [|3|]; [|4|] |] = Array.chunkBySize 1 [|1..4|])
Assert.IsTrue([| [|1..3|]; [|4|] |] = Array.chunkBySize 3 [|1..4|])
Assert.IsTrue([| [|1..5|]; [|6..10|]; [|11..12|] |] = Array.chunkBySize 5 [|1..12|])

// string Seq
Assert.AreEqual([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |], Array.chunkBySize 2 [|"a";"b";"c";"d";"e"|])
Assert.IsTrue([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |] = Array.chunkBySize 2 [|"a";"b";"c";"d";"e"|])

// empty Seq
Assert.AreEqual([||], Array.chunkBySize 3 [||])
Assert.IsTrue([||] = Array.chunkBySize 3 [||])

// null Seq
let nullArr:_[] = null
Expand All @@ -172,18 +174,18 @@ type ArrayModule() =
member this.SplitInto() =

// int array
Assert.AreEqual([| [|1..4|]; [|5..7|]; [|8..10|] |], Array.splitInto 3 [|1..10|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..11|] |], Array.splitInto 3 [|1..11|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..12|] |], Array.splitInto 3 [|1..12|])
Assert.IsTrue([| [|1..4|]; [|5..7|]; [|8..10|] |] = Array.splitInto 3 [|1..10|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..11|] |] = Array.splitInto 3 [|1..11|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..12|] |] = Array.splitInto 3 [|1..12|])

Assert.AreEqual([| [|1..2|]; [|3|]; [|4|]; [|5|] |], Array.splitInto 4 [|1..5|])
Assert.AreEqual([| [|1|]; [|2|]; [|3|]; [|4|] |], Array.splitInto 20 [|1..4|])
Assert.IsTrue([| [|1..2|]; [|3|]; [|4|]; [|5|] |] = Array.splitInto 4 [|1..5|])
Assert.IsTrue([| [|1|]; [|2|]; [|3|]; [|4|] |] = Array.splitInto 20 [|1..4|])

// string array
Assert.AreEqual([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |], Array.splitInto 3 [|"a";"b";"c";"d";"e"|])
Assert.IsTrue([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |] = Array.splitInto 3 [|"a";"b";"c";"d";"e"|])

// empty array
Assert.AreEqual([| |], Array.splitInto 3 [| |])
Assert.IsTrue([| |] = Array.splitInto 3 [| |])

// null array
let nullArr:_[] = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,8 @@ type ArrayModule2() =
CheckThrowsArgumentNullException(fun() -> Array.truncate 1 null |> ignore)

// negative count
CheckThrowsArgumentException(fun() -> Array.truncate -1 [|1..5|] |> ignore)
Assert.AreEqual([| |], Array.truncate -1 [|1..5|])
Assert.AreEqual([| |], Array.truncate System.Int32.MinValue [|1..5|])

()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ type ListModule() =
member this.ChunkBySize() =

// int list
Assert.AreEqual([ [1..4]; [5..8] ], List.chunkBySize 4 [1..8])
Assert.AreEqual([ [1..4]; [5..8]; [9..10] ], List.chunkBySize 4 [1..10])
Assert.AreEqual([ [1]; [2]; [3]; [4] ], List.chunkBySize 1 [1..4])
Assert.IsTrue([ [1..4]; [5..8] ] = List.chunkBySize 4 [1..8])
Assert.IsTrue([ [1..4]; [5..8]; [9..10] ] = List.chunkBySize 4 [1..10])
Assert.IsTrue([ [1]; [2]; [3]; [4] ] = List.chunkBySize 1 [1..4])

// string list
Assert.AreEqual([ ["a"; "b"]; ["c";"d"]; ["e"] ], List.chunkBySize 2 ["a";"b";"c";"d";"e"])
Assert.IsTrue([ ["a"; "b"]; ["c";"d"]; ["e"] ] = List.chunkBySize 2 ["a";"b";"c";"d";"e"])

// empty list
Assert.AreEqual([], List.chunkBySize 3 [])
Assert.IsTrue([] = List.chunkBySize 3 [])

// invalidArg
CheckThrowsArgumentException (fun () -> List.chunkBySize 0 [1..10] |> ignore)
Expand All @@ -132,18 +132,18 @@ type ListModule() =
member this.SplitInto() =

// int list
Assert.AreEqual([ [1..4]; [5..7]; [8..10] ], List.splitInto 3 [1..10])
Assert.AreEqual([ [1..4]; [5..8]; [9..11] ], List.splitInto 3 [1..11])
Assert.AreEqual([ [1..4]; [5..8]; [9..12] ], List.splitInto 3 [1..12])
Assert.IsTrue([ [1..4]; [5..7]; [8..10] ] = List.splitInto 3 [1..10])
Assert.IsTrue([ [1..4]; [5..8]; [9..11] ] = List.splitInto 3 [1..11])
Assert.IsTrue([ [1..4]; [5..8]; [9..12] ] = List.splitInto 3 [1..12])

Assert.AreEqual([ [1..2]; [3]; [4]; [5] ], List.splitInto 4 [1..5])
Assert.AreEqual([ [1]; [2]; [3]; [4] ], List.splitInto 20 [1..4])
Assert.IsTrue([ [1..2]; [3]; [4]; [5] ] = List.splitInto 4 [1..5])
Assert.IsTrue([ [1]; [2]; [3]; [4] ] = List.splitInto 20 [1..4])

// string list
Assert.AreEqual([ ["a"; "b"]; ["c";"d"]; ["e"] ], List.splitInto 3 ["a";"b";"c";"d";"e"])
Assert.IsTrue([ ["a"; "b"]; ["c";"d"]; ["e"] ] = List.splitInto 3 ["a";"b";"c";"d";"e"])

// empty list
Assert.AreEqual([], List.splitInto 3 [])
Assert.IsTrue([] = List.splitInto 3 [])

// invalidArg
CheckThrowsArgumentException (fun () -> List.splitInto 0 [1..10] |> ignore)
Expand Down Expand Up @@ -335,7 +335,7 @@ type ListModule() =
Assert.AreEqual(expectedStrList, List.except strList2 strList1)

// empty list
let emptyIntList = []
let emptyIntList : int list = []
Assert.AreEqual([1..100], List.except emptyIntList intList1)
Assert.AreEqual(emptyIntList, List.except intList1 emptyIntList)
Assert.AreEqual(emptyIntList, List.except emptyIntList emptyIntList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,12 @@ type ListModule02() =
Assert.AreEqual(["str1";"str2"], List.truncate 2 ["str1";"str2";"str3"])

// empty list
Assert.AreEqual([], List.truncate 0 [])
Assert.AreEqual([], List.truncate 1 [])
Assert.AreEqual(([] : int list), List.truncate 0 ([] : int list))
Assert.AreEqual(([] : int list), List.truncate 1 ([] : int list))

// negative count
CheckThrowsArgumentException(fun() -> List.truncate -1 [1..5] |> ignore)
Assert.AreEqual(([] : int list), List.truncate -1 [1..5])
Assert.AreEqual(([] : int list), List.truncate System.Int32.MinValue [1..5])

()

Expand Down Expand Up @@ -983,7 +984,7 @@ type ListModule02() =
{
InputList = [1..10]
WindowSize = 25
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = None
} |> testWindowed
{
Expand All @@ -993,15 +994,15 @@ type ListModule02() =
Exception = None
} |> testWindowed
{
InputList = []
InputList = ([] : int list)
WindowSize = 2
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = None
} |> testWindowed
{
InputList = [1..10]
WindowSize = 0
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = Some typeof<ArgumentException>
} |> testWindowed

Expand All @@ -1028,7 +1029,7 @@ type ListModule02() =
if windowSize <= 0 then
CheckThrowsArgumentException (fun () -> List.windowed windowSize [1..arraySize] |> ignore)
elif arraySize < windowSize then
Assert.AreEqual(([] : int[] list), List.windowed windowSize [1..arraySize])
Assert.AreEqual(([] : int list list), List.windowed windowSize [1..arraySize])
else
Assert.AreEqual(expectedLists.[arraySize, windowSize], List.windowed windowSize [1..arraySize])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,11 @@ type SeqModule2() =

// null Seq
CheckThrowsArgumentNullException(fun() -> Seq.truncate 1 null |> ignore)

// negative count
VerifySeqsEqual Seq.empty <| Seq.truncate -1 (seq [1;2;4;5;7])
VerifySeqsEqual Seq.empty <| Seq.truncate System.Int32.MinValue (seq [1;2;4;5;7])

()

[<Test>]
Expand Down
3 changes: 2 additions & 1 deletion src/fsharp/FSharp.Core.Unittests/FSharp.Core/PrimTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ type UnboxAndOptionStuff() =
Assert.IsTrue( tryUnbox<int> (box 1) = Some 1)
Assert.IsTrue( tryUnbox<string> (box "") = Some "")
Assert.IsTrue( tryUnbox<string> (box 1) = None)


[<Test>]
member this.IsNull() =
Assert.IsTrue( isNull (null : string))
Assert.IsTrue( isNull (null : string[]))
Expand Down
Loading

0 comments on commit 248a14c

Please sign in to comment.