Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit99a552c

Browse files
committed
Merge branch 'fsharp4' ofhttp://github.com/Microsoft/visualfsharp into fix-123
2 parentsd91cb38 +d17d429 commit99a552c

File tree

44 files changed

+630
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+630
-131
lines changed

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Utils.dll
9494
tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExprLibrary.dll
9595

9696
*.csproj.user
97+
98+
*.ide
99+
*.log
100+
*.jrs
101+
*.chk

‎.nuget/NuGet.Config‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<addkey="disableSourceControlIntegration"value="true" />
5+
</solution>
6+
</configuration>

‎.nuget/NuGet.exe‎

1.59 MB
Binary file not shown.

‎.nuget/NuGet.targets‎

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ProjectToolsVersion="4.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDirCondition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds-->
7+
<RestorePackagesCondition=" '$(RestorePackages)' == ''">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project-->
10+
<BuildPackageCondition=" '$(BuildPackage)' == ''">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages-->
13+
<RequireRestoreConsentCondition=" '$(RequireRestoreConsent)' != 'false'">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist-->
16+
<DownloadNuGetExeCondition=" '$(DownloadNuGetExe)' == ''">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroupCondition=" '$(PackageSources)' == ''">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used-->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list-->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroupCondition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands-->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
32+
</PropertyGroup>
33+
34+
<PropertyGroupCondition=" '$(OS)' != 'Windows_NT'">
35+
<!-- We need to launch nuget.exe with the mono command if we're not on windows-->
36+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
37+
<PackagesConfig>packages.config</PackagesConfig>
38+
</PropertyGroup>
39+
40+
<PropertyGroup>
41+
<!-- NuGet command-->
42+
<NuGetExePathCondition=" '$(NuGetExePath)' == ''">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
43+
<PackageSourcesCondition=" $(PackageSources) == ''">@(PackageSource)</PackageSources>
44+
45+
<NuGetCommandCondition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
46+
<NuGetCommandCondition=" '$(OS)' != 'Windows_NT'">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
47+
48+
<PackageOutputDirCondition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
49+
50+
<RequireConsentSwitchCondition=" $(RequireRestoreConsent) == 'true'">-RequireConsent</RequireConsentSwitch>
51+
<NonInteractiveSwitchCondition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT'">-NonInteractive</NonInteractiveSwitch>
52+
53+
<PaddedSolutionDirCondition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
54+
<PaddedSolutionDirCondition=" '$(OS)' != 'Windows_NT'">"$(SolutionDir)"</PaddedSolutionDir>
55+
56+
<!-- Commands-->
57+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
58+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
59+
60+
<!-- We need to ensure packages are restored prior to assembly resolve-->
61+
<BuildDependsOnCondition="$(RestorePackages) == 'true'">
62+
RestorePackages;
63+
$(BuildDependsOn);
64+
</BuildDependsOn>
65+
66+
<!-- Make the build depend on restore packages-->
67+
<BuildDependsOnCondition="$(BuildPackage) == 'true'">
68+
$(BuildDependsOn);
69+
BuildPackage;
70+
</BuildDependsOn>
71+
</PropertyGroup>
72+
73+
<TargetName="CheckPrerequisites">
74+
<!-- Raise an error if we're unable to locate nuget.exe-->
75+
<ErrorCondition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')"Text="Unable to locate '$(NuGetExePath)'" />
76+
<!--
77+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
78+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
79+
parallel builds will have to wait for it to complete.
80+
-->
81+
<MsBuildTargets="_DownloadNuGet"Projects="$(MSBuildThisFileFullPath)"Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
82+
</Target>
83+
84+
<TargetName="_DownloadNuGet">
85+
<DownloadNuGetOutputFilename="$(NuGetExePath)"Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
86+
</Target>
87+
88+
<TargetName="RestorePackages"DependsOnTargets="CheckPrerequisites">
89+
<ExecCommand="$(RestoreCommand)"
90+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
91+
92+
<ExecCommand="$(RestoreCommand)"
93+
LogStandardErrorAsError="true"
94+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
95+
</Target>
96+
97+
<TargetName="BuildPackage"DependsOnTargets="CheckPrerequisites">
98+
<ExecCommand="$(BuildCommand)"
99+
Condition=" '$(OS)' != 'Windows_NT'" />
100+
101+
<ExecCommand="$(BuildCommand)"
102+
LogStandardErrorAsError="true"
103+
Condition=" '$(OS)' == 'Windows_NT'" />
104+
</Target>
105+
106+
<UsingTaskTaskName="DownloadNuGet"TaskFactory="CodeTaskFactory"AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
107+
<ParameterGroup>
108+
<OutputFilenameParameterType="System.String"Required="true" />
109+
</ParameterGroup>
110+
<Task>
111+
<ReferenceInclude="System.Core" />
112+
<UsingNamespace="System" />
113+
<UsingNamespace="System.IO" />
114+
<UsingNamespace="System.Net" />
115+
<UsingNamespace="Microsoft.Build.Framework" />
116+
<UsingNamespace="Microsoft.Build.Utilities" />
117+
<CodeType="Fragment"Language="cs">
118+
<![CDATA[
119+
try {
120+
OutputFilename = Path.GetFullPath(OutputFilename);
121+
122+
Log.LogMessage("Downloading latest version of NuGet.exe...");
123+
WebClient webClient = new WebClient();
124+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
125+
126+
return true;
127+
}
128+
catch (Exception ex) {
129+
Log.LogErrorFromException(ex);
130+
return false;
131+
}
132+
]]>
133+
</Code>
134+
</Task>
135+
</UsingTask>
136+
</Project>

‎appveyor-build.cmd‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
@echoon
2+
3+
setAPPVEYOR_CI=1
4+
5+
:: Check prerequisites
6+
set_msbuildexe="%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild.exe"
7+
ifnotexist%_msbuildexe%set_msbuildexe="%ProgramFiles%\MSBuild\12.0\Bin\MSBuild.exe"
8+
ifnotexist%_msbuildexe%set_msbuildexe="%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe"
9+
ifnotexist%_msbuildexe%set_msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
10+
ifnotexist%_msbuildexe%echo Error: Could not find MSBuild.exe. Please see http://www.microsoft.com/en-us/download/details.aspx?id=40760.&&goto :eof
11+
12+
set_gacutilexe="%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe"
13+
ifnotexist%_gacutilexe%echo Error: Could not find gacutil.exe.&&goto :eof
14+
15+
.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages
16+
@if ERRORLEVEL1echo Error: Nuget restore failed&&goto :eof
17+
18+
::Build
19+
%_gacutilexe% /i lkg\FSharp-2.0.50726.900\bin\FSharp.Core.dll
20+
@if ERRORLEVEL1echo Error: gacutil failed&&goto :eof
21+
22+
%_msbuildexe% src\fsharp-proto-build.proj
23+
@if ERRORLEVEL1echo Error: compiler proto build failed&&goto :eof
24+
25+
ngen install lib\proto\fsc-proto.exe
26+
27+
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true
28+
@if ERRORLEVEL1echo Error: library debug build failed&&goto :eof
29+
30+
%_msbuildexe% src/fsharp-compiler-build.proj /p:UseNugetPackages=true
31+
@if ERRORLEVEL1echo Error: compile debug build failed&&goto :eof
32+
33+
REM We don't build new net20 FSharp.Core anymore
34+
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=net20
35+
REM @if ERRORLEVEL 1 echo Error: library net20 debug build failed && goto :eof
36+
37+
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
38+
@if ERRORLEVEL1echo Error: library portable47 debug build failed&&goto :eof
39+
40+
REM Dropped for faster build
41+
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
42+
REM @if ERRORLEVEL 1 echo Error: library portable7 debug build failed && goto :eof
43+
44+
45+
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
46+
@if ERRORLEVEL1echo Error: library portable78 debug build failed&&goto :eof
47+
48+
REM Dropped for faster build
49+
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable259
50+
REM @if ERRORLEVEL 1 echo Error: library portable259 debug build failed && goto :eof
51+
52+
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true
53+
@if ERRORLEVEL1echo Error: library unittests debug build failed&&goto :eof
54+
55+
56+
REM Dropped for faster build
57+
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47
58+
@REM if ERRORLEVEL 1 echo Error: library unittests debug build failed portable47 && goto :eof
59+
60+
REM Dropped for faster build
61+
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7
62+
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable7 && goto :eof
63+
64+
REM Dropped for faster build
65+
REM %_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78
66+
REM @if ERRORLEVEL 1 echo Error: library unittests debug build failed portable78 && goto :eof
67+
68+
69+
@echoon
70+
call src\update.cmd debug -ngen
71+
72+
@echoon
73+
call tests\BuildTestTools.cmd debug
74+
REM @if ERRORLEVEL 1 echo Error: 'tests\BuildTestTools.cmd debug' failed && goto :eof
75+
76+
@echoon
77+
78+
pushd tests
79+
80+
REM Disabled while working out perl problem, see https://github.com/Microsoft/visualfsharp/pull/169
81+
REM call RunTests.cmd debug fsharp Smoke
82+
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof
83+
84+
REM Disabled while working out perl problem, see https://github.com/Microsoft/visualfsharp/pull/169
85+
REM call RunTests.cmd debug fsharpqa Smoke
86+
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd debug fsharpqa Smoke' failed && goto :eof
87+
88+
setPATH=%PATH%;%~dp0%packages\NUnit.Runners.2.6.3\tools\
89+
call RunTests.cmd debug coreunit
90+
@if ERRORLEVEL1echo Error: 'RunTests.cmd debug coreunit' failed&&goto :eof
91+
92+
popd
93+
94+
95+

