Skip to content

Restructure NameResolution and fix bug around global#4471

Merged
KevinRansom merged 1 commit intodotnet:masterfrom
forki:restructure
Mar 14, 2018
Merged

Restructure NameResolution and fix bug around global#4471
KevinRansom merged 1 commit intodotnet:masterfrom
forki:restructure

Conversation

@forki
Copy link
Copy Markdown
Contributor

@forki forki commented Mar 8, 2018

  • This restructures Name Resolution a bit in order to reduce pattern matching on the same identifiers.
  • It also removes a couple of InternalErrors by using better typed functions
  • It also reduces string comparisons with demangled
  • It fixes issues with global modifier like:

image

Also I'm obsessed with NameRes

@forki forki changed the title Restructure NameResolution [WIP] Restructure NameResolution Mar 8, 2018
@forki forki force-pushed the restructure branch 10 times, most recently from c23ec2b to 1104d14 Compare March 9, 2018 09:11
Comment thread src/fsharp/TypeChecker.fs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good, no need to map when longId is empty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep

Comment thread src/fsharp/TypeChecker.fs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These look good short-circuiting on empty, I wonder if a empty check on modrefs would improve the other side.

Comment thread src/fsharp/TypeChecker.fs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good moving eAccessRights where needed

Comment thread src/fsharp/NameResolution.fsi Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does the introduced bool represent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's the new first parameter - needed to exclude the global after dot bug

Comment thread src/fsharp/NameResolution.fs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So this eventuality never arrises now as an id is always passed

Comment thread src/fsharp/NameResolution.fs Outdated
Copy link
Copy Markdown
Contributor

@7sharp9 7sharp9 Mar 9, 2018

Choose a reason for hiding this comment

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

I wonder if splitting the id/rest will allow new code paths to be ran that were not before? Thinking about it logically the id should always be present and what your are doing is removing unrepresentable state.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes we move that decision to outer scope. and don't check over and over again in rec functions

@dsyme
Copy link
Copy Markdown
Contributor

dsyme commented Mar 9, 2018

@forki Does profiling show that the pattern matching in the name resolution code is a hot spot? Just wondering what's behind this :)

@forki
Copy link
Copy Markdown
Contributor Author

forki commented Mar 9, 2018

@dsyme the additional pattern matching is mostly just null cheks. I don't think that perf is gained here (maybe a very very small bit by reducing string comparison). But I'm trying to reduce InternalError cases and fix bugs as shown in the description above.

@forki forki force-pushed the restructure branch 3 times, most recently from e831a89 to 3f823eb Compare March 9, 2018 14:01
@forki forki changed the title [WIP] Restructure NameResolution Restructure NameResolution and fix bug around global Mar 9, 2018
@forki
Copy link
Copy Markdown
Contributor Author

forki commented Mar 9, 2018

ready for review

Copy link
Copy Markdown
Contributor

@dsyme dsyme left a comment

Choose a reason for hiding this comment

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

There is lots of nice cleanup here, thanks

@KevinRansom KevinRansom merged commit 6453d1b into dotnet:master Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants