summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-02-26 12:57:57 -0500
committerBen Gamari <ben@smart-cactus.org>2019-02-26 12:57:57 -0500
commitca5b476083e4b361720135dcb159980b1bca82de (patch)
tree28a37ed6ccc05db30d92fd6c5db4a8d52b7a5619
parent78af4a329e8d368e2aa0b7ba44990876ae257c09 (diff)
downloadhaskell-ca5b476083e4b361720135dcb159980b1bca82de.tar.gz
Revert "Lexer: Alternate Layout Rule injects actual not virtual braces"
This reverts commit e0375ba980fd5639d23a29575efb00c30d97c743.
-rw-r--r--compiler/parser/Lexer.x32
m---------libraries/Cabal0
m---------libraries/transformers0
-rw-r--r--testsuite/tests/ghc-api/annotations/Makefile20
-rw-r--r--testsuite/tests/ghc-api/annotations/T16279.stdout30
-rw-r--r--testsuite/tests/ghc-api/annotations/Test16279.hs10
-rw-r--r--testsuite/tests/ghc-api/annotations/all.T2
m---------utils/haddock0
m---------utils/hsc2hs0
9 files changed, 15 insertions, 79 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 147e678973..10712c9c42 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2687,23 +2687,23 @@ alternativeLayoutRuleToken t
do setAlrExpectingOCurly Nothing
setALRContext (ALRLayout expectingOCurly thisCol : context)
setNextToken t
- return (L thisLoc ITvocurly)
+ return (L thisLoc ITocurly)
| otherwise ->
do setAlrExpectingOCurly Nothing
- setPendingImplicitTokens [L lastLoc ITvccurly]
+ setPendingImplicitTokens [L lastLoc ITccurly]
setNextToken t
- return (L lastLoc ITvocurly)
+ return (L lastLoc ITocurly)
(_, _, Just expectingOCurly) ->
do setAlrExpectingOCurly Nothing
setALRContext (ALRLayout expectingOCurly thisCol : context)
setNextToken t
- return (L thisLoc ITvocurly)
+ return (L thisLoc ITocurly)
-- We do the [] cases earlier than in the spec, as we
-- have an actual EOF token
(ITeof, ALRLayout _ _ : ls, _) ->
do setALRContext ls
setNextToken t
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
(ITeof, _, _) ->
return t
-- the other ITeof case omitted; general case below covers it
@@ -2714,7 +2714,7 @@ alternativeLayoutRuleToken t
| newLine ->
do setPendingImplicitTokens [t]
setALRContext ls
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
-- This next case is to handle a transitional issue:
(ITwhere, ALRLayout _ col : ls, _)
| newLine && thisCol == col && transitional ->
@@ -2726,7 +2726,7 @@ alternativeLayoutRuleToken t
setNextToken t
-- Note that we use lastLoc, as we may need to close
-- more layouts, or give a semicolon
- return (L lastLoc ITvccurly)
+ return (L lastLoc ITccurly)
-- This next case is to handle a transitional issue:
(ITvbar, ALRLayout _ col : ls, _)
| newLine && thisCol == col && transitional ->
@@ -2738,19 +2738,17 @@ alternativeLayoutRuleToken t
setNextToken t
-- Note that we use lastLoc, as we may need to close
-- more layouts, or give a semicolon
- return (L lastLoc ITvccurly)
+ return (L lastLoc ITccurly)
(_, ALRLayout _ col : ls, _)
| newLine && thisCol == col ->
do setNextToken t
- let loc = realSrcSpanStart thisLoc
- zeroWidthLoc = mkRealSrcSpan loc loc
- return (L zeroWidthLoc ITsemi)
+ return (L thisLoc ITsemi)
| newLine && thisCol < col ->
do setALRContext ls
setNextToken t
-- Note that we use lastLoc, as we may need to close
-- more layouts, or give a semicolon
- return (L lastLoc ITvccurly)
+ return (L lastLoc ITccurly)
-- We need to handle close before open, as 'then' is both
-- an open and a close
(u, _, _)
@@ -2759,7 +2757,7 @@ alternativeLayoutRuleToken t
ALRLayout _ _ : ls ->
do setALRContext ls
setNextToken t
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
ALRNoLayout _ isLet : ls ->
do let ls' = if isALRopen u
then ALRNoLayout (containsCommas u) False : ls
@@ -2782,21 +2780,21 @@ alternativeLayoutRuleToken t
(ITin, ALRLayout ALRLayoutLet _ : ls, _) ->
do setALRContext ls
setPendingImplicitTokens [t]
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
(ITin, ALRLayout _ _ : ls, _) ->
do setALRContext ls
setNextToken t
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
-- the other ITin case omitted; general case below covers it
(ITcomma, ALRLayout _ _ : ls, _)
| topNoLayoutContainsCommas ls ->
do setALRContext ls
setNextToken t
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
(ITwhere, ALRLayout ALRLayoutDo _ : ls, _) ->
do setALRContext ls
setPendingImplicitTokens [t]
- return (L thisLoc ITvccurly)
+ return (L thisLoc ITccurly)
-- the other ITwhere case omitted; general case below covers it
(_, _, _) -> return t
diff --git a/libraries/Cabal b/libraries/Cabal
-Subproject 064d9e9082c825f538655db1868108c48240377
+Subproject 98fcb3a964a4deef67920020a4a02d4d8552cc1
diff --git a/libraries/transformers b/libraries/transformers
-Subproject 80557845cdc0e72bc05cec19cf7a1bf5495e9e6
+Subproject 49655191d33912815a9389b764e2d89e9214093
diff --git a/testsuite/tests/ghc-api/annotations/Makefile b/testsuite/tests/ghc-api/annotations/Makefile
index f293810d20..98b45744ce 100644
--- a/testsuite/tests/ghc-api/annotations/Makefile
+++ b/testsuite/tests/ghc-api/annotations/Makefile
@@ -145,23 +145,3 @@ T13163:
.PHONY: T15303
T15303:
$(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test15303.hs
-
-.PHONY: T16212
-T16212:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test16212.hs
-
-.PHONY: T16230
-T16230:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test16230.hs
-
-.PHONY: T16236
-T16236:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test16236.hs
-
-.PHONY: StarBinderAnns
-StarBinderAnns:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" StarBinderAnns.hs
-
-.PHONY: T16279
-T16279:
- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test16279.hs
diff --git a/testsuite/tests/ghc-api/annotations/T16279.stdout b/testsuite/tests/ghc-api/annotations/T16279.stdout
deleted file mode 100644
index 7dac950679..0000000000
--- a/testsuite/tests/ghc-api/annotations/T16279.stdout
+++ /dev/null
@@ -1,30 +0,0 @@
----Unattached Annotation Problems (should be empty list)---
-[]
----Ann before enclosing span problem (should be empty list)---
-[
-
-]
-
----Annotations-----------------------
--- SrcSpan the annotation is attached to, AnnKeywordId,
--- list of locations the keyword item appears in
-[
-((Test16279.hs:5:1-20,AnnDcolon), [Test16279.hs:5:7-8]),
-((Test16279.hs:5:1-20,AnnSemi), [Test16279.hs:6:1]),
-((Test16279.hs:5:10-12,AnnRarrow), [Test16279.hs:5:14-15]),
-((Test16279.hs:5:10-20,AnnRarrow), [Test16279.hs:5:14-15]),
-((Test16279.hs:(6,1)-(7,24),AnnEqual), [Test16279.hs:6:7]),
-((Test16279.hs:(6,1)-(7,24),AnnFunId), [Test16279.hs:6:1-5]),
-((Test16279.hs:(6,1)-(7,24),AnnSemi), [Test16279.hs:9:1]),
-((Test16279.hs:(6,9)-(7,24),AnnCase), [Test16279.hs:6:10-13]),
-((Test16279.hs:(6,9)-(7,24),AnnLam), [Test16279.hs:6:9]),
-((Test16279.hs:6:15-23,AnnSemi), [Test16279.hs:7:15]),
-((Test16279.hs:6:17-23,AnnRarrow), [Test16279.hs:6:17-18]),
-((Test16279.hs:7:17-24,AnnRarrow), [Test16279.hs:7:17-18]),
-((Test16279.hs:9:1-16,AnnEqual), [Test16279.hs:9:6]),
-((Test16279.hs:9:1-16,AnnFunId), [Test16279.hs:9:1-4]),
-((Test16279.hs:9:1-16,AnnSemi), [Test16279.hs:11:1]),
-((Test16279.hs:9:15-16,AnnCloseP), [Test16279.hs:9:16]),
-((Test16279.hs:9:15-16,AnnOpenP), [Test16279.hs:9:15]),
-((<no location info>,AnnEofPos), [Test16279.hs:11:1])
-] \ No newline at end of file
diff --git a/testsuite/tests/ghc-api/annotations/Test16279.hs b/testsuite/tests/ghc-api/annotations/Test16279.hs
deleted file mode 100644
index 7817edadc5..0000000000
--- a/testsuite/tests/ghc-api/annotations/Test16279.hs
+++ /dev/null
@@ -1,10 +0,0 @@
-{-# LANGUAGE AlternativeLayoutRule #-}
-{-# LANGUAGE LambdaCase #-}
--- duplicate of T13087.hs
-
-isOne :: Int -> Bool
-isOne = \case 1 -> True
- _ -> False
-
-main = return ()
-
diff --git a/testsuite/tests/ghc-api/annotations/all.T b/testsuite/tests/ghc-api/annotations/all.T
index b4b21e262c..666cb3f044 100644
--- a/testsuite/tests/ghc-api/annotations/all.T
+++ b/testsuite/tests/ghc-api/annotations/all.T
@@ -59,5 +59,3 @@ test('T13163', [extra_files(['Test13163.hs']),
ignore_stderr], run_command, ['$MAKE -s --no-print-directory T13163'])
test('T15303', [extra_files(['Test15303.hs']),
ignore_stderr], run_command, ['$MAKE -s --no-print-directory T15303'])
-test('T16279', [extra_files(['Test16279.hs']),
- ignore_stderr], makefile_test, ['T16279'])
diff --git a/utils/haddock b/utils/haddock
-Subproject 6414b46e1ac8b63cad20d662311788a80e3b29b
+Subproject 21e4f3fa6f73a9b25f3deed80da0e56024238ea
diff --git a/utils/hsc2hs b/utils/hsc2hs
-Subproject a816333ae67c54b98cce4ed22621242714967b3
+Subproject fac8b62e48f4c99cfe8f3efff63c8fcd94b2a1d