dmd/compiler/test/fail_compilation/fail7372.d
WebFreak001 f01795072b Add supplemental scope info to mixin T; errors
Fix issue 7372 - Error provides too little information to diagnose the problem (error: undefined identifier)

Mixin templates are often defined inside libraries and may require the
definition of certain symbols alongside them (for example a text
templating library mapping struct fields to HTML text blocks could
attempt to simply access member variables) - Fixing compilation errors
where such identifiers are not found would then usually not require
code changes inside the library, but rather in the user code, where the
mixin is written.

So this PR adds a supplemental `parent scope from here: '...'` message,
which may be used from IDEs to show errors on the mixin line or just for
the user to read it in the command line and see where in the user code
the error originates from.
2022-09-06 01:26:25 +02:00

13 lines
271 B
D

/*
TEST_OUTPUT:
---
fail_compilation/imports/fail7372.d(7): Error: undefined identifier `X`
fail_compilation/fail7372.d(4): parent scope from here: `mixin Issue7372!()`
---
*/
#line 1
import imports.fail7372;
interface I {}
class C : I {
mixin Issue7372!();
}