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

Add entity.DeclaringEntity to F# Compiler Service #4633

Merged
merged 7 commits into from
Mar 28, 2018
Merged

Conversation

dsyme
Copy link
Contributor

@dsyme dsyme commented Mar 27, 2018

Implements FCS feature request fsharp/fsharp-compiler-docs#830

This has been requested by @vasily-kirichenko (Visual F# Tools), @auduchinok (Jet Brains Rider) and @nosami (VS for Mac/F# Roslyn bridge)

Feature description

There are many situations where users of FCS symbols require a DeclaringEntity property on an FSharpEntity, e.g. for modules, or types, nested in other modules or types.

This implements this. The implementation requires plumbing through the "partially inferred assembly contents", which stem from CompileOps.fs.

PR Notes

I've renamed a number of things along the way as I needed to do it to understand/clarify/document some of this old code, e.g.

  • cenv --> SymbolEnv in Symbols.fs
  • Clean up the mess with WithNoShortPrimaryAssembly in il.fs/il.fsi. We never need this version of things
  • Cleanup TypeCheckOneInputEventually to pass the partial inferred assembly contents back directly, and thus reduce the number of tcs tracking fields by one
  • Move a bit of code around in Symbols.fs

@dsyme dsyme changed the title Add entity.DeclaringEntity to F# Cmopiler Service Add entity.DeclaringEntity to F# Compiler Service Mar 27, 2018
@nosami
Copy link
Contributor

nosami commented Mar 28, 2018

This is great - more than I was hoping for! I can go from entity to parent entity or parent namespace, and get nested entities for namespaces.

@@ -4386,9 +4386,10 @@ and SlotParam =
member x.Type = let (TSlotParam(_,ty,_,_,_,_)) = x in ty

/// A type for a module-or-namespace-fragment and the actual definition of the module-or-namespace-fragment
/// The first ModuleOrNamespaceType is the signature and is a binder. However the bindings are not used in the ModuleOrNamespaceExpr: it is only referenced from the 'outside'
// is for use by FCS only to report the "hidden" contents of the assembly prior to applying the signature.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - missing /

@dsyme dsyme merged commit ff078e9 into dotnet:master Mar 28, 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.

2 participants