Skip to content

Error when code contains version specification

Silly errors out when my code contains a version specification. Example:

source/library.d

version = myversion;

unittest {
    assert(true);
}
> dub test
Generating test runner configuration 'sillytest-test-library' for 'library' (library).
Performing "unittest" build using dmd for x86_64.
sillytest ~master: building configuration "sillytest-test-library"...
/home/dennis/.dub/packages/silly-1.0.0/silly/silly.d(89,38): Error: undefined identifier myversion in module library
dmd failed with exit code 1.

The same happens with debug specifications.

debug = mydebug;

The error points to this piece of code in silly.d:

// Unittests in structs and classes
foreach(member; __traits(derivedMembers, module_))
	static if(!__traits(isTemplate,  __traits(getMember, module_, member)) &&

It seems like __traits(derivedMembers) gives version identifiers too, but you can't use __traits(getMember) on those.

Edited by Dennis Korpel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information