haskell / haskell/haskell-language-server

-Wno-safe doesn't work

Open
#2,818 0 comments 0 reactions 0 assignees View on GitHub
component: ghcide type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### Your environment

Which OS do you use: ManjaroOs - 5.15.28-1
Which LSP client (editor/plugin) do you use: VS Code + vscode-haskell + builded from source hls
Describe your project (alternative: link to the project): https://github.com/AbsoluteNikola/hls-warnings-bug

### Steps to reproduce
Clone repo and open Main.hs
I added these ghc options in cabal file: `-Weverything -Wno-safe -Wno-missing-safe-haskell-mode -Wno-implicit-prelude -Wno-missing-export-lists`
I tested on the latest master of hls and 2 different ghc 8.10.7 and 9.0.2. Every time the same issue

### Expected behavior
HLS should work the same with and without this pragma

![Screenshot_20220409_142308](https://user-images.githubusercontent.com/24353155/162569718-9a955eb2-8797-487d-9c9b-7e738cca12ae.png)
HLS should not show a warning as below because it was disabled in cabal
```
‘Main’ has been inferred as unsafe!
Reason:
: warning: Use of plugins makes the module unsafe
```
### Actual behaviour
HLS show this warning when `-Wno-safe` in cabal file. With other warnings everything works correctly
![Screenshot_20220409_142612](https://user-images.githubusercontent.com/24353155/162569790-2a1253dd-634e-4042-826a-32df84b4ce64.png)

### Include debug information
I didn't find any useful information in the log, but maybe it will be helpful for you
[hls.log](https://github.com/haskell/haskell-language-server/files/8456810/hls.log)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.