aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-04 17:10:23 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-04 23:13:49 +0200
commit799a558e393d1c8286e8faec2bf8930138d8b1f4 (patch)
tree50beaa01c84a45fcf4162b80a62eaeda36cb4fe3 /src/Sema.zig
parente6b3cb5043b189fab6417df4a6921728ea174c8f (diff)
downloadzig-799a558e393d1c8286e8faec2bf8930138d8b1f4.tar.gz
zig-799a558e393d1c8286e8faec2bf8930138d8b1f4.zip
Sema: implement peer type resolution of function pointers and function bodies
Closes #13438
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 3def393dfb..a127031808 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -28769,6 +28769,13 @@ fn resolvePeerTypes(
}
}
},
+ .Fn => {
+ if (!cand_info.mutable and cand_info.pointee_type.zigTypeTag() == .Fn and .ok == try sema.coerceInMemoryAllowedFns(block, chosen_ty, cand_info.pointee_type, target, src, src)) {
+ chosen = candidate;
+ chosen_i = candidate_i + 1;
+ continue;
+ }
+ },
else => {},
}
},
@@ -28799,6 +28806,11 @@ fn resolvePeerTypes(
.Vector => continue,
else => {},
},
+ .Fn => if (chosen_ty.isSinglePointer() and chosen_ty.isConstPtr() and chosen_ty.childType().zigTypeTag() == .Fn) {
+ if (.ok == try sema.coerceInMemoryAllowedFns(block, chosen_ty.childType(), candidate_ty, target, src, src)) {
+ continue;
+ }
+ },
else => {},
}