提交 8cbbd29f 编写于 作者: D Don Syme

Merge commit 'e05bdc2d' into feature/nullness

......@@ -605,6 +605,50 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Regular rebuild of FSharp.Compiler.Service.sln
# Test trimming on Windows
- job: Build_And_Test_Trimming_Windows
pool:
name: NetCore-Public
demands: ImageOverride -equals $(WindowsMachineQueueName)
strategy:
maxParallel: 2
matrix:
compressed_metadata:
_kind: "-compressAllMetadata"
classic_metadata:
_kind: ""
variables:
- name: _BuildConfig
value: Release
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- script: .\Build.cmd $(_kind) -pack -c $(_BuildConfig)
displayName: Initial build and prepare packages.
- script: dotnet publish -c $(_BuildConfig) -bl:\"./bin/$(_BuildConfig)/net7.0/win-x64/publish/Trimming.binlog\"
displayName: Build and publish a trim test package.
workingDirectory: $(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test
- script: .\check.cmd
displayName: Check the state of the trimmed app.
workingDirectory: $(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test
- task: PublishPipelineArtifact@1
displayName: Publish Trim Tests Logs
inputs:
targetPath: '$(Build.SourcesDirectory)/tests/projects/SelfContained_Trimming_Test/bin/$(_BuildConfig)/net7.0/win-x64/publish'
artifactName: 'Trim Test Logs Attempt $(System.JobAttempt) Logs $(_kind)'
continueOnError: true
condition: always()
# Arcade-powered source build
# turned off until https://github.com/dotnet/source-build/issues/1795 is fixed
# - template: /eng/common/templates/jobs/jobs.yml
......
......@@ -4391,7 +4391,8 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn
| SynType.App(arg1, _, args, _, _, postfix, m) ->
TcTypeMeasureApp kindOpt cenv newOk checkConstraints occ env tpenv arg1 args postfix m
| SynType.Paren(innerType, _) ->
| SynType.Paren(innerType, _)
| SynType.SignatureParameter(usedType = innerType) ->
TcTypeOrMeasure kindOpt cenv newOk checkConstraints occ iwsam env tpenv innerType
and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref =
......
......@@ -2444,7 +2444,7 @@ module InferredSigPrinting =
wordL (tagKeyword keyword) ^^ sepListL SepL.dot pathL
match expr with
| EmptyModuleOrNamespaces mspecs ->
| EmptyModuleOrNamespaces mspecs when showHeader ->
List.map emptyModuleOrNamespace mspecs
|> aboveListL
| expr -> imdefL denv expr
......
......@@ -823,8 +823,13 @@ module SyntaxTraversal =
| SynType.MeasureDivide (ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path)
| SynType.Tuple (path = segments) -> getTypeFromTuplePath segments |> List.tryPick (traverseSynType path)
| SynType.StaticConstantExpr (expr, _) -> traverseSynExpr [] expr
| SynType.Anon _ -> None
| _ -> None
| SynType.Paren (innerType = t)
| SynType.SignatureParameter (usedType = t) -> traverseSynType path t
| SynType.Anon _
| SynType.AnonRecd _
| SynType.LongIdent _
| SynType.Var _
| SynType.StaticConstant _ -> None
visitor.VisitType(origPath, defaultTraverse, ty)
......
......@@ -670,8 +670,15 @@ module ParsedInput =
| SynType.HashConstraint (t, _) -> walkType t
| SynType.MeasureDivide (t1, t2, _) -> walkType t1 |> Option.orElseWith (fun () -> walkType t2)
| SynType.MeasurePower (t, _, _) -> walkType t
| SynType.Paren (t, _) -> walkType t
| _ -> None
| SynType.Paren (t, _)
| SynType.SignatureParameter (usedType = t) -> walkType t
| SynType.StaticConstantExpr (e, _) -> walkExpr e
| SynType.StaticConstantNamed (ident, value, _) -> List.tryPick walkType [ ident; value ]
| SynType.Anon _
| SynType.AnonRecd _
| SynType.LongIdent _
| SynType.Var _
| SynType.StaticConstant _ -> None
and walkClause clause =
let (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) = clause
......@@ -1663,7 +1670,8 @@ module ParsedInput =
| SynType.Array (_, t, _)
| SynType.HashConstraint (t, _)
| SynType.MeasurePower (t, _, _)
| SynType.Paren (t, _) -> walkType t
| SynType.Paren (t, _)
| SynType.SignatureParameter (usedType = t) -> walkType t
| SynType.Fun (argType = t1; returnType = t2)
| SynType.MeasureDivide (t1, t2, _) ->
walkType t1
......@@ -1677,7 +1685,14 @@ module ParsedInput =
| SynType.WithGlobalConstraints (t, typeConstraints, _) ->
walkType t
List.iter walkTypeConstraint typeConstraints
| _ -> ()
| SynType.StaticConstantExpr (e, _) -> walkExpr e
| SynType.StaticConstantNamed (ident, value, _) ->
walkType ident
walkType value
| SynType.Anon _
| SynType.AnonRecd _
| SynType.Var _
| SynType.StaticConstant _ -> ()
and walkClause (SynMatchClause (pat = pat; whenExpr = e1; resultExpr = e2)) =
walkPat pat
......
......@@ -442,6 +442,8 @@ type SynType =
| Paren of innerType: SynType * range: range
| SignatureParameter of attributes: SynAttributes * optional: bool * id: Ident option * usedType: SynType * range: range
member x.Range =
match x with
| SynType.App (range = m)
......@@ -461,7 +463,8 @@ type SynType =
| SynType.WithNull (range = m)
| SynType.MeasureDivide (range = m)
| SynType.MeasurePower (range = m)
| SynType.Paren (range = m) -> m
| SynType.Paren (range = m)
| SynType.SignatureParameter (range = m) -> m
| SynType.LongIdent lidwd -> lidwd.Range
[<NoEquality; NoComparison; RequireQualifiedAccess>]
......
......@@ -518,6 +518,14 @@ type SynType =
| Paren of innerType: SynType * range: range
/// F# syntax: a: b, used in signatures and type annotations
| SignatureParameter of
attributes: SynAttributes *
optional: bool *
id: Ident option *
usedType: SynType *
range: range
/// Gets the syntax range of this construct
member Range: range
......
......@@ -5090,22 +5090,29 @@ topTupleTypeElements:
topAppType:
| attributes appType COLON appType
{ match $2 with
| SynType.LongIdent(SynLongIdent([id], _, _)) -> $4, SynArgInfo($1, false, Some id)
| SynType.LongIdent(SynLongIdent([id], _, _)) ->
let m = rhs2 parseState 1 4
SynType.SignatureParameter($1, false, Some id, $4, m), SynArgInfo($1, false, Some id)
| _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) }
| attributes QMARK ident COLON appType
{ $5, SynArgInfo($1, true, Some $3) }
{ let m = rhs2 parseState 1 5
SynType.SignatureParameter($1, true, Some $3, $5, m), SynArgInfo($1, true, Some $3) }
| attributes appType
{ ($2, SynArgInfo($1, false, None)) }
{ let m = rhs2 parseState 1 2
SynType.SignatureParameter($1, false, None, $2, m), SynArgInfo($1, false, None) }
| appType COLON appType
{ match $1 with
| SynType.LongIdent(SynLongIdent([id], _, _)) -> $3, SynArgInfo([], false, Some id)
| SynType.LongIdent(SynLongIdent([id], _, _)) ->
let m = rhs2 parseState 1 3
SynType.SignatureParameter([], false, Some id, $3, m), SynArgInfo([], false, Some id)
| _ -> raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsSyntaxErrorInLabeledType()) }
| QMARK ident COLON appType
{ $4, SynArgInfo([], true, Some $2) }
{ let m = rhs2 parseState 1 4
SynType.SignatureParameter([], true, Some $2, $4, m), SynArgInfo([], true, Some $2) }
| appType
{ $1, SynArgInfo([], false, None) }
......
......@@ -61,6 +61,8 @@
<GeneratedModuleName>Microsoft.FSharp.Core.SR</GeneratedModuleName>
<Link>FSCore.resx</Link>
</EmbeddedResource>
<EmbeddedResource Include="ILLink.LinkAttributes.xml" LogicalName="ILLink.LinkAttributes.xml" />
<EmbeddedResource Include="ILLink.Substitutions.xml" LogicalName="ILLink.Substitutions.xml" />
<CompileBefore Include="prim-types-prelude.fsi">
<Link>Primitives/prim-types-prelude.fsi</Link>
</CompileBefore>
......
<linker>
<!--
Attributes listed below here should be behind the 'System.AggressiveAttributeTrimming' feature switch, which
is only enabled by default on app models that need as much size savings as possible.
-->
<assembly fullname="FSharp.Core" feature="System.AggressiveAttributeTrimming" featurevalue="true">
<!-- Microsoft.FSharp.Core -->
<type fullname="Microsoft.FSharp.Core.AbstractClassAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.AutoOpenAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.AutoSerializableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ClassAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CLIEventAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CLIMutableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ComparisonConditionalOnAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationArgumentCountsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationSourceNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompiledNameAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerMessageAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CustomOperationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.DefaultAugmentationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.DefaultValueAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.EntryPointAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.EqualityConditionalOnAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ExperimentalAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.GeneralizableValueAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.InlineIfLambdaAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.FSharpInterfaceDataVersionLiteralAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.MeasureAnnotatedAbbreviationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.MeasureAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoDynamicInvocationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.NoEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.OptionalArgumentAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ProjectionParameterAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ReferenceEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ReflectedDefinitionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.RequireQualifiedAccessAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.RequiresExplicitTypeArgumentsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.SealedAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuralComparisonAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuralEqualityAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.UnverifiableAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.ValueAsStaticPropertyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.VolatileFieldAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<!-- The following attributes are accessed by FSharp.Core at runtime.
Removing them would cause behavior changes but the feature switch allows them. -->
<type fullname="Microsoft.FSharp.Core.AllowNullLiteralAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationMappingAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilationRepresentationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.StructuredFormatDisplayAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<!-- Microsoft.FSharp.Core.CompilerServices -->
<type fullname="Microsoft.FSharp.Core.CompilerServices.NoEagerConstraintApplicationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderDefinitionLocationAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderEditorHideMethodsAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Microsoft.FSharp.Core.CompilerServices.TypeProviderXmlDocAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>
</linker>
\ No newline at end of file
<linker>
<assembly fullname="FSharp.Core">
<resource name="FSharpOptimizationCompressedData.FSharp.Core" action="remove" />
<resource name="FSharpOptimizationInfo.FSharp.Core" action="remove" />
<resource name="FSharpSignatureCompressedData.FSharp.Core" action="remove" />
<resource name="FSharpSignatureInfo.FSharp.Core" action="remove" />
</assembly>
</linker>
......@@ -8483,6 +8483,16 @@ FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType get_innerTy
FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Syntax.SynType innerType
FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+Paren: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+SignatureParameter: Boolean get_optional()
FSharp.Compiler.Syntax.SynType+SignatureParameter: Boolean optional
FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Syntax.SynType get_usedType()
FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Syntax.SynType usedType
FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Text.Range get_range()
FSharp.Compiler.Syntax.SynType+SignatureParameter: FSharp.Compiler.Text.Range range
FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] attributes
FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList] get_attributes()
FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] get_id()
FSharp.Compiler.Syntax.SynType+SignatureParameter: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident] id
FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Syntax.SynConst constant
FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Syntax.SynConst get_constant()
FSharp.Compiler.Syntax.SynType+StaticConstant: FSharp.Compiler.Text.Range get_range()
......@@ -8508,6 +8518,7 @@ FSharp.Compiler.Syntax.SynType+Tags: Int32 LongIdentApp
FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasureDivide
FSharp.Compiler.Syntax.SynType+Tags: Int32 MeasurePower
FSharp.Compiler.Syntax.SynType+Tags: Int32 Paren
FSharp.Compiler.Syntax.SynType+Tags: Int32 SignatureParameter
FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstant
FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantExpr
FSharp.Compiler.Syntax.SynType+Tags: Int32 StaticConstantNamed
......@@ -8541,6 +8552,7 @@ FSharp.Compiler.Syntax.SynType: Boolean IsLongIdentApp
FSharp.Compiler.Syntax.SynType: Boolean IsMeasureDivide
FSharp.Compiler.Syntax.SynType: Boolean IsMeasurePower
FSharp.Compiler.Syntax.SynType: Boolean IsParen
FSharp.Compiler.Syntax.SynType: Boolean IsSignatureParameter
FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstant
FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantExpr
FSharp.Compiler.Syntax.SynType: Boolean IsStaticConstantNamed
......@@ -8558,6 +8570,7 @@ FSharp.Compiler.Syntax.SynType: Boolean get_IsLongIdentApp()
FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasureDivide()
FSharp.Compiler.Syntax.SynType: Boolean get_IsMeasurePower()
FSharp.Compiler.Syntax.SynType: Boolean get_IsParen()
FSharp.Compiler.Syntax.SynType: Boolean get_IsSignatureParameter()
FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstant()
FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantExpr()
FSharp.Compiler.Syntax.SynType: Boolean get_IsStaticConstantNamed()
......@@ -8575,6 +8588,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewLongIdentApp(F
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasureDivide(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewMeasurePower(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynRationalConst, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewParen(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewSignatureParameter(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], Boolean, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Syntax.Ident], FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstant(FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantExpr(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range)
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType NewStaticConstantNamed(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
......@@ -8592,6 +8606,7 @@ FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+LongIdentApp
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasureDivide
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+MeasurePower
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+Paren
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+SignatureParameter
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstant
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantExpr
FSharp.Compiler.Syntax.SynType: FSharp.Compiler.Syntax.SynType+StaticConstantNamed
......
......@@ -16,9 +16,7 @@ World
-the end
Test 3=================================================
> module FSI_0001
[Loading D:\staging\staging\src\tests\fsharp\core\load-script\1.fsx
> [Loading D:\staging\staging\src\tests\fsharp\core\load-script\1.fsx
Loading D:\staging\staging\src\tests\fsharp\core\load-script\2.fsx
Loading D:\staging\staging\src\tests\fsharp\core\load-script\3.fsx]
Hello
......
module FSI_0001
> val it: unit = ()
> val repeatId: string = "A"
......@@ -236,9 +234,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0020
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
module FSI_0001
> val it: unit = ()
> val repeatId: string = "A"
......@@ -131,9 +129,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0020
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
> module FSI_0001
val repeatId: string = "A"
> val repeatId: string = "A"
> val repeatId: string = "B"
......@@ -251,9 +249,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0019
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
> module FSI_0001
val repeatId: string = "A"
> val repeatId: string = "A"
> val repeatId: string = "B"
......@@ -251,9 +249,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0019
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
module FSI_0001
> val it: unit = ()
> val repeatId: string
......@@ -96,9 +94,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0020
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
> module FSI_0001
val repeatId: string = "A"
> val repeatId: string = "A"
> val repeatId: string = "B"
......@@ -251,9 +249,7 @@ module D1 =
val words: System.Collections.Generic.IDictionary<string,int>
val words2000: System.Collections.Generic.IDictionary<int,string>
> module FSI_0019
> module D2 =
> > module D2 =
val words: IDictionary<string,int>
val words2000: IDictionary<int,string>
val opt1: 'a option
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="localPackages" value="../../../artifacts/packages/Release/Release"/>
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
<fallbackPackageFolders>
<clear />
</fallbackPackageFolders>
</configuration>
此差异已折叠。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>preview</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DotNetBuildOffline>true</DotNetBuildOffline>
</PropertyGroup>
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<PublishTrimmed>true</PublishTrimmed>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net7.0/fsc.dll</DotnetFscCompilerPath>
<Fsc_DotNET_DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net7.0/fsc.dll</Fsc_DotNET_DotnetFscCompilerPath>
<FSharpPreferNetFrameworkTools>False</FSharpPreferNetFrameworkTools>
<FSharpPrefer64BitTools>True</FSharpPrefer64BitTools>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)../../../eng/Versions.props" />
<PropertyGroup>
<RestoreSources>
$(MSBuildThisFileDirectory)/../../../artifacts/packages/Release/Release
</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="$(FSCoreProductVersion).*"/>
</ItemGroup>
</Project>
@echo off
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0check.ps1""""
$output = .\bin\Release\net7.0\win-x64\publish\SelfContained_Trimming_Test.exe
# Checking that it is actually running.
if (-not ($LASTEXITCODE -eq 0))
{
Write-Error "Test failed with exit code ${LASTEXITCODE}" -ErrorAction Stop
}
# Checking that the output is as expected.
$expected = "All tests passed"
if (-not ($output -eq $expected))
{
Write-Error "Test failed with unexpected output:`nExpected:`n`t${expected}`nActual`n`t${output}" -ErrorAction Stop
}
# Checking that FSharp.Core binary is of expected size (needs adjustments if test is updated).
$expected_len = 2181119 # In bytes
$file = Get-Item .\bin\Release\net7.0\win-x64\publish\FSharp.Core.dll
$file_len = $file.Length
if ($file_len -le $expected_len)
{
Write-Error "Test failed with unexpected FSharp.Core length:`nExpected:`n`t${expected_len} Bytes`nActual:`n`t${file_len} Bytes" -ErrorAction Stop
}
\ No newline at end of file
......@@ -471,3 +471,44 @@ type Z with
assertRange (14, 0) (14, 4) mType3
assertRange (14, 7) (14, 11) mWith3
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
[<Test>]
let ``SynValSig contains parameter names`` () =
let parseResults =
getParseResultsOfSignatureFile
"""
module Meh
val InferSynValData:
memberFlagsOpt: SynMemberFlags option * pat: SynPat option * SynReturnInfo option * origRhsExpr: SynExpr ->
x: string ->
SynValData2
"""
match parseResults with
| ParsedInput.SigFile (ParsedSigFileInput (modules=[
SynModuleOrNamespaceSig(decls=[
SynModuleSigDecl.Val(valSig = SynValSig(synType =
SynType.Fun(
argType =
SynType.Tuple(path = [
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some memberFlagsOpt))
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some pat))
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type(SynType.App _)
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some origRhsExpr))
])
returnType =
SynType.Fun(
argType = SynType.SignatureParameter(id = Some x)
returnType = SynType.LongIdent _
)
)
))
] ) ])) ->
Assert.AreEqual("memberFlagsOpt", memberFlagsOpt.idText)
Assert.AreEqual("pat", pat.idText)
Assert.AreEqual("origRhsExpr", origRhsExpr.idText)
Assert.AreEqual("x", x.idText)
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
\ No newline at end of file
......@@ -524,3 +524,73 @@ let _: struct (int * int = ()
assertRange (2, 7) (2, 24) mTuple
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
[<Test>]
let ``Named parameters in delegate type`` () =
let parseResults =
getParseResults
"""
type Foo = delegate of a: A * b: B -> c:C -> D
"""
match parseResults with
| ParsedInput.ImplFile (ParsedImplFileInput(modules = [
SynModuleOrNamespace.SynModuleOrNamespace(decls = [
SynModuleDecl.Types(typeDefns = [
SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(kind =
SynTypeDefnKind.Delegate(signature = SynType.Fun(
argType =
SynType.Tuple(path = [
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some a))
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some b))
])
returnType =
SynType.Fun(
argType = SynType.SignatureParameter(id = Some c)
returnType = SynType.LongIdent _
)
))))
])
])
])) ->
Assert.AreEqual("a", a.idText)
Assert.AreEqual("b", b.idText)
Assert.AreEqual("c", c.idText)
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
[<Test>]
let ``Attributes in optional named member parameter`` () =
let parseResults =
getParseResults
"""
type X =
abstract member Y: [<Foo; Bar>] ?a: A -> B
"""
match parseResults with
| ParsedInput.ImplFile (ParsedImplFileInput(modules = [
SynModuleOrNamespace.SynModuleOrNamespace(decls = [
SynModuleDecl.Types(typeDefns = [
SynTypeDefn(typeRepr = SynTypeDefnRepr.ObjectModel(
members = [
SynMemberDefn.AbstractSlot(slotSig = SynValSig(synType =
SynType.Fun(
argType = SynType.SignatureParameter(
[ { Attributes = [ _ ; _ ] } ],
true,
Some a,
SynType.LongIdent _,
m
)
returnType = SynType.LongIdent _
)
))
]
))
])
])
])) ->
Assert.AreEqual("a", a.idText)
assertRange (3, 23) (3, 41) m
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
\ No newline at end of file
......@@ -135,4 +135,31 @@ type Currency =
])) ->
assertRange (7, 4) (7, 11) mPrivate
| _ ->
Assert.Fail "Could not get valid AST"
\ No newline at end of file
Assert.Fail "Could not get valid AST"
[<Test>]
let ``SynUnionCaseKind.FullType`` () =
let parseResults =
getParseResults
"""
type X =
| a: int * z:int
"""
match parseResults with
| ParsedInput.ImplFile (ParsedImplFileInput(modules = [
SynModuleOrNamespace.SynModuleOrNamespace(decls = [
SynModuleDecl.Types(typeDefns = [
SynTypeDefn(typeRepr = SynTypeDefnRepr.Simple(simpleRepr =
SynTypeDefnSimpleRepr.Union(unionCases = [
SynUnionCase(caseType = SynUnionCaseKind.FullType(fullType = SynType.Tuple(path = [
SynTupleTypeSegment.Type(SynType.LongIdent _)
SynTupleTypeSegment.Star _
SynTupleTypeSegment.Type(SynType.SignatureParameter(id = Some z))
])))
])))
])
])
])) ->
Assert.AreEqual("z", z.idText)
| _ -> Assert.Fail $"Could not get valid AST, got {parseResults}"
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册