This program:
type A = { a : int }
type B = { b : A }
//34567890
let r = {
b = { // line 6
a = 2 // line 7
}
}
Produces under mono/fsharpc this warning twice:
/Users/debois/git/dcr/foo.fs(7,5): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (6:7). Try indenting this token further or using standard formatting conventions.
Why does this warning occur at all? The f#-spec p. 228 makes me think the token 'a' following '{' sets a new offside line, in which case there should be no problem?
Why does it occur twice?
Thanks,
Søren
Full output:
dcr > fsharpc foo.fs
F# Compiler for F# 3.0 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
/Users/debois/git/dcr/foo.fs(7,5): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (6:7). Try indenting this token further or using standard formatting conventions.
/Users/debois/git/dcr/foo.fs(7,5): warning FS0058: Possible incorrect indentation: this token is offside of context started at position (6:7). Try indenting this token further or using standard formatting conventions.
dcr >
reformat your code as
type A = { a : int }
type B = { b : A }
//34567890
let r = { b = { a = 2 } }
or
let r =
{
b = { a = 2 }
}
i.e. the {
is the left-most token.
EDIT: One off-site line starts with the {
therefore you need to indent at least as much as the {
the line break after is not mandatory. And the second warning is because of the same reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With