diff --git a/record-dot-syntax-tests/Construction.hs b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail0.hs similarity index 100% rename from record-dot-syntax-tests/Construction.hs rename to testsuite/tests/parser/should_fail/RecordDotSyntaxFail0.hs diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail0.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail0.stderr new file mode 100644 index 0000000000000000000000000000000000000000..304291e4ecd24324897d4e7d9895bdb151556999 --- /dev/null +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail0.stderr @@ -0,0 +1,5 @@ +ghc: panic! (the 'impossible' happened) + (GHC version 8.11.0.20200909: + fbindToRecField: The impossible happened + +Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug diff --git a/record-dot-syntax-tests/Pattern.hs b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail1.hs similarity index 100% rename from record-dot-syntax-tests/Pattern.hs rename to testsuite/tests/parser/should_fail/RecordDotSyntaxFail1.hs diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail1.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail1.stderr new file mode 100644 index 0000000000000000000000000000000000000000..0b619a7729715451a0ecf1c1c2c45ef46aa30aee --- /dev/null +++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail1.stderr @@ -0,0 +1,2 @@ +RecordDotSyntaxFail1.hs:3:10: + Field selector syntax is not supported in patterns. diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 9142eb0393a8c3086f6f7f9df61bbf4ff32373c7..a83d3fa2887c3ccdca5dace87b1ff363edfe18db 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -173,3 +173,5 @@ test('T18251c', normal, compile_fail, ['']) test('T18251d', normal, compile_fail, ['']) test('T18251e', normal, compile_fail, ['']) test('T18251f', normal, compile_fail, ['']) +test('RecordDotSyntaxFail0', normal, compile_fail, ['']) +test('RecordDotSyntaxFail1', normal, compile_fail, ['']) diff --git a/record-dot-syntax-tests/Test.hs b/testsuite/tests/parser/should_run/RecordDotSyntax.hs similarity index 98% rename from record-dot-syntax-tests/Test.hs rename to testsuite/tests/parser/should_run/RecordDotSyntax.hs index f9c6cf1e6a551925b1cf170f05c9901fa13a44b8..e96137fc579929007b148d26a2abc066f01ea6e7 100644 --- a/record-dot-syntax-tests/Test.hs +++ b/testsuite/tests/parser/should_run/RecordDotSyntax.hs @@ -112,4 +112,4 @@ main = do g <- pure a print $ c{f} -- 42, 1 print $ c{f, g} -- 42, 42 - print $ c{f, g.foo.bar.baz.quux = 4} -- Can now mix top-level and nested updates!; 42, 4 + print $ c{f, g.foo.bar.baz.quux = 4} -- Mix top-level and nested updates; 42, 4 diff --git a/testsuite/tests/parser/should_run/RecordDotSyntax.stdout b/testsuite/tests/parser/should_run/RecordDotSyntax.stdout new file mode 100644 index 0000000000000000000000000000000000000000..a0c5f0303a52bfe232b8dd2a1e765c80cefa3fcb --- /dev/null +++ b/testsuite/tests/parser/should_run/RecordDotSyntax.stdout @@ -0,0 +1,36 @@ +-- selectors: +Bar {bar = Baz {baz = Quux {quux = 42}}} +Baz {baz = Quux {quux = 42}} +Quux {quux = 42} +42 +12 +12 +-- selections: +42 +Quux {quux = 42} +Baz {baz = Quux {quux = 42}} +Bar {bar = Baz {baz = Quux {quux = 42}}} +"hello" +"hello" +42 +42 +43 +43 +43 +-- updates: +Quux {quux = 2} +Bar {bar = Baz {baz = Quux {quux = 1}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 44}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 45}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 46}}}} +Grault {f = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 3}}}}, g = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 4}}}}} +-- punned updates: +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 102}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 102}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 102}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 102}}}} +Foo {foo = Bar {bar = Baz {baz = Quux {quux = 42}}}} +Grault {f = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 102}}}}, g = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 4}}}}} +Grault {f = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 42}}}}, g = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 1}}}}} +Grault {f = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 42}}}}, g = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 42}}}}} +Grault {f = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 42}}}}, g = Foo {foo = Bar {bar = Baz {baz = Quux {quux = 4}}}}} diff --git a/testsuite/tests/parser/should_run/all.T b/testsuite/tests/parser/should_run/all.T index 2fa6fce766d091113573a4dc67c7afabc7e0458e..c3a39abcc8e3fbd126b13c959efba14e2b5cb971 100644 --- a/testsuite/tests/parser/should_run/all.T +++ b/testsuite/tests/parser/should_run/all.T @@ -19,3 +19,4 @@ test('CountParserDeps', compile_and_run, ['-package ghc']) test('LexNegLit', normal, compile_and_run, ['']) +test('RecordDotSyntax', normal, compile_and_run, [''])