-
Notifications
You must be signed in to change notification settings - Fork 136
Enable -fdefer-type-errors on start-up #495
Conversation
@purcell Are you aware of any performance numbers showing that this is not usable? I'm going to test it on a few real world big files today and report if it's a bad experience. |
Loading
No actual observed difference here. |
From
So the numbers are slower when there's more code going on. Flagging up a type error is more than twice as slow, and flagging that the code is OK takes an extra 100ms. |
It seems to vary based on caching or garbage collection inside the GHC API, because it goes as low as
So, really, roughly twice as slow at picking up type errors. You basically pay the price of doing a full type check every time you request a In some cases it's consistently much more!
versus without
If I insert an error further down in the file. |
Warnings regularly get generated when there's an error in your code, such as "not in use" for a thing with a bad type and other nonsense results. It's kind of distracting, so instead like regular GHC behavior, this defers showing warnings until there are no errors anymore.
I feel like it's probably workable. It's a little slower for me on some files which were often annoyingly slow to flycheck anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@@ -737,8 +738,10 @@ CHECKER and BUFFER are added to each item parsed from STRING." | |||
(msg (match-string 3)) ;; Replace gross bullet points. | |||
(type (cond ((string-match "^Warning:" msg) | |||
(setq msg (replace-regexp-in-string "^Warning: *" "" msg)) | |||
(if (string-match "^\\[-Wdeferred-type-errors\\]" msg) | |||
'error | |||
(if (or (string-match "^\\[-Wdeferred-type-errors\\]" msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use string-prefix-p
here.
In the interest of always "working" (or, working more often), I think I'll merge. The speed hit does bother me a bit, but we can always be cleverer later to optimize the speed. |
After using this for a day or two, I reckon this has actually made the common case of flycheck error reporting significantly worse: if you refer to an unimported function, for example, then deferred errors will be reported in the code which calls it, but the root problem itself will not be detected. I feel like reverting this might be the best course of action in the first time. |
@purcell I think I pushed a change to fix that - can you try latest master? I noticed the same problem; out of scope identifiers become typed holes with deferred type errors on. Can you still reproduce your problem? |
Yeah, I think it's better now. Will plug away and report back. :-) |
@purcell Cool! |
See https://github.com/commercialhaskell/intero/issues/476#issuecomment-348467874 for detailed explanation.
I'm going to spend the day on this branch; if it doesn't cause any regressions in behavior (or bad performance), I'll merge to master.
If you want to test this out now, just run
killall intero
and start the processes up again.