-
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
Config specific exports don't work with analyzer/ddc #34179
Comments
I will check next week if this issue is present with kernel/ddk as well - if it isn't we might be able to skip fixing it. |
Looks like I get a different error for DDK so I can't test this properly right now, will follow up. |
Yeah we haven't implemented anything specific for this on DDC side (because Analyzer/CFE should resolve it for us). I don't know how config specific imports/exports are implemented in Analyzer though. It might require a flag to enable the feature? |
It might be that this is a bug in the analyzer summaries or something... @stereotype441 any ideas? |
No ideas off the top of my head. Even though config specific imports/exports aren't fully implemented in the analyzer IIRC, your example seems like it should work anyhow, since even if you disregard the config-specific imports, the name Note that in your gist, |
Added |
cc @stereotype441 - we're getting new user reports about this. Can we prioritize a fix? |
See also #35672 which highlights additional confusing UX around this lack or support. |
@stereotype441 - some quick thoughts here. The following: import 'dart:io'
if (dart.library.html) 'dart:html_misspelled';
void main() {
// print(HttpRequest);
} compiles without error in DDC. The code above also doesn't show an error in the IDE (but if I misspell If this is time consuming to fix, I think (for now) suppressing this check altogether when multiple configurations are present may be best short term step. |
any update? |
Fwiw this shouldn't be blocking migration to 2.2, it hasn't ever worked properly |
But, it works with 2.1.0 version for us, we cannot use d2j to compile our source code for 3~5 minutes only single line change with 2.2 version in development phase. |
I'm not aware of any regression between 2.1.0 and 2.2.0 around this issue. Can you explain the problem you hit when you tried to upgrade to 2.2.0 that was not happening in 2.1.0? |
@natebosch Yes, there is a simple reproducible example in #35672 which was failure to run with 2.1.0, but I found a workaround by adding |
@jakemac53 I try with your example and add my workaround, it can work well with Dart 2.1.0 version.
|
@jumperchen it is a bit complicated but I think you only see this issue if the library with the exports exists in a different module - which you don't have direct control over. You can make that happen though by moving the |
FYI: I try to verify this by myself, and I found the request arguments from build_web_compilers are the same between 2.1.0 vs 2.1.1 as follows 2.1.1
2.1.0
So I also try to diff the two sources between 2.1.0 and 2.1.1-dev.0.0, in the If someone can tell me about how to run |
@stereotype441 - adding this to 2.4 for now. This may be a blocker to flutter web integration (even without analyzer-ddc). |
Is this still an open (with DDK)? |
Exports work with DDK (as do imports, without the |
Is this ready to be used? This is blocking integration of DDC into the Flutter SDK. |
With the latest build_web_compilers (which uses kernel), yes. Analyzer is still not functioning which might be a blocker still, since you presumably need things to work internally as well. |
Thanks! This is only for the open-source projects. Internal workflow is not affected. |
I just spoke with @jakemac53 about this. There's a number of interacting issues:
For config specific imports, we're currently at a point of delicate stability where they're used infrequently enough that we don't happen to hit any bugs due to differences in constants, inferred types, or export targets. (We have to ignore some stray analyzer errors though, due to the analyzer trying to visit a file that's not correct for the given configuration). It's likely that we can hobble along a little longer in this condition, but with each passing day we're taking a risk of the house of cards falling over. For config specific exports, we might be able to reach a similar point of delicate stability, but then again we might not, because the consequences of the analyzer trying to visit the wrong exported file are worse than for trying to visit the wrong imported file; DDC will fall over trying to compile not just the file with the config-specific export, but any file that imports it and makes use of the exported symbols. Jake and I don't believe we'll be able to address these issues in the D24 timeframe, and I don't think it makes sense to hold up the D24 release for this. So I'm reassigning the milestone. But I'm keeping the P1 designation because the situation is delicate enough that we need to fix it as soon as we can. Jake is setting up a follow-up meeting to discuss what steps we should take next. |
There's no Web support in the Flutter SDK yet, so we won't be breaking anyone by adopting something new that works. |
@stereotype441, we are still waiting for this fix to upgrade dart SDK from 2.1.0 version, hope you can find a workaround for us, thanks. |
I discussed this with @jakemac53, @yjbanov, and @jonahwilliams yesterday. Since the Flutter code that triggered this problem is going to be compiled using kernel, we believe this is no longer necessary to fix on the analyzer. We'll reopen the issue if that changes. |
For clarification, the problem wasn't specific to flutter web and the usage of kernel to compile is not specific to flutter web. All external projects using |
@natebosch |
The issue with js interop should be resolved with the latest sdk dev release (2.4.0-dev.0.0) if you want to try that. |
@jakemac53 |
Example gist https://gist.github.com/jakemac53/2d7449e8002589f2f93a828c5bf41915
Given a structure like the gist above, I get an error like this:
So it doesn't appear that anything is actually being exported.
Note that in this scenario the
platform.dart
file does live in a separate module - so it could be an error on the analysis summary side of things. It does work in my IDE and I can click through to the definition (it goes to the default.dart import).cc @jmesserly @vsmenon @leafpetersen
The text was updated successfully, but these errors were encountered: