Mercurial > projects > dang
changeset 52:6decab6f45c4 new_gen
Two new tests that uncovered a bug - we dont to type conversion when calling functions
author | Anders Halager <halager@gmail.com> |
---|---|
date | Sat, 26 Apr 2008 16:12:36 +0200 |
parents | c96cdcbdb9d6 |
children | da551f90e03f |
files | gen/CodeGen.d lala.txt tests/code/basic_types_1.d tests/code/basic_types_2.d |
diffstat | 3 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- /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; +}
--- /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; } +