-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6409 from lydia-duncan/testRecordArgument
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
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
test/classes/initializers/records/generics/argument_type.chpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
2
test/classes/initializers/records/generics/argument_type.good
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(x = 10) | ||
Foo(int(64),int(64)) |