Skip to content

Commit af80b4e

Browse files
committed
Remove more .nn
1 parent c1ed612 commit af80b4e

File tree

15 files changed

+24
-28
lines changed

15 files changed

+24
-28
lines changed

compiler/src/dotty/tools/dotc/core/NameOps.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object NameOps {
4545
val cs = s.toArray
4646
val bytes = Codec.toUTF8(CharBuffer.wrap(cs).nn)
4747
md5.update(bytes)
48-
val md5chars = md5.digest().nn.map(b => (b & 0xFF).toHexString).mkString
48+
val md5chars = md5.digest().map(b => (b & 0xFF).toHexString).mkString
4949

5050
prefix + marker + md5chars + marker + suffix
5151
}

compiler/src/dotty/tools/dotc/core/Names.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ object Names {
404404
* from GenBCode or it also contains one of the whitelisted methods below.
405405
*/
406406
private def toStringOK = {
407-
val trace: Array[StackTraceElement] = Thread.currentThread.nn.getStackTrace.asInstanceOf[Array[StackTraceElement]]
408-
!trace.exists(_.getClassName.nn.endsWith("GenBCode")) ||
407+
val trace: Array[StackTraceElement] = Thread.currentThread.getStackTrace.asInstanceOf[Array[StackTraceElement]]
408+
!trace.exists(_.getClassName.endsWith("GenBCode")) ||
409409
trace.exists(elem =>
410410
List(
411411
"mangledString",

compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ object JavaScanners {
666666
val limit: Double =
667667
if (token == DOUBLELIT) Double.MaxValue else Float.MaxValue
668668
try {
669-
val value: Double = java.lang.Double.valueOf(strVal.toString).nn.doubleValue()
669+
val value: Double = java.lang.Double.valueOf(strVal.toString).doubleValue()
670670
if (value > limit)
671671
error(em"floating point number too large")
672672
if (negated) -value else value

compiler/src/dotty/tools/dotc/report.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ object report:
8484
def bestEffortError(ex: Throwable, msg: String)(using Context): Unit =
8585
val stackTrace =
8686
Option(ex.getStackTrace()).map { st =>
87-
if st.nn.isEmpty then ""
88-
else s"Stack trace: \n ${st.nn.mkString("\n ")}".stripMargin
87+
if st.isEmpty then ""
88+
else s"Stack trace: \n ${st.mkString("\n ")}".stripMargin
8989
}.getOrElse("")
9090
// Build tools and dotty's test framework may check precisely for
9191
// "Unsuccessful best-effort compilation." error text.

compiler/src/dotty/tools/dotc/transform/InstrumentCoverage.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer:
5656

5757
if !newlyCreated then
5858
// If the directory existed before, let's clean it up.
59-
dataDir.listFiles.nn
60-
.filter(_.nn.getName.nn.startsWith("scoverage"))
61-
.foreach(_.nn.delete())
59+
dataDir.listFiles
60+
.filter(_.getName.startsWith("scoverage"))
61+
.foreach(_.delete())
6262
end if
6363

6464
coverageExcludeClasslikePatterns = ctx.settings.coverageExcludeClasslikes.value.map(_.r.pattern)
@@ -71,13 +71,13 @@ class InstrumentCoverage extends MacroTransform with IdentityDenotTransformer:
7171
private def isClassIncluded(sym: Symbol)(using Context): Boolean =
7272
val fqn = sym.fullName.toText(ctx.printerFn(ctx)).show
7373
coverageExcludeClasslikePatterns.isEmpty || !coverageExcludeClasslikePatterns.exists(
74-
_.matcher(fqn).nn.matches
74+
_.matcher(fqn).matches
7575
)
7676

7777
private def isFileIncluded(file: SourceFile)(using Context): Boolean =
7878
val normalizedPath = file.path.replace(".scala", "")
7979
coverageExcludeFilePatterns.isEmpty || !coverageExcludeFilePatterns.exists(
80-
_.matcher(normalizedPath).nn.matches
80+
_.matcher(normalizedPath).matches
8181
)
8282

8383
override protected def newTransformer(using Context) =

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ object TreeChecker {
860860
val stack =
861861
if !ctx.settings.Ydebug.value then "\nstacktrace available when compiling with `-Ydebug`"
862862
else if err.getStackTrace == null then " no stacktrace"
863-
else err.getStackTrace.nn.mkString(" ", " \n", "")
863+
else err.getStackTrace.mkString(" ", " \n", "")
864864

865865
report.error(
866866
em"""Malformed tree was found while expanding macro with -Xcheck-macros.

compiler/src/dotty/tools/dotc/util/ParsedComment.scala

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package dotty.tools.dotc.util
22

3-
import scala.language.unsafeNulls
4-
53
import dotty.tools.dotc.core.Comments.{Comment, docCtx}
64
import dotty.tools.dotc.core.Contexts.*
75
import dotty.tools.dotc.core.Names.TermName

compiler/src/dotty/tools/io/File.scala

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package dotty.tools.io
1010

11-
import scala.language.unsafeNulls
12-
1311
import java.io.{File => JavaIoFile, _}
1412
import java.nio.file.{Files, Paths}
1513
import java.nio.file.StandardOpenOption.*

compiler/src/dotty/tools/io/FileWriters.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object FileWriters {
6666
def warning(message: Context ?=> Message): Unit = warning(message, NoSourcePosition)
6767
final def exception(reason: Context ?=> Message, throwable: Throwable): Unit =
6868
error({
69-
val trace = throwable.getStackTrace().nn.mkString("\n ")
69+
val trace = throwable.getStackTrace().mkString("\n ")
7070
em"An unhandled exception was thrown in the compiler while\n ${reason.message}.\n${throwable}\n $trace"
7171
}, NoSourcePosition)
7272
}

compiler/test-coursier/dotty/tools/coursier/CoursierScalaTests.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ object CoursierScalaTests:
159159

160160
def csScalaCmd(options: String*): List[String] =
161161
csScalaCmdWithStdin(options, None)
162-
162+
163163
def csScalaCmdWithStdin(options: Seq[String], stdin: Option[String]): List[String] =
164164
csCmd("dotty.tools.MainGenericRunner", options, stdin)
165165

compiler/test/dotty/tools/dotc/transform/PatmatExhaustivityTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PatmatExhaustivityTest {
3535
e.printStackTrace(printWriter)
3636
}
3737

38-
stringBuffer.toString.trim.nn.replaceAll("\\s+\n", "\n") match {
38+
stringBuffer.toString.trim.replaceAll("\\s+\n", "\n") match {
3939
case "" => Nil
4040
case s => s.linesIterator.toSeq
4141
}

library/src/scala/runtime/LazyVals.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object LazyVals {
2626
}
2727

2828
private val base: Int = {
29-
val processors = java.lang.Runtime.getRuntime.nn.availableProcessors()
29+
val processors = java.lang.Runtime.getRuntime.availableProcessors()
3030
8 * processors * processors
3131
}
3232

library/src/scala/runtime/coverage/Invoker.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ object Invoker {
5151
@nowarn("cat=deprecation")
5252
def measurementFile(dataDir: String): File = new File(
5353
dataDir,
54-
MeasurementsPrefix + runtimeUUID + "." + Thread.currentThread.nn.getId
54+
MeasurementsPrefix + runtimeUUID + "." + Thread.currentThread.getId
5555
)
5656
}

library/src/scala/util/FromDigits.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ object FromDigits {
135135
case ex: NumberFormatException => throw MalformedNumber()
136136
}
137137
if (x.isInfinite) throw NumberTooLarge()
138-
if (x == 0.0f && !zeroFloat.pattern.matcher(digits).nn.matches) throw NumberTooSmall()
138+
if (x == 0.0f && !zeroFloat.pattern.matcher(digits).matches) throw NumberTooSmall()
139139
x
140140
}
141141

presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ object AmmoniteFileCompletions:
3939
rawFileName: String
4040
)(using Context): List[CompletionValue] =
4141
val fileName: Option[String] = Option(rawFileName)
42-
.flatMap(_.split("/").nn.lastOption.map(_.nn.stripSuffix(".amm.sc.scala")))
42+
.flatMap(_.split("/").lastOption.map(_.stripSuffix(".amm.sc.scala")))
4343

4444
val split: List[String] = Option(rawPath)
45-
.fold(Nil)(_.split("\\$file").nn.toList.map(_.nn))
45+
.fold(Nil)(_.split("\\$file").toList.map(_.nn))
4646

4747
val editRange = selector.headOption.map { sel =>
4848
if sel.sourcePos.span.isZeroExtent then posRange
@@ -71,10 +71,10 @@ object AmmoniteFileCompletions:
7171
// drop / or \
7272
val current = workspace.resolve(script.drop(1))
7373
val importPath = translateImportToPath(select).drop(1)
74-
val currentPath = current.nn.getParent().nn.resolve(importPath).nn.toAbsolutePath()
74+
val currentPath = current.getParent().resolve(importPath).toAbsolutePath()
7575
val parentTextEdit =
76-
if query.exists(_.nn.isEmpty()) &&
77-
Files.exists(currentPath.nn.getParent()) && Files.isDirectory(
76+
if query.exists(_.isEmpty()) &&
77+
Files.exists(currentPath.getParent()) && Files.isDirectory(
7878
currentPath
7979
)
8080
then List(parent)
@@ -84,7 +84,7 @@ object AmmoniteFileCompletions:
8484
.iterator().nn
8585
.asScala
8686
.toList
87-
.filter(path => !fileName.contains(path.nn.getFileName().toString.stripSuffix(".sc")))
87+
.filter(path => !fileName.contains(path.getFileName().toString.stripSuffix(".sc")))
8888
.collect {
8989
case file if matches(file) =>
9090
CompletionValue.FileSystemMember(

0 commit comments

Comments
 (0)