Skip to content

Commit e0f1634

Browse files
authored
Nullness - reading+writing metadata for 'inherits' and interface implementations (#16597)
1 parent cf735db commit e0f1634

30 files changed

Lines changed: 755 additions & 87 deletions

File tree

Directory.Build.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
1717
</PropertyGroup>
1818

19-
<PropertyGroup Condition="'$(SolutionName)' == 'FSharp.Benchmarks' and '$(BUILDING_USING_DOTNET)' != 'false'">
20-
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
21-
</PropertyGroup>
22-
2319
<!-- Temporary workaround if proj-info is used, allows Ionide's evaluation to work correctly. -->
2420
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' != 'false' and '$(DotnetProjInfo)' == 'true'">
2521
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
@@ -28,6 +24,8 @@
2824
<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition = "Exists('$(RepoRoot)/Directory.Build.props.user')" />
2925

3026
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
27+
<BUILDING_WITH_LKG>true</BUILDING_WITH_LKG>
28+
<BUILD_FROM_SOURCE>true</BUILD_FROM_SOURCE>
3129
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
3230
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">true</FSHARPCORE_USE_PACKAGE>
3331
<DISABLE_ARCADE Condition="'$(DISABLE_ARCADE)' == ''">true</DISABLE_ARCADE>

azure-pipelines.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CI and PR triggers
1+
# CI and PR triggers
22
trigger:
33
branches:
44
include:
@@ -110,13 +110,10 @@ stages:
110110
demands: ImageOverride -equals windows.vs2022preview.amd64
111111
timeoutInMinutes: 300
112112
variables:
113-
- group: DotNet-Blob-Feed
114113
- group: DotNet-Symbol-Server-Pats
115114
- group: DotNet-DevDiv-Insertion-Workflow-Variables
116115
- name: _SignType
117116
value: Real
118-
- name: _DotNetPublishToBlobFeed
119-
value: true
120117
steps:
121118
- checkout: self
122119
clean: true
@@ -131,9 +128,6 @@ stages:
131128
/p:MicroBuild_SigningEnabled=true
132129
/p:OverridePackageSource=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
133130
/p:TeamName=$(_TeamName)
134-
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
135-
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
136-
/p:DotNetPublishToBlobFeed=true
137131
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
138132
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
139133
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
@@ -724,25 +718,10 @@ stages:
724718
steps:
725719
- checkout: self
726720
clean: true
727-
- script: dotnet --list-sdks
728-
displayName: Report dotnet SDK versions
729-
- task: UseDotNet@2
730-
displayName: install SDK
731-
inputs:
732-
packageType: sdk
733-
useGlobalJson: true
734-
includePreviewVersions: true
735-
workingDirectory: $(Build.SourcesDirectory)
736-
installationPath: $(Agent.ToolsDirectory)/dotnet
737-
- script: dotnet build -c $(_BuildConfig) .\FSharp.Benchmarks.sln /bl:\"artifacts/log/$(_BuildConfig)/BenchmarkBuild.binlog\"
738-
workingDirectory: $(Build.SourcesDirectory)
739-
displayName: Plain build of FSharp.Benchmarks.sln
721+
- script: eng\CIBuild.cmd -configuration $(_BuildConfig) -testBenchmarks
722+
displayName: Smoke test fast benchmarks
740723
continueOnError: true
741724
condition: always()
742-
- script: .\Build.cmd -c $(_BuildConfig)
743-
- pwsh: ./SmokeTestBenchmarks.ps1
744-
workingDirectory: $(Build.SourcesDirectory)/tests/benchmarks
745-
displayName: Smoke test fast benchmarks
746725

747726
# Test trimming on Windows
748727
- job: Build_And_Test_Trimming_Windows

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
* 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))
44
* `nameof Module` expressions and patterns are processed to link files in `--test:GraphBasedChecking`. ([PR #16550](https://github.com/dotnet/fsharp/pull/16550))
5-
* Graph Based Checking doesn't throw on invalid parsed input so it can be used for IDE scenarios ([PR #16575](https://github.com/dotnet/fsharp/pull/16575))
5+
* Graph Based Checking doesn't throw on invalid parsed input so it can be used for IDE scenarios ([PR #16575](https://github.com/dotnet/fsharp/pull/16575), [PR #16588](https://github.com/dotnet/fsharp/pull/16588))
6+
* Keep parens for problematic exprs (`if`, `match`, etc.) in `$"{(…):N0}"`, `$"{(…),-3}"`, etc. ([PR #16578](https://github.com/dotnet/fsharp/pull/16578))
67

78
### Added
89

910

1011
* Support for nullable reference types ([PR #15181](https://github.com/dotnet/fsharp/pull/15181))
11-
* The stackguard depth for ILPdbWriter.unshadowScopes can be modified via the environment variable `FSHARP_ILPdb_UnshadowScopes_StackGuardDepth`([PR #16583](https://github.com/dotnet/fsharp/pull/16583))
12+
* The stackguard depth for ILPdbWriter.unshadowScopes can be modified via the environment variable `FSHARP_ILPdb_UnshadowScopes_StackGuardDepth`([PR #16583](https://github.com/dotnet/fsharp/pull/16583))
1213
* Parser recovers on complex primary constructor patterns, better tree representation for primary constructor patterns. ([PR #16425](https://github.com/dotnet/fsharp/pull/16425))
1314
* Name resolution: keep type vars in subsequent checks ([PR #16456](https://github.com/dotnet/fsharp/pull/16456))
1415
* Higher-order-function-based API for working with the untyped abstract syntax tree. ([PR #16462](https://github.com/dotnet/fsharp/pull/16462))

eng/Build.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ param (
6262
[switch]$testAllButIntegration,
6363
[switch]$testpack,
6464
[switch]$testAOT,
65+
[switch]$testBenchmarks,
6566
[string]$officialSkipTests = "false",
6667
[switch]$noVisualStudio,
6768
[switch]$sourceBuild,
@@ -111,6 +112,7 @@ function Print-Usage() {
111112
Write-Host " -testVs Run F# editor unit tests"
112113
Write-Host " -testpack Verify built packages"
113114
Write-Host " -testAOT Run AOT/Trimming tests"
115+
Write-Host " -testBenchmarks Build and Run Benchmark suite"
114116
Write-Host " -officialSkipTests <bool> Set to 'true' to skip running tests"
115117
Write-Host ""
116118
Write-Host "Advanced settings:"
@@ -176,6 +178,7 @@ function Process-Arguments() {
176178
$script:testVs = $False
177179
$script:testpack = $False
178180
$script:testAOT = $False
181+
$script:testBenchmarks = $False
179182
$script:verifypackageshipstatus = $True
180183
}
181184

@@ -211,6 +214,10 @@ function Process-Arguments() {
211214
$script:pack = $True;
212215
}
213216

217+
if ($testBenchmarks) {
218+
$script:testBenchmarks = $True
219+
}
220+
214221
foreach ($property in $properties) {
215222
if (!$property.StartsWith("/p:", "InvariantCultureIgnoreCase")) {
216223
Write-Host "Invalid argument: $property"
@@ -541,12 +548,17 @@ try {
541548
}
542549
}
543550

551+
if ($testBenchmarks) {
552+
BuildSolution "FSharp.Benchmarks.sln" $False
553+
}
554+
544555
if ($pack) {
545556
$properties_storage = $properties
546557
$properties += "/p:GenerateSbom=false"
547558
BuildSolution "Microsoft.FSharp.Compiler.sln" $True
548559
$properties = $properties_storage
549560
}
561+
550562
if ($build) {
551563
VerifyAssemblyVersionsAndSymbols
552564
}
@@ -662,6 +674,12 @@ try {
662674
Pop-Location
663675
}
664676

677+
if ($testBenchmarks) {
678+
Push-Location "$RepoRoot\tests\benchmarks"
679+
./SmokeTestBenchmarks.ps1
680+
Pop-Location
681+
}
682+
665683
# verify nupkgs have access to the source code
666684
$nupkgtestFailed = $false
667685
if ($testpack) {

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
</Dependency>
3030
</ProductDependencies>
3131
<ToolsetDependencies>
32-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24073.2">
32+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24075.5">
3333
<Uri>https://github.com/dotnet/arcade</Uri>
34-
<Sha>4c941e2e3ae61502bd4ffd711930f662fd808375</Sha>
34+
<Sha>07cf24f27ee58b5d1a9662334a101d84bd1e07e5</Sha>
3535
<SourceBuild RepoName="arcade" ManagedOnly="true" />
3636
</Dependency>
3737
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.23475.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">

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.24073.2",
20+
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24075.5",
2121
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
2222
}
2323
}

src/Compiler/AbstractIL/il.fs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,6 +2612,7 @@ type ILTypeDef
26122612
attributes: TypeAttributes,
26132613
layout: ILTypeDefLayout,
26142614
implements: ILTypes,
2615+
implementsCustomAttrs: (ILAttributesStored * int) list option,
26152616
genericParams: ILGenericParameterDefs,
26162617
extends: ILType option,
26172618
methods: ILMethodDefs,
@@ -2632,6 +2633,7 @@ type ILTypeDef
26322633
attributes,
26332634
layout,
26342635
implements,
2636+
implementsCustomAttrs,
26352637
genericParams,
26362638
extends,
26372639
methods,
@@ -2648,6 +2650,7 @@ type ILTypeDef
26482650
attributes,
26492651
layout,
26502652
implements,
2653+
implementsCustomAttrs,
26512654
genericParams,
26522655
extends,
26532656
methods,
@@ -2674,6 +2677,8 @@ type ILTypeDef
26742677

26752678
member _.Implements = implements
26762679

2680+
member _.ImplementsCustomAttrs = implementsCustomAttrs
2681+
26772682
member _.Extends = extends
26782683

26792684
member _.Methods = methods
@@ -2710,7 +2715,8 @@ type ILTypeDef
27102715
?properties,
27112716
?isKnownToBeAttribute,
27122717
?customAttrs,
2713-
?securityDecls
2718+
?securityDecls,
2719+
?implementsCustomAttrs
27142720
) =
27152721
ILTypeDef(
27162722
name = defaultArg name x.Name,
@@ -2719,6 +2725,7 @@ type ILTypeDef
27192725
genericParams = defaultArg genericParams x.GenericParams,
27202726
nestedTypes = defaultArg nestedTypes x.NestedTypes,
27212727
implements = defaultArg implements x.Implements,
2728+
implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs,
27222729
extends = defaultArg extends x.Extends,
27232730
methods = defaultArg methods x.Methods,
27242731
securityDecls = defaultArg securityDecls x.SecurityDecls,
@@ -4192,6 +4199,7 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes
41924199
attributes = attributes,
41934200
genericParams = genparams,
41944201
implements = impl,
4202+
implementsCustomAttrs = None,
41954203
layout = ILTypeDefLayout.Auto,
41964204
extends = Some extends,
41974205
methods = methods,
@@ -4216,6 +4224,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) =
42164224
||| TypeAttributes.BeforeFieldInit
42174225
||| TypeAttributes.AnsiClass),
42184226
implements = [],
4227+
implementsCustomAttrs = None,
42194228
extends = Some iltyp_ValueType,
42204229
layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack },
42214230
methods = emptyILMethods,

src/Compiler/AbstractIL/il.fsi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,7 @@ type ILTypeDef =
15071507
attributes: TypeAttributes *
15081508
layout: ILTypeDefLayout *
15091509
implements: ILTypes *
1510+
implementsCustomAttrs: (ILAttributesStored * int) list option *
15101511
genericParams: ILGenericParameterDefs *
15111512
extends: ILType option *
15121513
methods: ILMethodDefs *
@@ -1527,6 +1528,7 @@ type ILTypeDef =
15271528
attributes: TypeAttributes *
15281529
layout: ILTypeDefLayout *
15291530
implements: ILTypes *
1531+
implementsCustomAttrs: (ILAttributesStored * int) list option *
15301532
genericParams: ILGenericParameterDefs *
15311533
extends: ILType option *
15321534
methods: ILMethodDefs *
@@ -1546,6 +1548,7 @@ type ILTypeDef =
15461548
member Layout: ILTypeDefLayout
15471549
member NestedTypes: ILTypeDefs
15481550
member Implements: ILTypes
1551+
member ImplementsCustomAttrs: (ILAttributesStored * int) list option
15491552
member Extends: ILType option
15501553
member Methods: ILMethodDefs
15511554
member SecurityDecls: ILSecurityDecls
@@ -1604,7 +1607,8 @@ type ILTypeDef =
16041607
?properties: ILPropertyDefs *
16051608
?isKnownToBeAttribute: bool *
16061609
?customAttrs: ILAttributes *
1607-
?securityDecls: ILSecurityDecls ->
1610+
?securityDecls: ILSecurityDecls *
1611+
?implementsCustomAttrs: (ILAttributesStored * int) list option ->
16081612
ILTypeDef
16091613

16101614
/// Represents a prefix of information for ILTypeDef.

src/Compiler/AbstractIL/ilread.fs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ type ILMetadataReader =
11801180
customAttrsReader_Module: ILAttributesStored
11811181
customAttrsReader_Assembly: ILAttributesStored
11821182
customAttrsReader_TypeDef: ILAttributesStored
1183+
customAttrsReader_InterfaceImpl: ILAttributesStored
11831184
customAttrsReader_GenericParam: ILAttributesStored
11841185
customAttrsReader_FieldDef: ILAttributesStored
11851186
customAttrsReader_MethodDef: ILAttributesStored
@@ -1450,11 +1451,16 @@ let seekReadParamRow (ctxt: ILMetadataReader) mdv idx =
14501451
(flags, seq, nameIdx)
14511452

14521453
/// Read Table InterfaceImpl.
1453-
let seekReadInterfaceImplRow (ctxt: ILMetadataReader) mdv idx =
1454+
let private seekReadInterfaceImplRow (ctxt: ILMetadataReader) mdv idx =
14541455
let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx
14551456
let tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr
14561457
let intfIdx = seekReadTypeDefOrRefOrSpecIdx ctxt mdv &addr
1457-
(tidx, intfIdx)
1458+
1459+
struct {|
1460+
TypeIdx = tidx
1461+
IntfIdx = intfIdx
1462+
IntImplIdx = idx
1463+
|}
14581464

14591465
/// Read Table MemberRef.
14601466
let seekReadMemberRefRow (ctxt: ILMetadataReader) mdv idx =
@@ -2144,7 +2150,10 @@ and typeDefReader ctxtH : ILTypeDefStored =
21442150
let mdefs = seekReadMethods ctxt numTypars methodsIdx endMethodsIdx
21452151
let fdefs = seekReadFields ctxt (numTypars, hasLayout) fieldsIdx endFieldsIdx
21462152
let nested = seekReadNestedTypeDefs ctxt idx
2147-
let impls = seekReadInterfaceImpls ctxt mdv numTypars idx
2153+
2154+
let impls, intImplsAttrs =
2155+
seekReadInterfaceImpls ctxt mdv numTypars idx |> List.unzip
2156+
21482157
let mimpls = seekReadMethodImpls ctxt numTypars idx
21492158
let props = seekReadProperties ctxt numTypars idx
21502159
let events = seekReadEvents ctxt numTypars idx
@@ -2156,6 +2165,7 @@ and typeDefReader ctxtH : ILTypeDefStored =
21562165
layout = layout,
21572166
nestedTypes = nested,
21582167
implements = impls,
2168+
implementsCustomAttrs = Some intImplsAttrs,
21592169
extends = super,
21602170
methods = mdefs,
21612171
securityDeclsStored = ctxt.securityDeclsReader_TypeDef,
@@ -2192,10 +2202,10 @@ and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numTypars tidx =
21922202
seekReadIndexedRows (
21932203
ctxt.getNumRows TableNames.InterfaceImpl,
21942204
seekReadInterfaceImplRow ctxt mdv,
2195-
fst,
2205+
(fun x -> x.TypeIdx),
21962206
simpleIndexCompare tidx,
21972207
isSorted ctxt TableNames.InterfaceImpl,
2198-
(snd >> seekReadTypeDefOrRef ctxt numTypars AsObject [])
2208+
(fun x -> (seekReadTypeDefOrRef ctxt numTypars AsObject [] x.IntfIdx), (ctxt.customAttrsReader_InterfaceImpl, x.IntImplIdx))
21992209
)
22002210

22012211
and seekReadGenericParams ctxt numTypars (a, b) : ILGenericParameterDefs =
@@ -4487,6 +4497,7 @@ let openMetadataReader
44874497
customAttrsReader_Module = customAttrsReader ctxtH hca_Module
44884498
customAttrsReader_Assembly = customAttrsReader ctxtH hca_Assembly
44894499
customAttrsReader_TypeDef = customAttrsReader ctxtH hca_TypeDef
4500+
customAttrsReader_InterfaceImpl = customAttrsReader ctxtH hca_InterfaceImpl
44904501
customAttrsReader_GenericParam = customAttrsReader ctxtH hca_GenericParam
44914502
customAttrsReader_FieldDef = customAttrsReader ctxtH hca_FieldDef
44924503
customAttrsReader_MethodDef = customAttrsReader ctxtH hca_MethodDef

0 commit comments

Comments
 (0)