Delphi compiler kinda freaks out with this code.

skybuck2000 <[email protected]> Fri, 11 Feb 2022 04:28:44 -0800 (PST)
Newsgroups alt.comp.lang.borland-delphi
Message-ID <[email protected]>
Weird stuff starts happening, TButton not compiling or it wants to remove the form variable.

Problem is the procedure cannot have a return type, and should be a (class) function.

This was a copy & paste mistake or so... compiler should be hardened against this somewhat.

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
	TRawBytes = TBytes;

	TAccountKey = record
		 EC_OpenSSL_NID : Word;
		 x: TRawBytes;
		 y: TRawBytes;

	end;

	TOperationBlock = Record
		block: Cardinal;
		account_key: TAccountKey;
		reward: UInt64;
		fee: UInt64;
		protocol_version: Word;     // Protocol version
		protocol_available: Word;   // Used to upgrade protocol
		timestamp: Cardinal;        // Timestamp creation
		compact_target: Cardinal;   // Target in compact form
		nonce: Cardinal;            // Random value to generate a new P-o-W
		block_payload : TRawBytes;  // RAW Payload that a miner can include to a blockchain
		initial_safe_box_hash: TRawBytes; // RAW Safe Box Hash value (32 bytes, it's a Sha256)
		operations_hash: TRawBytes; // RAW sha256 (32 bytes) of Operations
		proof_of_work: TRawBytes;   // RAW 32 bytes
		previous_proof_of_work: TRawBytes; // RAW 32 bytes
	end;



type
  TForm1 = class(TForm)
	Button1: TButton;
  private
    { Private declarations }
  public
	{ Public declarations }
	procedure Test(const newOperationBlock: TOperationBlock; var errors: String): Boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Test(const newOperationBlock: TOperationBlock; var errors: String): Boolean;
begin

end;

end.

Bye for now,
  Skybuck.