rsdn/nemerle — Issue #278: Modifing immutable field give runtime, not compile time error
Author: CodingUnit
Created: 2012-02-01 18:11:48+00:00
State: open
Labels: Bug, Compiler

This example makes InvalidProgramException exception, not compile time error during modifiying immutable field of class, but with = its gives compile error as in #276:

```nemerle
using Nemerle;
using System.Console;

public struct InnerDbRoot
{
public mutable d_new : int;
}

public class Dbx
{
public root : InnerDbRoot;

public calc_alloc() : void
{
root.d_new += 5; //Exception there is!
}
}

module Test
{

Main() : void
{
def d = Dbx();

d.calc_alloc();
WriteLine(d.root.d_new);
_ = ReadLine();
}
}
```