Skip to content

Commit f03e839

Browse files
authored
Fix splatnew test (#43835)
The function being tested currently throws: ``` julia> _construct_structwithsplatnew() ERROR: TypeError: in new, expected Int64, got a value of type String Stacktrace: [1] StructWithSplatNew @ ./REPL[15]:3 [inlined] [2] _construct_structwithsplatnew() @ Main ./REPL[16]:1 [3] top-level scope @ REPL[18]:1 ``` As a result, compiler precision improvements can cause the test to fail, which is not intended. Fix the fieldtype of the struct to make sure it doesn't throw.
1 parent 8667272 commit f03e839

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/compiler/inference.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3137,11 +3137,12 @@ _use_unstable_kw_2() = _unstable_kw(x = 2, y = rand())
31373137
@test Base.return_types(_use_unstable_kw_1) == Any[String]
31383138
@test Base.return_types(_use_unstable_kw_2) == Any[String]
31393139
@eval struct StructWithSplatNew
3140-
x::Int
3140+
x::String
31413141
StructWithSplatNew(t) = $(Expr(:splatnew, :StructWithSplatNew, :t))
31423142
end
31433143
_construct_structwithsplatnew() = StructWithSplatNew(("",))
31443144
@test Base.return_types(_construct_structwithsplatnew) == Any[StructWithSplatNew]
3145+
@test isa(_construct_structwithsplatnew(), StructWithSplatNew)
31453146

31463147
# case where a call cycle can be broken by constant propagation
31473148
struct NotQRSparse

0 commit comments

Comments
 (0)