Skip to content

Commit b3fa572

Browse files
dotnet-botKevinRansomvzarytovskiidawedaweabonie
authored
Merge main to release/dev17.10 (#16782)
* Fix 16105 - Release inline optimization leads to MethodAccessException if used with assembly:InternalsVisibleTo attribute (#16737) * Fix16105 * trimming * Update release notes --------- Co-authored-by: Vlad Zarytovskii <[email protected]> * fix wrong range start of INTERP_STRING_END (#16774) * fix wrong range start of INTERP_STRING_END * add release notes entry --------- Co-authored-by: Adam Boniecki <[email protected]> * Update dependencies from https://github.com/dotnet/arcade build 20240223.1 (#16776) Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24113.2 -> To Version 8.0.0-beta.24123.1 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Kevin Ransom (msft) <[email protected]> * remove superseded test of TryGetRecentCheckResultsForFile (#16770) * remove superseded test of TryGetRecentCheckResultsForFile * kick CI * Allow e2e tests to fail for now * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240227.2 (#16777) Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24123.3 -> To Version 9.0.0-alpha.1.24127.2 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> --------- Co-authored-by: Kevin Ransom (msft) <[email protected]> Co-authored-by: Vlad Zarytovskii <[email protected]> Co-authored-by: dawe <[email protected]> Co-authored-by: Adam Boniecki <[email protected]> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
1 parent 1caaf86 commit b3fa572

File tree

66 files changed

+544
-221
lines changed

Some content is hidden

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

66 files changed

+544
-221
lines changed

docs/release-notes/.FSharp.Compiler.Service/8.0.300.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Fixed
22

3+
* Fix wrong range start of INTERP_STRING_END. ([PR #16774](https://github.com/dotnet/fsharp/pull/16774))
34
* Fix missing warning for recursive calls in list comprehensions. ([PR #16652](https://github.com/dotnet/fsharp/pull/16652))
45
* Code generated files with > 64K methods and generated symbols crash when loaded. Use infered sequence points for debugging. ([Issue #16399](https://github.com/dotnet/fsharp/issues/16399), [#PR 16514](https://github.com/dotnet/fsharp/pull/16514))
56
* `nameof Module` expressions and patterns are processed to link files in `--test:GraphBasedChecking`. ([PR #16550](https://github.com/dotnet/fsharp/pull/16550), [PR #16743](https://github.com/dotnet/fsharp/pull/16743))
@@ -11,6 +12,7 @@
1112
* `[<CliEvent>]` member should not produce property symbol. ([Issue #16640](https://github.com/dotnet/fsharp/issues/16640), [PR #16658](https://github.com/dotnet/fsharp/pull/16658))
1213
* Fix discriminated union initialization. ([#PR 16661](https://github.com/dotnet/fsharp/pull/16661))
1314
* Allow calling method with both Optional and ParamArray. ([#PR 16688](https://github.com/dotnet/fsharp/pull/16688), [suggestions #1120](https://github.com/fsharp/fslang-suggestions/issues/1120))
15+
* Fix release inline optimization, which leads to MethodAccessException if used with `assembly:InternalsVisibleTo`` attribute. ([Issue #16105](https://github.com/dotnet/fsharp/issues/16105), ([PR #16737](https://github.com/dotnet/fsharp/pull/16737))
1416
* Enforce AttributeTargets on let values and functions. ([PR #16692](https://github.com/dotnet/fsharp/pull/16692))
1517

1618
### Added

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
33
<ProductDependencies>
4-
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24123.3">
4+
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="9.0.0-alpha.1.24127.2">
55
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
6-
<Sha>62fb9a85e5c4af657b0014fd6d6588c139d0bb4f</Sha>
6+
<Sha>6d28b5a26876f8f22dadb8f6cdee878faaa88464</Sha>
77
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
88
</Dependency>
99
<!-- Intermediate is necessary for source build. -->
@@ -30,9 +30,9 @@
3030
</Dependency>
3131
</ProductDependencies>
3232
<ToolsetDependencies>
33-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24113.2">
33+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24123.1">
3434
<Uri>https://github.com/dotnet/arcade</Uri>
35-
<Sha>da98edc4c3ea539f109ea320672136ceb32591a7</Sha>
35+
<Sha>042763a811fd94dc3556253d4c64118dd665216e</Sha>
3636
<SourceBuild RepoName="arcade" ManagedOnly="true" />
3737
</Dependency>
3838
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.23475.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">

eng/common/templates/steps/generate-sbom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector.
66

77
parameters:
8-
PackageVersion: 7.0.0
8+
PackageVersion: 8.0.0
99
BuildDropPath: '$(Build.SourcesDirectory)/artifacts'
1010
PackageName: '.NET'
1111
ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"perl": "5.38.0.1"
1818
},
1919
"msbuild-sdks": {
20-
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24113.2",
20+
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24123.1",
2121
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
2222
}
2323
}

src/Compiler/Optimize/Optimizer.fs

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ let rec IsPartialExprVal x =
496496
| TupleValue args | RecdValue (_, args) | UnionCaseValue (_, args) -> Array.exists IsPartialExprVal args
497497
| ConstValue _ | CurriedLambdaValue _ | ConstExprValue _ -> false
498498
| ValValue (_, a)
499-
| SizeValue(_, a) -> IsPartialExprVal a
499+
| SizeValue (_, a) -> IsPartialExprVal a
500500

501501
let CheckInlineValueIsComplete (v: Val) res =
502502
if v.MustInline && IsPartialExprVal res then
@@ -690,10 +690,25 @@ let GetInfoForVal cenv env m (vref: ValRef) =
690690
GetInfoForLocalValue cenv env vref.binding m
691691
else
692692
GetInfoForNonLocalVal cenv env vref
693+
res
693694

695+
let GetInfoForValWithCheck cenv env m (vref: ValRef) =
696+
let res = GetInfoForVal cenv env m vref
694697
check vref res |> ignore
695698
res
696699

700+
let IsPartialExpr cenv env m x =
701+
let rec isPartialExpression x =
702+
match x with
703+
| Expr.App (func, _, _, args, _) -> func :: args |> Seq.exists isPartialExpression
704+
| Expr.Lambda (_, _, _, _, expr, _, _) -> expr |> isPartialExpression
705+
| Expr.Let (TBind (_,expr,_), body, _, _) -> expr :: [body] |> List.exists isPartialExpression
706+
| Expr.LetRec (bindings, body, _, _) -> body :: (bindings |> List.map (fun (TBind (_,expr,_)) -> expr)) |> List.exists isPartialExpression
707+
| Expr.Sequential (expr1, expr2, _, _) -> [expr1; expr2] |> Seq.exists isPartialExpression
708+
| Expr.Val (vr, _, _) when not vr.IsLocalRef -> ((GetInfoForVal cenv env m vr).ValExprInfo) |> IsPartialExprVal
709+
| _ -> false
710+
isPartialExpression x
711+
697712
//-------------------------------------------------------------------------
698713
// Try to get information about values of particular types
699714
//-------------------------------------------------------------------------
@@ -3062,11 +3077,14 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, mustInline, inlineIfLambda, va
30623077
failwith "tuple, union and record values cannot be marked 'inline'"
30633078

30643079
| UnknownValue when mustInline ->
3065-
warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)); None
3080+
warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m))
3081+
None
30663082

30673083
| _ when mustInline ->
3068-
warning(Error(FSComp.SR.optValueMarkedInlineCouldNotBeInlined(), m)); None
3069-
| _ -> None
3084+
warning(Error(FSComp.SR.optValueMarkedInlineCouldNotBeInlined(), m))
3085+
None
3086+
3087+
| _ -> None
30703088

30713089
and TryOptimizeValInfo cenv env m vinfo =
30723090
if vinfo.HasEffect then None else TryOptimizeVal cenv env (None, false, false, vinfo.Info, m)
@@ -3089,7 +3107,7 @@ and OptimizeVal cenv env expr (v: ValRef, m) =
30893107

30903108
let g = cenv.g
30913109

3092-
let valInfoForVal = GetInfoForVal cenv env m v
3110+
let valInfoForVal = GetInfoForValWithCheck cenv env m v
30933111

30943112
match TryOptimizeVal cenv env (Some v, v.MustInline, v.InlineIfLambda, valInfoForVal.ValExprInfo, m) with
30953113
| Some e ->
@@ -3402,15 +3420,15 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m)
34023420
| _ -> false
34033421
| _ -> false
34043422
| _ -> false
3405-
| _ -> false
3423+
| _ -> false
34063424

34073425
if isValFromLazyExtensions then None else
34083426

34093427
let isSecureMethod =
34103428
match finfo.Info with
34113429
| ValValue(vref, _) ->
34123430
vref.Attribs |> List.exists (fun a -> (IsSecurityAttribute g cenv.amap cenv.casApplied a m) || (IsSecurityCriticalAttribute g a))
3413-
| _ -> false
3431+
| _ -> false
34143432

34153433
if isSecureMethod then None else
34163434

@@ -3421,6 +3439,13 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m)
34213439

34223440
if isGetHashCode then None else
34233441

3442+
let isApplicationPartialExpr =
3443+
match finfo.Info with
3444+
| ValValue (_, CurriedLambdaValue (_, _, _, expr, _) ) -> IsPartialExpr cenv env m expr
3445+
| _ -> false
3446+
3447+
if isApplicationPartialExpr then None else
3448+
34243449
// Inlining lambda
34253450
let f2R = CopyExprForInlining cenv false f2 m
34263451

@@ -3597,8 +3622,8 @@ and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) =
35973622
// This includes recursive calls to the function being defined (in which case we get a non-critical, closed-world tailcall).
35983623
// Note we also have to check the argument count to ensure this is a direct call (or a partial application).
35993624
let doesNotMakeCriticalTailcall =
3600-
vref.MakesNoCriticalTailcalls ||
3601-
(let valInfoForVal = GetInfoForVal cenv env m vref in valInfoForVal.ValMakesNoCriticalTailcalls) ||
3625+
vref.MakesNoCriticalTailcalls ||
3626+
(let valInfoForVal = GetInfoForValWithCheck cenv env m vref in valInfoForVal.ValMakesNoCriticalTailcalls) ||
36023627
(match env.functionVal with | None -> false | Some (v, _) -> valEq vref.Deref v)
36033628
if doesNotMakeCriticalTailcall then
36043629
let numArgs = otherArgs.Length + newArgs.Length

src/Compiler/Service/FSharpCheckerResults.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2685,7 +2685,7 @@ module internal ParseAndCheckFile =
26852685
| INTERP_STRING_BEGIN_PART _ | INTERP_STRING_PART _ as tok, _ ->
26862686
let braceOffset =
26872687
match tok with
2688-
| INTERP_STRING_BEGIN_PART(_, SynStringKind.TripleQuote, (LexerContinuation.Token(_, (_, _, dl, _) :: _))) ->
2688+
| INTERP_STRING_BEGIN_PART(_, SynStringKind.TripleQuote, (LexerContinuation.Token(_, (_, _, dl, _, _) :: _))) ->
26892689
dl - 1
26902690
| _ -> 0
26912691

src/Compiler/Service/ServiceLexing.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module FSharpTokenTag =
3636
tagOfToken (INTERP_STRING_BEGIN_PART("a", SynStringKind.Regular, LexCont.Default))
3737

3838
let INTERP_STRING_PART = tagOfToken (INTERP_STRING_PART("a", LexCont.Default))
39-
let INTERP_STRING_END = tagOfToken (INTERP_STRING_END("a", LexCont.Default))
39+
let INTERP_STRING_END = tagOfToken (INTERP_STRING_END("a", None, LexCont.Default))
4040
let LPAREN = tagOfToken LPAREN
4141
let RPAREN = tagOfToken RPAREN
4242
let LBRACK = tagOfToken LBRACK
@@ -493,7 +493,7 @@ module internal LexerStateEncoding =
493493
| INTERP_STRING_BEGIN_PART(_, _, cont)
494494
| INTERP_STRING_PART(_, cont)
495495
| INTERP_STRING_BEGIN_END(_, _, cont)
496-
| INTERP_STRING_END(_, cont)
496+
| INTERP_STRING_END(_, _, cont)
497497
| LBRACE cont
498498
| RBRACE cont
499499
| BYTEARRAY(_, _, cont)
@@ -621,12 +621,12 @@ module internal LexerStateEncoding =
621621
let tag1, i1, kind1, rest =
622622
match stringNest with
623623
| [] -> false, 0, 0, []
624-
| (i1, kind1, _, _) :: rest -> true, i1, encodeStringStyle kind1, rest
624+
| (i1, kind1, _, _, _) :: rest -> true, i1, encodeStringStyle kind1, rest
625625

626626
let tag2, i2, kind2 =
627627
match rest with
628628
| [] -> false, 0, 0
629-
| (i2, kind2, _, _) :: _ -> true, i2, encodeStringStyle kind2
629+
| (i2, kind2, _, _, _) :: _ -> true, i2, encodeStringStyle kind2
630630

631631
(if tag1 then 0b100000000000 else 0)
632632
||| (if tag2 then 0b010000000000 else 0)
@@ -696,9 +696,9 @@ module internal LexerStateEncoding =
696696
let nest =
697697
[
698698
if tag1 then
699-
i1, decodeStringStyle kind1, 0, range0
699+
i1, decodeStringStyle kind1, 0, None, range0
700700
if tag2 then
701-
i2, decodeStringStyle kind2, 0, range0
701+
i2, decodeStringStyle kind2, 0, None, range0
702702
]
703703

704704
nest

src/Compiler/SyntaxTree/LexHelpers.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type LexerStringFinisher =
190190
else if isPart then
191191
INTERP_STRING_PART(s, cont)
192192
else
193-
INTERP_STRING_END(s, cont)
193+
INTERP_STRING_END(s, None, cont)
194194
elif kind.IsByteString then
195195
let synByteStringKind =
196196
if isVerbatim then

src/Compiler/SyntaxTree/ParseHelpers.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ type LexerStringKind =
308308

309309
/// Represents the degree of nesting of '{..}' and the style of the string to continue afterwards, in an interpolation fill.
310310
/// Nesting counters and styles of outer interpolating strings are pushed on this stack.
311-
type LexerInterpolatedStringNesting = (int * LexerStringStyle * int * range) list
311+
type LexerInterpolatedStringNesting = (int * LexerStringStyle * int * range option * range) list
312312

313313
/// The parser defines a number of tokens for whitespace and
314314
/// comments eliminated by the lexer. These carry a specification of
@@ -973,7 +973,7 @@ let checkEndOfFileError t =
973973

974974
match nesting with
975975
| [] -> ()
976-
| (_, _, _, m) :: _ -> reportParseErrorAt m (FSComp.SR.parsEofInInterpolatedStringFill ())
976+
| (_, _, _, _, m) :: _ -> reportParseErrorAt m (FSComp.SR.parsEofInInterpolatedStringFill ())
977977

978978
type BindingSet = BindingSetPreAttrs of range * bool * bool * (SynAttributes -> SynAccess option -> SynAttributes * SynBinding list) * range
979979

src/Compiler/SyntaxTree/ParseHelpers.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type LexerStringKind =
118118

119119
static member String: LexerStringKind
120120

121-
type LexerInterpolatedStringNesting = (int * LexerStringStyle * int * range) list
121+
type LexerInterpolatedStringNesting = (int * LexerStringStyle * int * range option * range) list
122122

123123
[<RequireQualifiedAccess; NoComparison; NoEquality>]
124124
type LexerContinuation =

0 commit comments

Comments
 (0)