‎appveyor.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
init:
2+
build_script:
3+
-cmd:appveyor-build.cmd
4+
test:off
5+
version:0.0.1.{build}
6+
artifacts:
7+
-path:Debug
8+
name:Debug

‎packages.config‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<packageid="NUnit"version="2.6.3"targetFramework="net40" />
4+
<packageid="NUnit.Runners"version="2.6.3" />
5+
</packages>

‎src/fsharp/FSComp.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ lexfltSeparatorTokensOfPatternMatchMisaligned,"The '|' tokens separating rules o
10221022
1130,nrInvalidFieldLabel,"Invalid field label"
10231023
1132,nrInvalidExpression,"Invalid expression '%s'"
10241024
1133,nrNoConstructorsAvailableForType,"No constructors are available for the type '%s'"
1025-
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using.""
1025+
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using."
1026+
1135,nrRecordTypeNeedsQualifiedAccess,"The record type for the record field '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('%s') in the name you are using."
10261027
# -----------------------------------------------------------------------------
10271028
# ilwrite.fs errors
10281029
# -----------------------------------------------------------------------------
@@ -1309,7 +1310,6 @@ nicePrintOtherOverloads1,"+ 1 overload"
13091310
nicePrintOtherOverloadsN,"+ %d overloads"
13101311
erasedTo,"Erased to"
13111312
3156,parsUnfinishedExpression,"Unexpected token '%s' or incomplete expression"
1312-
3157,crefQuotationsCantContainByrefTypes,"Quotations cannot contain byref types"
13131313
3158,parsAttributeOnIncompleteCode,"Cannot find code target for this attribute, possibly because the code after the attribute is incomplete."
13141314
3159,parsTypeNameCannotBeEmpty,"Type name cannot be empty."
13151315
3160,buildProblemReadingAssembly,"Problem reading assembly '%s': %s"

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{TargetFrameworkDirectory};
2727
{Registry:Software\Microsoft\.NETFramework,v4.5,AssemblyFoldersEx};
2828
</AssemblySearchPaths>
29-
</PropertyGroup>
29+
</PropertyGroup>
3030
<PropertyGroup>
3131
<DefineConstantsCondition=" '$(TargetFramework)' == 'sl5'">$(DefineConstants);SILVERLIGHT</DefineConstants>
3232
<DefineConstants>$(DefineConstants);EXTENSIONTYPING</DefineConstants>
@@ -108,4 +108,10 @@
108108
<CompileInclude="SurfaceArea.4.0.fs"Condition="'$(TargetFramework)' == 'net40'"/>
109109
</ItemGroup>
110110
<ImportProject="$(FSharpSourcesRoot)\FSharpSource.targets" />
111+
<TargetName="BeforeResolveReferences"Condition="'$(UseNugetPackages)'=='true'">
112+
<CreatePropertyValue="$(ProjectDir)..\..\..\packages\NUnit.2.6.3\lib\;$(AssemblySearchPaths)">
113+
<OutputTaskParameter="Value"
114+
PropertyName="AssemblySearchPaths" />
115+
</CreateProperty>
116+
</Target>
111117
</Project>

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ open System
99
openFSharp.Core.Unittests.LibraryTestFx
1010
openNUnit.Framework
1111

