-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Not dart: or package: URIs cause exception #31801
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
Comments
From the IDE picture, I believe what you need is support for I have made changes in the past to remove any knowledge in fasta about non-dart and non-package schemes. We used to assume they were "file:" URIs incorrectly, instead we changed it to not assume anything and delegate to the underlying FileSystem to figure it out. Now any errors about unknown schemes comes from the underlying file system. By default we are running the frontend with a PhisicalFileSystem, for analyzer (and for the vm) this needs to be changed to use a file system that supports:
See also my comment on this other bug about If you believe #31618 is tracking what you need, we can probably close this bug as a duplicate. Beyond supporting dart-ext, the only thing I think we might want to do is to improve the error messages *(either change the default error or catch it and produce something the end user can understand) |
On the Analyzer level it does not matter whether the URI is As it is now, the |
Please make sure to include the following information in future bug reports:
|
The method
@kmillikin Please don't close issues on formal grounds. |
You get an exception from package:analyzer/src/dart/analysis/frontend_resolution.dart:485:7 because it throws the wrong exception. As far as I can tell, you wrote this code yourself: https://github.com/dart-lang/sdk/blame/master/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart#L485 |
The /// Returns a [FileSystemEntity] corresponding to the given [uri].
///
/// Uses of `..` and `.` in the URI are normalized before returning.
///
/// If the URI scheme is not supported by this file system, an [Error] will be
/// thrown.
///
/// Does not check whether a file or folder exists at the given location.
FileSystemEntity entityForUri(Uri uri); And actually there is no good way for any implementation to support random schemes. If it is not supported, what should it do? Return empty string? How FrontEnd will know that is not supported, so that an error should be reported? @kmillikin @stefantsov Can you please triage this issue? |
The comment is wrong, and the API is clearly marked as unstable. You have to throw FileSystemException as I've told you in past code reviews. Please stop this nonsense. |
Did you? I cannot find this :-( Yes, throwing
|
Why did you reopen this bug? Because of the #main method? If so, we don't need anymore bugs tracking that problem. |
I understand that we are all aware that a generic exception throwing But this is a specific situation - invalid URI makes FrontEnd return not useful results. And I think it is useful to track it separately, because a fix for this problem is also specific. There is no something generic that can fix all |
I was probably thinking about the conversation that led you to implement https://codereview.chromium.org/2864183002. However, it seems like we forgot about entityForUri in that CL. My apologies. Actually, my plan is to completely get rid of the bad #main. I know it doesn't work for the analyzer, and I know it is a problem for incremental compilation. So as far as I'm concerned, we need to remove KernelTarget.erroneousProgram and consider it a P1 issue. |
The issue with |
And the same issue causes problems in Analyzer integration.

This happens because
Loader.read
translates onlydart
orpackage
URIs and keep all other URIs as if they werefile
URIs.The text was updated successfully, but these errors were encountered: