-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb5cb2a
commit 086f06b
Showing
12 changed files
with
270 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package boa.types.proto; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import boa.types.BoaInt; | ||
import boa.types.BoaProtoTuple; | ||
import boa.types.BoaString; | ||
import boa.types.BoaType; | ||
import boa.types.proto.enums.CommentKindProtoMap; | ||
|
||
public class PositionInfoProtoTuple extends BoaProtoTuple { | ||
private final static List<BoaType> members = new ArrayList<BoaType>(); | ||
private final static Map<String, Integer> names = new HashMap<String, Integer>(); | ||
|
||
static { | ||
int count = 0; | ||
|
||
names.put("start_pos", count++); | ||
members.add(new BoaInt()); | ||
|
||
names.put("length", count++); | ||
members.add(new BoaInt()); | ||
|
||
names.put("start_line", count++); | ||
members.add(new BoaInt()); | ||
|
||
names.put("start_col", count++); | ||
members.add(new BoaInt()); | ||
|
||
names.put("end_line", count++); | ||
members.add(new BoaInt()); | ||
|
||
names.put("end_col", count++); | ||
members.add(new BoaInt()); | ||
} | ||
|
||
/** | ||
* Construct a {@link PositionInfoProtoTuple}. | ||
*/ | ||
public PositionInfoProtoTuple() { | ||
super(members, names); | ||
} | ||
|
||
/** @{inheritDoc} */ | ||
@Override | ||
public String toJavaType() { | ||
return "boa.types.Ast.PositionInfo"; | ||
} | ||
|
||
} |
Oops, something went wrong.
086f06b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@psybers
@RobertHSchmidt and I were updating the proto tuples and ran into a StackOverflowException when calculating hash code.
https://travis-ci.org/boalang/compiler/builds/336227992?utm_source=github_status&utm_medium=notification
After debugging, I found that the exception caused by adding recursive types at
086f06b#diff-54bc380eac6850531ef850933f83ab26R112
086f06b#diff-54bc380eac6850531ef850933f83ab26R121
086f06b#diff-83a2c3c5479302f4aa396a5e9c0eaa5aR71
I don't think recursive types are not allowed in Boa because we have been doing that.
For example, Expression type contains expressions and arguments of type Expression.
Talking about that recursive type of Expression, I saw that there was no exception because expressions and arguments are BoaProtoList whose hashCode() method was not overridden. I believe not having hashCode() method overridden is a bug.
What do you think?
086f06b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very odd. If you run 'ant test-codegen' you get that stack overflow. But if you run the compiler one at a time on all the test cases, it runs without problem...
086f06b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the JUnit test on boa.test.compiler.TestGood and got the same stack overflow.
086f06b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So somehow running from JUnit is differing from running with compile.sh.
Does it fail for each unit test or just one specific?
086f06b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It failed for each unit test in both compiler and datagen.