Re: [fpc-pascal] Constants in generics tests

2019-02-24 Thread Ryan Joseph
I made one final commit and now I’m submitting a patch for review. I’ve probably made mistakes in the patch process but I want to get this into the pipeline so it’s not just sitting there wasting space on my computer. Tests are included now and the link to the source on git is included in the re

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Ryan Joseph
> On Feb 15, 2019, at 1:52 PM, Jeppe Johansen wrote: > > Hi, > > Do you know why this doesn't work? Jeppe I got this fixed now so if you update and rebuild from git it should work now. Really stupid one liner mistake that took my all morning to find. I included this into the tests which all

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Ryan Joseph
> On Feb 16, 2019, at 9:42 AM, Sven Barth via fpc-pascal > wrote: > > When you create the constant symbols for the specialization you need to make > sure that they belong to the surrounding symtable, not the specialized > generic. > I probably didn’t get that right then. The constants are

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Sven Barth via fpc-pascal
Am Sa., 16. Feb. 2019, 15:34 hat Ryan Joseph geschrieben: > > > > On Feb 16, 2019, at 3:33 AM, Sven Barth via fpc-pascal < > fpc-pascal@lists.freepascal.org> wrote: > > > > While you're at it, you should probably also ensure that internal error > 2014050904 does not trigger ;) > > That’s what got

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Jonas Maebe
On 16/02/19 15:04, Ryan Joseph wrote: Btw, how does FPC generate internal errors numbers? I needed to add some errors myself and I didn’t know how to increment the counter. YearMonthDay00, YearMonthDay01, ... Jonas ___ fpc-pascal maillist - fpc-p

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Ryan Joseph
> On Feb 16, 2019, at 3:33 AM, Sven Barth via fpc-pascal > wrote: > > While you're at it, you should probably also ensure that internal error > 2014050904 does not trigger ;) That’s what got my in the first place. I saw the internal error and made it not trigger but didn’t bother to check i

Re: [fpc-pascal] Constants in generics tests

2019-02-16 Thread Sven Barth via fpc-pascal
Am 15.02.2019 um 23:00 schrieb Ryan Joseph: On Feb 15, 2019, at 4:19 PM, Sven Barth via fpc-pascal wrote: It could be that the method body is not generated. Look for generate_specialization_procs in pgenutil as that is what generates the bodies at the end of a unit (simplified). Really g

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Ryan Joseph
> On Feb 15, 2019, at 4:19 PM, Sven Barth via fpc-pascal > wrote: > > It could be that the method body is not generated. Look for > generate_specialization_procs in pgenutil as that is what generates the > bodies at the end of a unit (simplified). > Really good catch Sven. tstoreddef.is_s

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Jeppe Johansen
Hi, Do you know why this doesn't work? type   TGPIO = class   public     class function ReadValue: NativeUInt; virtual; abstract;     class procedure SetValue(AValue: NativeUInt); virtual; abstract;     class function GetPin(const AIndex: NativeInt): boolean; virtual;   end;   generic TStm32GP

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Sven Barth via fpc-pascal
Am Fr., 15. Feb. 2019, 21:54 hat Ryan Joseph geschrieben: > > > > On Feb 15, 2019, at 2:11 PM, Ryan Joseph > wrote: > > > > Something with class functions in particular. Very strange it can’t find > the declaration. So never mind about submitting, I need to fix this now. :) > > I just looked ove

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Ryan Joseph
> On Feb 15, 2019, at 2:11 PM, Ryan Joseph wrote: > > Something with class functions in particular. Very strange it can’t find the > declaration. So never mind about submitting, I need to fix this now. :) I just looked over this and indeed I have no idea idea what happened. I suspect there’s

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Sven Barth via fpc-pascal
Am Fr., 15. Feb. 2019, 20:58 hat Ryan Joseph geschrieben: > > > > On Feb 15, 2019, at 2:11 PM, Ryan Joseph > wrote: > > > > Also I just noticed that I’m getting warnings from the “U” constant > which is declared in the “strict private” section (Private const > "TTest$1.U" never used). That needs

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Ryan Joseph
> On Feb 15, 2019, at 2:11 PM, Ryan Joseph wrote: > > Also I just noticed that I’m getting warnings from the “U” constant which is > declared in the “strict private” section (Private const "TTest$1.U" never > used). That needs to be fixed also. Sven or some other compiler guy, do you > know

Re: [fpc-pascal] Constants in generics tests

2019-02-15 Thread Ryan Joseph
Good catch, I have no idea what broke or how that could have happened. I got it distilled down to this: type generic TTest = class class procedure DoThis; // <—— Forward declaration not solved "class DoThis;" end; class procedure TTest.DoThis; begin end; type ATest = specia

[fpc-pascal] Constants in generics tests

2019-02-15 Thread Ryan Joseph
Here’s the latest changes which fixed the constant type checking and includes some tests. Are the tests in the correct format? They are named tgenconst*.pp. https://github.com/genericptr/freepascal/tree/generic_constants For example: {%FAIL} {$mode objfpc} program tgenconst8; type gener