diff --git a/modules/ast/src/main/scala/playground/smithyql/AST.scala b/modules/ast/src/main/scala/playground/smithyql/AST.scala index f3467d9c..3adc2baf 100644 --- a/modules/ast/src/main/scala/playground/smithyql/AST.scala +++ b/modules/ast/src/main/scala/playground/smithyql/AST.scala @@ -270,7 +270,7 @@ object Struct { )( getValue: F[Identifier] => Identifier ): Option[F[InputNode[F]]] = value - .find(pair => getValue(pair.identifier).text == name) + .find(pair => getValue(pair.identifier).text === name) .map(_.value) } diff --git a/modules/core/src/main/scala/playground/CompilationError.scala b/modules/core/src/main/scala/playground/CompilationError.scala index 93b312c4..1aeded31 100644 --- a/modules/core/src/main/scala/playground/CompilationError.scala +++ b/modules/core/src/main/scala/playground/CompilationError.scala @@ -4,6 +4,7 @@ import cats.Id import cats.data.IorNel import cats.data.NonEmptyList import cats.implicits._ +import cats.kernel.Eq import playground.CompilationErrorDetails._ import playground.smithyql._ import playground.smithyql.format.Formatter @@ -19,8 +20,8 @@ final case class CompilationError( ) { def deprecated: CompilationError = copy(tags = tags + DiagnosticTag.Deprecated) - def isError: Boolean = severity == DiagnosticSeverity.Error - def isWarning: Boolean = severity == DiagnosticSeverity.Warning + def isError: Boolean = severity === DiagnosticSeverity.Error + def isWarning: Boolean = severity === DiagnosticSeverity.Warning } object CompilationError { @@ -69,6 +70,8 @@ object DiagnosticSeverity { case object Warning extends DiagnosticSeverity case object Error extends DiagnosticSeverity case object Information extends DiagnosticSeverity + + implicit val eq: Eq[DiagnosticSeverity] = Eq.fromUniversalEquals } sealed trait DiagnosticTag extends Product with Serializable @@ -145,7 +148,7 @@ sealed trait CompilationErrorDetails extends Product with Serializable { val expectedRemainingString = if (remainingFields.isEmpty) "" - else if (remainingFields.size == 1) + else if (remainingFields.sizeIs == 1) s" Expected: ${remainingFields.head}." else s" Expected: one of ${remainingFields.mkString(", ")}." diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index 1ce3f248..851080b5 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -271,7 +271,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { val presentKeys = struct.value.fields.value.keys val extraFieldErrors: QueryCompiler.Result[Unit] = presentKeys - .filterNot(field => validFields.contains(field.value.text)) + .filterNot(field => validFields.contains_(field.value.text)) .map { unexpectedKey => CompilationError.error( UnexpectedField(remainingValidFields), @@ -342,7 +342,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { // todo: should say it's a union .typeCheck(NodeKind.Struct) { case s @ Struct(_) => s } .emap { - case s if s.value.fields.value.size == 1 => + case s if s.value.fields.value.size === 1 => val definition = s.value.fields.value.head val key = definition.identifier @@ -462,10 +462,10 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { total: E => EnumValue[E], ): QueryCompiler[E] = (string, QueryCompiler.pos).tupled.emap { case (name, range) => val byValue = values - .find(_.stringValue == name) + .find(_.stringValue === name) val byName = values - .find(_.name == name) + .find(_.name === name) (byName, byValue) match { case (Some(v), _) => v.value.pure[QueryCompiler.Result] diff --git a/modules/core/src/test/scala/playground/IorUtilsTests.scala b/modules/core/src/test/scala/playground/IorUtilsTests.scala index 98bf621e..1d1cb067 100644 --- a/modules/core/src/test/scala/playground/IorUtilsTests.scala +++ b/modules/core/src/test/scala/playground/IorUtilsTests.scala @@ -26,7 +26,7 @@ object IorUtilsTests extends FunSuite { .foreach { testCase => test(s"orElseCombine(${testCase.lhs}, ${testCase.rhs})") { val result = IorUtils.orElseCombine(testCase.lhs, testCase.rhs) - assert(result == testCase.expected) + assert(result === testCase.expected) } } } diff --git a/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala b/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala index 9e28ef1c..3a71f518 100644 --- a/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala +++ b/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala @@ -68,16 +68,6 @@ private[format] object FormattingVisitor extends ASTVisitor[WithSource, Doc] { v internal + commentsRHSSep + commentsRHS - /* - case CommentPosition.After if lines.lengthIs == 1 => - // one line: we add a space before the comment - Doc.lineOrSpace + internalString - - case CommentPosition.After => - // more lines: we force a hardline before the comments - Doc.hardLine + internalString - } - */ } private def printGeneric( diff --git a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala index ee309930..56e1890c 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala @@ -51,7 +51,7 @@ object CompletionProvider { presentServiceIdentifiers: List[QualifiedIdentifier], insertBodyStruct: CompletionItem.InsertBodyStruct, ): List[CompletionItem] = { - val needsUseClause = !presentServiceIdentifiers.contains(serviceId) + val needsUseClause = !presentServiceIdentifiers.contains_(serviceId) val insertUseClause = if (needsUseClause) diff --git a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala index 98a64ed3..4cc15da1 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -2,6 +2,7 @@ package playground.language import cats.Id import cats.implicits._ +import cats.kernel.Eq import playground.ServiceNameExtractor import playground.TextUtils import playground.language.CompletionItem.InsertUseClause.NotRequired @@ -145,7 +146,7 @@ object CompletionItem { insertText: InsertText, schema: Schema[_], ): CompletionItem = { - val isField = kind == CompletionItemKind.Field + val isField = kind === CompletionItemKind.Field val sortText = isField match { @@ -402,6 +403,8 @@ object CompletionItemKind { case object Constant extends CompletionItemKind case object UnionMember extends CompletionItemKind case object Function extends CompletionItemKind + + implicit val eq: Eq[CompletionItemKind] = Eq.fromUniversalEquals } object CompletionVisitor extends SchemaVisitor[CompletionResolver] { diff --git a/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala b/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala index 30307495..7e7d99c2 100644 --- a/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala +++ b/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala @@ -72,12 +72,12 @@ case class ParsingFailure( e: Parser.Expectation, ): String = e match { - case OneOfStr(_, List(str)) => prep(str) - case OneOfStr(_, strs) => strs.map(prep).mkString_(" OR ") - case InRange(_, 'A', 'Z') => "an uppercase letter" - case InRange(_, 'a', 'z') => "a lowercase letter" - case InRange(_, '0', '9') => "digit" - case InRange(_, from, to) if from == to => prep(from.toString) + case OneOfStr(_, List(str)) => prep(str) + case OneOfStr(_, strs) => strs.map(prep).mkString_(" OR ") + case InRange(_, 'A', 'Z') => "an uppercase letter" + case InRange(_, 'a', 'z') => "a lowercase letter" + case InRange(_, '0', '9') => "digit" + case InRange(_, from, to) if from === to => prep(from.toString) case InRange(_, from, to) => s"one of ${prep(from.toString)} - ${prep(to.toString)}" case EndOfString(_, _) => "end of string" case WithContext(contextStr, underlying) if verbose =>