Skip to content

Commit f2812f7

Browse files
authored
Merge pull request #9371 from dotnet/merges/master-to-release/dev16.7
Merge master to release/dev16.7
2 parents 3fd5927 + f3d4754 commit f2812f7

15 files changed

+123
-48
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.20278.5">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20301.10">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>77bfd5a60e0691b0cebd180a0fd85eb65fa7f362</Sha>
8+
<Sha>e4cb18bd64d291e5dc34e2f77317c33d5022a6b8</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

eng/common/templates/post-build/post-build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,15 @@ stages:
354354
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
355355
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
356356
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
357+
358+
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
359+
parameters:
360+
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
361+
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
362+
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
363+
stageName: 'VS_Master_Publishing'
364+
channelName: 'VS Master'
365+
channelId: 1012
366+
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
367+
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
368+
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20278.5",
13+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20301.10",
1414
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1515
}
1616
}

src/fsharp/SyntaxTree.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,11 @@ type SynType =
515515
value: SynType *
516516
range: range
517517

518-
/// Gets the syntax range of this constuct
518+
| Paren of
519+
innerType: SynType *
520+
range: range
521+
522+
/// Gets the syntax range of this construct
519523
member x.Range =
520524
match x with
521525
| SynType.App (range=m)
@@ -532,7 +536,8 @@ type SynType =
532536
| SynType.StaticConstantNamed (range=m)
533537
| SynType.HashConstraint (range=m)
534538
| SynType.MeasureDivide (range=m)
535-
| SynType.MeasurePower (range=m) -> m
539+
| SynType.MeasurePower (range=m)
540+
| SynType.Paren (range=m) -> m
536541
| SynType.LongIdent lidwd -> lidwd.Range
537542

538543
/// Represents a syntax tree for F# expressions

src/fsharp/SyntaxTreeOps.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ open FSharp.Compiler
88
open FSharp.Compiler.AbstractIL
99
open FSharp.Compiler.AbstractIL.Internal.Library
1010
open FSharp.Compiler.ErrorLogger
11-
open FSharp.Compiler.Features
1211
open FSharp.Compiler.PrettyNaming
12+
open FSharp.Compiler.Range
1313
open FSharp.Compiler.SyntaxTree
1414
open FSharp.Compiler.Range
1515
open FSharp.Compiler.XmlDoc
@@ -397,6 +397,14 @@ let (|Attributes|) synAttributes =
397397
let rangeOfNonNilAttrs (attrs: SynAttributes) =
398398
(attrs.Head.Range, attrs.Tail) ||> unionRangeWithListBy (fun a -> a.Range)
399399

400+
let rec stripParenTypes synType =
401+
match synType with
402+
| SynType.Paren (innerType, _) -> stripParenTypes innerType
403+
| _ -> synType
404+
405+
let (|StripParenTypes|) synType =
406+
stripParenTypes synType
407+
400408
/// Operations related to the syntactic analysis of arguments of value, function and member definitions and signatures.
401409
module SynInfo =
402410

src/fsharp/TypeChecker.fs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4657,7 +4657,7 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope
46574657
| _, TyparKind.Type ->
46584658
TcTypeApp cenv newOk checkCxs occ env tpenv m tcref [] []
46594659

4660-
| SynType.App (SynType.LongIdent(LongIdentWithDots(tc, _)), _, args, _commas, _, postfix, m) ->
4660+
| SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _))), _, args, _commas, _, postfix, m) ->
46614661
let ad = env.eAccessRights
46624662

46634663
let tcref =
@@ -4793,7 +4793,7 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope
47934793
let ms2, tpenv = TcMeasure cenv newOk checkCxs occ env tpenv typ2 m
47944794
TType_measure (Measure.Prod(ms1, Measure.Inv ms2)), tpenv
47954795

4796-
| SynType.App((SynType.Var(_, m1) | SynType.MeasurePower(_, _, m1)) as arg1, _, args, _commas, _, postfix, m) ->
4796+
| SynType.App(StripParenTypes (SynType.Var(_, m1) | (SynType.MeasurePower(_, _, m1))) as arg1, _, args, _commas, _, postfix, m) ->
47974797
match optKind, args, postfix with
47984798
| (None | Some TyparKind.Measure), [arg2], true ->
47994799
let ms1, tpenv = TcMeasure cenv newOk checkCxs occ env tpenv arg1 m1
@@ -4808,10 +4808,13 @@ and TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscope
48084808
errorR(Error(FSComp.SR.tcIllegalSyntaxInTypeExpression(), m))
48094809
NewErrorType (), tpenv
48104810

4811+
| SynType.Paren(innerType, _) ->
4812+
TcTypeOrMeasure optKind cenv newOk checkCxs occ env (tpenv: SyntacticUnscopedTyparEnv) innerType
4813+
48114814
and TcType cenv newOk checkCxs occ env (tpenv: SyntacticUnscopedTyparEnv) ty =
48124815
TcTypeOrMeasure (Some TyparKind.Type) cenv newOk checkCxs occ env tpenv ty
48134816

4814-
and TcMeasure cenv newOk checkCxs occ env (tpenv: SyntacticUnscopedTyparEnv) ty m =
4817+
and TcMeasure cenv newOk checkCxs occ env (tpenv: SyntacticUnscopedTyparEnv) (StripParenTypes ty) m =
48154818
match ty with
48164819
| SynType.Anon m ->
48174820
error(Error(FSComp.SR.tcAnonymousUnitsOfMeasureCannotBeNested(), m))
@@ -4869,7 +4872,7 @@ and TcTyparConstraints cenv newOk checkCxs occ env tpenv wcs =
48694872
tpenv
48704873

48714874
#if !NO_EXTENSIONTYPING
4872-
and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (v: SynType) idOpt container =
4875+
and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (StripParenTypes v) idOpt container =
48734876
let g = cenv.g
48744877
let fail() = error(Error(FSComp.SR.etInvalidStaticArgument(NicePrint.minimalStringOfType env.DisplayEnv kind), v.Range))
48754878
let record ttype =
@@ -4938,7 +4941,7 @@ and TcStaticConstantParameter cenv (env: TcEnv) tpenv kind (v: SynType) idOpt co
49384941
and CrackStaticConstantArgs cenv env tpenv (staticParameters: Tainted<ProvidedParameterInfo>[], args: SynType list, container, containerName, m) =
49394942
let args =
49404943
args |> List.map (function
4941-
| SynType.StaticConstantNamed(SynType.LongIdent(LongIdentWithDots([id], _)), v, _) -> Some id, v
4944+
| StripParenTypes (SynType.StaticConstantNamed(StripParenTypes (SynType.LongIdent(LongIdentWithDots([id], _))), v, _)) -> Some id, v
49424945
| v -> None, v)
49434946

49444947
let unnamedArgs = args |> Seq.takeWhile (fst >> Option.isNone) |> Seq.toArray |> Array.map snd
@@ -15343,9 +15346,9 @@ module EstablishTypeDefinitionCores =
1534315346
k
1534415347

1534515348

15346-
let private (|TyconCoreAbbrevThatIsReallyAUnion|_|) (hasMeasureAttr, envinner, id: Ident) synTyconRepr =
15349+
let private (|TyconCoreAbbrevThatIsReallyAUnion|_|) (hasMeasureAttr, envinner, id: Ident) (synTyconRepr) =
1534715350
match synTyconRepr with
15348-
| SynTypeDefnSimpleRepr.TypeAbbrev(_, SynType.LongIdent(LongIdentWithDots([unionCaseName], _)), m)
15351+
| SynTypeDefnSimpleRepr.TypeAbbrev(_, StripParenTypes (SynType.LongIdent(LongIdentWithDots([unionCaseName], _))), m)
1534915352
when
1535015353
(not hasMeasureAttr &&
1535115354
(isNil (LookupTypeNameInEnvNoArity OpenQualified unionCaseName.idText envinner.eNameResEnv) ||
@@ -15628,11 +15631,11 @@ module EstablishTypeDefinitionCores =
1562815631

1562915632
#if !NO_EXTENSIONTYPING
1563015633
/// Get the items on the r.h.s. of a 'type X = ABC<...>' definition
15631-
let private TcTyconDefnCore_GetGenerateDeclaration_Rhs rhsType =
15634+
let private TcTyconDefnCore_GetGenerateDeclaration_Rhs (StripParenTypes rhsType) =
1563215635
match rhsType with
15633-
| SynType.App (SynType.LongIdent(LongIdentWithDots(tc, _)), _, args, _commas, _, _postfix, m) -> Some(tc, args, m)
15636+
| SynType.App (StripParenTypes (SynType.LongIdent(LongIdentWithDots(tc, _))), _, args, _commas, _, _postfix, m) -> Some(tc, args, m)
1563415637
| SynType.LongIdent (LongIdentWithDots(tc, _) as lidwd) -> Some(tc, [], lidwd.Range)
15635-
| SynType.LongIdentApp (SynType.LongIdent (LongIdentWithDots(tc, _)), LongIdentWithDots(longId, _), _, args, _commas, _, m) -> Some(tc@longId, args, m)
15638+
| SynType.LongIdentApp (StripParenTypes (SynType.LongIdent (LongIdentWithDots(tc, _))), LongIdentWithDots(longId, _), _, args, _commas, _, m) -> Some(tc@longId, args, m)
1563615639
| _ -> None
1563715640

1563815641
/// Check whether 'type X = ABC<...>' is a generative provided type definition
@@ -17147,7 +17150,7 @@ module TcDeclarations =
1714717150
memberFlags.MemberKind=MemberKind.Constructor &&
1714817151
// REVIEW: This is a syntactic approximation
1714917152
(match valSpfn.SynType, valSpfn.SynInfo.ArgInfos with
17150-
| SynType.Fun (SynType.LongIdent (LongIdentWithDots([id], _)), _, _), [[_]] when id.idText = "unit" -> true
17153+
| StripParenTypes (SynType.Fun (StripParenTypes (SynType.LongIdent (LongIdentWithDots([id], _))), _, _)), [[_]] when id.idText = "unit" -> true
1715117154
| _ -> false)
1715217155
| _ -> false)
1715317156

src/fsharp/pars.fsy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4956,12 +4956,12 @@ atomType:
49564956
| UNDERSCORE
49574957
{ SynType.Anon (lhs parseState) }
49584958

4959-
| LPAREN typ rparen
4960-
{ $2 }
4959+
| LPAREN typ rparen
4960+
{ SynType.Paren ($2, lhs parseState) }
49614961

4962-
| LPAREN typ recover
4963-
{ reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen())
4964-
$2 }
4962+
| LPAREN typ recover
4963+
{ reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnmatchedParen ())
4964+
SynType.Paren ($2, lhs parseState) }
49654965

49664966
| STRUCT LPAREN appType STAR tupleOrQuotTypeElements rparen
49674967
{ SynType.Tuple(true, (false, $3) :: $5, lhs parseState) }

src/fsharp/service/ServiceAssemblyContent.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ module ParsedInput =
603603
and walkType = function
604604
| SynType.Array (_, t, _)
605605
| SynType.HashConstraint (t, _)
606-
| SynType.MeasurePower (t, _, _) -> walkType t
606+
| SynType.MeasurePower (t, _, _)
607+
| SynType.Paren (t, _) -> walkType t
607608
| SynType.Fun (t1, t2, _)
608609
| SynType.MeasureDivide (t1, t2, _) -> walkType t1; walkType t2
609610
| SynType.LongIdent ident -> addLongIdentWithDots ident

src/fsharp/service/ServiceInterfaceStubGenerator.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ open FSharp.Compiler.AbstractIL.Internal.Library
1010
open FSharp.Compiler.Range
1111
open FSharp.Compiler.SourceCodeServices
1212
open FSharp.Compiler.SyntaxTree
13+
open FSharp.Compiler.SyntaxTreeOps
1314

1415
#if !FX_NO_INDENTED_TEXT_WRITER
1516
[<AutoOpen>]
@@ -112,8 +113,8 @@ type InterfaceData =
112113
ty.Range
113114
member x.TypeParameters =
114115
match x with
115-
| InterfaceData.Interface(ty, _)
116-
| InterfaceData.ObjExpr(ty, _) ->
116+
| InterfaceData.Interface(StripParenTypes ty, _)
117+
| InterfaceData.ObjExpr(StripParenTypes ty, _) ->
117118
let rec (|RationalConst|) = function
118119
| SynRationalConst.Integer i ->
119120
string i
@@ -158,6 +159,8 @@ type InterfaceData =
158159
Some (sprintf "%s^%s" typeName power)
159160
| SynType.MeasureDivide(TypeIdent numerator, TypeIdent denominator, _) ->
160161
Some (sprintf "%s/%s" numerator denominator)
162+
| SynType.Paren(TypeIdent typeName, _) ->
163+
Some typeName
161164
| _ ->
162165
None
163166
match ty with

src/fsharp/service/ServiceParamInfoLocations.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ type FSharpNoteworthyParamInfoLocations(longId: string list, longIdRange: range,
3232
[<AutoOpen>]
3333
module internal NoteworthyParamInfoLocationsImpl =
3434

35-
let isStaticArg a =
36-
match a with
35+
let isStaticArg (StripParenTypes synType) =
36+
match synType with
3737
| SynType.StaticConstant _ | SynType.StaticConstantExpr _ | SynType.StaticConstantNamed _ -> true
3838
| SynType.LongIdent _ -> true // NOTE: this is not a static constant, but it is a prefix of incomplete code, e.g. "TP<42, Arg3" is a prefix of "TP<42, Arg3=6>" and Arg3 shows up as a LongId
3939
| _ -> false
@@ -52,7 +52,7 @@ module internal NoteworthyParamInfoLocationsImpl =
5252
| Found of openParen: pos * commasAndCloseParen: (pos * string option) list * hasClosedParen: bool
5353
| NotFound
5454

55-
let digOutIdentFromStaticArg synType =
55+
let digOutIdentFromStaticArg (StripParenTypes synType) =
5656
match synType with
5757
| SynType.StaticConstantNamed(SynType.LongIdent(LongIdentWithDots([id], _)), _, _) -> Some id.idText
5858
| SynType.LongIdent(LongIdentWithDots([id], _)) -> Some id.idText // NOTE: again, not a static constant, but may be a prefix of a Named in incomplete code
@@ -145,9 +145,9 @@ module internal NoteworthyParamInfoLocationsImpl =
145145
NotFound, Some inner
146146
| _ -> NotFound, Some inner
147147

148-
let (|StaticParameters|_|) pos synType =
148+
let (|StaticParameters|_|) pos (StripParenTypes synType) =
149149
match synType with
150-
| SynType.App(SynType.LongIdent(LongIdentWithDots(lid, _) as lidwd), Some(openm), args, commas, closemOpt, _pf, wholem) ->
150+
| SynType.App(StripParenTypes (SynType.LongIdent(LongIdentWithDots(lid, _) as lidwd)), Some(openm), args, commas, closemOpt, _pf, wholem) ->
151151
let lidm = lidwd.Range
152152
let betweenTheBrackets = mkRange wholem.FileName openm.Start wholem.End
153153
if AstTraversal.rangeContainsPosEdgesExclusive betweenTheBrackets pos && args |> List.forall isStaticArg then

src/fsharp/service/ServiceParseTreeWalk.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace FSharp.Compiler.SourceCodeServices
99

1010
open FSharp.Compiler.Range
1111
open FSharp.Compiler.SyntaxTree
12+
open FSharp.Compiler.SyntaxTreeOps
1213

1314
/// A range of utility functions to assist with traversing an AST
1415
module public AstTraversal =
@@ -518,7 +519,7 @@ module public AstTraversal =
518519

519520
visitor.VisitPat (defaultTraverse, pat)
520521

521-
and traverseSynType (ty: SynType) =
522+
and traverseSynType (StripParenTypes ty) =
522523
let defaultTraverse ty =
523524
match ty with
524525
| SynType.App (typeName, _, typeArgs, _, _, _, _)

src/fsharp/service/ServiceUntypedParse.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ type FSharpParseFileResults(errors: FSharpErrorInfo[], input: ParsedInput option
355355
| SynMemberDefn.AutoProperty(_attribs, _isStatic, _id, _tyOpt, _propKind, _, _xmlDoc, _access, synExpr, _, _) -> yield! walkExpr true synExpr
356356
| SynMemberDefn.ImplicitCtor(_, _, _, _, m) -> yield! checkRange m
357357
| SynMemberDefn.Member(bind, _) -> yield! walkBind bind
358-
| SynMemberDefn.Interface(_synty, Some membs, _) -> for m in membs do yield! walkMember m
358+
| SynMemberDefn.Interface(_, Some membs, _) -> for m in membs do yield! walkMember m
359359
| SynMemberDefn.Inherit(_, _, m) ->
360360
// can break on the "inherit" clause
361361
yield! checkRange m
@@ -810,6 +810,7 @@ module UntypedParseImpl =
810810
| SynType.HashConstraint(t, _) -> walkType t
811811
| SynType.MeasureDivide(t1, t2, _) -> walkType t1 |> Option.orElse (walkType t2)
812812
| SynType.MeasurePower(t, _, _) -> walkType t
813+
| SynType.Paren(t, _) -> walkType t
813814
| _ -> None
814815

815816
and walkClause (Clause(pat, e1, e2, _, _)) =
@@ -1140,7 +1141,7 @@ module UntypedParseImpl =
11401141
| (SynExpr.New (_, SynType.LongIdent typeName, arg, _)) ->
11411142
// new A()
11421143
Some (endOfLastIdent typeName, findSetters arg)
1143-
| (SynExpr.New (_, SynType.App(SynType.LongIdent typeName, _, _, _, mGreaterThan, _, _), arg, _)) ->
1144+
| (SynExpr.New (_, SynType.App(StripParenTypes (SynType.LongIdent typeName), _, _, _, mGreaterThan, _, _), arg, _)) ->
11441145
// new A<_>()
11451146
Some (endOfClosingTokenOrLastIdent mGreaterThan typeName, findSetters arg)
11461147
| (SynExpr.App (_, false, SynExpr.Ident id, arg, _)) ->

tests/fsharp/typecheck/sigs/neg04.bsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ is not compatible with type
110110
'IBar'
111111

112112

113-
neg04.fs(144,10,144,25): typecheck error FS0193: Type constraint mismatch. The type
113+
neg04.fs(144,10,144,26): typecheck error FS0193: Type constraint mismatch. The type
114114
'int * int'
115115
is not compatible with type
116116
'IBar'
@@ -122,7 +122,7 @@ is not compatible with type
122122
'IBar'
123123

124124

125-
neg04.fs(150,10,150,26): typecheck error FS0193: Type constraint mismatch. The type
125+
neg04.fs(150,10,150,27): typecheck error FS0193: Type constraint mismatch. The type
126126
'int -> int'
127127
is not compatible with type
128128
'IBar'

tests/service/Common.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ let assertHasSymbolUsages (names: string list) (results: FSharpCheckFileResults)
368368
for name in names do
369369
Assert.That(Set.contains name symbolNames, name)
370370

371+
let getRangeCoords (r: range) =
372+
(r.StartLine, r.StartColumn), (r.EndLine, r.EndColumn)
373+
371374
let coreLibAssemblyName =
372375
#if NETCOREAPP
373376
"System.Runtime"

0 commit comments

Comments
 (0)