Skip to content

Conversation

@auduchinok
Copy link
Member

Keeps parsed implicit constructors for types that are not allowed to have them in the syntax tree.

@auduchinok auduchinok changed the title Keep parsed implicit constructor in SynTypeDefn Always keep parsed implicit constructor in SynTypeDefn Jan 28, 2021
@auduchinok auduchinok changed the title Always keep parsed implicit constructor in SynTypeDefn SyntaxTree: always keep parsed implicit constructors Jan 28, 2021
@auduchinok
Copy link
Member Author

It's ready.

@cartermp
Copy link
Contributor

Thanks!

@cartermp cartermp merged commit 494bc60 into dotnet:main Jan 29, 2021

// Process a class declaration or F# type declaration
let rec walkTycon (TypeDefn(ComponentInfo(_, _, _, _, _, _, _, _), repr, membDefns, m)) =
let rec walkTycon (TypeDefn(ComponentInfo(_, _, _, _, _, _, _, _), repr, membDefns, _, m)) =
Copy link
Contributor

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

Copy link
Member Author

@auduchinok auduchinok Jan 29, 2021

Choose a reason for hiding this comment

The 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).

| SynTypeDefnSigRepr.Exception(_) -> None

and walkTypeDefn (TypeDefn (info, repr, members, _)) =
and walkTypeDefn (TypeDefn (info, repr, members, _, _)) =
Copy link
Contributor

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

processExnDefnRepr baseName nested repr

and processTycon baseName (TypeDefn(ComponentInfo(_, _, _, lid, _, _, access, _), repr, membDefns, m)) =
and processTycon baseName (TypeDefn(ComponentInfo(_, _, _, lid, _, _, access, _), repr, membDefns, _, m)) =
Copy link
Contributor

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?

| SynModuleDecl.Open _ -> ()

and walkSynTypeDefn(TypeDefn(componentInfo, representation, members, _)) container =
and walkSynTypeDefn(TypeDefn(componentInfo, representation, members, _, _)) container =
Copy link
Contributor

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

None

and walkSynTypeDefn(TypeDefn(_componentInfo, representation, members, range)) =
and walkSynTypeDefn(TypeDefn(_componentInfo, representation, members, _, range)) =
Copy link
Contributor

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

| SynTypeDefnSigRepr.Exception _ -> ()

and walkTypeDefn (TypeDefn (info, repr, members, _)) =
and walkTypeDefn (TypeDefn (info, repr, members, _, _)) =
Copy link
Contributor

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

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.

3 participants