|
[#414] |
project: compiler |
priority: low |
category: missing feature |
|
submitter |
assigned to |
status |
date submitted |
|
Burak |
Martin |
won't fix |
2005-04-06 11:29:08.0 |
| subject |
empty case class constructor |
| code |
case class Empty[a] extends IntMap[a];
case class Node[a](left: IntMap[a], keyVal: Pair[int, a], right: IntMap[a]) extends IntMap[a];
abstract class IntMap[a] {
def lookup(key: int): a = this match {
case Empty =>
error("clef inexistante")
case _ =>
};
};
|
| what happened |
IntMap.scala:5: polymorphic expression of type [a]()Empty[a] cannot be instantiated from expected type IntMap[a]\
case Empty =>
^
|
| what expected |
The problem goes away if one writes Empty().
Shouldn't we treat Empty and Empty() the same?
The phase that handles empty argument list in constructors (which? Analyzer?) could also handle case class patterns that do not take parameters. |
|
[back to overview] |