Skip to content

Commit 7673d5e

Browse files
authored
Merge pull request #9391 from dotnet/merges/master-to-release/dev16.7
Merge master to release/dev16.7
2 parents 592e933 + 9aeabc6 commit 7673d5e

File tree

15 files changed

+596
-559
lines changed

15 files changed

+596
-559
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20301.10">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20302.3">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>e4cb18bd64d291e5dc34e2f77317c33d5022a6b8</Sha>
8+
<Sha>9b71be0663493cd0e111b55536a2e1eeb272f54c</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

fcs/global.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"sdk": {
3-
"version": "3.1.100"
3+
"version": "3.1.200",
4+
"rollForward":"minor"
45
}
56
}

global.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"tools": {
3-
"dotnet": "3.1.100",
3+
"dotnet": "3.1.200",
44
"vs": {
5-
"version": "16.3",
5+
"version": "16.4",
66
"components": [
7-
"Microsoft.Net.Core.Component.SDK.2.1",
87
"Microsoft.VisualStudio.Component.FSharp"
98
]
109
}
1110
},
1211
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20301.10",
12+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20302.3",
1413
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1514
}
1615
}

src/absil/ilreflect.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,12 @@ type cenv =
325325

326326
let convResolveAssemblyRef (cenv: cenv) (asmref: ILAssemblyRef) qualifiedName =
327327
let assembly =
328-
match cenv.resolveAssemblyRef asmref with
328+
match cenv.resolveAssemblyRef asmref with
329329
| Some (Choice1Of2 path) ->
330-
FileSystem.AssemblyLoadFrom path
330+
// asmRef is a path but the runtime is smarter with assembly names so make one
331+
let asmName = AssemblyName.GetAssemblyName(path)
332+
asmName.CodeBase <- path
333+
FileSystem.AssemblyLoad asmName
331334
| Some (Choice2Of2 assembly) ->
332335
assembly
333336
| None ->
@@ -359,8 +362,6 @@ let convTypeRefAux (cenv: cenv) (tref: ILTypeRef) =
359362
| ILScopeRef.PrimaryAssembly ->
360363
convResolveAssemblyRef cenv cenv.ilg.primaryAssemblyRef qualifiedName
361364

362-
363-
364365
/// The (local) emitter env (state). Some of these fields are effectively global accumulators
365366
/// and could be placed as hash tables in the global environment.
366367
[<AutoSerializable(false)>]

src/fsharp/FSharp.Core/async.fs

Lines changed: 60 additions & 73 deletions
Large diffs are not rendered by default.

src/fsharp/fsi/fsi.fs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,11 +2809,18 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
28092809

28102810
let fsiInteractionProcessor = FsiInteractionProcessor(fsi, tcConfigB, fsiOptions, fsiDynamicCompiler, fsiConsolePrompt, fsiConsoleOutput, fsiInterruptController, fsiStdinLexerProvider, lexResourceManager, initialInteractiveState)
28112811

2812+
// Raising an exception throws away the exception stack making diagnosis hard
2813+
// this wraps the existing exception as the inner exception
2814+
let makeNestedException (userExn: #Exception) =
2815+
// clone userExn -- make userExn the inner exception, to retain the stacktrace on raise
2816+
let arguments = [| userExn.Message :> obj; userExn :> obj |]
2817+
Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception
2818+
28122819
let commitResult res =
28132820
match res with
28142821
| Choice1Of2 r -> r
28152822
| Choice2Of2 None -> raise (FsiCompilationException(FSIstrings.SR.fsiOperationFailed(), None))
2816-
| Choice2Of2 (Some userExn) -> raise userExn
2823+
| Choice2Of2 (Some userExn) -> raise (makeNestedException userExn)
28172824

28182825
let commitResultNonThrowing errorOptions scriptFile (errorLogger: CompilationErrorLogger) res =
28192826
let errs = errorLogger.GetErrors()

src/fsharp/pars.fsy

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4011,8 +4011,8 @@ atomicExpr:
40114011
| GLOBAL
40124012
{ SynExpr.Ident (ident(MangledGlobalName, rhs parseState 1)), false }
40134013

4014-
| nameop
4015-
{ SynExpr.Ident ($1), false }
4014+
| identExpr
4015+
{ $1, false }
40164016

40174017
| LBRACK listExprElements RBRACK
40184018
{ $2 (lhs parseState) false, false }
@@ -5334,6 +5334,16 @@ pathOp:
53345334
nameop:
53355335
| identOrOp { $1 }
53365336

5337+
identExpr:
5338+
| ident
5339+
{ SynExpr.Ident($1) }
5340+
5341+
| opName
5342+
{ let m = lhs parseState
5343+
let mLparen = mkFileIndexRange m.FileIndex m.Start (mkPos m.StartLine (m.StartColumn + 1))
5344+
let mRparen = mkFileIndexRange m.FileIndex (mkPos m.EndLine (m.EndColumn - 1)) m.End
5345+
SynExpr.Paren(SynExpr.Ident($1), mLparen, Some mRparen, m) }
5346+
53375347
topSeparator:
53385348
| SEMICOLON { }
53395349
| SEMICOLON_SEMICOLON { }

src/fsharp/service/ServiceParamInfoLocations.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module internal NoteworthyParamInfoLocationsImpl =
4646
| SynExpr.LongIdent (_, LongIdentWithDots(lid, _), _, lidRange)
4747
| SynExpr.DotGet (_, _, LongIdentWithDots(lid, _), lidRange) -> Some (pathOfLid lid, lidRange)
4848
| SynExpr.TypeApp (synExpr, _, _synTypeList, _commas, _, _, _range) -> digOutIdentFromFuncExpr synExpr
49+
| SynExpr.Paren(expr = expr) -> digOutIdentFromFuncExpr expr
4950
| _ -> None
5051

5152
type FindResult =

tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,22 +533,37 @@ type AsyncType() =
533533

534534
[<Test>]
535535
member this.NonGenericTaskAsyncValueCancellation () =
536-
use ewh = new ManualResetEvent(false)
536+
use ewh = new ManualResetEvent(false)
537537
let cts = new CancellationTokenSource()
538538
let token = cts.Token
539539
#if !NET46
540-
let t =
540+
let t =
541541
#else
542542
use t =
543-
#endif
543+
#endif
544544
Task.Factory.StartNew(Action(fun () -> while not token.IsCancellationRequested do ()), token)
545-
let cancelled = ref true
546545
let a = async {
547546
use! _holder = Async.OnCancel(fun _ -> ewh.Set() |> ignore)
548547
let! v = Async.AwaitTask(t)
549548
return v
550-
}
549+
}
551550
Async.Start a
552551
cts.Cancel()
553-
ewh.WaitOne(10000) |> ignore
552+
ewh.WaitOne(10000) |> ignore
554553

554+
[<Test>]
555+
member this.CancellationExceptionThrown () =
556+
use ewh = new ManualResetEventSlim(false)
557+
let cts = new CancellationTokenSource()
558+
let token = cts.Token
559+
let mutable hasThrown = false
560+
token.Register(fun () -> ewh.Set() |> ignore) |> ignore
561+
let a = async {
562+
try
563+
while true do token.ThrowIfCancellationRequested()
564+
with _ -> hasThrown <- true
565+
}
566+
Async.Start(a, token)
567+
cts.Cancel()
568+
ewh.Wait(10000) |> ignore
569+
Assert.False hasThrown
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
open FSharp.TestHelpers
7+
8+
module ``Dictionary Tests`` =
9+
10+
[<Test>]
11+
let ``Assigning to dictionary should compile``() =
12+
// Regression test for FSHARP1.0:5365
13+
14+
CompilerAssert.Pass
15+
"""
16+
module N.M
17+
18+
open System
19+
open System.Collections.Generic
20+
21+
type ICloneable<'a> =
22+
abstract Clone : unit -> 'a
23+
24+
type DictionaryFeature<'key> (dict: IDictionary<'key, int>) =
25+
member this.Add key value =
26+
dict.[key] <- value
27+
"""
28+
29+
[<Test>]
30+
let ``Assigning to dictionary with type constraint should compile``() =
31+
// Regression test for FSHARP1.0:5365
32+
// Used to give error: value must be local and mutable in order to mutate the contents of a value type, e.g. 'let mutable x = ...'
33+
34+
CompilerAssert.Pass
35+
"""
36+
module N.M
37+
38+
open System
39+
open System.Collections.Generic
40+
41+
type ICloneable<'a> =
42+
abstract Clone : unit -> 'a
43+
44+
type DictionaryFeature<'key, 'dict when 'dict :> IDictionary<'key, int> and 'dict :> ICloneable<'dict>> (dict: 'dict) =
45+
member this.Add key value =
46+
dict.[key] <- value
47+
"""

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<Compile Include="Compiler\Libraries\Core\Collections\MapTests.fs" />
8080
<Compile Include="Compiler\Libraries\Core\Collections\CollectionTests.fs" />
8181
<Compile Include="Compiler\Libraries\Core\Collections\ListTests.fs" />
82+
<Compile Include="Compiler\Libraries\Core\ExtraTopLevelOperators\DictionaryTests.fs" />
8283
<None Include="app.config" />
8384
<None Include="update.base.line.with.actuals.fsx" />
8485

tests/fsharpqa/Source/Libraries/Core/ExtraTopLevelOperators/dict_typecheck01.fs

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/ExtraTopLevelOperators/dict_typecheck02.fs

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/ExtraTopLevelOperators/env.lst

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)