diff --git a/compiler/src/dotty/tools/dotc/cc/CaptureSet.scala b/compiler/src/dotty/tools/dotc/cc/CaptureSet.scala index d3ad7004d55e..4385aa26880d 100644 --- a/compiler/src/dotty/tools/dotc/cc/CaptureSet.scala +++ b/compiler/src/dotty/tools/dotc/cc/CaptureSet.scala @@ -949,7 +949,7 @@ object CaptureSet: * is not derived from some other variable. */ protected def ids(using Context): String = - def descr = getClass.getSimpleName.nn.take(1) + def descr = getClass.getSimpleName.take(1) val trail = this.match case dv: DerivedVar => def summary = if ctx.settings.YccVerbose.value then dv.summarize else descr diff --git a/compiler/src/dotty/tools/dotc/core/NullOpsDecorator.scala b/compiler/src/dotty/tools/dotc/core/NullOpsDecorator.scala index f1ff60e4ea22..572c94070066 100644 --- a/compiler/src/dotty/tools/dotc/core/NullOpsDecorator.scala +++ b/compiler/src/dotty/tools/dotc/core/NullOpsDecorator.scala @@ -47,7 +47,7 @@ object NullOpsDecorator: /** Is self (after widening and dealiasing) a type of the form `T | Null`? */ def isNullableUnion(using Context): Boolean = { - val stripped = self.stripNull() + val stripped = self.stripNull(stripFlexibleTypes = false) stripped ne self } end extension diff --git a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala index 9440920a31bb..2dd2f6378665 100644 --- a/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -322,7 +322,7 @@ object SymbolLoaders { val fullName = pkg.name val name = if (packageName.isEmpty) fullName - else fullName.substring(packageName.length + 1).nn + else fullName.substring(packageName.length + 1) enterPackage(root.symbol, name.toTermName, (module, modcls) => new PackageLoader(module, classPath)) diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index 1d1c497b2196..dd40a43fdff9 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -3376,12 +3376,12 @@ object TypeComparer { } private[core] def show(res: Any)(using Context): String = - if ctx.settings.YexplainLowlevel.value then String.valueOf(res).nn + if ctx.settings.YexplainLowlevel.value then String.valueOf(res) else res match case ClassInfo(_, cls, _, _, _) => cls.showLocated case bounds: TypeBounds => i"type bounds [$bounds]" case res: printing.Showable => res.show - case _ => String.valueOf(res).nn + case _ => String.valueOf(res) /** The approximation state indicates how the pair of types currently compared * relates to the types compared originally. diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 71699c992ab6..3a1c8d359d6f 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -382,7 +382,7 @@ object Types extends TypeUtils { /** Is this type guaranteed not to have `null` as a value? */ final def isNotNull(using Context): Boolean = this match { case tp: ConstantType => tp.value.value != null - case tp: FlexibleType => false + case tp: FlexibleType => true case tp: ClassInfo => !tp.cls.isNullableClass && !tp.isNothingType case tp: AppliedType => tp.superType.isNotNull case tp: TypeBounds => tp.hi.isNotNull diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index fc71c0e43034..91b61e1f4623 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1218,7 +1218,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer } catch { case ex: FromDigitsException => - report.error(ex.getMessage.nn, tree.srcPos) + report.error(ex.getMessage, tree.srcPos) tree.kind match { case Whole(_) => lit(0) case _ => lit(0.0) diff --git a/library/src/scala/reflect/Selectable.scala b/library/src/scala/reflect/Selectable.scala index 52b584bf815e..35a9b74c63be 100644 --- a/library/src/scala/reflect/Selectable.scala +++ b/library/src/scala/reflect/Selectable.scala @@ -23,7 +23,7 @@ trait Selectable extends scala.Selectable: final def selectDynamic(name: String): Any = val rcls = selectedValue.getClass try - val fld = rcls.getField(NameTransformer.encode(name)).nn + val fld = rcls.getField(NameTransformer.encode(name)) ensureAccessible(fld) fld.get(selectedValue) catch case ex: NoSuchFieldException => @@ -37,7 +37,7 @@ trait Selectable extends scala.Selectable: */ final def applyDynamic(name: String, paramTypes: Class[?]*)(args: Any*): Any = val rcls = selectedValue.getClass - val mth = rcls.getMethod(NameTransformer.encode(name), paramTypes*).nn + val mth = rcls.getMethod(NameTransformer.encode(name), paramTypes*) ensureAccessible(mth) mth.invoke(selectedValue, args.asInstanceOf[Seq[AnyRef]]*) diff --git a/library/src/scala/util/FromDigits.scala b/library/src/scala/util/FromDigits.scala index 73b5a79b7546..c37776cff392 100644 --- a/library/src/scala/util/FromDigits.scala +++ b/library/src/scala/util/FromDigits.scala @@ -154,7 +154,7 @@ object FromDigits { case ex: NumberFormatException => throw MalformedNumber() } if (x.isInfinite) throw NumberTooLarge() - if (x == 0.0d && !zeroFloat.pattern.matcher(digits).nn.matches) throw NumberTooSmall() + if (x == 0.0d && !zeroFloat.pattern.matcher(digits).matches) throw NumberTooSmall() x } diff --git a/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala b/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala index 7b30c745e3ed..6dabbe8013ee 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala @@ -23,7 +23,7 @@ object AutoImports: def renameConfigMap(config: PresentationCompilerConfig)(using Context ): Map[Symbol, String] = - config.symbolPrefixes().nn.asScala.flatMap { (from, to) => + config.symbolPrefixes().asScala.flatMap { (from, to) => val pkg = SemanticdbSymbols.inverseSemanticdbSymbol(from) val rename = to.stripSuffix(".").stripSuffix("#") List(pkg, pkg.map(_.moduleClass)).flatten @@ -253,7 +253,7 @@ object AutoImports: // see WorksheetProvider.worksheetScala3AdjustmentsForPC val indent = if pos.source.path.isWorksheet && - editPos.getStart().nn.getCharacter() == 0 + editPos.getStart().getCharacter() == 0 then indent0.drop(2) else indent0 val topPadding = diff --git a/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala index 97ec396abcf1..f26b802a2110 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala @@ -30,8 +30,8 @@ final class AutoImportsProvider( )(using ReportContext): def autoImports(isExtension: Boolean): List[AutoImportsResult] = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val filePath = Paths.get(uri) driver.run(uri, SourceFile.virtual(filePath.toString, text)) diff --git a/presentation-compiler/src/main/dotty/tools/pc/CompilerSearchVisitor.scala b/presentation-compiler/src/main/dotty/tools/pc/CompilerSearchVisitor.scala index aed8bf418490..6d57227800d0 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/CompilerSearchVisitor.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/CompilerSearchVisitor.scala @@ -19,7 +19,7 @@ class CompilerSearchVisitor( )(using ctx: Context, reports: ReportContext) extends SymbolSearchVisitor: - val logger: Logger = Logger.getLogger(classOf[CompilerSearchVisitor].getName()).nn + val logger: Logger = Logger.getLogger(classOf[CompilerSearchVisitor].getName()) private def isAccessibleImplicitClass(sym: Symbol) = val owner = sym.maybeOwner @@ -77,7 +77,7 @@ class CompilerSearchVisitor( .split("\\$") val added = - try toSymbols(pkg, innerPath.nn.toList.map(_.nn)).filter(visitSymbol) + try toSymbols(pkg, innerPath.toList).filter(visitSymbol) catch case NonFatal(e) => logger.log(Level.WARNING, e.getMessage(), e) diff --git a/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala b/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala index f7fdb1c36e6d..f4f083128b25 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala @@ -50,7 +50,7 @@ object CompletionItemResolver extends ItemResolver: Context ): String = def docs(gsym: Symbol): String = - search.symbolDocumentation(gsym).fold("")(_.docstring().nn) + search.symbolDocumentation(gsym).fold("")(_.docstring()) val gsymDoc = docs(gsym) def keyword(gsym: Symbol): String = if gsym.isClass then "class" diff --git a/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala index d4f945760cc0..a70f912d0a8b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala @@ -23,8 +23,8 @@ final class ConvertToNamedArgumentsProvider( ): def convertToNamedArguments: Either[String, List[l.TextEdit]] = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val filePath = Paths.get(uri) driver.run(uri, SourceFile.virtual(filePath.toString, text)) diff --git a/presentation-compiler/src/main/dotty/tools/pc/DiagnosticProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/DiagnosticProvider.scala index 878dcf72d89b..20066fda23e3 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/DiagnosticProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/DiagnosticProvider.scala @@ -18,7 +18,7 @@ class DiagnosticProvider(driver: InteractiveDriver, params: VirtualFileParams): def diagnostics(): List[lsp4j.Diagnostic] = if params.shouldReturnDiagnostics then - val diags = driver.run(params.uri().nn, params.text().nn) + val diags = driver.run(params.uri(), params.text()) given Context = driver.currentCtx diags.flatMap(toLsp) else Nil diff --git a/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala index bd44878aa11a..899a882df297 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala @@ -39,8 +39,8 @@ final class ExtractMethodProvider( extends ExtractMethodUtils: def extractMethod(): List[TextEdit] = - val text = range.text().nn - val uri = range.uri().nn + val text = range.text() + val uri = range.uri() val filePath = Paths.get(uri) val source = SourceFile.virtual(filePath.toString, text) driver.run(uri, source) diff --git a/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala index 375a75d0307f..8a066dede1dc 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala @@ -37,8 +37,8 @@ object HoverProvider: search: SymbolSearch, contentType: ContentType )(implicit reportContext: ReportContext): ju.Optional[HoverSignature] = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val sourceFile = SourceFile.virtual(uri, text) driver.run(uri, sourceFile) val unit = driver.compilationUnits.get(uri) @@ -90,7 +90,7 @@ object HoverProvider: ) end report reportContext.unsanitized.create(() => report, /*ifVerbose =*/ true) - ju.Optional.empty().nn + ju.Optional.empty() else val skipCheckOnName = !pos.isPoint // don't check isHoveringOnName for RangeHover @@ -158,9 +158,9 @@ object HoverProvider: contextInfo = printer.getUsedRenamesInfo, contentType = contentType ) - ).nn + ) case _ => - ju.Optional.empty().nn + ju.Optional.empty() end match case (_, tpe, Some(namedTupleArg)) :: _ => val exprTpw = tpe.widenTermRefExpr.deepDealiasAndSimplify @@ -175,8 +175,8 @@ object HoverProvider: contextInfo = printer.getUsedRenamesInfo, contentType = contentType ) - ).nn - case _ => ju.Optional.empty().nn + ) + case _ => ju.Optional.empty() end match end if end hover @@ -238,7 +238,7 @@ object HoverProvider: refTpe.flatMap(findRefinement).headOption.asJava case _ => - ju.Optional.empty().nn + ju.Optional.empty() end HoverProvider diff --git a/presentation-compiler/src/main/dotty/tools/pc/InferredMethodProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/InferredMethodProvider.scala index e6f27781bc64..57f9b759bb18 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/InferredMethodProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/InferredMethodProvider.scala @@ -54,10 +54,10 @@ final class InferredMethodProvider( def inferredMethodEdits( adjustOpt: Option[AdjustTypeOpts] = None ): List[TextEdit] = - val uri = params.uri().nn - val filePath = Paths.get(uri).nn + val uri = params.uri() + val filePath = Paths.get(uri) - val sourceText = adjustOpt.map(_.text).getOrElse(params.text().nn) + val sourceText = adjustOpt.map(_.text).getOrElse(params.text()) val source = SourceFile.virtual(filePath.toString(), sourceText) driver.run(uri, source) @@ -101,8 +101,8 @@ final class InferredMethodProvider( .mkString(", ") def printSignature( - methodName: Name, - params: List[List[Type]], + methodName: Name, + params: List[List[Type]], retTypeOpt: Option[Type] ): String = val retTypeString = retTypeOpt match @@ -145,15 +145,15 @@ final class InferredMethodProvider( /** * Returns the position to insert the method signature for a container. * If the container has an empty body, the position is the end of the container. - * If the container has a non-empty body, the position is the end of the last element in the body. - * + * If the container has a non-empty body, the position is the end of the last element in the body. + * * @param container the container to insert the method signature for * @return the position to insert the method signature for the container and a boolean indicating if the container has an empty body */ def insertPositionFor(container: Tree): Option[(SourcePosition, Boolean)] = val typeSymbol = container.tpe.widenDealias.typeSymbol if typeSymbol.exists then - val trees = driver.openedTrees(params.uri().nn) + val trees = driver.openedTrees(params.uri()) val include = Interactive.Include.definitions | Interactive.Include.local Interactive.findTreesMatching(trees, include, typeSymbol).headOption match case Some(srcTree) => @@ -170,9 +170,9 @@ final class InferredMethodProvider( /** * Extracts type information for a specific parameter in a method signature. - * If the parameter is a function type, extracts both the function's argument types + * If the parameter is a function type, extracts both the function's argument types * and return type. Otherwise, extracts just the parameter type. - * + * * @param methodType the method type to analyze * @param argIndex the index of the parameter to extract information for * @return a tuple of (argument types, return type) where: @@ -192,7 +192,7 @@ final class InferredMethodProvider( else (None, Some(m.paramInfos(argIndex))) case _ => (None, None) - + def signatureEdits(signature: String): List[TextEdit] = val pos = insertPosition() val indent = indentation(params.text(), pos.start - 1) @@ -234,17 +234,17 @@ final class InferredMethodProvider( * outerArgs * --------------------------- * method(..., errorMethod(args), ...) - * + * */ - case (id @ Ident(errorMethod)) :: - (apply @ Apply(func, args)) :: - Apply(method, outerArgs) :: + case (id @ Ident(errorMethod)) :: + (apply @ Apply(func, args)) :: + Apply(method, outerArgs) :: _ if id.symbol == NoSymbol && func == id && method != apply => - + val argTypes = args.map(_.typeOpt.widenDealias) val argIndex = outerArgs.indexOf(apply) - val (allArgTypes, retTypeOpt) = + val (allArgTypes, retTypeOpt) = extractParameterTypeInfo(method.tpe.widenDealias, argIndex) match case (Some(argTypes2), retTypeOpt) => (List(argTypes, argTypes2), retTypeOpt) case (None, retTypeOpt) => (List(argTypes), retTypeOpt) @@ -257,12 +257,12 @@ final class InferredMethodProvider( * outerArgs * --------------------- * method(..., errorMethod, ...) - * + * */ - case (id @ Ident(errorMethod)) :: - Apply(method, outerArgs) :: + case (id @ Ident(errorMethod)) :: + Apply(method, outerArgs) :: _ if id.symbol == NoSymbol && method != id => - + val argIndex = outerArgs.indexOf(id) val (argTypes, retTypeOpt) = extractParameterTypeInfo(method.tpe.widenDealias, argIndex) @@ -272,20 +272,20 @@ final class InferredMethodProvider( case None => Nil val signature = printSignature(errorMethod, allArgTypes, retTypeOpt) - + signatureEdits(signature) /** * tpt body * ----------- ---------------- * val value: DefinedType = errorMethod(args) - * + * */ - case (id @ Ident(errorMethod)) :: - (apply @ Apply(func, args)) :: - ValDef(_, tpt, body) :: + case (id @ Ident(errorMethod)) :: + (apply @ Apply(func, args)) :: + ValDef(_, tpt, body) :: _ if id.symbol == NoSymbol && func == id && apply == body => - + val retType = tpt.tpe.widenDealias val argTypes = args.map(_.typeOpt.widenDealias) @@ -296,24 +296,24 @@ final class InferredMethodProvider( * tpt body * ----------- ----------- * val value: DefinedType = errorMethod - * + * */ - case (id @ Ident(errorMethod)) :: - ValDef(_, tpt, body) :: + case (id @ Ident(errorMethod)) :: + ValDef(_, tpt, body) :: _ if id.symbol == NoSymbol && id == body => - + val retType = tpt.tpe.widenDealias val signature = printSignature(errorMethod, Nil, Some(retType)) signatureEdits(signature) /** - * + * * errorMethod(args) - * + * */ - case (id @ Ident(errorMethod)) :: - (apply @ Apply(func, args)) :: + case (id @ Ident(errorMethod)) :: + (apply @ Apply(func, args)) :: _ if id.symbol == NoSymbol && func == id => val argTypes = args.map(_.typeOpt.widenDealias) @@ -322,37 +322,37 @@ final class InferredMethodProvider( signatureEdits(signature) /** - * + * * errorMethod - * + * */ - case (id @ Ident(errorMethod)) :: + case (id @ Ident(errorMethod)) :: _ if id.symbol == NoSymbol => val signature = printSignature(errorMethod, Nil, None) signatureEdits(signature) /** - * + * * container.errorMethod(args) - * + * */ - case (select @ Select(container, errorMethod)) :: - (apply @ Apply(func, args)) :: + case (select @ Select(container, errorMethod)) :: + (apply @ Apply(func, args)) :: _ if select.symbol == NoSymbol && func == select => - + val argTypes = args.map(_.typeOpt.widenDealias) val signature = printSignature(errorMethod, List(argTypes), None) signatureEditsForContainer(signature, container) /** - * + * * container.errorMethod - * + * */ - case (select @ Select(container, errorMethod)) :: + case (select @ Select(container, errorMethod)) :: _ if select.symbol == NoSymbol => - + val signature = printSignature(errorMethod, Nil, None) signatureEditsForContainer(signature, container) diff --git a/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala index af5a0e409d1a..8a85fb198499 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala @@ -62,10 +62,10 @@ final class InferredTypeProvider( adjustOpt: Option[AdjustTypeOpts] = None ): List[TextEdit] = val retryType = adjustOpt.isEmpty - val uri = params.uri().nn - val filePath = Paths.get(uri).nn + val uri = params.uri() + val filePath = Paths.get(uri) - val sourceText = adjustOpt.map(_.text).getOrElse(params.text().nn) + val sourceText = adjustOpt.map(_.text).getOrElse(params.text()) val source = SourceFile.virtual(filePath.toString(), sourceText) driver.run(uri, source) @@ -86,7 +86,7 @@ final class InferredTypeProvider( ) def removeType(nameEnd: Int, tptEnd: Int) = - sourceText.substring(0, nameEnd).nn + + sourceText.substring(0, nameEnd) + sourceText.substring(tptEnd + 1, sourceText.length()) def optDealias(tpe: Type): Type = @@ -187,7 +187,7 @@ final class InferredTypeProvider( Some( AdjustTypeOpts( removeType(vl.namePos.end, tpt.sourcePos.end - 1), - tpt.sourcePos.toLsp.getEnd().nn + tpt.sourcePos.toLsp.getEnd() ) ) ) @@ -227,7 +227,7 @@ final class InferredTypeProvider( Some( AdjustTypeOpts( removeType(lastColon, tpt.sourcePos.end - 1), - tpt.sourcePos.toLsp.getEnd().nn + tpt.sourcePos.toLsp.getEnd() ) ) ) @@ -257,8 +257,8 @@ final class InferredTypeProvider( val firstEnd = patterns(0).endPos.end val secondStart = patterns(1).startPos.start val hasDot = params - .text().nn - .substring(firstEnd, secondStart).nn + .text() + .substring(firstEnd, secondStart) .exists(_ == ',') if !hasDot then val leftParen = new TextEdit(body.startPos.toLsp, "(") diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala index ca5a36cefad0..7196be69dc7b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala @@ -38,8 +38,8 @@ class PcDefinitionProvider( definitions(findTypeDef = true) private def definitions(findTypeDef: Boolean): DefinitionResult = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val filePath = Paths.get(uri) driver.run( uri, @@ -56,7 +56,7 @@ class PcDefinitionProvider( if findTypeDef then findTypeDefinitions(path, pos, indexedContext, uri) else findDefinitions(path, pos, indexedContext, uri) - if result.locations().nn.isEmpty() then fallbackToUntyped(pos, uri)(using ctx) + if result.locations().isEmpty() then fallbackToUntyped(pos, uri)(using ctx) else result end definitions diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala index 831e5ba181f7..abb0faf03841 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala @@ -228,7 +228,7 @@ class PcInlayHintsProvider( if symbol.source == pos.source then LabelPart( label, - pos = Some(symbol.sourcePos.toLsp.getStart().nn), + pos = Some(symbol.sourcePos.toLsp.getStart()), ) else LabelPart( diff --git a/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProvider.scala index c35046db2fc4..53d022cfd813 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProvider.scala @@ -87,7 +87,7 @@ final class PcInlineValueProvider( new l.Range(startPos, endPos) } - val position: l.Position = pos.toLsp.getStart().nn + val position: l.Position = pos.toLsp.getStart() override def collect(parent: Option[Tree])( tree: Tree | EndMarker, diff --git a/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala index 09c44b105555..7957ab6510b5 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SelectionRangeProvider.scala @@ -36,8 +36,8 @@ class SelectionRangeProvider(driver: InteractiveDriver, params: ju.List[OffsetPa params.asScala.toList.map { param => - val uri = param.uri().nn - val text = param.text().nn + val uri = param.uri() + val text = param.text() val filePath = Paths.get(uri) val source = SourceFile.virtual(filePath.toString, text) driver.run(uri, source) diff --git a/presentation-compiler/src/main/dotty/tools/pc/SemanticdbTextDocumentProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SemanticdbTextDocumentProvider.scala index 43e75a4d6130..997aecd26510 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SemanticdbTextDocumentProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SemanticdbTextDocumentProvider.scala @@ -25,7 +25,7 @@ class SemanticdbTextDocumentProvider( uri: URI, sourceCode: String ): Array[Byte] = - val filePath = Paths.get(uri).nn + val filePath = Paths.get(uri) val validCode = removeMagicImports(sourceCode, filePath) driver.run( uri, @@ -47,7 +47,7 @@ class SemanticdbTextDocumentProvider( val document = TextDocument( schema = Schema.SEMANTICDB4, language = Language.SCALA, - uri = path.nn, + uri = path, text = sourceCode, md5 = MD5.compute(sourceCode), symbols = extractor.symbolInfos.toList, @@ -57,7 +57,7 @@ class SemanticdbTextDocumentProvider( val out = SemanticdbOutputStream.newInstance(byteStream) document.writeTo(out) out.flush() - byteStream.toByteArray().nn + byteStream.toByteArray() end textDocument end SemanticdbTextDocumentProvider diff --git a/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala index 4fab29159bfb..7d2f776859ed 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/SignatureHelpProvider.scala @@ -25,10 +25,10 @@ object SignatureHelpProvider: params: OffsetParams, search: SymbolSearch )(using ReportContext): l.SignatureHelp = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val sourceFile = SourceFile.virtual(uri, text) - driver.run(uri.nn, sourceFile) + driver.run(uri, sourceFile) driver.compilationUnits.get(uri) match case Some(unit) => @@ -73,8 +73,8 @@ object SignatureHelpProvider: signature: Signatures.Signature, isJavaSymbol: Boolean ): Option[Signatures.Signature] = - val methodParams = info.parameters().nn.asScala - val typeParams = info.typeParameters().nn.asScala + val methodParams = info.parameters().asScala + val typeParams = info.typeParameters().asScala def updateParams(params: List[Signatures.Param], typeParamIndex: Int, methodParamIndex: Int): List[Signatures.Param] = params match @@ -86,13 +86,13 @@ object SignatureHelpProvider: if isJavaSymbol && head.name.startsWith("x$") then paramDoc.displayName() else head.name - head.copy(name = newName.nn, doc = Some(paramDoc.docstring.nn)) :: rest + head.copy(name = newName, doc = Some(paramDoc.docstring)) :: rest case _ => head :: rest case (head: Signatures.TypeParam) :: tail => val rest = updateParams(tail, typeParamIndex + 1, methodParamIndex) typeParams.lift(typeParamIndex) match case Some(paramDoc) => - head.copy(doc = Some(paramDoc.docstring.nn)) :: rest + head.copy(doc = Some(paramDoc.docstring)) :: rest case _ => head :: rest case _ => Nil @@ -111,7 +111,7 @@ object SignatureHelpProvider: case _ => (typeParamIndex, methodParamIndex) updated :: updateParamss(tail, nextTypeParamIndex, nextMethodParamIndex) val updatedParams = updateParamss(signature.paramss, 0, 0) - Some(signature.copy(doc = Some(info.docstring().nn), paramss = updatedParams)) + Some(signature.copy(doc = Some(info.docstring()), paramss = updatedParams)) end withDocumentation private def signatureToSignatureInformation( diff --git a/presentation-compiler/src/main/dotty/tools/pc/TastyUtils.scala b/presentation-compiler/src/main/dotty/tools/pc/TastyUtils.scala index 0c2afad5f92a..541ac0f704cf 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/TastyUtils.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/TastyUtils.scala @@ -21,7 +21,7 @@ object TastyUtils: private def normalTasty(tastyURI: URI): String = val tastyBytes = Files.readAllBytes(Paths.get(tastyURI)) - new TastyPrinter(tastyBytes.nn, isBestEffortTasty = false, testPickler = false).showContents() + new TastyPrinter(tastyBytes, isBestEffortTasty = false, testPickler = false).showContents() private def htmlTasty( tastyURI: URI, @@ -30,7 +30,7 @@ object TastyUtils: ): String = val title = tastyHtmlPageTitle(tastyURI) val tastyBytes = Files.readAllBytes(Paths.get(tastyURI)) - val tastyHtml = new TastyHTMLPrinter(tastyBytes.nn).showContents() + val tastyHtml = new TastyHTMLPrinter(tastyBytes).showContents() HtmlBuilder() .page(title, htmlStyles :: headElems, bodyAttributes) { builder => builder diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala index 7c25f8a69174..fde70d7feb2b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteFileCompletions.scala @@ -42,7 +42,7 @@ object AmmoniteFileCompletions: .flatMap(_.split("/").lastOption.map(_.stripSuffix(".amm.sc.scala"))) val split: List[String] = Option(rawPath) - .fold(Nil)(_.split("\\$file").toList.map(_.nn)) + .fold(Nil)(_.split("\\$file").toList) val editRange = selector.headOption.map { sel => if sel.sourcePos.span.isZeroExtent then posRange @@ -64,7 +64,7 @@ object AmmoniteFileCompletions: def matches(file: Path): Boolean = (Files.isDirectory(file) || file.toAbsolutePath().toString.isScalaScript) && - query.exists(q => CompletionFuzzy.matches(q.nn, file.getFileName().toString)) + query.exists(q => CompletionFuzzy.matches(q, file.getFileName().toString)) (split, workspace) match case (_ :: script :: Nil, Some(workspace)) => @@ -80,8 +80,8 @@ object AmmoniteFileCompletions: then List(parent) else Nil Files - .list(currentPath).nn - .iterator().nn + .list(currentPath) + .iterator() .asScala .toList .filter(path => !fileName.contains(path.getFileName().toString.stripSuffix(".sc"))) diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala index 718b57cd4828..a36a4b823cb5 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/AmmoniteIvyCompletions.scala @@ -31,7 +31,7 @@ object AmmoniteIvyCompletions: val (rangeStart, rangeEnd) = CoursierComplete.inferEditRange(pos.point, text) pos.withStart(rangeStart).withEnd(rangeEnd).toLsp - val completions = coursierComplete.complete(dependency.nn) + val completions = coursierComplete.complete(dependency) completions .map(insertText => CompletionValue.IvyImport( diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala index ed181695922e..93e0687defa4 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionPos.scala @@ -64,7 +64,7 @@ object CompletionPos: identEnd, query, sourcePos, - offsetParams.uri.nn, + offsetParams.uri, wasCursorApplied, hasLeadingBacktick, hasTrailingBacktick diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala index d3509466040d..e984fdc8416f 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionProvider.scala @@ -55,8 +55,8 @@ class CompletionProvider( referenceCounter: CompletionItemPriority )(using reports: ReportContext): def completions(): CompletionList = - val uri = params.uri().nn - val text = params.text().nn + val uri = params.uri() + val text = params.text() val (wasCursorApplied, code) = applyCompletionCursor(params) val sourceFile = SourceFile.virtual(uri, code) @@ -173,7 +173,7 @@ class CompletionProvider( * because scala parser trim end position to the last statement pos. */ private def applyCompletionCursor(params: OffsetParams): (Boolean, String) = - val text = params.text().nn + val text = params.text() val offset = params.offset() val query = Completion.naiveCompletionPrefix(text, offset) def isValidLastChar = @@ -193,9 +193,9 @@ class CompletionProvider( true -> ( if isStartMultilineComment then // Insert potentially missing `*/` to avoid comment out all codes after the "/**". - text.substring(0, offset).nn + Cursor.value + "*/" + text.substring(offset) + text.substring(0, offset) + Cursor.value + "*/" + text.substring(offset) else - text.substring(0, offset).nn + Cursor.value + text.substring(offset) + text.substring(0, offset) + Cursor.value + text.substring(offset) ) end applyCompletionCursor @@ -247,7 +247,7 @@ class CompletionProvider( additionalEdits: List[TextEdit] = Nil, range: Option[LspRange] = None ): CompletionItem = - val oldText = params.text().nn.substring(completionPos.queryStart, completionPos.identEnd) + val oldText = params.text().substring(completionPos.queryStart, completionPos.identEnd) val trimmedNewText = { var nt = newText if (completionPos.hasLeadingBacktick) nt = nt.stripPrefix("`") @@ -304,7 +304,7 @@ class CompletionProvider( case Some(edits) => edits match case AutoImportEdits(Some(nameEdit), other) => - mkItem(nameEdit.getNewText().nn, other.toList, range = Some(nameEdit.getRange().nn)) + mkItem(nameEdit.getNewText(), other.toList, range = Some(nameEdit.getRange())) case _ => mkItem( v.insertText.getOrElse(completionTextPrefix + ident.backticked(backtickSoftKeyword) + completionTextSuffix), diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala index 05d97972d76e..d84c9ef970b1 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/CompletionValue.scala @@ -249,7 +249,7 @@ object CompletionValue: tpe: Type, denotation: Denotation ) extends Symbolic: - override def insertText: Option[String] = Some(label.replace("$", "$$").nn) + override def insertText: Option[String] = Some(label.replace("$", "$$")) override def completionItemDataKind: Integer = CompletionSource.OverrideKind.ordinal override def completionItemKind(using Context): CompletionItemKind = CompletionItemKind.Field diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala index 72b65b3cadb9..a0a25d018abc 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -330,7 +330,7 @@ class Completions( ): (List[CompletionValue], Boolean) = val pos = completionPos.originalCursorPosition lazy val rawPath = Paths - .get(pos.source.path).nn + .get(pos.source.path) lazy val rawFileName = rawPath .getFileName() .toString() @@ -478,7 +478,7 @@ class Completions( // class Fo@@ case (td: TypeDef) :: _ if CompletionFuzzy.matches( - td.symbol.name.decoded.replace(Cursor.value, "").nn, + td.symbol.name.decoded.replace(Cursor.value, ""), filename ) => val values = FilenameCompletions.contribute(filename, td) @@ -607,7 +607,7 @@ class Completions( ).map(visit).forall(_ == true) else false, ) - Some(search.search(query, buildTargetIdentifier, visitor).nn) + Some(search.search(query, buildTargetIdentifier, visitor)) else if completionMode.is(Mode.Member) && query.nonEmpty then val visitor = new CompilerSearchVisitor(sym => def isExtensionMethod = sym.is(ExtensionMethod) && @@ -646,7 +646,7 @@ class Completions( ).map(visit).forall(_ == true) else false, ) - Some(search.searchMethods(query, buildTargetIdentifier, visitor).nn) + Some(search.searchMethods(query, buildTargetIdentifier, visitor)) else Some(SymbolSearch.Result.INCOMPLETE) end enrichWithSymbolSearch @@ -793,7 +793,7 @@ class Completions( catch case _ => false def isInheritedFromScalaLibrary(sym: Symbol) = - sym.owner == defn.AnyClass || + sym.owner == defn.AnyClass || sym.owner == defn.ObjectClass || sym.owner == defn.ProductClass || sym.owner == EqualsClass || @@ -960,7 +960,7 @@ class Completions( def fuzzyScore(o: CompletionValue.Symbolic): Int = fuzzyCache.getOrElseUpdate( o, { - val name = o.label.toLowerCase().nn + val name = o.label.toLowerCase() if name.startsWith(queryLower) then 0 else if name.contains(queryLower) then 1 else 2 diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala index 9cceff7310c6..6850c5a57555 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/InterpolatorCompletions.scala @@ -33,7 +33,7 @@ object InterpolatorCompletions: config: PresentationCompilerConfig, buildTargetIdentifier: String )(using Context, ReportContext) = - InterpolationSplice(completionPos.queryEnd, text.toCharArray().nn, text) match + InterpolationSplice(completionPos.queryEnd, text.toCharArray(), text) match case Some(interpolator) => InterpolatorCompletions.contributeScope( text, diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala index 2e89b4e5bb99..f6a2d5a3d384 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala @@ -340,7 +340,7 @@ object CaseKeywordCompletion: syms.sortBy(_._1.sym.sourcePos.point) else val defnSymbols = search - .definitionSourceToplevels(SemanticdbSymbols.symbolName(tpe.typeSymbol), uri).nn + .definitionSourceToplevels(SemanticdbSymbols.symbolName(tpe.typeSymbol), uri) .asScala .zipWithIndex .toMap @@ -410,7 +410,7 @@ class CompletionValueGenerator( case None => true case Some("") => true case Some(Cursor.value) => true - case Some(query) => CompletionFuzzy.matches(query.replace(Cursor.value, "").nn, name) + case Some(query) => CompletionFuzzy.matches(query.replace(Cursor.value, ""), name) def labelForCaseMember(sym: Symbol, name: String)(using Context diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala index faf6d715d8cf..327be659ef13 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala @@ -118,7 +118,6 @@ object NamedArgCompletions: val prefix = ident.name.toString .replace(Cursor.value, "") - .nn val params: List[ParamSymbol] = allParams diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala index f01a1e9b8cd8..8b7522940f1b 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/OverrideCompletions.scala @@ -89,7 +89,7 @@ object OverrideCompletions: val name = completing .fold(fallbackName)(sym => Some(sym.name.show)) - .map(_.replace(Cursor.value, "").nn) + .map(_.replace(Cursor.value, "")) .filter(!_.isEmpty()) // not using `td.tpe.abstractTermMembers` because those members includes @@ -173,9 +173,9 @@ object OverrideCompletions: case _ => None end FindTypeDef - val uri = params.uri().nn - val text = params.text().nn - driver.run(uri, SourceFile.virtual(uri.toASCIIString().nn, text)) + val uri = params.uri() + val text = params.text() + driver.run(uri, SourceFile.virtual(uri.toASCIIString(), text)) val unit = driver.currentCtx.run.nn.units.headOption unit match diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/SingletonCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/SingletonCompletions.scala index 621ef2e5c158..b5dc85f551f7 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/SingletonCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/SingletonCompletions.scala @@ -27,7 +27,7 @@ object SingletonCompletions: case (i @ Ident(name)) :: _ => List(name.toString() -> i.span) case (l @ Literal(const)) :: _ => List(const.show -> l.span) case _ => Nil - query = name.replace(Cursor.value, "").nn + query = name.replace(Cursor.value, "") tpe = tpe0 match // for Tuple 2 we want to suggest first arg completion case AppliedType(t: TypeRef, args) if t.classSymbol == Symbols.defn.Tuple2 && args.nonEmpty => diff --git a/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala b/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala index 5dee96c6133c..ff3a86c68ee4 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala @@ -315,7 +315,7 @@ class ShortenedTypePrinter( lazy val paramsDocs = symbolSearch.symbolDocumentation(gsym) match case Some(info) => - (info.typeParameters().nn.asScala ++ info.parameters().nn.asScala).toSeq + (info.typeParameters().asScala ++ info.parameters().asScala).toSeq case _ => Seq.empty @@ -527,7 +527,7 @@ class ShortenedTypePrinter( if includeDefaultParam == ShortenedTypePrinter.IncludeDefaultParam.Include && isDefaultParam then val defaultValue = docInfo match - case Some(value) if !value.defaultValue().nn.isEmpty() => + case Some(value) if !value.defaultValue().isEmpty() => value.defaultValue() case _ => "..." s" = $defaultValue" diff --git a/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala b/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala index 5003f1469f69..4666f6ef9f0f 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/utils/InteractiveEnrichments.scala @@ -42,7 +42,7 @@ object InteractiveEnrichments extends CommonMtagsEnrichments: isZeroExtent: Boolean = true ): SourcePosition = val uri = params.uri() - val source = driver.openedFiles(uri.nn) + val source = driver.openedFiles(uri) val span = params match case p: RangeParams if p.offset() != p.endOffset() => p.trimWhitespaceInRange.fold { @@ -285,7 +285,7 @@ object InteractiveEnrichments extends CommonMtagsEnrichments: () => parentSymbols.iterator.map(toSemanticdbSymbol).toList.asJava, contentType, ) - documentation.nn.toScala + documentation.toScala end symbolDocumentation end extension diff --git a/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala b/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala index c0064b94355a..c80712b0f571 100644 --- a/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala +++ b/presentation-compiler/test/dotty/tools/pc/utils/TestInlayHints.scala @@ -28,7 +28,7 @@ object TestInlayHints { def decorationString(inlayHint: InlayHint): String = { val buffer = ListBuffer.empty[String] - val labels = inlayHint.getLabel().nn.asScala match { + val labels = inlayHint.getLabel().asScala match { case Left(label) => List(label) case Right(labelParts) => labelParts.asScala.map(_.getValue()).toList } @@ -64,6 +64,6 @@ object TestInlayHints { } def removeInlayHints(text: String): String = - text.replaceAll(raw"\/\*(.*?)\*\/", "").nn + text.replaceAll(raw"\/\*(.*?)\*\/", "") } diff --git a/tests/explicit-nulls/warn/unnecessary-nn.scala b/tests/explicit-nulls/warn/unnecessary-nn.scala index 82d87e75c0a5..99df376ce2b3 100644 --- a/tests/explicit-nulls/warn/unnecessary-nn.scala +++ b/tests/explicit-nulls/warn/unnecessary-nn.scala @@ -10,7 +10,7 @@ def f5a[T <: String](s: T): String = s.nn // warn // flexible types def f7(s: String|Null): String = "".concat(s.nn) // warn -def f8(s: String): String = s.trim().nn // OK because the .nn could be useful as a dynamic null check +def f8(s: String): String = s.trim().nn // warn def f9(s: String|Null): String =