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

Support self:: in static trait methods accessed from outside #137

Closed
roberthusak opened this issue Jan 4, 2018 · 0 comments
Closed

Support self:: in static trait methods accessed from outside #137

roberthusak opened this issue Jan 4, 2018 · 0 comments
Assignees
Labels
Projects

Comments

@roberthusak
Copy link
Contributor

This issue is related to #135, aimed at the usage of self:: in such situations. Test case:

<?php
trait T {
  private static $bar = "right";
  public static function bar() {
    return self::$bar;
  }
}
class C {
  public static $bar = "wrong";
  public static function foo() {
    return T::bar();
  }
}
echo C::foo();
echo "\n";
echo T::bar();

Expected result:

right
right

Actual result:

wrong

Unhandled Exception: System.NotImplementedException: The method or operation is not implemented.
   at Pchp.Core.Dynamic.GetFieldBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args)
   at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)
   ...

Also, Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)) in FieldSymbol.AsMember fails during the compilation.

@roberthusak roberthusak added this to TODO in MediaWiki via automation Jan 4, 2018
jakubmisek added a commit that referenced this issue Jan 4, 2018
- #137
- calling static methods on traits using correct `self` inside the trait
MediaWiki automation moved this from TODO to Done Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
MediaWiki
  
Done
Development

No branches or pull requests

2 participants