-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
61 deletions.
There are no files selected for viewing
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
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
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,26 @@ | ||
// this verifies that inheritance parent type is recognized if | ||
// use before the class definition in file | ||
// https://github.com/ccrma/chuck/issues/375 | ||
|
||
// instance of our event | ||
TheEvent e; | ||
|
||
// spork a shred to broadcast later | ||
spork ~ timer( 1::samp ); | ||
|
||
// verify e can be recognized as child of Event, | ||
// before TheEvent definition | ||
e => now; | ||
|
||
// if we got here, then done | ||
<<< "success" >>>; | ||
|
||
// custom Event class | ||
class TheEvent extends Event { } | ||
|
||
// a function to wait a bit and broadcast | ||
fun void timer( dur T ) | ||
{ | ||
T => now; | ||
e.broadcast(); | ||
} |
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,27 @@ | ||
// error case: out of order class definitions; Y extends X, but | ||
// Y is defined ahead of X; certain definitions can appear after | ||
// usage or invocation, but for now this is not permitted | ||
|
||
|
||
// define Y | ||
class Y extends X | ||
{ | ||
public void foo() { } | ||
} | ||
|
||
// define X | ||
class X | ||
{ | ||
public void foo() { } | ||
int y; | ||
dur z; | ||
} | ||
|
||
// instantiate a X | ||
X x; | ||
|
||
// instantiate a Y | ||
Y y; | ||
|
||
// shouldn't get here... | ||
<<<"shouldn't get here...">>>; |
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,6 @@ | ||
error-class-def-order.ck:7:9: error: cannot extend incomplete type 'X' | ||
[7] class Y extends X | ||
^ | ||
error-class-def-order.ck:7:9: error: ...(note: the parent's declaration must precede child's) | ||
[7] class Y extends X | ||
^ |