From e37cf149e3a8422355d9697f29854fdf81b24408 Mon Sep 17 00:00:00 2001 From: Raghvendra Gupta Date: Mon, 17 Dec 2018 20:20:13 +0530 Subject: [PATCH] Fix #30006, getindex accessing fields that might not exist (#30405) * Fix #30006, range getindex accessing fields that might not exist * Add tests for #30006 (cherry picked from commit 64133f68a68a2bb52a8908bab25c32150a7e84fd) --- test/ranges.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/ranges.jl b/test/ranges.jl index dba2e8b24983c..272cee9c50e39 100644 --- a/test/ranges.jl +++ b/test/ranges.jl @@ -1413,6 +1413,13 @@ end @test Base.Slice(1:10)[Int8(2)] == Int8(2) end +@testset "Issue #30006" begin + @test Base.Slice(Base.OneTo(5))[Int32(1)] == Int32(1) + @test Base.Slice(Base.OneTo(3))[Int8(2)] == Int8(2) + @test Base.Slice(1:10)[Int32(2)] == Int32(2) + @test Base.Slice(1:10)[Int8(2)] == Int8(2) +end + @testset "allocation of TwicePrecision call" begin 0:286.493442:360 0:286:360