# HG changeset patch # User Anders Halager # Date 1209219156 -7200 # Node ID 6decab6f45c4cc86fbe2b73e2b375cf188635d52 # Parent c96cdcbdb9d6579fc4c7b725982b5deeaf7a61b6 Two new tests that uncovered a bug - we dont to type conversion when calling functions diff -r c96cdcbdb9d6 -r 6decab6f45c4 gen/CodeGen.d --- a/gen/CodeGen.d Sat Apr 26 15:54:54 2008 +0200 +++ b/gen/CodeGen.d Sat Apr 26 16:12:36 2008 +0200 @@ -267,6 +267,7 @@ args ~= v; } + // BUG: doesn't do implicit type-conversion return b.buildCall(m.getNamedFunction(func_sym.id.get), args, ".call"); case ExpType.Identifier: auto identifier = cast(Identifier)exp; diff -r c96cdcbdb9d6 -r 6decab6f45c4 lala.txt diff -r c96cdcbdb9d6 -r 6decab6f45c4 tests/code/basic_types_1.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/basic_types_1.d Sat Apr 26 16:12:36 2008 +0200 @@ -0,0 +1,8 @@ +int main() +{ + // test some basic type conversions + byte a = 2; + short b = 3 * a; + int c = b + a; + long d = c * a / b; +} diff -r c96cdcbdb9d6 -r 6decab6f45c4 tests/code/basic_types_2.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/code/basic_types_2.d Sat Apr 26 16:12:36 2008 +0200 @@ -0,0 +1,19 @@ +int main() +{ + byte a = 2; + short b = 3 * a; + int c = b + a; + long d = c * a / b; + + d = itol(2); + d = itol(a); + d = itol(b); + d = itol(c); + + c = stoi(a); + c = stoi(b); +} + +long itol(int x) { return x; } +int stoi(short x) { return x; } +