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

Possible issue with type checking in Msg Shard or result type of ToString #672

Closed
Yttruire opened this issue May 12, 2023 · 2 comments
Closed

Comments

@Yttruire
Copy link
Contributor

Describe the bug

When a value (e.g. Int) is converted into a String via the ToString shard and then passed to the Msg shard, it gives the following error whereby it seems that the type of the result of ToString is incorrect or undefined, or that Msg has an issue with type checking on the results of ToString:

[error] [2023-05-12 12:41:44.211] [T-21740] [SHCore.cpp::1193] Parameter validation failed: Parameter Message not accepting this kind of variable: & (valid types: String) shard: Msg
[error] [2023-05-12 12:41:44.211] [T-21740] [SHCore.cpp::1239] Failed parameter index: 0 line: 17 shard: Msg

There is no error when Msg is called on a normal String that has not undergone ToString type conversion

To Reproduce

The following code block will result in the above issue

(defmesh main)
(defshards test-shard [test-value]
  test-value (ToString) >= .local-test
  ;; (IsString) (Log) ;; If this line is run, it will output true, so it is might not be a (ToString) bug
  (Msg .local-test)
  ;; (Msg "Normal string") ;; if this line is run, there is no error
)

(defwire example
  (test-shard 3))

(schedule main example)
(run main 1 1)

Expected behavior

It should print "3" normally

@sinkingsugar
Copy link
Member

By design Msg only outputs a "message" so a string.
Do .local-test (Log) to output variable value.

@Yttruire
Copy link
Contributor Author

This issue has been clarified. Refer to #673 for a follow-up bug regarding the printed error message.

The behavior that the Msg shard cannot print the value of variables is intentional but not fully correct (as it can still print the value of argument variables). Refer to #674 for the follow up to this issue, and here for the respective issue in documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants