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

Implemented high-level typeof operator expression & internal meta types for arrays and functions #688

Merged
merged 39 commits into from
Sep 2, 2024

Conversation

lorenzholzbauer
Copy link
Member

@lorenzholzbauer lorenzholzbauer commented Jul 26, 2024

What type of change does this PR perform?

  • Info or documentation change (Non-breaking change that updates repo info files (e.g. README.md, CONTRIBUTING.md, etc.) or online documentation)
  • Website (Change that changes the design or functionality of the websites or docs)
  • Development or internal changes (These changes do not add new features or fix bugs, but update the code in other ways)
  • Bug fix (Non-breaking change which fixes an issue)
  • New feature (Non-breaking change which adds functionality)
  • Breaking change (Major bug fix or feature that would cause existing functionality not to work as expected.)
  • Requires a documentation update, as it changes language or compiler behaviour

Summary

This PR adds the typeof expression in Kipper, which returns the type of an object at runtime. It also adds runtime type generation for interfaces adnd builtin types.

Closes #663

Detailed Changelog

Added

  • Support for the typeof operator, which returns the runtime type of a value.
  • Support for Nix Flakes and direnv, which allows for a more reproducible and consistent development environment.
  • New classes:
    • TypeofExpression, which represents an AST typeof expression that returns the runtime type of an object.
    • TypeofTypeSpecifierExpression, which represents an AST typeof type specifier that lets one define a type by using an object as reference
    • BuiltInTypeObject, which is the base class for the compilers representation of runtime objects
  • New functions:
    • generateInterfaceRuntimeTypeChecks which generates runtime type checks for an interface.
    • getRuntimeType, which gets the corresponding runtime representation of a built-in type.

Does this PR create new warnings?

No new warnings.

Linked issues or PRs

…eration-for-builtin-types' into 663-feature-high-level-typeof-operator

# Conflicts:
#	kipper/core/src/compiler/semantics/symbol-table/universum-scope.ts
…level-typeof-operator

# Conflicts:
#	kipper/target-js/src/code-generator.ts
#	kipper/target-ts/src/code-generator.ts
…-operator

# Conflicts:
#	CHANGELOG.md
#	kipper/core/src/compiler/ast/nodes/expressions/primary-expression/lambda-primary-expression/lambda-primary-expression-type-semantics.ts
#	kipper/core/src/compiler/ast/nodes/expressions/primary-expression/lambda-primary-expression/lambda-primary-expression.ts
#	kipper/core/src/compiler/const.ts
#	kipper/core/src/compiler/semantics/analyser/type-checker.ts
#	kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts
#	kipper/core/src/compiler/target-presets/semantic-analyser.ts
#	kipper/target-js/src/code-generator.ts
#	kipper/target-ts/src/code-generator.ts
#	kipper/target-ts/src/target.ts
… implementation of runtime `typeof` function
@lorenzholzbauer lorenzholzbauer added feature New feature or enhancement breaking change This is a breaking change high priority High priority issue, discussion or pull request labels Jul 26, 2024
@lorenzholzbauer lorenzholzbauer added this to the v0.12.0 milestone Jul 26, 2024
@lorenzholzbauer lorenzholzbauer requested review from ByteWolf-dev and a team July 26, 2024 14:56
@lorenzholzbauer lorenzholzbauer self-assigned this Jul 26, 2024
@lorenzholzbauer lorenzholzbauer marked this pull request as ready for review July 31, 2024 14:40
@Luna-Klatzer Luna-Klatzer force-pushed the 663-feature-high-level-typeof-operator branch from bdb2562 to 90788ae Compare August 23, 2024 16:24
Copy link

codecov bot commented Aug 24, 2024

Codecov Report

Attention: Patch coverage is 67.88321% with 44 lines in your changes missing coverage. Please review.

Project coverage is 82.90%. Comparing base (6623e69) to head (694954c).
Report is 40 commits behind head on dev-next.

Files with missing lines Patch % Lines
...-expression/typeof-expression/typeof-expression.ts 33.33% 14 Missing ⚠️
kipper/target-js/src/code-generator.ts 65.85% 14 Missing ⚠️
...ier-expression/typeof-type-specifier-expression.ts 10.00% 9 Missing ⚠️
kipper/target-ts/src/tools.ts 50.00% 1 Missing and 2 partials ⚠️
kipper/target-ts/src/code-generator.ts 81.81% 2 Missing ⚠️
kipper/target-js/src/target.ts 75.00% 1 Missing ⚠️
kipper/target-ts/src/target.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           dev-next     #688      +/-   ##
============================================
- Coverage     84.24%   82.90%   -1.34%     
============================================
  Files           274      276       +2     
  Lines          4684     4780      +96     
  Branches        513      525      +12     
============================================
+ Hits           3946     3963      +17     
- Misses          590      668      +78     
- Partials        148      149       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This is a breaking change feature New feature or enhancement high priority High priority issue, discussion or pull request
Projects
Development

Successfully merging this pull request may close these issues.

[Feature] Implement high-level typeof operator
2 participants