-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of unannotated unconstrained type parameter in nullable diabled code #34842
Labels
3 - Working
4 - In Review
A fix for the issue is submitted for review.
Area-Compilers
Bug
Feature - Nullable Reference Types
Nullable Reference Types
Milestone
Comments
gafter
added
Area-Compilers
Bug
Feature - Nullable Reference Types
Nullable Reference Types
labels
Apr 8, 2019
gafter
added a commit
to gafter/roslyn
that referenced
this issue
Apr 9, 2019
A reference to an unconstrained type parameter in nullable-disabled code should be treated as *oblivious*, and therefore reading them should be considered to produce non-null values, and we are permitted to assign null values to them without a diagnostic. Fixes dotnet#34842 Also disable the old WRN_DotOnDefault when the nullable feature is enabled. Fixes dotnet#34855
gafter
added a commit
that referenced
this issue
Apr 26, 2019
…ode (#34889) A reference to an unconstrained type parameter in nullable-disabled code should be treated as *oblivious*, and therefore reading them should be considered to produce non-null values, and we are permitted to assign null values to them without a diagnostic. Fixes #34842 Also disable the old WRN_DotOnDefault when the nullable feature is enabled. Fixes #34855
heejaechang
added a commit
that referenced
this issue
May 2, 2019
* Revoke IVTs to dotnet/roslyn-analyzers Closes #35102 * Implement InternalsVisibleTo checks Closes #35064 * Allow a work item for tracking migration of IVTs * Exclude MonoDevelop IVTs for not loading inside VS * Exclude Moq IVTs for not loading inside VS * Track removal of external IVTs for XAML See #35069 * Remove IVTs to non-existent assemblies Roslyn.Compilers.CompilerServer.UnitTests removed in 2472120 Roslyn.Test.Utilities.CoreClr removed in cf58bbc Roslyn.Test.Utilities.Desktop removed in cf58bbc Roslyn.Compilers.CSharp.PerformanceTests removed in cd33333 Roslyn.Test.Utilities.FX45 removed in b77c547 Roslyn.Compilers.VisualBasic.PerformanceTests never existed (typo from 3c14b04) Roslyn.Compilers.CSharp.Test.Utilities.Desktop removed in edd89e4 * Track removal of EnC.UnitTests IVTs See #35071 * Track removal of legacy testing IVTs See #35072 * Use the assembly name instead of project file name for IVT analysis * Track removal of project system IVTs See #35070 * Track removal of Live Share IVTs See #35074 * Track removal of F# IVTs See #35076 * Track removal of TypeScript IVTs See #35077 * Track removal of unit testing IVTs See #35078 * Track removal of Razor IVTs See #35079 * Track removal of legacy code analysis IVTs See #35080 * Track removal of internal testing IVTs See #35081 * Remove IVTs to non-existent assemblies Roslyn.InteractiveWindow.UnitTests renamed in 2efc2ce and removed in db7a842 Roslyn.VisualStudio.VisualBasic.Repl renamed in 8ea0f52 and removed in 7ab3b77 Microsoft.VisualStudio.CSharp.Repl removed in 7ab3b77 Microsoft.VisualStudio.VisualBasic.Repl removed in 7ab3b77 * Track removal of IntelliTrace IVTs See #35084 * Track removal of ExternalDependencyServices IVTs See #35085 * Simplify null checks using 'is null' and 'is object' (#35017) * Track removal of CodeLens IVTs See #35086 * Track removal of Scripting.Desktop IVT See #35090 * Track removal of Editor.UI.Wpf IVTs See #35091 * Track removal of Microsoft.VisualStudio.InteractiveServices See #35098 * Track removal of Xamarin IVTs See #35099 * Remove IVTs to non-existent assemblies Roslyn.Compilers.VisualBasic.Test.Utilities.Desktop incorrectly added in a70cdce VBCSCompilerPortable removed in b2bd77b Microsoft.CodeAnalysis.CompilerServer removed in b00224e Roslyn.VisualStudio.Test.Utilities.Next renamed in e0e16d7 Microsoft.CodeAnalysis.Scripting.Destkop.UnitTests never existed (typo) Roslyn.DebuggerVisualizers removed in d7e4939 Microsoft.VisualStudio.LanguageServices.VisualBasic.UnitTests never existed (typo in 7ab3b77) Roslyn.Services.Editor.CSharp.UnitTests2 renamed in bb1f97b * Only process IVTs for the primary solution * Clean up Build Boss code style and error messaging * Fix VisitPatternForRewriting. * install servicehub json files in common7/servicehub folders (#34563) * moved files * opt-in to new "serviceOverride": true support and refactor directory structure to share json files with devdiv insertion projects * added swr for servicehub json files. * delete projects not needed * moving to auto generated service.json approach * made json file included in vsix * generate swr file * address PR feedbacks and remove duplications except vsix manifest * use relative path in json file * share duplicated string to multiple csproj * fix swr package name * PR feedbacks * Add missing binary back-compat method This was missed when we were adding another parameter to the one with optional arguments. * Use Machine.Arm64 instead of raw value. (#35097) Changes Use Machine.Arm64 instead of raw value. These cases were probably missed on #27023. * Add unit-tests for fixed issues. (#35094) Closes #33276. Closes #31676. * Update string * Move to base project so it triggers for CPS * Be resilient to cases where a language service is moving to a new assembly Fixes #34987 * Fix sorting of import completion items * Track IVT removal in Microsoft.CodeAnalysis.Scripting See #5661 * Clarify primary solution argument for build boss * Addressing Review comments. - Added condition to handle cases when invocation is null. - Added corresponding unit test. * Use button over vs:button to have high contrast work correctly. Set the HelpText dynamically * Remove unneeded properties from stack panel * Correctly report null reference possibility when GetEnumerator returns a potentially nullable Enumerator type. * Added test for previously fixed #34667 * Addressed PR feedback. * Update nullable attribute in docs (#34763) * Update nullable attribute in docs Update nullable attribute in docs to show NullableFlags * Update nullable-reference-types.md * Fix the pull member up failure (#34581) * Add missing parameters and tests * Address feedback * Removing extra null check. * PR feedback * `Equals` for generic methods should compare nullable annotations for type type arguments. (#35116) Fixes #35083. * Intellisense broken inside of methods that have delegates as arguments (#35067) * Addressed pr feedback, added new test to demonstrate #35151. * Targeted Completion Prototype * Use tag name instead of literal text * Make target-typed completion an experiment * More strictly keep original code * Rename some helpers * Switch to "CorrelationScope" icon * Add initial tests and telementry * Telemetry * Remove redundant check * Unit tests * Whitespace * Handle multitargeting * More descriptive comment * Rename local * Add a couple tests * Update unit test Trait name * Renaming some things from "matching type" to "target typed" * More renaming from matchingType -> targetTyped * Add VB tests * Update string to "Target type matches" * Rename "MatchingType" to "TargetTypeMatch" more places * Rename to TargetTypedFilters * Improved telemetry * More correct telemetry * Improve linked file handling * Fix & improve telemetry * PR feedback * Definitely avoid some allocations * Remove a repeated allocation. * Formatting * Fix mismerge * Fix mismerges * Fix mismerges * Fix mismerge * Avoid caching VS completion items for non-import items * Regex Completion + Async Completion = Failure to trigger on `[` in VB (#34988) * Fix typos * Cleanup missed prototype comments. * Add link to tracking bug * Async-enumerator methods honor the EnumeratorCancellation attribute (#35121) * Revert "Remove the dependence between the order in NullableAnnotation and metadata attribute values (#34909)" This reverts commit e922628. * Fix complete statement's semicolon placement to better handle incomplete code (#35024) * Fix for 34983 * Cleanup, fix For statements * Add more tests * Respond to feedback * Fix spelling * Binary log for Unix bootstrap Generate a binary log file for the bootstrap phase on Unix platforms. * Add 16.1P3 to .yml files * Update PublishData for Dev16.1 Preview 3 * Use correct branch name for 16.1 Preview 3 * Re-enable set -e * Add test to assert relative order of completion items * Update PublishData for 16.1 Preview 3 and 16.2 Preview 1 * Update eng/config/PublishData.json Co-Authored-By: dpoeschl <dpoeschl@gmail.com> * Update eng/config/PublishData.json Co-Authored-By: dpoeschl <dpoeschl@gmail.com> * Implement IMethodSymbol.ReceiverNullableAnnotation. * Fix to modify tooltip text instead of helptext * Revert "Add tests for experiment service" This reverts commit 42fe72d. * Add import placement codestyle, diagnostic, and fixer (#35009) * Add import placement codestyle option * Add TextEditor CodeStyle options for Using Placement * Add misplaced using directives analyzer and code fix * Use consistent pluralization * Removed Preserve AddImportPlacement option * Removed Preserve from CSharp Style Options * Removed Preserve from editorconfig tests * Coverted to Roslyn style analyzer and fixer tests. * Simplified MisplacedUsings CodeFix based on feedback. * Simplified MisplacedUsings CodeFix based on feedback. * Add warning annotation to moved using directives * Move misplaced usings out of multiple namespaces * Deduplicate usings when moving them * Simplified move usings warning text * Add expected warning markers to misplaced using tests * Fix editor config generator tests * Consolidated diagnostics and tests * Add tests where directives are in both contexts * Update Versions.props for 16.2 * Update Language Feature Status.md * Add version check to enable the pattern-based Index & Range indexers (#35170) * Implement an alternative way to break cycles while calculating IsValueType/IsReferenceType for a type parameter. (#35145) Fixes #30081. * Using FQN instead of adding import during ENC session * Use 'is null' when in C#7 when adding null checks for a parameter. * Don't add null checks for nullable-structs. The fact that they're nullable indicates they don't need checks. * Fix callers * Simplify * Fix * Make bootstrap 32 bit in 32 bit CI This changes our bootstrap compiler to run as a 32 bit process in the 32 bit CI runs. The intent of this runs is to validate we can function on 32 bit systems and that should extend to the compiler as well. This can help us identify the rare cases where we emit code that doesn't perform well on the 32 bit JIT, or just outright crashes. * Don't suggest static members in PropertySubPatternCompletionProvider * Revert two step initialization of base type in PENamedTypeSymbol. (#35189) Related to #28834. Also, remove obsolete comments from a test. Closes #30003. * Ensure we refresh ruleset severities after a ruleset change If a ruleset file changed, we didn't always reapply the new values in the IDE. For legacy projects the IDE is taking the ruleset files and applying them to the compilation; for CPS projects that's being done when we call into the compiler to parse the command line string. We forgot to reparse the command line string, so CPS projects wouldn't refresh until some other command line string changed or the project was unloaded or reloaded. Fixes #35164 * Revert "Revert "Add tests for experiment service"" This reverts commit adbcf8a. * Only emit readonly attributes implicitly when feature enabled (#35213) * Only emit readonly attributes implicitly when readonly members feature is enabled * Comment about reasoning and use Theory for test * Use Properties indexer instead of Add() to track pasted span * VisualBasic semantic model does not recognize overloads at chained queries (#35155) * Add spec for enhanced using (#34697) * Add spec for enhanced using * Create a shared experiment service mock * Fix existing tests * Treat CandidateReason MemberGroup the same as Abiguous when classifying NameSyntax * Rename mock service * Don't provide sync namespace refactoring in generated code * Update azure-pipelines* for dev16.1-preview3* * Update versions.props for 16.1 preview 4 * Update PublishData for 16.1 preview3 and preview4 * Optimise DisplayClass Allocations (#32092) The current implementation of closure conversion creates closure environments for each new scope. This change tries to minimize the number of closure environments, and thus closure environment allocations, when possible by merging "adjacent" closure environments. To merge two closure environments, they have to: 1. Be captured by exactly the same set of closures 2. Have no backwards branching between the allocation of the two environments 3. Have the same environment lifetime If so, all of the variables will be merged into a single closure environment. Fixes #29965 * intellisense should suggest event after readonly in a struct member declaration (#35234) * intellisense should suggest event after writing readonly in a struct member declaration. * Avoid repetition of keywords in EventKeywordRecommender * Re-enable symbol tests on mono (#35265) * Remove usage of QuietRestore (#35264) * Readonly struct and readonly member metadata as source (#34778) * Implement MetadataAsSource for ref and readonly structs * MetadataAsSource for readonly members * Fix NotImplementedException errors. Fix some ArrayBuilder leaks. * Fix a leak. Fix implicit readonly attribute test. * List passed to GetUpdatedDeclarationAccessibilityModifiers needs to support Remove * Allow specifying a metadata language version for MetadataAsSourceTests * Remove unused SyntaxTokenList members. Comment readonly event generation. * Check VB MetadataAsSource for readonly members * Fixes from feedback * Add test for not implicitly readonly struct getter * Label arguments in call to GetCustomAttributesForToken * Reference issue about readonly event public API * Fix crash in pattern matching (#35249) When we relaxed the requirement for pattern matching open types to a constant pattern to not require a conversion from the pattern expression to the open type, but the pattern expression should be required to have a constant value. Fixes #34980 * Warn for CancellationToken parameters missing [EnumeratorCancellation] (#35254) * Use of unannotated unconstrained type parameter in nullable diabled code (#34889) A reference to an unconstrained type parameter in nullable-disabled code should be treated as *oblivious*, and therefore reading them should be considered to produce non-null values, and we are permitted to assign null values to them without a diagnostic. Fixes #34842 Also disable the old WRN_DotOnDefault when the nullable feature is enabled. Fixes #34855 * Error for `typeof(T?)` when `T` is a reference type (#35001) Fixes #29894 * Make Generated syntax trees restore to project-level nullability (#35018) * Make Generated syntax trees restore to project nullability * Focus first tabbable element in PMU dialog (#35212) * Add new optprof test for training * Update foreach based on nullable analysis This makes 2 changes: 1. Reinfer the GetEnumerator method based on nullable analysis of the foreach expression type. 2. Use that information to update the collection element type based on that same analysis. * Update DynamicFileInfo.cs * Fix applying code actions that change AdditionalDocuments Some code was accidentally calling GetDocument with an additional document ID; this didn't end well. * VS 2017 -> VS 2019 * Fix broken link in Language Feature Status Fix link to Nullable reference types specification * Fix more links in Language Feature Status Fix links to recursive patterns and async streams specifications * Move to non Int pools Responding to a request from our core engineering team to move to a different pool. * Remove unnecessary parameter The `CoreCompile` targets for C# and VB were both passing the set of `PotentialEditorConfigFiles` to the `PotentialAnalyzerConfigFiles` input parameter of `CscTask`/`VbcTask`. However, this parameter no longer exists. At one point in the development of the editorconfig-in-compiler feature we had a separate MSBuild task that would compute both the actual and potential .editorconfig file paths and pass them to the task. These are now computed as part of the MSBuild evaluation pass, and the potential .editorconfig files are passed to the project systems via a separate target (`GetPotentialEditorConfigFiles` in Microsoft.Common.CurrentVersion.targets). * Make sure nullability mismatch in constraints specified in different partial declarations (types/methods) are properly detected and reported. (#35272) Make sure nullability mismatch in constraints specified in different partial declarations (types/methods) are properly detected and reported. Fixes #30229. Fixes #35179. Implements the following LDM decision: For partial types, the invariant matching from type inference and merging. A mismatch between two non-oblivious candidates produces an error. No warnings are produced. For partial methods, nullability has to match with exception for oblivious and we produce warnings. For the result, we use the implementation signature inside the implementation, and the declaration signature for the callers. * Make compilation outputs available via a workspace service (#34809) * Handle dynamic null checks against literal null (#34996) Fixes #30939 * Clean up an assertion in LambdaRewriter. (#35284) Fixes #30069 * Fixup from bad merge. (#35351) * Addressed pr feedback. * Lambdas in array initializers checked in nullable walker (#35030) Also fixes a corresponding issue in the switch expression Fixes #34299 See also #35029 * Null inferences do not flow out of a finally block. (#35276) Fixes #34018 * changed the way we report live analysis to task center (#35336) * changed the way we report live analysis to task center previously, we listen to diagnostic service to report progress. problem is that, it only raise event if it found errors on a file. so what we report is actually last file we found errors on rather than file that we are analyzing. this caused confusion since we report in task center that we are analyzing file "A" when it is actually "analyzed" not "analyzing" another issue is since it only report file that contains errors. we might not actually show anything in task center if there is no error, or show file "A" for long time if that is only file with errors. this PR changes the experience closer to what users would expects. and now progress is for solution crawler not specifically on diagnostics. now we report file that solution crawler is analyzing. there is still cavet such as solution cralwer can pause between processing a file if VS is busy. but it will still show file "A". or we will not update UI at least 200ms a part and etc. since it is task center where we don't want to be too impactful to VS, based on feeedback we will see whether we need to do more such as detect solution crawlwer pause and update task center to show pasue. or update task center to show different stage such as analyzing/analyzed. or show in task center, what analyzer is actually running such as diagnostic, todo, designer attribute scan, find all reference cache and etc. * addressing PR feedbacks * Handle val escape for the switch expression. (#35311) Fixes #35278 * Additional Nullability checks for deconstruction: (#35016) * Additional Nullability checks for deconstruction: - Check 'this' param for extension deconstruct - Re-infer the argument types for generic extension deconstruct - Update the deconstruction method in instance cases - Update return type with visited arguments - Update tests * Correct nullability analysis in conditional access (#34973) Fixes #29956 Also introduce a helper `TypeSymbol.IsVoidType()` * Use Button instead of vs:Button on warning dialog for PMU (#35344) * Update version for Microsoft.Net.Test.Sdk package This change is required in order to enable running on non-desktop TFM tests from VS test explorer window. * [master] Update dependencies from dotnet/arcade (#34831) * Update dependencies from https://github.com/dotnet/arcade build 20190407.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19207.1 * Update dependencies from https://github.com/dotnet/arcade build 20190409.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19209.2 * Update dependencies from https://github.com/dotnet/arcade build 20190410.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19210.7 * Update dependencies from https://github.com/dotnet/arcade build 20190411.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19211.2 * Update dependencies from https://github.com/dotnet/arcade build 20190412.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19212.2 * Update dependencies from https://github.com/dotnet/arcade build 20190413.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19213.2 * Update dependencies from https://github.com/dotnet/arcade build 20190414.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19214.2 * Update dependencies from https://github.com/dotnet/arcade build 20190415.12 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19215.12 * Update dependencies from https://github.com/dotnet/arcade build 20190417.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19217.1 * Update dependencies from https://github.com/dotnet/arcade build 20190418.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.1 * Update dependencies from https://github.com/dotnet/arcade build 20190418.4 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.4 * Update dependencies from https://github.com/dotnet/arcade build 20190418.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.7 * Update dependencies from https://github.com/dotnet/arcade build 20190422.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19222.2 * Update dependencies from https://github.com/dotnet/arcade build 20190423.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19223.2 * Use Arcade CoreXT package support * Update dependencies from https://github.com/dotnet/arcade build 20190424.9 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19224.9 * Fix signing * Update dependencies from https://github.com/dotnet/arcade build 20190425.5 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19225.5 * Update dependencies from https://github.com/dotnet/arcade build 20190426.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19226.3 * Update dependencies from https://github.com/dotnet/arcade build 20190429.8 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19229.8 * Update dependencies from https://github.com/dotnet/arcade build 20190430.6 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19230.6 * Use more robust initialization for TypeWithAnnotations.Builder (#35373) * Auto-generate assembly version of the build task assembly (#35238)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 - Working
4 - In Review
A fix for the issue is submitted for review.
Area-Compilers
Bug
Feature - Nullable Reference Types
Nullable Reference Types
The issue is the treatment of a reference to a (unconstrainted) type parameter that was both declared and referenced in a disabled context (without an annotation). Such a reference should designate an oblivious type and should be treated accordingly. That does not appear to be the treatment today. That is the issue in
M1
below. There should be no problem with the default expression because it is being converted to an oblivious type.See also #30214
The text was updated successfully, but these errors were encountered: