Skip to content
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

Runtime and analyzer generate different source for the same macro ("library augment" missing in runtime) #54848

Closed
DanTup opened this issue Feb 7, 2024 · 13 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. feature-macros Implementation of the macros feature

Comments

@DanTup
Copy link
Collaborator

DanTup commented Feb 7, 2024

When debugging, we need the macro generated files produced by the analyzer and runtime to match up so that breakpoints added before you start running (done by navigating using the analyzer to the analyzer-produced virtual files) are in the correct locations when the code is run.

Currently (with https://dart-review.googlesource.com/c/sdk/+/349864 patched in), there seems to be a difference ("library augment" missing in the runtime version) which means all of the locations are different.

Left is from the analyzer, right is from the VM.

Screenshot 2024-02-07 180342

@bwilkerson
Copy link
Member

@jakemac53

@jakemac53
Copy link
Contributor

Interesting, @johnniwinther is the cfe removing this line by chance?

@davidmorgan
Copy link
Contributor

FYI #54718 is on me to add a way of testing that CFE and analyzer output the same code.

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. feature-macros Implementation of the macros feature labels Feb 8, 2024
@jakemac53
Copy link
Contributor

jakemac53 commented Feb 20, 2024

Working to resolve this in https://dart-review.googlesource.com/c/sdk/+/353322 . This analyzer was adding this before and this works towards moving that into the shared code.

copybara-service bot pushed a commit that referenced this issue Feb 27, 2024
Bug: #54848
Change-Id: I5ec3cb01a76955e4cbe91a867277c9d91ce5c927
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353322
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Jake Macdonald <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
@DanTup
Copy link
Collaborator Author

DanTup commented Mar 13, 2024

@jakemac53 this was fixed, although I'm seeing differences with prefixes in recent code (c506bb8):

image

I believe everything I have is consistent from that version (analyzer, VM etc.), but it's possible I've missed something. Any ideas?

@scheglov
Copy link
Contributor

It looks that CFE does not remove unnecessary import prefixes yet.

@jakemac53
Copy link
Contributor

cc @davidmorgan maybe we should prioritize a test ensuring no differences here :D

@scheglov just so I understand, the analyzer is using the code optimizer now, but the CFE is not?

The priority should imo be that we generate the same code - so I think we should either revert the analyzer change to use the code optimizer, or land the support to use it in the CFE ASAP if that is easy to do.

@scheglov
Copy link
Contributor

Well, it is trivial to remove from the analyzer.
IIRC it was told that CFE can support this too.
But actually implementing it in CFE is outside of my normal scope.
So, I would prefer someone else to do this integration.

@jakemac53
Copy link
Contributor

Ok, I would recommend reverting it in the analyzer for now then, until @johnniwinther can implement (or delegate) support for it.

@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/357441 to disable for now in the analyzer.

copybara-service bot pushed a commit that referenced this issue Mar 14, 2024
Bug: #54848
Change-Id: Ia3cb73cd930194c434921ba2e9bab9c714d792f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357441
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
@davidmorgan
Copy link
Contributor

Yeeeeah there is often a case for testing being cheaper the sooner you add it ;) if it looks like I should tackle the golden tests as the very next thing I do please let me know.

@jakemac53
Copy link
Contributor

Yeeeeah there is often a case for testing being cheaper the sooner you add it ;) if it looks like I should tackle the golden tests as the very next thing I do please let me know.

I think getting flutter working should be the priority, but this should probably follow up closely behind

@davidmorgan
Copy link
Contributor

Closing with #54718 to track adding test support / coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. feature-macros Implementation of the macros feature
Projects
Development

No branches or pull requests

6 participants