Skip to content
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

Fix error on out param of extern local function #49860

Merged
merged 2 commits into from
Dec 10, 2020

Conversation

RikkiGibson
Copy link
Contributor

Closes #49500

@@ -58,6 +58,12 @@ protected TLocalFunctionState GetOrCreateLocalFuncUsages(LocalFunctionSymbol loc

public override BoundNode? VisitLocalFunctionStatement(BoundLocalFunctionStatement localFunc)
{
if (localFunc.Symbol.IsExtern)
Copy link
Contributor

@AlekseyTs AlekseyTs Dec 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localFunc.Symbol.IsExtern [](start = 16, length = 25)

Does this match the criteria used to skip analysis for type members (non-local functions)? Would it make sense to check for presence of the body instead? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that for member methods, we decide whether to analyze based on whether BindMethodBody returned a non-null body. extern member methods will force a null return from BindMethodBody, which makes us skip analysis even in an error scenario where an extern method has a body.

I didn't want to modify the conditions when a BoundLocalFunctionStatement is given a null body, in order to reduce churn, and felt that this check resulted in useful diagnostic behaviors (i.e. if the function is required to have a body but one is missing, we might as well also let you know about things that are required to be included in that body), which are consistent enough with the diagnostics given for member methods.

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 2)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 2)

@jcouv jcouv self-assigned this Dec 10, 2020
@RikkiGibson RikkiGibson merged commit d3ed2ca into dotnet:master Dec 10, 2020
@RikkiGibson RikkiGibson deleted the fix-49500 branch December 10, 2020 21:02
@ghost ghost added this to the Next milestone Dec 10, 2020
333fred added a commit to 333fred/roslyn that referenced this pull request Dec 15, 2020
* upstream/master: (241 commits)
  Allow pattern matching `null` against pointer types when the pointer types contain nested type parameters (dotnet#49915)
  Remove document extension method and convert usages to use the text buffer extension method.
  VB: Strengthen implementation of `PropertySymbol.IsWritable` against NullReferenceException (dotnet#49962)
  Add switch to skip nullable analysis (dotnet#49876)
  Update dependencies from https://github.com/dotnet/roslyn build 20201211.16 (dotnet#49958)
  Treat record positional parameters as properties (dotnet#48329)
  [master] Update dependencies from dotnet/roslyn (dotnet#49395)
  VB: Ensure array access indexes undergo conversion to integer even when there is a mismatch with array rank. (dotnet#49907)
  Disable OOP when running as cloud environment client VS instance
  Rename workspace context method (and unify impls) to better represent the condition being checked
  Report non-Const locals used in an expression that must have a constant value. (dotnet#49912)
  Add support for more ServiceAudience values (dotnet#49914)
  Handle ref-containing structs returned by value from function-pointers (dotnet#49883)
  Fix error on out param of extern local function (dotnet#49860)
  Fix constructor exit warnings for generic NotNull (dotnet#49841)
  Loc updates
  Prefer more specific path map key (dotnet#49670)
  Rename `_availablelocalFunctionOrdinal` to `_availableLocalFunctionOrdinal` (dotnet#49901)
  Fix namespace so that external access wrapper type can be accessed from UT.
  XamlProjectService fixes (dotnet#49711)
  ...
@dibarbet dibarbet modified the milestones: Next, 16.9.P3 Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect error about uninitialized out parameter in extern local function
5 participants