Skip to content

Commit

Permalink
Deprecate with type operator in 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Nov 3, 2023
1 parent 8c602b3 commit d9f5d28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
/** mods object name impl */
case class ModuleDef(name: TermName, impl: Template)(implicit @constructorOnly src: SourceFile)
extends MemberDef {
type ThisTree[+T <: Untyped] <: Trees.NameTree[T] with Trees.MemberDef[T] with ModuleDef
type ThisTree[+T <: Untyped] <: Trees.NameTree[T] & Trees.MemberDef[T] & ModuleDef
def withName(name: Name)(using Context): ModuleDef = cpy.ModuleDef(this)(name.toTermName, impl)
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/config/CliCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.PartialFunction.cond

trait CliCommand:

type ConcreteSettings <: CommonScalaSettings with Settings.SettingGroup
type ConcreteSettings <: CommonScalaSettings & Settings.SettingGroup

def versionMsg: String

Expand Down
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1756,11 +1756,12 @@ object Parsers {
if in.token == LBRACE || in.token == INDENT then
t
else
report.errorOrMigrationWarning(
DeprecatedWithOperator(rewriteNotice(`future-migration`)),
report.gradualErrorOrMigrationWarning(
DeprecatedWithOperator(rewriteNotice(`3.4-migration`)),
in.sourcePos(withOffset),
from = future)
if sourceVersion == `future-migration` then
warnFrom = `3.4`,
errorFrom = future)
if sourceVersion.isAtLeast(`3.4-migration`) then
patch(source, Span(withOffset, withOffset + 4), "&")
atSpan(startOffset(t)) { makeAndType(t, withType()) }
else t
Expand Down

0 comments on commit d9f5d28

Please sign in to comment.