-
Notifications
You must be signed in to change notification settings - Fork 847
SyntaxTree: always keep parsed implicit constructors #10967
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -702,7 +702,7 @@ module InterfaceStubGenerator = | |
| | SynModuleDecl.Open _ -> | ||
| None | ||
|
|
||
| and walkSynTypeDefn(TypeDefn(_componentInfo, representation, members, range)) = | ||
| and walkSynTypeDefn(TypeDefn(_componentInfo, representation, members, _, range)) = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should walk the implicit ctor if it's there |
||
| if not <| rangeContainsPos range pos then | ||
| None | ||
| else | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ module NavigationImpl = | |
| let nested = processMembers membDefns FSharpEnclosingEntityKind.Exception |> snd | ||
| processExnDefnRepr baseName nested repr | ||
|
|
||
| and processTycon baseName (TypeDefn(ComponentInfo(_, _, _, lid, _, _, access, _), repr, membDefns, m)) = | ||
| and processTycon baseName (TypeDefn(ComponentInfo(_, _, _, lid, _, _, access, _), repr, membDefns, _, m)) = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should walk the implicit ctor if it's there? |
||
| let topMembers = processMembers membDefns FSharpEnclosingEntityKind.Class |> snd | ||
| match repr with | ||
| | SynTypeDefnRepr.Exception repr -> processExnDefnRepr baseName [] repr | ||
|
|
@@ -686,7 +686,7 @@ module NavigateTo = | |
| | SynModuleDecl.HashDirective _ | ||
| | SynModuleDecl.Open _ -> () | ||
|
|
||
| and walkSynTypeDefn(TypeDefn(componentInfo, representation, members, _)) container = | ||
| and walkSynTypeDefn(TypeDefn(componentInfo, representation, members, _, _)) container = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should walk the implicit ctor if it's there |
||
| let container = addComponentInfo ContainerType.Type NavigableItemKind.Type componentInfo false container | ||
| walkSynTypeDefnRepr representation container | ||
| for m in members do | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -600,7 +600,7 @@ type FSharpParseFileResults(errors: FSharpDiagnostic[], input: ParsedInput optio | |
| yield! walkExpr true e ] | ||
|
|
||
| // Process a class declaration or F# type declaration | ||
| let rec walkTycon (TypeDefn(ComponentInfo(_, _, _, _, _, _, _, _), repr, membDefns, m)) = | ||
| let rec walkTycon (TypeDefn(ComponentInfo(_, _, _, _, _, _, _, _), repr, membDefns, _, m)) = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should walk the implicit ctor if it's there
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I expect it to walk in it for object model types if it already does (via repr members), this behaviour hasn't changed. Do you mean it should walk in it for types that don't allow implicit constructors too? This PR only adds possibly thrown out constructors back, so it's possible to inspect them via syntax tree inside non-object model types too (via a separate field that is ignored by the type checker). |
||
| if not (isMatchRange m) then [] else | ||
| [ for memb in membDefns do yield! walkMember memb | ||
| match repr with | ||
|
|
@@ -1236,7 +1236,7 @@ module UntypedParseImpl = | |
| | SynTypeDefnSigRepr.Simple(defn, _) -> walkTypeDefnSimple defn | ||
| | SynTypeDefnSigRepr.Exception(_) -> None | ||
|
|
||
| and walkTypeDefn (TypeDefn (info, repr, members, _)) = | ||
| and walkTypeDefn (TypeDefn (info, repr, members, _, _)) = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should walk the implicit ctor if it's there |
||
| walkComponentInfo false info | ||
| |> Option.orElse (walkTypeDefnRepr repr) | ||
| |> Option.orElse (List.tryPick walkMember members) | ||
|
|
@@ -1489,7 +1489,7 @@ module UntypedParseImpl = | |
| let contextFromTreePath completionPath = | ||
| // detect records usage in constructor | ||
| match path with | ||
| | TS.Expr(_) :: TS.Binding(_) :: TS.MemberDefn(_) :: TS.TypeDefn(SynTypeDefn.TypeDefn(ComponentInfo(_, _, _, [id], _, _, _, _), _, _, _)) :: _ -> | ||
| | TS.Expr(_) :: TS.Binding(_) :: TS.MemberDefn(_) :: TS.TypeDefn(SynTypeDefn.TypeDefn(ComponentInfo(_, _, _, [id], _, _, _, _), _, _, _, _)) :: _ -> | ||
| RecordContext.Constructor(id.idText) | ||
| | _ -> RecordContext.New completionPath | ||
| match field with | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should walk the implicit ctor if it's there