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

[WIP] Add TypeApplication synthetics #5

Open
wants to merge 9 commits into
base: synthetic-implicit-conversion
Choose a base branch
from

Conversation

tanishiking
Copy link
Owner

No description provided.

Support following synthetics
- implicit and context parameters application
- Anonymous context param name
- Invented given

Also convert TypeVar to stripped type, which may appear in synthetics
@@ -740,6 +754,10 @@ Occurrences:
[56:6..56:13): TestObj -> endmarkers/TestObj.
[58:4..58:14): endmarkers -> endmarkers/

Synthetics:
[23:7..23:7): => *.apply[Int, Int, Int]
[27:7..27:7): => *.apply[Int, Int, Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

synthetic's range should be (1,2,3) ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

it should be (1,2,3) => Tuple2.apply[Int, Int, Int](*) ?? (even in scala2)

Synthetics:
[42:24..42:32):Tag[Int] => *[Int]
[43:28..43:40):Tag[Boolean] => *[Boolean]
[46:28..46:35):C <:< C => *[C, C]
Copy link
Owner Author

Choose a reason for hiding this comment

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

do we need this?

[49:27..49:31):Refl => *.apply[T]
[52:9..52:13):Refl => *.unapply[Option[B]]
[52:19..52:30):opt.flatMap => *[B]
[52:31..52:50):identity[Option[B]] => *[Function1[A, Option[B]]]
Copy link
Owner Author

Choose a reason for hiding this comment

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

?

[54:14..54:18):Some => *.apply[Some[Int]]
[54:19..54:23):Some => *.apply[Int]
[54:28..54:34):unwrap => *[Some[Int], Int]
[54:34..54:34): => *[Option[Int]]
Copy link
Owner Author

Choose a reason for hiding this comment

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

what?

[54:19..54:23):Some => *.apply[Int]
[54:28..54:34):unwrap => *[Some[Int], Int]
[54:34..54:34): => *[Option[Int]]
[56:52..56:64):Enum[Planet] => *[Planet]
Copy link
Owner Author

Choose a reason for hiding this comment

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

?

[9:6..9:7): x <- example/Example.x.
[9:10..9:15): scala -> scala/
[9:16..9:23): reflect -> scala/reflect/
[9:24..9:32): classTag -> scala/reflect/package.classTag().
[9:33..9:36): Int -> scala/Int#

Synthetics:
[5:6..5:41):scala.collection.mutable.Stack[Int] => *[Int]
[5:6..5:41):scala.collection.mutable.Stack[Int] => *[Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

why we have type application here

@@ -1315,6 +1354,7 @@ Occurrences:
[17:50..17:51): U -> ext/Functor#map().[U]

Synthetics:
[4:37..4:37): => *.apply[String, Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

tuple apply's range should contains tuple

@@ -1398,6 +1439,73 @@ Occurrences:
[40:6..40:7): e -> local9
[41:6..41:7): f -> local10

Synthetics:
[4:9..4:16):List(1) => *.flatMap[Tuple3[Int, Int, Int]]
Copy link
Owner Author

Choose a reason for hiding this comment

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

for comprehension shouldn't emit at this moment.

Synthetics:
[12:17..12:25):sayHello => *[Int]
[13:19..13:29):sayGoodbye => *[Int]
[14:18..14:27):saySoLong => *[Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

wanna test

extension [A](any: A)
  def foo[B] = ...

[15:2..15:9):message => augmentString(*)
[17:2..17:2): => *[Tuple2[Int, Int]]
Copy link
Owner Author

Choose a reason for hiding this comment

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

?

[8:2..8:10):(x1, x1) => orderingToOrdered[Tuple2[Int, Int]](*)
[8:2..8:10):(x1, x1) => *(Tuple2(Int, Int))
[8:3..8:3): => *.apply[Int, Int]
[8:10..8:10): => *[Int, Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

suppress revisit

@@ -2116,7 +2249,11 @@ Occurrences:
[34:8..34:9): m -> example/Methods#m17.m().

Synthetics:
[3:14..3:26):Methods[Int] => *[Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

Methods[Int][Int]

@@ -2116,7 +2249,11 @@ Occurrences:
[34:8..34:9): m -> example/Methods#m17.m().

Synthetics:
[3:14..3:26):Methods[Int] => *[Int]
[11:11..11:22):m.List[Int] => *[Int]
Copy link
Owner Author

Choose a reason for hiding this comment

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

dit

@@ -2866,7 +3003,10 @@ Occurrences:
[32:57..32:59): as -> example/PickOneRefinement_1#run().(as)

Synthetics:
[15:23..15:34):elems.toMap => *[String, Any]
Copy link
Owner Author

Choose a reason for hiding this comment

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

stop revisit

Copy link
Owner Author

Choose a reason for hiding this comment

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

this is not revisit

    private[this] val elems: Seq[(String, Any)] @Repeated
    private[this] val fields: Map[String, Any] = 
      Record.this.elems.toMap[String, Any](<:<.refl[(String, Any)])
    def selectDynamic(name: String): Any = this.fields.apply(name)

@@ -3730,6 +3933,10 @@ Occurrences:
[14:8..14:15): println -> scala/Predef.println(+1).
[17:4..17:7): out -> local0

Synthetics:
[12:5..12:5): => *.apply[Repr[In], Repr[Out]]
[13:12..13:12): => *.unapply[Repr[In], Repr[Out]]
Copy link
Owner Author

Choose a reason for hiding this comment

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

tuple pattern should have unapply?

@@ -4133,6 +4359,12 @@ Occurrences:
[25:27..25:28): t <- local1
[25:33..25:36): ??? -> scala/Predef.`???`().

Synthetics:
[10:22..10:22): => *[T, U, V]
Copy link
Owner Author

Choose a reason for hiding this comment

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

this => *[T, U, V]

@@ -3730,6 +3924,10 @@ Occurrences:
[14:8..14:15): println -> scala/Predef.println(+1).
[17:4..17:7): out -> local0

Synthetics:
[11:14..11:32):copyImpl[Repr](in) => copyImpl[Repr](*)
Copy link
Owner Author

Choose a reason for hiding this comment

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

?

@tanishiking tanishiking force-pushed the synthetic-implicit-conversion branch 4 times, most recently from edd392e to a4f1400 Compare August 27, 2021 16:55
@tanishiking tanishiking changed the base branch from synthetic-implicit-conversion to master September 6, 2021 08:02
@tanishiking tanishiking changed the base branch from master to synthetic-implicit-conversion September 6, 2021 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant