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.

enter image description here

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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -