Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Fix DU case names matching IWSAM member names no longer cause duplicate property entries. (Issue [#14321](https://github.com/dotnet/fsharp/issues/14321), [PR #19341](https://github.com/dotnet/fsharp/pull/19341))
* Fix DefaultAugmentation(false) duplicate entry in method table. (Issue [#16565](https://github.com/dotnet/fsharp/issues/16565), [PR #19341](https://github.com/dotnet/fsharp/pull/19341))
* Fix abstract event accessors now have SpecialName flag. (Issue [#5834](https://github.com/dotnet/fsharp/issues/5834), [PR #19341](https://github.com/dotnet/fsharp/pull/19341))
* Fix warning 20 ("expression is implicitly ignored") pointing at the wrong range when the last expression in a sequential block (e.g. inside `for`, `while` loops) is non-unit. The squiggle now correctly highlights only the offending expression. ([Issue #5735](https://github.com/dotnet/fsharp/issues/5735), [PR #19504](https://github.com/dotnet/fsharp/pull/19504))
* Fix CLIEvent properties to be correctly recognized as events: `IsEvent` returns `true` and `XmlDocSig` uses `E:` prefix instead of `P:`. ([Issue #10273](https://github.com/dotnet/fsharp/issues/10273), [PR #18584](https://github.com/dotnet/fsharp/pull/18584))
* Fix extra sequence point at the end of match expressions. ([Issue #12052](https://github.com/dotnet/fsharp/issues/12052), [PR #19278](https://github.com/dotnet/fsharp/pull/19278))
* Fix wrong sequence point range for `return`/`yield`/`return!`/`yield!` inside computation expressions. ([Issue #19248](https://github.com/dotnet/fsharp/issues/19248), [PR #19278](https://github.com/dotnet/fsharp/pull/19278))
Expand All @@ -17,6 +18,7 @@
* Fix `YieldFromFinal`/`ReturnFromFinal` being incorrectly called in non-tail positions (`for`, `use`, `use!`, `try/with` handler). ([Issue #19402](https://github.com/dotnet/fsharp/issues/19402), [PR #19403](https://github.com/dotnet/fsharp/pull/19403))
* Fixed how the source ranges of warn directives are reported (as trivia) in the parser output (by not reporting leading spaces). ([Issue #19405](https://github.com/dotnet/fsharp/issues/19405), [PR #19408]((https://github.com/dotnet/fsharp/pull/19408)))
* Fix UoM value type `ToString()` returning garbage values when `--checknulls+` is enabled, caused by double address-taking in codegen. ([Issue #19435](https://github.com/dotnet/fsharp/issues/19435), [PR #19440](https://github.com/dotnet/fsharp/pull/19440))
* Fix completion inconsistently showing some obsolete members (fields and events) while hiding others (methods and properties). All obsolete members are now consistently hidden by default. ([Issue #13512](https://github.com/dotnet/fsharp/issues/13512), [PR #19506](https://github.com/dotnet/fsharp/pull/19506))

### Added

Expand Down
7 changes: 6 additions & 1 deletion eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ param (
[switch]$useGlobalNuGetCache = $true,
[switch]$dontUseGlobalNuGetCache = $false,
[switch]$warnAsError = $true,
[string]$warnNotAsError = "",
[switch][Alias('test')]$testDesktop,
[string]$testDesktopBatch = "",
[switch]$testCoreClr,
Expand Down Expand Up @@ -149,6 +150,7 @@ function Print-Usage() {
Write-Host " -compressAllMetadata Build product with compressed metadata"
Write-Host " -buildnorealsig Build product with realsig- (default use realsig+, where necessary)"
Write-Host " -verifypackageshipstatus Verify whether the packages we are building have already shipped to nuget"
Write-Host " -warnNotAsError <codes> Suppress specific warnings from being treated as errors (semi-colon delimited)"
Write-Host ""
Write-Host "Command line arguments starting with '/p:' are passed through to MSBuild."
}
Expand Down Expand Up @@ -305,6 +307,8 @@ function BuildSolution([string] $solutionName, $packSolution) {

$pack = if ($packSolution -eq $False) {""} else {$pack}

$msbuildWarnNotAsError = if ($warnAsError -and $warnNotAsError -ne "") { "/warnNotAsError:$warnNotAsError" } else { "" }

MSBuild $toolsetBuildProj `
$bl `
/p:Configuration=$configuration `
Expand All @@ -327,7 +331,8 @@ function BuildSolution([string] $solutionName, $packSolution) {
/p:BuildNoRealsig=$buildnorealsig `
/v:$verbosity `
$suppressExtensionDeployment `
@properties
@properties `
$msbuildWarnNotAsError

$env:BUILDING_USING_DOTNET=$BUILDING_USING_DOTNET_ORIG
}
Expand Down
16 changes: 8 additions & 8 deletions eng/Version.Details.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ This file should be imported by eng/Versions.props
<optimizationwindows_ntx64MIBCRuntimePackageVersion>1.0.0-prerelease.26180.1</optimizationwindows_ntx64MIBCRuntimePackageVersion>
<optimizationwindows_ntx86MIBCRuntimePackageVersion>1.0.0-prerelease.26180.1</optimizationwindows_ntx86MIBCRuntimePackageVersion>
<!-- dotnet-roslyn dependencies -->
<MicrosoftCodeAnalysisPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisPackageVersion>
<MicrosoftCodeAnalysisCompilersPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisCompilersPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisExternalAccessFSharpPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisExternalAccessFSharpPackageVersion>
<MicrosoftCodeAnalysisFeaturesPackageVersion>5.7.0-1.26209.5</MicrosoftCodeAnalysisFeaturesPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>5.7.0-1.26209.5</MicrosoftVisualStudioLanguageServicesPackageVersion>
<MicrosoftCodeAnalysisPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisPackageVersion>
<MicrosoftCodeAnalysisCompilersPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisCompilersPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisEditorFeaturesPackageVersion>
<MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion>
<MicrosoftCodeAnalysisExternalAccessFSharpPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisExternalAccessFSharpPackageVersion>
<MicrosoftCodeAnalysisFeaturesPackageVersion>5.7.0-1.26210.5</MicrosoftCodeAnalysisFeaturesPackageVersion>
<MicrosoftVisualStudioLanguageServicesPackageVersion>5.7.0-1.26210.5</MicrosoftVisualStudioLanguageServicesPackageVersion>
<!-- dotnet-runtime dependencies -->
<SystemCollectionsImmutablePackageVersion>10.0.2</SystemCollectionsImmutablePackageVersion>
<SystemCompositionPackageVersion>10.0.2</SystemCompositionPackageVersion>
Expand Down
34 changes: 17 additions & 17 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="1a405c76db678301b6f6f5b22d2a63a152c26b97" BarId="309188" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="0cf6b19ed68d2d52e097e6af6d6046b4eeefefe2" BarId="309569" />
<ProductDependencies>
<Dependency Name="Microsoft.Build" Version="18.6.1">
<Uri>https://github.com/dotnet/msbuild</Uri>
Expand All @@ -18,37 +18,37 @@
<Uri>https://github.com/dotnet/msbuild</Uri>
<Sha>e5ebe15655a6be2b2e3209464d0cde1b8825ab57</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Features" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.Features" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.FSharp" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.ExternalAccess.FSharp" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Compilers" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.CodeAnalysis.Compilers" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="5.7.0-1.26209.5">
<Dependency Name="Microsoft.VisualStudio.LanguageServices" Version="5.7.0-1.26210.5">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>e3a102fb75ef112d064feebd2f9385385a445a06</Sha>
<Sha>0eca297f565449839436b91fe4aa180f9bcdedd2</Sha>
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="System.Collections.Immutable" Version="10.0.2">
Expand Down
14 changes: 13 additions & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ usage()
echo " --fromVMR Set when building from within the VMR"
echo " --buildnorealsig Build product with realsig- (default use realsig+ where necessary)"
echo " --tfm Override the default target framework"
echo " --warnNotAsError <codes> Suppress specific warnings from being treated as errors (semi-colon delimited)"
echo ""
echo "Command line arguments starting with '/p:' are passed through to MSBuild."
}
Expand Down Expand Up @@ -80,6 +81,7 @@ product_build=false
from_vmr=false
buildnorealsig=true
properties=""
warn_not_as_error=""
docker=false
args=""

Expand Down Expand Up @@ -189,6 +191,10 @@ while [[ $# > 0 ]]; do
tfm=$2
shift
;;
--warnnotaserror)
warn_not_as_error=$2
shift
;;
/p:*)
properties+=("$1")
;;
Expand Down Expand Up @@ -328,6 +334,11 @@ function BuildSolution {
# do real build
BuildMessage="Error building solution"

local msbuild_warn_not_as_error=""
if [[ "$warn_not_as_error" != "" && "$warn_as_error" == true ]]; then
msbuild_warn_not_as_error="/warnNotAsError:$warn_not_as_error"
fi

MSBuild $toolset_build_proj \
$bl \
/p:Configuration=$configuration \
Expand All @@ -347,7 +358,8 @@ function BuildSolution {
/p:DotNetBuild=$product_build \
/p:DotNetBuildSourceOnly=$source_build \
/p:DotNetBuildFromVMR=$from_vmr \
${properties[@]+"${properties[@]}"}
${properties[@]+"${properties[@]}"} \
$msbuild_warn_not_as_error
fi
}

Expand Down
21 changes: 21 additions & 0 deletions src/Compiler/Checking/AttributeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,27 @@ let PropInfoIsUnseen _m allowObsolete pinfo =
CheckProvidedAttributesForUnseen (pi.PApply((fun st -> (st :> IProvidedCustomAttributeProvider)), m)) m
#endif

/// Indicate if an ILFieldInfo has 'Obsolete' attribute.
/// Used to suppress the item in intellisense.
let ILFieldInfoIsUnseen (finfo: ILFieldInfo) =
match finfo with
| ILFieldInfo(_, fdef) -> CheckILAttributesForUnseen fdef.CustomAttrs
#if !NO_TYPEPROVIDERS
| ProvidedField(_amap, fi, m) ->
CheckProvidedAttributesForUnseen (fi.PApply((fun st -> (st :> IProvidedCustomAttributeProvider)), m)) m
#endif

/// Indicate if an EventInfo has 'Obsolete' or 'CompilerMessageAttribute'.
/// Used to suppress the item in intellisense.
let EventInfoIsUnseen allowObsolete (einfo: EventInfo) =
match einfo with
| ILEvent(ILEventInfo(_, ilEventDef)) -> CheckILAttributesForUnseen ilEventDef.CustomAttrs
| FSEvent(g, _, addValRef, _) -> CheckFSharpAttributesForUnseen g addValRef.Attribs allowObsolete
#if !NO_TYPEPROVIDERS
| ProvidedEvent(_amap, ei, m) ->
CheckProvidedAttributesForUnseen (ei.PApply((fun st -> (st :> IProvidedCustomAttributeProvider)), m)) m
#endif

/// Check the attributes on a union case, returning errors and warnings as data.
let CheckUnionCaseAttributes g (x:UnionCaseRef) m =
trackErrors {
Expand Down
4 changes: 4 additions & 0 deletions src/Compiler/Checking/AttributeChecking.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ val MethInfoIsUnseen: g: TcGlobals -> m: range -> ty: TType -> minfo: MethInfo -

val PropInfoIsUnseen: _m: 'a -> allowObsolete: bool -> pinfo: PropInfo -> bool

val ILFieldInfoIsUnseen: finfo: ILFieldInfo -> bool

val EventInfoIsUnseen: allowObsolete: bool -> einfo: EventInfo -> bool

val CheckEntityAttributes: g: TcGlobals -> tcref: TyconRef -> m: range -> OperationResult<unit>

val CheckUnionCaseAttributes: g: TcGlobals -> x: UnionCaseRef -> m: range -> OperationResult<unit>
Expand Down
11 changes: 10 additions & 1 deletion src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5522,7 +5522,16 @@ and TcStmtThatCantBeCtorBody (cenv: cenv) env tpenv synExpr =
and TcStmt (cenv: cenv) env tpenv synExpr =
let g = cenv.g
let expr, ty, tpenv = TcExprOfUnknownType cenv env tpenv synExpr
let m = synExpr.Range

// Use the range of the last expression in a sequential chain for warnings,
// so that "expression is ignored" diagnostics point at the offending expression
// rather than the entire sequential body. See https://github.com/dotnet/fsharp/issues/5735
let rec lastExprRange (e: SynExpr) =
match e with
| SynExpr.Sequential(expr2 = expr2) -> lastExprRange expr2
| _ -> e.Range

let m = lastExprRange synExpr
let wasUnit = UnifyUnitType cenv env m ty expr
if wasUnit then
expr, tpenv
Expand Down
8 changes: 6 additions & 2 deletions src/Compiler/Checking/NameResolution.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4393,6 +4393,8 @@ let ItemIsUnseen ad g amap m allowObsolete item =
isUnseenNameOfOperator || IsValUnseen ad g m allowObsolete x
| Item.UnionCase(x, _) -> IsUnionCaseUnseen ad g amap m allowObsolete x.UnionCaseRef
| Item.ExnCase x -> IsTyconUnseen ad g amap m allowObsolete x
| Item.ILField finfo -> not allowObsolete && ILFieldInfoIsUnseen finfo
| Item.Event einfo -> not allowObsolete && EventInfoIsUnseen allowObsolete einfo
| _ -> false

let ItemOfTyconRef ncenv m (x: TyconRef) =
Expand Down Expand Up @@ -4467,7 +4469,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
ncenv.InfoReader.GetEventInfosOfType(None, ad, m, ty)
|> List.filter (fun x ->
IsStandardEventInfo ncenv.InfoReader m ad x &&
x.IsStatic = statics)
x.IsStatic = statics &&
(allowObsolete || not (EventInfoIsUnseen allowObsolete x)))
else []

let nestedTypes =
Expand All @@ -4482,7 +4485,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
|> List.filter (fun x ->
not x.IsSpecialName &&
x.IsStatic = statics &&
IsILFieldInfoAccessible g amap m ad x)
IsILFieldInfoAccessible g amap m ad x &&
(allowObsolete || not (ILFieldInfoIsUnseen x)))

let qinfos =
ncenv.InfoReader.GetTraitInfosInType None ty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,43 @@ type Vehicle() = class end
[ (Error 39, Line 3, Col 14, Line 3, Col 28, "The type 'OutOfScopeType' is not defined.")
(Error 267, Line 3, Col 7, Line 3, Col 29, "This is not a valid constant expression or custom attribute value") ]

// https://github.com/dotnet/fsharp/issues/10043
[<Fact>]
let ``Issue 10043 - backtick in type annotation should not report unexpected keyword`` () =
FSharp
"""
let i:float`1 = 3.0
"""
|> typecheck
|> shouldFail
|> withDiagnostics
[ (Error 3563, Line 2, Col 12, Line 2, Col 13, "This is not a valid identifier")
(Error 10, Line 2, Col 13, Line 2, Col 14, "Unexpected integer literal in binding. Expected '=' or other token.") ]

// https://github.com/dotnet/fsharp/issues/10043
[<Fact>]
let ``Issue 10043 - at sign in type annotation should report infix operator`` () =
FSharp
"""
let i:float@1 = 3.0
"""
|> typecheck
|> shouldFail
|> withDiagnostics
[ (Error 615, Line 2, Col 12, Line 2, Col 13, "Unexpected infix operator in type expression") ]

// https://github.com/dotnet/fsharp/issues/10043
[<Fact>]
let ``Issue 10043 - bang in type annotation should report reserved identifier`` () =
FSharp
"""
let i:float!1 = 3.0
"""
|> typecheck
|> shouldFail
|> withDiagnostics
[ (Error 1141, Line 2, Col 7, Line 2, Col 13, "Identifiers followed by '!' are reserved for future use")
(Error 10, Line 2, Col 13, Line 2, Col 14, "Unexpected integer literal in binding. Expected '=' or other token.") ]

// https://github.com/dotnet/fsharp/issues/7177
[<Fact>]
Expand Down
Loading
Loading