Skip to content

Commit

Permalink
Merge pull request #6409 from lydia-duncan/testRecordArgument
Browse files Browse the repository at this point in the history
Add a test of declaring an argument with a generic record instantiation
[tests, not reviewed]

Realized I had covered this for the class case but not the record case.

Passed with a clean checkout
  • Loading branch information
lydia-duncan authored Jun 7, 2017
2 parents 38e30b0 + 4150f6f commit 45c35d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/classes/initializers/records/generics/argument_type.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Checks the behavior for declaring an argument with the type desired
record Foo {
type t;
var x;

proc init(xVal) {
t = xVal.type;
x = xVal;
super.init();
}
}

proc takesAFoo(val: Foo(int, int)) {
writeln(val);
writeln(val.type: string);
}

var f = new Foo(10);
takesAFoo(f);
2 changes: 2 additions & 0 deletions test/classes/initializers/records/generics/argument_type.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(x = 10)
Foo(int(64),int(64))

0 comments on commit 45c35d2

Please sign in to comment.