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

DartVM: abstract methods inheritance should be properly verified #978

Closed
DartBot opened this issue Dec 26, 2011 · 15 comments
Closed

DartVM: abstract methods inheritance should be properly verified #978

DartBot opened this issue Dec 26, 2011 · 15 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior

Comments

@DartBot
Copy link

DartBot commented Dec 26, 2011

This issue was originally filed by [email protected]


What steps will reproduce the problem?
consider the following test:
class A {
  abstract f(var x);
}

class C extends A {
  f(var x, var y) {}
}

main() {
  new A().f(2);
  new C().f(2, 2);
}

What is the expected output? What do you see instead?
Expected: compile-time error
Actual: successful compilation

What version of the product are you using? On what operating system?
DartVM r2810

Please provide any additional information below.
There are more various co19 tests:
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A03/t02
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A03/t03
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A03/t04
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A03/t05

LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t02
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t03
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t05
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t06

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2012

Added Area-VM, Triaged labels.

@iposva-google
Copy link
Contributor

Marked this as being blocked by #1031.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2012

This comment was originally written by [email protected]


Please note that the following tests were corrected and are not related to this issue anymore
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t02
LangSpecTest/07_Classes/1_Instance_Methods/1/Abstract/Methods/A04/t03

@iposva-google
Copy link
Contributor

Matthias, can you please work with Gilad to resolve whether these are still expected to be compile-time errors and whether they should be. See the blocking bug.


cc @gbracha.
Set owner to @mhausner.
Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented Mar 16, 2012

