From c35a3238392990023e984625c3c344f16b597852 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 15 Aug 2020 18:28:21 +0100 Subject: [PATCH] Apply the module pragmas for evaluation --- src/Ide/Plugin/Eval.hs | 3 +-- test/functional/Eval.hs | 1 + test/testdata/eval/T9.hs | 5 +++++ test/testdata/eval/T9.hs.expected | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/testdata/eval/T9.hs create mode 100644 test/testdata/eval/T9.hs.expected diff --git a/src/Ide/Plugin/Eval.hs b/src/Ide/Plugin/Eval.hs index fe37b0d576..a14d14393a 100644 --- a/src/Ide/Plugin/Eval.hs +++ b/src/Ide/Plugin/Eval.hs @@ -214,9 +214,8 @@ done, we want to switch back to GhcSessionDeps: hscEnv' <- ExceptT $ evalGhcEnv (hscEnv session) $ do - df <- getSessionDynFlags env <- getSession - df <- liftIO $ setupDynFlagsForGHCiLike env df + df <- liftIO $ setupDynFlagsForGHCiLike env $ ms_hspp_opts ms _lp <- setSessionDynFlags df -- copy the package state to the interactive DynFlags diff --git a/test/functional/Eval.hs b/test/functional/Eval.hs index 6f12cac76d..3af6c9d83a 100644 --- a/test/functional/Eval.hs +++ b/test/functional/Eval.hs @@ -63,6 +63,7 @@ tests = testGroup , testCase "Refresh an evaluation w/ lets" $ goldenTest "T6.hs" , testCase "Refresh a multiline evaluation" $ goldenTest "T7.hs" , testCase "Evaluate incorrect expressions" $ goldenTest "T8.hs" + , testCase "Applies file LANGUAGE extensions" $ goldenTest "T9.hs" ] goldenTest :: FilePath -> IO () diff --git a/test/testdata/eval/T9.hs b/test/testdata/eval/T9.hs new file mode 100644 index 0000000000..bc83803bb3 --- /dev/null +++ b/test/testdata/eval/T9.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE DataKinds #-} +module T9 where +import Data.Proxy + +-- >>> Proxy :: Proxy 3 diff --git a/test/testdata/eval/T9.hs.expected b/test/testdata/eval/T9.hs.expected new file mode 100644 index 0000000000..4ea9e33218 --- /dev/null +++ b/test/testdata/eval/T9.hs.expected @@ -0,0 +1,6 @@ +{-# LANGUAGE DataKinds #-} +module T9 where +import Data.Proxy + +-- >>> Proxy :: Proxy 3 +-- Proxy