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

Implement missing type methods (typer layer) #358

Merged
merged 39 commits into from
Feb 19, 2019
Merged

Conversation

greenhat
Copy link
Member

@greenhat greenhat commented Jan 10, 2019

#324
Close #344

Todo:

  • "shifting" SCollection methods;
  • rebase ontov2.0 after Add missing non-method ops (typer layer) #347 is merged;
  • methods from other types;
  • the rest of missing SCollection methods;
  • SCollection.zip, partition type cannot be expressed (circular dependency on STuple);
  • SCollection.mapReduce;
  • move existing IR building code from CompiletimeCosting into SMethod.irBuilder;
  • try pulling a few MethodCall based collection method through the costing;
  • test new methods (MethodCall based) pulled through the costing in interpreter;
  • add costOf(node) for MethodCall ops (RuntimeCosting);
  • move to special.sigma appending of the result type of the lambda to arg list on MethodCall eval and also for other methods with RType implicit argument (if any) cmt

@greenhat greenhat added the S-wip Status: Work in progress label Jan 10, 2019
@greenhat greenhat force-pushed the i324-methods-and-i344 branch 2 times, most recently from 56cdc54 to 152c55a Compare January 16, 2019 11:17
@greenhat greenhat force-pushed the i324-methods-and-i344 branch from 64f096f to b8776f4 Compare January 16, 2019 14:53
@greenhat greenhat force-pushed the i324-methods-and-i344 branch from b8776f4 to 87ad4d0 Compare January 17, 2019 14:53
@greenhat greenhat changed the base branch from i324-typer-layer to v2.0 January 17, 2019 14:54
@greenhat greenhat force-pushed the i324-methods-and-i344 branch from 717b89e to 9891b78 Compare January 23, 2019 13:44
@greenhat greenhat force-pushed the i324-methods-and-i344 branch from 9891b78 to 63bb585 Compare January 28, 2019 08:41
src/main/scala/sigmastate/eval/RuntimeCosting.scala Outdated Show resolved Hide resolved
src/main/scala/sigmastate/eval/RuntimeCosting.scala Outdated Show resolved Hide resolved
src/main/scala/sigmastate/eval/RuntimeCosting.scala Outdated Show resolved Hide resolved
}

property("SCollection.flatMap") {
testMissingCosting("OUTPUTS.flatMap({ (out: Box) => Coll(out.value >= 1L) })",
comp("OUTPUTS.flatMap({ (out: Box) => Coll(out.value >= 1L) })") shouldBe
Copy link
Member

Choose a reason for hiding this comment

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

@greenhat The flatMap can accept only limited lambdas as arguments.
Currently:

  1. x => x._1
  2. box => MethodCall(box, name, List())
  3. x: Coll[T] => x

Copy link
Member

Choose a reason for hiding this comment

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

please put this requirements into description of method call both LangSpec.md and special.collection.Colls.scala

Copy link
Member Author

Choose a reason for hiding this comment

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

@aslesarenko Done. What's the reason for this limitation? I'm struggling to find where and how it's enforced.

@greenhat greenhat force-pushed the i324-methods-and-i344 branch from e7c41e8 to 1309475 Compare January 31, 2019 13:19
@greenhat greenhat force-pushed the i324-methods-and-i344 branch 3 times, most recently from accf789 to 602738f Compare February 18, 2019 09:58
@greenhat greenhat added S-ready-for-merge Status: This PR is ready for merge and removed S-wip Status: Work in progress labels Feb 18, 2019
add Apply(Select) to MethodCallLike transformation in binder for collections;
implement irBuilder for getOrElse method;
add indices and flatMap methods;
add toBytes and toBits methods to numeric types;
add Apply(Select)/Select to MethodCall transformation to typer(via method.irBuilder);
add SBigInt.multModQ method;
add SOption.toColl method;
add CONTEXT.dataInputs to MethodCall translation;
@greenhat greenhat force-pushed the i324-methods-and-i344 branch from 08ecf81 to 4c35205 Compare February 19, 2019 04:25
Copy link
Member

@aslesarenko aslesarenko left a comment

Choose a reason for hiding this comment

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

LGTM

@aslesarenko aslesarenko merged commit 1c81f6a into v2.0 Feb 19, 2019
@kushti kushti deleted the i324-methods-and-i344 branch May 28, 2019 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-ready-for-merge Status: This PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants