forked from scala/scala
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#5640 from optimizely/repl-import-handler
SI-9881 Fix ImportHandler's reporting of importedNames and importedSymbols
- Loading branch information
Showing
7 changed files
with
131 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
scala> // import in various ways | ||
|
||
scala> import java.util.Date | ||
import java.util.Date | ||
|
||
scala> import scala.util._ | ||
import scala.util._ | ||
|
||
scala> import scala.reflect.runtime.{universe => ru} | ||
import scala.reflect.runtime.{universe=>ru} | ||
|
||
scala> import ru.TypeTag | ||
import ru.TypeTag | ||
|
||
scala> | ||
|
||
scala> // show the imports | ||
|
||
scala> :imports | ||
1) import java.lang._ (...) | ||
2) import scala._ (...) | ||
3) import scala.Predef._ (...) | ||
4) import java.util.Date (...) | ||
5) import scala.util._ (...) | ||
6) import scala.reflect.runtime.{universe=>ru} (...) | ||
7) import ru.TypeTag (...) | ||
|
||
scala> | ||
|
||
scala> // should be able to define this class with the imports above | ||
|
||
scala> class C[T](date: Date, rand: Random, typeTag: TypeTag[T]) | ||
defined class C | ||
|
||
scala> :quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import scala.tools.partest.ReplTest | ||
import scala.tools.nsc.Settings | ||
|
||
object Test extends ReplTest { | ||
|
||
override def transformSettings(s: Settings): Settings = { | ||
s.Yreplclassbased.value = true | ||
s | ||
} | ||
|
||
lazy val normalizeRegex = """(import\s.*)\(.*\)""".r | ||
|
||
override def normalize(s: String): String = normalizeRegex.replaceFirstIn(s, "$1(...)") | ||
|
||
def code = | ||
""" | ||
|// import in various ways | ||
|import java.util.Date | ||
|import scala.util._ | ||
|import scala.reflect.runtime.{universe => ru} | ||
|import ru.TypeTag | ||
| | ||
|// show the imports | ||
|:imports | ||
| | ||
|// should be able to define this class with the imports above | ||
|class C[T](date: Date, rand: Random, typeTag: TypeTag[T]) | ||
""".stripMargin | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters