dlang-community / drepl

A REPL for D
Boost Software License 1.0
78 stars 20 forks source link

fix unittest #74

Closed ShigekiKarita closed 4 years ago

ShigekiKarita commented 5 years ago

I found a unittest inside Interpreter template can cause compiler error when I built drepl with unittest or used as a library. The problem is comparison between Interpreter!EchoEngine.Kind and Interpreter!(<Instantiated Type>).Kind in the unittest.

For example, when I instantiated Interpreter!DMDEngine inside unittest caused following compiler error.

src/drepl/interpreter.d(129,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.as
OriginalType
src/drepl/interpreter.d(131,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.as
OriginalType
src/drepl/interpreter.d(132,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.as
OriginalType
src/drepl/interpreter.d(134,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.as
OriginalType
src/drepl/interpreter.d(135,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.as
OriginalType
src/drepl/interpreter.d(137,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.asOriginalType
src/drepl/interpreter.d(139,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.asOriginalType
src/drepl/interpreter.d(141,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.asOriginalType
src/drepl/interpreter.d(143,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.asOriginalType
src/drepl/interpreter.d(145,16): Error: Comparison between different enumeration types Kind and Kind; If this behavior is intended consider using std.conv.asOriginalType
src/drepl/interpreter.d(152,1): Error: template instance `drepl.interpreter.Interpreter!(DMDEngine)` error instantiating
src/drepl/interpreter.d(160,25):        instantiated from here: interpreter!(DMDEngine)

Therefore, I propose adding static if to limit the unittest instantiation only with EchoEngine.

rikkimax commented 4 years ago

@wilzbach I've rerun CI, you seem to have some ownership, are we good to go?

wilzbach commented 4 years ago

Sure. Sorry for missing it and thanks for the ping!

wilzbach commented 4 years ago

you seem to have some ownership

Should we change the teams to give everyone at dlang-community access to every repo?

rikkimax commented 4 years ago

you seem to have some ownership

Should we change the teams to give everyone at dlang-community access to every repo?

I was referring to the code base, rather than the repository. So no, we are good as far as I know :)