Skip to content

Commit 3f66eeb

Browse files
committed
Handle Scala 3 syntax for an arity-0 function
1 parent 57cd003 commit 3f66eeb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/test/scala/net/codingwell/scalaguice/TypeLiteralSpec.scala

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ class TypeLiteralSpec extends AnyFunSpec with Matchers {
126126
// Scala 2 represents it as Function1[Function0[Unit],String]
127127
// Scala 3 represents it as just Function1[Unit,String]
128128
typeLiteral[(=> Unit) => String] shouldEqual new TypeLiteral[(=> Unit) => String] {}
129+
// In Scala 3 the parenthesis are not optional, otherwise it isn't a function
130+
typeLiteral[(() => Unit) => String] shouldEqual new TypeLiteral[(() => Unit) => String] {}
131+
typeLiteral[Function1[Function0[Unit],String]] shouldEqual new TypeLiteral[(() => Unit) => String] {}
129132
}
130133

131134
it("should handle complex type") {

0 commit comments

Comments
 (0)