-
Notifications
You must be signed in to change notification settings - Fork 328
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
Expression update contains full multi-value info #12195
Conversation
|
||
if (publicTypes != null) { | ||
final Type[] allTypes = typeOfNode.findAllTypesOrNull(value, true); | ||
// Relies on the fact that allTypes appends extra types to the end of publicTypes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this safer:
- assert the first
publicType.length
part is the same in both arrays - change the format of the message to avoid this array equlibristic
engine/polyglot-api/src/main/scala/org/enso/polyglot/runtime/Runtime.scala
Show resolved
Hide resolved
* @param conversionType the available conversions | ||
*/ | ||
case class ExpressionType( | ||
visibleType: Vector[String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I like the terminology:
- maybe we use visible type somewhere
- but we certainly never used conversion type!
The documentation is using following terms:
- "has been cast to (the visible part)"
- "hidden types .... can be cast to."
I understand that the current terminology isn't perfect. We can change it, but consistently. We shouldn't be inventing conversionType
term in the protocol only. If we want new term, we should update (at least) docs as well.
ffb1fe2
to
e9b98b5
Compare
e9b98b5
to
6de087f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why the protocol gets new expressionType?: ExpressionType
field. Otherwise kinda OK.
engine/runtime-instrument-common/src/main/java/org/enso/interpreter/instrument/TypeInfo.java
Outdated
Show resolved
Hide resolved
...runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java
Outdated
Show resolved
Hide resolved
...runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java
Outdated
Show resolved
Hide resolved
...runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java
Outdated
Show resolved
Hide resolved
* @param visibleType the public type of the value visible to the user | ||
* @param hiddenType the list of types the value can be converted to | ||
*/ | ||
public record TypeInfo(String[] visibleType, String[] hiddenType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also use plural?
cachedHiddenType = cachedTypeInfo.hiddenType(); | ||
} | ||
|
||
return !Arrays.equals(visibleType, cachedVisibleType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this delegate to typeInfo.equals(...)
method? Once properly implemented to deal with String[]
or once we use List<String>
instead?
* @param visibleType the public type of the value visible to the user | ||
* @param hiddenType the list of types the value can be converted to | ||
*/ | ||
public record TypeInfo(String[] visibleType, String[] hiddenType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
record
is immutable structure, but it references mutable String[]
arrays. Isn't it better to use List<String>
and make it immutable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is close to runtime, so I decided that arrays are a better choice than lists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please move equality check test to TypeInfo
, as Jaroslav suggested.
Pull Request Description
close #12153
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.