From 4106e18a0f165e89d142bcf11da9eeb3e0ec2615 Mon Sep 17 00:00:00 2001 From: tgodzik Date: Thu, 13 Aug 2020 13:11:37 +0200 Subject: [PATCH] Add types to worksheet values --- build.sbt | 2 +- .../scala/tests/BaseWorksheetLspSuite.scala | 32 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index 3923c3538b4..0cba4b41ffc 100644 --- a/build.sbt +++ b/build.sbt @@ -181,7 +181,7 @@ lazy val V = new { val sbtBloop = bloop val gradleBloop = bloop val mavenBloop = bloop - val mdoc = "2.2.4" + val mdoc = "2.2.5" val scalafmt = "2.6.4" val munit = "0.7.10" // List of supported Scala versions in SemanticDB. Needs to be manually updated diff --git a/tests/unit/src/main/scala/tests/BaseWorksheetLspSuite.scala b/tests/unit/src/main/scala/tests/BaseWorksheetLspSuite.scala index 047739658f3..2122ada9610 100644 --- a/tests/unit/src/main/scala/tests/BaseWorksheetLspSuite.scala +++ b/tests/unit/src/main/scala/tests/BaseWorksheetLspSuite.scala @@ -56,8 +56,8 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiagnostics() _ = assertNoDiff( client.workspaceDecorations, - """|identity(42) // 42 - |val name = sourcecode.Name.generate.value // "name" + """|identity(42) // : Int = 42 + |val name = sourcecode.Name.generate.value // : String = "name" |""".stripMargin ) } yield () @@ -130,13 +130,12 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiagnostics() _ = assertNoDiff( client.workspaceDecorations, - """| - |import java.nio.file.Files - |val name = "Susan" // "Susan" - |val greeting = s"Hello $name" // "Hello Susan" + """|import java.nio.file.Files + |val name = "Susan" // : String = "Susan" + |val greeting = s"Hello $name" // : String = "Hello Susan" |println(greeting + "\nHow are you?") // Hello Susan… - |1.to(10).toVector // Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - |val List(a, b) = List(42, 10) // a=42, b=10 + |1.to(10).toVector // : Vector[Int] = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + |val List(a, b) = List(42, 10) // a: Int = 42, b: Int = 10 |""".stripMargin ) } yield () @@ -161,13 +160,12 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiagnostics() _ = assertNoDiff( client.workspaceDecorations, - """| - |import java.nio.file.Files - |val name = "Susan" // "Susan" - |val greeting = s"Hello $name" // "Hello Susan" + """|import java.nio.file.Files + |val name = "Susan" // : String = "Susan" + |val greeting = s"Hello $name" // : String = "Hello Susan" |println(greeting + "\nHow are you?") // Hello Susan… - |1.to(10).toVector // Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) - |val List(a, b) = List(42, 10) // a=42, b=10 + |1.to(10).toVector // : Vector[Int] = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) + |val List(a, b) = List(42, 10) // a: Int = 42, b: Int = 10 |""".stripMargin ) _ = assertNoDiff( @@ -250,7 +248,7 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiff( client.workspaceDecorations, """| - |val x = 42 // 42 + |val x = 42 // : Int = 42 |throw new RuntimeException("boom") |""".stripMargin ) @@ -358,7 +356,7 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiff( client.workspaceDecorations, """ - |a.Util.increase(1) // 2 + |a.Util.increase(1) // : Int = 2 |""".stripMargin ) _ <- server.didSave("a/src/main/scala/a/Util.scala")( @@ -368,7 +366,7 @@ abstract class BaseWorksheetLspSuite(scalaVersion: String) _ = assertNoDiff( client.workspaceDecorations, """ - |a.Util.increase(1) // 3 + |a.Util.increase(1) // : Int = 3 |""".stripMargin ) } yield ()