Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Явная реализация свойства из шаблонного интерфейса не работает #3073

Open
SunSerega opened this issue Apr 1, 2024 · 1 comment

Comments

@SunSerega
Copy link
Contributor

С интерфейсом из .dll пишет что свойство это не свойство:

uses System.Collections;
uses System.Collections.Generic;

type
  t1<T> = class(System.Collections.Generic.ICollection<T>)
    public procedure Add(item: T) := exit;
    public procedure Clear := exit;
    public function Contains(item: T): boolean := true;
    public procedure CopyTo(a: array of T; arrayIndex: integer) := exit;
    
    // Так работает, хотя не должно
//    public function ICollection<T>.get_Count: integer := 0;
    //Ошибка: Ожидалось свойство
    public property ICollection<T>.Count: integer read 0;
    
    public property IsReadOnly: boolean read 0=0;
    public function IEnumerable.GetEnumerator: IEnumerator := nil;
    public function GetEnumerator: IEnumerator<T> := nil;
    public function Remove(item: T): boolean := true;
  end;
  
begin
  
end.

С пользовательским типом пишет что геттер свойства не реализован:

type
  I1<T> = interface
    property p1: byte read;
  end;
  t1<T> = class(I1<T>)
    public b: byte;
    //Ошибка: Класс t1<T> не реализует метод get_p1:byte интерфейса I1<T>
    public property I1<T>.p1: byte read byte(b);
  end;
  
begin end.

Этот код взял из #2607, но поидее связано только поверхностно.
И в данном случае ошибки одинаковые, не зависимо от того реализованы ли свойства старым стилем (имя поля или функции в read) или новым (выражение в read).

@SunSerega
Copy link
Contributor Author

Однако с явной реализацией IsReadOnly, в отличии от Count выше, не воспроизводится. Наверное тут всё же 2 отдельные issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant