Skip to content

SDK now refuses to compile code with invalid annotations. Breaks code that uses unittest. #25204

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
alan-knight opened this issue Dec 9, 2015 · 20 comments
Assignees
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Milestone

Comments

@alan-knight
Copy link
Contributor

As of https://codereview.chromium.org/1510863004 dart2js does not compile code that includes an invalid annotation. package:unittest/unittest.dart has an invalid annotation (@deprecated(...)), so things that still uses unittest refuse to compile. This is a badly breaking change, and the only reason the bots are still working is that the SDK has an old version of unittest without that annotation.
@kevmoo @johnniwinther

@alan-knight alan-knight added P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). labels Dec 9, 2015
@alan-knight alan-knight added this to the 1.14 milestone Dec 9, 2015
@dgrove
Copy link
Contributor

dgrove commented Dec 9, 2015

@sigmundch

@alan-knight
Copy link
Contributor Author

Right now, this would break many applications. For example, if we updated the SDK it would break every html test and various package tests.

It would be easy to fix unittest, but we would still break things until people did a pub upgrade.

I think it would be better if we made this a warning in the compiler where it would complain, but not refuse to compile.

@sigmundch
Copy link
Member

Section 15 of the spec does indicate that it should be a compile-time error though. @gbracha can we change it to be just a warning in this case?

The alternative I see is for us to make it a warning in Dart 1.14, update all the packages, and make it an error in Dart 1.15

@sigmundch
Copy link
Member

(just to clarify - the CL above was fixing #14548 - a very old dart2js bug regarding that spec section)

@kevmoo
Copy link
Member

kevmoo commented Dec 10, 2015

Let's not change the spec. This is totally valid.

But waiting at least until 1.15 to crash in dart2js is a good idea, IMHO

@lrhn
Copy link
Member

lrhn commented Dec 10, 2015

Also, take this as a good time to switch to package:test.

@johnniwinther
Copy link
Member

Dart2js doesn't crash; it reports a compile-time error.

On 10 December 2015 at 02:30, Kevin Moore [email protected] wrote:

Let's not change the spec. This is totally valid.

But waiting at least until 1.15 to crash in dart2js is a good idea, IMHO


Reply to this email directly or view it on GitHub
#25204 (comment).

@sigmundch
Copy link
Member

@johnniwinther - I think @kevmoo meant "crash" as "produce an error without any output".

@floitschG gave a couple additional suggestions:

  • emit an error message in dart2js but still continue. Make it fatal sometime in the future.
  • abort the compilation, but provide a flag to ignore that error. Remove that flag sometime in the future.

I'm fine with either - @johnniwinther which of these would be easier? Seems like the latter might fit more nicely with our current architecture.

@kevmoo
Copy link
Member

kevmoo commented Dec 10, 2015

Folks are going to be annoyed enough w/ new error messages.

NO FLAGS for this. The result should NOT CHANGE from before. Yell at the user: fine. 😃

@nex3
Copy link
Member

nex3 commented Dec 10, 2015

package:unittest/unittest.dart has an invalid annotation (@deprecated(...))

Where is this annotation? I can't find it in the 0.11.x branch or indeed anywhere in the history of the repo.

@alan-knight
Copy link
Contributor Author

https://github.com/dart-lang/old_unittest/blob/master/lib/unittest.dart

On Thu, Dec 10, 2015 at 3:15 PM Natalie Weizenbaum [email protected]
wrote:

package:unittest/unittest.dart has an invalid annotation (@deprecated
https://github.com/deprecated(...))

Where is this annotation? I can't find it in the 0.11.x branch
https://github.com/dart-lang/test/tree/0.11.x or indeed anywhere in the
history of the repo.


Reply to this email directly or view it on GitHub
#25204 (comment).

@nex3
Copy link
Member

nex3 commented Dec 10, 2015

I see. That repo tracks the 0.12.x releases of the unittest package; there should be no reason to use it anymore, since it just exports test. It also has an implicit SDK upper bound of 0.12.4, so how is this issue even coming up?

@kevmoo
Copy link
Member

kevmoo commented Dec 10, 2015

@alan-knight which version of unittest are you seeing the issue with?

@alan-knight
Copy link
Contributor Author

I saw this because I have a package that I just test various small things
in. It has unittest: any in the pubspec. The pubspec.lock has

unittest:
description: unittest
source: hosted
version: "0.12.4"

On Thu, Dec 10, 2015 at 3:56 PM Kevin Moore [email protected]
wrote:

@alan-knight https://github.com/alan-knight which version of unittest
are you seeing the issue with?


Reply to this email directly or view it on GitHub
#25204 (comment).

@johnniwinther
Copy link
Member

@sigmundch We already have --generate-code-with-compile-time-errors option. Is that sufficient?

@kevmoo
Copy link
Member

kevmoo commented Dec 11, 2015

@johnniwinther Please don't require a new flag to compile code that has compiled fine for a year.

Let's go w/ a warning.

@sigmundch
Copy link
Member

keeping it as a warning for now sounds good.

If we want to really be spec compliant, we could report it as an error, but continue compiling for this specific error only. That would require that we divide errors in 2 groups (fatal and non-fatal). Feels odd because all errors except this one would be fatal, but we could use it as a way of introducing errors in the future. Non-fatal errors will have a date/release when they will be come fatal (e.g. say that in 1.15 we'll flip the bit), so users have a transition path.

@johnniwinther
Copy link
Member

@alan-knight I don't see how the deprecated(...) code was affected by the mentioned CL. Running dart2js on

@deprecated(
    'The "unittest" package is deprecated. Use the "test" package instead.')
main() {}

gives the following result on e03c395 (the previous commit):
temp/test4.dart:2:2:
Error: 'deprecated' is not a type.
@deprecated(
^^^^^^^^^^
temp/test4.dart:2:2:
Error: Not a compile-time constant.
@deprecated(
'The "unittest" package is deprecated. Use the "test" package instead.')

temp/test4.dart:2:2:
Error: Not a compile-time constant.
@deprecated(
'The "unittest" package is deprecated. Use the "test" package instead.')

Error: Compilation failed.

Do you have an example of a program with this annotation that worked before but not after?

nex3 added a commit to googlearchive/old_unittest that referenced this issue Dec 14, 2015
@alan-knight
Copy link
Contributor Author

Yes, I see that as well. So it must have been a pub upgrade giving me the version with the invalid annotation that caused it, rather than the compiler change.

@kevmoo
Copy link
Member

kevmoo commented Dec 15, 2015

@alan-knight – @nex3 did fix pkg/unittest, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

7 participants