magic-lang / magic

0 stars 2 forks source link

Detect indentation errors #104

Closed ghost closed 9 years ago

ghost commented 9 years ago
init: func ~this (original: This) {
    this init()
    for (i in 0 .. original count)
            this append(original[i] copy())
}

Line 4 has one extra leading tab. Is it possible for Magic to detect and report indentation errors such as this ?

thomasfanell commented 9 years ago

Existing issue, #70. I started to implement a check for this, but had to abort due to higher priority tasks. I'll see if I can find some time to implement it this week.

davidhesselbom commented 9 years ago

It's not the same issue, really. #70 requires magic to know how things should be indented, but in the case described here, it's just a matter of detecting that indentation from one line to the next has increased by more than 1 tab, which is always wrong, no matter the contents (I think). Should be very easy to fix compared to #70.

thomasfanell commented 9 years ago

If it handles this, it should be able to handle #70, otherwise I would call it unreliable. It may very well be that I approached this problem incorrectly the last time around, but it was anything but easy. I'll re-visit this soon.

davidhesselbom commented 9 years ago

If you fix #70, this issue will be solved too, as a side effect. But the reverse is not true. A quick fix for the described problem won't be unreliable, it's just going to be limited to a specific type of indentation error.