Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent Scopes from extending other Scopes
- Loading branch information
1 parent
1d90d28
commit 2400b50
Showing
14 changed files
with
270 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# 0.3.2-SNAPSHOT | ||
|
||
* Throw a compiler error when a Scope extends another Scope | ||
|
||
# 0.3.1 | ||
|
||
* No changes | ||
|
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
31 changes: 31 additions & 0 deletions
31
errormessage/src/main/kotlin/motif/errormessage/ScopeExtendsScopeMethodHandler.kt
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,31 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package motif.errormessage | ||
|
||
import motif.models.ScopeExtendsScope | ||
|
||
class ScopeExtendsScopeMethodHandler(private val error: ScopeExtendsScope) : ErrorHandler { | ||
|
||
override val name = "SCOPE EXTENDS SCOPE" | ||
|
||
override fun StringBuilder.handle() { | ||
appendln(""" | ||
Scopes can't extend other Scopes: | ||
${error.scope.qualifiedName} | ||
""".trimIndent()) | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
tests/src/main/java/testcases/E057_scope_extends_scope/BarScope.java
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,19 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.E057_scope_extends_scope; | ||
|
||
@motif.Scope | ||
public interface BarScope {} |
24 changes: 24 additions & 0 deletions
24
tests/src/main/java/testcases/E057_scope_extends_scope/ERROR.txt
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,24 @@ | ||
######################################################################## | ||
# # | ||
# This file is auto-generated by running the Motif compiler tests and # | ||
# serves both as validation of error correctness and as a record of # | ||
# the current compiler error output. # | ||
# # | ||
# - Do not edit manually. # | ||
# - Commit changes to source control. # | ||
# - Since this file is autogenerated, code review changes carefully to # | ||
# ensure correctness. # | ||
# # | ||
######################################################################## | ||
|
||
==================================== | ||
Motif Errors | ||
==================================== | ||
|
||
[SCOPE EXTENDS SCOPE] | ||
|
||
Scopes can't extend other Scopes: | ||
|
||
testcases.E057_scope_extends_scope.FooScope | ||
|
||
==================================== |
19 changes: 19 additions & 0 deletions
19
tests/src/main/java/testcases/E057_scope_extends_scope/FooScope.java
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,19 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.E057_scope_extends_scope; | ||
|
||
@motif.Scope | ||
public interface FooScope extends BarScope {} |
39 changes: 39 additions & 0 deletions
39
tests/src/main/java/testcases/E057_scope_extends_scope/GRAPH.txt
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,39 @@ | ||
######################################################################## | ||
# # | ||
# This file is auto-generated by running the Motif compiler tests and # | ||
# serves a as validation of graph correctness. IntelliJ plugin tests # | ||
# also rely on this file to ensure that the plugin graph understanding # | ||
# is equivalent to the compiler's. # | ||
# # | ||
# - Do not edit manually. # | ||
# - Commit changes to source control. # | ||
# - Since this file is autogenerated, code review changes carefully to # | ||
# ensure correctness. # | ||
# # | ||
######################################################################## | ||
|
||
---------- | ||
| BarScope | | ||
---------- | ||
|
||
==== Required ==== | ||
|
||
==== Provides ==== | ||
|
||
---- BarScope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
---------- | ||
| FooScope | | ||
---------- | ||
|
||
==== Required ==== | ||
|
||
==== Provides ==== | ||
|
||
---- FooScope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
|
19 changes: 19 additions & 0 deletions
19
tests/src/main/java/testcases/E058_scope_extends_scope_intermediate_class/BarScope.java
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,19 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.E058_scope_extends_scope_intermediate_class; | ||
|
||
@motif.Scope | ||
public interface BarScope {} |
24 changes: 24 additions & 0 deletions
24
tests/src/main/java/testcases/E058_scope_extends_scope_intermediate_class/ERROR.txt
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,24 @@ | ||
######################################################################## | ||
# # | ||
# This file is auto-generated by running the Motif compiler tests and # | ||
# serves both as validation of error correctness and as a record of # | ||
# the current compiler error output. # | ||
# # | ||
# - Do not edit manually. # | ||
# - Commit changes to source control. # | ||
# - Since this file is autogenerated, code review changes carefully to # | ||
# ensure correctness. # | ||
# # | ||
######################################################################## | ||
|
||
==================================== | ||
Motif Errors | ||
==================================== | ||
|
||
[SCOPE EXTENDS SCOPE] | ||
|
||
Scopes can't extend other Scopes: | ||
|
||
testcases.E058_scope_extends_scope_intermediate_class.FooScope | ||
|
||
==================================== |
19 changes: 19 additions & 0 deletions
19
tests/src/main/java/testcases/E058_scope_extends_scope_intermediate_class/FooScope.java
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,19 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.E058_scope_extends_scope_intermediate_class; | ||
|
||
@motif.Scope | ||
public interface FooScope extends Intermediate {} |
39 changes: 39 additions & 0 deletions
39
tests/src/main/java/testcases/E058_scope_extends_scope_intermediate_class/GRAPH.txt
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,39 @@ | ||
######################################################################## | ||
# # | ||
# This file is auto-generated by running the Motif compiler tests and # | ||
# serves a as validation of graph correctness. IntelliJ plugin tests # | ||
# also rely on this file to ensure that the plugin graph understanding # | ||
# is equivalent to the compiler's. # | ||
# # | ||
# - Do not edit manually. # | ||
# - Commit changes to source control. # | ||
# - Since this file is autogenerated, code review changes carefully to # | ||
# ensure correctness. # | ||
# # | ||
######################################################################## | ||
|
||
---------- | ||
| BarScope | | ||
---------- | ||
|
||
==== Required ==== | ||
|
||
==== Provides ==== | ||
|
||
---- BarScope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
---------- | ||
| FooScope | | ||
---------- | ||
|
||
==== Required ==== | ||
|
||
==== Provides ==== | ||
|
||
---- FooScope | implicit ---- | ||
[ Required ] | ||
[ Consumed By ] | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
tests/src/main/java/testcases/E058_scope_extends_scope_intermediate_class/Intermediate.java
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,18 @@ | ||
/* | ||
* Copyright (c) 2018-2019 Uber Technologies, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package testcases.E058_scope_extends_scope_intermediate_class; | ||
|
||
public interface Intermediate extends BarScope {} |