Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3425,14 +3425,16 @@ object Parsers {
else mods.withPrivateWithin(ident().toTypeName)
}
if mods1.is(Local) then
val span = Span(startOffset, in.lastOffset)
val p = if mods1.is(Private) then "private" else "protected"
report.errorOrMigrationWarning(
em"""Ignoring [this] qualifier.
|This syntax will be deprecated in the future; it should be dropped.
|The syntax `$p[this]` will be deprecated in the future; just write `$p` instead.
|See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html${rewriteNotice(`3.4-migration`)}""",
in.sourcePos(),
in.sourcePos().withSpan(span),
MigrationVersion.RemoveThisQualifier)
if MigrationVersion.RemoveThisQualifier.needsPatch then
patch(source, Span(startOffset, in.lastOffset), "")
patch(source, span, "")
mods1
}
else mods
Expand Down
32 changes: 16 additions & 16 deletions tests/semanticdb/metac.expect
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ Occurrences:
[9:11..9:14): ??? -> scala/Predef.`???`().

Diagnostics:
[4:16..4:16): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[4:9..4:15): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[7:18..7:18): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[7:11..7:17): [warning] Ignoring [this] qualifier.
The syntax `protected[this]` will be deprecated in the future; just write `protected` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.

Expand Down Expand Up @@ -823,13 +823,13 @@ Occurrences:
Diagnostics:
[13:20..13:21): [warning] unused explicit parameter
[18:9..18:10): [warning] unused explicit parameter
[20:23..20:23): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[20:16..20:22): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[20:27..20:28): [warning] unused explicit parameter
[22:23..22:23): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[22:16..22:22): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[22:27..22:28): [warning] unused explicit parameter
Expand Down Expand Up @@ -4553,20 +4553,20 @@ Occurrences:

Diagnostics:
[2:20..2:21): [warning] unused explicit parameter
[5:16..5:16): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[5:9..5:15): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[7:16..7:16): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[7:9..7:15): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[12:16..12:16): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[12:9..12:15): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.
[13:16..13:16): [warning] Ignoring [this] qualifier.
This syntax will be deprecated in the future; it should be dropped.
[13:9..13:15): [warning] Ignoring [this] qualifier.
The syntax `private[this]` will be deprecated in the future; just write `private` instead.
See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
This construct can be rewritten automatically under -rewrite -source 3.4-migration.

Expand Down
24 changes: 12 additions & 12 deletions tests/warn/private-this-3.4.check
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-- Warning: tests/warn/private-this-3.4.scala:4:16 ---------------------------------------------------------------------
-- Warning: tests/warn/private-this-3.4.scala:4:9 ----------------------------------------------------------------------
4 | private[this] def foo: Int = ??? // warn: migration warning
| ^
| Ignoring [this] qualifier.
| This syntax will be deprecated in the future; it should be dropped.
| See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
| This construct can be rewritten automatically under -rewrite -source 3.4-migration.
-- Warning: tests/warn/private-this-3.4.scala:5:18 ---------------------------------------------------------------------
| ^^^^^^
| Ignoring [this] qualifier.
| The syntax `private[this]` will be deprecated in the future; just write `private` instead.
| See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
| This construct can be rewritten automatically under -rewrite -source 3.4-migration.
-- Warning: tests/warn/private-this-3.4.scala:5:11 ---------------------------------------------------------------------
5 | protected[this] def bar: Int = ??? // warn: migration warning
| ^
| Ignoring [this] qualifier.
| This syntax will be deprecated in the future; it should be dropped.
| See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
| This construct can be rewritten automatically under -rewrite -source 3.4-migration.
| ^^^^^^
| Ignoring [this] qualifier.
| The syntax `protected[this]` will be deprecated in the future; just write `protected` instead.
| See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
| This construct can be rewritten automatically under -rewrite -source 3.4-migration.
Loading