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

Refactor type declaration, parents, interfaces to lang.ast.Type instances #39

Merged
merged 2 commits into from
Nov 6, 2022

Conversation

thekid
Copy link
Member

@thekid thekid commented Nov 6, 2022

Refactoring

This pull request changes uses lang.ast.Type subclasses in the following places:

TypeDeclaration implementations

+ use lang\ast\Type;
@@ ... @@
  abstract class TypeDeclaration extends Annotated {
-   public string $name;
+   public ?Type $name;
  }
@@ ... @@
  class ClassDeclaration extends TypeDeclaration {
-   public ?string $parent;
-   public array<string> $implements;
+   public ?Type $parent;
+   public array<Type> $implements;
}
@@ ... @@
  class InterfaceDeclaration extends TypeDeclaration {
-   public array<string> $parents;
+   public array<Type> $parents;
}
@@ ... @@
  class EnumDeclaration extends TypeDeclaration {
-   public array<string> $implements;
+   public array<Type> $implements;
}

NewExpression

- use lang\ast\Node;
+ use lang\ast\{Node, Type};
@@ ... @@
  class NewExpression extends Node {
-   public string|Node $type;
+   public Type $type;
  }

IsGeneric

  class IsGeneric extends Type {
-   public string $base;
+   public Type $base;
  }

It also introduces the lang.types.IsExpression class to be used for new $expr / new ($expr) cases.

BC break

This introduces as BC break (the XP compiler test suite will fail with Compile error (Cannot use 'self' as class name, as it is reserved), for example), and will thus result in a new major version (9.0 at the time of writing).

thekid added a commit to xp-framework/compiler that referenced this pull request Nov 6, 2022
@thekid thekid merged commit d631e19 into master Nov 6, 2022
@thekid thekid deleted the refactor/types branch November 6, 2022 21:32
thekid added a commit to xp-lang/xp-records that referenced this pull request Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant