Skip to content

Commit 2cd7028

Browse files
committed
Treat new style given syntax without a rhs or template as concrete
To make an abstract given with new style syntax, one needs to write `= deferred`.
1 parent 62d08e3 commit 2cd7028

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,7 +4159,7 @@ object Parsers {
41594159
ValDef(name, parents.head, subExpr())
41604160
else
41614161
DefDef(name, adjustDefParams(joinParams(tparams, vparamss)), parents.head, subExpr())
4162-
else if (isStatSep || isStatSeqEnd) && parentsIsType then
4162+
else if (isStatSep || isStatSeqEnd) && parentsIsType && !newSyntaxAllowed then
41634163
if name.isEmpty then
41644164
syntaxError(em"anonymous given cannot be abstract")
41654165
DefDef(name, adjustDefParams(joinParams(tparams, vparamss)), parents.head, EmptyTree)

tests/neg/deferred-givens.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//> using options -YXtypeclass -source future
1+
//> using options -language:experimental.modularity -source future
22
class Ctx
33
class Ctx2
44

tests/pos/hylolib/Integers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ given Int is Comparable:
4343

4444
def lt(other: Int): Boolean = self < other
4545

46-
given Int is StringConvertible {}
46+
given Int is StringConvertible

0 commit comments

Comments
 (0)