-
Notifications
You must be signed in to change notification settings - Fork 1.1k
REPL: do not dealias before printing types #3566
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
Conversation
471711c
to
4daf3a0
Compare
scala> Seq('a','b') | ||
val res2: Seq[Char] = List(a, b) | ||
scala> Set(4, 5) | ||
val res6: Set[Int] = Set(4, 5) |
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.
Should be res3
5968d96
to
0c13af0
Compare
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 looks good.
@@ -357,9 +357,16 @@ class Definitions { | |||
def newGenericArrayMethod(implicit ctx: Context) = DottyArraysModule.requiredMethod("newGenericArray") | |||
def newArrayMethod(implicit ctx: Context) = DottyArraysModule.requiredMethod("newArray") | |||
|
|||
lazy val ListType = ctx.requiredClassRef("scala.collection.immutable.List") | |||
def ListClass = ListType.symbol.asClass |
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.
This looks wrong. Don't we need to pass a context to ListClass
, like we do everywhere else? (same for the other new definitions)
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.
Indeed, fixed.
@@ -147,7 +152,12 @@ class PlainPrinter(_ctx: Context) extends Printer { | |||
case tp: TermRef if tp.denot.isOverloaded => | |||
"<overloaded " ~ toTextRef(tp) ~ ">" | |||
case tp: TypeRef => | |||
toTextPrefix(tp.prefix) ~ selectionString(tp) | |||
printWithoutPrefix.find(sym => tp.isDirectRef(sym)) 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.
I would prefer not to hard-code these. Can't we instead check when printing whether a class has an alias in Predef
or scala
with the same name?
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.
Possibly, but that would be more expensive and may require forcing things.
db6d057
to
18c55d3
Compare
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3566/ to see the changes. Benchmarks is based on merging with master (d929fc9) |
Also simplify the mechanism used to avoid printing prefixes. This is now handled in the PlainPrinter and limited to List, Map, Set, Seq.
…la.Predef In the previous commit, this was limited to a hardcoded subset of these types.
18c55d3
to
f1f3558
Compare
Also simplify the mechanism used to avoid printing prefixes. This is now
handled in the PlainPrinter and limited to List, Map, Set, Seq.