Skip to content

Fixes to transparent functions #4881

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

Merged
merged 5 commits into from
Aug 7, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 31, 2018

The end-goal is to have a nice implementation of tuples/hlists. A start is in Tuple.scala. This stresses transparent handling in interesting ways.

@odersky odersky force-pushed the fix-transparent-1 branch from 90707d5 to 9abda15 Compare July 31, 2018 17:05
@odersky odersky requested a review from nicolasstucki July 31, 2018 18:00
Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

case Some(x) => x > 1 || x == 1 && !boundSym.is(Method)
case none => true
}
} && !boundSym.is(TransparentImplicitMethod)
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be clearer and more performant if the conditions are inverted

!boundSym.is(TransparentImplicitMethod) &&
refCount.get(boundSym) match {
  ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I doubt the "more performant part" since the test isboundSym.is(TransparentImplicitMethod) is ~99% likely to succeed. So it's better to put the test first that prunes more cases.

odersky added 5 commits August 7, 2018 11:37
When adding implicit bindings to an implicit context of an inline
body, we need to maintain the transparency of the implicits.

The added implicit bindings are eliminated after inlining,
since they are either unused or have been inlined.
If the result of reducing a projection has local bindings,
these bindings need to be copied.

Test case in run/Tuple.scala
Can't lift bindings from arguments as this might change evaluation
order and it also does not work for cbn parameters.

Also, fix stray printing
@odersky odersky force-pushed the fix-transparent-1 branch 5 times, most recently from 4b83e2e to 8b941d6 Compare August 7, 2018 11:18
@odersky
Copy link
Contributor Author

odersky commented Aug 7, 2018

I have put previously pushed subsequent commits in a separate PR, so that we can merge what was already approved.

@nicolasstucki nicolasstucki merged commit 416d85c into scala:master Aug 7, 2018
@Blaisorblade Blaisorblade deleted the fix-transparent-1 branch August 7, 2018 12:17
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