Skip to content

Commit fa35069

Browse files
Improve recursive type error (#1028)
* Improve recursive type error * Update src/Tracing.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f600f07 commit fa35069

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Tracing.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,13 @@ function make_tracer_unknown(
11151115
if xi !== xi2
11161116
changed = true
11171117
end
1118+
if mode != TracedToTypes && !(Core.Typeof(xi2) <: fieldtype(TT, i))
1119+
throw(
1120+
AssertionError(
1121+
"Could not recursively make tracer of object of type $RT into $TT at field $i (named $(fieldname(TT, i))), need object of type $(fieldtype(TT, i)) found object of type $(Core.Typeof(xi2)) ",
1122+
),
1123+
)
1124+
end
11181125
flds[i] = xi2
11191126
else
11201127
nf = i - 1 # rest of tail must be undefined values

0 commit comments

Comments
 (0)