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 symbol creation for an operator with a constraint #6307

Merged
merged 1 commit into from
Mar 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/fsharp/symbols/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ type FSharpSymbol(cenv: SymbolEnv, item: (unit -> Item), access: (FSharpSymbol -
| Item.ArgName(id, ty, _) ->
FSharpParameter(cenv, ty, {Attribs=[]; Name=Some id}, Some id.idRange, isParamArrayArg=false, isInArg=false, isOutArg=false, isOptionalArg=false) :> _

| Item.ImplicitOp(_, { contents = Some(TraitConstraintSln.FSMethSln(_, vref, _)) }) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good fix, though we should also cover the case where the solution is a .NET Method or an F# record field (the other possibliies for TestConstraintSln)

@7sharp9 Would you be able to submit a new PR for those cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dsyme , yeah I can add the others too.
Testing these is really tough though as Ive only been able to replicate the issue within Falanx referencing a Fleece operator, which references FSharpPlus operator. i.e.No simple minimal repo. There may be other symbols that we could surface too...

Copy link
Contributor Author

@7sharp9 7sharp9 Mar 10, 2019

Choose a reason for hiding this comment

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

Incidentally @dsyme Do you know why ItemWithInst.TyparInst is always empty for custom operators?

https://github.com/Microsoft/visualfsharp/blob/a26d32a86c88f4ae61a77bfe5c764cb0ea8cec8b/src/fsharp/NameResolution.fsi#L133

Copy link
Contributor

Choose a reason for hiding this comment

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

Custom operators (in computation expressions) or implicit operators?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implicit operators, they seem to match always get created with ItemWithNoInst

FSharpMemberOrFunctionOrValue(cenv, V vref, item) :> _

// TODO: the following don't currently return any interesting subtype
| Item.ImplicitOp _
| Item.ILField _
Expand Down