Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn

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:


```d
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
)
```


Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn

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.


Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread Berni44 via Digitalmars-d-learn

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...


Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread Chris Piker via Digitalmars-d-learn

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):

```
```d
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.




Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn

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.





Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn

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:

```d
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)`