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 evaluator #405

Merged
merged 20 commits into from
May 24, 2023
Merged

Runtime evaluator #405

merged 20 commits into from
May 24, 2023

Conversation

iusildra
Copy link
Contributor

@iusildra iusildra commented Apr 13, 2023

Goal: make an evaluator that would evaluate an expression with reflection by using jdi and scalameta

How it should work:

  1. Parse the expression into a tree using scalameta
  2. Validate the expression by traversing the scalameta tree, and generating a new tree containing references and any relevant information (arguments, qualifier...) of the corresponding element (or only their name and types if it depends on the current frame), that can be used to cache the expression
    • name resolution (local variable, fields, modules, classes...)
    • method resolution (apply calls, non-generic overloads resolution)
    • type checking (works only on non-generic types because of erasure)
  3. Evaluate the expression using the tree generated during the validation

Because of some overloads resolution or access to private field during the debug session, one evaluation mode might fail but not the other, so there must be some priorities:

@iusildra iusildra force-pushed the runtime-evaluator branch 2 times, most recently from 06b541d to 54c446e Compare April 20, 2023 13:52
@iusildra iusildra force-pushed the runtime-evaluator branch 5 times, most recently from aecbb32 to a277b39 Compare May 11, 2023 07:23
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments

@iusildra iusildra force-pushed the runtime-evaluator branch 3 times, most recently from 167e307 to 9132c9d Compare May 22, 2023 08:04
iusildra and others added 10 commits May 22, 2023 10:13
feat: more complex apply, inheritance partially handled

feat: find implicit .apply() calls

fix: cross compile error

saving

runtime validator

feat: Added runtime case errors. Added qualifiers to runtime tree nodes

fix: removed duplicates in RuntimeEvaluator

some refactoring & basic module resolution

fix: syntax
fix: tests & type component extraction

fix: evaluate any module if already instantiated

fix: .only :'(

looking for error

found it: wrong comparison =D

temporary: use latest version of sbt for the ci to pass

grouped tests by feature and splitted source

feat: evaluate inner & nested types

fix: module resolution

fix: split select and apply validation

removed useless code + defined validation-specific monad

finished applying validation monad, evaluation type ordering

feat: new call evaluation 1/2 + class lookup fix for scala 2

looking for errors bis

looking for errors (forgot some prints)

printy printy

we love print

one last time

cross-compile error x)

found it ?

found error + began checking Java expressions evaluation

feat: runtime validation & evaluation

feat: migrating to the new jdi classes & minor optimization for class lookup

fix: syntax cross compatibility

fix: java syntax warning-error

added tests for static method calls

fix: java syntax warning-error

fix: primitive evaluation 1/n

feat: primitive method evaluation

fix: removed uneeded scalameta deps, fixed sbt plugin error

refactoring

fix: changed deprecated converter + removed unneeded conversions

feat: primitive equality

placed primitive operations tests in separate file. Inlined auxiliary methods

fix: allow unboxable type in primitive operation + load classes on need
fix: recover by looking for classes in static context

fix: applied requested changes 1.5/2

fix: removed access to instance members via static

applied changes 1.75/2, added some docs, fixed nested types resolutions

applied review comments, fixed == operator
fix: module evaluation
@iusildra iusildra marked this pull request as ready for review May 24, 2023 07:03
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @iusildra!

@iusildra iusildra merged commit 419c5ee into scalacenter:main May 24, 2023
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.

Evaluate expression using scalameta in the debugger
2 participants