Skip to content

Commit

Permalink
Reverted serialization of runtime types for self variables
Browse files Browse the repository at this point in the history
(cherry picked from commit 7c685b5)
  • Loading branch information
hurricup committed Aug 11, 2019
1 parent a518454 commit bc576e5
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public final class PerlValuesManager {
static final int SMART_GETTER_ID = id++;

// MUST stay here. Automatically changes on new element creation
public static final int VERSION = id + 4;
public static final int VERSION = id + 5;

private static final WeakInterner<PerlValue> INTERNER = new WeakInterner<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import com.perl5.lang.perl.psi.impl.PerlImplicitVariableDeclaration;
import com.perl5.lang.perl.psi.properties.PerlLexicalScope;
import com.perl5.lang.perl.psi.references.scopes.PerlVariableDeclarationSearcher;
import com.perl5.lang.perl.util.PerlPackageUtil;
import com.perl5.lang.perl.util.PerlUtil;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -326,9 +325,6 @@ private static PerlValue getValueFromControlFlow(@NotNull PsiElement element,
if( !declaredValue.isUnknown()){
valueBuilder.addVariant(declaredValue);
}
if (lexicalDeclaration.isInvocantDeclaration() || lexicalDeclaration.isSelf()) {
valueBuilder.addVariant(PerlPackageUtil.getExpectedSelfValue(lexicalDeclaration));
}
}
return valueBuilder.build();
}
Expand Down
3 changes: 1 addition & 2 deletions plugin/testData/unit/perl/perlValues/argumentSelf.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ sub something{
----------
$self
PsiPerlScalarVariableImpl(Perl5: SCALAR_VARIABLE) at 38 in argumentSelf.pl
OneOf[ArrayItem: SUB_ARGUMENTS[0],
main]
ArrayItem: SUB_ARGUMENTS[0]
----------
Resolved
----------
Expand Down
3 changes: 1 addition & 2 deletions plugin/testData/unit/perl/perlValues/issue2092First.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ sub useClass{
$var
PsiPerlScalarVariableImpl(Perl5: SCALAR_VARIABLE) at 159 in issue2092First.pl
scalar OneOf[ArrayItem: SUB_ARGUMENTS[1],
Some::Class,
main]->something()
Some::Class]->something()
----------
Resolved
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ method something($first){
----------
$self
PsiPerlScalarVariableImpl(Perl5: SCALAR_VARIABLE) at 28 in methodImplicitInvocant.pl
OneOf[ArrayItem: SUB_ARGUMENTS[0],
main]
ArrayItem: SUB_ARGUMENTS[0]
----------
Resolved
----------
Expand Down
6 changes: 1 addition & 5 deletions plugin/testData/unit/perl/perlValues/mojo/app.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ scalar main::app()
----------
Resolved
----------
OneOf[Mojolicious,
Ref[Hash(), blessed with Mojo::Base],
Ref[Hash(), blessed with main],
Ref[Hash(Value unknown), blessed with Mojo::Base],
OneOf[Ref[Hash(), blessed with main],
Ref[Hash(Value unknown), blessed with main],
Ref[Hash(moniker => dummy), blessed with Mojo::Base],
Ref[Hash(moniker => dummy), blessed with main],
main]
6 changes: 1 addition & 5 deletions plugin/testData/unit/perl/perlValues/mojo/new.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ scalar main::new()
----------
Resolved
----------
OneOf[Mojolicious,
Ref[Hash(), blessed with Mojo::Base],
Ref[Hash(), blessed with main],
Ref[Hash(Value unknown), blessed with Mojo::Base],
OneOf[Ref[Hash(), blessed with main],
Ref[Hash(Value unknown), blessed with main],
Ref[Hash(moniker => dummy), blessed with Mojo::Base],
Ref[Hash(moniker => dummy), blessed with main],
main]
3 changes: 1 addition & 2 deletions plugin/testData/unit/perl/perlValues/superCall.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ scalar Child->new(foo, 42)
Resolved
----------
OneOf[Child,
Ref[Hash(foo => 42), blessed with Child],
Ref[Hash(foo => 42), blessed with Parent]]
Ref[Hash(foo => 42), blessed with Child]]
2 changes: 1 addition & 1 deletion plugin/testData/unit/perl/returnValues/argumentSelf.pl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
$self;
}
----------
OneOf: [ArrayItem: SUB_ARGUMENTS[0], main]
ArrayItem: SUB_ARGUMENTS[0]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
$cb
}
----------
OneOf: [ArrayItem: SUB_ARGUMENTS[0], main]
ArrayItem: SUB_ARGUMENTS[0]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
$self
}
----------
OneOf: [ArrayItem: SUB_ARGUMENTS[0], main]
ArrayItem: SUB_ARGUMENTS[0]

0 comments on commit bc576e5

Please sign in to comment.