Forum > General

Problem with Generics.Defaults / Compiler message

(1/4) > >>

Grahame Grieve:
I'm compiling code. When I'm building everything, I get an error compiling:

generics.defaults.pas(1051,43) Error: No type info available for this type

I recompile, and it compiles this time. Then, clean up and build, and I'll be back there. So there's some compiler bug here. But: what's the actual problem? I can't tell, because I don't know what the type is. Just "T". What was it actually compiling when the error happens? I don't know; it's some other unit, but I don't know which one, nor which type T is that leads to this problem.

Should the error message say what the type is explicitly? I'd *really* like that, because other times, I've spent ages trying to figure out what the problem is, and it turns out I was looking at the wrong type because of scope issues. Or have I missed something and this has an obvious solution?

Version: Lazarus 2.2.5 (rev lazarus_2_2_4-3-g564e1e8244) FPC 3.2.2 aarch64-darwin-cocoa

Thaddy:
That error is a bit strange given the documentation of TypeInfo : https://www.freepascal.org/docs-html/rtl/system/typeinfo.html states that the result is always non-nil.
Anyway, I'd still like to see what T is specialized to , because un-specialized T itself does of course never have type info, only the specialization can have type info.
Am I right it sometimes works and sometimes not? In that case some example code will help.

Maybe @PascalDragon can shed some light on it?

Grahame Grieve:
well, the thing is, I'm not sure how to create sample code, because my immediate problem is: I don''t know what code is compiling at that point, and that's my real question. It's a List<Something> but I don't know how to figure out which something - there's no clue in the compiler output

Thaddy:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Type  TMySomethingList = Tlist<something>;// from here Tsomethinglist has type info... var  SomethingList:TMySomethingList;// from here somethinglist  can be queried for type info...beginend.You should look for the specialization, given something is a valid something ;) and not T

PascalDragon:

--- Quote from: Grahame Grieve on November 18, 2022, 12:53:36 pm ---well, the thing is, I'm not sure how to create sample code, because my immediate problem is: I don''t know what code is compiling at that point, and that's my real question. It's a List<Something> but I don't know how to figure out which something - there's no clue in the compiler output

--- End quote ---

Do you by any chance specialize somewhere with an enumeration type that has holes between values or does not start with 0? Cause that's the only case where this error message is triggered.

Navigation

[0] Message Index

[#] Next page

Go to full version