-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Pretty-printing precedence issue #4068
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
Labels
Comments
Blaisorblade
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 5, 2018
WIP. I consider this a hack, though I haven't found the adequate test to show it. Fix scala#4068.
Blaisorblade
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 30, 2018
WIP. I consider this a hack, though I haven't found the adequate test to show it. Fix scala#4068.
Blaisorblade
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 30, 2018
Fix scala#4068 in a hacky way.
Blaisorblade
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 30, 2018
`argText` will never add parentheses around its output, which makes sense for arguments of type constructors: if we're printing `Foo[T1, T2]` we never need parens around `T1` or `T2`, whatever its root operator. But that's inappropriate for a function type `T1 => T2`; the code in `toTextFunction` attempted to use `atPrec(InfixPrec)` to correct for that, but that didn't work, because `argText` called `atPrec(GlobalPrec)` right away, hence we ended up running `atPrec(InfixPrec) { atPrec(GlobalPrec) { ... }}`, which means just `atPrec(GlobalPrec) { ... }`.
Blaisorblade
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 9, 2018
Using `atPrec(GlobalPrec)` ensures that `argText(args.head)` never adds parentheses around its output, but that's inappropriate for a function type `T1 => T2`. The nested calls to `atPrec` make no sense, but `argText` hid that before it was refactored.
Jasper-M
referenced
this issue
in Jasper-M/dotty
Sep 27, 2018
Pretty-printing: handle type-operator precedence correctly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type
(Int => Any) => List[Any]
is shown without the parens:while parens are omitted correctly here:
that is, the pretty-printer misses associativity of
=>
.The text was updated successfully, but these errors were encountered: