Skip to content
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

Wrong unimplemented members reported #21335

Closed
Duhemm opened this issue Aug 6, 2024 · 0 comments · Fixed by #21337
Closed

Wrong unimplemented members reported #21335

Duhemm opened this issue Aug 6, 2024 · 0 comments · Fixed by #21337

Comments

@Duhemm
Copy link
Contributor

Duhemm commented Aug 6, 2024

Compiler version

3.4.2

Minimized code

trait Foo { def x(): Foo }
trait Bar extends Foo { override def x(): Bar }
class Z extends Bar

Output

-- Error: source.scala:3:6 -----------------------------------------------------
3 |class Z extends Bar
  |      ^
  |      class Z needs to be abstract, since:
  |      it has 2 unimplemented members.
  |      /** As seen from class Z, the missing signatures are as follows.
  |       *  For convenience, these are usable as stub implementations.
  |       */
  |        // Members declared in Bar
  |        override def x(): Bar = ???
  |
  |        // Members declared in Foo
  |        def x(): Foo = ???
1 error found

Expectation

I expected only a single unimplemented member to be reported, override def x(): Bar = ???, which is what I get with Scala 2.

@Duhemm Duhemm added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 6, 2024
Duhemm added a commit to Duhemm/dotty that referenced this issue Aug 6, 2024
Previously, when a concrete class A had unimplemented members that are
overridden, all overrides would be reported as unimplemented in the
error message. This would produce error messages that are not accurate,
and that suggest stubs that are not correct.

This patch fixes the issue by reporting in the error message only the
unimplemented members that are not overridden by other unimplemented
members.

Fixes scala#21335
@Gedochao Gedochao added area:overloading and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 8, 2024
@sjrd sjrd closed this as completed in 0d50a30 Aug 8, 2024
sjrd added a commit that referenced this issue Aug 8, 2024
Previously, when a concrete class A had unimplemented members that are
overridden, all overrides would be reported as unimplemented in the
error message. This would produce error messages that are not accurate,
and that suggest stubs that are not correct.

This patch fixes the issue by reporting in the error message only the
unimplemented members that are not overridden by other unimplemented
members.

Fixes #21335
WojciechMazur pushed a commit that referenced this issue Aug 28, 2024
Previously, when a concrete class A had unimplemented members that are
overridden, all overrides would be reported as unimplemented in the
error message. This would produce error messages that are not accurate,
and that suggest stubs that are not correct.

This patch fixes the issue by reporting in the error message only the
unimplemented members that are not overridden by other unimplemented
members.

Fixes #21335

[Cherry-picked 0d50a30]
@WojciechMazur WojciechMazur added this to the 3.5.2 milestone Oct 8, 2024
WojciechMazur pushed a commit that referenced this issue Dec 2, 2024
Previously, when a concrete class A had unimplemented members that are
overridden, all overrides would be reported as unimplemented in the
error message. This would produce error messages that are not accurate,
and that suggest stubs that are not correct.

This patch fixes the issue by reporting in the error message only the
unimplemented members that are not overridden by other unimplemented
members.

Fixes #21335

[Cherry-picked 0d50a30]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants