Skip to content

Commit b369282

Browse files
authored
Merge pull request #17069 from dotnet/merges/main-to-release/dev17.11
Merge main to release/dev17.11
2 parents bc475f1 + dde9a4b commit b369282

File tree

7 files changed

+204
-4
lines changed

7 files changed

+204
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
### Fixed
22

3+
* Make typechecking of indexed setters with tuples on the right more consistent. ([Issue #16987](https://github.com/dotnet/fsharp/issues/16987), [PR #17017](https://github.com/dotnet/fsharp/pull/17017))
34
* Static abstract method on classes no longer yields internal error. ([Issue #17044](https://github.com/dotnet/fsharp/issues/17044), [PR #17055](https://github.com/dotnet/fsharp/pull/17055))
45
* Disallow calling abstract methods directly on interfaces. ([Issue #14012](https://github.com/dotnet/fsharp/issues/14012), [Issue #16299](https://github.com/dotnet/fsharp/issues/16299), [PR #17021](https://github.com/dotnet/fsharp/pull/17021))
56
* Various parenthesization API fixes. ([PR #16977](https://github.com/dotnet/fsharp/pull/16977))
7+
* Files passed with -embed:relative/path/to/file are not embedded. ([Issue #16768](https://github.com/dotnet/fsharp/pull/17068))
68
* Fix bug in optimization of for-loops over integral ranges with steps and units of measure. ([Issue #17025](https://github.com/dotnet/fsharp/issues/17025), [PR #17040](https://github.com/dotnet/fsharp/pull/17040), [PR #17048](https://github.com/dotnet/fsharp/pull/17048))
79
* Fix calling an overridden virtual static method via the interface ([PR #17013](https://github.com/dotnet/fsharp/pull/17013))
10+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
* Make tooltips work in file with no solution. ([PR #17054](https://github.com/dotnet/fsharp/pull/17054))

src/Compiler/Checking/CheckExpressions.fs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5412,7 +5412,10 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed =
54125412
TcNonControlFlowExpr env <| fun env ->
54135413
if g.langVersion.SupportsFeature LanguageFeature.IndexerNotationWithoutDot then
54145414
warning(Error(FSComp.SR.tcIndexNotationDeprecated(), mDot))
5415-
TcIndexerThen cenv env overallTy mWholeExpr mDot tpenv (Some (expr3, mOfLeftOfSet)) expr1 indexArgs delayed
5415+
// Wrap in extra parens: like MakeDelayedSet,
5416+
// but we don't actually want to delay it here.
5417+
let setInfo = SynExpr.Paren (expr3, range0, None, expr3.Range), mOfLeftOfSet
5418+
TcIndexerThen cenv env overallTy mWholeExpr mDot tpenv (Some setInfo) expr1 indexArgs delayed
54165419

54175420
// Part of 'T.Ident
54185421
| SynExpr.Typar (typar, m) ->
@@ -5827,7 +5830,10 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
58275830
// synExpr1.longId(synExpr2) <- expr3, very rarely used named property setters
58285831
| SynExpr.DotNamedIndexedPropertySet (synExpr1, synLongId, synExpr2, expr3, mStmt) ->
58295832
TcNonControlFlowExpr env <| fun env ->
5830-
TcExprDotNamedIndexedPropertySet cenv overallTy env tpenv (synExpr1, synLongId, synExpr2, expr3, mStmt)
5833+
// Wrap in extra parens: like MakeDelayedSet,
5834+
// but we don't actually want to delay it here.
5835+
let setInfo = SynExpr.Paren (expr3, range0, None, expr3.Range)
5836+
TcExprDotNamedIndexedPropertySet cenv overallTy env tpenv (synExpr1, synLongId, synExpr2, setInfo, mStmt)
58315837

58325838
| SynExpr.LongIdentSet (synLongId, synExpr2, m) ->
58335839
TcNonControlFlowExpr env <| fun env ->
@@ -5836,7 +5842,10 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
58365842
// Type.Items(synExpr1) <- synExpr2
58375843
| SynExpr.NamedIndexedPropertySet (synLongId, synExpr1, synExpr2, mStmt) ->
58385844
TcNonControlFlowExpr env <| fun env ->
5839-
TcExprNamedIndexPropertySet cenv overallTy env tpenv (synLongId, synExpr1, synExpr2, mStmt)
5845+
// Wrap in extra parens: like MakeDelayedSet,
5846+
// but we don't actually want to delay it here.
5847+
let setInfo = SynExpr.Paren (synExpr2, range0, None, synExpr2.Range)
5848+
TcExprNamedIndexPropertySet cenv overallTy env tpenv (synLongId, synExpr1, setInfo, mStmt)
58405849

58415850
| SynExpr.TraitCall (TypesForTypar tps, synMemberSig, arg, m) ->
58425851
TcNonControlFlowExpr env <| fun env ->

src/Compiler/Driver/fsc.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ let AdjustForScriptCompile (tcConfigB: TcConfigBuilder, commandLineSourceFiles,
204204
error (Error(FSComp.SR.pathIsInvalid file, rangeStartup))
205205

206206
let commandLineSourceFiles = commandLineSourceFiles |> List.map combineFilePath
207+
tcConfigB.embedSourceList <- tcConfigB.embedSourceList |> List.map combineFilePath
207208

208209
// Script compilation is active if the last item being compiled is a script and --noframework has not been specified
209210
let mutable allSources = []

tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
<Compile Include="Language\CopyAndUpdateTests.fs" />
234234
<Compile Include="Language\ConstraintIntersectionTests.fs" />
235235
<Compile Include="Language\BooleanReturningAndReturnTypeDirectedPartialActivePatternTests.fs" />
236+
<Compile Include="Language\IndexedSetTests.fs" />
236237
<Compile Include="ConstraintSolver\PrimitiveConstraints.fs" />
237238
<Compile Include="ConstraintSolver\MemberConstraints.fs" />
238239
<Compile Include="ConstraintSolver\ObjInference.fs" />
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
module Language.IndexedSetTests
4+
5+
open FSharp.Test.Compiler
6+
open Xunit
7+
8+
module Array =
9+
[<Fact>]
10+
let ``Dotless indexed set of parenthesized tuple compiles`` () =
11+
FSharp "
12+
let xs = Array.zeroCreate<int * int * int> 1
13+
xs[0] <- (1, 2, 3)
14+
"
15+
|> typecheck
16+
|> shouldSucceed
17+
18+
[<Fact>]
19+
let ``Dotless indexed set of unparenthesized tuple compiles`` () =
20+
FSharp "
21+
let xs = Array.zeroCreate<int * int * int> 1
22+
xs[0] <- 1, 2, 3
23+
"
24+
|> typecheck
25+
|> shouldSucceed
26+
27+
[<Fact>]
28+
let ``Dotless indexed set of double-parenthesized tuple compiles`` () =
29+
FSharp "
30+
let xs = Array.zeroCreate<int * int * int> 1
31+
xs[0] <- ((1, 2, 3))
32+
"
33+
|> typecheck
34+
|> shouldSucceed
35+
36+
[<Fact>]
37+
let ``Dot-indexed set of parenthesized tuple compiles`` () =
38+
FSharp "
39+
let xs = Array.zeroCreate<int * int * int> 1
40+
xs.[0] <- (1, 2, 3)
41+
"
42+
|> typecheck
43+
|> shouldSucceed
44+
45+
[<Fact>]
46+
let ``Dot-indexed set of unparenthesized tuple compiles`` () =
47+
FSharp "
48+
let xs = Array.zeroCreate<int * int * int> 1
49+
xs.[0] <- 1, 2, 3
50+
"
51+
|> typecheck
52+
|> shouldSucceed
53+
54+
[<Fact>]
55+
let ``Dot-indexed set of double-parenthesized tuple compiles`` () =
56+
FSharp "
57+
let xs = Array.zeroCreate<int * int * int> 1
58+
xs.[0] <- ((1, 2, 3))
59+
"
60+
|> typecheck
61+
|> shouldSucceed
62+
63+
module Dictionary =
64+
// Parsed as SynExpr.Set.
65+
[<Fact>]
66+
let ``Dotless indexed set of parenthesized tuple compiles`` () =
67+
FSharp "
68+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
69+
xs[0] <- (1, 2, 3)
70+
"
71+
|> typecheck
72+
|> shouldSucceed
73+
74+
// Parsed as SynExpr.Set.
75+
[<Fact>]
76+
let ``Dotless indexed set of unparenthesized tuple compiles`` () =
77+
FSharp "
78+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
79+
xs[0] <- 1, 2, 3
80+
"
81+
|> typecheck
82+
|> shouldSucceed
83+
84+
// Parsed as SynExpr.Set.
85+
[<Fact>]
86+
let ``Dotless indexed set of double-parenthesized tuple compiles`` () =
87+
FSharp "
88+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
89+
xs[0] <- ((1, 2, 3))
90+
"
91+
|> typecheck
92+
|> shouldSucceed
93+
94+
// Parsed as SynExpr.DotIndexedSet.
95+
[<Fact>]
96+
let ``Dot-indexed set of parenthesized tuple compiles`` () =
97+
FSharp "
98+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
99+
xs.[0] <- (1, 2, 3)
100+
"
101+
|> typecheck
102+
|> shouldSucceed
103+
104+
// Parsed as SynExpr.DotIndexedSet.
105+
[<Fact>]
106+
let ``Dot-indexed set of unparenthesized tuple compiles`` () =
107+
FSharp "
108+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
109+
xs.[0] <- 1, 2, 3
110+
"
111+
|> typecheck
112+
|> shouldSucceed
113+
114+
// Parsed as SynExpr.DotIndexedSet.
115+
[<Fact>]
116+
let ``Dot-indexed set of double-parenthesized tuple compiles`` () =
117+
FSharp "
118+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
119+
xs.[0] <- ((1, 2, 3))
120+
"
121+
|> typecheck
122+
|> shouldSucceed
123+
124+
// Parsed as SynExpr.NamedIndexedPropertySet.
125+
[<Fact>]
126+
let ``Named indexed property set of parenthesized tuple compiles`` () =
127+
FSharp "
128+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
129+
xs.Item 0 <- (1, 2, 3)
130+
"
131+
|> typecheck
132+
|> shouldSucceed
133+
134+
// Parsed as SynExpr.NamedIndexedPropertySet.
135+
[<Fact>]
136+
let ``Named indexed property set of unparenthesized tuple compiles`` () =
137+
FSharp "
138+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
139+
xs.Item 0 <- 1, 2, 3
140+
"
141+
|> typecheck
142+
|> shouldSucceed
143+
144+
// Parsed as SynExpr.NamedIndexedPropertySet.
145+
[<Fact>]
146+
let ``Named indexed property set of double-parenthesized tuple compiles`` () =
147+
FSharp "
148+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
149+
xs.Item 0 <- ((1, 2, 3))
150+
"
151+
|> typecheck
152+
|> shouldSucceed
153+
154+
// Parsed as SynExpr.DotNamedIndexedPropertySet.
155+
[<Fact>]
156+
let ``Dot-named indexed property set of parenthesized tuple compiles`` () =
157+
FSharp "
158+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
159+
(xs).Item 0 <- (1, 2, 3)
160+
"
161+
|> typecheck
162+
|> shouldSucceed
163+
164+
// Parsed as SynExpr.DotNamedIndexedPropertySet.
165+
[<Fact>]
166+
let ``Dot-named indexed property set of unparenthesized tuple compiles`` () =
167+
FSharp "
168+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
169+
(xs).Item 0 <- 1, 2, 3
170+
"
171+
|> typecheck
172+
|> shouldSucceed
173+
174+
// Parsed as SynExpr.DotNamedIndexedPropertySet.
175+
[<Fact>]
176+
let ``Dot-named indexed property set of double-parenthesized tuple compiles`` () =
177+
FSharp "
178+
let xs = System.Collections.Generic.Dictionary<int, int * int * int> ()
179+
(xs).Item 0 <- ((1, 2, 3))
180+
"
181+
|> typecheck
182+
|> shouldSucceed

vsintegration/src/FSharp.Editor/QuickInfo/QuickInfoProvider.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ type internal FSharpAsyncQuickInfoSource
4444

4545
[
4646
Path.GetRelativePath(projectDir, filePath)
47-
Path.GetRelativePath(solutionDir, filePath)
47+
if not (isNull solutionDir) then
48+
Path.GetRelativePath(solutionDir, filePath)
4849
]
4950
|> List.minBy String.length
5051

0 commit comments

Comments
 (0)