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

Cross compilable Scala 2/3 abstractions #286

Merged
merged 13 commits into from
Apr 18, 2023

Conversation

MateuszKubuszok
Copy link
Member

@MateuszKubuszok MateuszKubuszok commented Mar 15, 2023

This PR is a draft proposal for an alternative architecture of macros. (Touching #279 #276).

TODO:

  • create an entrypoint to call this new structore from Scala 2 macros
  • create a temporary bridge which would delegate not-yet-implemented branched to old macro code
  • create an initial implementation for this structure in Scala 3 to show that it actually does enable implementation
  • make Scala 3 version return ??? as trees to make it compile all cases but fail tests in runtime to make the migration process less PITA

@MateuszKubuszok MateuszKubuszok added this to the scala-3 milestone Mar 15, 2023
@MateuszKubuszok MateuszKubuszok requested a review from krzemin March 15, 2023 18:05
@MateuszKubuszok MateuszKubuszok force-pushed the feature/typed-inner-abatractions branch from de3f966 to b8de712 Compare March 15, 2023 18:30
@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: -27.39 ⚠️

Comparison is base (64e1413) 85.64% compared to head (eccf02e) 58.26%.

❗ Current head eccf02e differs from pull request most recent head b0e579a. Consider uploading reports for the commit b0e579a to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           scala-3     #286       +/-   ##
============================================
- Coverage    85.64%   58.26%   -27.39%     
============================================
  Files           31       57       +26     
  Lines         1066     1567      +501     
  Branches        98      129       +31     
============================================
  Hits           913      913               
- Misses         153      654      +501     
Impacted Files Coverage Δ
...ey/internal/compiletime/ChimneyTypesPlatform.scala 0.00% <0.00%> (ø)
.../internal/compiletime/ConfigurationsPlatform.scala 0.00% <0.00%> (ø)
...d/chimney/internal/compiletime/ExprsPlatform.scala 0.00% <0.00%> (ø)
...chimney/internal/compiletime/ResultsPlatform.scala 0.00% <0.00%> (ø)
...d/chimney/internal/compiletime/TypesPlatform.scala 0.00% <0.00%> (ø)
...al/compiletime/derivation/DerivationPlatform.scala 0.00% <0.00%> (ø)
...ternal/compiletime/derivation/LegacyPlatform.scala 0.00% <0.00%> (ø)
...nd/chimney/internal/macros/TransformerMacros.scala 97.65% <ø> (ø)
...and/chimney/compiletime/ChimneyExprsPlatform.scala 0.00% <0.00%> (ø)
...and/chimney/compiletime/ChimneyTypesPlatform.scala 0.00% <0.00%> (ø)
... and 21 more

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@krzemin krzemin force-pushed the feature/typed-inner-abatractions branch from 2cf3971 to 8bc7356 Compare March 17, 2023 19:44
* Refactor Types abstractions:

- split Types (language & stdlib types) and ChimneyTypes (library-specific types)
- simplify the API structure

* Restructure Scala 2 platform types impl

* make Scala 2 code compiling

* implement Scala 3 types, make it compile

* refactor Exprs interface

* implementation of new Expr interface for Scala 2

* implementation of new Expr interface for Scala 3

* remove unused code

* resolved TODO comments with implicit exprs resolution

* uncomment code
…erContext, fix legacy macro workaround implementation (#294)

* Share TransformerDefinitionErrors, split TransformerContext and PatcherContext, fix legacy macro workaround implementation

* Improve error handling in Results

* Move DerivationResult to a separate file outside mix-in

* Remove unnecessary src = src

* Fix to actually use the implementation in Gateway
@krzemin krzemin changed the title Draft: Typed inner abstractions Cross compilable Scala 2/3 abstractions Apr 18, 2023
@krzemin krzemin merged commit a68d89f into scala-3 Apr 18, 2023
@MateuszKubuszok MateuszKubuszok deleted the feature/typed-inner-abatractions branch April 19, 2023 10:10
krzemin added a commit that referenced this pull request Apr 19, 2023
* The first draft of an elternative structure for macros towards which current code could be migrated, one rule by one

* Small cleanup

* fixup! Small cleanup

* Split Transformer, PartialTransformer and Patcher into shared code and *Platform files

* Initial Scala 3 implementation for some of compiletime abstractions

* Remodel new types abstractions a bit

* Move logging from Context to DerivationResult

* Add missing abstractions from old macros

* Refactor Types/Exprs module (#293)

* Refactor Types abstractions:

- split Types (language & stdlib types) and ChimneyTypes (library-specific types)
- simplify the API structure

* Restructure Scala 2 platform types impl

* make Scala 2 code compiling

* implement Scala 3 types, make it compile

* refactor Exprs interface

* implementation of new Expr interface for Scala 2

* implementation of new Expr interface for Scala 3

* remove unused code

* resolved TODO comments with implicit exprs resolution

* uncomment code

* Share TransformerDefinitionErrors, split TransformerContext and PatcherContext, fix legacy macro workaround implementation (#294)

* Share TransformerDefinitionErrors, split TransformerContext and PatcherContext, fix legacy macro workaround implementation

* Improve error handling in Results

* Move DerivationResult to a separate file outside mix-in

* Remove unnecessary src = src

* Fix to actually use the implementation in Gateway

* Remove resolved todo in reportError

* Align transformerDefinitionPrefix type with what is used in legacy macros, use proper error reporing in flag parsing

* Move derivation related traits to transformer subpackage

---------

Co-authored-by: Piotr Krzemiński <2477704+krzemin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants