Skip to content

propagate custom constructor of base class through abstract class in inheritance chain #1272

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

Merged

Conversation

PetrShumilov
Copy link
Contributor

@PetrShumilov PetrShumilov commented Mar 28, 2025

Following code:

class A {
    public function __construct() {
        echo "A!";
    }
}

abstract class B extends A {}

class C extends B {}

new C();

should lead to output like this:

A1

Currently, we get empty output due to incorrect code gen. Constructor of class C looks like:

#pragma once
#include "runtime-headers.h"
#include "cl/[email protected]"

inline class_instance<C$C> f$C$$__construct(class_instance<C$C> const &v$this) noexcept ;

//source = [test.php]
//14: class C extends B {
class_instance<C$C> f$C$$__construct(class_instance<C$C> const &v$this) noexcept  {
  return v$this;
} 

Constructor for A has not been generated

@PetrShumilov PetrShumilov added bug Something isn't working compiler Feature related to compiler labels Mar 28, 2025
@PetrShumilov PetrShumilov added this to the next milestone Mar 28, 2025
@PetrShumilov PetrShumilov self-assigned this Mar 28, 2025
@PetrShumilov PetrShumilov force-pushed the pshumilov/fix_trying_to_access_property_of_null_object branch from 69ae06b to c3e49d9 Compare March 28, 2025 18:09
mkornaukhov03
mkornaukhov03 previously approved these changes Mar 31, 2025
Copy link
Contributor

@mkornaukhov03 mkornaukhov03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Petr Shumilov <[email protected]>
@PetrShumilov PetrShumilov force-pushed the pshumilov/fix_trying_to_access_property_of_null_object branch from c3e49d9 to da31259 Compare April 1, 2025 18:03
@PetrShumilov PetrShumilov force-pushed the pshumilov/fix_trying_to_access_property_of_null_object branch 3 times, most recently from a8a36d6 to 2ff6d77 Compare April 2, 2025 15:49
@PetrShumilov PetrShumilov requested a review from a team as a code owner April 2, 2025 15:49
ZemlyakovDmitry
ZemlyakovDmitry previously approved these changes Apr 2, 2025
@PetrShumilov PetrShumilov force-pushed the pshumilov/fix_trying_to_access_property_of_null_object branch 8 times, most recently from 142d0bf to f797ee1 Compare April 2, 2025 17:46
@PetrShumilov PetrShumilov force-pushed the pshumilov/fix_trying_to_access_property_of_null_object branch from f797ee1 to 6158ae7 Compare April 2, 2025 18:00
Copy link
Contributor

@mkornaukhov03 mkornaukhov03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@PetrShumilov PetrShumilov merged commit c39bb94 into master Apr 3, 2025
5 checks passed
@PetrShumilov PetrShumilov deleted the pshumilov/fix_trying_to_access_property_of_null_object branch April 3, 2025 18:05
@Danil42Russia Danil42Russia modified the milestones: next, next2 Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Feature related to compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants