-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3932: ANSI color leak in repl #4462
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
85cc876
to
a73199c
Compare
I believe the REPL had its syntax highlighting mechanism before we introduced colors in Printer. I think a better fix is to make the REPL only relies on the mechanism from the Printers (i.e. replace call to |
Unless we want to stop highlighting code "as it's been written", we won't be able to get ride of the REPL syntax highlighting. Given thaz we have two syntax highlighters, it's not clear to me what we would gain by using the one from RefinedPrinter over the REPL one. |
The syntax highlighter from the printers is supposed to be more fined grained (it knows the semantic of what it is printing) and is also configurable (using the compiler options). The issue in #3932 is because we are currently calling You are right for code "as it's been written", we have to keep using |
Side-note: we could use the regular Parser to handle this String. Our parser is supposed to recover from errors (needed for the IDE to work well), so it could also work for syntax highlighting as you type in the REPL. |
@@ -0,0 +1,2 @@ | |||
scala> def f(erased a: Int): Int = ??? | |||
def f(erased a: Int): Int |
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.
Add a test case for erased implicit
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.
Done!
@@ -169,7 +169,9 @@ class PlainPrinter(_ctx: Context) extends Printer { | |||
"<noprefix>" | |||
case tp: MethodType => | |||
changePrec(GlobalPrec) { | |||
(if (tp.isImplicitMethod) "(implicit " else "(") ~ paramsText(tp) ~ | |||
("(" + (if (tp.isImplicitMethod) "implicit " else "") | |||
+ (if (tp.isErasedMethod) "erased " else "") |
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.
Print erased
first. erased implicit
seems to be better than implicit erased
based on the feedback I have received in the past.
a73199c
to
da0b6ba
Compare
@OlivierBlanvillain is this still a WIP? |
It's good to go! |
No description provided.