Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New linter option : -Xlint:private-shadow #17643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schuetzcarl opened this issue Mar 31, 2023 · 0 comments
Closed

New linter option : -Xlint:private-shadow #17643

schuetzcarl opened this issue Mar 31, 2023 · 0 comments

Comments

@schuetzcarl
Copy link
Contributor

schuetzcarl commented Mar 31, 2023

In the scope of my Bachelor Project supervised by @anatoliykmetyuk,
I would like to add for dotty an equivalent lint warning as the -Xlint:private-shadow of Scala 2.

It would warn about a private field or a class parameter that shadows a superclass field.

Here is a more concrete example from the Scala 2 issue ( scala/bug#4762 ) :

class Base(var x : Int):
	def increment() =
		x = x + 1

class Derived(x : Int) extends Base(x):
	override def toString = 
		x.toString

val derived = new Derived(1)
println(derived.toString)     // yields '1', as expected
derived.increment()
println(derived.toString)     // still '1', probably unexpected
@schuetzcarl schuetzcarl changed the title New linter option : -Wprivate-shadow New linter option : -Xlint:private-shadow Apr 4, 2023
@ckipp01 ckipp01 transferred this issue from lampepfl/dotty-feature-requests May 31, 2023
@scala scala locked and limited conversation to collaborators May 31, 2023
@ckipp01 ckipp01 converted this issue into discussion #17644 May 31, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant