-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cleanup code in DynamicTuple #8326
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
Cleanup code in DynamicTuple #8326
Conversation
Note that classes in |
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
* Remove dead code * Remove uses of scala.Tuple.* match types * Remove `dynamic` prefix from methods in `DynamicTuple`
2e05728
to
9aca3a3
Compare
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/8326/ to see the changes. Benchmarks is based on merging with master (b4e037c) |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/8326/ to see the changes. Benchmarks is based on merging with master (068c09c) |
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.
Otherwise, LGTM
else tree | ||
|
||
private def transformTupleCons(tree: tpd.Apply)(implicit ctx: Context): Tree = { | ||
val head :: tail :: Nil = tree.args | ||
defn.tupleTypes(tree.tpe) match { | ||
defn.tupleTypes(tree.tpe.widenTermRefExpr.dealias) match { |
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.
Maybe move .dealias
before . widenTermRefExpr
? Can we just use widen
instead of widenTermRefExpr
?
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.
No, the alias appears after the widening of the term ref. I did not find a case where we needed to completely widen the type. For the case of indices and sizes, this might widen the constant typea.
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.
We only widen the term refs that come from inserting val bindings when inlining.
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.
We could mark the parameters an inline to avoid it. But I will remove the inline altogether in a future PR as it does not really have a purpose anymore.
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.
For the case of indices and sizes, this might widen the constant type.
The type is a tuple type, it thus may not be constant types.
For dealiasing, what I've in mind is type T = a.type
. But I guess no programmers will write such code, so it's fine to ignore such cases.
dynamic
prefix from methods inDynamicTuple