Skip to content

Commit

Permalink
Allow 1.userproperty syntax.
Browse files Browse the repository at this point in the history
At the same time, it disallows short floating literals like 1.f, 1.Li, ... (Part of issue 6277)
  • Loading branch information
9rnsr committed Dec 26, 2011
1 parent 3cb2e12 commit ff7e522
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/lexer.c
Expand Up @@ -2071,7 +2071,10 @@ TOK Lexer::number(Token *t)
continue;
}
if (c == '.' && p[1] != '.')
{ if (isalpha(p[1]) || p[1] == '_')
goto done;
goto real;
}
else if (c == 'i' || c == 'f' || c == 'F' ||
c == 'e' || c == 'E')
{
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test16.d
Expand Up @@ -269,7 +269,7 @@ void test9()
{
len9(a[0], a[1], a[2], a[3]);

float justOne() { return 1.f; }
float justOne() { return 1.0f; }

float dot = justOne();
if (dot < 0.f)
Expand Down
2 changes: 1 addition & 1 deletion test/runnable/test28.d
Expand Up @@ -425,7 +425,7 @@ void test24()

void test25()
{
ireal x = 4.Li;
ireal x = 4.0Li;
ireal y = 4.0Li;
ireal z = 4Li;
creal c = 4L + 0Li;
Expand Down
4 changes: 2 additions & 2 deletions test/runnable/test4.d
Expand Up @@ -555,7 +555,7 @@ void test16()

void test17()
{
creal z = 1. + 2.i;
creal z = 1. + 2.0i;

real r = z.re;
assert(r == 1.0);
Expand Down Expand Up @@ -672,7 +672,7 @@ void test21()

void test22()
{
creal z1 = 1. - 2.i;
creal z1 = 1. - 2.0i;
ireal imag_part = z1.im/1i;
}

Expand Down

0 comments on commit ff7e522

Please sign in to comment.