Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions csharp/ql/test/library-tests/typealias/alias.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

using TupleType1 = (int, object);
using TupleType2 = (int, string);
using TupleType3 = (int, object);
using Point = (int x, int y);

public class TupleMethods
{
public void M1(TupleType1 t)
{
var x = t.Item1;
var y = t.Item2;
}

public void M2(TupleType2 t)
{
var x = t.Item1;
var y = t.Item2;
M1(t);
}

public void M3(Point p)
{
var x = p.x;
var y = p.y;
}

public void M4(TupleType3 t) { }
}
4 changes: 4 additions & 0 deletions csharp/ql/test/library-tests/typealias/alias.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
| alias.cs:10:17:10:18 | M1 | alias.cs:10:31:10:31 | t | (Int32,Object) |
| alias.cs:16:17:16:18 | M2 | alias.cs:16:31:16:31 | t | (Int32,String) |
| alias.cs:23:17:23:18 | M3 | alias.cs:23:26:23:26 | p | (Int32,Int32) |
| alias.cs:29:17:29:18 | M4 | alias.cs:29:31:29:31 | t | (Int32,Object) |
8 changes: 8 additions & 0 deletions csharp/ql/test/library-tests/typealias/alias.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import csharp

from Method m, Parameter p, Type t
where
m.fromSource() and
p = m.getAParameter() and
p.getType() = t
select m, p, t.toString()