Skip to content
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

Add known broken tests for import placement #2425

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ghcide/test/data/import-placement/MultiLinePragma.expected.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards,
OverloadedStrings #-}
{-# OPTIONS_GHC -Wall,
-Wno-unused-imports #-}
import Data.Monoid


-- some comment
class Semigroup a => SomeData a

instance SomeData All
12 changes: 12 additions & 0 deletions ghcide/test/data/import-placement/MultiLinePragma.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards,
OverloadedStrings #-}
{-# OPTIONS_GHC -Wall,
-Wno-unused-imports #-}


-- some comment
class Semigroup a => SomeData a

instance SomeData All
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{-# LANGUAGE OverloadedStrings #-}


{-# LANGUAGE TupleSections #-}
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
15 changes: 15 additions & 0 deletions ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{-# LANGUAGE OverloadedStrings #-}


{-# LANGUAGE TupleSections #-}




class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Data.Monoid
class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
7 changes: 7 additions & 0 deletions ghcide/test/data/import-placement/OptionsPragmaNotAtTop.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall,
OPTIONS_GHC -Wno-unrecognised-pragmas #-}
-- another comment
-- oh
{- multi line
comment
-}

{-# LANGUAGE TupleSections #-}
import Data.Monoid
{- some comment -}

-- again
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall,
OPTIONS_GHC -Wno-unrecognised-pragmas #-}
Comment on lines +3 to +4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected version of this test doesn't have the OPTIONS_GHC -Wno-unrecognized-pragmas line. I think the expected version of the test should have this line unless the test does more than add an import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no you're right, that's updated now.

-- another comment
-- oh
{- multi line
comment
-}

{-# LANGUAGE TupleSections #-}
{- some comment -}

-- again
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall #-}
-- another comment

{-# LANGUAGE TupleSections #-}
import Data.Monoid
{- some comment -}


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall #-}
-- another comment

{-# LANGUAGE TupleSections #-}
{- some comment -}


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Text
import Data.Monoid


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
18 changes: 18 additions & 0 deletions ghcide/test/data/import-placement/PragmaNotAtTopWithImports.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Text


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
10 changes: 10 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTop.expected.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid

class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
9 changes: 9 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTop.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}

class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Data.Monoid
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
7 changes: 7 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}



{-# LANGUAGE TupleSections #-}
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
20 changes: 20 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}



{-# LANGUAGE TupleSections #-}




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Asdf
(f
, where')

where
import Data.Int



f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
17 changes: 17 additions & 0 deletions ghcide/test/data/import-placement/WhereDeclLowerInFile.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Asdf
(f
, where')

where



f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Asdf


where
import Data.Int


f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Asdf


where


f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
Loading