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

Name resolution: resolve interfaces in expressions #15660

Merged
merged 9 commits into from
Dec 19, 2023

Conversation

auduchinok
Copy link
Member

Here's an experiment to see what breaks in CI.

@auduchinok auduchinok requested a review from a team as a code owner July 21, 2023 14:59
@auduchinok auduchinok changed the title Name resolution symbols interface2 Name resolution: experiment with resolving interfaces in expressions Jul 21, 2023
@T-Gro
Copy link
Member

T-Gro commented Jul 27, 2023

Is this still an experiment, or ready for review?

I have a feeling that the typecheck error reported now is worse from understandability points of view => I would need convincing that the tradeoff is worth it.

@auduchinok
Copy link
Member Author

auduchinok commented Jul 27, 2023

@T-Gro This is currently still an experiment. I'm currently on vacation and going to get back to it afterwards.

The general idea here is to provide symbols (with the type arguments where possible) and have better errors for unfinished expressions like:

// module/class/record/union
List
List.

// interface
IList
IList<_>
IList<int>

Currently no symbols are provided and the errors are misleading. This experiment already improves things for some of these cases, but needs further work.

The change in the tests is mostly about quite a corner case related to incorrect type definitions, and the previous error about constructors is also misleading. I'm going to look into improving it; maybe I'll just try to reuse this error.

@0101 0101 marked this pull request as draft July 31, 2023 17:11
@auduchinok
Copy link
Member Author

auduchinok commented Dec 10, 2023

I have a feeling that the typecheck error reported now is worse from understandability points of view => I would need convincing that the tradeoff is worth it.

@T-Gro I think they're actually better. The most of the updated baselines capture cases where there's a type that can't be instantiated properly due to an issue in its declaration, and previous errors would say that the types are undefined (which is not true and is misleading) while the newer errors say that the types are used in a wrong way, which is probably good enough considering that a fix is needed on the declaration side, and there's an appropriate error reported for the declaration.

@auduchinok auduchinok force-pushed the nameResolution-symbols-interface2 branch from 33e4b4d to 51f31c8 Compare December 10, 2023 08:25
@auduchinok auduchinok changed the title Name resolution: experiment with resolving interfaces in expressions Name resolution: resolve interfaces in expressions Dec 11, 2023
@auduchinok auduchinok marked this pull request as ready for review December 11, 2023 21:18
@auduchinok
Copy link
Member Author

auduchinok commented Dec 11, 2023

This is ready. It changes the way how wrong usages of interfaces are encoded in name resolution items, but it looks good and makes interface items more inline with rest of the types by removing the special case.

Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Mhm I guess the resulting message could be clearer but IMO the new way it is not worse than what used to be. Okay with me.

@psfinaki
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@psfinaki
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@psfinaki
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@psfinaki
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@auduchinok auduchinok force-pushed the nameResolution-symbols-interface2 branch from 3d596c8 to b96fa07 Compare December 19, 2023 19:05
@auduchinok
Copy link
Member Author

This is green now.

@psfinaki psfinaki merged commit 1df1433 into dotnet:main Dec 19, 2023
OwnageIsMagic added a commit to OwnageIsMagic/fsharp that referenced this pull request Dec 21, 2023
* upstream/main: (166 commits)
  typo in foldBack summary (dotnet#16453)
  Fix for dotnet#83 (improve constraint error message) (dotnet#16304)
  Name resolution: resolve interfaces in expressions (dotnet#15660)
  AddExplicitReturnType refactoring (dotnet#16077)
  Disabling 2 tests: running for too long, causing CI timeouts
  Improve value restriction error message dotnet#1103 (dotnet#15877)
  Parens: Keep parens for non-identical infix operator pairs with same precedence (dotnet#16372)
  More release note entries (dotnet#16438)
  Using Ordinal is both faster and more correct as our intent is to do … (dotnet#16439)
  merge (dotnet#16427)
  Optimize empty string compares (dotnet#16435)
  Checker: recover on unresolved type in 'inherit' member (dotnet#16429)
  Release notes proposal (dotnet#16377)
  [main] Update dependencies from dotnet/source-build-reference-packages (dotnet#16411)
  Allow usage of [<TailCall>] with older FSharp.Core package versions (dotnet#16373)
  Parser: recover on unfinished 'as' patterns (dotnet#16404)
  Parens: Keep parens in method calls in dot-lambdas (dotnet#16395)
  Checker: check unfinished obj expression inside computations (dotnet#16413)
  Added default dotnet-tools + additional tasks to launch them (dotnet#16409)
  make `remarks` and `returns` visible in quick info (dotnet#16417)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants