From 3c252f57effc9a01062f69ba5e868e36badbd585 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 3 Feb 2021 18:50:28 +0100 Subject: [PATCH] Disable some SessionTests in Scala 3 --- .../scala/ammonite/shell/SessionTests.scala | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/shell/src/test/scala/ammonite/shell/SessionTests.scala b/shell/src/test/scala/ammonite/shell/SessionTests.scala index 3b64a8a49..ed7443e30 100644 --- a/shell/src/test/scala/ammonite/shell/SessionTests.scala +++ b/shell/src/test/scala/ammonite/shell/SessionTests.scala @@ -57,7 +57,7 @@ object SessionTests extends TestSuite{ """) } - test("cdIntoDirSymlink"){ + def cdIntoDirSymlinkTest() = { check.session( s""" @ import ammonite.ops._ @@ -85,8 +85,21 @@ object SessionTests extends TestSuite{ @ rm! tmpdir """) } + test("cdIntoDirSymlink"){ + // Getting weird errors in Scala 3: + // java.lang.AssertionError: assertion failed: os.BasePathImpl & os.FilePath / + // TypeRef(ThisType(TypeRef(NoPrefix,module class os)),trait BasePathImpl) & + // HKTypeLambda(List(CC), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class + // scala)),class Nothing),HKTypeLambda(List(_), List(TypeBounds(TypeRef(ThisType(TypeRef( + // NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module + // class scala)),class Any))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class + // Any), List()))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class os)),trait + // FilePath),List(TypeParamRef(CC)))) + if (scala2) cdIntoDirSymlinkTest() + else "Disabled in Scala 3" + } - test("nestedSymlinks"){ + def nestedSymlinksTest() = { check.session( s""" @ import ammonite.ops._ @@ -132,7 +145,21 @@ object SessionTests extends TestSuite{ @ rm! tmpdir """) } - test("opsInSymlinkedDir"){ + test("nestedSymlinks"){ + // Disabled in Scala 3, it seems the Path -> FilePath conversion in the `ln.s` calls + // triggers an assertion in dotty: + // java.lang.AssertionError: assertion failed: os.BasePathImpl & os.FilePath / TypeRef( + // ThisType(TypeRef(NoPrefix,module class os)),trait BasePathImpl) & HKTypeLambda(List(CC), + // List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing), + // HKTypeLambda(List(_), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class + // scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any + // ))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any), List()))), + // AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class os)),trait FilePath),List( + // TypeParamRef(CC)))) + if (scala2) nestedSymlinksTest() + else "Disabled in Scala 3" + } + def opsInSymlinkedDir() = { // test mkdir, write, read, stat/stat.full, cp, and ls inside a symlinked directory // (both while wd = symlinked and outside) check.session( @@ -226,6 +253,11 @@ object SessionTests extends TestSuite{ @ rm! tmpdir """) } + test("opsInSymlinkedDir"){ + // Just like nestedSymlinks, getting some weird error in Scala 3 + if (scala2) opsInSymlinkedDir() + else "Disabled in Scala 3" + } } }