Thread overview
Any suggestions on dmd error message formatting?
May 15, 2021
Chris Piker
May 15, 2021
SealabJaster
May 15, 2021
SealabJaster
May 15, 2021
Chris Piker
May 15, 2021
SealabJaster
May 15, 2021
Berni44
May 15, 2021
SealabJaster
May 15, 2021

Hi D

So the compile error messages getting from dmd are starting to remind me of the notorious 130 line error message I once got from a C++ compiler for missing a comma in a template. :-/

(After fixing that bug, I left work early and came back the next day with a python book.)

So, like the noob I am, I've been copying error messages to a text editor, deleting all the @ annotations, replacing common patterns with short tokens, indenting the result, and then trying to understand the problem.

I figured this community is so inventive that I'm obviously doing it wrong and that there is a better way. So does anyone have any suggestions on how I make error messages like this one more grokable?

das2/range.d(359,31): Error: constructor das2.range.PriorityRange!(DasRange!(Tuple!(int, int)[], int function(Tuple!(int, int)) pure nothrow @nogc @safe, int function(Tuple!(int, int)) pure nothrow @nogc @safe, Tuple!(int, int), int), int function() pure nothrow @nogc @safe).PriorityRange.this(DasRange!(Tuple!(int, int)[], int function(Tuple!(int, int)) pure nothrow @nogc @safe, int function(Tuple!(int, int)) pure nothrow @nogc @safe, Tuple!(int, int), int) range, int function(Tuple!(int, int)) priority) is not callable using argument types (DasRange!(Tuple!(int, int)[], int function(Tuple!(int, int)) pure nothrow @nogc @safe, int function(Tuple!(int, int)) pure nothrow @nogc @safe, Tuple!(int, int), int), int function() pure nothrow @nogc @safe)

As always, your advice is much appreciated

May 15, 2021

On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote:

>

Hi D

T_T My eyes burn.

Anyway, Here it is formatted slightly better:

PriorityRange.this(
	DasRange!(
		Tuple!(int, int)[],
		int function(Tuple!(int, int)) pure nothrow @nogc @safe,
		int function(Tuple!(int, int)) pure nothrow @nogc @safe,
		Tuple!(int, int),
		int
	) range,
	int function(Tuple!(int, int)) priority
) is not callable using argument types (
	DasRange!(
		Tuple!(int, int)[],
		int function(Tuple!(int, int)) pure nothrow @nogc @safe,
		int function(Tuple!(int, int)) pure nothrow @nogc @safe,
		Tuple!(int, int),
		int
	),
	int function() pure nothrow @nogc @safe
)

Seems the final int function parameter needs to accept a Tuple!(int, int)

May 15, 2021

On Saturday, 15 May 2021 at 06:12:25 UTC, SealabJaster wrote:

>

...

Honestly I also kind of wish that the D compilers could format functions better on the command line, because these giant blobs of "where's wally the difference?" are just horrid when they show up.

May 15, 2021

On Saturday, 15 May 2021 at 06:12:25 UTC, SealabJaster wrote:

>

On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote:

T_T My eyes burn.

Good, it's not just me. If figured the Deities out there visually parse these messages even hung over.

>

Seems the final int function parameter needs to accept a Tuple!(int, int)

I did much the same as you and reformatted the error message to find the bug. As to the larger question of how to automatically process compiler output... got any ideas?

Hey since you're pretty good at this, can you tell me why how a person fixes this error? I've already formatted it, but I haven't changed any of the non-whitespace text.

das2/range.d(570,39): Error: incompatible types for (dr_fine) : (dr_coarse):
das2.range.PriorityRange!(
  DasRange!(
    Take!(
      ZipShortest!(
        cast(Flag)false, Result, Generator!(function () @safe => uniform(0, 128))
      )
    ),
    int function(Tuple!(int, int)) pure nothrow @nogc @safe,
    int function(Tuple!(int, int)) pure nothrow @nogc @safe,
    Tuple!(int, int),
    int
  ),
  int function() pure nothrow @nogc @safe
)

and

das2.range.PriorityRange!(
  DasRange!(
    Take!(
      ZipShortest!(
        cast(Flag)false, Result, Generator!(function () @safe => uniform(0, 128))
      )
    ),
    int function(Tuple!(int, int)) pure nothrow @nogc @safe,
    int function(Tuple!(int, int)) pure nothrow @nogc @safe,
    Tuple!(int, int),
    int
  ),
  int function() pure nothrow @nogc @safe
)

To get around the problem I used .array for a bit of type erasure, so for now this error isn't messing with my unittests, but danged if I can spot the problem, even formatted.

My guess is that the Result item is a hint. Result probably never equals another Result no matter what.

May 15, 2021

On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote:

>

As always, your advice is much appreciated

I'm usually piping the results through hexdump. ;-)

No, in earnest, I often would have liked to have better formatted messages. The only thing I can say: Sometimes it helps to increase the size of the window (>300 columns or so). Without line breaking, sometimes you can spot patterns you didn't before...

May 15, 2021

On Saturday, 15 May 2021 at 08:15:19 UTC, Chris Piker wrote:

>

I did much the same as you and reformatted the error message to find the bug. As to the larger question of how to automatically process compiler output... got any ideas?

Hope someone who knows how to modify DMD bothers to:

  1. Implement some kind of ability for that to work.
  2. Convinces Walter to let it through.

I can't do either, so just have to hope this issue is finally tackled at some point in the future.

>

My guess is that the Result item is a hint. Result probably never equals another Result no matter what.

Yea, I can't see what's wrong just from that either.

My best guess is Result might be embedded within another templated thing, which might be different than the Result that the function is expecting. Place a couple of pragma(msg, Result.stringof); // Might need to use typeof(Result).stringof, or even __traits(identifier, Result) wherever it might be relevant, and see if that shows anything fun.

I also really can't see where else there'd be a type mismatch, especially if a .array is what fixes things.

e.g. RangeThatReturns!OtherRange.Result != RangeThatReturns!(int[]).Result

But other than that, I can't tell just from that error snippet.

May 15, 2021

On Saturday, 15 May 2021 at 09:09:36 UTC, Berni44 wrote:

>

...

Honestly, even having a dumb formatter that puts things like this would be 100x more useable than what we currently get:

das2.range.PriorityRange!(
  DasRange!(
    Take!(
      ZipShortest!(
        cast(Flag)false, Result, Generator!(
            function (
            ) @safe => uniform(
                0,
                128
            )
        )
      )
    ),
    int function(
        Tuple!(
            int,
            int
        )
    ) pure nothrow @nogc @safe,
    int function(
        Tuple!(
            int,
            int
        )
    ) pure nothrow @nogc @safe,
    Tuple!(
        int,
        int
    ),
    int
  ),
  int function(
  ) pure nothrow @nogc @safe
)