fable-compiler / repl-legacy

http://fable.io/repl
MIT License
14 stars 10 forks source link

Show compiler errors? #38

Closed SirUppyPancakes closed 5 years ago

SirUppyPancakes commented 6 years ago

A huge learning/productivity tool at this point has been the online Fable REPL, being able to see JS output from my browser whenever I am curious how some F# feature will pan out, all without having some extra 'test project' open in vscode cluttering things up.

When you compile code that is not valid Fable code, but is valid F# code, there is no indication of anything wrong, other than incorrect JS output. As an example, I was curious what Fable would do if I were to use the lock opeartor, even though JS is single-threaded:

module Test

let x = new obj()
lock x (fun () -> printfn "hello world")

No errors pop up anywhere in the code or console, just some empty JS output:

export const x = {};

While if I run the fable daemon on my vscode 'test project' I get a compiler error and no JS output:

ERROR in ./src/Console.fs
C:/Users/caleb/FableConsole/src/Console.fs(6,0): (6,33) error FABLE: Cannot find replacement for Microsoft.FSharp.Core.Operators::Lock
 @ ./src/Console.fsproj 1:0-29 1:0-29

This is by no means a major issue once you realize it is missing errors like this, but it would definitely help ease the barrier to entry when learning Fable :)

SirUppyPancakes commented 5 years ago

Fixed :)