Skip to content

Commit

Permalink
Merge branch 'main' into antlr
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Jul 17, 2024
2 parents 712d295 + 3fd962d commit e7c1f91
Show file tree
Hide file tree
Showing 108 changed files with 1,817 additions and 675 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ jobs:
timeout-minutes: 30
steps:

- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v4.1.1

- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23

- uses: cachix/cachix-action@v12
with:
name: kubukoz
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Cache sbt
uses: actions/[email protected].1
uses: actions/[email protected].2
with:
path: |
~/.sbt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v4.1.1
- uses: scalacenter/sbt-dependency-submission@v2
9 changes: 9 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ rewrite {
sort = ascii
}
}

fileOverride {
"glob:**.sbt" {
runner.dialect = sbt1
}
"glob:**/project/**" {
runner.dialect = scala212
}
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ We have:
- booleans: `true`, `false`
- lists: `[ true, false, ]`
- structures: `{ k: "value", k2: true, k3: [ 10, 20, ], }` - note that keys aren't quoted, unlike in JSON
- null, but it's not what you think: the `null` literal only typechecks as a Smithy `Document`,
and corresponds to the [Null document](https://awslabs.github.io/smithy/2.0/spec/simple-types.html?highlight=null#document).
- null, but it's not what you think: the `null` literal only typechecks as two things:
- a Smithy `Document`: corresponds to the [Null document](https://awslabs.github.io/smithy/2.0/spec/simple-types.html?highlight=null#document)
- an element of a sparse collection.

### Type representation

Expand Down
52 changes: 26 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inThisBuild(
)
)

import scala.sys.process._
import scala.sys.process.*

def crossPlugin(
x: sbt.librarymanagement.ModuleID
Expand All @@ -27,29 +27,29 @@ val compilerPlugins =
Nil
else
List(
crossPlugin("org.typelevel" % "kind-projector" % "0.13.2")
crossPlugin("org.typelevel" % "kind-projector" % "0.13.3")
))

ThisBuild / versionScheme := Some("early-semver")

Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / scalaVersion := "2.13.11"
ThisBuild / crossScalaVersions := Seq("2.13.11")
ThisBuild / scalaVersion := "2.13.13"
ThisBuild / crossScalaVersions := Seq("2.13.13")

// For coursier's "latest.integration"
ThisBuild / dynverSeparator := "-"

val commonSettings = Seq(
organization := "com.kubukoz.playground",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.9.0",
"org.typelevel" %% "cats-mtl" % "1.3.1",
"com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test,
"com.softwaremill.diffx" %% "diffx-core" % "0.8.3" % Test,
"com.softwaremill.diffx" %% "diffx-cats" % "0.8.3" % Test,
"org.typelevel" %% "cats-core" % "2.12.0",
"org.typelevel" %% "cats-mtl" % "1.4.0",
"com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.4" % Test,
"com.softwaremill.diffx" %% "diffx-core" % "0.9.0" % Test,
"com.softwaremill.diffx" %% "diffx-cats" % "0.9.0" % Test,
),
compilerPlugins,
scalacOptions -= "-Xfatal-warnings",
Expand Down Expand Up @@ -95,10 +95,10 @@ lazy val source = module("source")
lazy val parser = module("parser")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-parse" % "0.3.10",
"io.circe" %% "circe-generic" % "0.14.5" % Test,
"io.circe" %% "circe-parser" % "0.14.5" % Test,
"co.fs2" %% "fs2-io" % "3.8.0" % Test,
"org.typelevel" %% "cats-parse" % "1.0.0",
"io.circe" %% "circe-generic" % "0.14.9" % Test,
"io.circe" %% "circe-parser" % "0.14.9" % Test,
"co.fs2" %% "fs2-io" % "3.10.2" % Test,
)
)
.enablePlugins(Antlr4Plugin)
Expand All @@ -116,7 +116,7 @@ lazy val parser = module("parser")
lazy val formatter = module("formatter")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "paiges-cats" % "0.4.3"
"org.typelevel" %% "paiges-cats" % "0.4.4"
)
)
.dependsOn(
Expand All @@ -130,14 +130,14 @@ lazy val formatter = module("formatter")
lazy val core = module("core")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.5.1",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.2",
"org.typelevel" %% "cats-effect" % "3.5.4",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.7",
"com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.2.3" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.34.0" % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.3.10" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.50.0" % Test,
),
Smithy4sCodegenPlugin.defaultSettings(Test),
)
Expand All @@ -158,12 +158,12 @@ lazy val languageSupport = module("language-support")
lazy val lsp = module("lsp")
.settings(
libraryDependencies ++= Seq(
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.0",
"io.circe" %% "circe-core" % "0.14.5",
"org.http4s" %% "http4s-ember-client" % "0.23.23",
"org.http4s" %% "http4s-ember-server" % "0.23.23" % Test,
"io.get-coursier" %% "coursier" % "2.1.5",
"org.typelevel" %% "cats-tagless-macros" % "0.15.0",
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1",
"io.circe" %% "circe-core" % "0.14.9",
"org.http4s" %% "http4s-ember-client" % "0.23.27",
"org.http4s" %% "http4s-ember-server" % "0.23.27" % Test,
"io.get-coursier" %% "coursier" % "2.1.10",
"org.typelevel" %% "cats-tagless-macros" % "0.16.2",
),
buildInfoPackage := "playground.lsp.buildinfo",
buildInfoKeys ++= Seq(version, scalaBinaryVersion),
Expand Down
30 changes: 24 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
devShell = pkgs.mkShell {
buildInputs = [
pkgs.yarn
pkgs.nodejs-14_x
pkgs.nodejs
pkgs.sbt
pkgs.jless
pkgs.gnupg
Expand Down
4 changes: 2 additions & 2 deletions modules/ast/src/main/scala/playground/smithyql/AST.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import cats.Functor
import cats.Id
import cats.Show
import cats.data.NonEmptyList
import cats.implicits._
import cats.kernel.Eq
import cats.kernel.Order
import cats.syntax.all.*
import cats.~>

/** The main type for AST nodes of SmithyQL. The type parameter `F[_]` is a type constructor that
Expand Down Expand Up @@ -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)

}
Expand Down
2 changes: 1 addition & 1 deletion modules/ast/src/main/scala/playground/smithyql/DSL.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package playground.smithyql

import cats.Id
import cats.implicits._
import cats.syntax.all.*

object DSL {

Expand Down
6 changes: 3 additions & 3 deletions modules/ast/src/test/scala/playground/Assertions.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package playground

import cats.Id
import cats.implicits._
import cats.syntax.all.*
import com.softwaremill.diffx.Diff
import com.softwaremill.diffx.ShowConfig
import playground.smithyql._
import playground.smithyql.*
import weaver.Expectations
import weaver.SourceLocation

Expand All @@ -23,7 +23,7 @@ object Assertions extends Expectations.Helpers {
val stringWithResets = d.show()(conf).linesWithSeparators.map(Console.RESET + _).mkString

failure(
s"Diff failed:\n${Console.RESET}(${conf.right("expected")}, ${conf.left("actual")})\n\n" + stringWithResets
s"Diff failed:\n${Console.RESET}(${conf.left("expected")}, ${conf.right("actual")})\n\n" + stringWithResets
)
}

Expand Down
16 changes: 10 additions & 6 deletions modules/core/src/main/scala/playground/CompilationError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package playground
import cats.Id
import cats.data.IorNel
import cats.data.NonEmptyList
import cats.implicits._
import playground.CompilationErrorDetails._
import playground.smithyql._
import cats.kernel.Eq
import cats.kernel.Order.catsKernelOrderingForOrder
import cats.syntax.all.*
import playground.CompilationErrorDetails.*
import playground.smithyql.*
import playground.smithyql.format.Formatter
import smithy.api.TimestampFormat
import smithy4s.ShapeId
Expand All @@ -19,8 +21,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 {
Expand Down Expand Up @@ -69,6 +71,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
Expand Down Expand Up @@ -145,7 +149,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(", ")}."
Expand Down
Loading

0 comments on commit e7c1f91

Please sign in to comment.