File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,9 @@ ndims(x::Number) = 0
68
68
ndims (:: Type{<:Number} ) = 0
69
69
length (x:: Number ) = 1
70
70
firstindex (x:: Number ) = 1
71
+ firstindex (x:: Number , d:: Int ) = d < 1 ? throw (BoundsError ()) : 1
71
72
lastindex (x:: Number ) = 1
73
+ lastindex (x:: Number , d:: Int ) = d < 1 ? throw (BoundsError ()) : 1
72
74
IteratorSize (:: Type{<:Number} ) = HasShape {0} ()
73
75
keys (:: Number ) = OneTo (1 )
74
76
Original file line number Diff line number Diff line change @@ -2401,7 +2401,12 @@ end
2401
2401
@test size (1 ) == ()
2402
2402
@test length (1 ) == 1
2403
2403
@test firstindex (1 ) == 1
2404
+ @test firstindex (1 , 1 ) == 1
2405
+ @test_throws BoundsError firstindex (1 ,0 )
2404
2406
@test lastindex (1 ) == 1
2407
+ @test lastindex (1 , 1 ) == 1
2408
+ @test 1 [end ,end ] == 1
2409
+ @test_throws BoundsError lastindex (1 ,0 )
2405
2410
@test eltype (Integer) == Integer
2406
2411
end
2407
2412
You can’t perform that action at this time.
0 commit comments