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

Complete ternary expression creates an Option #160

Closed
versvisa opened this issue Apr 6, 2024 · 2 comments
Closed

Complete ternary expression creates an Option #160

versvisa opened this issue Apr 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@versvisa
Copy link

versvisa commented Apr 6, 2024

Version: 0.5.7.9

On the REPL: (if (1 < 0) 12 else 34).to_string()

Expected result: "34"

Actual result:

KontrolSystem.TO2.Runtime.REPLException: <inline>(1, 24): Type 'Option<int>' does not have a method or field 'to_string'
  at KontrolSystem.TO2.AST.MethodCall.Eval (KontrolSystem.TO2.Runtime.REPLContext context) [0x0037c] in <1dc95836ef154e7482cf2c01ca73c2e8>:0
  at KontrolSystem.TO2.AST.Block+REPLBlockEval.PollValue () [0x0002d] in <1dc95836ef154e7482cf2c01ca73c2e8>:0
  at KontrolSystem.KSP.Runtime.KSPUI.Builtin.REPLExpression.Run (System.String expression) [0x0011d] in <aa4b85f6cc974d628372a13d00851de8>:0
  at KontrolSystem.KSP.Runtime.KSPUI.Builtin.ConsoleWindow.OnRunCommand () [0x0005a] in <aa4b85f6cc974d628372a13d00851de8>:0
@untoldwind untoldwind added the bug Something isn't working label Apr 6, 2024
untoldwind added a commit that referenced this issue Apr 6, 2024
@untoldwind
Copy link
Owner

This should be fixed in pre-release 0.5.8.0 (https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.5.8.0).
I was already working on improvements to the REPL system. The command-line is not integrated into the console itself (not entirely finished yet).

@versvisa
Copy link
Author

versvisa commented Apr 7, 2024

I'm surprised that the outcome is different for REPL vs. normal code.

I just stumbled over this while debugging another issue, which turned out to be my fault.

@versvisa versvisa closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants