Skip to content

Commit

Permalink
concurrent: ActorMsg allow id to be any Obj so that it can be used wi…
Browse files Browse the repository at this point in the history
…th enums too
  • Loading branch information
briansfrank committed Sep 6, 2024
1 parent f5c290b commit 8a5f724
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/concurrent/fan/ActorMsg.fan
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
const class ActorMsg
{
** Constructor with zero arguments
new make0(Str id)
new make0(Obj id)
{
this.id = id
}

** Constructor with one argument
new make1(Str id, Obj? a)
new make1(Obj id, Obj? a)
{
this.id = id
this.a = a
}

** Constructor with two arguments
new make2(Str id, Obj? a, Obj? b)
new make2(Obj id, Obj? a, Obj? b)
{
this.id = id
this.a = a
this.b = b
}

** Constructor with three arguments
new make3(Str id, Obj? a, Obj? b, Obj? c)
new make3(Obj id, Obj? a, Obj? b, Obj? c)
{
this.id = id
this.a = a
Expand All @@ -43,7 +43,7 @@ const class ActorMsg
}

** Constructor with four arguments
new make4(Str id, Obj? a, Obj? b, Obj? c, Obj? d)
new make4(Obj id, Obj? a, Obj? b, Obj? c, Obj? d)
{
this.id = id
this.a = a
Expand All @@ -53,7 +53,7 @@ const class ActorMsg
}

** Constructor with five arguments
new make5(Str id, Obj? a, Obj? b, Obj? c, Obj? d, Obj? e)
new make5(Obj id, Obj? a, Obj? b, Obj? c, Obj? d, Obj? e)
{
this.id = id
this.a = a
Expand All @@ -63,8 +63,8 @@ const class ActorMsg
this.e = e
}

** Message identifier key
const Str id
** Message identifier key, typically string or enum
const Obj id

** Argument a
const Obj? a
Expand Down
4 changes: 4 additions & 0 deletions src/concurrent/test/ActorTest.fan
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,10 @@ class ActorTest : Test
verifyMsg(ActorMsg("foo", "a", "b", "c", "d"), 4, "a", "b", "c", "d", null)
verifyMsg(ActorMsg("foo", "a", "b", "c", "d", "e"), 5, "a", "b", "c", "d", "e")
verifyMsg(ActorMsg("foo", "a", "b", null, "d", "e"), 5, "a", "b", null, "d", "e")

m := ActorMsg(123, "alpha")
verifyEq(m.id, 123)
verifyEq(m.a, "alpha")
}

Void verifyMsg(ActorMsg m, Int count, Obj? a, Obj? b, Obj? c, Obj? d, Obj? e)
Expand Down

0 comments on commit 8a5f724

Please sign in to comment.