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

[INFO] Conversion to string #783

Merged
merged 3 commits into from Jun 17, 2016
Merged

[INFO] Conversion to string #783

merged 3 commits into from Jun 17, 2016

Conversation

melex750
Copy link
Contributor

@krzys-h, I saw you were working on this so I'm sharing what I did a few days ago.

But first, recent changes appear to have broke these conversions:

message("" + this);      // output: "Pointer"
message("" + array);     // output: "("
message("" + position);  // output: "point("

As for this PR:
The first two commits are good, imo.
I'm not very happy with the third, but it works.

Fixes these bugs:
TEST_F(CBotUT, DISABLED_FunctionBadReturn)
Currently, you can return a string from any non-void function
and crash the game if you assign that to something other than a string.

TEST_F(CBotUT, DISABLED_BadStringAdd_Issue535)

anArray[0] = "A"; // "issue-419"

voidfunc() + "";  // crash on run

message( "" + voidfunc() ); // crash on run

aVar += ;
aVar = ;

@melex750
Copy link
Contributor Author

melex750 commented May 29, 2016

~~Did it start building automatically? ~not good.~~
That was different.

@krzys-h
Copy link
Member

krzys-h commented May 29, 2016

Huh, it looks like the new Jenkins configuration builds PRs from outside contributors automatically and I don't even see a config option to disable it...

@melex750
Copy link
Contributor Author

Possible solution HERE.
This looks like it might be the Jenkins plugin you were using before.

@krzys-h krzys-h merged commit 37ab015 into colobot:dev Jun 17, 2016
krzys-h added a commit that referenced this pull request Jun 17, 2016
[INFO] Conversion to string
@melex750
Copy link
Contributor Author

Sorry, I forgot to mention that this PR lets this work too:

string str;
str = 2.4; <-- expressions like this are commented-out in unit tests.
str += 4.2;

   NOTE: arithmetic and boolean operations require
   parentheses when concatenating strings.

message("" + (2+2) + "" );  without "( )"  output is "22"

krzys-h added a commit that referenced this pull request Jun 18, 2016
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.

None yet

2 participants