HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.19k stars 655 forks source link

Type not found error causes questionable error state #11395

Open Simn opened 12 months ago

Simn commented 12 months ago

I noticed today that when deleting the haxe.crypto package and trying to compile haxelib, the reported errors look like this:

C:\git\haxe\std/haxe/zip/InflateImpl.hx:26: characters 8-27 : Type not found : haxe.crypto.Adler32
C:\git\haxe\std/haxe/zip/InflateImpl.hx:35: characters 10-17 : Type not found : Adler32
C:\git\haxe\std/haxe/zip/InflateImpl.hx:146: characters 12-27 : haxe.zip._InflateImpl.Window does not have a constructor
C:\git\haxe\std/haxe/zip/InflateImpl.hx:287: characters 23-31 : haxe.zip._InflateImpl.Window has no field checksum
C:\git\haxe\std/haxe/zip/InflateImpl.hx:292: characters 15-22 : Type not found : Adler32
C:\git\haxe\std/haxe/zip/InflateImpl.hx:205: characters 10-18 : haxe.zip._InflateImpl.Window has no field addBytes
C:\git\haxe\std/haxe/zip/InflateImpl.hx:219: characters 18-29 : haxe.zip._InflateImpl.Window has no field getLastChar
C:\git\haxe\std/haxe/zip/InflateImpl.hx:212: characters 10-17 : haxe.zip._InflateImpl.Window has no field addByte
C:\git\haxe\std/haxe/zip/InflateImpl.hx:380: characters 24-33 : haxe.zip._InflateImpl.Window has no field available

This suggests a strange error state where compilation continues despite the original error, but without the erroneous class having any structure. I find this to be an odd middle ground, because compilation should either:

  1. Fail harder so these followup errors don't occur in the first place.
  2. Don't fail so hard so that the class still has a structure.

Personally, I dislike how we try to recover from errors because I rarely find the followup errors useful, but I'm aware that others disagree with that. Either way, I'd first like to understand where the original error is caught.

kLabz commented 12 months ago

Similar thing happens when a type fails to build, leading to nonsense errors afterwards.

I have a note somewhere to try keeping track of such types and silence errors related to those, but failing harder would be much easier.

Simn commented 12 months ago

You wouldn't happen to know there this is actually caught? I'm seeing plenty of catches for Error Unify but not so much for this particular one. I wonder if this is caught by some random general with Error err like the one in type_block.

kLabz commented 12 months ago

I triggered a similar thing and got some from various places: