diff --git a/community-build/community-projects/protoquill b/community-build/community-projects/protoquill index 41532f2b193e..23819814ca86 160000 --- a/community-build/community-projects/protoquill +++ b/community-build/community-projects/protoquill @@ -1 +1 @@ -Subproject commit 41532f2b193e00aec49dd2fa46247d6cb0a6b64d +Subproject commit 23819814ca86652b293d480da1f36cfc1c439885 diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 63b6e9f8ac51..fb271ed1a154 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -3619,6 +3619,8 @@ object Parsers { syntaxError(em"anonymous given cannot be abstract") DefDef(name, joinParams(tparams, vparamss), parents.head, EmptyTree) else + if mods.is(Inline) then + syntaxError(i"`inline given` cannot be implemented using a `with`") val tparams1 = tparams.map(tparam => tparam.withMods(tparam.mods | PrivateLocal)) val vparamss1 = vparamss.map(_.map(vparam => vparam.withMods(vparam.mods &~ Param | ParamAccessor | Protected))) diff --git a/tests/neg/i14177a.scala b/tests/neg/i14177a.scala new file mode 100644 index 000000000000..e26d1ad96a0c --- /dev/null +++ b/tests/neg/i14177a.scala @@ -0,0 +1,6 @@ +import scala.compiletime.* + +trait C[A] + +inline given [Tup <: Tuple]: C[Tup] with // error + val cs = summonAll[Tuple.Map[Tup, C]] diff --git a/tests/neg/i14177b.scala b/tests/neg/i14177b.scala new file mode 100644 index 000000000000..aa3c24993e56 --- /dev/null +++ b/tests/neg/i14177b.scala @@ -0,0 +1,15 @@ +class T + +inline given fail1: T with // error + val cs = scala.compiletime.summonAll[EmptyTuple] +inline given fail2[X]: T with // error + val cs = scala.compiletime.summonAll[EmptyTuple] +inline given fail3(using DummyImplicit): T with // error + val cs = scala.compiletime.summonAll[EmptyTuple] + +inline given ok1: T = new T: + val cs = scala.compiletime.summonAll[EmptyTuple] +inline given ok2[X]: T = new T: + val cs = scala.compiletime.summonAll[EmptyTuple] +inline given ok3(using DummyImplicit): T = new T: + val cs = scala.compiletime.summonAll[EmptyTuple]