forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 1
New ci #19
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These two files were missing headers. There is other work on-going to automate updating of the headers, but that likely won't crossover with this.
Don't consume literal brace as Scala pattern. Previously, leading space would let the text parser `xText` handle it correctly instead.
70407c6 to
f725327
Compare
SI-5817: Add header to language.scala and languageFeature.scala
SI-5154 Parse leading literal brace in XML pattern
|
/sync |
|
/rebuild |
|
/synch |
|
/rebuild |
adriaanm
pushed a commit
that referenced
this pull request
Aug 3, 2015
And do the same for the specialized variants.
Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.
Here's how the interfaces look now:
```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
public abstract R apply(T1);
public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
Code:
0: aload_0
1: aload_1
2: invokestatic #18 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
Code:
0: aload_0
1: aload_1
2: invokestatic #24 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public abstract java.lang.String toString();
public int apply$mcII$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#110 // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
5: ireturn
public long apply$mcJI$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#115 // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
5: lreturn
...
}
% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
public java.lang.Object apply(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: invokestatic #16 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
5: invokeinterface #19, 2 // InterfaceMethod apply:(I)I
10: invokestatic #23 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
13: areturn
public abstract int apply$mcII$sp(int);
public int apply(int);
Code:
0: aload_0
1: iload_1
2: invokeinterface scala#30, 2 // InterfaceMethod apply$mcII$sp:(I)I
7: ireturn
}
```
adriaanm
pushed a commit
that referenced
this pull request
Aug 8, 2015
And do the same for the specialized variants.
Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.
Here's how the interfaces look now:
```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
public abstract R apply(T1);
public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
Code:
0: aload_0
1: aload_1
2: invokestatic #18 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
Code:
0: aload_0
1: aload_1
2: invokestatic #24 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public abstract java.lang.String toString();
public int apply$mcII$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#110 // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
5: ireturn
public long apply$mcJI$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#115 // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
5: lreturn
...
}
% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
public java.lang.Object apply(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: invokestatic #16 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
5: invokeinterface #19, 2 // InterfaceMethod apply:(I)I
10: invokestatic #23 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
13: areturn
public abstract int apply$mcII$sp(int);
public int apply(int);
Code:
0: aload_0
1: iload_1
2: invokeinterface scala#30, 2 // InterfaceMethod apply$mcII$sp:(I)I
7: ireturn
}
```
adriaanm
pushed a commit
that referenced
this pull request
Sep 2, 2015
And do the same for the specialized variants.
Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.
Here's how the interfaces look now:
```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
public abstract R apply(T1);
public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
Code:
0: aload_0
1: aload_1
2: invokestatic #18 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
Code:
0: aload_0
1: aload_1
2: invokestatic #24 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
5: areturn
public abstract java.lang.String toString();
public int apply$mcII$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#110 // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
5: ireturn
public long apply$mcJI$sp(int);
Code:
0: aload_0
1: iload_1
2: invokestatic scala#115 // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
5: lreturn
...
}
% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
public java.lang.Object apply(java.lang.Object);
Code:
0: aload_0
1: aload_1
2: invokestatic #16 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
5: invokeinterface #19, 2 // InterfaceMethod apply:(I)I
10: invokestatic #23 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
13: areturn
public abstract int apply$mcII$sp(int);
public int apply(int);
Code:
0: aload_0
1: iload_1
2: invokeinterface scala#30, 2 // InterfaceMethod apply$mcII$sp:(I)I
7: ireturn
}
```
adriaanm
pushed a commit
that referenced
this pull request
Jun 10, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial scala#32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic scala#36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic scala#59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual scala#63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual scala#66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual scala#69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual scala#28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual scala#31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual scala#34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.