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

S02-types/array-shapes.t line:7 reason: 'array shapes' #3842

Closed
p6rt opened this issue May 3, 2015 · 7 comments
Closed

S02-types/array-shapes.t line:7 reason: 'array shapes' #3842

p6rt opened this issue May 3, 2015 · 7 comments

Comments

@p6rt
Copy link

p6rt commented May 3, 2015

Migrated from rt.perl.org#124502 (status was 'open')

Searchable as RT124502$

@p6rt
Copy link
Author

p6rt commented May 6, 2015

From @usev6

Maybe this should be merged into https://rt-archive.perl.org/perl6/Ticket/Display.html?id=75002?

@p6rt
Copy link
Author

p6rt commented Nov 21, 2015

From @usev6

Most of the tests in S02-types/array-shapes.t pass now (unfudged/adjusted with commit Raku/roast@4a5edf73db).

Maybe the other tests should be reviewed?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 21, 2015

From @usev6

Most of the tests in S02-types/array-shapes.t pass now (unfudged/adjusted with commit Raku/roast@4a5edf73db).

Maybe the other tests should be reviewed?

@p6rt
Copy link
Author

p6rt commented Nov 21, 2015

@usev6 - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 16, 2017

From @usev6

On Sat, 21 Nov 2015 01​:18​:15 -0800, bartolin@​gmx.de wrote​:

Most of the tests in S02-types/array-shapes.t pass now
(unfudged/adjusted with commit
Raku/roast@4a5edf73db).

Maybe the other tests should be reviewed?

For the record​: These are the two remaining tests fudged with this ticket number ('todo')​:

$ ./perl6-m -e 'use Test; throws-like q[my @​arr.[8]], Exception, "array with dot form dies"'
  1..2
  not ok 1 - 'my @​arr.[8]' died
  # Failed test ''my @​arr.[8]' died'
  # at -e line 1
  ok 2 - # SKIP Code did not die, can not check exception
  # Looks like you failed 1 test of 2
not ok 1 - array with dot form dies
# Failed test 'array with dot form dies'
# at -e line 1

$ $ ./perl6-m -e 'use Test; throws-like q[my @​arr\ .[8]], Exception, "array with dot form and unspace dies"'
  1..2
  not ok 1 - 'my @​arr\ .[8]' died
  # Failed test ''my @​arr\ .[8]' died'
  # at -e line 1
  ok 2 - # SKIP Code did not die, can not check exception
  # Looks like you failed 1 test of 2
not ok 1 - array with dot form and unspace dies
# Failed test 'array with dot form and unspace dies'
# at -e line 1

@p6rt p6rt added the NYI Features not yet implemented label Jan 5, 2020
@usev6
Copy link

usev6 commented Oct 7, 2023

I took a closer look at the two still failing tests today and I think they are wrong.

The tests were added to cover S09/Fixed-size arrays from the Synopsis back in 2008-07 with Raku/roast@3547fffe14.

I wasn't able to track the synopsis document back to 2008-07, but on 2008-11-26 the relevant text looked like this (cmp. https://github.com/Raku/old-design-docs/blob/68d062fcaa/S09.pod?plain=1#L191-L195):

Note that the square brackets are a compile-time declarator, not a run-time
operator, so you can't use the "dotted" form either:

my @values.[10];          # Error
my @keys\ .[10];          # Error

Only in 2010-09 the following clarification was done: Raku/old-design-docs@e8527c2291

commit e8527c229122b5e2f8ae581f3716bc99a5fd3118
Author: Carl Masak <cmasak@gmail.com>
Date:   Wed Sep 29 07:51:17 2010 +0200

    [S09] be more clear about what's an error
    
    Two of the three examples marked with "Error" turned out to actually
    be logical maybe-not-what-I-meant errors. Marked them as such.

diff --git a/S09-data.pod b/S09-data.pod
index 0a4ba5d..fcad94d 100644
--- a/S09-data.pod
+++ b/S09-data.pod
@@ -207,8 +207,8 @@ specification, but "unspace" is allowed:
 Note that the square brackets are a compile-time declarator, not a run-time
 operator, so you can't use the "dotted" form either:
 
-    my @values.[10];          # Error
-    my @keys\ .[10];          # Error
+    my @values.[10];          # An indexing, not a fixed-size declaration
+    my @keys\ .[10];          # Ditto
 
 Attempting to access an index outside an array's defined range will fail:

And it looks like the code from the two tests indeed just does an indexing operation (calling &postcircumfix:<[ ]> on the freshly initialized array), e.g.

$ ./rakudo-m -e 'my @arr.[2] = 42; dd @arr'
Array @arr = [Any, Any, 42]
$ ./rakudo-m -e 'my @arr\ .[2] = 42; dd @arr'
Array @arr = [Any, Any, 42]

Those are not shaped arrays at all.

I'll make a PR for roast to adjust the tests.
Edit: PR exists now: Raku/roast#841

@usev6 usev6 added bogustest and removed NYI Features not yet implemented labels Oct 7, 2023
@usev6
Copy link

usev6 commented Oct 15, 2023

I've merged the mentioned PR, so I'll close this issue as "resolved".

@usev6 usev6 closed this as completed Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants