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

Add compiler pass that discovers ambiguous imports #6868

Merged
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7292123
Add AmbiguousImportAnalysis
Akirathan May 26, 2023
2738138
AmbiguousImportsAnalysis distinguishes between duplicated and ambiguo…
Akirathan May 31, 2023
74cd016
docs
Akirathan May 31, 2023
2590bfa
Merge branch 'develop' into wip/akirathan/6431-ambiguous-aliased-impo…
Akirathan May 31, 2023
9f2851d
Update changelog
Akirathan May 31, 2023
06bdbb1
AmbiguousImportAnalysis uses symbol full paths to determine ambiguity
Akirathan Jun 2, 2023
1325b60
Fix some tests - duplicated import is a warn, not error
Akirathan Jun 2, 2023
d8693b5
Improve compiler's diagnostic messages
Akirathan Jun 2, 2023
08efa41
Rename Extension.enso files
Akirathan Jun 2, 2023
c466b35
Add some docs
Akirathan Jun 5, 2023
cc4a672
Revert "Improve compiler's diagnostic messages"
Akirathan Jun 5, 2023
25f3d48
Remove Sort_Direction ambiguity from Vector.enso
Akirathan Jun 5, 2023
c952d4e
Remove temp debug logging
Akirathan Jun 5, 2023
41a0068
Fix multiple symbol importing.
Akirathan Jun 5, 2023
be394ea
Improve errors collection
Akirathan Jun 5, 2023
6cdc63e
Remove URI ambiguity in HTTP.enso
Akirathan Jun 5, 2023
c46a4ba
Remove duplicate imports
Akirathan Jun 6, 2023
e7cbf0d
Fix PassesTest
Akirathan Jun 6, 2023
c35f8e6
Fix hidden names case
Akirathan Jun 6, 2023
9b00b9b
Remove duplicate imports from Standard.Table
Akirathan Jun 6, 2023
6e817f6
Rename Standard.Test/Extensions to Test_Extensions
Akirathan Jun 6, 2023
b1e5809
Remove some ambiguous imports
Akirathan Jun 6, 2023
fdc9247
Remove some duplicate imports
Akirathan Jun 6, 2023
ca7e22a
Fix some imports after removals
Akirathan Jun 6, 2023
c0611ac
Remove some duplicate imports
Akirathan Jun 7, 2023
e377f17
fmt
Akirathan Jun 7, 2023
4bd05ea
Merge branch 'develop' into wip/akirathan/6431-ambiguous-aliased-impo…
Akirathan Jun 7, 2023
9f85a58
Fix Extensions module renames
Akirathan Jun 8, 2023
727ee80
Merge branch 'develop' into wip/akirathan/6431-ambiguous-aliased-impo…
Akirathan Jun 8, 2023
836b1b3
Fix more ambiguous imports
Akirathan Jun 8, 2023
d4da61c
Remove a Vector duplicate import
Akirathan Jun 8, 2023
1ae1414
Revert "Rename Extension.enso files"
Akirathan Jun 9, 2023
e8810d6
Revert Extensions module renaming
Akirathan Jun 9, 2023
11358e5
Remove duplicate import from a scala test
Akirathan Jun 9, 2023
2a9e19e
typo
Akirathan Jun 9, 2023
4ce6c07
Revert extensions module renaming
Akirathan Jun 9, 2023
0181c4c
Remove some duplicates
Akirathan Jun 9, 2023
3103fe4
Apply suggestions from code review
Akirathan Jun 9, 2023
e1cb0ce
Consistent naming of polyglot java imports
Akirathan Jun 9, 2023
5cb41fc
Hide symbols from more generic imports
Akirathan Jun 9, 2023
78375fa
Move Sort_Direction from Ordering module to Data
Akirathan Jun 9, 2023
7dfdd36
Use more specific imports in Std lib instead of import all
Akirathan Jun 9, 2023
a759efd
Revert examples documentation
Akirathan Jun 9, 2023
102e4f6
Revert extensions module renaming
Akirathan Jun 9, 2023
c99b608
Move Sort_Direction from Ordering module to Data
Akirathan Jun 9, 2023
0cca1a6
Fix after merge
Akirathan Jun 9, 2023
2b49036
Specific symbols are hidden from more generic imports
Akirathan Jun 9, 2023
b36b4b8
Remove unnecessary from.. Extensions import all statements
Akirathan Jun 9, 2023
dd77052
Apply some PR suggestions
Akirathan Jun 12, 2023
45ffd3a
Get rid of some more duplicated imports
Akirathan Jun 13, 2023
71e39e5
typo in docs
Akirathan Jun 13, 2023
608e69e
Fix builtin types test metadata
Akirathan Jun 13, 2023
47697eb
Revert "Get rid of some more duplicated imports"
Akirathan Jun 13, 2023
a0d2daf
Merge branch 'develop' into wip/akirathan/6431-ambiguous-aliased-impo…
Akirathan Jun 13, 2023
354b5f3
Remove unnecessary imports causing duplication warnings
Akirathan Jun 13, 2023
f291dec
Revert "Specific symbols are hidden from more generic imports"
Akirathan Jun 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@
- [Add project creation time to project metadata][6780]
- [Upgrade GraalVM to 22.3.1 JDK17][6750]
- [Ascribed types are checked during runtime][6790]
- [Add compiler pass that discovers ambiguous and duplicated symbols][6868]
- [Improve and colorize compiler's diagnostic messages][6931]

[3227]: https://github.com/enso-org/enso/pull/3227
Expand Down Expand Up @@ -930,6 +931,7 @@
[6755]: https://github.com/enso-org/enso/pull/6755
[6780]: https://github.com/enso-org/enso/pull/6780
[6790]: https://github.com/enso-org/enso/pull/6790
[6868]: https://github.com/enso-org/enso/pull/6868
[6931]: https://github.com/enso-org/enso/pull/6931

# Enso 2.0.0-alpha.18 (2021-10-12)
Expand Down
2 changes: 1 addition & 1 deletion distribution/lib/Standard/Base/0.0.0-dev/src/Any.enso
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import project.Data.Pair.Pair
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Error.Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import project.Data.List.List
import project.Data.Ordering.Ordering
import project.Data.Ordering.Sort_Direction.Sort_Direction
import project.Data.Pair.Pair
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Text
import project.Data.Vector.Vector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import project.Any.Any
import project.Data.Boolean.Boolean
import project.Data.Text.Case_Sensitivity.Case_Sensitivity
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Regex
import project.Data.Text.Text
import project.Data.Vector.Vector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import project.Any.Any
import project.Data.Numbers.Integer
import project.Data.Range.Range
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Errors.Common.Index_Out_Of_Bounds
Expand Down
6 changes: 3 additions & 3 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data/Json.enso
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import project.Any.Any
import project.Data.Array.Array
import project.Data.Array_Proxy.Array_Proxy
import project.Data.Json.Extensions
import project.Data.Json.Json_Extensions
import project.Data.Map.Map
import project.Data.Numbers.Integer
import project.Data.Numbers.Number
import project.Data.Pair.Pair
import project.Data.Range.Extensions
import project.Data.Text.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Errors.Common.Type_Error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import project.Data.Map.Map
import project.Data.Numbers.Decimal
import project.Data.Numbers.Integer
import project.Data.Numbers.Number
import project.Data.Range.Extensions
import project.Data.Text.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Data.Text.Text_Sub_Range.Text_Sub_Range
import project.Data.Vector.Vector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import project.Any.Any
import project.Data.Filter_Condition.Filter_Condition
import project.Data.Text.Case.Case
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Metadata.Display
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import project.Any.Any
import project.Data.Numbers.Integer
import project.Data.Vector.Vector
import project.Data.Pair.Pair
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Error.Error
import project.Errors.Illegal_Argument.Illegal_Argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import project.Any.Any
import project.Data.Boolean.Boolean
import project.Data.Numbers.Integer
import project.Data.Text.Text
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Vector.Vector
import project.Errors.Common.Index_Out_Of_Bounds
import project.Errors.Common.Not_Found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import project.Data.Numbers.Integer
import project.Data.Ordering.Comparable
import project.Data.Ordering.Ordering
import project.Data.Vector.Vector
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Errors.Illegal_Argument.Illegal_Argument
import project.Nothing.Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import project.Data.Numbers.Integer
import project.Data.Numbers.Number
import project.Data.Ordering.Ordering
import project.Data.Ordering.Comparable
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Vector.Vector
import project.Errors.Common.Incomparable_Values
import project.Error.Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import project.Any.Any
import project.Data.Map.Map
import project.Data.Numbers.Integer
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Regex.No_Such_Group
import project.Data.Text.Regex.Pattern.Pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import project.Any.Any
import project.Data.Filter_Condition.Filter_Condition
import project.Data.Map.Map
import project.Data.Numbers.Integer
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
Akirathan marked this conversation as resolved.
Show resolved Hide resolved
import project.Data.Text.Helpers
import project.Data.Text.Span.Span
import project.Data.Text.Span.Utf_16_Span
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import project.Data.Numbers.Integer
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Regex
import project.Data.Text.Regex.Match.Match
import project.Data.Text.Regex.No_Such_Group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import project.Data.Numbers.Integer
import project.Data.Pair.Pair
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Text
import project.Errors.Common.Index_Out_Of_Bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import project.Any.Any
import project.Data.Array.Array
import project.Data.Index_Sub_Range.Index_Sub_Range
import project.Data.Locale.Locale
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Case.Case
import project.Data.Text.Case_Sensitivity.Case_Sensitivity
Expand Down Expand Up @@ -38,7 +38,6 @@ import project.Nothing.Nothing
from project.Data.Boolean import Boolean, True, False
from project.Data.Json import Json, Invalid_JSON, JS_Object
from project.Data.Numbers import Decimal, Integer, Number, Number_Parse_Error
from project.Data.Text.Text_Sub_Range import Codepoint_Ranges, Text_Sub_Range

from project.Widget_Helpers import make_delimiter_selector

Expand Down Expand Up @@ -1458,14 +1457,14 @@ Text.parse_json self = Json.parse self
> Example
Parse the date of 23rd December 2020.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-12-23".parse_date

> Example
Recover from an error due to a wrong format.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions
from Standard.Base.Errors.Common import Time_Error

example_parse_err = "my birthday".parse_date . catch Time_Error _->
Expand All @@ -1474,14 +1473,14 @@ Text.parse_json self = Json.parse self
> Example
Parse "1999-1-1" as Date using a custom format.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "1999-1-1".parse_date "yyyy-M-d"

> Example
Recover from the parse error.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions
from Standard.Base.Errors.Common import Time_Error

example_parse_err =
Expand Down Expand Up @@ -1526,49 +1525,49 @@ Text.parse_date self format=Nothing = Date.parse self format
> Example
Parse UTC time.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-10-01T04:11:12Z".parse_date_time

> Example
Parse UTC-04:00 time.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-10-01T04:11:12-04:00".parse_date_time

> Example
Parse UTC-04:00 time specifying New York timezone.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-10-01T04:11:12-04:00[America/New_York]".parse_date_time

> Example
Parse UTC-04:00 time with nanoseconds.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-10-01T04:11:12.177528-04:00".parse_date_time

> Example
Recover from the parse error.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-10-01".parse_date_time . catch Time_Error (_->Date_Time.now)

> Example
Parse "2020-05-06 04:30:20" as Date_Time

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "2020-05-06 04:30:20".parse_date_time "yyyy-MM-dd HH:mm:ss"

> Example
Parse "06 of May 2020 at 04:30AM" as Date_Tme

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse =
"06 of May 2020 at 04:30AM".parse_date_time "dd 'of' MMMM yyyy 'at' hh:mma"
Expand Down Expand Up @@ -1615,14 +1614,14 @@ Text.parse_date_time self format=Nothing locale=Locale.default = Date_Time.parse
> Example
Get the time 15:05:30.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "15:05:30".parse_time_of_day

> Example
Recover from the parse error.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions
from Standard.Base.Errors.Common import Time_Error

example_parse = "half twelve".parse_time_of_day . catch Time_Error _->
Expand All @@ -1631,14 +1630,14 @@ Text.parse_date_time self format=Nothing locale=Locale.default = Date_Time.parse
> Example
Parse "04:30:20" as Time_Of_Day.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "04:30:20".parse_time_of_day "HH:mm:ss"

> Example
Parse "4:30AM" as Time_Of_Day

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "4:30AM".parse_time_of_day "h:mma"
@locale Locale.default_widget
Expand All @@ -1652,28 +1651,28 @@ Text.parse_time_of_day self format=Nothing locale=Locale.default = Time_Of_Day.p
> Example
Get Central European Time.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "CET".parse_time_zone

> Example
Get Moscow time.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "Europe/Moscow".parse_time_zone

> Example
Get time zone -06:00.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "-06:00".parse_time_zone

> Example
Get custom offset +03:02:01 of 3 hours 2 minutes an 1 second.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "+03:02:01".parse_time_zone
Text.parse_time_zone : Time_Zone ! Time_Error
Expand All @@ -1688,7 +1687,7 @@ Text.parse_time_zone self = Time_Zone.parse self
> Example
Parse URI text.

import Standard.Base.Data.Text.Extensions
import Standard.Base.Data.Text.Text_Extensions

example_parse = "http://example.com".parse_uri
Text.parse_uri : URI ! Syntax_Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import project.Data.Index_Sub_Range.Index_Sub_Range
import project.Data.Numbers.Integer
import project.Data.Pair.Pair
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Range.Range
import project.Data.Text.Text
import project.Data.Vector.Vector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import project.Data.Filter_Condition.Filter_Condition
import project.Data.Json.JS_Object
import project.Data.Numbers.Integer
import project.Data.Range.Empty_Error
import project.Data.Range.Extensions
import project.Data.Range.Range_Extensions
import project.Data.Text.Text
import project.Data.Time.Date.Date
import project.Data.Time.Date_Period.Date_Period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import project.Data.Numbers.Decimal
import project.Data.Numbers.Integer
import project.Data.Ordering.Comparable
import project.Data.Pair.Pair
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Data.Time.Date_Time.Date_Time
import project.Data.Time.Period.Period
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import project.Any.Any
import project.Data.Json.JS_Object
import project.Data.Numbers.Integer
import project.Data.Ordering.Comparable
import project.Data.Text.Extensions
import project.Data.Text.Text_Extensions
import project.Data.Text.Text
import project.Data.Time.Date.Date
import project.Data.Time.Duration.Duration
Expand Down
Loading