Skip to content

Conversation

@killian-scalian
Copy link
Collaborator

No description provided.

@killian-scalian killian-scalian marked this pull request as ready for review August 1, 2025 16:13
@killian-scalian killian-scalian requested a review from tbittar August 1, 2025 16:13
grammar/Expr.g4 Outdated
| IDENTIFIER '[' expr ']' # timeIndex
| '(' expr ')' '[' shift ']' # timeShiftExpr
| '(' expr ')' '[' expr ']' # timeIndexExpr
| 'max' '(' expr (',' expr)* ')' # maxExpr
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be MAX here, no ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It depends, we want MAX or max as operand?


@dataclass(frozen=True)
class CopyVisitor(ExpressionVisitorOperations[ExpressionNode]):
class CopyVisitor(ExpressionVisitorOperations[ExpressionNode]): # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need #type : ignore ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it depends with what ExpressionVisitorOperations returns. If it returns ExpressionNode, it is ok, if it returns T, we need to ignore

def port_field_aggregator(self, node: PortFieldAggregatorNode) -> float:
raise NotImplementedError()

def max_node(self, node: MaxNode) -> float: # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need type : ignore ?

"""
import typing

from typing import cast
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is it used for ?

return left_value / right_value

def max_node(self, node: MaxNode) -> ExpressionNode: # type: ignore
return MaxNode(operands=[visit(op, self) for op in node.operands]) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again why type: ignore ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because it returns ExpressionNode, wich is not homogene with ExpressionVisitor abstract method and the visit method

@AntaresSimulatorTeam AntaresSimulatorTeam deleted a comment from wiiisp Aug 5, 2025
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.

3 participants