Infer method calls on known types and warn about nonexistent methods#11399
Infer method calls on known types and warn about nonexistent methods#11399mergify[bot] merged 171 commits intodevelopfrom
Conversation
…tion no longer in outer layer
…ce tests Ideally, the static analysis tests should be runnable without the Graal runtime context. We'd like to be able to run these static passes without Graal runtime, e.g. inside of code editors. But refactoring import resolution and PackageRepository to work without Graal is out of scope of the current types work. It can be planned for later, when needed. For now the focus is to make type checking provide actual value - before that any editor integration wouldn't be useful anyway.
This reverts commit 9d5deaa.
# Conflicts: # engine/runtime/src/main/scala/org/enso/interpreter/runtime/IrToTruffle.scala
|
I'm getting weird test failures in Interestingly, it seems that my followup PR #11955 that removes the @JaroslavTulach do you think we can merge both PRs at once (I need to finish the followup but I'm working on that) OR would you like to help me investigating this serialization issue? Seems like there is still some issue in the persistance when cycles are around. IMO it will be easier to just merge the followup, although we can also try investigating the persistance to make it more robust as such failures probably shouldn't be happening - but I don't think fixing persistance should be the focus of this PR in more extent than necesary. |
…s (no parameter type mismatch checks yet, instead testing method mismatch)
|
I wanted to keep these PRs separate but it initially (I'm waiting for full CI suite to pass to verify) seems that the followup PR #11955 is fixing the persistance issues that are causing test failures in this PR. So I think ideally I'd merge #11955 into this PR and then merge the whole changeset as a single change. I'm not merging yet so that you can review more easily - first my answers to your requests in this PR and then the followup PR that builds on top of it. |
JaroslavTulach
left a comment
There was a problem hiding this comment.
I believe the abstraction of algorithms into singletonizers and their usage is correct. I don't feel completely qualified to talk about the static analysis, but I left few comments inline. If the CI is green, then I am for integrating these changes.
...e/runtime-compiler/src/main/java/org/enso/compiler/common/BuildScopeFromModuleAlgorithm.java
Outdated
Show resolved
Hide resolved
...e/runtime-compiler/src/main/java/org/enso/compiler/common/BuildScopeFromModuleAlgorithm.java
Show resolved
Hide resolved
engine/runtime-compiler/src/main/java/org/enso/compiler/pass/analyse/types/BuiltinTypes.java
Outdated
Show resolved
Hide resolved
...me-compiler/src/main/java/org/enso/compiler/pass/analyse/types/TypeInferencePropagation.java
Outdated
Show resolved
Hide resolved
engine/runtime-compiler/src/main/java/org/enso/compiler/pass/analyse/types/BuiltinTypes.java
Outdated
Show resolved
Hide resolved
| */ | ||
| def compile( | ||
| shouldCompileDependencies: Boolean, | ||
| shouldWriteCache: Boolean, |
There was a problem hiding this comment.
I assume this is a reasonable way to avoid the static type information to be stored in the caches.
There was a problem hiding this comment.
Yes, plus IIRC it fixes a weird behaviour - that even if caches were disabled, they would still be written after compilation or something.
Now, if we run --no-ir-cache, we neither read nor write the caches, which I think is correct.
There was a problem hiding this comment.
The reason why we are seeing failures like https://github.com/enso-org/enso/actions/runs/12680614808/job/35342759884?pr=12023#step:7:2875 is probably because of this nor write behavior. Previously there was one failing run and the bad caches would get overwritten. Now the bad caches stick there forever.
That's rational, but looks like the
may not be ready for that!
There was a problem hiding this comment.
Oh...
Can't we just run the engine with --compile to write the new caches, before running this bench?
engine/runtime-compiler/src/main/scala/org/enso/compiler/context/InlineContext.scala
Outdated
Show resolved
Hide resolved
| * | ||
| * <p>Ideally, the tests for the static analysis capabilities of the compiler should _not_ depend | ||
| * on the Graal runtime context, as they should be runnable in other contexts - i.e. in a Visual | ||
| * Studio Code language server. |
There was a problem hiding this comment.
That would indeed be ideal! The integration of the runtime-compiler into VSCode is blocked right now because we have no way to run the runtime-compiler without TruffleCompilerContext right now. If only these tests could be moved to runtime-compiler project test directory! Then:
- they wouldn't depend on
TruffleCompilerContext - they would need an independent compiler context implementation
- such an implementation could be used in VSCode as well
I remember @Akirathan was once dreaming about using runtime-compiler in VSCode and this was a huge "known unknown".
There was a problem hiding this comment.
Yes I think ideally we should move them there - it seems like the right direction.
But implementing the independent compiler context is definitely a task for a separate PR.
engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/StaticAnalysisTest.java
Outdated
Show resolved
Hide resolved
…atom type resolution (#11955)
|
In 6b0ce25 I merged the followup PR so that we can merge them both to develop in one try. I will proceed with merging once CI gets green. |
|
I've ran the benchmarks and tried comparing against develop: It's really quite hard to tell in each benchmark if any deviations are just due to benchmark instability or real regression (how are you guys managing to live without seeing the standard deviation error bars on the measurements? 😮). Here are a few 'more concerning' results I saw: Still they don't seem bad, so I think I will proceed with merging. |



Pull Request Description
Any) type that does not exist on that type, a warning is reported, because such a call would always result inNo_Such_Methoderror at runtime.Anyhas special behaviour - ifx : Anywe don't know whatxmight be, so we allow all methods on it and defer to the runtime to see if they will be valid or not.BindingsMapby instead relying onStaticModuleScopefor atom type resolution #11955:AtomTypeInterface,TypeRepresentationto be a plain data structure,BindingsMapin favour of relying onStaticModuleScope.Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.