How can F# report syntax and semantic errors at same time? -
here f# code both syntax , semantic errors:
let b = b b let x = (if)
edit: f# vim reports both infinite type error , syntax error, fsc
or fsi
stops @ sytnax error.
how f# vim report syntax , semantic error @ same time, while f# compiler stop @ reporting syntax errors?
the f# compiler (which used vim plugin under cover) has error recovery mechanism - means when finds expression cannot parse, attempts fill make valid f# expression.
when write let = (if)
, guess compiler internally expands like
let = (if _ _ else _)
_
special "invalid expression" placeholder.
this makes possible type-check invalid f# code, useful in ide when writing code (which invalid) because type information used auto-completion etc.
reporting type-checking errors in automatically "fixed" code when running compiler directly possible, not useful - when filling in holes, compiler may not expect , give odd error messages.
Comments
Post a Comment