Type annotations make the pretty-printed tree quadratically large
See original GitHub issueclass Foo {
val x: Int = (1: @annot1 @annot2 @annot3 @annot4 @annot5)
}
class annot1 extends scala.annotation.Annotation
class annot2 extends scala.annotation.Annotation
class annot3 extends scala.annotation.Annotation
class annot4 extends scala.annotation.Annotation
class annot5 extends scala.annotation.Annotation
types the code as
result of Foo.scala after frontend:
package <empty> {
class Foo() extends Object() {
val x: Int =
1: Int(1) @annot1: Int(1) @annot1 @annot2: Int(1) @annot1 @annot2 @annot3
:
Int(1) @annot1 @annot2 @annot3 @annot4:
Int(1) @annot1 @annot2 @annot3 @annot4 @annot5
}
...
}
where we should have
val x: Int = 1: Int(1) @annot1 @annot2 @annot3 @annot4 @annot5
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
What's New In Python 3.10 — Python 3.11.1 documentation
It works around the quirks of accessing the annotations on various types of objects, and makes very few assumptions about the object it...
Read more >Type Hints in Python: What, Why, and How - YouTube
In this video I talk about annotating your functions and variables with type hints in Python and why you should do it.Need one-on-one...
Read more >Type Annotations in Python 3.8 - Medium
One reason why Python is so easy to get started with is that it has dynamic types. You don't have to specify the...
Read more >pretty :: Stackage Server
Pretty : A Haskell Pretty-printer library. Hackage Dependencies · BSD3 License · Build. Pretty is a pretty-printing library, a set of API's that...
Read more >Python Programming Examples - Javatpoint
Python Programs or Python Programming Examples for beginners and professionals with programs on basics, controls, loops, functions, native data types etc.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We should still fix the printer
You could add a test to
dotty.tools.dotc.printing.PrinterTests