-
-
Notifications
You must be signed in to change notification settings - Fork 398
Fix renaming data constructors with fields (resolves #2915, resolves #4083) #4635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1ca33e3
e429304
f81ab41
59eb14e
f1f33d0
53a2aa0
dbfcda7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
data Foo = FooRenamed { a :: Int, b :: Bool } | ||
|
||
foo1 :: Foo | ||
foo1 = FooRenamed { a = 1, b = True } | ||
|
||
foo2 :: Foo | ||
foo2 = FooRenamed 1 True | ||
|
||
fun1 :: Foo -> Int | ||
fun1 FooRenamed {a} = a | ||
|
||
fun2 :: Foo -> Int | ||
fun2 FooRenamed {a = i} = i |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
data Foo = Foo { a :: Int, b :: Bool } | ||
|
||
foo1 :: Foo | ||
foo1 = Foo { a = 1, b = True } | ||
|
||
foo2 :: Foo | ||
foo2 = Foo 1 True | ||
|
||
fun1 :: Foo -> Int | ||
fun1 Foo {a} = a | ||
|
||
fun2 :: Foo -> Int | ||
fun2 Foo {a = i} = i |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
data Foo = FooRenamed { a :: Int, b :: Bool } | ||
|
||
fun :: Foo -> Int | ||
fun FooRenamed {..} = a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{-# LANGUAGE RecordWildCards #-} | ||
data Foo = Foo { a :: Int, b :: Bool } | ||
|
||
fun :: Foo -> Int | ||
fun Foo {..} = a |
Unchanged files with check annotations Beta
{ source_version = ver | ||
, old_value = m_old | ||
, get_file_version = use GetModificationTime_{missingFileDiagnostics = False} | ||
, get_linkable_hashes = \fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs | ||
Check warning on line 805 in ghcide/src/Development/IDE/Core/Rules.hs
|
||
, get_module_graph = useWithSeparateFingerprintRule_ GetModuleGraphTransDepsFingerprints GetModuleGraph f | ||
, regenerate = regenerateHiFile session f ms | ||
} |
Just fileDiags -> do | ||
pure $ Just $ filter diagRangeOverlaps fileDiags | ||
where | ||
diagRangeOverlaps = \fileDiag -> | ||
Check warning on line 219 in ghcide/src/Development/IDE/Core/PluginUtils.hs
|
||
rangesOverlap range (fileDiag ^. fdLspDiagnosticL . LSP.range) | ||
-- | Just like 'activeDiagnosticsInRangeMT'. See the docs of 'activeDiagnosticsInRangeMT' for details. |
import Data.Time (UTCTime (..)) | ||
import Data.Tuple.Extra (dupe) | ||
import Debug.Trace | ||
import Development.IDE.Core.FileStore (resetInterfaceStore) | ||
Check warning on line 73 in ghcide/src/Development/IDE/Core/Compile.hs
|
||
import Development.IDE.Core.Preprocessor | ||
import Development.IDE.Core.ProgressReporting (progressUpdate) | ||
import Development.IDE.Core.RuleTypes | ||
tcs = tcg_tcs ts :: [TyCon] | ||
hie_asts = GHC.enrichHie all_binds (tmrRenamed tcm) top_ev_binds insts tcs | ||
pure $ Just $ | ||
#if MIN_VERSION_ghc(9,11,0) | ||
hie_asts (tcg_type_env ts) | ||
#else | ||
convImport (L _ i) = ( | ||
(ideclPkgQual i) | ||
Check warning on line 1106 in ghcide/src/Development/IDE/Core/Compile.hs
|
||
, reLoc $ ideclName i) | ||
msrImports = implicit_imports ++ imps |
{-# LANGUAGE DeriveAnyClass #-} | ||
Check warning on line 1 in ghcide/session-loader/Development/IDE/Session/Diagnostics.hs
|
||
module Development.IDE.Session.Diagnostics where | ||
import Control.Applicative | ||
surround start s end = do | ||
guard (listToMaybe s == Just start) | ||
guard (listToMaybe (reverse s) == Just end) | ||
pure $ drop 1 $ take (length s - 1) s | ||
multiCradleErrMessage :: MultiCradleErr -> [String] | ||
multiCradleErrMessage e = |
[] -> error $ "GHC version could not be parsed: " <> version | ||
((runTime, _):_) | ||
| compileTime == runTime -> do | ||
atomicModifyIORef' cradle_files (\xs -> (cfp:xs,())) | ||
Check warning on line 630 in ghcide/session-loader/Development/IDE/Session.hs
|
||
session (hieYaml, toNormalizedFilePath' cfp, opts, libDir) | ||
| otherwise -> return (([renderPackageSetupException cfp GhcVersionMismatch{..}], Nothing),[]) | ||
-- Failure case, either a cradle error or the none cradle | ||
x <- map errMsgDiagnostic closure_errs | ||
DriverHomePackagesNotClosed us <- pure x | ||
pure us | ||
isBad ci = (homeUnitId_ (componentDynFlags ci)) `OS.member` bad_units | ||
Check warning on line 897 in ghcide/session-loader/Development/IDE/Session.hs
|
||
-- Whenever we spin up a session on Linux, dynamically load libm.so.6 | ||
-- in. We need this in case the binary is statically linked, in which | ||
-- case the interactive session will fail when trying to load |
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE OverloadedStrings #-} |
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.
Fyi this is a separate new issue I discovered while testing this PR that affects ghc 9.6 and 9.8.
I opened a separate issue to track that: #4636