REPL breaks when complicated type is inferred
See original GitHub issueI was trying to investigate something about how dotty infers types that scalac infers as existential “forSome” types. Alas the REPL only shows me an error that seems to come from the code generation phase of the REPL itself.
scala>
object foo {
trait ShapeLevel
trait FlatShapeLevel extends ShapeLevel
trait ColumnsShapeLevel extends FlatShapeLevel
abstract class Shape[Level <: ShapeLevel, -Mixed, Unpacked, Packed]
object Shape extends TupleShapeImplicits { }
trait TupleShapeImplicits {
implicit final def tuple2Shape[Level <: ShapeLevel, M1,M2, U1,U2, P1,P2](implicit u1: Shape[_ <: Level, M1, U1, P1], u2: Shape[_ <: Level, M2, U2, P2]): Shape[Level, (M1,M2), (U1,U2), (P1,P2)] = ???
}
}
defined module foo
scala> import foo._
import foo._
scala> implicit val shape: Shape[_ <: FlatShapeLevel, Int, Int, _] = null
val shape: foo.Shape[_ <: foo.FlatShapeLevel, Int, Int, _] = null
scala> def hint = Shape.tuple2Shape(shape, shape)
-- Error: <console>:4:4 --------------------------------------------------------
4 |(""+"def hint: foo.Shape[foo.FlatShapeLevel, (Int, Int), (Int, Int), (shape.Packed,
| ^
| unclosed string literal
-- [E039] Syntax Error: <console>:6:1 ------------------------------------------
6 |)]\n"
| ^
| ';' expected, but `Packed` found
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Oh that nice! - Replit
This is not a dynamically typed language, but the type is inferred. That means that Rust understood x should be an integer.
Read more >Noughts & Crosses Game in 69 lines of Python code - Replit
If the while loop doesn't encounter a break on its way, it means that the 9 moves are made, yet no one won,...
Read more >Error when creating new React Typescript project - Replit
Property 'a' must be of type 'DetailedHTMLProps ', but here has type 'DetailedHTMLProps '. I have changed nothing in the ... Cannot infer...
Read more >@laksh5teach https://repl.it... - Replit
This tutorial is fairly simple, with some complex concepts to it. ... Cannot infer image mime type ... If not, it breaks the...
Read more >Types and readability
Then, so long as it's not too complicated, it might be able to work out the type for me. I can run the...
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
Thanks for reporting @Jasper-M! We will shortly be reimplementing the REPL from scratch. Hopefully, this won’t rear its ugly head in the new shiny version! 😃
See #3020, there was still an issue with how the types were printed.