match не работает?
От: Clerk  
Дата: 21.11.09 21:19
Оценка:
В последней ревизии компилятор ругается на след. код
using System;
using System.Console;
using Nemerle.Utility;

module Program
{
  variant RgbColor
  {
    | Red
    | Yellow
    | Green
    | Different
      {
        red : float;
        green : float;
        blue : float;
      }
  }

  MatchStringLiteral(lit : string) : RgbColor
  { | "yellow" => RgbColor.Yellow
    | "red"    => RgbColor.Red
    | "green"  => RgbColor.Green
    | _        => throw Exception();
  }

  Main() : void
  {
    WriteLine(MatchStringLiteral("green").ToString());
  }
}


Error    1    expected void -> Program.RgbColor.Yellow-, got void -> Program.RgbColor.Red in computation branch: common super type of types [void -> Program.RgbColor.Yellow, void -> Program.RgbColor.Red] is just `object', please upcast one of the types to `object' if this is desired    C:\_Other\2009.08.21\ConsoleApplication5\Main.n    22    20    ConsoleApplication5
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.