Skip to content

Conversation

@liufengyun
Copy link
Contributor

Fix #6048: set missing position in value class rewiring (thanks @nicolasstucki )

case _ =>
if (isMethodWithExtension(tree.symbol))
rewire(tree).ensureConforms(tree.tpe)
rewire(tree).ensureConforms(tree.tpe).withSpan(tree.span)
Copy link
Member

Choose a reason for hiding this comment

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

I would put the withSpan in the definition of rewire

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @smarter . That was what @nicolasstucki and I initially did -- but soon we find it's not the right place due to the recursive nature of rewire.

Copy link
Member

Choose a reason for hiding this comment

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

There is one branch of rewire which is not recursive (the last one), that branch should get the withSpan.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem is that we want to set the initial tree.span, instead of the tree.span from recursive calls.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue there is that the tree is the tree of the qualifier which does not have the position of the full call (it does not cover the arguments). We could pass the position as a parameter to rewire instead.

Copy link
Member

Choose a reason for hiding this comment

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

ah I see, one way to do that would be to change rewire to contain an inner method which is recursive, but I guess it's not very important since it's only used once anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or we could pass the span as an extra parameter.

@liufengyun liufengyun merged commit 0496200 into scala:master Mar 11, 2019
@liufengyun liufengyun deleted the fix-6048 branch March 11, 2019 21:52
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