-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dartc allows non-constant fields in a class with declared constant constructor #988
Comments
Added Area-Compiler, Triaged labels. |
This comment was originally written by zundel@google.com 7.5.3 "It is a compile-time error if a constant constructor is declared by a class that has a non-final instance variable." I agree that this fix is needed to comply with the spec, but it seems to me that creating a constant constructor creates a large set of constraints on the class hierarchy, thus, in practice, users are going to have to create an interface and two separate classes, neither of which can derive from the other, to implement the interface if they want to use constant constructors. I am hoping with some thought we could we come up with a way to change the spec to allow one class to define both a const constructor and a non-constant version of the class in the same class definition. cc @gbracha. |
Fixed as per the spec for now: Added Fixed label. |
2021-02-22 whesse@google.com Fix syntax error in test expectation in ffi test (#1002) 2021-02-20 irina.arkhipets@gmail.com #1000: Missing Issue tags added. 2021-02-20 irina.arkhipets@gmail.com Issue #1000: tests updated according to the recent result analysis 2021-02-20 sgrekhov@unipro.ru Roll failures fixed 2021-02-19 sgrekhov@unipro.ru #999. Missed experiment flags added 2021-02-19 sgrekhov@unipro.ru #993. 32 and 64-bit integer tests added 2021-02-19 sgrekhov@unipro.ru #993. Change test to expect compile error if struct subclass created by the constructor 2021-02-19 sgrekhov@unipro.ru #993. Remove tests that run "nm" command 2021-02-18 sgrekhov@unipro.ru #993. More ffi tests added 2021-02-18 irina.arkhipets@gmail.com Instantiate-to-bounds tests apdated according to the SDK Issues 44223, 42446 evaluation. 2021-02-17 irina.arkhipets@gmail.com Issue #535: nnbd-strong requirement added to the tests, more tests for constant evaluation and canonicalization added. 2021-02-17 sgrekhov@unipro.ru Some of type aliases tests fixed 2021-02-17 sgrekhov@unipro.ru #993. More Struct tests added 2021-02-16 irina.arkhipets@gmail.com Issue #535: more tests for constant evaluation and canonicalization added. 2021-02-12 irina.arkhipets@gmail.com Fixes #994: test expectesions updated according to the recent SDK changes. 2021-02-12 sgrekhov@unipro.ru #993. More Struct tests added 2021-02-12 irina.arkhipets@gmail.com Merge remote-tracking branch 'origin/master' 2021-02-12 sgrekhov@unipro.ru #993. NativeType and Struct tests added 2021-02-11 irina.arkhipets@gmail.com Fixes #991: tests updated according to the recent SDK changes. 2021-02-08 sgrekhov@unipro.ru #993. sizeOf() tests added 2021-02-05 sgrekhov@unipro.ru #993. More tests for DynamicLibrary added 2021-02-04 sgrekhov@unipro.ru #993. DynamicLibrary constructors tests added 2021-02-03 sgrekhov@unipro.ru #993. co19 ffi tests. Initial commit 2021-02-02 sgrekhov@unipro.ru Fixes #992. Boolean conditional evaluation tests added 2021-02-01 irina.arkhipets@gmail.com Fixes #990: tests updated according to the recent SDK changes. 2021-01-28 irina.arkhipets@gmail.com Fixes #979: I-2-b tests updated according to the recent changes for dart-lang/language#1133 2021-01-28 irina.arkhipets@gmail.com Fixes #984: I-2-b tests updated according to the recent changes for dart-lang/language#1133 2021-01-27 sgrekhov@unipro.ru Fixes #989. Runtime type equality operator tests added 2021-01-26 irina.arkhipets@gmail.com Fixes #988: Static warning checks corrected. 2021-01-25 sgrekhov@unipro.ru Fixes #987. Local variables and inference tests added Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,analyzer-nnbd-mac-release-try,analyzer-nnbd-win-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-mac-release-x64-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-ia32-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-nnbd-win-release-x64-try Change-Id: I78ba37f9c74d2afc360ef5fbd51d01ab75239fd6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186146 Reviewed-by: Jonas Termansen <sortie@google.com>
2021-03-17 sgrekhov@unipro.ru Fixes #1017. Use => for setter returning value tests 2021-03-16 irina.arkhipets@gmail.com Issue #996: more tests for Generic functions as type arguments and bounds added. 2021-03-16 sgrekhov@unipro.ru Fixes #1005. Description updated for method_definition tests 2021-03-16 sgrekhov@unipro.ru Fixes #1011. Expect an error if non-function type is called as a function 2021-03-16 irina.arkhipets@gmail.com Issue #996: tests for Generic functions as type arguments and bounds re-factored, more tests added. 2021-03-15 irina.arkhipets@gmail.com Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-15 irina.arkhipets@gmail.com Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-15 sgrekhov@unipro.ru Missed experiment flag added 2021-03-12 irina.arkhipets@gmail.com Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-12 sgrekhov@unipro.ru #993. Added tests checking that Struct fields cannot have initializers 2021-03-12 sgrekhov@unipro.ru #993. Tests for not external members of Struct subtype added 2021-03-11 sgrekhov@unipro.ru #993. Use package ffi in co19 ffi tests 2021-03-09 sgrekhov@unipro.ru Fixes #995. Annotations with type arguments tests added 2021-03-09 irina.arkhipets@gmail.com Issue #997: existing triple-shift tests corrected. 2021-03-09 irina.arkhipets@gmail.com More fixes for #535: split constant evaluation tests because static behavior of the strong and weak mode is different. 2021-03-04 sgrekhov@unipro.ru #993. Array tests added 2021-03-04 sgrekhov@unipro.ru #993. Pointer equality tests added 2021-03-03 sgrekhov@unipro.ru #993. Pointer.elementAt() tests added 2021-03-02 sgrekhov@unipro.ru #993. Pointer.cast() tests added 2021-03-01 sgrekhov@unipro.ru #993. Pointer tests added 2021-03-01 sgrekhov@unipro.ru Fixes #936. Change expected result according to the new left top rule 2021-02-26 irina.arkhipets@gmail.com Fixed #998: tests checks output streams correctly now. 2021-02-26 sgrekhov@unipro.ru #993. IntPtr tests added 2021-02-26 sgrekhov@unipro.ru #993. More Struct tests added 2021-02-25 irina.arkhipets@gmail.com Tests updated, missing issue tags added. 2021-02-25 sgrekhov@unipro.ru #1003. Isolate test fixed to not to be a racy 2021-02-25 sgrekhov@unipro.ru Issue numbers added 2021-02-24 sgrekhov@unipro.ru Issue number added 2021-02-24 sgrekhov@unipro.ru #988. Typo in error message fixed 2021-02-24 sgrekhov@unipro.ru #988. Fix test expectations 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-debug-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-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try Change-Id: I718644028b1d2a9fbba0c7efdf2923bb67184fde Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191409 Reviewed-by: William Hesse <whesse@google.com>
2021-04-07 irina.arkhipets@gmail.com Fixes #535: more nnbd tests for constant evaluation added. 2021-04-07 sgrekhov@unipro.ru Fixes #1068. Remove excessive - in a SharedOptions 2021-04-05 irina.arkhipets@gmail.com Fixes #535: more nnbd tests for constant evaluation added. 2021-04-05 irina.arkhipets@gmail.com Fixes #996: more tests added. 2021-04-05 irina.arkhipets@gmail.com Fixes #996: more tests added. 2021-04-05 irina.arkhipets@gmail.com Fixes #1067: added checks for old and new dart versions. 2021-04-05 irina.arkhipets@gmail.com Fixes #1066: added @Dart=2.12 to the initial version of the test, new test which checks recent dart behavior added. 2021-04-05 irina.arkhipets@gmail.com Fixes #1057: Expected result doe the tests with mailformed types updated. 2021-04-02 sgrekhov@unipro.ru Fixes #1062. Remove unnecessary assignment 2021-04-01 irina.arkhipets@gmail.com Fixes #1057: Expected result doe the tests with mailformed types updated. 2021-04-01 sgrekhov@unipro.ru Expected error code is fixed for Windows 2021-04-01 sgrekhov@unipro.ru Fixes #1060. Expected error message position updated 2021-04-01 sgrekhov@unipro.ru Fixes #1059. Expected error message updated 2021-04-01 sgrekhov@unipro.ru Fixes #1024. Adjust expected results for web platforms 2021-04-01 sgrekhov@unipro.ru #993. More Array tests added 2021-03-31 58489007+franklinyow@users.noreply.github.com Update LICENSE 2021-03-31 sgrekhov@unipro.ru #993. Array tests added 2021-03-31 irina.arkhipets@gmail.com Issue #1053: Missing Issue tag added, test expectation updated. 2021-03-30 irina.arkhipets@gmail.com Fixes #1054: Updated expectations for mailformed raw type variables. 2021-03-30 irina.arkhipets@gmail.com Fixes #1050: Updated expectations for mailformed raw type variables. 2021-03-30 irina.arkhipets@gmail.com Fixes #1050: Got rid of mailformed row type variable usage in i-2-b- tests. 2021-03-29 sgrekhov@unipro.ru Fixes #1043. Remove static warning as an expected result 2021-03-29 irina.arkhipets@gmail.com Fixes #1049: Correct expectation adjusted 2021-03-29 sgrekhov@unipro.ru Fixes #1048. Move tests to correct folder and change the description 2021-03-29 irina.arkhipets@gmail.com Fixes #1046: Test adjusted to work with the generic metadata feature enabled. 2021-03-29 sgrekhov@unipro.ru Fixes #1047. Change expected result to not to fail on JavaScript configurations 2021-03-29 sgrekhov@unipro.ru Fixes #1044. Change expected result to not to fail on JavaScript configurations 2021-03-26 irina.arkhipets@gmail.com Fixes #1029: Missing Issue tag added to the test. 2021-03-26 sgrekhov@unipro.ru Fixes #1042. Add check that produces different results for triple and double shifts 2021-03-26 sgrekhov@unipro.ru Fixes #1042. Fix built-in_types_t11.dart to expect correct results 2021-03-25 sgrekhov@unipro.ru Fixes #1019. Don't use type aliases in legacy libraries 2021-03-25 irina.arkhipets@gmail.com Fixes #1039: Old-style aliases corrected. 2021-03-25 sgrekhov@unipro.ru Fixes #988. Expect static type warning in a right way 2021-03-24 irina.arkhipets@gmail.com Issues #1029: Static expectation corrected. 2021-03-24 irina.arkhipets@gmail.com Issues #1035: Issue tag for the bug 45443 added. 2021-03-24 irina.arkhipets@gmail.com Merge branch 'master' of https://github.com/dart-lang/co19 2021-03-24 sgrekhov@unipro.ru #1023. Change SplayTreeMap and SplayTreeSet tests according to the new behavior 2021-03-23 sgrekhov@unipro.ru #1021. Remove expecting errors on web configurations for some negative numbers 2021-03-23 sgrekhov@unipro.ru Fixes #1034. Missed experimental flag added 2021-03-23 sgrekhov@unipro.ru #1033. Perform runtime check on big values for non-JavaScript configurations only 2021-03-23 irina.arkhipets@gmail.com Issues #1029: co19/Language/Generics/Superbounded_types/typedef3_A01_t06/02 corrected and does not expect a compile error now. 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-debug-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-debug-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try Change-Id: I5fae01c7b48aba502da04638430f4f6de79ac745 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194241 Reviewed-by: William Hesse <whesse@google.com>
This issue was originally filed by ms...@unipro.ru
What steps will reproduce the problem?
Run the following test:
class A {
const A();
var x;
}
main() {
var a = const A();
}
What is the expected output? What do you see instead?
Expected: compile-time error
Actual: test compiles without errors
What version of the product are you using? On what operating system?
dartc r2810, Ubuntu 10.04
Please provide any additional information below.
The text was updated successfully, but these errors were encountered: