Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Issue 5933 & 7159 & 9377 - Invoke function semantic3 correctly where it is required. #1543

Merged
merged 5 commits into from Jan 24, 2013

Conversation

Projects
None yet
4 participants
Member

9rnsr commented Jan 24, 2013

  • Issue 5933 - Cannot retrieve the return type of an auto-return member function
  • Issue 7159 - Forward reference when casting auto return method
  • Issue 9377 - Link-failure regression cause by fixing issue 8504

This is a superseded pull of #535.

By this, the test result of bug 6661 in test/compilable/compile1.d is changed. I think that the old one was a incorrect behavior.


Requires a phobos pull: D-Programming-Language/phobos#1096

Member

9rnsr commented Jan 24, 2013

I tested test/runnable/test9377.sh only in Windows platform. So it might fail in Posix platforms.
Please wait the auto tester result.

Member

9rnsr commented Jan 24, 2013

I'm not sure why the test script fails in Linux_64_32 platform.
http://d.puremagic.com/test-results/pull.ghtml?projectid=1&runid=467723

@braddr : Do you know the reason why the test fails?

Member

9rnsr commented Jan 24, 2013

Hmm, might -m${MODEL} be required? I'm trying it...

@don-clugston-sociomantic don-clugston-sociomantic and 1 other commented on an outdated diff Jan 24, 2013

test/compilable/compile1.d
@@ -80,6 +80,7 @@ static assert(!is(typeof(bug6650!(int)(18))));
/**************************************************
6661 Templates instantiated only through is(typeof()) shouldn't cause errors
+ => should cause errors.
@don-clugston-sociomantic

don-clugston-sociomantic Jan 24, 2013

Contributor

The point is that it should not print any ungagged error message. I agree that is(typeof()) should return false.

@9rnsr

9rnsr Jan 24, 2013

Member

OK, I convinced. I'll remove this line.

9rnsr added some commits Jan 24, 2013

@9rnsr 9rnsr fix Issue 9377 - Link-failure regression cause by fixing issue 8504
The test is disabled only in win64 platform.
6a0be5b
@9rnsr 9rnsr fix test result for issue 6661
Inherently, when you try to instantiate a template, the whole template
body correctness should be checked at the same time.

In this case, bug6661!(int).qutz is a normal function declared inside
template, so it should be instantiated at the same time with bug6661!(int).
Now, the inner `static assert(qutz(13).sizeof!=299);` runs the semantic3
of qutz by calling it. So the module level static assertion fails _correctly_.

But, `is(typeof(bug6661x!(int)))` still returns true incorrectly.
I think it is yet another known issue in current dmd implementation.
e914286
Member

9rnsr commented Jan 24, 2013

Rearranged commits to keep clean history.
Now, auto tester result displays all green in all platformd. Ready to merge.

@MartinNowak MartinNowak commented on the diff Jan 24, 2013

src/func.c
@@ -1730,6 +1730,60 @@ void FuncDeclaration::semantic3(Scope *sc)
//fflush(stdout);
}
+bool FuncDeclaration::functionSemantic()
+{
+ if (scope && !originalType) // semantic not yet run
@MartinNowak

MartinNowak Jan 24, 2013

Member

Why not using semanticRun <= PASSsemantic?

@WalterBright

WalterBright Jan 25, 2013

Owner

the logic isn't quite the same, if you look at FuncDeclaration::semantic()

@MartinNowak MartinNowak commented on the diff Jan 24, 2013

src/func.c
+ return false;
+ }
+
+ // if inferring return type, sematic3 needs to be run
+ if (scope && (inferRetType && type && !type->nextOf() ||
+ getFuncTemplateDecl(this)))
+ {
+ return functionSemantic3();
+ }
+
+ return true;
+}
+
+bool FuncDeclaration::functionSemantic3()
+{
+ if (scope)
@MartinNowak

MartinNowak Jan 24, 2013

Member

semanticRun < PASSsemantic3 && scope?

@9rnsr

9rnsr Jan 25, 2013

Member

I had thought same doubts, but I didn't change it because this is for the refactoring.

Owner

WalterBright commented Jan 24, 2013

dawgfoto, I need to pull this. I'll go back and check your suggestions.

@WalterBright WalterBright added a commit that referenced this pull request Jan 24, 2013

@WalterBright WalterBright Merge pull request #1543 from 9rnsr/fix5933
Issue 5933 & 7159 & 9377 - Invoke function semantic3 correctly where it is required.
de4f8f6

@WalterBright WalterBright merged commit de4f8f6 into dlang:master Jan 24, 2013

1 check passed

default Pass: 10
Details

@WalterBright WalterBright added a commit that referenced this pull request Jan 25, 2013

@WalterBright WalterBright Merge pull request #1548 from WalterBright/b31
minor correction to pull #1543
7410295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment