#1017 Nitpicker's issue on field initialization error reporting

katox Tue 9 Mar 2010

I found out that this code

1  class E
2  {
3    Int i := Int[10] // incompatible types  
4  
5    new make()
6    {
7      i[0] = 1 // only this error is reported
8      // i = 2
9    }
10 }

only reports Unknown method sys::Int.get (and set) on line 7. The error message sys::Int[] is not assignable to sys::Int which you can get by commenting out line 7 is unfortunately missing. I'd prefer if the first error could be reported too because it shows the error more clearly and on actual errorneous source line. The second type of error would be printed also if line 7 is commented out and line 8 uncommented.

brian Wed 10 Mar 2010

The way the compiler works is each step in pipeline is run, then if any errors were found it bails. So you will see errors in multiple stages based on their classification. I try to do as much error checking as possible in one step (CheckErrors), but sometimes we don't have enough of a correct program to get that far.

Login or Signup to reply.