It seems there are two confusions here. The first one is the one identified by Rex and Kim. You can read this section from Programming in Scala for more information. It boils down to:
x match { case Some(foo) => } // variable pattern, defines and binds variable foo
x match { case Some(Foo) => } // constant pattern, based on val Foo
x match { case Some(`foo`) => } // constant pattern for lowercase val
You can also use a guard to constraint the match
x match { case Some(foo) if condition => }
The second confusion is that you want to "make a ChangeSet object with to from the method parameters". If I understand you correctly you are trying to construct an object using the case class syntax:
ChangeSet(field, from, to)
This does not work on that side of pattern matching. What happens on the case side of the pattern match can actually be seen as the reverse of the construction of ChangeSet. match { case ChangeSet(field, from, to) => } sort of deconstructs your ChangeSet object and assigns its parts to the field, from and to vals. This is also true when it's composed like this: Some(ChangeSet(field, from, to)), it first deconstructs Some and then ChangeSet. You can see that working on value definitions as it is leveraging the same deconstruction mechanism:
scala> val cset = ChangeSet("a", "from", "to")
cset: ChangeSet = ChangeSet(a,from,to)
scala> val Some(ChangeSet(s, o1, o2)) = Some(cset)
s: String = a
o1: java.lang.Object = from
o2: java.lang.Object = to
It seems what you want to do is to construct a new object that copies the value of ChangeSet but replacing a single field. Case classes supports this with copy, continuing with my REPL example:
scala> val cset2 = cset.copy(from = o2)
cset2: ChangeSet = ChangeSet(a,to,to)
With that in mind, here is another suggestion for change:
def change(field:String, from:Object, to:Object) {
changed.find(_.field == field) match {
case Some(cset) =>
val csetnew = cset.copy(from = to)
// do stuff with csetnew
case None =>
// do stuff
}
}