diff --git a/modules/compiler-core/src/internals/recursion.scala b/modules/compiler-core/src/internals/recursion.scala index d4b3250..f6cd1c5 100644 --- a/modules/compiler-core/src/internals/recursion.scala +++ b/modules/compiler-core/src/internals/recursion.scala @@ -93,7 +93,7 @@ private[compiler] object recursion { type PatternWithLabel[T] = WithLabel[Pattern[T]] implicit val patternWithLabelTraverse : Traverse[PatternWithLabel] = Traverse[WithLabel].compose[Pattern] - refoldPar[F, PatternWithLabel, A, B](unfold, fold.tupled)(a) + refoldPar[F, PatternWithLabel, A, B](unfold, (fold.apply _).tupled)(a) } } diff --git a/modules/formatter/src/parsers/ControlParser.scala b/modules/formatter/src/parsers/ControlParser.scala index e83dc94..f2a5f48 100644 --- a/modules/formatter/src/parsers/ControlParser.scala +++ b/modules/formatter/src/parsers/ControlParser.scala @@ -33,6 +33,6 @@ object ControlParser { } val control_section: Parser0[ControlSection] = - control_statement.rep0.map(ControlSection) + control_statement.rep0.map(ControlSection(_)) } diff --git a/modules/formatter/src/parsers/MetadataParser.scala b/modules/formatter/src/parsers/MetadataParser.scala index e774e90..f778693 100644 --- a/modules/formatter/src/parsers/MetadataParser.scala +++ b/modules/formatter/src/parsers/MetadataParser.scala @@ -34,7 +34,7 @@ object MetadataParser { } val metadata_section: Parser0[MetadataSection] = - metadata_statement.rep0.map(MetadataSection) + metadata_statement.rep0.map(MetadataSection(_)) } /* diff --git a/modules/formatter/src/parsers/NodeParser.scala b/modules/formatter/src/parsers/NodeParser.scala index e399512..23fbd60 100644 --- a/modules/formatter/src/parsers/NodeParser.scala +++ b/modules/formatter/src/parsers/NodeParser.scala @@ -53,10 +53,10 @@ object NodeParser { } val escaped_char: Parser[EscapedChar] = - escape *> (Parser.charIn(escapeChars).map(CharCase) | unicode_escape) + escape *> (Parser.charIn(escapeChars).map(CharCase(_)) | unicode_escape) val quoted_char: Parser[QuotedChar] = - qChar.backtrack.map(SimpleCharCase) | - escaped_char.backtrack.map(EscapedCharCase) | + qChar.backtrack.map(SimpleCharCase(_)) | + escaped_char.backtrack.map(EscapedCharCase(_)) | nl.as(NewLineCase) val three_dquotes: Parser[Unit] = dquote *> dquote *> dquote @@ -66,17 +66,17 @@ object NodeParser { } val text_block: Parser[TextBlock] = ((three_dquotes ~ sp0 *> nl) *> text_block_content.rep0 <* three_dquotes) - .map(TextBlock) + .map(TextBlock(_)) val quoted_text: Parser[QuotedText] = - (dquote *> quoted_char.rep0 <* dquote).map(QuotedText) - val node_string_value: Parser[NodeStringValue] = shape_id.backtrack.map( - ShapeIdCase - ) | text_block.backtrack.map(TextBlockCase) | quoted_text.backtrack - .map(QuotedTextCase) + (dquote *> quoted_char.rep0 <* dquote).map(QuotedText(_)) + val node_string_value: Parser[NodeStringValue] = + shape_id.backtrack.map(ShapeIdCase(_)) | + text_block.backtrack.map(TextBlockCase(_)) | + quoted_text.backtrack.map(QuotedTextCase(_)) val node_keywords: Parser[NodeKeyword] = - Parser.stringIn(Set("true", "false", "null")).map(NodeKeyword) + Parser.stringIn(Set("true", "false", "null")).map(NodeKeyword(_)) - val frac: Parser[Frac] = Parser.char('.') *> digit.rep.string.map(Frac) + val frac: Parser[Frac] = Parser.char('.') *> digit.rep.string.map(Frac(_)) val exp: Parser[Exp] = (Parser.charIn('e', 'E') ~ opParser.? ~ digit.rep.string) .map { case ((a, b), c) => @@ -92,10 +92,9 @@ object NodeParser { nodeArray.backtrack | nodeObject.backtrack | number.backtrack | node_keywords.backtrack | node_string_value.backtrack ) - val node_object_key: Parser[NodeObjectKey] = quoted_text.backtrack - .map( - NodeObjectKey.QuotedTextNok - ) | identifier.map(NodeObjectKey.IdentifierNok) + val node_object_key: Parser[NodeObjectKey] = + quoted_text.backtrack.map(NodeObjectKey.QuotedTextNok(_)) | + identifier.map(NodeObjectKey.IdentifierNok(_)) lazy val node_object_kvp: Parser[NodeObjectKeyValuePair] = ((node_object_key ~ ws <* colon) ~ ws ~ node_value).map { @@ -109,7 +108,7 @@ object NodeParser { } val nodeArray: Parser[NodeArray] = { - val valueP = (node_value ~ ws).map(NodeArrayValue.tupled) + val valueP = (node_value ~ ws).map((NodeArrayValue.apply _).tupled) ((openSquare *> ws ~ valueP.backtrack.rep0) <* (ws ~ closeSquare)) .map { case (whitespace, maybeTuple) => NodeArray(whitespace, maybeTuple) diff --git a/modules/formatter/src/parsers/ShapeIdParser.scala b/modules/formatter/src/parsers/ShapeIdParser.scala index f7a846d..290be8d 100644 --- a/modules/formatter/src/parsers/ShapeIdParser.scala +++ b/modules/formatter/src/parsers/ShapeIdParser.scala @@ -33,16 +33,16 @@ import cats.parse.Rfc5234.{alpha, digit} object ShapeIdParser { val underscore: Parser[Underscore] = Parser.charIn('_').as(Underscore) val identifier_chars: Parser[IdentifierChar] = - (Parser.charIn('_') | digit | alpha).map(IdentifierChar) + (Parser.charIn('_') | digit | alpha).map(IdentifierChar(_)) val identifier_start: Parser[IdentifierStart] = - (underscore.rep0.with1 ~ alpha).map(IdentifierStart.tupled) + (underscore.rep0.with1 ~ alpha).map((IdentifierStart.apply _).tupled) val identifier: Parser[Identifier] = - (identifier_start ~ identifier_chars.rep0).map(Identifier.tupled) + (identifier_start ~ identifier_chars.rep0).map((Identifier.apply _).tupled) val shape_id_member: Parser[ShapeIdMember] = - (Parser.char('$') *> identifier).map(ShapeIdMember) + (Parser.char('$') *> identifier).map(ShapeIdMember(_)) val namespace: Parser[Namespace] = (identifier ~ (Parser.charIn('.') *> identifier).rep0) - .map(Namespace.tupled) + .map((Namespace.apply _).tupled) val absolute_root_shape_id: Parser[AbsoluteRootShapeId] = ((namespace <* Parser.char('#')) ~ identifier) .map { case (ns, id) => AbsoluteRootShapeId.apply(ns, id) } @@ -51,7 +51,7 @@ object ShapeIdParser { .eitherOr(identifier) .map(either => RootShapeId(either.swap)) val shape_id: Parser[ShapeId] = - (root_shape_id ~ shape_id_member.backtrack.?).map(ShapeId.tupled) + (root_shape_id ~ shape_id_member.backtrack.?).map((ShapeId.apply _).tupled) } /* diff --git a/modules/formatter/src/parsers/ShapeParser.scala b/modules/formatter/src/parsers/ShapeParser.scala index b6db292..c49f5ec 100644 --- a/modules/formatter/src/parsers/ShapeParser.scala +++ b/modules/formatter/src/parsers/ShapeParser.scala @@ -83,7 +83,7 @@ object ShapeParser { val enumTypeNames: Set[String] = Set("enum", "intEnum") val simple_type_name: Parser[SimpleTypeName] = - Parser.stringIn(simpleNames).map(SimpleTypeName) + Parser.stringIn(simpleNames).map(SimpleTypeName(_)) val enum_type_name: Parser[String] = Parser.stringIn(enumTypeNames) // see comments on ValueAssignment @@ -134,12 +134,10 @@ object ShapeParser { val explicit_list_member: Parser[ExplicitListMember] = Parser.string("member") *> sp0 *> Parser.charIn(':') *> sp0 *> shape_id - .map( - ExplicitListMember - ) + .map(ExplicitListMember(_)) val elided_list_member: Parser[ElidedListMember] = - shape_id_member.map(ElidedListMember) + shape_id_member.map(ElidedListMember(_)) val list_member: Parser[ListMember] = (trait_statements.with1.soft ~ (explicit_list_member.backtrack | elided_list_member)) @@ -173,17 +171,15 @@ object ShapeParser { object map_parsers { val elided_map_key: Parser[ElidedMapKey] = - shape_id_member.map(ElidedMapKey) + shape_id_member.map(ElidedMapKey(_)) val explicit_map_key: Parser[ExplicitMapKey] = - Parser.string("key") *> sp0 *> colon *> sp0 *> shape_id.map( - ExplicitMapKey - ) + Parser.string("key") *> sp0 *> colon *> sp0 *> + shape_id.map(ExplicitMapKey(_)) val elided_map_value: Parser[ElidedMapValue] = - shape_id_member.map(ElidedMapValue) + shape_id_member.map(ElidedMapValue(_)) val explicit_map_value: Parser[ExplicitMapValue] = - Parser.string("value") *> sp0 *> colon *> sp0 *> shape_id.map( - ExplicitMapValue - ) + Parser.string("value") *> sp0 *> colon *> sp0 *> + shape_id.map(ExplicitMapValue(_)) val map_value: Parser[MapValue] = (trait_statements.?.with1.soft ~ (explicit_map_value.backtrack | elided_map_value)) .map { case (traits, member) => @@ -210,9 +206,9 @@ object ShapeParser { object structure_parsers { val explicit_structure_member: Parser[ExplicitStructureMember] = ((identifier <* sp0 <* Parser.charIn(':') <* sp0) ~ shape_id) - .map(ExplicitStructureMember.tupled) + .map((ExplicitStructureMember.apply _).tupled) val elided_structure_member: Parser[ElidedStructureMember] = - (Parser.charIn('$') *> identifier).map(ElidedStructureMember) + (Parser.charIn('$') *> identifier).map(ElidedStructureMember(_)) val structure_member: Parser[StructureMember] = { ((explicit_structure_member.backtrack | elided_structure_member) ~ value_assigments.backtrack.?) .map { case (member, va) => @@ -231,7 +227,7 @@ object ShapeParser { } val structure_resource: Parser[StructureResource] = (sp0.with1 *> Parser.string("for") *> sp0 *> shape_id) - .map(StructureResource) + .map(StructureResource(_)) val structure_statement: Parser[StructureStatement] = (Parser.string( "structure" ) *> sp0 *> identifier ~ structure_resource.backtrack.? ~ mixinBT.? ~ ws ~ structure_members) @@ -243,7 +239,7 @@ object ShapeParser { object union_parsers { val union_member: Parser[UnionMember] = (structure_parsers.explicit_structure_member | structure_parsers.elided_structure_member) - .map(UnionMember) + .map(UnionMember(_)) val union_members: Parser[UnionMembers] = (openCurly *> ws ~ (trait_statements.with1 ~ union_member ~ ws).rep0 <* closeCurly) .map { case (ws0, members) => @@ -347,8 +343,8 @@ object ShapeParser { } } val shape_statement_or_apply: Parser[ShapeStatementsCase] = - shape_statement.map(ShapeStatementCase) | - apply_statement.map(ApplyStatementCase) + shape_statement.map(ShapeStatementCase(_)) | + apply_statement.map(ApplyStatementCase(_)) // The optional trailing BR is not in the spec but it exists in a lot of // files. @@ -366,7 +362,7 @@ object ShapeParser { (Parser.string("use") *> sp *> absolute_root_shape_id ~ br).map { case (arsi, br) => UseStatement(arsi, br) } - val use_section: Parser0[UseSection] = use_statement.rep0.map(UseSection) + val use_section: Parser0[UseSection] = use_statement.rep0.map(UseSection(_)) val shape_section: Parser0[ShapeSection] = (namespace_statement ~ use_section ~ shape_statements.?).?.map { op => ShapeSection(op.map { case ((ns, use), ss) => diff --git a/modules/formatter/src/parsers/SmithyTraitParser.scala b/modules/formatter/src/parsers/SmithyTraitParser.scala index f017fdb..089c1a1 100644 --- a/modules/formatter/src/parsers/SmithyTraitParser.scala +++ b/modules/formatter/src/parsers/SmithyTraitParser.scala @@ -39,13 +39,12 @@ object SmithyTraitParser { // TraitStructureKvp *(*WS TraitStructureKvp) val trait_structure: Parser[TraitStructure] = (trait_structure_kvp ~ (ws.with1 ~ trait_structure_kvp).backtrack.rep0) - .map(TraitStructure.tupled) + .map((TraitStructure.apply _).tupled) // trait_structure / node_value val strait_body_value: Parser0[SmithyTraitBodyValue] = - trait_structure.backtrack.map(SmithyTraitStructureCase) | node_value.map( - NodeValueCase - ) + trait_structure.backtrack.map(SmithyTraitStructureCase(_)) | + node_value.map(NodeValueCase(_)) // "(" ws trait_body_value ws ")" val strait_body: Parser0[TraitBody] = ((openParentheses *> ws ~ strait_body_value.? ~ ws) <* closeParentheses) @@ -54,7 +53,9 @@ object SmithyTraitParser { } // "@" shape_id [trait_body] val strait: Parser[SmithyTrait] = - Parser.char('@') *> (shape_id ~ strait_body.?).map { SmithyTrait.tupled } + Parser.char('@') *> (shape_id ~ strait_body.?).map { + (SmithyTrait.apply _).tupled + } // *(ws trait) ws val trait_statements: Parser0[TraitStatements] = ((ws.with1 ~ strait).backtrack.rep0 ~ ws).map { case (traits, ws) => @@ -73,7 +74,7 @@ object SmithyTraitParser { ApplyStatementBlock(a, b, c) } val apply_statement: Parser[ApplyStatement] = - apply_block.backtrack.eitherOr(apply_singular).map(ApplyStatement) + apply_block.backtrack.eitherOr(apply_singular).map(ApplyStatement(_)) } diff --git a/modules/formatter/src/parsers/WhitespaceParser.scala b/modules/formatter/src/parsers/WhitespaceParser.scala index d4e038c..0ac85b9 100644 --- a/modules/formatter/src/parsers/WhitespaceParser.scala +++ b/modules/formatter/src/parsers/WhitespaceParser.scala @@ -51,6 +51,6 @@ object WhitespaceParser { .rep0 .map(_.flatMap(_.swap.toOption.flatMap(_.swap.toOption))) .map(_.flatMap(_.toOption)) - .map(Whitespace) + .map(Whitespace(_)) } diff --git a/modules/json-schema/src/internals/Extractors.scala b/modules/json-schema/src/internals/Extractors.scala index baeb45e..c6c8506 100644 --- a/modules/json-schema/src/internals/Extractors.scala +++ b/modules/json-schema/src/internals/Extractors.scala @@ -84,7 +84,7 @@ private[json_schema] object Extractors { else Some(PDouble) val (typedMin, typedMax): (Double, Double) = prim match { - case Some(PInt) => (Int.MinValue, Int.MaxValue) + case Some(PInt) => (Int.MinValue.toDouble, Int.MaxValue.toDouble) case _ => (Double.MinValue, Double.MaxValue) } @@ -127,7 +127,7 @@ private[json_schema] object Extractors { // type: string case (s: StringSchema) => val pattern = - Option(s.getPattern()).map(_.pattern()).map(Hint.Pattern) + Option(s.getPattern()).map(_.pattern()).map(Hint.Pattern(_)) val max = Option(s.getMaxLength()).map(n => n.longValue()) val min = Option(s.getMinLength()).map(n => n.longValue()) val length = @@ -296,7 +296,7 @@ private[json_schema] object Extractors { case other => other } .map(GetExtensions.anyToNode) - .map(Hint.DefaultValue) + .map(Hint.DefaultValue(_)) List(description, default, current, target).flatten ++ extensions } diff --git a/modules/json-schema/src/internals/JsonSchemaToIModel.scala b/modules/json-schema/src/internals/JsonSchemaToIModel.scala index 0361703..b59c73b 100644 --- a/modules/json-schema/src/internals/JsonSchemaToIModel.scala +++ b/modules/json-schema/src/internals/JsonSchemaToIModel.scala @@ -293,7 +293,7 @@ private class JsonSchemaToIModel[F[_]: Parallel: TellShape: TellError]( private implicit class WithDescriptionSyntax(p: OpenApiPattern[Local]) { def withDescription(local: Local): OpenApiPattern[Local] = { val maybeDesc = - Option(local.schema.getDescription()).map(Hint.Description).toList + Option(local.schema.getDescription()).map(Hint.Description(_)).toList p.mapContext(_.addHints(maybeDesc, retainTopLevel = true)) } } diff --git a/modules/readme-validator/src/ReadmeParser.scala b/modules/readme-validator/src/ReadmeParser.scala index 1c75bcd..571ee15 100644 --- a/modules/readme-validator/src/ReadmeParser.scala +++ b/modules/readme-validator/src/ReadmeParser.scala @@ -69,15 +69,15 @@ object ReadmeParser { val openapiSection = sectionParser(openapiHeader, smithyHeader) .map(_.map(_.head)) - .map(Example.OpenApi.tupled) + .map(Example.(OpenApi.apply _).tupled) val jsonSection = sectionParser(jsonHeader, smithyHeader) .map(_.map(_.head)) - .map(Example.JsonSchema.tupled) + .map(Example.(JsonSchema.apply _).tupled) val protoSection = sectionParser(smithyHeader, protoHeader) .map(_.map(_.head)) - .map(Example.Proto.tupled) + .map(Example.(Proto.apply _).tupled) val section = openapiSection.backtrack .orElse(jsonSection) .backtrack