-
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 [email protected] 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 [email protected] Fix syntax error in test expectation in ffi test (#1002) 2021-02-20 [email protected] #1000: Missing Issue tags added. 2021-02-20 [email protected] Issue #1000: tests updated according to the recent result analysis 2021-02-20 [email protected] Roll failures fixed 2021-02-19 [email protected] #999. Missed experiment flags added 2021-02-19 [email protected] #993. 32 and 64-bit integer tests added 2021-02-19 [email protected] #993. Change test to expect compile error if struct subclass created by the constructor 2021-02-19 [email protected] #993. Remove tests that run "nm" command 2021-02-18 [email protected] #993. More ffi tests added 2021-02-18 [email protected] Instantiate-to-bounds tests apdated according to the SDK Issues 44223, 42446 evaluation. 2021-02-17 [email protected] Issue #535: nnbd-strong requirement added to the tests, more tests for constant evaluation and canonicalization added. 2021-02-17 [email protected] Some of type aliases tests fixed 2021-02-17 [email protected] #993. More Struct tests added 2021-02-16 [email protected] Issue #535: more tests for constant evaluation and canonicalization added. 2021-02-12 [email protected] Fixes #994: test expectesions updated according to the recent SDK changes. 2021-02-12 [email protected] #993. More Struct tests added 2021-02-12 [email protected] Merge remote-tracking branch 'origin/master' 2021-02-12 [email protected] #993. NativeType and Struct tests added 2021-02-11 [email protected] Fixes #991: tests updated according to the recent SDK changes. 2021-02-08 [email protected] #993. sizeOf() tests added 2021-02-05 [email protected] #993. More tests for DynamicLibrary added 2021-02-04 [email protected] #993. DynamicLibrary constructors tests added 2021-02-03 [email protected] #993. co19 ffi tests. Initial commit 2021-02-02 [email protected] Fixes #992. Boolean conditional evaluation tests added 2021-02-01 [email protected] Fixes #990: tests updated according to the recent SDK changes. 2021-01-28 [email protected] Fixes #979: I-2-b tests updated according to the recent changes for dart-lang/language#1133 2021-01-28 [email protected] Fixes #984: I-2-b tests updated according to the recent changes for dart-lang/language#1133 2021-01-27 [email protected] Fixes #989. Runtime type equality operator tests added 2021-01-26 [email protected] Fixes #988: Static warning checks corrected. 2021-01-25 [email protected] 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 <[email protected]>
2021-03-17 [email protected] Fixes #1017. Use => for setter returning value tests 2021-03-16 [email protected] Issue #996: more tests for Generic functions as type arguments and bounds added. 2021-03-16 [email protected] Fixes #1005. Description updated for method_definition tests 2021-03-16 [email protected] Fixes #1011. Expect an error if non-function type is called as a function 2021-03-16 [email protected] Issue #996: tests for Generic functions as type arguments and bounds re-factored, more tests added. 2021-03-15 [email protected] Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-15 [email protected] Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-15 [email protected] Missed experiment flag added 2021-03-12 [email protected] Issue #996: tests for Generic functions as type arguments and bounds added. 2021-03-12 [email protected] #993. Added tests checking that Struct fields cannot have initializers 2021-03-12 [email protected] #993. Tests for not external members of Struct subtype added 2021-03-11 [email protected] #993. Use package ffi in co19 ffi tests 2021-03-09 [email protected] Fixes #995. Annotations with type arguments tests added 2021-03-09 [email protected] Issue #997: existing triple-shift tests corrected. 2021-03-09 [email protected] More fixes for #535: split constant evaluation tests because static behavior of the strong and weak mode is different. 2021-03-04 [email protected] #993. Array tests added 2021-03-04 [email protected] #993. Pointer equality tests added 2021-03-03 [email protected] #993. Pointer.elementAt() tests added 2021-03-02 [email protected] #993. Pointer.cast() tests added 2021-03-01 [email protected] #993. Pointer tests added 2021-03-01 [email protected] Fixes #936. Change expected result according to the new left top rule 2021-02-26 [email protected] Fixed #998: tests checks output streams correctly now. 2021-02-26 [email protected] #993. IntPtr tests added 2021-02-26 [email protected] #993. More Struct tests added 2021-02-25 [email protected] Tests updated, missing issue tags added. 2021-02-25 [email protected] #1003. Isolate test fixed to not to be a racy 2021-02-25 [email protected] Issue numbers added 2021-02-24 [email protected] Issue number added 2021-02-24 [email protected] #988. Typo in error message fixed 2021-02-24 [email protected] #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 <[email protected]>
2021-04-07 [email protected] Fixes #535: more nnbd tests for constant evaluation added. 2021-04-07 [email protected] Fixes #1068. Remove excessive - in a SharedOptions 2021-04-05 [email protected] Fixes #535: more nnbd tests for constant evaluation added. 2021-04-05 [email protected] Fixes #996: more tests added. 2021-04-05 [email protected] Fixes #996: more tests added. 2021-04-05 [email protected] Fixes #1067: added checks for old and new dart versions. 2021-04-05 [email protected] Fixes #1066: added @Dart=2.12 to the initial version of the test, new test which checks recent dart behavior added. 2021-04-05 [email protected] Fixes #1057: Expected result doe the tests with mailformed types updated. 2021-04-02 [email protected] Fixes #1062. Remove unnecessary assignment 2021-04-01 [email protected] Fixes #1057: Expected result doe the tests with mailformed types updated. 2021-04-01 [email protected] Expected error code is fixed for Windows 2021-04-01 [email protected] Fixes #1060. Expected error message position updated 2021-04-01 [email protected] Fixes #1059. Expected error message updated 2021-04-01 [email protected] Fixes #1024. Adjust expected results for web platforms 2021-04-01 [email protected] #993. More Array tests added 2021-03-31 [email protected] Update LICENSE 2021-03-31 [email protected] #993. Array tests added 2021-03-31 [email protected] Issue #1053: Missing Issue tag added, test expectation updated. 2021-03-30 [email protected] Fixes #1054: Updated expectations for mailformed raw type variables. 2021-03-30 [email protected] Fixes #1050: Updated expectations for mailformed raw type variables. 2021-03-30 [email protected] Fixes #1050: Got rid of mailformed row type variable usage in i-2-b- tests. 2021-03-29 [email protected] Fixes #1043. Remove static warning as an expected result 2021-03-29 [email protected] Fixes #1049: Correct expectation adjusted 2021-03-29 [email protected] Fixes #1048. Move tests to correct folder and change the description 2021-03-29 [email protected] Fixes #1046: Test adjusted to work with the generic metadata feature enabled. 2021-03-29 [email protected] Fixes #1047. Change expected result to not to fail on JavaScript configurations 2021-03-29 [email protected] Fixes #1044. Change expected result to not to fail on JavaScript configurations 2021-03-26 [email protected] Fixes #1029: Missing Issue tag added to the test. 2021-03-26 [email protected] Fixes #1042. Add check that produces different results for triple and double shifts 2021-03-26 [email protected] Fixes #1042. Fix built-in_types_t11.dart to expect correct results 2021-03-25 [email protected] Fixes #1019. Don't use type aliases in legacy libraries 2021-03-25 [email protected] Fixes #1039: Old-style aliases corrected. 2021-03-25 [email protected] Fixes #988. Expect static type warning in a right way 2021-03-24 [email protected] Issues #1029: Static expectation corrected. 2021-03-24 [email protected] Issues #1035: Issue tag for the bug 45443 added. 2021-03-24 [email protected] Merge branch 'master' of https://github.com/dart-lang/co19 2021-03-24 [email protected] #1023. Change SplayTreeMap and SplayTreeSet tests according to the new behavior 2021-03-23 [email protected] #1021. Remove expecting errors on web configurations for some negative numbers 2021-03-23 [email protected] Fixes #1034. Missed experimental flag added 2021-03-23 [email protected] #1033. Perform runtime check on big values for non-JavaScript configurations only 2021-03-23 [email protected] 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 <[email protected]>
This issue was originally filed by [email protected]
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: