Skip to content

Commit

Permalink
Merge branch 'master' into feature/string-interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvgt committed Jan 21, 2025
2 parents 0aa6431 + 719ae83 commit e7c16c7
Show file tree
Hide file tree
Showing 103 changed files with 5,351 additions and 2,204 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,94 @@ env:
NODE_VERSION: '16.x'

jobs:
check-release-needed:
name: Check if release is needed
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: 0 # Need full history for tags

- name: Verify repository state
run: |
# Ensure we're on master
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "master" ]; then
echo "ERROR: Not on master branch! Current branch: $current_branch"
exit 1
fi
# Ensure we have tags
if ! git tag | grep -q '^v'; then
echo "ERROR: No version tags found in repository!"
exit 1
fi
# Get the latest commit
latest_commit=$(git rev-parse HEAD)
echo "Latest commit: $latest_commit"
# Get all tags on the latest commit
tags_on_commit=$(git tag --points-at $latest_commit)
echo "Tags on latest commit:"
echo "$tags_on_commit"
# Check for version tags
if echo "$tags_on_commit" | grep -q '^v'; then
echo "Latest commit already has a version tag. Details:"
echo "$tags_on_commit" | grep '^v'
echo "No new release needed."
exit 1
fi
# Get the most recent version tag
previous_version=$(git tag --sort=-v:refname | grep '^v' | head -n1)
if [ -z "$previous_version" ]; then
echo "ERROR: Could not determine previous version!"
exit 1
fi
echo "Previous version: $previous_version"
# Check what files changed since last release
echo "Changes since $previous_version:"
changes_all=$(git diff --name-only $previous_version HEAD)
echo "$changes_all"
# Check if only .github files changed
changes_non_github=$(echo "$changes_all" | grep -v '^\.github/')
if [ -z "$changes_non_github" ]; then
echo "Only .github files changed since $previous_version. No release needed."
exit 1
fi
# Verify the previous release commit message
prev_release_commit=$(git rev-list -n 1 $previous_version)
prev_commit_msg=$(git log -1 --format=%B $prev_release_commit)
prev_version_number=${previous_version#v} # Remove 'v' prefix
expected_msg="Bump version to $prev_version_number"
if [ "$prev_commit_msg" != "$expected_msg" ]; then
echo "WARNING: Previous release commit message doesn't match expected format"
echo "Expected: $expected_msg"
echo "Found: $prev_commit_msg"
# Not failing here as this is just a warning
fi
# Verify previous release was made by the bot
prev_release_author=$(git log -1 --format='%ae' $prev_release_commit)
if ! echo "$prev_release_author" | grep -q "effekt-updater\[bot\]@users.noreply.github.com"; then
echo "WARNING: Previous release wasn't made by effekt-updater[bot]"
echo "Author: $prev_release_author"
# Not failing here as this is just a warning
fi
echo "All checks passed. Release is needed!"
run-tests: # redux of usual CI defined in `ci.yml`
name: Run tests
needs: [check-release-needed]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
15 changes: 12 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ lazy val replDependencies = Seq(
)

lazy val lspDependencies = Seq(
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.12.0",
"com.google.code.gson" % "gson" % "2.8.9"
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1"
)

lazy val testingDependencies = Seq(
Expand All @@ -63,7 +62,8 @@ lazy val kiama: CrossProject = crossProject(JSPlatform, JVMPlatform).in(file("ki
name := "kiama"
)
.jvmSettings(
libraryDependencies ++= (replDependencies ++ lspDependencies)
libraryDependencies ++= (replDependencies ++ lspDependencies ++ testingDependencies),
testFrameworks += new TestFramework("utest.runner.Framework")
)

lazy val root = project.in(file("effekt"))
Expand Down Expand Up @@ -116,6 +116,15 @@ lazy val effekt: CrossProject = crossProject(JSPlatform, JVMPlatform).in(file("e

assembly / assemblyJarName := "effekt.jar",

// there is a conflict between the two transitive dependencies "gson:2.11.0"
// and "error_prone_annotations:2.27.0", so we need the merge strategy here for `sbt install`
assembly / assemblyMergeStrategy := {
case PathList("META-INF", "versions", "9", "module-info.class") => MergeStrategy.first
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
},

// we use the lib folder as resource directory to include it in the JAR
Compile / unmanagedResourceDirectories += (ThisBuild / baseDirectory).value / "libraries",

Expand Down
7 changes: 6 additions & 1 deletion effekt/jvm/src/main/scala/effekt/Runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,16 @@ object JSWebRunner extends Runner[String] {
| <script type="text/javascript">
| window.onload=${mainName};
| </script>
| <div id="app"></div>
| </body>
|</html>
|""".stripMargin
IO.createFile(htmlFilePath, htmlContent, false)
C.abort(s"Open file://${htmlFilePath} in your browser or include ${jsFilePath}.")

// TODO: In ErrorReporter, add a way to terminate the program with a message, but not report a exit failure.
// Workaround: print and then 'exit(0)'
println(s"Open file://${htmlFilePath} in your browser or include ${jsFilePath}.")
scala.sys.exit(0)
}

trait ChezRunner extends Runner[String] {
Expand Down
28 changes: 2 additions & 26 deletions effekt/jvm/src/main/scala/effekt/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import effekt.core.PrettyPrinter
import effekt.source.{ FunDef, Hole, ModuleDecl, Tree }
import effekt.util.{ PlainMessaging, getOrElseAborting }
import effekt.util.messages.EffektError

import kiama.util.{ Filenames, Position, Services, Source }
import kiama.util.{ Filenames, Notebook, NotebookCell, Position, Services, Source }
import kiama.output.PrettyPrinterTypes.Document

import org.eclipse.lsp4j.{ Diagnostic, DocumentSymbol, SymbolKind, ExecuteCommandParams }
import org.eclipse.lsp4j.{ Diagnostic, DocumentSymbol, ExecuteCommandParams, SymbolKind }

/**
* effekt.Intelligence <--- gathers information -- LSPServer --- provides LSP interface ---> kiama.Server
Expand Down Expand Up @@ -95,28 +93,6 @@ trait LSPServer extends kiama.util.Server[Tree, EffektConfig, EffektError] with
info <- getHoleInfo(tree)(context)
} yield info

// The implementation in kiama.Server does not support file sources
def toURI(filename: String): String = {
if (filename startsWith "file://")
filename
else
if (filename startsWith "./")
"file://" ++ Filenames.cwd() ++ "/" ++ Filenames.dropPrefix(filename, ".")
else
s"file://$filename"
}

override def locationOfNode(node: Tree): Location = {
(positions.getStart(node), positions.getFinish(node)) match {
case (start @ Some(st), finish @ Some(_)) =>
val s = convertPosition(start)
val f = convertPosition(finish)
new Location(toURI(st.source.name), new LSPRange(s, f))
case _ =>
null
}
}

def positionToLocation(p: Position): Location = {
val s = convertPosition(Some(p))
new Location(p.source.name, new LSPRange(s, s))
Expand Down
9 changes: 8 additions & 1 deletion effekt/jvm/src/test/scala/effekt/ChezSchemeTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ abstract class ChezSchemeTests extends EffektTests {
examplesDir / "pos" / "bidirectional",
examplesDir / "pos" / "object",
examplesDir / "pos" / "type_omission_op.effekt",

// filesystem operations and bytearrays are not yet supported in our Chez backend
examplesDir / "benchmarks" / "input_output" / "word_count_ascii.effekt",
examplesDir / "benchmarks" / "input_output" / "word_count_utf8.effekt",
examplesDir / "benchmarks" / "input_output" / "dyck_one.effekt",
examplesDir / "benchmarks" / "input_output" / "number_matrix.effekt",

// unsafe continuations are not yet supported in our Chez backend
examplesDir / "pos" / "unsafe_cont.effekt",
Expand Down Expand Up @@ -55,9 +59,12 @@ abstract class ChezSchemeTests extends EffektTests {

examplesDir / "pos" / "io", // async io is only implemented for monadic JS

examplesDir / "pos" / "genericcompare.effekt", // genericCompare is only implemented for JS

examplesDir / "pos" / "issue429.effekt",

// Generic comparison
examplesDir / "pos" / "genericcompare.effekt",
examplesDir / "pos" / "issue733.effekt",
)
}

Expand Down
20 changes: 10 additions & 10 deletions effekt/jvm/src/test/scala/effekt/EffektTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ trait EffektTests extends munit.FunSuite {
case f if f.isDirectory && !ignored.contains(f) =>
f.listFiles.foreach(foreachFileIn(_)(test))
case f if f.getName.endsWith(".effekt") || f.getName.endsWith(".effekt.md") =>
val path = f.getParentFile
val baseName = f.getName.stripSuffix(".md").stripSuffix(".effekt")

if (ignored.contains(f)) {
ignored.contains(f)
} else {
val checkfile = path / (baseName + ".check")
val expected = if checkfile.exists() then Some(IO.read(checkfile)) else None

test(f, expected)
if (!ignored.contains(f)) {
test(f, expectedResultFor(f))
}
case _ => ()
}

runTests()
}

def expectedResultFor(f: File): Option[String] = {
val path = f.getParentFile
val baseName = f.getName.stripSuffix(".md").stripSuffix(".effekt")
val checkfile = path / (baseName + ".check")
if checkfile.exists() then Some(IO.read(checkfile)) else None
}

21 changes: 6 additions & 15 deletions effekt/jvm/src/test/scala/effekt/LLVMTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,9 @@ class LLVMTests extends EffektTests {
lazy val bugs: List[File] = List(
// names not sanitized (even?)
examplesDir / "pos" / "special_names.effekt",

// sanitizer/valgrind: segfault
examplesDir / "pos" / "parametrized.effekt",

// Valgrind leak, unclear
examplesDir / "llvm" / "polymorphism_map.effekt",
examplesDir / "pos" / "type_parameters_blocks.effekt",

// Valgrind leak in array_new
examplesDir / "benchmarks" / "are_we_fast_yet" / "sieve.effekt",
examplesDir / "benchmarks" / "are_we_fast_yet" / "nbody.effekt",
examplesDir / "benchmarks" / "are_we_fast_yet" / "bounce.effekt", // + c_ref_fresh
examplesDir / "benchmarks" / "are_we_fast_yet" / "towers.effekt",
examplesDir / "benchmarks" / "are_we_fast_yet" / "permute.effekt",
examplesDir / "benchmarks" / "are_we_fast_yet" / "queens.effekt",
// Jump to the invalid address stated on the next line
examplesDir / "benchmarks" / "input_output" / "dyck_one.effekt",
examplesDir / "benchmarks" / "input_output" / "number_matrix.effekt",
examplesDir / "benchmarks" / "input_output" / "word_count_ascii.effekt",
examplesDir / "benchmarks" / "input_output" / "word_count_utf8.effekt",
)
Expand Down Expand Up @@ -94,6 +82,9 @@ class LLVMTests extends EffektTests {

// Generic equality
examplesDir / "pos" / "issue429.effekt",

// Generic comparison
examplesDir / "pos" / "issue733.effekt",
)

override lazy val ignored: List[File] = bugs ++ missingFeatures
Expand Down
3 changes: 3 additions & 0 deletions effekt/jvm/src/test/scala/effekt/RecursiveDescentTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ class RecursiveDescentTests extends munit.FunSuite {
)
parseExpr("box { (x: Int) => x }")
parseExpr("box new Fresh { def fresh() = \"42\" }")
parseExpr("box foo()")
parseExpr("box bar(1)")
parseExpr("box baz(quux)")

// { f } is parsed as a capture set and not backtracked.
intercept[Throwable] { parseExpr("box { f }") }
Expand Down
17 changes: 2 additions & 15 deletions effekt/jvm/src/test/scala/effekt/StdlibTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,8 @@ class StdlibLLVMTests extends StdlibTests {
// Syscall param write(buf) points to uninitialised byte(s)
examplesDir / "stdlib" / "io" / "filesystem" / "files.effekt",
examplesDir / "stdlib" / "io" / "filesystem" / "async_file_io.effekt",
examplesDir / "stdlib" / "io" / "filesystem" / "files.effekt",

// Conditional jump or move depends on uninitialised value(s)
examplesDir / "stdlib" / "io" / "filesystem" / "wordcount.effekt",
examplesDir / "stdlib" / "io" / "time.effekt",
examplesDir / "stdlib" / "list" / "flatmap.effekt",
examplesDir / "stdlib" / "list" / "zip.effekt",
examplesDir / "stdlib" / "list" / "deleteat.effekt",
examplesDir / "stdlib" / "list" / "join.effekt",
examplesDir / "stdlib" / "list" / "modifyat.effekt",
examplesDir / "stdlib" / "list" / "updateat.effekt",
examplesDir / "stdlib" / "list" / "insert.effekt",
examplesDir / "stdlib" / "list" / "fill.effekt",
examplesDir / "stdlib" / "list" / "zipwith.effekt",
examplesDir / "stdlib" / "list" / "collect.effekt",
examplesDir / "stdlib" / "list" / "build.effekt",
examplesDir / "stdlib" / "string" / "strings.effekt",
examplesDir / "stdlib" / "string" / "unicode.effekt",
)
}
39 changes: 0 additions & 39 deletions effekt/jvm/src/test/scala/effekt/core/LambdaLiftingTests.scala

This file was deleted.

Loading

0 comments on commit e7c16c7

Please sign in to comment.