Skip to content

Ensure we associate an error with all missing identifiers in the parser.#44389

Merged
CyrusNajmabadi merged 5 commits intodotnet:masterfrom
CyrusNajmabadi:missingIdentifierError
Jul 14, 2020
Merged

Ensure we associate an error with all missing identifiers in the parser.#44389
CyrusNajmabadi merged 5 commits intodotnet:masterfrom
CyrusNajmabadi:missingIdentifierError

Conversation

@CyrusNajmabadi
Copy link
Contributor

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 19, 2020 20:06
@CyrusNajmabadi CyrusNajmabadi requested a review from jcouv May 19, 2020 20:06
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

This cannot be merged until after the syntax changes for function pointers go in, which will be after Preview 3.

@CyrusNajmabadi
Copy link
Contributor Author

This cannot be merged until after the syntax changes for function pointers go in

Why? This doesn't affect function pointers at all. It just fixes a current deficiency in parsing new-types.

@jcouv
Copy link
Member

jcouv commented May 26, 2020

I suspect Fred probably wants to minimize extra work (resolving conflicts) that might impede merging a scheduled feature. I haven't looked at the change on either side, so I don't know what are the chances of conflicts.

@333fred 333fred dismissed their stale review May 29, 2020 17:05

When I blocked this, I just looked at the PR title, which implies that it would break function pointers which uses an errorless missing identifier. If that's not what this PR is doing, then perhaps a different title would be clearer.


ParseAndValidate(text, TestOptions.Regular,
// (7,21): error CS1526: A new expression requires an argument list or (), [], or {} after type
// (7,21): error CS1031: Type expected
Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong, especially in the face of target-typed new. A type is not necessarily expected here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In parsers it's very common to just state what the expectation is for the common case when things are missing. It's not like the otehr error message is correct either. it's acting as if we have a type (we don't, we have a missing identifier), and then saying what is missing coming after that missing identifier.

Copy link
Member

Choose a reason for hiding this comment

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

Sure. But I would prefer that we introduce a message that says something like "Type or parens expected".

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'm not opposed to that. it's just generally not something we commonly do. With missing stuff, we commonly just specify the 95% case we expect. It helps keeps teh errors relevant and not overloaded with tons of information.

I'd honestly prefer that if we do this, we do it through a "consistifying pass" that did this for all messages instead of doing it in an adhoc fashion.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not opposed to a consistifying pass. But I also think we should fix them where they're obvious

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not obvious to me that anything is wrong with this will message. I.e. I don't think it's the goal of a parse error to enumerate all potential legal follow-up tokens/nodes.

Copy link
Member

Choose a reason for hiding this comment

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

@CyrusNajmabadi, my opinion on this hasn't changed. This is a worse error message, and I do not want to take the change with it.

@333fred
Copy link
Member

333fred commented May 29, 2020

Done review pass (commit 1)

@CyrusNajmabadi CyrusNajmabadi requested a review from 333fred June 22, 2020 19:13
Copy link
Member

@333fred 333fred 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 5)

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 5). Please use squash/merge since compiler PR.

@jcouv jcouv self-assigned this Jul 14, 2020
@CyrusNajmabadi
Copy link
Contributor Author

Done, thanks :)

@CyrusNajmabadi CyrusNajmabadi merged commit fad977f into dotnet:master Jul 14, 2020
@ghost ghost added this to the Next milestone Jul 14, 2020
@JoeRobich JoeRobich modified the milestones: Next, 16.8.P1 Jul 20, 2020
@CyrusNajmabadi CyrusNajmabadi deleted the missingIdentifierError branch April 11, 2021 18:56
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.

5 participants