Skip to content

Commit 9c2a0c8

Browse files
RalfJungoli-obk
andauthored
Expand discussion of post-monomorphization errors.
Co-authored-by: Oliver Scherer <[email protected]>
1 parent e250f62 commit 9c2a0c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

const_checks.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ Dynamic checks are conceptually very simple: when evaluating the compile-time co
99
Thus, a dynamic check generally makes it very clear what is being protected against.
1010

1111
The main disadvantage of dynamic checks is that they can only run when the compile-time code is being evaluated, which is after monomorphization.
12-
We generally try to avoid post-monomorphization errors as they make for a bad user experience.
12+
We generally try to avoid post-monomorphization errors as they inherently make for a bad user experience.
13+
While there are technical aspects that could be improved here, the main problem is that the site where the error is reported is disconnected from the site where the root cause is.
14+
Such problems can be observed when creating an associated constant that uses associated constants from generic parameters.
15+
These generic parameters are unknown, so the usage of these associated constants may cause errors depending on the *value* of the generic parameter's associated constants.
1316

1417
[Promotion analysis](promotion.md) also makes little sense dynamically as it is about code transformation.
1518
All we can do is check after the transformation if the generated code makes sense.

0 commit comments

Comments
 (0)