Skip to content

Commit

Permalink
Add Experimental Features checkbox (-Xexperimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilinum authored and Alefas committed Jun 24, 2015
1 parent 4b9f678 commit 45075ad
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
Expand Up @@ -90,6 +90,10 @@ public String[] getCompilerOptions() {
list.add("-P:continuations:enable");
}

if (myState.experimental) {
list.add("-Xexperimental");
}

switch (myState.debuggingInfoLevel) {
case None:
list.add("-g:none");
Expand Down Expand Up @@ -146,6 +150,8 @@ public static class State {

public boolean macros;

public boolean experimental;

public boolean warnings = true; //no -nowarn

public boolean deprecationWarnings;
Expand Down
Expand Up @@ -21,6 +21,7 @@ class ScalaCompilerSettings(state: ScalaCompilerSettingsState) {
var higherKinds: Boolean = _
var existentials: Boolean = _
var macros: Boolean = _
var experimental: Boolean = _

var warnings: Boolean = _
var deprecationWarnings: Boolean = _
Expand All @@ -43,6 +44,7 @@ class ScalaCompilerSettings(state: ScalaCompilerSettingsState) {
("-language:higherKinds", () => higherKinds, higherKinds = _),
("-language:existentials", () => existentials, existentials = _),
("-language:macros", () => macros, macros = _),
("-Xexperimental", () => experimental, experimental = _),
("-nowarn", () => !warnings, (b: Boolean) => warnings = !b),
("-deprecation", () => deprecationWarnings, deprecationWarnings = _),
("-unchecked", () => uncheckedWarnings, uncheckedWarnings = _),
Expand Down Expand Up @@ -117,6 +119,7 @@ class ScalaCompilerSettings(state: ScalaCompilerSettingsState) {
higherKinds = state.higherKinds
existentials = state.existentials
macros = state.macros
experimental = state.experimental

warnings = state.warnings
deprecationWarnings = state.deprecationWarnings
Expand All @@ -143,6 +146,7 @@ class ScalaCompilerSettings(state: ScalaCompilerSettingsState) {
state.higherKinds = higherKinds
state.existentials = existentials
state.macros = macros
state.experimental = experimental

state.warnings = warnings
state.deprecationWarnings = deprecationWarnings
Expand Down
Expand Up @@ -227,6 +227,14 @@
<toolTipText value="Respect @specialize annotations"/>
</properties>
</component>
<component id="5ed87" class="javax.swing.JCheckBox" binding="myExperimental">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="E&amp;xperimental Features"/>
</properties>
</component>
</children>
</grid>
<component id="6d327" class="com.intellij.ui.TitledSeparator">
Expand Down
Expand Up @@ -37,6 +37,7 @@ public class ScalaCompilerSettingsPanel {
private JCheckBox myFeatureWarnings;
private JCheckBox myMacros;
private JCheckBox mySpecialization;
private JCheckBox myExperimental;

private MyPathEditor myPluginsEditor = new MyPathEditor(new FileChooserDescriptor(true, false, true, true, false, true));

Expand All @@ -61,6 +62,7 @@ public ScalaCompilerSettingsState getState() {
state.higherKinds = myHigherKinds.isSelected();
state.existentials = myExistentials.isSelected();
state.macros = myMacros.isSelected();
state.experimental = myExperimental.isSelected();

state.compileOrder = (CompileOrder) myCompileOrder.getSelectedItem();
state.warnings = myWarnings.isSelected();
Expand Down Expand Up @@ -97,6 +99,7 @@ public void setState(ScalaCompilerSettingsState state) {
myHigherKinds.setSelected(state.higherKinds);
myExistentials.setSelected(state.existentials);
myMacros.setSelected(state.macros);
myExperimental.setSelected(state.experimental);

myCompileOrder.setSelectedItem(state.compileOrder);
myWarnings.setSelected(state.warnings);
Expand Down Expand Up @@ -270,6 +273,11 @@ public void setProfile(ScalaCompilerSettingsProfile profile) {
mySpecialization.setDisplayedMnemonicIndex(7);
mySpecialization.setToolTipText("Respect @specialize annotations");
panel1.add(mySpecialization, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
myExperimental = new JCheckBox();
myExperimental.setText("Experimental");
myExperimental.setMnemonic('X');
myExperimental.setDisplayedMnemonicIndex(1);
panel1.add(myExperimental, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final TitledSeparator titledSeparator3 = new TitledSeparator();
titledSeparator3.setText("Compiler plugins");
myContentPanel.add(titledSeparator3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
Expand Down
Expand Up @@ -27,6 +27,8 @@ public class ScalaCompilerSettingsState {

public boolean macros = false;

public boolean experimental = false;

public boolean warnings = true;

public boolean deprecationWarnings = false;
Expand Down Expand Up @@ -67,6 +69,7 @@ public boolean equals(Object o) {
higherKinds == that.higherKinds &&
existentials == that.existentials &&
macros == that.macros &&
experimental == that.experimental &&
warnings == that.warnings &&
deprecationWarnings == that.deprecationWarnings &&
uncheckedWarnings == that.uncheckedWarnings &&
Expand Down

0 comments on commit 45075ad

Please sign in to comment.