-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a test case for generics, re-adds generics data to the search index, and tweaks function indexing to use less space in JSON. This reverts commit 14ca894.
- Loading branch information
Showing
8 changed files
with
191 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const QUERY = '<'; | ||
|
||
const EXPECTED = { | ||
'others': [ | ||
{ 'name': 'Ord' }, | ||
], | ||
}; |
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,23 @@ | ||
const QUERY = [ | ||
'Result<SomeTrait>', | ||
'OtherThingxxxxxxxx', | ||
]; | ||
|
||
const EXPECTED = [ | ||
{ | ||
'in_args': [ | ||
{ 'path': 'generics_trait', 'name': 'beta' }, | ||
], | ||
'returned': [ | ||
{ 'path': 'generics_trait', 'name': 'bet' }, | ||
], | ||
}, | ||
{ | ||
'in_args': [ | ||
{ 'path': 'generics_trait', 'name': 'alpha' }, | ||
], | ||
'returned': [ | ||
{ 'path': 'generics_trait', 'name': 'alef' }, | ||
], | ||
}, | ||
]; |
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,8 @@ | ||
pub trait SomeTrait {} | ||
pub trait OtherThingxxxxxxxx {} | ||
|
||
pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> { loop {} } | ||
pub fn bet<T: SomeTrait>() -> Result<T, ()> { loop {} } | ||
|
||
pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) { loop {} } | ||
pub fn beta<T: SomeTrait>(_param: Result<T, ()>) { loop {} } |
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,44 @@ | ||
// exact-check | ||
|
||
const QUERY = [ | ||
'"R<P>"', | ||
'"P"', | ||
'P', | ||
'"ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>"', | ||
]; | ||
|
||
const EXPECTED = [ | ||
{ | ||
'returned': [ | ||
{ 'path': 'generics', 'name': 'alef' }, | ||
], | ||
'in_args': [ | ||
{ 'path': 'generics', 'name': 'alpha' }, | ||
], | ||
}, | ||
{ | ||
'others': [ | ||
{ 'path': 'generics', 'name': 'P' }, | ||
], | ||
'returned': [ | ||
{ 'path': 'generics', 'name': 'alef' }, | ||
], | ||
'in_args': [ | ||
{ 'path': 'generics', 'name': 'alpha' }, | ||
], | ||
}, | ||
{ | ||
'returned': [ | ||
{ 'path': 'generics', 'name': 'alef' }, | ||
], | ||
'in_args': [ | ||
{ 'path': 'generics', 'name': 'alpha' }, | ||
], | ||
}, | ||
{ | ||
'in_args': [ | ||
{ 'path': 'generics', 'name': 'extracreditlabhomework' }, | ||
], | ||
'returned': [], | ||
}, | ||
]; |
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,21 @@ | ||
pub struct P; | ||
pub struct Q; | ||
pub struct R<T>(T); | ||
|
||
// returns test | ||
pub fn alef() -> R<P> { loop {} } | ||
pub fn bet() -> R<Q> { loop {} } | ||
|
||
// in_args test | ||
pub fn alpha(_x: R<P>) { loop {} } | ||
pub fn beta(_x: R<Q>) { loop {} } | ||
|
||
// test case with multiple appearances of the same type | ||
pub struct ExtraCreditStructMulti<T, U> { t: T, u: U } | ||
pub struct ExtraCreditInnerMulti {} | ||
pub fn extracreditlabhomework( | ||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti> | ||
) { loop {} } | ||
pub fn redherringmatchforextracredit( | ||
_param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()> | ||
) { loop {} } |