-
Notifications
You must be signed in to change notification settings - Fork 1
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
(many) Support more types in string+int and int+string concatenation #473
Conversation
rightTypeReference.ClrType == typeof(AsciiString))) { | ||
// 42 + "string" + 42 | ||
expr.TypeReference.ClrType = typeof(AsciiString); | ||
} | ||
else if (expr.Operator.Type == TokenType.PLUS && | ||
(leftTypeReference.ClrType == typeof(int) && | ||
(new[] { typeof(int), typeof(long), typeof(uint), typeof(ulong) }.Contains(typeof(int)) && |
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.
Hmm, these three are quite obviously wrong. 😁 Let's see if we have a test that covers this error of mine... 🙈
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 think we do, in fact. The [Internal compiler error
](error: no viable conversion from 'shared_ptr)` problem is probably caused by this, triggering a different code path, making a previously skipped test no longer be skipped... and that test in turn is currently broken, since it generates C++ code which looks like this:
std::shared_ptr<const perlang::ASCIIString> a = perlang::ASCIIString::from_static_string("a");
perlang::print(a);
std::shared_ptr<const perlang::ASCIIString> b = (*a + *perlang::ASCIIString::from_static_string(" b"));
perlang::print(b);
std::shared_ptr<const perlang::ASCIIString> c = (*a + *perlang::ASCIIString::from_static_string(" c"));
perlang::print(c);
std::shared_ptr<const perlang::ASCIIString> d = (*b + *perlang::ASCIIString::from_static_string(" d"));
perlang::print(d);
This fails because some of these +
operators return a std::shared_ptr<const perlang::String>
, which can't be converted to std::shared_ptr<const perlang::ASCIIString>
. We'll have to look into this at some point, but not tonight...
48e684d
to
ac29a54
Compare
ac29a54
to
c63fda4
Compare
...and remove some commented out code that was merged by mistake in #462.
c63fda4
to
321f94d
Compare
No description provided.