Skip to content

Commit 5c1e5f6

Browse files
bracevactgodzik
authored andcommitted
Disallow context function types as value-class parameters
[Cherry-picked 3ee5b29]
1 parent 9ebb8c4 commit 5c1e5f6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ object Checking {
755755
}
756756
clParamAccessors match {
757757
case param :: params =>
758+
if (defn.isContextFunctionType(param.info))
759+
report.error("value classes are not allowed for context function types", param.srcPos)
758760
if (param.is(Mutable))
759761
report.error(ValueClassParameterMayNotBeAVar(clazz, param), param.srcPos)
760762
if (param.info.isInstanceOf[ExprType])

tests/neg/i22752.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Inner(body: Int ?=> Int) extends AnyVal: // error
2+
def rescue: Int ?=> Int = ???
3+
4+
class Inner2(body: Int => Int) extends AnyVal // ok

0 commit comments

Comments
 (0)