diff --git a/base/int.jl b/base/int.jl index 80140c6d65191..aa6070a6d1299 100644 --- a/base/int.jl +++ b/base/int.jl @@ -640,10 +640,10 @@ typemax(::Type{UInt64}) = 0xffffffffffffffff @eval typemin(::Type{Int128} ) = $(convert(Int128, 1) << 127) @eval typemax(::Type{Int128} ) = $(bitcast(Int128, typemax(UInt128) >> 1)) -widen(::Type{<:Union{Int8, Int16}}) = Int32 +widen(::Type{<:Union{Int8, Int16}}) = Int widen(::Type{Int32}) = Int64 widen(::Type{Int64}) = Int128 -widen(::Type{<:Union{UInt8, UInt16}}) = UInt32 +widen(::Type{<:Union{UInt8, UInt16}}) = UInt widen(::Type{UInt32}) = UInt64 widen(::Type{UInt64}) = UInt128 diff --git a/test/int.jl b/test/int.jl index 9ed384e561b1c..9d645256051be 100644 --- a/test/int.jl +++ b/test/int.jl @@ -188,15 +188,15 @@ end end end @testset "widen/widemul" begin - @test widen(UInt8(3)) === UInt32(3) - @test widen(UInt16(3)) === UInt32(3) + @test widen(UInt8(3)) === UInt(3) + @test widen(UInt16(3)) === UInt(3) @test widen(UInt32(3)) === UInt64(3) @test widen(UInt64(3)) === UInt128(3) @test widen(UInt128(3)) == 3 @test typeof(widen(UInt128(3))) == BigInt - @test widen(Int8(-3)) === Int32(-3) - @test widen(Int16(-3)) === Int32(-3) + @test widen(Int8(-3)) === Int(-3) + @test widen(Int16(-3)) === Int(-3) @test widen(Int32(-3)) === Int64(-3) @test widen(Int64(-3)) === Int128(-3) @test widen(Int128(-3)) == -3 diff --git a/test/numbers.jl b/test/numbers.jl index 91241e7678371..b324aa7592728 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -2013,7 +2013,7 @@ end @testset "widen and widemul" begin @test widen(1.5f0) === 1.5 @test widen(Int32(42)) === Int64(42) - @test widen(Int8) === Int32 + @test widen(Int8) === Int @test widen(Int64) === Int128 @test widen(Float32) === Float64 @test widen(Float16) === Float32