Class C should cause a compile time error, because of the illegal override of f/1 by f/2 (I'm using the Erlang notation to distinguish methods with the same name and different arity). That rule is not expected to change.

@gbracha
Copy link
Contributor

gbracha commented Mar 16, 2012

Note that Abstract/Methods/A04/t03 is not a compile-time error. The overriding method declares all named parameters declared by the overridden method, in the same order. It adds ana additional named parameter at the end, but that is ok. Same for Abstract/Methods/A04/t02

@DartBot
Copy link
Author

DartBot commented Oct 15, 2012

This comment was originally written by [email protected]


the new relevant test names are:
Language/07_Classes/4_Abstract_Instance_Members_A03_t02
Language/07_Classes/4_Abstract_Instance_Members_A03_t03
Language/07_Classes/4_Abstract_Instance_Members_A03_t04
Language/07_Classes/4_Abstract_Instance_Members_A03_t05
Language/07_Classes/4_Abstract_Instance_Members_A04_t01
Language/07_Classes/4_Abstract_Instance_Members_A04_t05
Language/07_Classes/4_Abstract_Instance_Members_A04_t06

and rather than create a separate issue, it's probably more appropriate to add this here:
there's an unexpected compile-time error when overriding an abstract method with one that has the same set of named parameters, but declared in a different order.
The assertion in spec was changed, but VM hasn't been told yet
the following co19 tests illustrate this:
Language/07_Classes/4_Abstract_Instance_Members_A04_t04

@iposva-google
Copy link
Contributor

Is this still a valid bug report?


Set owner to @gbracha.

@DartBot
Copy link
Author

DartBot commented May 29, 2013

This comment was originally written by @mhausner


Yes. The VM needs to add abstract methods to classes so it can check whether they are used properly in an extending class. That will have an impact on how we handle noSuchMethod, since we can't rely on not finding the name in the class.

@iposva-google
Copy link
Contributor

Removed Priority-Medium label.
Added Priority-Unassigned label.

@ghost
Copy link

ghost commented Aug 16, 2013

What is the status of this one? Is Gilad still the correct owner?

@iposva-google
Copy link
Contributor

Regis, you were looking at when to throw compile-time errors from within the VM.


cc @crelier.

@crelier
Copy link
Contributor

crelier commented Aug 19, 2013

Abstract methods should be listed as methods of the class in the VM, as Matthias commented on May 29. However, this is not relevant to this bug report, since bad overrides are not compile-time errors anymore (unless you specify --error_on_bad_override, in which case you do not get an error either, because abstract methods are not listed).

These co19 tests have the wrong expectation. They should not expect a compile-time error. Unless I miss something, this bug should be closed and a new co19 bug should be opened against these co19 tests.

@iposva-google
Copy link
Contributor

Regis, can this now be closed? If the bugs have been filed agains co19, then probably you can do so.

@crelier
Copy link
Contributor

crelier commented Oct 2, 2013

I do not see any failing co19 tests related to abstract methods and I do not see any reference to issue #978. Closing issue.


Added AsDesigned label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior labels Oct 2, 2013
dart-bot pushed a commit that referenced this issue Jan 25, 2021
2021-01-24 [email protected] Issue #983: Static warning checks corrected.
2021-01-22 [email protected] Issue #983: triple-shift folders re-named correctly, typo in the library paths updated for 2 tests.
2021-01-21 [email protected] Fixes #985. LateInitializationError removed
2021-01-20 [email protected] Fixes #982. Add tests for The future value type of an asynchronous non-generator function part of NNBD spec
2021-01-19 [email protected] Issue #462: NNBD type-normalization tests for weak mode added.
2021-01-19 [email protected] Issue #462: NNBD type-aliases tests for weak mode added.
2021-01-19 [email protected] Issue #462: NNBD tripple-shift tests for weak mode added.
2021-01-19 [email protected] Issue #462: NNBD tests for weak mode added for the override checkings.
2021-01-19 [email protected] Issue #462: NNBD tests for weak mode added (Leatest-greatest-closures).
2021-01-19 [email protected] Issue #462: NNBD tests for weak mode added (Leatest-greatest-closures).
2021-01-18 [email protected] Fixes #981. Add tests for Return statements part of NNBD spec
2021-01-18 [email protected] Issue #462: NNBD tests for weak mode corrected according to the current Spec changes.
2021-01-14 [email protected] Issue #462: Additional comments regarding the constant evaluation issues added to weak mode tests.
2021-01-14 [email protected] Fixes #980. Remove warnings expectations for overriding default values of optional parameters tests
2021-01-13 [email protected] Issue #462: Tests for weak mode added to nnbd/weak/flow-analysis directory.
2021-01-12 [email protected] #978. Weak mode test changes
2021-01-12 [email protected] Issue #462: Tests for weak mode added to nnbd/weak directory.
2021-01-11 [email protected] Fixes #978. Tests updated according to the "flow analysis boolean variable" feature
2020-12-25 [email protected] Issues #463: Tests for weak mode added.
2020-12-25 [email protected] Issues #462, #463: Moved or added new nnbd tests for weak mode, added new tests for strong mode.
2020-12-24 [email protected] #970. Usr correct values for ProcessSignal.sigusr1 and ProcessSignal.sigusr2 on Mac
2020-12-24 [email protected] Issue #462: 1. Added nnbd tests for weak mode: exports_*, expression_typing_*, extension_method_resolution_*, future_flattening_*. 2. Moved and re-factored nnbd extension_method_resolution_*, future_flattening_* tests for weak mode into weak folder. 3. Copyrights updated Issue #463: Two exports* tests for strong mode added.
2020-12-24 [email protected] Fixes #496. Change tested date to 1 second instead of 1 day to reduce probability to change timezone on DST
2020-12-23 [email protected] Fixes #473. Remove UtilsHtml directory
2020-12-23 [email protected] Fix for Issue #462: 1. Added nnbd tests for weak mode: assignability_*, const_evaluation_*, const_objects_*, const_type_var_elimination_*. 2. Moved and re-factored nnbd exports_* tests for weak mode into weak folder.
2020-12-10 [email protected] Fixes #976. Remove obsolete errors expectations
2020-12-10 [email protected] Fixes #975. Fix wrong expected compile time error type
2020-12-07 [email protected] Flag Requirements=nnbd-weak added to the tests that run legacy code

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I69acc5c0a28fd2e7a2d38f6c9062e5a5854bdfa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180823
Reviewed-by: William Hesse <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

5 participants