Skip to content

Commit

Permalink
[Resolver] Wrote reproducing-test for aBothe/Mono-D#622
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Bothe committed Aug 13, 2015
1 parent 8d2450b commit 1899fa0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Tests/CompletionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,37 @@ void main() {
Assert.That(CodeCompletion.GenerateCompletionData (ed, g, 'a', true), Is.True);
}

[Test]
public void ForeachIteratorVarArg()
{
var code = @"module A;
template T(){ struct S { int a, b, c; }
static void print(Templ=S)(Templ[] p_args...) {
int S;
foreach(cur; p_args)
{
cur;
}}}
";
var ed = GenEditorData(6, 5, code);
var S = ResolutionTests.N<DClassLike> (ed.SyntaxTree, "T.S");
var print = ResolutionTests.N<DMethod> (ed.SyntaxTree, "T.print");
var cur = (ResolutionTests.S (print, 1, 0, 0) as IExpressionContainingStatement).SubExpressions[0];

var ctxt = ResolutionTests.CreateDefCtxt (ed.ParseCache, print, cur.EndLocation);
AbstractType t;
MemberSymbol ms;

t = ExpressionTypeEvaluation.EvaluateType (cur, ctxt);
Assert.That (t, Is.TypeOf(typeof(MemberSymbol)));
ms = (MemberSymbol)t;

Assert.That (ms.Base, Is.TypeOf(typeof(TemplateParameterSymbol)));
t = (ms.Base as TemplateParameterSymbol).Base;

Assert.That (t, Is.TypeOf(typeof(StructType)));
}

[Test]
public void ForeachIteratorCompletion()
{
Expand Down

0 comments on commit 1899fa0

Please sign in to comment.