Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest updates from master #992

Merged
merged 32 commits into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
02307b1
Fix inlining on subtypes
dsyme Dec 4, 2015
f2e8505
Update array.fs
Jan 7, 2016
21826e8
Update test.fsx
dsyme Jan 25, 2016
ec2c264
Merge branch 'master' of https://github.com/Microsoft/visualfsharp in…
dsyme Jan 29, 2016
bba7ad2
Merge branch 'fix-740' of https://github.com/dsyme/visualfsharp into …
dsyme Jan 29, 2016
1881a37
Use correct flags to create ctor calls for DispatchWrapper and Unknow…
latkin Jan 29, 2016
6e5fc14
Update COM optional arg handling to match C# and VB
latkin Jan 29, 2016
769b0cf
Add test for optional COM arguments
latkin Jan 30, 2016
7782514
removed lkg FsSrGen
enricosada Feb 12, 2016
5461194
update doc
enricosada Feb 12, 2016
407369c
add dependency to FsSrGen package
enricosada Feb 12, 2016
3a8fc4e
[TEMP] add FsSrGen ci nuget feed
enricosada Feb 12, 2016
3457c5a
use FsSrGen.exe in package directory
enricosada Feb 12, 2016
e3937b2
remove disabled EnsureThereAreNoUnusedFsSrGenResources
enricosada Feb 12, 2016
45c6b3b
remove now useless FindUnusedResources.exe (was used by EnsureThereAr…
enricosada Feb 12, 2016
3718d43
use latest FsSrGen package
enricosada Feb 15, 2016
f36edb3
remove lkg FSharp.SRGen.Build.Tasks
enricosada Feb 17, 2016
099e339
use FSharp.SRGen.Build.Tasks package
enricosada Feb 17, 2016
6d12279
update docs
enricosada Feb 17, 2016
2dcce7f
use msbuild target file from package
enricosada Feb 17, 2016
2ec299f
use latest FsSrGen package
enricosada Feb 18, 2016
87abc35
use final FsSrGen 2.0.0
enricosada Feb 18, 2016
b7143b6
remove fssrgen ci feed, download package from nuget.org feed
enricosada Feb 18, 2016
629d651
use property for FSharp.SRGen.Build.Tasks package version
enricosada Feb 22, 2016
ca9d289
use property for FsSrGen package version
enricosada Feb 22, 2016
0061aa7
Merge pull request #963 from enricosada/use_fssrgen_package
Feb 22, 2016
527a54f
Merge pull request #854 from xenocons/patch-1
KevinRansom Feb 25, 2016
ba68a23
Merge pull request #919 from latkin/latkin-fix-907
KevinRansom Feb 25, 2016
0f925ac
Merge pull request #763 from dsyme/fix-740
KevinRansom Feb 25, 2016
53e0498
Fix Linq101Aggregates01.il baseline
KevinRansom Feb 26, 2016
f481bc8
Merge pull request #986 from KevinRansom/master
KevinRansom Feb 26, 2016
1602805
Fix merge conflicts
Mar 1, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nuget/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
<add key="myget.org roslyn-nightly" value="https://www.myget.org/F/roslyn-nightly" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
</configuration>
2 changes: 1 addition & 1 deletion DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Restart Visual Studio, it should now be running your freshly-built Visual F# IDE

1. The `update.cmd` script adds required strong name validation skips, and NGens the compiler and libraries. This requires admin privileges.
1. The compiler binaries produced are "private" and strong-named signed with a test key.
1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory.
1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll` and the other tools found in the `lkg` directory.
1. The overall bootstrapping process executes as follows
- We first need an existing F# compiler. We use the one in the `lkg` directory. Let's assume this compiler has an `FSharp.Core.dll` with version X.
- We use this compiler to compile the source in this distribution, to produce a "proto" compiler, dropped to the `proto` directory. When run, this compiler still relies on `FSharp.Core.dll` with version X.
Expand Down
2 changes: 1 addition & 1 deletion lkg/FSharp-14.0.23413.0/bin/FSharp.Core/README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
The copy of FSharp.Core in this directory is version 2.0.50726.900, required by FSharp.SRGen.Build.Tasks.dll and other legacy Power Pack libraries in the parent directory.
The copy of FSharp.Core in this directory is version 2.0.50726.900, required by legacy Power Pack libraries in the parent directory.

This copy of FSharp.Core.dll should not be referenced as an LKG, it is present merely as a workaround to enable the legacy libraries to work without needing to update the GAC.
Binary file not shown.
67 changes: 0 additions & 67 deletions lkg/FSharp-14.0.23413.0/bin/FSharp.SRGen.targets

This file was deleted.

Binary file removed lkg/FSharp-14.0.23413.0/bin/FindUnusedResources.exe
Binary file not shown.
Binary file removed lkg/FSharp-14.0.23413.0/bin/FsSrGen.exe
Binary file not shown.
4 changes: 3 additions & 1 deletion packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
<package id="Microsoft.CodeAnalysis.Features" version="1.2.0-beta1-20160218-02" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.2.0-beta1-20160218-02" targetFramework="net45" />
<package id="Microsoft.VisualStudio.LanguageServices" version="1.2.0-beta1-20160218-02" targetFramework="net46" />
</packages>
<package id="FsSrGen" version="2.0.0" targetFramework="net46" />
<package id="FSharp.SRGen.Build.Tasks" version="2.0.0" targetFramework="net46" />
</packages>
7 changes: 4 additions & 3 deletions src/FSharpSource.targets
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
<MicrosoftCompositionVersion>1.0.30</MicrosoftCompositionVersion>
<SystemCollectionsImmutableVersion>1.1.37</SystemCollectionsImmutableVersion>
<RoslynVersion>1.2.0-beta1-20160218-02</RoslynVersion>
<FsSrGenVersion>2.0.0</FsSrGenVersion>
<FsSrGenBuildTasksVersion>2.0.0</FsSrGenBuildTasksVersion>
</PropertyGroup>

<!-- v2.0-specific flags -->
Expand Down Expand Up @@ -710,7 +712,7 @@

<!-- Reference an existing FSI.EXE for use from within MSBuild -->
<PropertyGroup>
<FsSrGenToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsSrGenToolPath>
<FsSrGenToolPath>$(FSharpSourcesRoot)\..\packages\FsSrGen.$(FsSrGenVersion)\lib\net46</FsSrGenToolPath>
<FsLexToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsLexToolPath>
<FsYaccToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsYaccToolPath>
<FsLexToolExe>fslex.exe</FsLexToolExe>
Expand All @@ -723,7 +725,6 @@
<CompileDependsOn>ValidateConfiguration;$(CompileDependsOn);CustomCopyLocalFiles</CompileDependsOn>
<RootNamespace></RootNamespace>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
<EnsureThereAreNoUnusedFsSrGenResources>false</EnsureThereAreNoUnusedFsSrGenResources>
</PropertyGroup>

<Target Name="ValidateConfiguration">
Expand Down Expand Up @@ -761,7 +762,7 @@
</CreateItem>
</Target>

<Import Project="..\lkg\FSharp-$(LkgVersion)\bin\FSharp.SRGen.targets" />
<Import Project="..\packages\FSharp.SRGen.Build.Tasks.$(FsSrGenBuildTasksVersion)\content\FSharp.SRGen.targets" />

<Target Name="ReorderCompileItems"
BeforeTargets="CoreCompile"
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/FSharp.Core/array.fs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ namespace Microsoft.FSharp.Collections
checkNonNull "array" array
let len = array.Length
let rec loop i = i < len && (f array.[i] || loop (i+1))
loop 0
len > 0 && loop 0

[<CompiledName("Contains")>]
let inline contains e (array:'T[]) =
Expand Down
9 changes: 8 additions & 1 deletion src/fsharp/Optimizer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2749,7 +2749,14 @@ and OptimizeLambdas (vspec: Val option) cenv env topValInfo e ety =
let valu =
match baseValOpt with
| None -> CurriedLambdaValue (lambdaId,arities,bsize,expr',ety)
| _ -> UnknownValue
| Some baseVal ->
let fvs = freeInExpr CollectLocals body'
if fvs.UsesMethodLocalConstructs || fvs.FreeLocals.Contains baseVal then
UnknownValue
else
let expr2 = mkMemberLambdas m tps ctorThisValOpt None vsl (body',bodyty)
CurriedLambdaValue (lambdaId,arities,bsize,expr2,ety)


expr', { TotalSize=bsize + (if isTopLevel then methodDefnTotalSize else closureTotalSize); (* estimate size of new syntactic closure - expensive, in contrast to a method *)
FunctionSize=1;
Expand Down
14 changes: 8 additions & 6 deletions src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9128,11 +9128,13 @@ and TcMethodApplication
// Handle CallerSide optional arguments.
//
// CallerSide optional arguments are largely for COM interop, e.g. to PIA assemblies for Word etc.
// As a result we follow the VB spec here. To quote from an email exchange between the C# and VB teams.
// As a result we follow the VB and C# behavior here.
//
// "1. If the parameter is statically typed as System.Object and does not have a value, then there are two cases:
// a. The parameter may have the IDispatchConstantAttribute or IUnknownConstantAttribute attribute. If this is the case, the VB compiler then create an instance of the System.Runtime.InteropServices.DispatchWrapper /System.Runtime.InteropServices.UnknownWrapper type at the call site to wrap the value Nothing/null.
// b. If the parameter does not have those two attributes, we will emit Missing.Value.
// "1. If the parameter is statically typed as System.Object and does not have a value, then there are four cases:
// a. The parameter is marked with MarshalAs(IUnknown), MarshalAs(Interface), or MarshalAs(IDispatch). In this case we pass null.
// b. Else if the parameter is marked with IUnknownConstantAttribute. In this case we pass new System.Runtime.InteropServices.UnknownWrapper(null)
// c. Else if the parameter is marked with IDispatchConstantAttribute. In this case we pass new System.Runtime.InteropServices.DispatchWrapper(null)
// d. Else, we will pass Missing.Value.
// 2. Otherwise, if there is a value attribute, then emit the default value.
// 3. Otherwise, we emit default(T).
// 4. Finally, we apply conversions from the value to the parameter type. This is where the nullable conversions take place for VB.
Expand Down Expand Up @@ -9174,15 +9176,15 @@ and TcMethodApplication
| Some assemblyRef ->
let tref = mkILNonGenericBoxedTy(mkILTyRef(assemblyRef, "System.Runtime.InteropServices.DispatchWrapper"))
let mref = mkILCtorMethSpecForTy(tref,[cenv.g.ilg.typ_Object]).MethodRef
let expr = Expr.Op(TOp.ILCall(false,false,false,false,CtorValUsedAsSuperInit,false,false,mref,[],[],[cenv.g.obj_ty]),[],[mkDefault(mMethExpr,currCalledArgTy)],mMethExpr)
let expr = Expr.Op(TOp.ILCall(false,false,false,true,NormalValUse,false,false,mref,[],[],[cenv.g.obj_ty]),[],[mkDefault(mMethExpr,currCalledArgTy)],mMethExpr)
emptyPreBinder,expr
| WrapperForIUnknown ->
match cenv.g.ilg.traits.SystemRuntimeInteropServicesScopeRef.Value with
| None -> error(Error(FSComp.SR.fscSystemRuntimeInteropServicesIsRequired(), mMethExpr))
| Some assemblyRef ->
let tref = mkILNonGenericBoxedTy(mkILTyRef(assemblyRef, "System.Runtime.InteropServices.UnknownWrapper"))
let mref = mkILCtorMethSpecForTy(tref,[cenv.g.ilg.typ_Object]).MethodRef
let expr = Expr.Op(TOp.ILCall(false,false,false,false,CtorValUsedAsSuperInit,false,false,mref,[],[],[cenv.g.obj_ty]),[],[mkDefault(mMethExpr,currCalledArgTy)],mMethExpr)
let expr = Expr.Op(TOp.ILCall(false,false,false,true,NormalValUse,false,false,mref,[],[],[cenv.g.obj_ty]),[],[mkDefault(mMethExpr,currCalledArgTy)],mMethExpr)
emptyPreBinder,expr
| PassByRef (ty, dfltVal2) ->
let v,_ = mkCompGenLocal mMethExpr "defaultByrefArg" ty
Expand Down
9 changes: 6 additions & 3 deletions src/fsharp/infos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,12 @@ type OptionalArgInfo =
let ty = destByrefTy g ty
PassByRef (ty, analyze ty)
elif isObjTy g ty then
if TryFindILAttributeOpt g.attrib_IDispatchConstantAttribute ilParam.CustomAttrs then WrapperForIDispatch
elif TryFindILAttributeOpt g.attrib_IUnknownConstantAttribute ilParam.CustomAttrs then WrapperForIUnknown
else MissingValue
match ilParam.Marshal with
| Some(ILNativeType.IUnknown | ILNativeType.IDispatch | ILNativeType.Interface) -> Constant(ILFieldInit.Null)
| _ ->
if TryFindILAttributeOpt g.attrib_IUnknownConstantAttribute ilParam.CustomAttrs then WrapperForIUnknown
elif TryFindILAttributeOpt g.attrib_IDispatchConstantAttribute ilParam.CustomAttrs then WrapperForIDispatch
else MissingValue
else
DefaultValue
CallerSide (analyze (ImportTypeFromMetadata amap m ilScope ilTypeInst [] ilParam.Type))
Expand Down
3 changes: 3 additions & 0 deletions tests/RunTests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ set OSARCH=%PROCESSOR_ARCHITECTURE%
set X86_PROGRAMFILES=%ProgramFiles%
if "%OSARCH%"=="AMD64" set X86_PROGRAMFILES=%ProgramFiles(x86)%

set SYSWOW64=.
if "%OSARCH%"=="AMD64" set SYSWOW64=SysWoW64

set REGEXE32BIT=reg.exe
if not "%OSARCH%"=="x86" set REGEXE32BIT=%WINDIR%\syswow64\reg.exe

Expand Down
24 changes: 21 additions & 3 deletions tests/fsharp/core/subtype/test.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -1484,9 +1484,9 @@ module TestTwoConversionsOK =
// 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
// 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
// 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.
Expand Down Expand Up @@ -1696,6 +1696,24 @@ module RecordPropertyConstraintTests =
check "ckjwnewk" (f8()) (System.TimeSpan.FromSeconds 2.0) // after mutation
check "ckjwnewk" (f10()) "Gary"

// See https://github.com/Microsoft/visualfsharp/issues/740 - inlining on subtypes was not allowed
module InliningOnSubTypes1 =
type A() =
static member inline dosomething() = ()

type B() =
inherit A()
member inline this.SomethingElse a = a + 10
member inline this.SomethingElse2 a b = a + b + 10

let f () =
let b = B()
let x1 = b.SomethingElse 3
let x2 = b.SomethingElse2 3 4
(x1, x2)
do check "clkewlijwlkw" (f()) (13, 17)



// See https://github.com/Microsoft/visualfsharp/issues/238
module GenericPropertyConstraintSolvedByRecord =
Expand All @@ -1711,4 +1729,4 @@ let aa =

do (stdout.WriteLine "Test Passed";
System.IO.File.WriteAllText("test.ok","ok");
exit 0)
exit 0)
Loading