12+
moduleLeakUtils=
13+
// when testing for liveness, the things that we want to observe must always be created in
14+
// a nested function call to avoid the GC (possibly) treating them as roots past the last use in the block.
15+
// We also need something non trivial to disuade the compiler from inlining in Release builds.
16+
typeToRun<'a>(f: unit->'a)=
17+
memberthis.Invoke()= f()
18+
19+
letrun(toRun:ToRun<'a>)= toRun.Invoke()
1220

1321
// ---------------------------------------------------
1422

@@ -103,7 +111,7 @@ type AsyncModule() =
103111

104112
letendMs= DateTime.Now.Millisecond
105113
letdelta= endMs- startMs
106-
Assert.IsTrue(abs((abs delta)-500)<50, sprintf"Delta is too big%d" delta)
114+
Assert.IsTrue(abs((abs delta)-500)<400, sprintf"Delta is too big%d" delta)
107115

108116
[<Test>]
109117
memberthis.``AwaitWaitHandle.TimeoutWithCancellation``()=
@@ -191,6 +199,41 @@ type AsyncModule() =
191199

192200
for_i=1to50do test()
193201

202+
203+
[<Test>]
204+
memberthis.``Async.AwaitWaitHandle does not leak memory``()=
205+
// This test checks that AwaitWaitHandle does not leak continuations (described in #131),
206+
// We only test the worst case - when the AwaitWaitHandle is already set.
207+
use manualResetEvent=new System.Threading.ManualResetEvent(true)
208+
209+
lettryToLeak()=
210+
letresource=
211+
LeakUtils.ToRun(fun()->
212+
letresource= obj()
213+
letwork=
214+
async{
215+
let!_= Async.AwaitWaitHandle manualResetEvent
216+
GC.KeepAlive(resource)
217+
return()
218+
}
219+
220+
work|> Async.RunSynchronously|> ignore
221+
WeakReference(resource))
222+
|> LeakUtils.run
223+
224+
Assert.IsTrue(resource.IsAlive)
225+
226+
GC.Collect()
227+
GC.WaitForPendingFinalizers()
228+
GC.Collect()
229+
GC.WaitForPendingFinalizers()
230+
GC.Collect()
231+
232+
Assert.IsFalse(resource.IsAlive)
233+
234+
// The leak hangs on a race condition which is really hard to trigger in F# 3.0, hence the 100000 runs...
235+
for_in1..100do tryToLeak()
236+
194237
[<Test>]
195238
memberthis.``AwaitWaitHandle.DisposedWaitHandle2``()=
196239
letwh=new System.Threading.ManualResetEvent(false)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp